<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ethereum EIPs</title>
    <description>A feed of all EIPs</description>
    <link>https://ercs.ethereum.org</link>
    <atom:link href="https://ercs.ethereum.org/all.xml" rel="self" type="application/rss+xml" />
    <lastBuildDate>Wed, 22 Apr 2026 15:00:24 +0000</lastBuildDate>
    
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
  .container {
    margin: 10px auto;
    max-width: 600px;
    text-align: center;
  }
  h1 {
    margin: 30px 0;
    font-size: 4em;
    line-height: 1;
    letter-spacing: -1px;
  }
&lt;/style&gt;

&lt;div class=&quot;container&quot;&gt;
  &lt;h1&gt;404&lt;/h1&gt;
  &lt;p&gt;&lt;strong&gt;Page not found :(&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;The requested page could not be found.&lt;/p&gt;
&lt;/div&gt;
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/404</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/404</guid>
      </item>
    
      <item>
        <title>All</title>
        <category>/</category>
        
        <description>&lt;style type=&quot;text/css&quot;&gt;
  .eiptable .title {
    width: 67%;
  }

  .eiptable .author {
    width: 33%;
  }
&lt;/style&gt;

  
  
  
    &lt;h2 id=&quot;living&quot;&gt;Living&lt;/h2&gt;
    &lt;table class=&quot;eiptable&quot;&gt;
      &lt;thead&gt;
        
          &lt;tr&gt;&lt;th class=&quot;eipnum&quot;&gt;Number&lt;/th&gt;&lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;&lt;th class=&quot;author&quot;&gt;Author&lt;/th&gt;&lt;/tr&gt;
        
      &lt;/thead&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/eip-1&quot;&gt;1&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;EIP Purpose and Guidelines&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Martin Becze&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mb@ethereum.org&quot;&gt;mb@ethereum.org&lt;/a&gt;&amp;gt;, Hudson Jameson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:hudson@ethereum.org&quot;&gt;hudson@ethereum.org&lt;/a&gt;&amp;gt;,  et al.&lt;/td&gt;
        &lt;/tr&gt;
      
    &lt;/table&gt;
  

  
  
  
    &lt;h2 id=&quot;final&quot;&gt;Final&lt;/h2&gt;
    &lt;table class=&quot;eiptable&quot;&gt;
      &lt;thead&gt;
        
          &lt;tr&gt;&lt;th class=&quot;eipnum&quot;&gt;Number&lt;/th&gt;&lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;&lt;th class=&quot;author&quot;&gt;Author&lt;/th&gt;&lt;/tr&gt;
        
      &lt;/thead&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-20&quot;&gt;20&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Fabian Vogelsteller&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:fabian@ethereum.org&quot;&gt;fabian@ethereum.org&lt;/a&gt;&amp;gt;, Vitalik Buterin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:vitalik.buterin@ethereum.org&quot;&gt;vitalik.buterin@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-55&quot;&gt;55&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Mixed-case checksum address encoding&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Vitalik Buterin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:vitalik.buterin@ethereum.org&quot;&gt;vitalik.buterin@ethereum.org&lt;/a&gt;&amp;gt;, Alex Van de Sande&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:avsa@ethereum.org&quot;&gt;avsa@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-137&quot;&gt;137&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum Domain Name Service - Specification&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:arachnid@notdot.net&quot;&gt;arachnid@notdot.net&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-162&quot;&gt;162&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Initial ENS Hash Registrar&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Maurelian, Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@ethereum.org&quot;&gt;nick@ethereum.org&lt;/a&gt;&amp;gt;, Alex Van de Sande&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:avsa@ethereum.org&quot;&gt;avsa@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-165&quot;&gt;165&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Standard Interface Detection&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Christian Reitwießner&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chris@ethereum.org&quot;&gt;chris@ethereum.org&lt;/a&gt;&amp;gt;, Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@ethereum.org&quot;&gt;nick@ethereum.org&lt;/a&gt;&amp;gt;, Fabian Vogelsteller&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:fabian@lukso.network&quot;&gt;fabian@lukso.network&lt;/a&gt;&amp;gt;, Jordi Baylina&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jordi@baylina.cat&quot;&gt;jordi@baylina.cat&lt;/a&gt;&amp;gt;, Konrad Feldmeier&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:konrad.feldmeier@brainbot.com&quot;&gt;konrad.feldmeier@brainbot.com&lt;/a&gt;&amp;gt;, William Entriken&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:github.com@phor.net&quot;&gt;github.com@phor.net&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-173&quot;&gt;173&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract Ownership Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Mudge&amp;nbsp;(&lt;a href=&quot;https://github.com/mudgen&quot;&gt;@mudgen&lt;/a&gt;), Dan Finlay&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dan@danfinlay.com&quot;&gt;dan@danfinlay.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-181&quot;&gt;181&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ENS support for reverse resolution of Ethereum addresses&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:arachnid@notdot.net&quot;&gt;arachnid@notdot.net&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-190&quot;&gt;190&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum Smart Contract Packaging Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Piper Merriam&amp;nbsp;(&lt;a href=&quot;https://github.com/pipermerriam&quot;&gt;@pipermerriam&lt;/a&gt;), Tim Coulter&amp;nbsp;(&lt;a href=&quot;https://github.com/tcoulter&quot;&gt;@tcoulter&lt;/a&gt;), Denis Erfurt&amp;nbsp;(&lt;a href=&quot;https://github.com/mhhf&quot;&gt;@mhhf&lt;/a&gt;), RJ Catalano&amp;nbsp;(&lt;a href=&quot;https://github.com/VoR0220&quot;&gt;@VoR0220&lt;/a&gt;), Iuri Matias&amp;nbsp;(&lt;a href=&quot;https://github.com/iurimatias&quot;&gt;@iurimatias&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-191&quot;&gt;191&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Signed Data Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Martin Holst Swende&amp;nbsp;(&lt;a href=&quot;https://github.com/holiman&quot;&gt;@holiman&lt;/a&gt;), Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:arachnid@notdot.net&quot;&gt;arachnid@notdot.net&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-223&quot;&gt;223&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token with transaction handling model&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Dexaran (@Dexaran)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dexaran@ethereumclassic.org&quot;&gt;dexaran@ethereumclassic.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-600&quot;&gt;600&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum purpose allocation for Deterministic Wallets&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;), Micah Zoltu&amp;nbsp;(&lt;a href=&quot;https://github.com/micahzoltu&quot;&gt;@micahzoltu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-601&quot;&gt;601&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum hierarchy for deterministic wallets&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;), Micah Zoltu&amp;nbsp;(&lt;a href=&quot;https://github.com/micahzoltu&quot;&gt;@micahzoltu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-681&quot;&gt;681&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;URL Format for Transaction Requests&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Daniel A. Nagy&amp;nbsp;(&lt;a href=&quot;https://github.com/nagydani&quot;&gt;@nagydani&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-721&quot;&gt;721&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-Fungible Token Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;William Entriken&amp;nbsp;(&lt;a href=&quot;https://github.com/fulldecent&quot;&gt;@fulldecent&lt;/a&gt;), Dieter Shirley&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dete@axiomzen.co&quot;&gt;dete@axiomzen.co&lt;/a&gt;&amp;gt;, Jacob Evans&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jacob@dekz.net&quot;&gt;jacob@dekz.net&lt;/a&gt;&amp;gt;, Nastassia Sachs&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nastassia.sachs@protonmail.com&quot;&gt;nastassia.sachs@protonmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-777&quot;&gt;777&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jacques Dafflon&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mail@0xjac.com&quot;&gt;mail@0xjac.com&lt;/a&gt;&amp;gt;, Jordi Baylina&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jordi@baylina.cat&quot;&gt;jordi@baylina.cat&lt;/a&gt;&amp;gt;, Thomas Shababi&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:tom@truelevel.io&quot;&gt;tom@truelevel.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-820&quot;&gt;820&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Pseudo-introspection Registry Contract&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jordi Baylina&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jordi@baylina.cat&quot;&gt;jordi@baylina.cat&lt;/a&gt;&amp;gt;, Jacques Dafflon&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jacques@dafflon.tech&quot;&gt;jacques@dafflon.tech&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1046&quot;&gt;1046&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;tokenURI Interoperability&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Tommy Nicholas&amp;nbsp;(&lt;a href=&quot;https://github.com/tomasienrbc&quot;&gt;@tomasienrbc&lt;/a&gt;), Matt Russo&amp;nbsp;(&lt;a href=&quot;https://github.com/mateosu&quot;&gt;@mateosu&lt;/a&gt;), John Zettler&amp;nbsp;(&lt;a href=&quot;https://github.com/JohnZettler&quot;&gt;@JohnZettler&lt;/a&gt;), Matt Condon&amp;nbsp;(&lt;a href=&quot;https://github.com/shrugs&quot;&gt;@shrugs&lt;/a&gt;), Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1155&quot;&gt;1155&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi Token Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Witek Radomski&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:witek@enjin.io&quot;&gt;witek@enjin.io&lt;/a&gt;&amp;gt;, Andrew Cooke&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ac0dem0nk3y@gmail.com&quot;&gt;ac0dem0nk3y@gmail.com&lt;/a&gt;&amp;gt;, Philippe Castonguay (@phabc)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:pc@horizongames.net&quot;&gt;pc@horizongames.net&lt;/a&gt;&amp;gt;, James Therien&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:james@turing-complete.com&quot;&gt;james@turing-complete.com&lt;/a&gt;&amp;gt;, Eric Binet&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:eric@enjin.io&quot;&gt;eric@enjin.io&lt;/a&gt;&amp;gt;, Ronan Sandford (@wighawag)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:wighawag@gmail.com&quot;&gt;wighawag@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1167&quot;&gt;1167&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Proxy Contract&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Peter Murray&amp;nbsp;(&lt;a href=&quot;https://github.com/yarrumretep&quot;&gt;@yarrumretep&lt;/a&gt;), Nate Welch&amp;nbsp;(&lt;a href=&quot;https://github.com/flygoing&quot;&gt;@flygoing&lt;/a&gt;), Joe Messerman&amp;nbsp;(&lt;a href=&quot;https://github.com/JAMesserman&quot;&gt;@JAMesserman&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1271&quot;&gt;1271&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Standard Signature Validation Method for Contracts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;), Matt Condon&amp;nbsp;(&lt;a href=&quot;https://github.com/shrugs&quot;&gt;@shrugs&lt;/a&gt;), Philippe Castonguay&amp;nbsp;(&lt;a href=&quot;https://github.com/PhABC&quot;&gt;@PhABC&lt;/a&gt;), Amir Bandeali&amp;nbsp;(&lt;a href=&quot;https://github.com/abandeali1&quot;&gt;@abandeali1&lt;/a&gt;), Jorge Izquierdo&amp;nbsp;(&lt;a href=&quot;https://github.com/izqui&quot;&gt;@izqui&lt;/a&gt;), Bertrand Masius&amp;nbsp;(&lt;a href=&quot;https://github.com/catageek&quot;&gt;@catageek&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1328&quot;&gt;1328&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;WalletConnect URI Format&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;ligi&amp;nbsp;(&lt;a href=&quot;https://github.com/ligi&quot;&gt;@ligi&lt;/a&gt;), Pedro Gomes&amp;nbsp;(&lt;a href=&quot;https://github.com/pedrouid&quot;&gt;@pedrouid&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1363&quot;&gt;1363&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Payable Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Vittorio Minacori&amp;nbsp;(&lt;a href=&quot;https://github.com/vittominacori&quot;&gt;@vittominacori&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1820&quot;&gt;1820&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Pseudo-introspection Registry Contract&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jordi Baylina&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jordi@baylina.cat&quot;&gt;jordi@baylina.cat&lt;/a&gt;&amp;gt;, Jacques Dafflon&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mail@0xjac.com&quot;&gt;mail@0xjac.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1967&quot;&gt;1967&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Proxy Storage Slots&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Santiago Palladino&amp;nbsp;(&lt;a href=&quot;https://github.com/spalladino&quot;&gt;@spalladino&lt;/a&gt;), Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;), Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2098&quot;&gt;2098&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Compact Signature Representation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Richard Moore&amp;nbsp;(&lt;a href=&quot;https://github.com/ricmoo&quot;&gt;@ricmoo&lt;/a&gt;), Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@ethereum.org&quot;&gt;nick@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2135&quot;&gt;2135&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Consumable Interface (Tickets, etc)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2309&quot;&gt;2309&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Consecutive Transfer Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sean Papanikolas&amp;nbsp;(&lt;a href=&quot;https://github.com/pizzarob&quot;&gt;@pizzarob&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2535&quot;&gt;2535&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Diamonds, Multi-Facet Proxy&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Mudge&amp;nbsp;(&lt;a href=&quot;https://github.com/mudgen&quot;&gt;@mudgen&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2612&quot;&gt;2612&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Permit Extension for EIP-20 Signed Approvals&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Martin Lundfall&amp;nbsp;(&lt;a href=&quot;https://github.com/Mrchico&quot;&gt;@Mrchico&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2678&quot;&gt;2678&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Revised Ethereum Smart Contract Packaging Standard (EthPM v3)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;g. nicholas d’andrea&amp;nbsp;(&lt;a href=&quot;https://github.com/gnidan&quot;&gt;@gnidan&lt;/a&gt;), Piper Merriam&amp;nbsp;(&lt;a href=&quot;https://github.com/pipermerriam&quot;&gt;@pipermerriam&lt;/a&gt;), Nick Gheorghita&amp;nbsp;(&lt;a href=&quot;https://github.com/njgheorghita&quot;&gt;@njgheorghita&lt;/a&gt;), Christian Reitwiessner&amp;nbsp;(&lt;a href=&quot;https://github.com/chriseth&quot;&gt;@chriseth&lt;/a&gt;), Ben Hauser&amp;nbsp;(&lt;a href=&quot;https://github.com/iamdefinitelyahuman&quot;&gt;@iamdefinitelyahuman&lt;/a&gt;), Bryant Eisenbach&amp;nbsp;(&lt;a href=&quot;https://github.com/fubuloubu&quot;&gt;@fubuloubu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2771&quot;&gt;2771&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Secure Protocol for Native Meta Transactions&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ronan Sandford&amp;nbsp;(&lt;a href=&quot;https://github.com/wighawag&quot;&gt;@wighawag&lt;/a&gt;), Liraz Siri&amp;nbsp;(&lt;a href=&quot;https://github.com/lirazsiri&quot;&gt;@lirazsiri&lt;/a&gt;), Dror Tirosh&amp;nbsp;(&lt;a href=&quot;https://github.com/drortirosh&quot;&gt;@drortirosh&lt;/a&gt;), Yoav Weiss&amp;nbsp;(&lt;a href=&quot;https://github.com/yoavw&quot;&gt;@yoavw&lt;/a&gt;), Alex Forshtat&amp;nbsp;(&lt;a href=&quot;https://github.com/forshtat&quot;&gt;@forshtat&lt;/a&gt;), Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;), Sachin Tomar&amp;nbsp;(&lt;a href=&quot;https://github.com/tomarsachin2271&quot;&gt;@tomarsachin2271&lt;/a&gt;), Patrick McCorry&amp;nbsp;(&lt;a href=&quot;https://github.com/stonecoldpat&quot;&gt;@stonecoldpat&lt;/a&gt;), Nicolas Venturo&amp;nbsp;(&lt;a href=&quot;https://github.com/nventuro&quot;&gt;@nventuro&lt;/a&gt;), Fabian Vogelsteller&amp;nbsp;(&lt;a href=&quot;https://github.com/frozeman&quot;&gt;@frozeman&lt;/a&gt;), Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2981&quot;&gt;2981&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Royalty Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zach Burks&amp;nbsp;(&lt;a href=&quot;https://github.com/vexycats&quot;&gt;@vexycats&lt;/a&gt;), James Morgan&amp;nbsp;(&lt;a href=&quot;https://github.com/jamesmorgan&quot;&gt;@jamesmorgan&lt;/a&gt;), Blaine Malone&amp;nbsp;(&lt;a href=&quot;https://github.com/blmalone&quot;&gt;@blmalone&lt;/a&gt;), James Seibel&amp;nbsp;(&lt;a href=&quot;https://github.com/seibelj&quot;&gt;@seibelj&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3156&quot;&gt;3156&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Flash Loans&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alberto Cuesta Cañada&amp;nbsp;(&lt;a href=&quot;https://github.com/alcueca&quot;&gt;@alcueca&lt;/a&gt;), Fiona Kobayashi&amp;nbsp;(&lt;a href=&quot;https://github.com/fifikobayashi&quot;&gt;@fifikobayashi&lt;/a&gt;), fubuloubu&amp;nbsp;(&lt;a href=&quot;https://github.com/fubuloubu&quot;&gt;@fubuloubu&lt;/a&gt;), Austin Williams&amp;nbsp;(&lt;a href=&quot;https://github.com/onewayfunction&quot;&gt;@onewayfunction&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3448&quot;&gt;3448&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;MetaProxy Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;pinkiebell&amp;nbsp;(&lt;a href=&quot;https://github.com/pinkiebell&quot;&gt;@pinkiebell&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3475&quot;&gt;3475&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Abstract Storage Bonds&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yu Liu&amp;nbsp;(&lt;a href=&quot;https://github.com/yuliu-debond&quot;&gt;@yuliu-debond&lt;/a&gt;), Varun Deshpande&amp;nbsp;(&lt;a href=&quot;https://github.com/dr-chain&quot;&gt;@dr-chain&lt;/a&gt;), Cedric Ngakam&amp;nbsp;(&lt;a href=&quot;https://github.com/drikssy&quot;&gt;@drikssy&lt;/a&gt;), Dhruv Malik&amp;nbsp;(&lt;a href=&quot;https://github.com/dhruvmalik007&quot;&gt;@dhruvmalik007&lt;/a&gt;), Samuel Gwlanold Edoumou&amp;nbsp;(&lt;a href=&quot;https://github.com/Edoumou&quot;&gt;@Edoumou&lt;/a&gt;), Toufic Batrice&amp;nbsp;(&lt;a href=&quot;https://github.com/toufic0710&quot;&gt;@toufic0710&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3525&quot;&gt;3525&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Semi-Fungible Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Will Wang&amp;nbsp;(&lt;a href=&quot;https://github.com/will42w&quot;&gt;@will42w&lt;/a&gt;), Mike Meng&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:myan@solv.finance&quot;&gt;myan@solv.finance&lt;/a&gt;&amp;gt;, Yi Cai (@YeeTsai)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:yee.tsai@gmail.com&quot;&gt;yee.tsai@gmail.com&lt;/a&gt;&amp;gt;, Ryan Chow&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ryanchow@solv.finance&quot;&gt;ryanchow@solv.finance&lt;/a&gt;&amp;gt;, Zhongxin Wu&amp;nbsp;(&lt;a href=&quot;https://github.com/Nerverwind&quot;&gt;@Nerverwind&lt;/a&gt;), AlvisDu&amp;nbsp;(&lt;a href=&quot;https://github.com/AlvisDu&quot;&gt;@AlvisDu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3643&quot;&gt;3643&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;T-REX - Token for Regulated EXchanges&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Joachim Lebrun&amp;nbsp;(&lt;a href=&quot;https://github.com/Joachim-Lebrun&quot;&gt;@Joachim-Lebrun&lt;/a&gt;), Tony Malghem&amp;nbsp;(&lt;a href=&quot;https://github.com/TonyMalghem&quot;&gt;@TonyMalghem&lt;/a&gt;), Kevin Thizy&amp;nbsp;(&lt;a href=&quot;https://github.com/Nakasar&quot;&gt;@Nakasar&lt;/a&gt;), Luc Falempin&amp;nbsp;(&lt;a href=&quot;https://github.com/lfalempin&quot;&gt;@lfalempin&lt;/a&gt;), Adam Boudjemaa&amp;nbsp;(&lt;a href=&quot;https://github.com/Aboudjem&quot;&gt;@Aboudjem&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3668&quot;&gt;3668&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;CCIP Read—Secure offchain data retrieval&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4361&quot;&gt;4361&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Sign-In with Ethereum&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Wayne Chang&amp;nbsp;(&lt;a href=&quot;https://github.com/wyc&quot;&gt;@wyc&lt;/a&gt;), Gregory Rocco&amp;nbsp;(&lt;a href=&quot;https://github.com/obstropolos&quot;&gt;@obstropolos&lt;/a&gt;), Brantly Millegan&amp;nbsp;(&lt;a href=&quot;https://github.com/brantlymillegan&quot;&gt;@brantlymillegan&lt;/a&gt;), Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/Arachnid&quot;&gt;@Arachnid&lt;/a&gt;), Oliver Terbu&amp;nbsp;(&lt;a href=&quot;https://github.com/awoie&quot;&gt;@awoie&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4400&quot;&gt;4400&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;EIP-721 Consumable Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Daniel Ivanov&amp;nbsp;(&lt;a href=&quot;https://github.com/Daniel-K-Ivanov&quot;&gt;@Daniel-K-Ivanov&lt;/a&gt;), George Spasov&amp;nbsp;(&lt;a href=&quot;https://github.com/Perseverance&quot;&gt;@Perseverance&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4519&quot;&gt;4519&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-Fungible Tokens Tied to Physical Assets&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Javier Arcenegui&amp;nbsp;(&lt;a href=&quot;https://github.com/Hardblock-IMSE-CNM&quot;&gt;@Hardblock-IMSE-CNM&lt;/a&gt;), Rosario Arjona&amp;nbsp;(&lt;a href=&quot;https://github.com/RosarioArjona&quot;&gt;@RosarioArjona&lt;/a&gt;), Roberto Román&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:roman@imse-cnm.csic.es&quot;&gt;roman@imse-cnm.csic.es&lt;/a&gt;&amp;gt;, Iluminada Baturone&amp;nbsp;(&lt;a href=&quot;https://github.com/lumi2018&quot;&gt;@lumi2018&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4626&quot;&gt;4626&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Tokenized Vaults&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Joey Santoro&amp;nbsp;(&lt;a href=&quot;https://github.com/joeysantoro&quot;&gt;@joeysantoro&lt;/a&gt;), t11s&amp;nbsp;(&lt;a href=&quot;https://github.com/transmissions11&quot;&gt;@transmissions11&lt;/a&gt;), Jet Jadeja&amp;nbsp;(&lt;a href=&quot;https://github.com/JetJadeja&quot;&gt;@JetJadeja&lt;/a&gt;), Alberto Cuesta Cañada&amp;nbsp;(&lt;a href=&quot;https://github.com/alcueca&quot;&gt;@alcueca&lt;/a&gt;), Señor Doggo&amp;nbsp;(&lt;a href=&quot;https://github.com/fubuloubu&quot;&gt;@fubuloubu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4804&quot;&gt;4804&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Web3 URL to EVM Call Message Translation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Qi Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;), Chao Pi&amp;nbsp;(&lt;a href=&quot;https://github.com/pichaoqkc&quot;&gt;@pichaoqkc&lt;/a&gt;), Sam Wilson&amp;nbsp;(&lt;a href=&quot;https://github.com/SamWilsn&quot;&gt;@SamWilsn&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4834&quot;&gt;4834&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Hierarchical Domains&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4906&quot;&gt;4906&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;EIP-721 Metadata Update Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Anders&amp;nbsp;(&lt;a href=&quot;https://github.com/0xanders&quot;&gt;@0xanders&lt;/a&gt;), Lance&amp;nbsp;(&lt;a href=&quot;https://github.com/LanceSnow&quot;&gt;@LanceSnow&lt;/a&gt;), Shrug&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shrug@emojidao.org&quot;&gt;shrug@emojidao.org&lt;/a&gt;&amp;gt;, Nathan&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nathan.gang@gemini.com&quot;&gt;nathan.gang@gemini.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4907&quot;&gt;4907&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Rental NFT, an Extension of EIP-721&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Anders&amp;nbsp;(&lt;a href=&quot;https://github.com/0xanders&quot;&gt;@0xanders&lt;/a&gt;), Lance&amp;nbsp;(&lt;a href=&quot;https://github.com/LanceSnow&quot;&gt;@LanceSnow&lt;/a&gt;), Shrug&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shrug@emojidao.org&quot;&gt;shrug@emojidao.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4910&quot;&gt;4910&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Royalty Bearing NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Andreas Freund&amp;nbsp;(&lt;a href=&quot;https://github.com/Therecanbeonlyone1969&quot;&gt;@Therecanbeonlyone1969&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4955&quot;&gt;4955&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Vendor Metadata Extension for NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ignacio Mazzara&amp;nbsp;(&lt;a href=&quot;https://github.com/nachomazzara&quot;&gt;@nachomazzara&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5006&quot;&gt;5006&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Rental NFT, NFT User Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lance&amp;nbsp;(&lt;a href=&quot;https://github.com/LanceSnow&quot;&gt;@LanceSnow&lt;/a&gt;), Anders&amp;nbsp;(&lt;a href=&quot;https://github.com/0xanders&quot;&gt;@0xanders&lt;/a&gt;), Shrug&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shrug@emojidao.org&quot;&gt;shrug@emojidao.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5007&quot;&gt;5007&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Time NFT, ERC-721 Time Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Anders&amp;nbsp;(&lt;a href=&quot;https://github.com/0xanders&quot;&gt;@0xanders&lt;/a&gt;), Lance&amp;nbsp;(&lt;a href=&quot;https://github.com/LanceSnow&quot;&gt;@LanceSnow&lt;/a&gt;), Shrug&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shrug@emojidao.org&quot;&gt;shrug@emojidao.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5023&quot;&gt;5023&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Shareable Non-Fungible Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jarno Marttila&amp;nbsp;(&lt;a href=&quot;https://github.com/yaruno&quot;&gt;@yaruno&lt;/a&gt;), Martin Moravek&amp;nbsp;(&lt;a href=&quot;https://github.com/mmartinmo&quot;&gt;@mmartinmo&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5169&quot;&gt;5169&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Client Script URI for Token Contracts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;James&amp;nbsp;(&lt;a href=&quot;https://github.com/JamesSmartCell&quot;&gt;@JamesSmartCell&lt;/a&gt;), Weiwu&amp;nbsp;(&lt;a href=&quot;https://github.com/weiwu-zhang&quot;&gt;@weiwu-zhang&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5192&quot;&gt;5192&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Soulbound NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Tim Daubenschütz&amp;nbsp;(&lt;a href=&quot;https://github.com/TimDaub&quot;&gt;@TimDaub&lt;/a&gt;), Anders&amp;nbsp;(&lt;a href=&quot;https://github.com/0xanders&quot;&gt;@0xanders&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5202&quot;&gt;5202&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Blueprint contract format&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Charles Cooper&amp;nbsp;(&lt;a href=&quot;https://github.com/charles-cooper&quot;&gt;@charles-cooper&lt;/a&gt;), Edward Amor&amp;nbsp;(&lt;a href=&quot;https://github.com/skellet0r&quot;&gt;@skellet0r&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5219&quot;&gt;5219&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract Resource Requests&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5267&quot;&gt;5267&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Retrieval of EIP-712 domain&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5313&quot;&gt;5313&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Light Contract Ownership&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;William Entriken&amp;nbsp;(&lt;a href=&quot;https://github.com/fulldecent&quot;&gt;@fulldecent&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5375&quot;&gt;5375&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Author Information and Consent&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Samuele Marro&amp;nbsp;(&lt;a href=&quot;https://github.com/samuelemarro&quot;&gt;@samuelemarro&lt;/a&gt;), Luca Donno&amp;nbsp;(&lt;a href=&quot;https://github.com/lucadonnoh&quot;&gt;@lucadonnoh&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5380&quot;&gt;5380&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Entitlement Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;), Tim Daubenschütz&amp;nbsp;(&lt;a href=&quot;https://github.com/TimDaub&quot;&gt;@TimDaub&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5484&quot;&gt;5484&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Consensual Soulbound Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Buzz Cai&amp;nbsp;(&lt;a href=&quot;https://github.com/buzzcai&quot;&gt;@buzzcai&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5489&quot;&gt;5489&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Hyperlink Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;IronMan_CH&amp;nbsp;(&lt;a href=&quot;https://github.com/coderfengyun&quot;&gt;@coderfengyun&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5507&quot;&gt;5507&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Refundable Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;elie222&amp;nbsp;(&lt;a href=&quot;https://github.com/elie222&quot;&gt;@elie222&lt;/a&gt;), Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5521&quot;&gt;5521&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Referable NFT&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Saber Yu&amp;nbsp;(&lt;a href=&quot;https://github.com/OniReimu&quot;&gt;@OniReimu&lt;/a&gt;), Qin Wang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:qin.wang@data61.csiro.au&quot;&gt;qin.wang@data61.csiro.au&lt;/a&gt;&amp;gt;, Shange Fu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shange.fu@monash.edu&quot;&gt;shange.fu@monash.edu&lt;/a&gt;&amp;gt;, Yilin Sai&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:yilin.sai@data61.csiro.au&quot;&gt;yilin.sai@data61.csiro.au&lt;/a&gt;&amp;gt;, Shiping Chen&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shiping.chen@data61.csiro.au&quot;&gt;shiping.chen@data61.csiro.au&lt;/a&gt;&amp;gt;, Sherry Xu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:xiwei.xu@data61.csiro.au&quot;&gt;xiwei.xu@data61.csiro.au&lt;/a&gt;&amp;gt;, Jiangshan Yu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jiangshan.yu@monash.edu&quot;&gt;jiangshan.yu@monash.edu&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5528&quot;&gt;5528&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Refundable Fungible Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;StartfundInc&amp;nbsp;(&lt;a href=&quot;https://github.com/StartfundInc&quot;&gt;@StartfundInc&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5564&quot;&gt;5564&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Stealth Addresses&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Toni Wahrstätter&amp;nbsp;(&lt;a href=&quot;https://github.com/nerolation&quot;&gt;@nerolation&lt;/a&gt;), Matt Solomon&amp;nbsp;(&lt;a href=&quot;https://github.com/mds1&quot;&gt;@mds1&lt;/a&gt;), Ben DiFrancesco&amp;nbsp;(&lt;a href=&quot;https://github.com/apbendi&quot;&gt;@apbendi&lt;/a&gt;), Vitalik Buterin&amp;nbsp;(&lt;a href=&quot;https://github.com/vbuterin&quot;&gt;@vbuterin&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5570&quot;&gt;5570&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Digital Receipt Non-Fungible Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sean Darcy&amp;nbsp;(&lt;a href=&quot;https://github.com/darcys22&quot;&gt;@darcys22&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5585&quot;&gt;5585&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 NFT Authorization&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Veega Labs&amp;nbsp;(&lt;a href=&quot;https://github.com/VeegaLabsOfficial&quot;&gt;@VeegaLabsOfficial&lt;/a&gt;), Sean NG&amp;nbsp;(&lt;a href=&quot;https://github.com/ngveega&quot;&gt;@ngveega&lt;/a&gt;), Tiger&amp;nbsp;(&lt;a href=&quot;https://github.com/tiger0x&quot;&gt;@tiger0x&lt;/a&gt;), Fred&amp;nbsp;(&lt;a href=&quot;https://github.com/apan826&quot;&gt;@apan826&lt;/a&gt;), Fov Cao&amp;nbsp;(&lt;a href=&quot;https://github.com/fovcao&quot;&gt;@fovcao&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5606&quot;&gt;5606&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multiverse NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gaurang Torvekar&amp;nbsp;(&lt;a href=&quot;https://github.com/gaurangtorvekar&quot;&gt;@gaurangtorvekar&lt;/a&gt;), Khemraj Adhawade&amp;nbsp;(&lt;a href=&quot;https://github.com/akhemraj&quot;&gt;@akhemraj&lt;/a&gt;), Nikhil Asrani&amp;nbsp;(&lt;a href=&quot;https://github.com/nikhilasrani&quot;&gt;@nikhilasrani&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5615&quot;&gt;5615&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-1155 Supply Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5625&quot;&gt;5625&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Metadata JSON Schema dStorage Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin Fu&amp;nbsp;(&lt;a href=&quot;https://github.com/gavfu&quot;&gt;@gavfu&lt;/a&gt;), Leo Wang&amp;nbsp;(&lt;a href=&quot;https://github.com/wanglie1986&quot;&gt;@wanglie1986&lt;/a&gt;), Bova Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/appoipp&quot;&gt;@appoipp&lt;/a&gt;), Guang Han&amp;nbsp;(&lt;a href=&quot;https://github.com/pangwa&quot;&gt;@pangwa&lt;/a&gt;), Brian Wu&amp;nbsp;(&lt;a href=&quot;https://github.com/wuhaixian1984&quot;&gt;@wuhaixian1984&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5646&quot;&gt;5646&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token State Fingerprint&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Naim Ashhab&amp;nbsp;(&lt;a href=&quot;https://github.com/ashhanai&quot;&gt;@ashhanai&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5679&quot;&gt;5679&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Minting and Burning&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5725&quot;&gt;5725&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Transferable Vesting NFT&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Apeguru&amp;nbsp;(&lt;a href=&quot;https://github.com/Apegurus&quot;&gt;@Apegurus&lt;/a&gt;), Marco De Vries&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:marco@paladinsec.co&quot;&gt;marco@paladinsec.co&lt;/a&gt;&amp;gt;, Mario&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mario@paladinsec.co&quot;&gt;mario@paladinsec.co&lt;/a&gt;&amp;gt;, DeFiFoFum&amp;nbsp;(&lt;a href=&quot;https://github.com/DeFiFoFum&quot;&gt;@DeFiFoFum&lt;/a&gt;), Elliott Green&amp;nbsp;(&lt;a href=&quot;https://github.com/elliott-green&quot;&gt;@elliott-green&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5732&quot;&gt;5732&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Commit Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;), Matt Stam&amp;nbsp;(&lt;a href=&quot;https://github.com/mattstam&quot;&gt;@mattstam&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5750&quot;&gt;5750&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;General Extensibility for Method Behaviors&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5773&quot;&gt;5773&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Context-Dependent Multi-Asset Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bruno Škvorc&amp;nbsp;(&lt;a href=&quot;https://github.com/Swader&quot;&gt;@Swader&lt;/a&gt;), Cicada&amp;nbsp;(&lt;a href=&quot;https://github.com/CicadaNCR&quot;&gt;@CicadaNCR&lt;/a&gt;), Steven Pineda&amp;nbsp;(&lt;a href=&quot;https://github.com/steven2308&quot;&gt;@steven2308&lt;/a&gt;), Stevan Bogosavljevic&amp;nbsp;(&lt;a href=&quot;https://github.com/stevyhacker&quot;&gt;@stevyhacker&lt;/a&gt;), Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6059&quot;&gt;6059&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Parent-Governed Nestable Non-Fungible Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bruno Škvorc&amp;nbsp;(&lt;a href=&quot;https://github.com/Swader&quot;&gt;@Swader&lt;/a&gt;), Cicada&amp;nbsp;(&lt;a href=&quot;https://github.com/CicadaNCR&quot;&gt;@CicadaNCR&lt;/a&gt;), Steven Pineda&amp;nbsp;(&lt;a href=&quot;https://github.com/steven2308&quot;&gt;@steven2308&lt;/a&gt;), Stevan Bogosavljevic&amp;nbsp;(&lt;a href=&quot;https://github.com/stevyhacker&quot;&gt;@stevyhacker&lt;/a&gt;), Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6066&quot;&gt;6066&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Signature Validation Method for NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jack Boyuan Xu&amp;nbsp;(&lt;a href=&quot;https://github.com/boyuanx&quot;&gt;@boyuanx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6093&quot;&gt;6093&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Custom errors for commonly-used tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;), Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;), Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6105&quot;&gt;6105&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;No Intermediary NFT Trading Protocol&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;5660-eth&amp;nbsp;(&lt;a href=&quot;https://github.com/5660-eth&quot;&gt;@5660-eth&lt;/a&gt;), Silvere Heraudeau&amp;nbsp;(&lt;a href=&quot;https://github.com/lambdalf-dev&quot;&gt;@lambdalf-dev&lt;/a&gt;), Martin McConnell&amp;nbsp;(&lt;a href=&quot;https://github.com/offgridgecko&quot;&gt;@offgridgecko&lt;/a&gt;), Abu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:team10kuni@gmail.com&quot;&gt;team10kuni@gmail.com&lt;/a&gt;&amp;gt;,  Wizard Wang&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6147&quot;&gt;6147&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Guard of NFT/SBT, an Extension of ERC-721&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;5660-eth&amp;nbsp;(&lt;a href=&quot;https://github.com/5660-eth&quot;&gt;@5660-eth&lt;/a&gt;),  Wizard Wang&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6150&quot;&gt;6150&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Hierarchical NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Keegan Lee&amp;nbsp;(&lt;a href=&quot;https://github.com/keeganlee&quot;&gt;@keeganlee&lt;/a&gt;), msfew&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:msfew@hyperoracle.io&quot;&gt;msfew@hyperoracle.io&lt;/a&gt;&amp;gt;, Kartin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kartin@hyperoracle.io&quot;&gt;kartin@hyperoracle.io&lt;/a&gt;&amp;gt;, qizhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6220&quot;&gt;6220&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Composable NFTs utilizing Equippable Parts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bruno Škvorc&amp;nbsp;(&lt;a href=&quot;https://github.com/Swader&quot;&gt;@Swader&lt;/a&gt;), Cicada&amp;nbsp;(&lt;a href=&quot;https://github.com/CicadaNCR&quot;&gt;@CicadaNCR&lt;/a&gt;), Steven Pineda&amp;nbsp;(&lt;a href=&quot;https://github.com/steven2308&quot;&gt;@steven2308&lt;/a&gt;), Stevan Bogosavljevic&amp;nbsp;(&lt;a href=&quot;https://github.com/stevyhacker&quot;&gt;@stevyhacker&lt;/a&gt;), Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6239&quot;&gt;6239&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Semantic Soulbound Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jessica Chang&amp;nbsp;(&lt;a href=&quot;https://github.com/JessicaChg&quot;&gt;@JessicaChg&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6381&quot;&gt;6381&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Public Non-Fungible Token Emote Repository&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bruno Škvorc&amp;nbsp;(&lt;a href=&quot;https://github.com/Swader&quot;&gt;@Swader&lt;/a&gt;), Steven Pineda&amp;nbsp;(&lt;a href=&quot;https://github.com/steven2308&quot;&gt;@steven2308&lt;/a&gt;), Stevan Bogosavljevic&amp;nbsp;(&lt;a href=&quot;https://github.com/stevyhacker&quot;&gt;@stevyhacker&lt;/a&gt;), Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6454&quot;&gt;6454&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Transferable NFT detection interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bruno Škvorc&amp;nbsp;(&lt;a href=&quot;https://github.com/Swader&quot;&gt;@Swader&lt;/a&gt;), Francesco Sullo&amp;nbsp;(&lt;a href=&quot;https://github.com/sullof&quot;&gt;@sullof&lt;/a&gt;), Steven Pineda&amp;nbsp;(&lt;a href=&quot;https://github.com/steven2308&quot;&gt;@steven2308&lt;/a&gt;), Stevan Bogosavljevic&amp;nbsp;(&lt;a href=&quot;https://github.com/stevyhacker&quot;&gt;@stevyhacker&lt;/a&gt;), Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6492&quot;&gt;6492&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Signature Validation for Predeploy Contracts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ivo Georgiev&amp;nbsp;(&lt;a href=&quot;https://github.com/Ivshti&quot;&gt;@Ivshti&lt;/a&gt;), Agustin Aguilar&amp;nbsp;(&lt;a href=&quot;https://github.com/Agusx1211&quot;&gt;@Agusx1211&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6538&quot;&gt;6538&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Stealth Meta-Address Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Matt Solomon&amp;nbsp;(&lt;a href=&quot;https://github.com/mds1&quot;&gt;@mds1&lt;/a&gt;), Toni Wahrstätter&amp;nbsp;(&lt;a href=&quot;https://github.com/nerolation&quot;&gt;@nerolation&lt;/a&gt;), Ben DiFrancesco&amp;nbsp;(&lt;a href=&quot;https://github.com/apbendi&quot;&gt;@apbendi&lt;/a&gt;), Vitalik Buterin&amp;nbsp;(&lt;a href=&quot;https://github.com/vbuterin&quot;&gt;@vbuterin&lt;/a&gt;), Gary Ghayrat&amp;nbsp;(&lt;a href=&quot;https://github.com/garyghayrat&quot;&gt;@garyghayrat&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6672&quot;&gt;6672&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-redeemable NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;RE:DREAMER Lab&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dev@redreamer.io&quot;&gt;dev@redreamer.io&lt;/a&gt;&amp;gt;, Archie Chang (@ArchieR7)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:archie@redreamer.io&quot;&gt;archie@redreamer.io&lt;/a&gt;&amp;gt;, Kai Yu (@chihkaiyu)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kai@redreamer.io&quot;&gt;kai@redreamer.io&lt;/a&gt;&amp;gt;, Yonathan Randyanto (@Randyanto)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:randy@redreamer.io&quot;&gt;randy@redreamer.io&lt;/a&gt;&amp;gt;, Boyu Chu (@chuboyu)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:boyu@redreamer.io&quot;&gt;boyu@redreamer.io&lt;/a&gt;&amp;gt;, Boxi Li (@boxi79)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:boxi@redreamer.io&quot;&gt;boxi@redreamer.io&lt;/a&gt;&amp;gt;, Jason Cheng (@JasonCheng0729)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jason@redreamer.io&quot;&gt;jason@redreamer.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6808&quot;&gt;6808&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Fungible Key Bound Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Mihai Onila&amp;nbsp;(&lt;a href=&quot;https://github.com/MihaiORO&quot;&gt;@MihaiORO&lt;/a&gt;), Nick Zeman&amp;nbsp;(&lt;a href=&quot;https://github.com/NickZCZ&quot;&gt;@NickZCZ&lt;/a&gt;), Narcis Cotaie&amp;nbsp;(&lt;a href=&quot;https://github.com/NarcisCRO&quot;&gt;@NarcisCRO&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6809&quot;&gt;6809&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-Fungible Key Bound Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Mihai Onila&amp;nbsp;(&lt;a href=&quot;https://github.com/MihaiORO&quot;&gt;@MihaiORO&lt;/a&gt;), Nick Zeman&amp;nbsp;(&lt;a href=&quot;https://github.com/NickZCZ&quot;&gt;@NickZCZ&lt;/a&gt;), Narcis Cotaie&amp;nbsp;(&lt;a href=&quot;https://github.com/NarcisCRO&quot;&gt;@NarcisCRO&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6909&quot;&gt;6909&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Multi-Token Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;JT Riley&amp;nbsp;(&lt;a href=&quot;https://github.com/jtriley2p&quot;&gt;@jtriley2p&lt;/a&gt;), Dillon&amp;nbsp;(&lt;a href=&quot;https://github.com/d1ll0n&quot;&gt;@d1ll0n&lt;/a&gt;), Sara&amp;nbsp;(&lt;a href=&quot;https://github.com/snreynolds&quot;&gt;@snreynolds&lt;/a&gt;), Vectorized&amp;nbsp;(&lt;a href=&quot;https://github.com/Vectorized&quot;&gt;@Vectorized&lt;/a&gt;), Neodaoist&amp;nbsp;(&lt;a href=&quot;https://github.com/neodaoist&quot;&gt;@neodaoist&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6982&quot;&gt;6982&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Efficient Default Lockable Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Francesco Sullo&amp;nbsp;(&lt;a href=&quot;https://github.com/sullof&quot;&gt;@sullof&lt;/a&gt;), Alexe Spataru&amp;nbsp;(&lt;a href=&quot;https://github.com/urataps&quot;&gt;@urataps&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7007&quot;&gt;7007&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Verifiable AI-Generated Content Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Cathie So&amp;nbsp;(&lt;a href=&quot;https://github.com/socathie&quot;&gt;@socathie&lt;/a&gt;), Xiaohang Yu&amp;nbsp;(&lt;a href=&quot;https://github.com/xhyumiracle&quot;&gt;@xhyumiracle&lt;/a&gt;), Conway&amp;nbsp;(&lt;a href=&quot;https://github.com/0x1cc&quot;&gt;@0x1cc&lt;/a&gt;), Lee Ting Ting&amp;nbsp;(&lt;a href=&quot;https://github.com/tina1998612&quot;&gt;@tina1998612&lt;/a&gt;), Kartin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kartin@hyperoracle.io&quot;&gt;kartin@hyperoracle.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7053&quot;&gt;7053&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Interoperable Digital Media Indexing&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bofu Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/bafu&quot;&gt;@bafu&lt;/a&gt;), Tammy Yang&amp;nbsp;(&lt;a href=&quot;https://github.com/tammyyang&quot;&gt;@tammyyang&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7066&quot;&gt;7066&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Lockable Extension for ERC-721&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Piyush Chittara&amp;nbsp;(&lt;a href=&quot;https://github.com/piyush-chittara&quot;&gt;@piyush-chittara&lt;/a&gt;), StreamNFT&amp;nbsp;(&lt;a href=&quot;https://github.com/streamnft-tech&quot;&gt;@streamnft-tech&lt;/a&gt;), Srinivas Joshi&amp;nbsp;(&lt;a href=&quot;https://github.com/SrinivasJoshi&quot;&gt;@SrinivasJoshi&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7092&quot;&gt;7092&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Financial Bonds&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Samuel Gwlanold Edoumou&amp;nbsp;(&lt;a href=&quot;https://github.com/Edoumou&quot;&gt;@Edoumou&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7160&quot;&gt;7160&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Multi-Metadata Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;0xG&amp;nbsp;(&lt;a href=&quot;https://github.com/0xGh&quot;&gt;@0xGh&lt;/a&gt;), Marco Peyfuss&amp;nbsp;(&lt;a href=&quot;https://github.com/mpeyfuss&quot;&gt;@mpeyfuss&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7201&quot;&gt;7201&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Namespaced Storage Layout&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;), Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;), Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;), Eric Lau&amp;nbsp;(&lt;a href=&quot;https://github.com/ericglau&quot;&gt;@ericglau&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7208&quot;&gt;7208&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;On-Chain Data Containers&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Rachid Ajaja&amp;nbsp;(&lt;a href=&quot;https://github.com/abrajaja&quot;&gt;@abrajaja&lt;/a&gt;), Matthijs de Vries&amp;nbsp;(&lt;a href=&quot;https://github.com/sudomati&quot;&gt;@sudomati&lt;/a&gt;), Alexandros Athanasopulos&amp;nbsp;(&lt;a href=&quot;https://github.com/Xaleee&quot;&gt;@Xaleee&lt;/a&gt;), Pavel Rubin&amp;nbsp;(&lt;a href=&quot;https://github.com/pash7ka&quot;&gt;@pash7ka&lt;/a&gt;), Sebastian Galimberti Romano&amp;nbsp;(&lt;a href=&quot;https://github.com/galimba&quot;&gt;@galimba&lt;/a&gt;), Daniel Berbesi&amp;nbsp;(&lt;a href=&quot;https://github.com/berbex&quot;&gt;@berbex&lt;/a&gt;), Apostolos Mavropoulos&amp;nbsp;(&lt;a href=&quot;https://github.com/ApostolosMavro&quot;&gt;@ApostolosMavro&lt;/a&gt;), Barbara Marcano&amp;nbsp;(&lt;a href=&quot;https://github.com/Barbara-Marcano&quot;&gt;@Barbara-Marcano&lt;/a&gt;), Daniel Ortega&amp;nbsp;(&lt;a href=&quot;https://github.com/xdaniortega&quot;&gt;@xdaniortega&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7231&quot;&gt;7231&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Identity-aggregated NFT&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chloe Gu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chloe@carv.io&quot;&gt;chloe@carv.io&lt;/a&gt;&amp;gt;, Navid X.&amp;nbsp;(&lt;a href=&quot;https://github.com/xuxinlai2002&quot;&gt;@xuxinlai2002&lt;/a&gt;), Victor Yu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:victor@carv.io&quot;&gt;victor@carv.io&lt;/a&gt;&amp;gt;,  Archer H.&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7291&quot;&gt;7291&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Purpose bound money&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Orchid-Dev&amp;nbsp;(&lt;a href=&quot;https://github.com/proj-orchid-straitsx&quot;&gt;@proj-orchid-straitsx&lt;/a&gt;), Victor Liew&amp;nbsp;(&lt;a href=&quot;https://github.com/alcedo&quot;&gt;@alcedo&lt;/a&gt;), Wong Tse Jian&amp;nbsp;(&lt;a href=&quot;https://github.com/wongtsejian&quot;&gt;@wongtsejian&lt;/a&gt;), Jacob Shan&amp;nbsp;(&lt;a href=&quot;https://github.com/Jacobshan429&quot;&gt;@Jacobshan429&lt;/a&gt;), Chin Sin Ong&amp;nbsp;(&lt;a href=&quot;https://github.com/chinsinong&quot;&gt;@chinsinong&lt;/a&gt;), Praveen Kumar&amp;nbsp;(&lt;a href=&quot;https://github.com/veenkumarr&quot;&gt;@veenkumarr&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7401&quot;&gt;7401&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Parent-Governed Non-Fungible Tokens Nesting&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bruno Škvorc&amp;nbsp;(&lt;a href=&quot;https://github.com/Swader&quot;&gt;@Swader&lt;/a&gt;), Cicada&amp;nbsp;(&lt;a href=&quot;https://github.com/CicadaNCR&quot;&gt;@CicadaNCR&lt;/a&gt;), Steven Pineda&amp;nbsp;(&lt;a href=&quot;https://github.com/steven2308&quot;&gt;@steven2308&lt;/a&gt;), Stevan Bogosavljevic&amp;nbsp;(&lt;a href=&quot;https://github.com/stevyhacker&quot;&gt;@stevyhacker&lt;/a&gt;), Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7409&quot;&gt;7409&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Public Non-Fungible Tokens Emote Repository&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bruno Škvorc&amp;nbsp;(&lt;a href=&quot;https://github.com/Swader&quot;&gt;@Swader&lt;/a&gt;), Steven Pineda&amp;nbsp;(&lt;a href=&quot;https://github.com/steven2308&quot;&gt;@steven2308&lt;/a&gt;), Stevan Bogosavljevic&amp;nbsp;(&lt;a href=&quot;https://github.com/stevyhacker&quot;&gt;@stevyhacker&lt;/a&gt;), Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7432&quot;&gt;7432&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-Fungible Token Roles&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ernani São Thiago&amp;nbsp;(&lt;a href=&quot;https://github.com/ernanirst&quot;&gt;@ernanirst&lt;/a&gt;), Daniel Lima&amp;nbsp;(&lt;a href=&quot;https://github.com/karacurt&quot;&gt;@karacurt&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7439&quot;&gt;7439&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Prevent ticket touting&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;LeadBest Consulting Group&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:service@getoken.io&quot;&gt;service@getoken.io&lt;/a&gt;&amp;gt;, Sandy Sung&amp;nbsp;(&lt;a href=&quot;https://github.com/sandy-sung-lb&quot;&gt;@sandy-sung-lb&lt;/a&gt;), Mars Peng&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mars.peng@getoken.io&quot;&gt;mars.peng@getoken.io&lt;/a&gt;&amp;gt;, Taien Wang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:taien.wang@getoken.io&quot;&gt;taien.wang@getoken.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7528&quot;&gt;7528&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ETH (Native Asset) Address Convention&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Joey Santoro&amp;nbsp;(&lt;a href=&quot;https://github.com/joeysantoro&quot;&gt;@joeysantoro&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7535&quot;&gt;7535&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Native Asset ERC-4626 Tokenized Vault&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Joey Santoro&amp;nbsp;(&lt;a href=&quot;https://github.com/joeysantoro&quot;&gt;@joeysantoro&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7540&quot;&gt;7540&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Asynchronous ERC-4626 Tokenized Vaults&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jeroen Offerijns&amp;nbsp;(&lt;a href=&quot;https://github.com/hieronx&quot;&gt;@hieronx&lt;/a&gt;), Alina Sinelnikova&amp;nbsp;(&lt;a href=&quot;https://github.com/ilinzweilin&quot;&gt;@ilinzweilin&lt;/a&gt;), Vikram Arun&amp;nbsp;(&lt;a href=&quot;https://github.com/vikramarun&quot;&gt;@vikramarun&lt;/a&gt;), Joey Santoro&amp;nbsp;(&lt;a href=&quot;https://github.com/joeysantoro&quot;&gt;@joeysantoro&lt;/a&gt;), Farhaan Ali&amp;nbsp;(&lt;a href=&quot;https://github.com/0xfarhaan&quot;&gt;@0xfarhaan&lt;/a&gt;), João Martins&amp;nbsp;(&lt;a href=&quot;https://github.com/0xTimepunk&quot;&gt;@0xTimepunk&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7575&quot;&gt;7575&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-Asset ERC-4626 Vaults&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jeroen Offerijns&amp;nbsp;(&lt;a href=&quot;https://github.com/hieronx&quot;&gt;@hieronx&lt;/a&gt;), Alina Sinelnikova&amp;nbsp;(&lt;a href=&quot;https://github.com/ilinzweilin&quot;&gt;@ilinzweilin&lt;/a&gt;), Vikram Arun&amp;nbsp;(&lt;a href=&quot;https://github.com/vikramarun&quot;&gt;@vikramarun&lt;/a&gt;), Joey Santoro&amp;nbsp;(&lt;a href=&quot;https://github.com/joeysantoro&quot;&gt;@joeysantoro&lt;/a&gt;), Farhaan Ali&amp;nbsp;(&lt;a href=&quot;https://github.com/0xfarhaan&quot;&gt;@0xfarhaan&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7578&quot;&gt;7578&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Physical Asset Redemption&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lee Vidor&amp;nbsp;(&lt;a href=&quot;https://github.com/V1d0r&quot;&gt;@V1d0r&lt;/a&gt;), David Tan&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:david@emergentx.org&quot;&gt;david@emergentx.org&lt;/a&gt;&amp;gt;, Lee Smith&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:lee@emergentx.org&quot;&gt;lee@emergentx.org&lt;/a&gt;&amp;gt;, Gabriel Stoica&amp;nbsp;(&lt;a href=&quot;https://github.com/gabrielstoica&quot;&gt;@gabrielstoica&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7588&quot;&gt;7588&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Blob Transactions Metadata JSON Schema&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin Fu&amp;nbsp;(&lt;a href=&quot;https://github.com/gavfu&quot;&gt;@gavfu&lt;/a&gt;), Leo Wang&amp;nbsp;(&lt;a href=&quot;https://github.com/wanglie1986&quot;&gt;@wanglie1986&lt;/a&gt;), Bova Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/appoipp&quot;&gt;@appoipp&lt;/a&gt;), Aiden X&amp;nbsp;(&lt;a href=&quot;https://github.com/4ever9&quot;&gt;@4ever9&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7627&quot;&gt;7627&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Secure Messaging Protocol&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chen Liaoyuan (@chenly)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:cly@kip.pro&quot;&gt;cly@kip.pro&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7631&quot;&gt;7631&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Dual Nature Token Pair&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;vectorized&amp;nbsp;(&lt;a href=&quot;https://github.com/vectorized&quot;&gt;@vectorized&lt;/a&gt;), Thomas&amp;nbsp;(&lt;a href=&quot;https://github.com/0xth0mas&quot;&gt;@0xth0mas&lt;/a&gt;), Quit&amp;nbsp;(&lt;a href=&quot;https://github.com/quitcrypto&quot;&gt;@quitcrypto&lt;/a&gt;), Michael Amadi&amp;nbsp;(&lt;a href=&quot;https://github.com/AmadiMichael&quot;&gt;@AmadiMichael&lt;/a&gt;), cygaar&amp;nbsp;(&lt;a href=&quot;https://github.com/cygaar&quot;&gt;@cygaar&lt;/a&gt;), Harrison&amp;nbsp;(&lt;a href=&quot;https://github.com/pop-punk&quot;&gt;@pop-punk&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7634&quot;&gt;7634&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Limited Transfer Count NFT&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Qin Wang&amp;nbsp;(&lt;a href=&quot;https://github.com/qinwang-git&quot;&gt;@qinwang-git&lt;/a&gt;), Saber Yu&amp;nbsp;(&lt;a href=&quot;https://github.com/OniReimu&quot;&gt;@OniReimu&lt;/a&gt;), Shiping Chen&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shiping.chen@data61.csiro.au&quot;&gt;shiping.chen@data61.csiro.au&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7656&quot;&gt;7656&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Generalized Contract-Linked Services&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Francesco Sullo&amp;nbsp;(&lt;a href=&quot;https://github.com/sullof&quot;&gt;@sullof&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7734&quot;&gt;7734&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Decentralized Identity Verification (DID)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Anushka Yadav (@64anushka)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:64anushka@gmail.com&quot;&gt;64anushka@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7743&quot;&gt;7743&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-Owner Non-Fungible Tokens (MO-NFT)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Cheng Qian (@jamesavechives)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:james.walstonn@gmail.com&quot;&gt;james.walstonn@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7751&quot;&gt;7751&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wrapping of bubbled up reverts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Daniel Gretzke&amp;nbsp;(&lt;a href=&quot;https://github.com/gretzke&quot;&gt;@gretzke&lt;/a&gt;), Sara Reynolds&amp;nbsp;(&lt;a href=&quot;https://github.com/snreynolds&quot;&gt;@snreynolds&lt;/a&gt;), Alice Henshaw&amp;nbsp;(&lt;a href=&quot;https://github.com/hensha256&quot;&gt;@hensha256&lt;/a&gt;), Marko Veniger&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:marko.veniger@tenderly.co&quot;&gt;marko.veniger@tenderly.co&lt;/a&gt;&amp;gt;, Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7786&quot;&gt;7786&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross-Chain Messaging Gateway&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;), Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;), Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;), CJ Cobb&amp;nbsp;(&lt;a href=&quot;https://github.com/cjcobb23&quot;&gt;@cjcobb23&lt;/a&gt;), Sergey Gorbunov&amp;nbsp;(&lt;a href=&quot;https://github.com/sergeynog&quot;&gt;@sergeynog&lt;/a&gt;), joxes&amp;nbsp;(&lt;a href=&quot;https://github.com/Joxess&quot;&gt;@Joxess&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7818&quot;&gt;7818&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Expirable ERC-20&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;sirawt&amp;nbsp;(&lt;a href=&quot;https://github.com/MASDXI&quot;&gt;@MASDXI&lt;/a&gt;), ADISAKBOONMARK&amp;nbsp;(&lt;a href=&quot;https://github.com/ADISAKBOONMARK&quot;&gt;@ADISAKBOONMARK&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7820&quot;&gt;7820&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Access Control Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Shubham Khandelwal&amp;nbsp;(&lt;a href=&quot;https://github.com/shubh-ta&quot;&gt;@shubh-ta&lt;/a&gt;), Anushka Yadav&amp;nbsp;(&lt;a href=&quot;https://github.com/anushka642000&quot;&gt;@anushka642000&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7837&quot;&gt;7837&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Diffusive Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Cheng Qian (@jamesavechives)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:james.walstonn@gmail.com&quot;&gt;james.walstonn@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7857&quot;&gt;7857&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;AI Agents NFT with Private Metadata&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ming Wu&amp;nbsp;(&lt;a href=&quot;https://github.com/sparkmiw&quot;&gt;@sparkmiw&lt;/a&gt;), Jason Zeng&amp;nbsp;(&lt;a href=&quot;https://github.com/zenghbo&quot;&gt;@zenghbo&lt;/a&gt;), Wei Wu&amp;nbsp;(&lt;a href=&quot;https://github.com/Wilbert957&quot;&gt;@Wilbert957&lt;/a&gt;), Michael Heinrich&amp;nbsp;(&lt;a href=&quot;https://github.com/michaelomg&quot;&gt;@michaelomg&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7858&quot;&gt;7858&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Expirable NFTs and SBTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;sirawt&amp;nbsp;(&lt;a href=&quot;https://github.com/MASDXI&quot;&gt;@MASDXI&lt;/a&gt;), ADISAKBOONMARK&amp;nbsp;(&lt;a href=&quot;https://github.com/ADISAKBOONMARK&quot;&gt;@ADISAKBOONMARK&lt;/a&gt;), parametprame&amp;nbsp;(&lt;a href=&quot;https://github.com/parametprame&quot;&gt;@parametprame&lt;/a&gt;), Nacharoen&amp;nbsp;(&lt;a href=&quot;https://github.com/najaroen&quot;&gt;@najaroen&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7878&quot;&gt;7878&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Bequeathable Contracts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Wamith Mockbill&amp;nbsp;(&lt;a href=&quot;https://github.com/wamith&quot;&gt;@wamith&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7893&quot;&gt;7893&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;DeFi Protocol Solvency Proof Mechanism&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sean Luis Guada Rodríguez (@SeanLuis)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:seanluis47@gmail.com&quot;&gt;seanluis47@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7908&quot;&gt;7908&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;HD wallet In Treasury Management&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Xiaoyu Liu (@elizabethxiaoyu)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jiushi.lxy@antgroup.com&quot;&gt;jiushi.lxy@antgroup.com&lt;/a&gt;&amp;gt;, Yuxiang Fu (@tmac4096)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kunfu.fyx@antgroup.com&quot;&gt;kunfu.fyx@antgroup.com&lt;/a&gt;&amp;gt;, Yanyi Liang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:eason.lyy@antgroup.com&quot;&gt;eason.lyy@antgroup.com&lt;/a&gt;&amp;gt;, Hao Zou (@BruceZH0915)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:situ.zh@antgroup.com&quot;&gt;situ.zh@antgroup.com&lt;/a&gt;&amp;gt;, Siyuan Zheng (@andrewcoder666)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:zhengsiyuan.zsy@antgroup.com&quot;&gt;zhengsiyuan.zsy@antgroup.com&lt;/a&gt;&amp;gt;, yuanshanhshan (@xunayuan)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:yuanshanshan.yss@antgroup.com&quot;&gt;yuanshanshan.yss@antgroup.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7913&quot;&gt;7913&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Signature Verifiers&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;), Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;), Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;), Aryeh Greenberg&amp;nbsp;(&lt;a href=&quot;https://github.com/arr00&quot;&gt;@arr00&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7950&quot;&gt;7950&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Encode chain id with transaction hash&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lauri Peltonen&amp;nbsp;(&lt;a href=&quot;https://github.com/microbecode&quot;&gt;@microbecode&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7994&quot;&gt;7994&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Purpose-Bound ERC-20 with Conditional Unlock&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Anushka Yadav&amp;nbsp;(&lt;a href=&quot;https://github.com/64anushka&quot;&gt;@64anushka&lt;/a&gt;), Akash Kothawade&amp;nbsp;(&lt;a href=&quot;https://github.com/akash3927&quot;&gt;@akash3927&lt;/a&gt;), Atishek Singh&amp;nbsp;(&lt;a href=&quot;https://github.com/atisheksingh&quot;&gt;@atisheksingh&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8001&quot;&gt;8001&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Agent Coordination Framework&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kwame Bryan&amp;nbsp;(&lt;a href=&quot;https://github.com/KBryan&quot;&gt;@KBryan&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8034&quot;&gt;8034&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Referable NFT Royalties&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ruiqiang Li (@richard-620)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:richard.620.research@gmail.com&quot;&gt;richard.620.research@gmail.com&lt;/a&gt;&amp;gt;, Qin Wang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:qin.wang@data61.csiro.au&quot;&gt;qin.wang@data61.csiro.au&lt;/a&gt;&amp;gt;, Shiping Chen&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shiping.chen@data61.csiro.au&quot;&gt;shiping.chen@data61.csiro.au&lt;/a&gt;&amp;gt;, Saber Yu&amp;nbsp;(&lt;a href=&quot;https://github.com/OniReimu&quot;&gt;@OniReimu&lt;/a&gt;), Brian Yecies&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:byecies@uow.edu.au&quot;&gt;byecies@uow.edu.au&lt;/a&gt;&amp;gt;, John Le&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:johnle@uow.edu.au&quot;&gt;johnle@uow.edu.au&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8042&quot;&gt;8042&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Diamond Storage&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Mudge&amp;nbsp;(&lt;a href=&quot;https://github.com/mudgen&quot;&gt;@mudgen&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8063&quot;&gt;8063&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Groups - Membership Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Cheng Qian (@jamesavechives)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:contact@deakee.com&quot;&gt;contact@deakee.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
    &lt;/table&gt;
  

  
  
  
    &lt;h2 id=&quot;last-call&quot;&gt;Last Call&lt;/h2&gt;
    &lt;table class=&quot;eiptable&quot;&gt;
      &lt;thead&gt;
        
          &lt;tr&gt;
          &lt;th class=&quot;eipnum&quot;&gt;Number&lt;/th&gt;&lt;th class=&quot;date&quot;&gt;Review ends&lt;/th&gt;&lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;&lt;th class=&quot;author&quot;&gt;Author&lt;/th&gt;&lt;/tr&gt;
        
      &lt;/thead&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1191&quot;&gt;1191&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2019-11-18&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Add chain id to mixed-case checksum address encoding&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Juliano Rizzo&amp;nbsp;(&lt;a href=&quot;https://github.com/juli&quot;&gt;@juli&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2266&quot;&gt;2266&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2020-12-31&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Atomic Swap-based American Call Option Contract Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Runchao Han&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:runchao.han@monash.edu&quot;&gt;runchao.han@monash.edu&lt;/a&gt;&amp;gt;, Haoyu Lin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chris.haoyul@gmail.com&quot;&gt;chris.haoyul@gmail.com&lt;/a&gt;&amp;gt;, Jiangshan Yu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jiangshan.yu@monash.edu&quot;&gt;jiangshan.yu@monash.edu&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5008&quot;&gt;5008&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2023-08-15&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Nonce Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Anders&amp;nbsp;(&lt;a href=&quot;https://github.com/0xanders&quot;&gt;@0xanders&lt;/a&gt;), Lance&amp;nbsp;(&lt;a href=&quot;https://github.com/LanceSnow&quot;&gt;@LanceSnow&lt;/a&gt;), Shrug&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shrug@emojidao.org&quot;&gt;shrug@emojidao.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5114&quot;&gt;5114&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2023-09-19&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Soulbound Badge&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Micah Zoltu&amp;nbsp;(&lt;a href=&quot;https://github.com/MicahZoltu&quot;&gt;@MicahZoltu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5164&quot;&gt;5164&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2023-11-15&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross-Chain Execution&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Brendan Asselstine&amp;nbsp;(&lt;a href=&quot;https://github.com/asselstine&quot;&gt;@asselstine&lt;/a&gt;), Pierrick Turelier&amp;nbsp;(&lt;a href=&quot;https://github.com/PierrickGT&quot;&gt;@PierrickGT&lt;/a&gt;), Chris Whinfrey&amp;nbsp;(&lt;a href=&quot;https://github.com/cwhinfrey&quot;&gt;@cwhinfrey&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5216&quot;&gt;5216&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2022-11-12&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-1155 Allowance Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Iván Mañús&amp;nbsp;(&lt;a href=&quot;https://github.com/ivanmmurciaua&quot;&gt;@ivanmmurciaua&lt;/a&gt;), Juan Carlos Cantó&amp;nbsp;(&lt;a href=&quot;https://github.com/EscuelaCryptoES&quot;&gt;@EscuelaCryptoES&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5453&quot;&gt;5453&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2023-09-27&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Endorsement - Permit for Any Functions&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5496&quot;&gt;5496&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2022-11-29&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-privilege Management NFT Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jeremy Z&amp;nbsp;(&lt;a href=&quot;https://github.com/wnft&quot;&gt;@wnft&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6224&quot;&gt;6224&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2025-07-31&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contracts Dependencies Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Artem Chystiakov&amp;nbsp;(&lt;a href=&quot;https://github.com/arvolear&quot;&gt;@arvolear&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6357&quot;&gt;6357&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2023-11-10&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Single-contract Multi-delegatecall&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7744&quot;&gt;7744&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2025-07-29&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Code Index&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Tim Pechersky (@peersky)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:t@peersky.xyz&quot;&gt;t@peersky.xyz&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7746&quot;&gt;7746&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2025-07-29&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Composable Security Middleware Hooks&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Tim Pechersky&amp;nbsp;(&lt;a href=&quot;https://github.com/peersky&quot;&gt;@peersky&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7943&quot;&gt;7943&lt;/a&gt;&lt;/td&gt;
          
            &lt;td class=&quot;date&quot;&gt;2026-01-30&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;uRWA - Universal Real World Asset Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Dario Lo Buglio&amp;nbsp;(&lt;a href=&quot;https://github.com/xaler5&quot;&gt;@xaler5&lt;/a&gt;), Tino Martinez Molina&amp;nbsp;(&lt;a href=&quot;https://github.com/tinom9&quot;&gt;@tinom9&lt;/a&gt;), Mihai Colceriu&amp;nbsp;(&lt;a href=&quot;https://github.com/mihaic195&quot;&gt;@mihaic195&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
    &lt;/table&gt;
  

  
  
  
    &lt;h2 id=&quot;review&quot;&gt;Review&lt;/h2&gt;
    &lt;table class=&quot;eiptable&quot;&gt;
      &lt;thead&gt;
        
          &lt;tr&gt;&lt;th class=&quot;eipnum&quot;&gt;Number&lt;/th&gt;&lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;&lt;th class=&quot;author&quot;&gt;Author&lt;/th&gt;&lt;/tr&gt;
        
      &lt;/thead&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1185&quot;&gt;1185&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Storage of DNS Records in ENS&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jim McDonald&amp;nbsp;(&lt;a href=&quot;https://github.com/mcdee&quot;&gt;@mcdee&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1202&quot;&gt;1202&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Voting Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;), ERC-1202 Working Group&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:erc1202@googlegroups.com&quot;&gt;erc1202@googlegroups.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2333&quot;&gt;2333&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;BLS12-381 Key Generation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Carl Beekhuizen (@CarlBeek)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:carl@ethereum.org&quot;&gt;carl@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2334&quot;&gt;2334&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;BLS12-381 Deterministic Account Hierarchy&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Carl Beekhuizen (@CarlBeek)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:carl@ethereum.org&quot;&gt;carl@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2335&quot;&gt;2335&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;BLS12-381 Keystore&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Carl Beekhuizen (@CarlBeek)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:carl@ethereum.org&quot;&gt;carl@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4337&quot;&gt;4337&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Account Abstraction Using Alt Mempool&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Vitalik Buterin&amp;nbsp;(&lt;a href=&quot;https://github.com/vbuterin&quot;&gt;@vbuterin&lt;/a&gt;), Yoav Weiss&amp;nbsp;(&lt;a href=&quot;https://github.com/yoavw&quot;&gt;@yoavw&lt;/a&gt;), Dror Tirosh&amp;nbsp;(&lt;a href=&quot;https://github.com/drortirosh&quot;&gt;@drortirosh&lt;/a&gt;), Shahaf Nacson&amp;nbsp;(&lt;a href=&quot;https://github.com/shahafn&quot;&gt;@shahafn&lt;/a&gt;), Alex Forshtat&amp;nbsp;(&lt;a href=&quot;https://github.com/forshtat&quot;&gt;@forshtat&lt;/a&gt;), Kristof Gazso&amp;nbsp;(&lt;a href=&quot;https://github.com/kristofgazso&quot;&gt;@kristofgazso&lt;/a&gt;), Tjaden Hess&amp;nbsp;(&lt;a href=&quot;https://github.com/tjade273&quot;&gt;@tjade273&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4824&quot;&gt;4824&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Common Interfaces for DAOs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Joshua Tan&amp;nbsp;(&lt;a href=&quot;https://github.com/thelastjosh&quot;&gt;@thelastjosh&lt;/a&gt;), Isaac Patka&amp;nbsp;(&lt;a href=&quot;https://github.com/ipatka&quot;&gt;@ipatka&lt;/a&gt;), Ido Gershtein&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ido@daostack.io&quot;&gt;ido@daostack.io&lt;/a&gt;&amp;gt;, Eyal Eithcowich&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:eyal@deepdao.io&quot;&gt;eyal@deepdao.io&lt;/a&gt;&amp;gt;, Michael Zargham&amp;nbsp;(&lt;a href=&quot;https://github.com/mzargham&quot;&gt;@mzargham&lt;/a&gt;), Sam Furter&amp;nbsp;(&lt;a href=&quot;https://github.com/nivida&quot;&gt;@nivida&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4973&quot;&gt;4973&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Account-bound Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Tim Daubenschütz&amp;nbsp;(&lt;a href=&quot;https://github.com/TimDaub&quot;&gt;@TimDaub&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5247&quot;&gt;5247&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Smart Contract Executable Proposal Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5269&quot;&gt;5269&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC Detection and Discovery&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5289&quot;&gt;5289&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum Notary Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5485&quot;&gt;5485&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Jurisdiction, Accreditation, and Enforcement&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5568&quot;&gt;5568&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Well-Known Format for Required Actions&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5639&quot;&gt;5639&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Delegation Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;foobar&amp;nbsp;(&lt;a href=&quot;https://github.com/0xfoobar&quot;&gt;@0xfoobar&lt;/a&gt;), Wilkins Chung (@wwhchung)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:wilkins@manifold.xyz&quot;&gt;wilkins@manifold.xyz&lt;/a&gt;&amp;gt;, ryley-o&amp;nbsp;(&lt;a href=&quot;https://github.com/ryley-o&quot;&gt;@ryley-o&lt;/a&gt;), Jake Rockland&amp;nbsp;(&lt;a href=&quot;https://github.com/jakerockland&quot;&gt;@jakerockland&lt;/a&gt;), andy8052&amp;nbsp;(&lt;a href=&quot;https://github.com/andy8052&quot;&gt;@andy8052&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5982&quot;&gt;5982&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Role-based Access Control&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6065&quot;&gt;6065&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Real Estate Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alex&amp;nbsp;(&lt;a href=&quot;https://github.com/Alex-Klasma&quot;&gt;@Alex-Klasma&lt;/a&gt;), Ben Fusek&amp;nbsp;(&lt;a href=&quot;https://github.com/bfusek&quot;&gt;@bfusek&lt;/a&gt;), Daniel Fallon-Cyr&amp;nbsp;(&lt;a href=&quot;https://github.com/dfalloncyr&quot;&gt;@dfalloncyr&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6120&quot;&gt;6120&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Universal Token Router&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Derion&amp;nbsp;(&lt;a href=&quot;https://github.com/derion-io&quot;&gt;@derion-io&lt;/a&gt;), Zergity&amp;nbsp;(&lt;a href=&quot;https://github.com/Zergity&quot;&gt;@Zergity&lt;/a&gt;), Ngo Quang Anh&amp;nbsp;(&lt;a href=&quot;https://github.com/anhnq82&quot;&gt;@anhnq82&lt;/a&gt;), BerlinP&amp;nbsp;(&lt;a href=&quot;https://github.com/BerlinP&quot;&gt;@BerlinP&lt;/a&gt;), Khanh Pham&amp;nbsp;(&lt;a href=&quot;https://github.com/blackskin18&quot;&gt;@blackskin18&lt;/a&gt;), Hal Blackburn&amp;nbsp;(&lt;a href=&quot;https://github.com/h4l&quot;&gt;@h4l&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6315&quot;&gt;6315&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-2771 Namespaced Account Abstraction&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6358&quot;&gt;6358&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross-Chain Token States Synchronization&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Shawn Zheng&amp;nbsp;(&lt;a href=&quot;https://github.com/xiyu1984&quot;&gt;@xiyu1984&lt;/a&gt;), Jason Cheng&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chengjingxx@gmail.com&quot;&gt;chengjingxx@gmail.com&lt;/a&gt;&amp;gt;, George Huang&amp;nbsp;(&lt;a href=&quot;https://github.com/virgil2019&quot;&gt;@virgil2019&lt;/a&gt;), Kay Lin&amp;nbsp;(&lt;a href=&quot;https://github.com/kay404&quot;&gt;@kay404&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6366&quot;&gt;6366&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Permission Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chiro&amp;nbsp;(&lt;a href=&quot;https://github.com/chiro-hiro&quot;&gt;@chiro-hiro&lt;/a&gt;), Victor Dusart&amp;nbsp;(&lt;a href=&quot;https://github.com/vdusart&quot;&gt;@vdusart&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6372&quot;&gt;6372&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract clock&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;), Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6551&quot;&gt;6551&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-fungible Token Bound Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jayden Windle&amp;nbsp;(&lt;a href=&quot;https://github.com/jaydenwindle&quot;&gt;@jaydenwindle&lt;/a&gt;), Benny Giang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:bg@futureprimitive.xyz&quot;&gt;bg@futureprimitive.xyz&lt;/a&gt;&amp;gt;,  Steve Jang, Druzy Downs&amp;nbsp;(&lt;a href=&quot;https://github.com/druzydowns&quot;&gt;@druzydowns&lt;/a&gt;), Raymond Huynh&amp;nbsp;(&lt;a href=&quot;https://github.com/huynhr&quot;&gt;@huynhr&lt;/a&gt;), Alanah Lam&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:alanah@futureprimitive.xyz&quot;&gt;alanah@futureprimitive.xyz&lt;/a&gt;&amp;gt;, Wilkins Chung (@wwhchung)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:wilkins@manifold.xyz&quot;&gt;wilkins@manifold.xyz&lt;/a&gt;&amp;gt;, Paul Sullivan (@sullivph)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:paul.sullivan@manifold.xyz&quot;&gt;paul.sullivan@manifold.xyz&lt;/a&gt;&amp;gt;, Auryn Macmillan&amp;nbsp;(&lt;a href=&quot;https://github.com/auryn-macmillan&quot;&gt;@auryn-macmillan&lt;/a&gt;), Jan-Felix Schwarz&amp;nbsp;(&lt;a href=&quot;https://github.com/jfschwarz&quot;&gt;@jfschwarz&lt;/a&gt;), Anton Bukov&amp;nbsp;(&lt;a href=&quot;https://github.com/k06a&quot;&gt;@k06a&lt;/a&gt;), Mikhail Melnik&amp;nbsp;(&lt;a href=&quot;https://github.com/ZumZoom&quot;&gt;@ZumZoom&lt;/a&gt;), Josh Weintraub (@jhweintraub)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jhweintraub@gmail.com&quot;&gt;jhweintraub@gmail.com&lt;/a&gt;&amp;gt;, Rob Montgomery (@RobAnon)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:rob@revest.finance&quot;&gt;rob@revest.finance&lt;/a&gt;&amp;gt;, vectorized&amp;nbsp;(&lt;a href=&quot;https://github.com/vectorized&quot;&gt;@vectorized&lt;/a&gt;), Víctor Martínez&amp;nbsp;(&lt;a href=&quot;https://github.com/vnmrtz&quot;&gt;@vnmrtz&lt;/a&gt;), Adrián Pajares&amp;nbsp;(&lt;a href=&quot;https://github.com/0xadrii&quot;&gt;@0xadrii&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6596&quot;&gt;6596&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cultural and Historical Asset Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Phillip Pon&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:phillip@artifactlabs.com&quot;&gt;phillip@artifactlabs.com&lt;/a&gt;&amp;gt;, Gary Liu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:gary@artifactlabs.com&quot;&gt;gary@artifactlabs.com&lt;/a&gt;&amp;gt;, Henry Chan&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:henry@artifactlabs.com&quot;&gt;henry@artifactlabs.com&lt;/a&gt;&amp;gt;, Joey Liu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:joey@artifactlabs.com&quot;&gt;joey@artifactlabs.com&lt;/a&gt;&amp;gt;, Lauren Ho&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:lauren@artifactlabs.com&quot;&gt;lauren@artifactlabs.com&lt;/a&gt;&amp;gt;, Jeff Leung&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jeff@artifactlabs.com&quot;&gt;jeff@artifactlabs.com&lt;/a&gt;&amp;gt;, Brian Liang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:brian@artifactlabs.com&quot;&gt;brian@artifactlabs.com&lt;/a&gt;&amp;gt;, Joyce Li&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:joyce@artifactlabs.com&quot;&gt;joyce@artifactlabs.com&lt;/a&gt;&amp;gt;, Avir Mahtani&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:avir@artifactlabs.com&quot;&gt;avir@artifactlabs.com&lt;/a&gt;&amp;gt;, Antoine Cote&amp;nbsp;(&lt;a href=&quot;https://github.com/acote88&quot;&gt;@acote88&lt;/a&gt;), David Leung&amp;nbsp;(&lt;a href=&quot;https://github.com/dhl&quot;&gt;@dhl&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6617&quot;&gt;6617&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Bit Based Permission&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chiro&amp;nbsp;(&lt;a href=&quot;https://github.com/chiro-hiro&quot;&gt;@chiro-hiro&lt;/a&gt;), Victor Dusart&amp;nbsp;(&lt;a href=&quot;https://github.com/vdusart&quot;&gt;@vdusart&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6734&quot;&gt;6734&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;L2 Token List&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kelvin Fichter&amp;nbsp;(&lt;a href=&quot;https://github.com/smartcontracts&quot;&gt;@smartcontracts&lt;/a&gt;), Andreas Freund&amp;nbsp;(&lt;a href=&quot;https://github.com/Therecanbeonlyone1969&quot;&gt;@Therecanbeonlyone1969&lt;/a&gt;), Pavel Sinelnikov&amp;nbsp;(&lt;a href=&quot;https://github.com/psinelnikov&quot;&gt;@psinelnikov&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6735&quot;&gt;6735&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;L2 Aliasing of EVM-based Addresses&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kelvin Fichter&amp;nbsp;(&lt;a href=&quot;https://github.com/smartcontracts&quot;&gt;@smartcontracts&lt;/a&gt;), Andreas Freund&amp;nbsp;(&lt;a href=&quot;https://github.com/Therecanbeonlyone1969&quot;&gt;@Therecanbeonlyone1969&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6956&quot;&gt;6956&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Asset-bound Non-Fungible Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Thomas Bergmueller&amp;nbsp;(&lt;a href=&quot;https://github.com/tbergmueller&quot;&gt;@tbergmueller&lt;/a&gt;), Lukas Meyer&amp;nbsp;(&lt;a href=&quot;https://github.com/ibex-technology&quot;&gt;@ibex-technology&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6997&quot;&gt;6997&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 with transaction validation step.&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Eduard López i Fina&amp;nbsp;(&lt;a href=&quot;https://github.com/eduardfina&quot;&gt;@eduardfina&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7015&quot;&gt;7015&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Creator Attribution&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;indreams&amp;nbsp;(&lt;a href=&quot;https://github.com/strollinghome&quot;&gt;@strollinghome&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7144&quot;&gt;7144&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-20 with transaction validation step.&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Eduard López i Fina&amp;nbsp;(&lt;a href=&quot;https://github.com/eduardfina&quot;&gt;@eduardfina&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7246&quot;&gt;7246&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Encumber - Splitting Ownership &amp;amp; Guarantees&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Coburn Berry&amp;nbsp;(&lt;a href=&quot;https://github.com/coburncoburn&quot;&gt;@coburncoburn&lt;/a&gt;), Mykel Pereira&amp;nbsp;(&lt;a href=&quot;https://github.com/mykelp&quot;&gt;@mykelp&lt;/a&gt;), Scott Silver&amp;nbsp;(&lt;a href=&quot;https://github.com/scott-silver&quot;&gt;@scott-silver&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7399&quot;&gt;7399&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;⚡ Flash Loans ⚡&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alberto Cuesta Cañada&amp;nbsp;(&lt;a href=&quot;https://github.com/alcueca&quot;&gt;@alcueca&lt;/a&gt;), Michael Amadi&amp;nbsp;(&lt;a href=&quot;https://github.com/AmadiMichaels&quot;&gt;@AmadiMichaels&lt;/a&gt;), Devtooligan&amp;nbsp;(&lt;a href=&quot;https://github.com/devtooligan&quot;&gt;@devtooligan&lt;/a&gt;), Ultrasecr.eth&amp;nbsp;(&lt;a href=&quot;https://github.com/ultrasecreth&quot;&gt;@ultrasecreth&lt;/a&gt;), Sam Bacha&amp;nbsp;(&lt;a href=&quot;https://github.com/sambacha&quot;&gt;@sambacha&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7417&quot;&gt;7417&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Converter&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Dexaran (@Dexaran)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dexaran@ethereumclassic.org&quot;&gt;dexaran@ethereumclassic.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7518&quot;&gt;7518&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Dynamic Compliant Interop Security Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Abhinav (@abhinav-d3v)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:abhinav@zoniqx.com&quot;&gt;abhinav@zoniqx.com&lt;/a&gt;&amp;gt;, Prithvish Baidya (@d4mr)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:pbaidya@zoniqx.com&quot;&gt;pbaidya@zoniqx.com&lt;/a&gt;&amp;gt;, Rajat Kumar (@rajatwasan)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:rwasan@zoniqx.com&quot;&gt;rwasan@zoniqx.com&lt;/a&gt;&amp;gt;, Prasanth Kalangi&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:pkalangi@zoniqx.com&quot;&gt;pkalangi@zoniqx.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7531&quot;&gt;7531&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Staked ERC-721 Ownership Recognition&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Francesco Sullo&amp;nbsp;(&lt;a href=&quot;https://github.com/sullof&quot;&gt;@sullof&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7586&quot;&gt;7586&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Interest Rate Swaps&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Samuel Gwlanold Edoumou&amp;nbsp;(&lt;a href=&quot;https://github.com/Edoumou&quot;&gt;@Edoumou&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7590&quot;&gt;7590&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-20 Holder Extension for NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Steven Pineda&amp;nbsp;(&lt;a href=&quot;https://github.com/steven2308&quot;&gt;@steven2308&lt;/a&gt;), Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7628&quot;&gt;7628&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Ownership Shares Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chen Liaoyuan (@chenly)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:cly@kip.pro&quot;&gt;cly@kip.pro&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7673&quot;&gt;7673&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Distinguishable base256emoji Addresses&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;William Morriss&amp;nbsp;(&lt;a href=&quot;https://github.com/wjmelements&quot;&gt;@wjmelements&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7674&quot;&gt;7674&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Temporary Approval Extension for ERC-20&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Xenia Shape&amp;nbsp;(&lt;a href=&quot;https://github.com/byshape&quot;&gt;@byshape&lt;/a&gt;), Mikhail Melnik&amp;nbsp;(&lt;a href=&quot;https://github.com/ZumZoom&quot;&gt;@ZumZoom&lt;/a&gt;), Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7677&quot;&gt;7677&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Paymaster Web Service Capability&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lukas Rosario&amp;nbsp;(&lt;a href=&quot;https://github.com/lukasrosario&quot;&gt;@lukasrosario&lt;/a&gt;), Dror Tirosh&amp;nbsp;(&lt;a href=&quot;https://github.com/drortirosh&quot;&gt;@drortirosh&lt;/a&gt;), Wilson Cusack&amp;nbsp;(&lt;a href=&quot;https://github.com/wilsoncusack&quot;&gt;@wilsoncusack&lt;/a&gt;), Kristof Gazso&amp;nbsp;(&lt;a href=&quot;https://github.com/kristofgazso&quot;&gt;@kristofgazso&lt;/a&gt;), Hazim Jumali&amp;nbsp;(&lt;a href=&quot;https://github.com/hazim-j&quot;&gt;@hazim-j&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7750&quot;&gt;7750&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Decentralized Employment System&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;James Savechives (@jamesavechives)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:james.walstonn@gmail.com&quot;&gt;james.walstonn@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7758&quot;&gt;7758&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Transfer With Authorization&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Peter Jihoon Kim&amp;nbsp;(&lt;a href=&quot;https://github.com/petejkim&quot;&gt;@petejkim&lt;/a&gt;), Kevin Britz&amp;nbsp;(&lt;a href=&quot;https://github.com/kbrizzle&quot;&gt;@kbrizzle&lt;/a&gt;), David Knott&amp;nbsp;(&lt;a href=&quot;https://github.com/DavidLKnott&quot;&gt;@DavidLKnott&lt;/a&gt;), Dongri Jin&amp;nbsp;(&lt;a href=&quot;https://github.com/dongri&quot;&gt;@dongri&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7776&quot;&gt;7776&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Transparent Financial Statements&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ignacio Ceaglio (@Nachoxt17)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ignacioceaglio@gmail.com&quot;&gt;ignacioceaglio@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7777&quot;&gt;7777&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Governance for Human Robot Societies&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;OpenMind, Jan Liphardt&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jan@openmind.org&quot;&gt;jan@openmind.org&lt;/a&gt;&amp;gt;, Shaohong Zhong&amp;nbsp;(&lt;a href=&quot;https://github.com/ShaohongZ&quot;&gt;@ShaohongZ&lt;/a&gt;), Boyuan Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/bchen-dev&quot;&gt;@bchen-dev&lt;/a&gt;), Paige Xu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:paige@openmind.org&quot;&gt;paige@openmind.org&lt;/a&gt;&amp;gt;, James Ball&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:james.ball@nethermind.io&quot;&gt;james.ball@nethermind.io&lt;/a&gt;&amp;gt;, Thamer Dridi&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:thamer.dridi@nethermind.io&quot;&gt;thamer.dridi@nethermind.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7812&quot;&gt;7812&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ZK Identity Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Artem Chystiakov (@arvolear)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:artem@rarilabs.com&quot;&gt;artem@rarilabs.com&lt;/a&gt;&amp;gt;, Oleksandr Kurbatov&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:oleksandr@rarilabs.com&quot;&gt;oleksandr@rarilabs.com&lt;/a&gt;&amp;gt;, Yaroslav Panasenko&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:yaroslav@rarilabs.com&quot;&gt;yaroslav@rarilabs.com&lt;/a&gt;&amp;gt;, Michael Elliot (@michaelelliot)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mike@zkpassport.id&quot;&gt;mike@zkpassport.id&lt;/a&gt;&amp;gt;, Vitalik Buterin&amp;nbsp;(&lt;a href=&quot;https://github.com/vbuterin&quot;&gt;@vbuterin&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7813&quot;&gt;7813&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Store, Table-Based Introspectable Storage&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;alvarius&amp;nbsp;(&lt;a href=&quot;https://github.com/alvrs&quot;&gt;@alvrs&lt;/a&gt;), dk1a&amp;nbsp;(&lt;a href=&quot;https://github.com/dk1a&quot;&gt;@dk1a&lt;/a&gt;), frolic&amp;nbsp;(&lt;a href=&quot;https://github.com/frolic&quot;&gt;@frolic&lt;/a&gt;), ludens&amp;nbsp;(&lt;a href=&quot;https://github.com/ludns&quot;&gt;@ludns&lt;/a&gt;), vdrg&amp;nbsp;(&lt;a href=&quot;https://github.com/vdrg&quot;&gt;@vdrg&lt;/a&gt;), yonada&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:yonada@proton.me&quot;&gt;yonada@proton.me&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7829&quot;&gt;7829&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Data Asset NFT&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Allen Dong&amp;nbsp;(&lt;a href=&quot;https://github.com/Allen2730&quot;&gt;@Allen2730&lt;/a&gt;), Lonika Zhang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:lonika@memolabs.net&quot;&gt;lonika@memolabs.net&lt;/a&gt;&amp;gt;, Steven He&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:steven@memolabs.net&quot;&gt;steven@memolabs.net&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7832&quot;&gt;7832&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Sustainable collaborative NFT collections&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gustavo Lobo&amp;nbsp;(&lt;a href=&quot;https://github.com/gflobo&quot;&gt;@gflobo&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7866&quot;&gt;7866&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Decentralised User Profiles&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kumar Anirudha&amp;nbsp;(&lt;a href=&quot;https://github.com/anistark&quot;&gt;@anistark&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7936&quot;&gt;7936&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Versioned Proxy Contract Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Raphina Liu&amp;nbsp;(&lt;a href=&quot;https://github.com/Stamp9&quot;&gt;@Stamp9&lt;/a&gt;), Monica Jin&amp;nbsp;(&lt;a href=&quot;https://github.com/mokita-j&quot;&gt;@mokita-j&lt;/a&gt;), Martin Monperrus&amp;nbsp;(&lt;a href=&quot;https://github.com/monperrus&quot;&gt;@monperrus&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7945&quot;&gt;7945&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Confidential Transactions Supported Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Siyuan Zheng (@andrewcoder666)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:zhengsiyuan.zsy@antgroup.com&quot;&gt;zhengsiyuan.zsy@antgroup.com&lt;/a&gt;&amp;gt;, Zhe Han (@iampkuhz)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:hanzhe.hz@ant-intl.com&quot;&gt;hanzhe.hz@ant-intl.com&lt;/a&gt;&amp;gt;, Xiaoyu Liu (@elizabethxiaoyu)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jiushi.lxy@antgroup.com&quot;&gt;jiushi.lxy@antgroup.com&lt;/a&gt;&amp;gt;, Wenwei Ma (@madyinglight)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:huiwei.mww@antgroup.com&quot;&gt;huiwei.mww@antgroup.com&lt;/a&gt;&amp;gt;, Jun Meng Tan (@chadxeth)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:junmeng.t@antgroup.com&quot;&gt;junmeng.t@antgroup.com&lt;/a&gt;&amp;gt;, Yuxiang Fu (@tmac4096)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kunfu.fyx@antgroup.com&quot;&gt;kunfu.fyx@antgroup.com&lt;/a&gt;&amp;gt;, Kecheng Gao (@thanks-v-me-50)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:gaokecheng.gkc@antgroup.com&quot;&gt;gaokecheng.gkc@antgroup.com&lt;/a&gt;&amp;gt;, Alwin Ng Jun Wei (@alwinngjw)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:alwin.ng@antgroup.com&quot;&gt;alwin.ng@antgroup.com&lt;/a&gt;&amp;gt;, Chenxin Wang (@3235773541)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:wcx465603@antgroup.com&quot;&gt;wcx465603@antgroup.com&lt;/a&gt;&amp;gt;, Xiang Gao (@GaoYiRu)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:gaoxiang.gao@antgroup.com&quot;&gt;gaoxiang.gao@antgroup.com&lt;/a&gt;&amp;gt;, yuanshanhshan (@xunayuan)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:yuanshanshan.yss@antgroup.com&quot;&gt;yuanshanshan.yss@antgroup.com&lt;/a&gt;&amp;gt;, Hao Zou (@BruceZH0915)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:situ.zh@antgroup.com&quot;&gt;situ.zh@antgroup.com&lt;/a&gt;&amp;gt;, Yanyi Liang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:eason.lyy@antgroup.com&quot;&gt;eason.lyy@antgroup.com&lt;/a&gt;&amp;gt;, Yuehua Zhang (@astroyhzcc)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ruoying.zyh@antgroup.com&quot;&gt;ruoying.zyh@antgroup.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8019&quot;&gt;8019&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Wallet-Managed Auto-Login for SIWE&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ivo Georgiev&amp;nbsp;(&lt;a href=&quot;https://github.com/Ivshti&quot;&gt;@Ivshti&lt;/a&gt;), Vijay Krishnavanshi&amp;nbsp;(&lt;a href=&quot;https://github.com/vijaykrishnavanshi&quot;&gt;@vijaykrishnavanshi&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8111&quot;&gt;8111&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Bound Signatures&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;William Morriss&amp;nbsp;(&lt;a href=&quot;https://github.com/wjmelements&quot;&gt;@wjmelements&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8126&quot;&gt;8126&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;AI Agent Verification&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Leigh Cronian (@cybercentry)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:leigh.cronian@cybercentry.co.uk&quot;&gt;leigh.cronian@cybercentry.co.uk&lt;/a&gt;&amp;gt;, Chris Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chris@virtuals.io&quot;&gt;chris@virtuals.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8161&quot;&gt;8161&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Transferable Tokenized Vault Requests&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Cain O&apos;Sullivan&amp;nbsp;(&lt;a href=&quot;https://github.com/cosullivan&quot;&gt;@cosullivan&lt;/a&gt;), Jeroen Offerijns&amp;nbsp;(&lt;a href=&quot;https://github.com/hieronx&quot;&gt;@hieronx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8167&quot;&gt;8167&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Modular Dispatch Proxies&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;William Morriss&amp;nbsp;(&lt;a href=&quot;https://github.com/wjmelements&quot;&gt;@wjmelements&lt;/a&gt;), Radek Svarz&amp;nbsp;(&lt;a href=&quot;https://github.com/radeksvarz&quot;&gt;@radeksvarz&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
    &lt;/table&gt;
  

  
  
  
    &lt;h2 id=&quot;draft&quot;&gt;Draft&lt;/h2&gt;
    &lt;table class=&quot;eiptable&quot;&gt;
      &lt;thead&gt;
        
          &lt;tr&gt;&lt;th class=&quot;eipnum&quot;&gt;Number&lt;/th&gt;&lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;&lt;th class=&quot;author&quot;&gt;Author&lt;/th&gt;&lt;/tr&gt;
        
      &lt;/thead&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-725&quot;&gt;725&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;General data key/value store and execution&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Fabian Vogelsteller&amp;nbsp;(&lt;a href=&quot;https://github.com/frozeman&quot;&gt;@frozeman&lt;/a&gt;), Tyler Yasaka&amp;nbsp;(&lt;a href=&quot;https://github.com/tyleryasaka&quot;&gt;@tyleryasaka&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-838&quot;&gt;838&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ABI specification for REVERT reason string&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Federico Bond&amp;nbsp;(&lt;a href=&quot;https://github.com/federicobond&quot;&gt;@federicobond&lt;/a&gt;), Renan Rodrigues de Souza&amp;nbsp;(&lt;a href=&quot;https://github.com/RenanSouza2&quot;&gt;@RenanSouza2&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-998&quot;&gt;998&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Composable Non-Fungible Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Matt Lockyer&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mattdlockyer@gmail.com&quot;&gt;mattdlockyer@gmail.com&lt;/a&gt;&amp;gt;, Nick Mudge&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@perfectabstractions.com&quot;&gt;nick@perfectabstractions.com&lt;/a&gt;&amp;gt;, Jordan Schalm&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jordan.schalm@gmail.com&quot;&gt;jordan.schalm@gmail.com&lt;/a&gt;&amp;gt;, sebastian echeverry&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:sebastian.echeverry@robotouniverse.com&quot;&gt;sebastian.echeverry@robotouniverse.com&lt;/a&gt;&amp;gt;, Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3009&quot;&gt;3009&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Transfer With Authorization&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Peter Jihoon Kim&amp;nbsp;(&lt;a href=&quot;https://github.com/petejkim&quot;&gt;@petejkim&lt;/a&gt;), Kevin Britz&amp;nbsp;(&lt;a href=&quot;https://github.com/kbrizzle&quot;&gt;@kbrizzle&lt;/a&gt;), David Knott&amp;nbsp;(&lt;a href=&quot;https://github.com/DavidLKnott&quot;&gt;@DavidLKnott&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3770&quot;&gt;3770&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Chain-specific addresses&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lukas Schor&amp;nbsp;(&lt;a href=&quot;https://github.com/lukasschor&quot;&gt;@lukasschor&lt;/a&gt;), Richard Meissner&amp;nbsp;(&lt;a href=&quot;https://github.com/rmeissner&quot;&gt;@rmeissner&lt;/a&gt;), Pedro Gomes&amp;nbsp;(&lt;a href=&quot;https://github.com/pedrouid&quot;&gt;@pedrouid&lt;/a&gt;), ligi&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ligi@ligi.de&quot;&gt;ligi@ligi.de&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4883&quot;&gt;4883&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Composable SVG NFT&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Andrew B Coathup&amp;nbsp;(&lt;a href=&quot;https://github.com/abcoathup&quot;&gt;@abcoathup&lt;/a&gt;), Alex&amp;nbsp;(&lt;a href=&quot;https://github.com/AlexPartyPanda&quot;&gt;@AlexPartyPanda&lt;/a&gt;), Damian Martinelli&amp;nbsp;(&lt;a href=&quot;https://github.com/damianmarti&quot;&gt;@damianmarti&lt;/a&gt;), blockdev&amp;nbsp;(&lt;a href=&quot;https://github.com/0xbok&quot;&gt;@0xbok&lt;/a&gt;), Austin Griffith&amp;nbsp;(&lt;a href=&quot;https://github.com/austintgriffith&quot;&gt;@austintgriffith&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4972&quot;&gt;4972&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Name-Owned Account&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Shu Dong&amp;nbsp;(&lt;a href=&quot;https://github.com/dongshu2013&quot;&gt;@dongshu2013&lt;/a&gt;), Qi Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;), Zihao Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/zihaoccc&quot;&gt;@zihaoccc&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5115&quot;&gt;5115&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;SY Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Vu Nguyen&amp;nbsp;(&lt;a href=&quot;https://github.com/mrenoon&quot;&gt;@mrenoon&lt;/a&gt;), Long Vuong&amp;nbsp;(&lt;a href=&quot;https://github.com/UncleGrandpa925&quot;&gt;@UncleGrandpa925&lt;/a&gt;), Anton Buenavista&amp;nbsp;(&lt;a href=&quot;https://github.com/ayobuenavista&quot;&gt;@ayobuenavista&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5173&quot;&gt;5173&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Future Rewards (nFR)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yale ReiSoleil&amp;nbsp;(&lt;a href=&quot;https://github.com/longnshort&quot;&gt;@longnshort&lt;/a&gt;), dRadiant&amp;nbsp;(&lt;a href=&quot;https://github.com/dRadiant&quot;&gt;@dRadiant&lt;/a&gt;),  D Wang, PhD&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:david@iob.fi&quot;&gt;david@iob.fi&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5189&quot;&gt;5189&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Account Abstraction via Endorsed Operations&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Agustín Aguilar&amp;nbsp;(&lt;a href=&quot;https://github.com/agusx1211&quot;&gt;@agusx1211&lt;/a&gt;), Philippe Castonguay&amp;nbsp;(&lt;a href=&quot;https://github.com/phabc&quot;&gt;@phabc&lt;/a&gt;), Michael Standen&amp;nbsp;(&lt;a href=&quot;https://github.com/ScreamingHawk&quot;&gt;@ScreamingHawk&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5516&quot;&gt;5516&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Soulbound Multi-owner Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lucas Martín Grasso Ramos&amp;nbsp;(&lt;a href=&quot;https://github.com/LucasGrasso&quot;&gt;@LucasGrasso&lt;/a&gt;), Matias Arazi&amp;nbsp;(&lt;a href=&quot;https://github.com/MatiArazi&quot;&gt;@MatiArazi&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5573&quot;&gt;5573&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Sign-In with Ethereum Capabilities, ReCaps&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Oliver Terbu&amp;nbsp;(&lt;a href=&quot;https://github.com/awoie&quot;&gt;@awoie&lt;/a&gt;), Jacob Ward&amp;nbsp;(&lt;a href=&quot;https://github.com/cobward&quot;&gt;@cobward&lt;/a&gt;), Charles Lehner&amp;nbsp;(&lt;a href=&quot;https://github.com/clehner&quot;&gt;@clehner&lt;/a&gt;), Sam Gbafa&amp;nbsp;(&lt;a href=&quot;https://github.com/skgbafa&quot;&gt;@skgbafa&lt;/a&gt;), Wayne Chang&amp;nbsp;(&lt;a href=&quot;https://github.com/wyc&quot;&gt;@wyc&lt;/a&gt;), Charles Cunningham&amp;nbsp;(&lt;a href=&quot;https://github.com/chunningham&quot;&gt;@chunningham&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5604&quot;&gt;5604&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Lien&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;), Allen Zhou&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:allen@ubiloan.io&quot;&gt;allen@ubiloan.io&lt;/a&gt;&amp;gt;, Alex Qin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:alex@ubiloan.io&quot;&gt;alex@ubiloan.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5630&quot;&gt;5630&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;New approach for encryption / decryption&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Firn Protocol&amp;nbsp;(&lt;a href=&quot;https://github.com/firnprotocol&quot;&gt;@firnprotocol&lt;/a&gt;),  Fried L. Trout, Weiji Guo&amp;nbsp;(&lt;a href=&quot;https://github.com/weijiguo&quot;&gt;@weijiguo&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5700&quot;&gt;5700&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Bindable Token Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Leeren&amp;nbsp;(&lt;a href=&quot;https://github.com/leeren&quot;&gt;@leeren&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5727&quot;&gt;5727&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Semi-Fungible Soulbound Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Austin Zhu&amp;nbsp;(&lt;a href=&quot;https://github.com/AustinZhu&quot;&gt;@AustinZhu&lt;/a&gt;), Terry Chen&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:terry.chen@phaneroz.io&quot;&gt;terry.chen@phaneroz.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5791&quot;&gt;5791&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Physical Backed Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;2pmflow&amp;nbsp;(&lt;a href=&quot;https://github.com/2pmflow&quot;&gt;@2pmflow&lt;/a&gt;), locationtba&amp;nbsp;(&lt;a href=&quot;https://github.com/locationtba&quot;&gt;@locationtba&lt;/a&gt;), Cameron Robertson&amp;nbsp;(&lt;a href=&quot;https://github.com/ccamrobertson&quot;&gt;@ccamrobertson&lt;/a&gt;), cygaar&amp;nbsp;(&lt;a href=&quot;https://github.com/cygaar&quot;&gt;@cygaar&lt;/a&gt;), Brian Weick&amp;nbsp;(&lt;a href=&quot;https://github.com/bweick&quot;&gt;@bweick&lt;/a&gt;), vectorized&amp;nbsp;(&lt;a href=&quot;https://github.com/vectorized&quot;&gt;@vectorized&lt;/a&gt;), djdabs&amp;nbsp;(&lt;a href=&quot;https://github.com/djdabs&quot;&gt;@djdabs&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6123&quot;&gt;6123&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Smart Derivative Contract&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Christian Fries&amp;nbsp;(&lt;a href=&quot;https://github.com/cfries&quot;&gt;@cfries&lt;/a&gt;), Peter Kohl-Landgraf&amp;nbsp;(&lt;a href=&quot;https://github.com/pekola&quot;&gt;@pekola&lt;/a&gt;), Alexandros Korpis&amp;nbsp;(&lt;a href=&quot;https://github.com/kourouta&quot;&gt;@kourouta&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6170&quot;&gt;6170&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross-Chain Messaging Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sujith Somraaj&amp;nbsp;(&lt;a href=&quot;https://github.com/sujithsomraaj&quot;&gt;@sujithsomraaj&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6229&quot;&gt;6229&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Tokenized Vaults with Lock-in Period&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Anderson Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/Ankarrr&quot;&gt;@Ankarrr&lt;/a&gt;), Martinet Lee&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:martinetlee@gmail.com&quot;&gt;martinetlee@gmail.com&lt;/a&gt;&amp;gt;, Anton Cheng&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:antonassocareer@gmail.com&quot;&gt;antonassocareer@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6327&quot;&gt;6327&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Elastic Signature&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;George&amp;nbsp;(&lt;a href=&quot;https://github.com/JXRow&quot;&gt;@JXRow&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6604&quot;&gt;6604&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Abstract Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chris Walker (@cr-walker)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chris@ckwalker.com&quot;&gt;chris@ckwalker.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6662&quot;&gt;6662&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;AA Account Metadata For Authentication&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Shu Dong&amp;nbsp;(&lt;a href=&quot;https://github.com/dongshu2013&quot;&gt;@dongshu2013&lt;/a&gt;), Zihao Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/zihaoccc&quot;&gt;@zihaoccc&lt;/a&gt;), Peter Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/pette1999&quot;&gt;@pette1999&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6682&quot;&gt;6682&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Flashloans&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;out.eth&amp;nbsp;(&lt;a href=&quot;https://github.com/outdoteth&quot;&gt;@outdoteth&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6785&quot;&gt;6785&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Utilities Information Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Otniel Nicola&amp;nbsp;(&lt;a href=&quot;https://github.com/OT-kthd&quot;&gt;@OT-kthd&lt;/a&gt;), Bogdan Popa&amp;nbsp;(&lt;a href=&quot;https://github.com/BogdanKTHD&quot;&gt;@BogdanKTHD&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6786&quot;&gt;6786&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Registry for royalties payment for NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Otniel Nicola&amp;nbsp;(&lt;a href=&quot;https://github.com/OT-kthd&quot;&gt;@OT-kthd&lt;/a&gt;), Bogdan Popa&amp;nbsp;(&lt;a href=&quot;https://github.com/BogdanKTHD&quot;&gt;@BogdanKTHD&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6787&quot;&gt;6787&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Order Book DEX with Two Phase Withdrawal&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jessica&amp;nbsp;(&lt;a href=&quot;https://github.com/qizheng09&quot;&gt;@qizheng09&lt;/a&gt;), Roy&amp;nbsp;(&lt;a href=&quot;https://github.com/royshang&quot;&gt;@royshang&lt;/a&gt;), Jun&amp;nbsp;(&lt;a href=&quot;https://github.com/SniperUsopp&quot;&gt;@SniperUsopp&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6806&quot;&gt;6806&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Holding Time Tracking&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Saitama&amp;nbsp;(&lt;a href=&quot;https://github.com/saitama2009&quot;&gt;@saitama2009&lt;/a&gt;), Combo&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:combo@1combo.io&quot;&gt;combo@1combo.io&lt;/a&gt;&amp;gt;, Luigi&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:luigi@1combo.io&quot;&gt;luigi@1combo.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6821&quot;&gt;6821&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Support ENS Name for Web3 URL&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Qi Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;), Qiang Zhu&amp;nbsp;(&lt;a href=&quot;https://github.com/qzhodl&quot;&gt;@qzhodl&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6823&quot;&gt;6823&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Mapping Slot Retrieval Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;qdqd (@qd-qd)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:qdqdqdqdqd@protonmail.com&quot;&gt;qdqdqdqdqd@protonmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6860&quot;&gt;6860&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Web3 URL to EVM Call Message Translation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Qi Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;), Chao Pi&amp;nbsp;(&lt;a href=&quot;https://github.com/pichaoqkc&quot;&gt;@pichaoqkc&lt;/a&gt;), Sam Wilson&amp;nbsp;(&lt;a href=&quot;https://github.com/SamWilsn&quot;&gt;@SamWilsn&lt;/a&gt;), Nicolas Deschildre&amp;nbsp;(&lt;a href=&quot;https://github.com/nand2&quot;&gt;@nand2&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6864&quot;&gt;6864&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Upgradable Fungible Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jeff Huang&amp;nbsp;(&lt;a href=&quot;https://github.com/jeffishjeff&quot;&gt;@jeffishjeff&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6865&quot;&gt;6865&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;On-Chain EIP-712 Visualization&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Abderrahmen Hanafi&amp;nbsp;(&lt;a href=&quot;https://github.com/a6-dou&quot;&gt;@a6-dou&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6900&quot;&gt;6900&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Modular Smart Contract Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Adam Egyed&amp;nbsp;(&lt;a href=&quot;https://github.com/adamegyed&quot;&gt;@adamegyed&lt;/a&gt;), Fangting Liu&amp;nbsp;(&lt;a href=&quot;https://github.com/trinity-0111&quot;&gt;@trinity-0111&lt;/a&gt;), Jay Paik&amp;nbsp;(&lt;a href=&quot;https://github.com/jaypaik&quot;&gt;@jaypaik&lt;/a&gt;), Yoav Weiss&amp;nbsp;(&lt;a href=&quot;https://github.com/yoavw&quot;&gt;@yoavw&lt;/a&gt;), Huawei Gu&amp;nbsp;(&lt;a href=&quot;https://github.com/huaweigu&quot;&gt;@huaweigu&lt;/a&gt;), Daniel Lim&amp;nbsp;(&lt;a href=&quot;https://github.com/dlim-circle&quot;&gt;@dlim-circle&lt;/a&gt;), Ruben Koch&amp;nbsp;(&lt;a href=&quot;https://github.com/0xrubes&quot;&gt;@0xrubes&lt;/a&gt;), David Philipson&amp;nbsp;(&lt;a href=&quot;https://github.com/dphilipson&quot;&gt;@dphilipson&lt;/a&gt;), Howy Ho&amp;nbsp;(&lt;a href=&quot;https://github.com/howydev&quot;&gt;@howydev&lt;/a&gt;), Nikita Belenkov&amp;nbsp;(&lt;a href=&quot;https://github.com/nikita-quantstamp&quot;&gt;@nikita-quantstamp&lt;/a&gt;), zer0dot&amp;nbsp;(&lt;a href=&quot;https://github.com/zer0dot&quot;&gt;@zer0dot&lt;/a&gt;), David Kim&amp;nbsp;(&lt;a href=&quot;https://github.com/PowerStream3604&quot;&gt;@PowerStream3604&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6932&quot;&gt;6932&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Subscription-Based Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;360 Core&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:hello@360coreinc.com&quot;&gt;hello@360coreinc.com&lt;/a&gt;&amp;gt;, Robin Rajput&amp;nbsp;(&lt;a href=&quot;https://github.com/0xRobinR&quot;&gt;@0xRobinR&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6944&quot;&gt;6944&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-5219 Resolve Mode&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;), Qi Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6960&quot;&gt;6960&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Dual Layer Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Adam Boudjemaa&amp;nbsp;(&lt;a href=&quot;https://github.com/aboudjem&quot;&gt;@aboudjem&lt;/a&gt;), Mohamad Hammoud&amp;nbsp;(&lt;a href=&quot;https://github.com/mohamadhammoud&quot;&gt;@mohamadhammoud&lt;/a&gt;), Nawar Hisso&amp;nbsp;(&lt;a href=&quot;https://github.com/nawar-hisso&quot;&gt;@nawar-hisso&lt;/a&gt;), Khawla Hassan&amp;nbsp;(&lt;a href=&quot;https://github.com/khawlahssn&quot;&gt;@khawlahssn&lt;/a&gt;), Mohammad Zakeri Rad&amp;nbsp;(&lt;a href=&quot;https://github.com/zakrad&quot;&gt;@zakrad&lt;/a&gt;), Ashish Sood&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:soodgen@gmail.com&quot;&gt;soodgen@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6981&quot;&gt;6981&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Reserved Ownership Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Paul Sullivan (@sullivph)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:paul.sullivan@manifold.xyz&quot;&gt;paul.sullivan@manifold.xyz&lt;/a&gt;&amp;gt;, Wilkins Chung (@wwchung)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:wilkins@manifold.xyz&quot;&gt;wilkins@manifold.xyz&lt;/a&gt;&amp;gt;, Kartik Patel (@Slokh)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kartik@manifold.xyz&quot;&gt;kartik@manifold.xyz&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7085&quot;&gt;7085&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Relationship Enhancement&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Guang&amp;nbsp;(&lt;a href=&quot;https://github.com/xg1990&quot;&gt;@xg1990&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7087&quot;&gt;7087&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;MIME type for Web3 URL in Auto Mode&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Qi Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;), Nicolas Deschildre&amp;nbsp;(&lt;a href=&quot;https://github.com/nand2&quot;&gt;@nand2&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7093&quot;&gt;7093&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Social Recovery Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;John Zhang&amp;nbsp;(&lt;a href=&quot;https://github.com/johnz1019&quot;&gt;@johnz1019&lt;/a&gt;), Davis Xiang&amp;nbsp;(&lt;a href=&quot;https://github.com/xcshuan&quot;&gt;@xcshuan&lt;/a&gt;), Kyle Xu&amp;nbsp;(&lt;a href=&quot;https://github.com/kylexyxu&quot;&gt;@kylexyxu&lt;/a&gt;), George Zhang&amp;nbsp;(&lt;a href=&quot;https://github.com/odysseus0&quot;&gt;@odysseus0&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7196&quot;&gt;7196&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Simple token, Simplified ERC-20&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Xiang&amp;nbsp;(&lt;a href=&quot;https://github.com/wenzhenxiang&quot;&gt;@wenzhenxiang&lt;/a&gt;), Ben77&amp;nbsp;(&lt;a href=&quot;https://github.com/ben2077&quot;&gt;@ben2077&lt;/a&gt;), Mingshi S.&amp;nbsp;(&lt;a href=&quot;https://github.com/newnewsms&quot;&gt;@newnewsms&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7204&quot;&gt;7204&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract wallet management token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Xiang&amp;nbsp;(&lt;a href=&quot;https://github.com/wenzhenxiang&quot;&gt;@wenzhenxiang&lt;/a&gt;), Ben77&amp;nbsp;(&lt;a href=&quot;https://github.com/ben2077&quot;&gt;@ben2077&lt;/a&gt;), Mingshi S.&amp;nbsp;(&lt;a href=&quot;https://github.com/newnewsms&quot;&gt;@newnewsms&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7254&quot;&gt;7254&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Revenue Sharing&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Quy Phan&amp;nbsp;(&lt;a href=&quot;https://github.com/quyphandang&quot;&gt;@quyphandang&lt;/a&gt;), Quy Phan&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:quy.phan@cryptoviet.info&quot;&gt;quy.phan@cryptoviet.info&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7272&quot;&gt;7272&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum Access Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chris Chung&amp;nbsp;(&lt;a href=&quot;https://github.com/0xpApaSmURf&quot;&gt;@0xpApaSmURf&lt;/a&gt;), Raphael Roullet&amp;nbsp;(&lt;a href=&quot;https://github.com/ra-phael&quot;&gt;@ra-phael&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7280&quot;&gt;7280&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Metadata Extension like JSON-LD&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yohei Nishikubo&amp;nbsp;(&lt;a href=&quot;https://github.com/yoheinishikubo&quot;&gt;@yoheinishikubo&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7303&quot;&gt;7303&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token-Controlled Token Circulation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ko Fujimura&amp;nbsp;(&lt;a href=&quot;https://github.com/kofujimura&quot;&gt;@kofujimura&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7390&quot;&gt;7390&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Vanilla Options for ERC-20 Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ewan Humbert (@Xeway)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:xeway@protonmail.com&quot;&gt;xeway@protonmail.com&lt;/a&gt;&amp;gt;, Lassi Maksimainen (@mlalma)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:lassi.maksimainen@gmail.com&quot;&gt;lassi.maksimainen@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7405&quot;&gt;7405&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Portable Smart Contract Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Aaron Yee&amp;nbsp;(&lt;a href=&quot;https://github.com/aaronyee-eth&quot;&gt;@aaronyee-eth&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7406&quot;&gt;7406&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-Namespace Onchain Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Mengshi Zhang&amp;nbsp;(&lt;a href=&quot;https://github.com/MengshiZhang&quot;&gt;@MengshiZhang&lt;/a&gt;), Zihao Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/zihaoccc&quot;&gt;@zihaoccc&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7410&quot;&gt;7410&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-20 Update Allowance By Spender&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Mohammad Zakeri Rad&amp;nbsp;(&lt;a href=&quot;https://github.com/zakrad&quot;&gt;@zakrad&lt;/a&gt;), Adam Boudjemaa&amp;nbsp;(&lt;a href=&quot;https://github.com/aboudjem&quot;&gt;@aboudjem&lt;/a&gt;), Mohamad Hammoud&amp;nbsp;(&lt;a href=&quot;https://github.com/mohamadhammoud&quot;&gt;@mohamadhammoud&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7412&quot;&gt;7412&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;On-Demand Off-Chain Data Retrieval&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Noah Litvin&amp;nbsp;(&lt;a href=&quot;https://github.com/noahlitvin&quot;&gt;@noahlitvin&lt;/a&gt;), db&amp;nbsp;(&lt;a href=&quot;https://github.com/dbeal-eth&quot;&gt;@dbeal-eth&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7425&quot;&gt;7425&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Tokenized Reserve&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jimmy Debe&amp;nbsp;(&lt;a href=&quot;https://github.com/jimstir&quot;&gt;@jimstir&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7444&quot;&gt;7444&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Time Locks Maturity&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Thanh Trinh (@thanhtrinh2003)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:thanh@revest.finance&quot;&gt;thanh@revest.finance&lt;/a&gt;&amp;gt;, Joshua Weintraub (@jhweintraub)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:josh@revest.finance&quot;&gt;josh@revest.finance&lt;/a&gt;&amp;gt;, Rob Montgomery (@RobAnon)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:rob@revest.finance&quot;&gt;rob@revest.finance&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7484&quot;&gt;7484&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Registry Extension for ERC-7579&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Konrad Kopp&amp;nbsp;(&lt;a href=&quot;https://github.com/kopy-kat&quot;&gt;@kopy-kat&lt;/a&gt;), zeroknots&amp;nbsp;(&lt;a href=&quot;https://github.com/zeroknots&quot;&gt;@zeroknots&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7496&quot;&gt;7496&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Dynamic Traits&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Adam Montgomery&amp;nbsp;(&lt;a href=&quot;https://github.com/montasaurus&quot;&gt;@montasaurus&lt;/a&gt;), Ryan Ghods&amp;nbsp;(&lt;a href=&quot;https://github.com/ryanio&quot;&gt;@ryanio&lt;/a&gt;), 0age&amp;nbsp;(&lt;a href=&quot;https://github.com/0age&quot;&gt;@0age&lt;/a&gt;), James Wenzel&amp;nbsp;(&lt;a href=&quot;https://github.com/emo-eth&quot;&gt;@emo-eth&lt;/a&gt;), Stephan Min&amp;nbsp;(&lt;a href=&quot;https://github.com/stephankmin&quot;&gt;@stephankmin&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7498&quot;&gt;7498&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Redeemables&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ryan Ghods&amp;nbsp;(&lt;a href=&quot;https://github.com/ryanio&quot;&gt;@ryanio&lt;/a&gt;), 0age&amp;nbsp;(&lt;a href=&quot;https://github.com/0age&quot;&gt;@0age&lt;/a&gt;), Adam Montgomery&amp;nbsp;(&lt;a href=&quot;https://github.com/montasaurus&quot;&gt;@montasaurus&lt;/a&gt;), Stephan Min&amp;nbsp;(&lt;a href=&quot;https://github.com/stephankmin&quot;&gt;@stephankmin&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7506&quot;&gt;7506&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Trusted Hint Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Philipp Bolte&amp;nbsp;(&lt;a href=&quot;https://github.com/strumswell&quot;&gt;@strumswell&lt;/a&gt;), Dennis von der Bey&amp;nbsp;(&lt;a href=&quot;https://github.com/DennisVonDerBey&quot;&gt;@DennisVonDerBey&lt;/a&gt;), Lauritz Leifermann&amp;nbsp;(&lt;a href=&quot;https://github.com/lleifermann&quot;&gt;@lleifermann&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7507&quot;&gt;7507&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-User NFT Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ming Jiang&amp;nbsp;(&lt;a href=&quot;https://github.com/minkyn&quot;&gt;@minkyn&lt;/a&gt;), Zheng Han&amp;nbsp;(&lt;a href=&quot;https://github.com/hanbsd&quot;&gt;@hanbsd&lt;/a&gt;), Fan Yang&amp;nbsp;(&lt;a href=&quot;https://github.com/fayang&quot;&gt;@fayang&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7508&quot;&gt;7508&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Dynamic On-Chain Token Attributes Repository&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Steven Pineda&amp;nbsp;(&lt;a href=&quot;https://github.com/steven2308&quot;&gt;@steven2308&lt;/a&gt;), Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7509&quot;&gt;7509&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Entity Component System&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Rickey&amp;nbsp;(&lt;a href=&quot;https://github.com/HelloRickey&quot;&gt;@HelloRickey&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7510&quot;&gt;7510&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross-Contract Hierarchical NFT&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ming Jiang&amp;nbsp;(&lt;a href=&quot;https://github.com/minkyn&quot;&gt;@minkyn&lt;/a&gt;), Zheng Han&amp;nbsp;(&lt;a href=&quot;https://github.com/hanbsd&quot;&gt;@hanbsd&lt;/a&gt;), Fan Yang&amp;nbsp;(&lt;a href=&quot;https://github.com/fayang&quot;&gt;@fayang&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7511&quot;&gt;7511&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Proxy Contract with PUSH0&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;0xAA&amp;nbsp;(&lt;a href=&quot;https://github.com/AmazingAng&quot;&gt;@AmazingAng&lt;/a&gt;), vectorized&amp;nbsp;(&lt;a href=&quot;https://github.com/Vectorized&quot;&gt;@Vectorized&lt;/a&gt;), 0age&amp;nbsp;(&lt;a href=&quot;https://github.com/0age&quot;&gt;@0age&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7512&quot;&gt;7512&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Onchain Representation for Audits&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Richard Meissner - Safe&amp;nbsp;(&lt;a href=&quot;https://github.com/rmeissner&quot;&gt;@rmeissner&lt;/a&gt;), Robert Chen - OtterSec&amp;nbsp;(&lt;a href=&quot;https://github.com/chen-robert&quot;&gt;@chen-robert&lt;/a&gt;), Matthias Egli - ChainSecurity&amp;nbsp;(&lt;a href=&quot;https://github.com/MatthiasEgli&quot;&gt;@MatthiasEgli&lt;/a&gt;), Jan Kalivoda - Ackee Blockchain&amp;nbsp;(&lt;a href=&quot;https://github.com/jaczkal&quot;&gt;@jaczkal&lt;/a&gt;), Michael Lewellen - OpenZeppelin&amp;nbsp;(&lt;a href=&quot;https://github.com/cylon56&quot;&gt;@cylon56&lt;/a&gt;), Shay Zluf - Hats Finance&amp;nbsp;(&lt;a href=&quot;https://github.com/shayzluf&quot;&gt;@shayzluf&lt;/a&gt;), Alex Papageorgiou - Omniscia&amp;nbsp;(&lt;a href=&quot;https://github.com/alex-ppg&quot;&gt;@alex-ppg&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7513&quot;&gt;7513&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Smart NFT - A Component for Intent-Centric&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;MJ Tseng (@TsengMJ)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:tsngmj@gmail.com&quot;&gt;tsngmj@gmail.com&lt;/a&gt;&amp;gt;, Clay (@Clay2018)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:clay.uw@outlook.com&quot;&gt;clay.uw@outlook.com&lt;/a&gt;&amp;gt;, Jeffery.c&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jeffery.c@a3sprotocol.xyz&quot;&gt;jeffery.c@a3sprotocol.xyz&lt;/a&gt;&amp;gt;, Johnny.c&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:johnny.c@a3sprotocol.xyz&quot;&gt;johnny.c@a3sprotocol.xyz&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7517&quot;&gt;7517&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Content Consent for AI/ML Data Mining&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bofu Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/bafu&quot;&gt;@bafu&lt;/a&gt;), Tammy Yang&amp;nbsp;(&lt;a href=&quot;https://github.com/tammyyang&quot;&gt;@tammyyang&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7521&quot;&gt;7521&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;General Intents for Smart Contract Wallets&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Stephen Monn&amp;nbsp;(&lt;a href=&quot;https://github.com/pixelcircuits&quot;&gt;@pixelcircuits&lt;/a&gt;), Bikem Bengisu&amp;nbsp;(&lt;a href=&quot;https://github.com/supiket&quot;&gt;@supiket&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7522&quot;&gt;7522&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;OIDC ZK Verifier for AA Account&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Shu Dong (@dongshu2013)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shu@hexlink.io&quot;&gt;shu@hexlink.io&lt;/a&gt;&amp;gt;, Yudao Yan&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dean@dauth.network&quot;&gt;dean@dauth.network&lt;/a&gt;&amp;gt;, Song Z&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:s@misfit.id&quot;&gt;s@misfit.id&lt;/a&gt;&amp;gt;, Kai Chen&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kai@dauth.network&quot;&gt;kai@dauth.network&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7524&quot;&gt;7524&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;PLUME Signature in Wallets&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yush G (@Divide-By-0)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:aayushg@mit.edu&quot;&gt;aayushg@mit.edu&lt;/a&gt;&amp;gt;, Kobi Gurkan&amp;nbsp;(&lt;a href=&quot;https://github.com/kobigurk&quot;&gt;@kobigurk&lt;/a&gt;), Richard Liu&amp;nbsp;(&lt;a href=&quot;https://github.com/rrrliu&quot;&gt;@rrrliu&lt;/a&gt;), Vivek Bhupatiraju&amp;nbsp;(&lt;a href=&quot;https://github.com/vb7401&quot;&gt;@vb7401&lt;/a&gt;), Barry Whitehat&amp;nbsp;(&lt;a href=&quot;https://github.com/barryWhiteHat&quot;&gt;@barryWhiteHat&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7527&quot;&gt;7527&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Bound Function Oracle AMM&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Elaine Zhang (@lanyinzly)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:lz8aj@virginia.edu&quot;&gt;lz8aj@virginia.edu&lt;/a&gt;&amp;gt;, Jerry&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jerrymindflow@gmail.com&quot;&gt;jerrymindflow@gmail.com&lt;/a&gt;&amp;gt;, Amandafanny&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:amandafanny200@gmail.com&quot;&gt;amandafanny200@gmail.com&lt;/a&gt;&amp;gt;, Shouhao Wong (@wangshouh)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:wongshouhao@outlook.com&quot;&gt;wongshouhao@outlook.com&lt;/a&gt;&amp;gt;, 0xPoet&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:0xpoets@gmail.com&quot;&gt;0xpoets@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7529&quot;&gt;7529&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract Discovery and eTLD+1 Association&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Todd Chapman&amp;nbsp;(&lt;a href=&quot;https://github.com/tthebc01&quot;&gt;@tthebc01&lt;/a&gt;), Charlie Sibbach&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:charlie@cwsoftware.com&quot;&gt;charlie@cwsoftware.com&lt;/a&gt;&amp;gt;, Sean Sing&amp;nbsp;(&lt;a href=&quot;https://github.com/seansing&quot;&gt;@seansing&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7533&quot;&gt;7533&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Public Cross Port&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;George&amp;nbsp;(&lt;a href=&quot;https://github.com/JXRow&quot;&gt;@JXRow&lt;/a&gt;), Zisu&amp;nbsp;(&lt;a href=&quot;https://github.com/lazy1523&quot;&gt;@lazy1523&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7538&quot;&gt;7538&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multiplicative Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gavin John&amp;nbsp;(&lt;a href=&quot;https://github.com/Pandapip1&quot;&gt;@Pandapip1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7546&quot;&gt;7546&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Upgradeable Clone for Scalable Contracts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Shogo Ochiai (@shogochiai)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shogo.ochiai@pm.me&quot;&gt;shogo.ochiai@pm.me&lt;/a&gt;&amp;gt;, Kai Hiroi (@KaiHiroi)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kai.hiroi@pm.me&quot;&gt;kai.hiroi@pm.me&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7548&quot;&gt;7548&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Open IP Protocol built on NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Combo&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:combo@1combo.io&quot;&gt;combo@1combo.io&lt;/a&gt;&amp;gt;, Saitama&amp;nbsp;(&lt;a href=&quot;https://github.com/saitama2009&quot;&gt;@saitama2009&lt;/a&gt;), CT29&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:CT29@1combo.io&quot;&gt;CT29@1combo.io&lt;/a&gt;&amp;gt;, Luigi&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:luigi@1combo.io&quot;&gt;luigi@1combo.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7555&quot;&gt;7555&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Single Sign-On for Account Discovery&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alexander Müller&amp;nbsp;(&lt;a href=&quot;https://github.com/alexmmueller&quot;&gt;@alexmmueller&lt;/a&gt;), Gregory Markou&amp;nbsp;(&lt;a href=&quot;https://github.com/GregTheGreek&quot;&gt;@GregTheGreek&lt;/a&gt;), Willem Olding&amp;nbsp;(&lt;a href=&quot;https://github.com/Wollum&quot;&gt;@Wollum&lt;/a&gt;), Belma Gutlic&amp;nbsp;(&lt;a href=&quot;https://github.com/morrigan&quot;&gt;@morrigan&lt;/a&gt;), Marin Petrunić&amp;nbsp;(&lt;a href=&quot;https://github.com/mpetrunic&quot;&gt;@mpetrunic&lt;/a&gt;), Pedro Gomes&amp;nbsp;(&lt;a href=&quot;https://github.com/pedrouid&quot;&gt;@pedrouid&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7561&quot;&gt;7561&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Simple NFT, Simplified ERC-721&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Xiang&amp;nbsp;(&lt;a href=&quot;https://github.com/wenzhenxiang&quot;&gt;@wenzhenxiang&lt;/a&gt;), Ben77&amp;nbsp;(&lt;a href=&quot;https://github.com/ben2077&quot;&gt;@ben2077&lt;/a&gt;), Mingshi S.&amp;nbsp;(&lt;a href=&quot;https://github.com/newnewsms&quot;&gt;@newnewsms&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7562&quot;&gt;7562&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Account Abstraction Validation Scope Rules&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yoav Weiss&amp;nbsp;(&lt;a href=&quot;https://github.com/yoavw&quot;&gt;@yoavw&lt;/a&gt;), Dror Tirosh&amp;nbsp;(&lt;a href=&quot;https://github.com/drortirosh&quot;&gt;@drortirosh&lt;/a&gt;), Alex Forshtat&amp;nbsp;(&lt;a href=&quot;https://github.com/forshtat&quot;&gt;@forshtat&lt;/a&gt;), Shahaf Nacson&amp;nbsp;(&lt;a href=&quot;https://github.com/shahafn&quot;&gt;@shahafn&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7564&quot;&gt;7564&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract wallet management NFT&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Xiang&amp;nbsp;(&lt;a href=&quot;https://github.com/wenzhenxiang&quot;&gt;@wenzhenxiang&lt;/a&gt;), Ben77&amp;nbsp;(&lt;a href=&quot;https://github.com/ben2077&quot;&gt;@ben2077&lt;/a&gt;), Mingshi S.&amp;nbsp;(&lt;a href=&quot;https://github.com/newnewsms&quot;&gt;@newnewsms&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7565&quot;&gt;7565&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Perpetual Contract NFTs as Collateral&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Hyoungsung Kim (@HyoungsungKim)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:hyougnsung@keti.re.kr&quot;&gt;hyougnsung@keti.re.kr&lt;/a&gt;&amp;gt;, Yong-Suk Park&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:yspark@keti.re.kr&quot;&gt;yspark@keti.re.kr&lt;/a&gt;&amp;gt;, Hyun-Sik Kim&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:hskim@keti.re.kr&quot;&gt;hskim@keti.re.kr&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7566&quot;&gt;7566&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multiplayer Game Communication&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Rickey&amp;nbsp;(&lt;a href=&quot;https://github.com/HelloRickey&quot;&gt;@HelloRickey&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7572&quot;&gt;7572&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract-level metadata via `contractURI()`&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Devin Finzer&amp;nbsp;(&lt;a href=&quot;https://github.com/dfinzer&quot;&gt;@dfinzer&lt;/a&gt;), Alex Atallah&amp;nbsp;(&lt;a href=&quot;https://github.com/alexanderatallah&quot;&gt;@alexanderatallah&lt;/a&gt;), Ryan Ghods&amp;nbsp;(&lt;a href=&quot;https://github.com/ryanio&quot;&gt;@ryanio&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7573&quot;&gt;7573&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Conditional-upon-Transfer-Decryption for DvP&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Christian Fries&amp;nbsp;(&lt;a href=&quot;https://github.com/cfries&quot;&gt;@cfries&lt;/a&gt;), Peter Kohl-Landgraf&amp;nbsp;(&lt;a href=&quot;https://github.com/pekola&quot;&gt;@pekola&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7579&quot;&gt;7579&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Modular Smart Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;zeroknots&amp;nbsp;(&lt;a href=&quot;https://github.com/zeroknots&quot;&gt;@zeroknots&lt;/a&gt;), Konrad Kopp&amp;nbsp;(&lt;a href=&quot;https://github.com/kopy-kat&quot;&gt;@kopy-kat&lt;/a&gt;), Taek Lee&amp;nbsp;(&lt;a href=&quot;https://github.com/leekt&quot;&gt;@leekt&lt;/a&gt;), Fil Makarov&amp;nbsp;(&lt;a href=&quot;https://github.com/filmakarov&quot;&gt;@filmakarov&lt;/a&gt;), Elim Poon&amp;nbsp;(&lt;a href=&quot;https://github.com/yaonam&quot;&gt;@yaonam&lt;/a&gt;), Lyu Min&amp;nbsp;(&lt;a href=&quot;https://github.com/rockmin216&quot;&gt;@rockmin216&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7580&quot;&gt;7580&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Advertisement Tracking Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;wart&amp;nbsp;(&lt;a href=&quot;https://github.com/wartstone&quot;&gt;@wartstone&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7582&quot;&gt;7582&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Modular Accounts with Delegated Validation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Shivanshi Tyagi&amp;nbsp;(&lt;a href=&quot;https://github.com/nerderlyne&quot;&gt;@nerderlyne&lt;/a&gt;), Ross Campbell&amp;nbsp;(&lt;a href=&quot;https://github.com/z0r0z&quot;&gt;@z0r0z&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7585&quot;&gt;7585&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;MixHash and Public Data Storage Proofs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Liu Zhicong&amp;nbsp;(&lt;a href=&quot;https://github.com/waterflier&quot;&gt;@waterflier&lt;/a&gt;), William Entriken&amp;nbsp;(&lt;a href=&quot;https://github.com/fulldecent&quot;&gt;@fulldecent&lt;/a&gt;), Wei Qiushi&amp;nbsp;(&lt;a href=&quot;https://github.com/weiqiushi&quot;&gt;@weiqiushi&lt;/a&gt;), Si Changjun&amp;nbsp;(&lt;a href=&quot;https://github.com/photosssa&quot;&gt;@photosssa&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7589&quot;&gt;7589&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Semi-Fungible Token Roles&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ernani São Thiago&amp;nbsp;(&lt;a href=&quot;https://github.com/ernanirst&quot;&gt;@ernanirst&lt;/a&gt;), Daniel Lima&amp;nbsp;(&lt;a href=&quot;https://github.com/karacurt&quot;&gt;@karacurt&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7595&quot;&gt;7595&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Collateralized NFT&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;571nKY&amp;nbsp;(&lt;a href=&quot;https://github.com/571nKY&quot;&gt;@571nKY&lt;/a&gt;), Cosmos&amp;nbsp;(&lt;a href=&quot;https://github.com/Cosmos4k&quot;&gt;@Cosmos4k&lt;/a&gt;), f4t50&amp;nbsp;(&lt;a href=&quot;https://github.com/f4t50&quot;&gt;@f4t50&lt;/a&gt;), Harpocrates&amp;nbsp;(&lt;a href=&quot;https://github.com/harpocrates555&quot;&gt;@harpocrates555&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7597&quot;&gt;7597&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Signature Validation Extension for Permit&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yvonne Zhang&amp;nbsp;(&lt;a href=&quot;https://github.com/yvonnezhangc&quot;&gt;@yvonnezhangc&lt;/a&gt;), Aloysius Chan&amp;nbsp;(&lt;a href=&quot;https://github.com/circle-aloychan&quot;&gt;@circle-aloychan&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7598&quot;&gt;7598&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Use contract signature for signed transfer&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yvonne Zhang&amp;nbsp;(&lt;a href=&quot;https://github.com/yvonnezhangc&quot;&gt;@yvonnezhangc&lt;/a&gt;), Aloysius Chan&amp;nbsp;(&lt;a href=&quot;https://github.com/circle-aloychan&quot;&gt;@circle-aloychan&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7603&quot;&gt;7603&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-1155 Multi-Asset extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Haru&amp;nbsp;(&lt;a href=&quot;https://github.com/haruu8&quot;&gt;@haruu8&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7604&quot;&gt;7604&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-1155 Permit Approvals&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;calvbore&amp;nbsp;(&lt;a href=&quot;https://github.com/calvbore&quot;&gt;@calvbore&lt;/a&gt;), emiliolanzalaco&amp;nbsp;(&lt;a href=&quot;https://github.com/emiliolanzalaco&quot;&gt;@emiliolanzalaco&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7613&quot;&gt;7613&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Puppet Proxy Contract&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Igor Żuk&amp;nbsp;(&lt;a href=&quot;https://github.com/CodeSandwich&quot;&gt;@CodeSandwich&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7615&quot;&gt;7615&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Atomic Push-based Data Feed Among Contracts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Elaine Zhang (@lanyinzly)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:lz8aj@virginia.edu&quot;&gt;lz8aj@virginia.edu&lt;/a&gt;&amp;gt;, Jerry&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jerrymindflow@gmail.com&quot;&gt;jerrymindflow@gmail.com&lt;/a&gt;&amp;gt;, Amandafanny&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:amandafanny200@gmail.com&quot;&gt;amandafanny200@gmail.com&lt;/a&gt;&amp;gt;, Shouhao Wong (@wangshouh)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:wongshouhao@outlook.com&quot;&gt;wongshouhao@outlook.com&lt;/a&gt;&amp;gt;, Doris Che (@Cheyukj)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dorischeyy@gmail.com&quot;&gt;dorischeyy@gmail.com&lt;/a&gt;&amp;gt;, Henry Yuan (@onehumanbeing)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:hy2878@nyu.edu&quot;&gt;hy2878@nyu.edu&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7617&quot;&gt;7617&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Chunk support for ERC-5219 mode in Web3 URL&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Qi Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;), Nicolas Deschildre&amp;nbsp;(&lt;a href=&quot;https://github.com/nand2&quot;&gt;@nand2&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7618&quot;&gt;7618&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Content encoding in ERC-5219 mode Web3 URL&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Qi Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;), Nicolas Deschildre&amp;nbsp;(&lt;a href=&quot;https://github.com/nand2&quot;&gt;@nand2&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7621&quot;&gt;7621&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Basket Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Dominic Ryder&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dom@alvara.xyz&quot;&gt;dom@alvara.xyz&lt;/a&gt;&amp;gt;, Michael Ryder&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mike@alvara.xyz&quot;&gt;mike@alvara.xyz&lt;/a&gt;&amp;gt;, Callum Mitchell-Clark (@AlvaraProtocol)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:cal@alvara.xyz&quot;&gt;cal@alvara.xyz&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7629&quot;&gt;7629&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-20/ERC-721 Unified Token Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;0xZeus1111&amp;nbsp;(&lt;a href=&quot;https://github.com/0xZeus1111&quot;&gt;@0xZeus1111&lt;/a&gt;), Nvuwa&amp;nbsp;(&lt;a href=&quot;https://github.com/Nvuwa&quot;&gt;@Nvuwa&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7632&quot;&gt;7632&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Interfaces for Named Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7638&quot;&gt;7638&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Batch Calls Encoding in SCA&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;George&amp;nbsp;(&lt;a href=&quot;https://github.com/JXRow&quot;&gt;@JXRow&lt;/a&gt;), Zisu&amp;nbsp;(&lt;a href=&quot;https://github.com/lazy1523&quot;&gt;@lazy1523&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7641&quot;&gt;7641&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Intrinsic RevShare Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Conway&amp;nbsp;(&lt;a href=&quot;https://github.com/0x1cc&quot;&gt;@0x1cc&lt;/a&gt;), Cathie So&amp;nbsp;(&lt;a href=&quot;https://github.com/socathie&quot;&gt;@socathie&lt;/a&gt;), Xiaohang Yu&amp;nbsp;(&lt;a href=&quot;https://github.com/xhyumiracle&quot;&gt;@xhyumiracle&lt;/a&gt;), Suning Yao&amp;nbsp;(&lt;a href=&quot;https://github.com/fewwwww&quot;&gt;@fewwwww&lt;/a&gt;), Kartin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kartin@hyperoracle.io&quot;&gt;kartin@hyperoracle.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7644&quot;&gt;7644&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Name Registry Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chen Liaoyuan&amp;nbsp;(&lt;a href=&quot;https://github.com/chenly&quot;&gt;@chenly&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7649&quot;&gt;7649&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Bonding curve-embedded liquidity for NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Arif Khan&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:arif@alethea.ai&quot;&gt;arif@alethea.ai&lt;/a&gt;&amp;gt;, Ahmad Matyana&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ahmad@alethea.ai&quot;&gt;ahmad@alethea.ai&lt;/a&gt;&amp;gt;, Basil Gorin&amp;nbsp;(&lt;a href=&quot;https://github.com/vgorin&quot;&gt;@vgorin&lt;/a&gt;), Vijay Bhayani&amp;nbsp;(&lt;a href=&quot;https://github.com/unblocktechie&quot;&gt;@unblocktechie&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7651&quot;&gt;7651&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Fractionally Represented Non-Fungible Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Acme&amp;nbsp;(&lt;a href=&quot;https://github.com/0xacme&quot;&gt;@0xacme&lt;/a&gt;), Calder&amp;nbsp;(&lt;a href=&quot;https://github.com/caldereth&quot;&gt;@caldereth&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7652&quot;&gt;7652&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Guarantee Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Liu.C.Dao (@CDao)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:iunknow@163.com&quot;&gt;iunknow@163.com&lt;/a&gt;&amp;gt;, Sam&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:1047180870@qq.com&quot;&gt;1047180870@qq.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7654&quot;&gt;7654&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Request Method Types&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Rickey&amp;nbsp;(&lt;a href=&quot;https://github.com/HelloRickey&quot;&gt;@HelloRickey&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7662&quot;&gt;7662&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;AI Agent NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Greg Marlin&amp;nbsp;(&lt;a href=&quot;https://github.com/marleymarl&quot;&gt;@marleymarl&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7679&quot;&gt;7679&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;UserOperation Builder&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Derek Chiang&amp;nbsp;(&lt;a href=&quot;https://github.com/derekchiang&quot;&gt;@derekchiang&lt;/a&gt;), Garvit Khatri&amp;nbsp;(&lt;a href=&quot;https://github.com/plusminushalf&quot;&gt;@plusminushalf&lt;/a&gt;), Fil Makarov&amp;nbsp;(&lt;a href=&quot;https://github.com/filmakarov&quot;&gt;@filmakarov&lt;/a&gt;), Kristof Gazso&amp;nbsp;(&lt;a href=&quot;https://github.com/kristofgazso&quot;&gt;@kristofgazso&lt;/a&gt;), Derek Rein&amp;nbsp;(&lt;a href=&quot;https://github.com/arein&quot;&gt;@arein&lt;/a&gt;), Tomas Rocchi&amp;nbsp;(&lt;a href=&quot;https://github.com/tomiir&quot;&gt;@tomiir&lt;/a&gt;), bumblefudge&amp;nbsp;(&lt;a href=&quot;https://github.com/bumblefudge&quot;&gt;@bumblefudge&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7681&quot;&gt;7681&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Dual Nature Multi Token Protocol&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sennett Lau&amp;nbsp;(&lt;a href=&quot;https://github.com/sennett-lau&quot;&gt;@sennett-lau&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7682&quot;&gt;7682&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Auxiliary Funds Capability&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lukas Rosario&amp;nbsp;(&lt;a href=&quot;https://github.com/lukasrosario&quot;&gt;@lukasrosario&lt;/a&gt;), Wilson Cusack&amp;nbsp;(&lt;a href=&quot;https://github.com/wilsoncusack&quot;&gt;@wilsoncusack&lt;/a&gt;), Alex Donesky&amp;nbsp;(&lt;a href=&quot;https://github.com/adonesky1&quot;&gt;@adonesky1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7683&quot;&gt;7683&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross Chain Intents&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Mark Toda&amp;nbsp;(&lt;a href=&quot;https://github.com/marktoda&quot;&gt;@marktoda&lt;/a&gt;), Matt Rice&amp;nbsp;(&lt;a href=&quot;https://github.com/mrice32&quot;&gt;@mrice32&lt;/a&gt;), Nick Pai&amp;nbsp;(&lt;a href=&quot;https://github.com/nicholaspai&quot;&gt;@nicholaspai&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7694&quot;&gt;7694&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Solana Storage Router&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Avneet Singh&amp;nbsp;(&lt;a href=&quot;https://github.com/sshmatrix&quot;&gt;@sshmatrix&lt;/a&gt;), 0xc0de4c0ffee&amp;nbsp;(&lt;a href=&quot;https://github.com/0xc0de4c0ffee&quot;&gt;@0xc0de4c0ffee&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7695&quot;&gt;7695&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ownership Delegation and Context for ERC-721&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Duc Tho Tran&amp;nbsp;(&lt;a href=&quot;https://github.com/ducthotran2010&quot;&gt;@ducthotran2010&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7699&quot;&gt;7699&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-20 Transfer Reference Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Radek Svarz&amp;nbsp;(&lt;a href=&quot;https://github.com/radeksvarz&quot;&gt;@radeksvarz&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7700&quot;&gt;7700&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross-chain Storage Router Protocol&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Avneet Singh&amp;nbsp;(&lt;a href=&quot;https://github.com/sshmatrix&quot;&gt;@sshmatrix&lt;/a&gt;), 0xc0de4c0ffee&amp;nbsp;(&lt;a href=&quot;https://github.com/0xc0de4c0ffee&quot;&gt;@0xc0de4c0ffee&lt;/a&gt;), Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;), Makoto Inoue&amp;nbsp;(&lt;a href=&quot;https://github.com/makoto&quot;&gt;@makoto&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7710&quot;&gt;7710&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Smart Contract Delegation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ryan McPeck&amp;nbsp;(&lt;a href=&quot;https://github.com/McOso&quot;&gt;@McOso&lt;/a&gt;), Dan Finlay&amp;nbsp;(&lt;a href=&quot;https://github.com/DanFinlay&quot;&gt;@DanFinlay&lt;/a&gt;), Rob Dawson&amp;nbsp;(&lt;a href=&quot;https://github.com/rojotek&quot;&gt;@rojotek&lt;/a&gt;), Derek Chiang&amp;nbsp;(&lt;a href=&quot;https://github.com/derekchiang&quot;&gt;@derekchiang&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7715&quot;&gt;7715&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Request Permissions from Wallets&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Luka Isailovic&amp;nbsp;(&lt;a href=&quot;https://github.com/lukaisailovic&quot;&gt;@lukaisailovic&lt;/a&gt;), Derek Rein&amp;nbsp;(&lt;a href=&quot;https://github.com/arein&quot;&gt;@arein&lt;/a&gt;), Dan Finlay&amp;nbsp;(&lt;a href=&quot;https://github.com/danfinlay&quot;&gt;@danfinlay&lt;/a&gt;), Derek Chiang&amp;nbsp;(&lt;a href=&quot;https://github.com/derekchiang&quot;&gt;@derekchiang&lt;/a&gt;), Fil Makarov&amp;nbsp;(&lt;a href=&quot;https://github.com/filmakarov&quot;&gt;@filmakarov&lt;/a&gt;), Pedro Gomes&amp;nbsp;(&lt;a href=&quot;https://github.com/pedrouid&quot;&gt;@pedrouid&lt;/a&gt;), Conner Swenberg&amp;nbsp;(&lt;a href=&quot;https://github.com/ilikesymmetry&quot;&gt;@ilikesymmetry&lt;/a&gt;), Lukas Rosario&amp;nbsp;(&lt;a href=&quot;https://github.com/lukasrosario&quot;&gt;@lukasrosario&lt;/a&gt;), Idris Bowman&amp;nbsp;(&lt;a href=&quot;https://github.com/V00D00-child&quot;&gt;@V00D00-child&lt;/a&gt;), Jeff Smale&amp;nbsp;(&lt;a href=&quot;https://github.com/jeffsmale90&quot;&gt;@jeffsmale90&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7720&quot;&gt;7720&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Deferred Token Transfer&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chen Liaoyuan (@chenly)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:cly@kip.pro&quot;&gt;cly@kip.pro&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7721&quot;&gt;7721&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Lockable Extension for ERC-1155&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Piyush Chittara&amp;nbsp;(&lt;a href=&quot;https://github.com/piyush-chittara&quot;&gt;@piyush-chittara&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7722&quot;&gt;7722&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Opaque Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ivica Aračić&amp;nbsp;(&lt;a href=&quot;https://github.com/ivica7&quot;&gt;@ivica7&lt;/a&gt;), Ante Bešlić&amp;nbsp;(&lt;a href=&quot;https://github.com/ethSplit&quot;&gt;@ethSplit&lt;/a&gt;), Mirko Katanić&amp;nbsp;(&lt;a href=&quot;https://github.com/mkatanic&quot;&gt;@mkatanic&lt;/a&gt;),  SWIAT&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7726&quot;&gt;7726&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Common Quote Oracle&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;alcueca&amp;nbsp;(&lt;a href=&quot;https://github.com/alcueca&quot;&gt;@alcueca&lt;/a&gt;), ruvaag&amp;nbsp;(&lt;a href=&quot;https://github.com/ruvaag&quot;&gt;@ruvaag&lt;/a&gt;), totomanov&amp;nbsp;(&lt;a href=&quot;https://github.com/totomanov&quot;&gt;@totomanov&lt;/a&gt;), r0ohafza&amp;nbsp;(&lt;a href=&quot;https://github.com/r0ohafza&quot;&gt;@r0ohafza&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7729&quot;&gt;7729&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token with Metadata&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;msfew&amp;nbsp;(&lt;a href=&quot;https://github.com/fewwwww&quot;&gt;@fewwwww&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7730&quot;&gt;7730&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Structured Data Clear Signing Format&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Laurent Castillo&amp;nbsp;(&lt;a href=&quot;https://github.com/lcastillo-ledger&quot;&gt;@lcastillo-ledger&lt;/a&gt;), Derek Rein&amp;nbsp;(&lt;a href=&quot;https://github.com/arein&quot;&gt;@arein&lt;/a&gt;), Pierre Aoun&amp;nbsp;(&lt;a href=&quot;https://github.com/paoun-ledger&quot;&gt;@paoun-ledger&lt;/a&gt;), Arik Galansky&amp;nbsp;(&lt;a href=&quot;https://github.com/arikg&quot;&gt;@arikg&lt;/a&gt;), Bartosz Rozwarski&amp;nbsp;(&lt;a href=&quot;https://github.com/llbartekll&quot;&gt;@llbartekll&lt;/a&gt;), Kaan Uzdogan&amp;nbsp;(&lt;a href=&quot;https://github.com/kuzdogan&quot;&gt;@kuzdogan&lt;/a&gt;), Fredrik&amp;nbsp;(&lt;a href=&quot;https://github.com/Fredrik0x&quot;&gt;@Fredrik0x&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7738&quot;&gt;7738&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Permissionless Script Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Victor Zhang&amp;nbsp;(&lt;a href=&quot;https://github.com/zhangzhongnan928&quot;&gt;@zhangzhongnan928&lt;/a&gt;), James Brown&amp;nbsp;(&lt;a href=&quot;https://github.com/JamesSmartCell&quot;&gt;@JamesSmartCell&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7739&quot;&gt;7739&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Readable Typed Signatures for Smart Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;vectorized&amp;nbsp;(&lt;a href=&quot;https://github.com/vectorized&quot;&gt;@vectorized&lt;/a&gt;), Sihoon Lee&amp;nbsp;(&lt;a href=&quot;https://github.com/push0ebp&quot;&gt;@push0ebp&lt;/a&gt;), Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;), Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;), Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;), Im Juno&amp;nbsp;(&lt;a href=&quot;https://github.com/junomonster&quot;&gt;@junomonster&lt;/a&gt;), howydev&amp;nbsp;(&lt;a href=&quot;https://github.com/howydev&quot;&gt;@howydev&lt;/a&gt;), Atarpara&amp;nbsp;(&lt;a href=&quot;https://github.com/Atarpara&quot;&gt;@Atarpara&lt;/a&gt;), 0xcuriousapple&amp;nbsp;(&lt;a href=&quot;https://github.com/0xcuriousapple&quot;&gt;@0xcuriousapple&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7741&quot;&gt;7741&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Authorize Operator&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jeroen Offerijns&amp;nbsp;(&lt;a href=&quot;https://github.com/hieronx&quot;&gt;@hieronx&lt;/a&gt;), João Martins&amp;nbsp;(&lt;a href=&quot;https://github.com/0xTimepunk&quot;&gt;@0xTimepunk&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7754&quot;&gt;7754&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Tamperproof Extension Wallets API (TWIST)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Erik Marks&amp;nbsp;(&lt;a href=&quot;https://github.com/remarks&quot;&gt;@remarks&lt;/a&gt;), Guillaume Grosbois&amp;nbsp;(&lt;a href=&quot;https://github.com/uni-guillaume&quot;&gt;@uni-guillaume&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7760&quot;&gt;7760&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Upgradeable Proxies&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Atarpara&amp;nbsp;(&lt;a href=&quot;https://github.com/Atarpara&quot;&gt;@Atarpara&lt;/a&gt;), JT Riley&amp;nbsp;(&lt;a href=&quot;https://github.com/jtriley-eth&quot;&gt;@jtriley-eth&lt;/a&gt;), Thomas&amp;nbsp;(&lt;a href=&quot;https://github.com/0xth0mas&quot;&gt;@0xth0mas&lt;/a&gt;), xiaobaiskill&amp;nbsp;(&lt;a href=&quot;https://github.com/xiaobaiskill&quot;&gt;@xiaobaiskill&lt;/a&gt;), Vectorized&amp;nbsp;(&lt;a href=&quot;https://github.com/Vectorized&quot;&gt;@Vectorized&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7765&quot;&gt;7765&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Privileged Non-Fungible Tokens Tied To RWA&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;frank (@frankmint2024)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:frank@mintchain.io&quot;&gt;frank@mintchain.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7766&quot;&gt;7766&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Signature Aggregation for ERC-4337&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Vitalik Buterin&amp;nbsp;(&lt;a href=&quot;https://github.com/vbuterin&quot;&gt;@vbuterin&lt;/a&gt;), Yoav Weiss&amp;nbsp;(&lt;a href=&quot;https://github.com/yoavw&quot;&gt;@yoavw&lt;/a&gt;), Dror Tirosh&amp;nbsp;(&lt;a href=&quot;https://github.com/drortirosh&quot;&gt;@drortirosh&lt;/a&gt;), Shahaf Nacson&amp;nbsp;(&lt;a href=&quot;https://github.com/shahafn&quot;&gt;@shahafn&lt;/a&gt;), Alex Forshtat&amp;nbsp;(&lt;a href=&quot;https://github.com/forshtat&quot;&gt;@forshtat&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7769&quot;&gt;7769&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;JSON-RPC API for ERC-4337&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Vitalik Buterin&amp;nbsp;(&lt;a href=&quot;https://github.com/vbuterin&quot;&gt;@vbuterin&lt;/a&gt;), Yoav Weiss&amp;nbsp;(&lt;a href=&quot;https://github.com/yoavw&quot;&gt;@yoavw&lt;/a&gt;), Dror Tirosh&amp;nbsp;(&lt;a href=&quot;https://github.com/drortirosh&quot;&gt;@drortirosh&lt;/a&gt;), Shahaf Nacson&amp;nbsp;(&lt;a href=&quot;https://github.com/shahafn&quot;&gt;@shahafn&lt;/a&gt;), Alex Forshtat&amp;nbsp;(&lt;a href=&quot;https://github.com/forshtat&quot;&gt;@forshtat&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7770&quot;&gt;7770&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Fractional Reserve Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yaron Velner&amp;nbsp;(&lt;a href=&quot;https://github.com/yaronvel&quot;&gt;@yaronvel&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7774&quot;&gt;7774&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cache invalidation in ERC-5219 mode Web3 URL&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nicolas Deschildre&amp;nbsp;(&lt;a href=&quot;https://github.com/nand2&quot;&gt;@nand2&lt;/a&gt;), Sam Wilson&amp;nbsp;(&lt;a href=&quot;https://github.com/SamWilsn&quot;&gt;@SamWilsn&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7779&quot;&gt;7779&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Interoperable Delegated Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;David Kim&amp;nbsp;(&lt;a href=&quot;https://github.com/PowerStream3604&quot;&gt;@PowerStream3604&lt;/a&gt;), Richard Meissner&amp;nbsp;(&lt;a href=&quot;https://github.com/rmeissner&quot;&gt;@rmeissner&lt;/a&gt;), Akshay Patel&amp;nbsp;(&lt;a href=&quot;https://github.com/akshay-ap&quot;&gt;@akshay-ap&lt;/a&gt;), Joshua Kim&amp;nbsp;(&lt;a href=&quot;https://github.com/LightningHun&quot;&gt;@LightningHun&lt;/a&gt;), Fangting&amp;nbsp;(&lt;a href=&quot;https://github.com/trinity-0111&quot;&gt;@trinity-0111&lt;/a&gt;), Yoav Weiss&amp;nbsp;(&lt;a href=&quot;https://github.com/yoavw&quot;&gt;@yoavw&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7780&quot;&gt;7780&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Validation Module Extension for ERC-7579&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;zeroknots&amp;nbsp;(&lt;a href=&quot;https://github.com/zeroknots&quot;&gt;@zeroknots&lt;/a&gt;), Konrad Kopp&amp;nbsp;(&lt;a href=&quot;https://github.com/kopy-kat&quot;&gt;@kopy-kat&lt;/a&gt;), Taek Lee&amp;nbsp;(&lt;a href=&quot;https://github.com/leekt&quot;&gt;@leekt&lt;/a&gt;), Fil Makarov&amp;nbsp;(&lt;a href=&quot;https://github.com/filmakarov&quot;&gt;@filmakarov&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7785&quot;&gt;7785&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Onchain registration of chain identifiers&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Marco Stronati&amp;nbsp;(&lt;a href=&quot;https://github.com/paracetamolo&quot;&gt;@paracetamolo&lt;/a&gt;), Jeff Lau&amp;nbsp;(&lt;a href=&quot;https://github.com/jefflau&quot;&gt;@jefflau&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7787&quot;&gt;7787&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Soulbound Degradable Governance&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Guilherme Neves&amp;nbsp;(&lt;a href=&quot;https://github.com/0xneves&quot;&gt;@0xneves&lt;/a&gt;), Rafael Castaneda&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:rafaelcastaneda@gmail.com&quot;&gt;rafaelcastaneda@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7794&quot;&gt;7794&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Grant Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Guilherme Neves&amp;nbsp;(&lt;a href=&quot;https://github.com/0xneves&quot;&gt;@0xneves&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7795&quot;&gt;7795&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wallet Call Token Capabilities&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Agustín Aguilar&amp;nbsp;(&lt;a href=&quot;https://github.com/agusx1211&quot;&gt;@agusx1211&lt;/a&gt;), Michael Standen&amp;nbsp;(&lt;a href=&quot;https://github.com/ScreamingHawk&quot;&gt;@ScreamingHawk&lt;/a&gt;), Peter Kieltyka&amp;nbsp;(&lt;a href=&quot;https://github.com/pkieltyka&quot;&gt;@pkieltyka&lt;/a&gt;), William Hua&amp;nbsp;(&lt;a href=&quot;https://github.com/attente&quot;&gt;@attente&lt;/a&gt;), Philippe Castonguay&amp;nbsp;(&lt;a href=&quot;https://github.com/PhABC&quot;&gt;@PhABC&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7796&quot;&gt;7796&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Conditional send transaction RPC&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Dror Tirosh&amp;nbsp;(&lt;a href=&quot;https://github.com/drortirosh&quot;&gt;@drortirosh&lt;/a&gt;), Yoav Weiss&amp;nbsp;(&lt;a href=&quot;https://github.com/yoavw&quot;&gt;@yoavw&lt;/a&gt;), Alex Forshtat&amp;nbsp;(&lt;a href=&quot;https://github.com/forshtat&quot;&gt;@forshtat&lt;/a&gt;), Shahaf Nacson&amp;nbsp;(&lt;a href=&quot;https://github.com/shahafn&quot;&gt;@shahafn&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7802&quot;&gt;7802&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token With Mint/Burn Access Across Chains&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;skeletor&amp;nbsp;(&lt;a href=&quot;https://github.com/skeletor-spaceman&quot;&gt;@skeletor-spaceman&lt;/a&gt;), parti&amp;nbsp;(&lt;a href=&quot;https://github.com/0xParticle&quot;&gt;@0xParticle&lt;/a&gt;), joxes&amp;nbsp;(&lt;a href=&quot;https://github.com/Joxess&quot;&gt;@Joxess&lt;/a&gt;), ng&amp;nbsp;(&lt;a href=&quot;https://github.com/0xng&quot;&gt;@0xng&lt;/a&gt;), agus duha&amp;nbsp;(&lt;a href=&quot;https://github.com/agusduha&quot;&gt;@agusduha&lt;/a&gt;), disco&amp;nbsp;(&lt;a href=&quot;https://github.com/0xDiscotech&quot;&gt;@0xDiscotech&lt;/a&gt;), gotzen&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:gotzen@defi.sucks&quot;&gt;gotzen@defi.sucks&lt;/a&gt;&amp;gt;, 0age&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:0age@uniswap.org&quot;&gt;0age@uniswap.org&lt;/a&gt;&amp;gt;, Mark Tyneway&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mark@oplabs.co&quot;&gt;mark@oplabs.co&lt;/a&gt;&amp;gt;, Zain Bacchus&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:zain@oplabs.co&quot;&gt;zain@oplabs.co&lt;/a&gt;&amp;gt;, Matt Solomon&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:msolomon@oplabs.co&quot;&gt;msolomon@oplabs.co&lt;/a&gt;&amp;gt;, Maurelian&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:maurelian@protonmail.ch&quot;&gt;maurelian@protonmail.ch&lt;/a&gt;&amp;gt;, Blaine Malone&amp;nbsp;(&lt;a href=&quot;https://github.com/blmalone&quot;&gt;@blmalone&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7803&quot;&gt;7803&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;EIP-712 Extensions for Account Abstraction&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7806&quot;&gt;7806&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal intent-centric EOA smart account&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;hellohanchen&amp;nbsp;(&lt;a href=&quot;https://github.com/hellohanchen&quot;&gt;@hellohanchen&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7811&quot;&gt;7811&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wallet Asset Discovery&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Luka Isailovic&amp;nbsp;(&lt;a href=&quot;https://github.com/lukaisailovic&quot;&gt;@lukaisailovic&lt;/a&gt;), Konrad Kopp&amp;nbsp;(&lt;a href=&quot;https://github.com/kopy-kat&quot;&gt;@kopy-kat&lt;/a&gt;), Derek Rein&amp;nbsp;(&lt;a href=&quot;https://github.com/arein&quot;&gt;@arein&lt;/a&gt;), Chris Smith&amp;nbsp;(&lt;a href=&quot;https://github.com/chris13524&quot;&gt;@chris13524&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7821&quot;&gt;7821&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Batch Executor Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Vectorized&amp;nbsp;(&lt;a href=&quot;https://github.com/Vectorized&quot;&gt;@Vectorized&lt;/a&gt;), Jake Moxey&amp;nbsp;(&lt;a href=&quot;https://github.com/jxom&quot;&gt;@jxom&lt;/a&gt;), Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7827&quot;&gt;7827&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;JSON Contract with Value Version Control&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;lex-clinic&amp;nbsp;(&lt;a href=&quot;https://github.com/lex-clinic&quot;&gt;@lex-clinic&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7828&quot;&gt;7828&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Interoperable Names&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sam Kaufman&amp;nbsp;(&lt;a href=&quot;https://github.com/SampkaML&quot;&gt;@SampkaML&lt;/a&gt;), Marco Stronati&amp;nbsp;(&lt;a href=&quot;https://github.com/paracetamolo&quot;&gt;@paracetamolo&lt;/a&gt;), Yuliya Alexiev&amp;nbsp;(&lt;a href=&quot;https://github.com/yuliyaalexiev&quot;&gt;@yuliyaalexiev&lt;/a&gt;), Jeff Lau&amp;nbsp;(&lt;a href=&quot;https://github.com/jefflau&quot;&gt;@jefflau&lt;/a&gt;), Sam Wilson&amp;nbsp;(&lt;a href=&quot;https://github.com/samwilsn&quot;&gt;@samwilsn&lt;/a&gt;), Vitalik Buterin&amp;nbsp;(&lt;a href=&quot;https://github.com/vbuterin&quot;&gt;@vbuterin&lt;/a&gt;), Teddy&amp;nbsp;(&lt;a href=&quot;https://github.com/0xteddybear&quot;&gt;@0xteddybear&lt;/a&gt;), Joxes&amp;nbsp;(&lt;a href=&quot;https://github.com/Joxess&quot;&gt;@Joxess&lt;/a&gt;), Racu&amp;nbsp;(&lt;a href=&quot;https://github.com/0xRacoon&quot;&gt;@0xRacoon&lt;/a&gt;), Skeletor Spaceman&amp;nbsp;(&lt;a href=&quot;https://github.com/0xskeletor-spaceman&quot;&gt;@0xskeletor-spaceman&lt;/a&gt;), TiTi&amp;nbsp;(&lt;a href=&quot;https://github.com/0xtiti&quot;&gt;@0xtiti&lt;/a&gt;), Gori&amp;nbsp;(&lt;a href=&quot;https://github.com/0xGorilla&quot;&gt;@0xGorilla&lt;/a&gt;), Ardy&amp;nbsp;(&lt;a href=&quot;https://github.com/0xArdy&quot;&gt;@0xArdy&lt;/a&gt;), Onizuka&amp;nbsp;(&lt;a href=&quot;https://github.com/onizuka-wl&quot;&gt;@onizuka-wl&lt;/a&gt;), Lumi&amp;nbsp;(&lt;a href=&quot;https://github.com/oxlumi&quot;&gt;@oxlumi&lt;/a&gt;), Moebius&amp;nbsp;(&lt;a href=&quot;https://github.com/0xmoebius&quot;&gt;@0xmoebius&lt;/a&gt;), Thomas Clowes&amp;nbsp;(&lt;a href=&quot;https://github.com/clowestab&quot;&gt;@clowestab&lt;/a&gt;), Prem Makeig&amp;nbsp;(&lt;a href=&quot;https://github.com/nxt3d&quot;&gt;@nxt3d&lt;/a&gt;), Mono&amp;nbsp;(&lt;a href=&quot;https://github.com/0xMonoAx&quot;&gt;@0xMonoAx&lt;/a&gt;), Orca&amp;nbsp;(&lt;a href=&quot;https://github.com/0xrcinus&quot;&gt;@0xrcinus&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7831&quot;&gt;7831&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-Chain Addressing&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sam Wilson (@SamWilsn)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:sam@binarycake.ca&quot;&gt;sam@binarycake.ca&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7836&quot;&gt;7836&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wallet Call Preparation API&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lukas Rosario&amp;nbsp;(&lt;a href=&quot;https://github.com/lukasrosario&quot;&gt;@lukasrosario&lt;/a&gt;), Conner Swenberg&amp;nbsp;(&lt;a href=&quot;https://github.com/ilikesymmetry&quot;&gt;@ilikesymmetry&lt;/a&gt;), Adam Hodges&amp;nbsp;(&lt;a href=&quot;https://github.com/ajhodges&quot;&gt;@ajhodges&lt;/a&gt;), Paaras Bhandari&amp;nbsp;(&lt;a href=&quot;https://github.com/paarasbhandari&quot;&gt;@paarasbhandari&lt;/a&gt;), Jake Moxey&amp;nbsp;(&lt;a href=&quot;https://github.com/jxom&quot;&gt;@jxom&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7841&quot;&gt;7841&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross-chain Message Format and Mailbox&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ellie Davidson&amp;nbsp;(&lt;a href=&quot;https://github.com/elliedavidson&quot;&gt;@elliedavidson&lt;/a&gt;), Alex Xiong&amp;nbsp;(&lt;a href=&quot;https://github.com/alxiong&quot;&gt;@alxiong&lt;/a&gt;), Philippe Camacho&amp;nbsp;(&lt;a href=&quot;https://github.com/philippecamacho&quot;&gt;@philippecamacho&lt;/a&gt;), and Ben Fisch&amp;nbsp;(&lt;a href=&quot;https://github.com/benafisch&quot;&gt;@benafisch&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7845&quot;&gt;7845&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Universal Orchestrator RPC&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kieran Goodary&amp;nbsp;(&lt;a href=&quot;https://github.com/IAmKio&quot;&gt;@IAmKio&lt;/a&gt;), Pillar Wallet&amp;nbsp;(&lt;a href=&quot;https://github.com/pillarwallet&quot;&gt;@pillarwallet&lt;/a&gt;), Luke Wickens&amp;nbsp;(&lt;a href=&quot;https://github.com/lbw33&quot;&gt;@lbw33&lt;/a&gt;), Rana Khoury&amp;nbsp;(&lt;a href=&quot;https://github.com/RanaBug&quot;&gt;@RanaBug&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7846&quot;&gt;7846&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wallet Connection API&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Conner Swenberg&amp;nbsp;(&lt;a href=&quot;https://github.com/ilikesymmetry&quot;&gt;@ilikesymmetry&lt;/a&gt;), Jake Moxey&amp;nbsp;(&lt;a href=&quot;https://github.com/jxom&quot;&gt;@jxom&lt;/a&gt;), Lukas Rosario&amp;nbsp;(&lt;a href=&quot;https://github.com/lukasrosario&quot;&gt;@lukasrosario&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7847&quot;&gt;7847&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Social Media NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Juntilla (@nickjuntilla)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@ownerfy.com&quot;&gt;nick@ownerfy.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7856&quot;&gt;7856&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Chain-Specific Payment Requests&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jack Chuma&amp;nbsp;(&lt;a href=&quot;https://github.com/jackchuma&quot;&gt;@jackchuma&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7861&quot;&gt;7861&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Verifiable Credential Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Valerio Massimo Camaiani&amp;nbsp;(&lt;a href=&quot;https://github.com/vmc-crossmint&quot;&gt;@vmc-crossmint&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7871&quot;&gt;7871&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wallet Signing API&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lukas Rosario&amp;nbsp;(&lt;a href=&quot;https://github.com/lukasrosario&quot;&gt;@lukasrosario&lt;/a&gt;), Jake Moxey&amp;nbsp;(&lt;a href=&quot;https://github.com/jxom&quot;&gt;@jxom&lt;/a&gt;), Cody Crozier&amp;nbsp;(&lt;a href=&quot;https://github.com/wcrozier12&quot;&gt;@wcrozier12&lt;/a&gt;), Conner Swenberg&amp;nbsp;(&lt;a href=&quot;https://github.com/ilikesymmetry&quot;&gt;@ilikesymmetry&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7876&quot;&gt;7876&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum Network Configuration for DApps&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bogdan Gusiev&amp;nbsp;(&lt;a href=&quot;https://github.com/bogdan&quot;&gt;@bogdan&lt;/a&gt;), Sergey Bomko&amp;nbsp;(&lt;a href=&quot;https://github.com/aquiladev&quot;&gt;@aquiladev&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7884&quot;&gt;7884&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Operation Router&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lucas Picollo&amp;nbsp;(&lt;a href=&quot;https://github.com/pikonha&quot;&gt;@pikonha&lt;/a&gt;), Alex Netto&amp;nbsp;(&lt;a href=&quot;https://github.com/alextnetto&quot;&gt;@alextnetto&lt;/a&gt;), Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7887&quot;&gt;7887&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cancelation for ERC-7540 Tokenized Vaults&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jeroen Offerijns&amp;nbsp;(&lt;a href=&quot;https://github.com/hieronx&quot;&gt;@hieronx&lt;/a&gt;), Vikram Arun&amp;nbsp;(&lt;a href=&quot;https://github.com/vikramarun&quot;&gt;@vikramarun&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7888&quot;&gt;7888&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Crosschain Broadcaster&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Henry Arneson&amp;nbsp;(&lt;a href=&quot;https://github.com/godzillaba&quot;&gt;@godzillaba&lt;/a&gt;), Chris Buckland&amp;nbsp;(&lt;a href=&quot;https://github.com/yahgwai&quot;&gt;@yahgwai&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7891&quot;&gt;7891&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Splitting and Merging of NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nitin Bhagat (@nitin312)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:bhagatnitin312@gmail.com&quot;&gt;bhagatnitin312@gmail.com&lt;/a&gt;&amp;gt;, JongWook Bae&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:bae@cwnu.ac.kr&quot;&gt;bae@cwnu.ac.kr&lt;/a&gt;&amp;gt;, Su-Hyun Lee&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:sleepl@changwon.ac.kr&quot;&gt;sleepl@changwon.ac.kr&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7895&quot;&gt;7895&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;API for Hierarchical Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Wilson Cusack&amp;nbsp;(&lt;a href=&quot;https://github.com/wilsoncusack&quot;&gt;@wilsoncusack&lt;/a&gt;), Jake Feldman&amp;nbsp;(&lt;a href=&quot;https://github.com/jakefeldman&quot;&gt;@jakefeldman&lt;/a&gt;), Montana Wong&amp;nbsp;(&lt;a href=&quot;https://github.com/montycheese&quot;&gt;@montycheese&lt;/a&gt;), Felix Zhang&amp;nbsp;(&lt;a href=&quot;https://github.com/fan-zhang-sv&quot;&gt;@fan-zhang-sv&lt;/a&gt;), Jake Moxey&amp;nbsp;(&lt;a href=&quot;https://github.com/jxom&quot;&gt;@jxom&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7902&quot;&gt;7902&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wallet Capabilities for Account Abstraction&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yoav Weiss&amp;nbsp;(&lt;a href=&quot;https://github.com/yoavw&quot;&gt;@yoavw&lt;/a&gt;), Alex Forshtat&amp;nbsp;(&lt;a href=&quot;https://github.com/forshtat&quot;&gt;@forshtat&lt;/a&gt;), Dror Tirosh&amp;nbsp;(&lt;a href=&quot;https://github.com/drortirosh&quot;&gt;@drortirosh&lt;/a&gt;), Shahaf Nacson&amp;nbsp;(&lt;a href=&quot;https://github.com/shahafn&quot;&gt;@shahafn&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7920&quot;&gt;7920&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Composite EIP-712 Signatures&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sola Ogunsakin&amp;nbsp;(&lt;a href=&quot;https://github.com/sola92&quot;&gt;@sola92&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7929&quot;&gt;7929&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;PermaLink Asset Bound Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Mihai Onila&amp;nbsp;(&lt;a href=&quot;https://github.com/MihaiORO&quot;&gt;@MihaiORO&lt;/a&gt;), Nick Zeman&amp;nbsp;(&lt;a href=&quot;https://github.com/NickZCZ&quot;&gt;@NickZCZ&lt;/a&gt;), Narcis Cotaie&amp;nbsp;(&lt;a href=&quot;https://github.com/NarcisCRO&quot;&gt;@NarcisCRO&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7930&quot;&gt;7930&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Interoperable Addresses&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Teddy&amp;nbsp;(&lt;a href=&quot;https://github.com/0xteddybear&quot;&gt;@0xteddybear&lt;/a&gt;), Joxes&amp;nbsp;(&lt;a href=&quot;https://github.com/0xJoxess&quot;&gt;@0xJoxess&lt;/a&gt;), Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/Arachnid&quot;&gt;@Arachnid&lt;/a&gt;), Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;), Skeletor Spaceman&amp;nbsp;(&lt;a href=&quot;https://github.com/skeletor-spaceman&quot;&gt;@skeletor-spaceman&lt;/a&gt;), Racu&amp;nbsp;(&lt;a href=&quot;https://github.com/0xRacoon&quot;&gt;@0xRacoon&lt;/a&gt;), TiTi&amp;nbsp;(&lt;a href=&quot;https://github.com/0xtiti&quot;&gt;@0xtiti&lt;/a&gt;), Gori&amp;nbsp;(&lt;a href=&quot;https://github.com/0xGorilla&quot;&gt;@0xGorilla&lt;/a&gt;), Ardy&amp;nbsp;(&lt;a href=&quot;https://github.com/0xArdy&quot;&gt;@0xArdy&lt;/a&gt;), Onizuka&amp;nbsp;(&lt;a href=&quot;https://github.com/onizuka-wl&quot;&gt;@onizuka-wl&lt;/a&gt;), Sam Kaufman&amp;nbsp;(&lt;a href=&quot;https://github.com/SampkaML&quot;&gt;@SampkaML&lt;/a&gt;), Marco Stronati&amp;nbsp;(&lt;a href=&quot;https://github.com/paracetamolo&quot;&gt;@paracetamolo&lt;/a&gt;), Yuliya Alexiev&amp;nbsp;(&lt;a href=&quot;https://github.com/yuliyaalexiev&quot;&gt;@yuliyaalexiev&lt;/a&gt;), Jeff Lau&amp;nbsp;(&lt;a href=&quot;https://github.com/jefflau&quot;&gt;@jefflau&lt;/a&gt;), Sam Wilson&amp;nbsp;(&lt;a href=&quot;https://github.com/samwilsn&quot;&gt;@samwilsn&lt;/a&gt;), Vitalik Buterin&amp;nbsp;(&lt;a href=&quot;https://github.com/vbuterin&quot;&gt;@vbuterin&lt;/a&gt;), Thomas Clowes&amp;nbsp;(&lt;a href=&quot;https://github.com/clowestab&quot;&gt;@clowestab&lt;/a&gt;), Mono&amp;nbsp;(&lt;a href=&quot;https://github.com/0xMonoAx&quot;&gt;@0xMonoAx&lt;/a&gt;), Prem Makeig&amp;nbsp;(&lt;a href=&quot;https://github.com/nxt3d&quot;&gt;@nxt3d&lt;/a&gt;), Orca&amp;nbsp;(&lt;a href=&quot;https://github.com/0xrcinus&quot;&gt;@0xrcinus&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7946&quot;&gt;7946&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Unidirectional Wallet Uplink aka UWULink&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Moody Salem&amp;nbsp;(&lt;a href=&quot;https://github.com/moodysalem&quot;&gt;@moodysalem&lt;/a&gt;), Tina Zheng&amp;nbsp;(&lt;a href=&quot;https://github.com/tinaszheng&quot;&gt;@tinaszheng&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7947&quot;&gt;7947&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Account Abstraction Recovery Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Artem Chystiakov (@arvolear)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:artem@rarilabs.com&quot;&gt;artem@rarilabs.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7955&quot;&gt;7955&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Permissionless CREATE2 Factory&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nicholas Rodrigues Lordello&amp;nbsp;(&lt;a href=&quot;https://github.com/nlordell&quot;&gt;@nlordell&lt;/a&gt;), Richard Meissner&amp;nbsp;(&lt;a href=&quot;https://github.com/rmeissner&quot;&gt;@rmeissner&lt;/a&gt;), Valentin Seehausen&amp;nbsp;(&lt;a href=&quot;https://github.com/vseehausen&quot;&gt;@vseehausen&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7962&quot;&gt;7962&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Key Hash Based Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alex Tian&amp;nbsp;(&lt;a href=&quot;https://github.com/dugubuyan&quot;&gt;@dugubuyan&lt;/a&gt;), Zhixiong Pan&amp;nbsp;(&lt;a href=&quot;https://github.com/nake13&quot;&gt;@nake13&lt;/a&gt;), Geoffrey (@stbrahms)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:geoffrey@datadance.ai&quot;&gt;geoffrey@datadance.ai&lt;/a&gt;&amp;gt;, liyingxuan (@LiYingxuan)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:liyingxuan@datadance.ai&quot;&gt;liyingxuan@datadance.ai&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7964&quot;&gt;7964&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Crosschain EIP-712 Signatures&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7965&quot;&gt;7965&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Proof-based Broadcast in ERC-7786 Gateways&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7968&quot;&gt;7968&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Owner-Authorized Token Transfer Protocol&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Julius Lauterbach&amp;nbsp;(&lt;a href=&quot;https://github.com/Julius278&quot;&gt;@Julius278&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7969&quot;&gt;7969&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;DomainKeys Identified Mail (DKIM) Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Mike Fu&amp;nbsp;(&lt;a href=&quot;https://github.com/fumeng00mike&quot;&gt;@fumeng00mike&lt;/a&gt;), Matthew Yu&amp;nbsp;(&lt;a href=&quot;https://github.com/0xknon&quot;&gt;@0xknon&lt;/a&gt;), Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7984&quot;&gt;7984&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Confidential Fungible Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Aryeh Greenberg&amp;nbsp;(&lt;a href=&quot;https://github.com/arr00&quot;&gt;@arr00&lt;/a&gt;), Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;), Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;), Ghazi Ben Amor&amp;nbsp;(&lt;a href=&quot;https://github.com/GBAZama&quot;&gt;@GBAZama&lt;/a&gt;), Clement Danjou&amp;nbsp;(&lt;a href=&quot;https://github.com/immortal-tofu&quot;&gt;@immortal-tofu&lt;/a&gt;), Joseph Andre Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/jatZama&quot;&gt;@jatZama&lt;/a&gt;), Silas Davis&amp;nbsp;(&lt;a href=&quot;https://github.com/silasdavis&quot;&gt;@silasdavis&lt;/a&gt;), Nicolas Pasquier&amp;nbsp;(&lt;a href=&quot;https://github.com/npasquie&quot;&gt;@npasquie&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7985&quot;&gt;7985&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Gateway Attributes for Message Control&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ernesto García&amp;nbsp;(&lt;a href=&quot;https://github.com/ernestognw&quot;&gt;@ernestognw&lt;/a&gt;), Kalman Lajko&amp;nbsp;(&lt;a href=&quot;https://github.com/LajkoKalman&quot;&gt;@LajkoKalman&lt;/a&gt;), Valera Grinenko&amp;nbsp;(&lt;a href=&quot;https://github.com/0xValera&quot;&gt;@0xValera&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7988&quot;&gt;7988&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Avatar Smart Wallet (MASW)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;0xMostafas (@MostafaS)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:0xmostafas@proton.me&quot;&gt;0xmostafas@proton.me&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7992&quot;&gt;7992&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Verifiable ML Model Inference (ZKML)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Aryaethn&amp;nbsp;(&lt;a href=&quot;https://github.com/aryaethn&quot;&gt;@aryaethn&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7996&quot;&gt;7996&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract Feature Detection&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;raffy.eth&amp;nbsp;(&lt;a href=&quot;https://github.com/adraffy&quot;&gt;@adraffy&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8000&quot;&gt;8000&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Operator contract for non delegated EOAs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Marcelo Morgado&amp;nbsp;(&lt;a href=&quot;https://github.com/marcelomorgado&quot;&gt;@marcelomorgado&lt;/a&gt;), Manoj Patidar&amp;nbsp;(&lt;a href=&quot;https://github.com/patidarmanoj10&quot;&gt;@patidarmanoj10&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8002&quot;&gt;8002&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Simplified Payment Verification Gateway&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Artem Chystiakov&amp;nbsp;(&lt;a href=&quot;https://github.com/arvolear&quot;&gt;@arvolear&lt;/a&gt;), Oleh Komendant&amp;nbsp;(&lt;a href=&quot;https://github.com/Hrom131&quot;&gt;@Hrom131&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8004&quot;&gt;8004&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Trustless Agents&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Marco De Rossi&amp;nbsp;(&lt;a href=&quot;https://github.com/MarcoMetaMask&quot;&gt;@MarcoMetaMask&lt;/a&gt;), Davide Crapis (@dcrapis)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:davide@ethereum.org&quot;&gt;davide@ethereum.org&lt;/a&gt;&amp;gt;, Jordan Ellis&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jordanellis@google.com&quot;&gt;jordanellis@google.com&lt;/a&gt;&amp;gt;, Erik Reppel&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:erik.reppel@coinbase.com&quot;&gt;erik.reppel@coinbase.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8017&quot;&gt;8017&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Payout Race&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kyle Thornton (@kyle)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kyle@cowrie.io&quot;&gt;kyle@cowrie.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8023&quot;&gt;8023&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-step Contract Ownership&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;David Kim&amp;nbsp;(&lt;a href=&quot;https://github.com/PowerStream3604&quot;&gt;@PowerStream3604&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8033&quot;&gt;8033&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Agent Council Oracles&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Rohan Parikh&amp;nbsp;(&lt;a href=&quot;https://github.com/phiraml&quot;&gt;@phiraml&lt;/a&gt;), Jon Michael Ross&amp;nbsp;(&lt;a href=&quot;https://github.com/jonmross&quot;&gt;@jonmross&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8041&quot;&gt;8041&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Fixed-Supply Agent NFT Collections&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Prem Makeig&amp;nbsp;(&lt;a href=&quot;https://github.com/nxt3d&quot;&gt;@nxt3d&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8048&quot;&gt;8048&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Onchain Metadata for Token Registries&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Prem Makeig&amp;nbsp;(&lt;a href=&quot;https://github.com/nxt3d&quot;&gt;@nxt3d&lt;/a&gt;), Rafael Abuawad&amp;nbsp;(&lt;a href=&quot;https://github.com/rafael-abuawad&quot;&gt;@rafael-abuawad&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8049&quot;&gt;8049&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract-Level Onchain Metadata&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Prem Makeig&amp;nbsp;(&lt;a href=&quot;https://github.com/nxt3d&quot;&gt;@nxt3d&lt;/a&gt;), Rafael Abuawad&amp;nbsp;(&lt;a href=&quot;https://github.com/rafael-abuawad&quot;&gt;@rafael-abuawad&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8056&quot;&gt;8056&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Scaled UI Amount Extension for ERC-20 Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chris Ridmann (@cridmann)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chris@superstate.co&quot;&gt;chris@superstate.co&lt;/a&gt;&amp;gt;, Daniel Gretzke&amp;nbsp;(&lt;a href=&quot;https://github.com/gretzke&quot;&gt;@gretzke&lt;/a&gt;), Gilbert Shih&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chung.shih@robinhood.com&quot;&gt;chung.shih@robinhood.com&lt;/a&gt;&amp;gt;, Tino Martinez Molina&amp;nbsp;(&lt;a href=&quot;https://github.com/tinom9&quot;&gt;@tinom9&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8065&quot;&gt;8065&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Zero Knowledge Token Wrapper&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jiahui Cui&amp;nbsp;(&lt;a href=&quot;https://github.com/doublespending&quot;&gt;@doublespending&lt;/a&gt;), 0xZPL&amp;nbsp;(&lt;a href=&quot;https://github.com/0xZPL&quot;&gt;@0xZPL&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8074&quot;&gt;8074&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Self-Describing Bytes via EIP-712 Selectors&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Andrew Richardson&amp;nbsp;(&lt;a href=&quot;https://github.com/awrichar&quot;&gt;@awrichar&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8092&quot;&gt;8092&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Associated Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Steve Katzman&amp;nbsp;(&lt;a href=&quot;https://github.com/stevieraykatz&quot;&gt;@stevieraykatz&lt;/a&gt;), Amie Corso&amp;nbsp;(&lt;a href=&quot;https://github.com/amiecorso&quot;&gt;@amiecorso&lt;/a&gt;), Stephan Cilliers&amp;nbsp;(&lt;a href=&quot;https://github.com/stephancill&quot;&gt;@stephancill&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8106&quot;&gt;8106&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;RWA Event-based Compliance Framework&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Andrew Wang (@wz14)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:zhuowangy2k@outlook.com&quot;&gt;zhuowangy2k@outlook.com&lt;/a&gt;&amp;gt;, Jack Yin (@0xjackey)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:0xjackey@gmail.com&quot;&gt;0xjackey@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8107&quot;&gt;8107&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ENS Trust Registry for Agent Coordination&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kwame Bryan&amp;nbsp;(&lt;a href=&quot;https://github.com/KBryan&quot;&gt;@KBryan&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8110&quot;&gt;8110&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Domain Architecture for Diamonds&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Hoang&amp;nbsp;(&lt;a href=&quot;https://github.com/0x76agabond&quot;&gt;@0x76agabond&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8113&quot;&gt;8113&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Series Accounting for Incentivized Vaults&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yash Saraswat&amp;nbsp;(&lt;a href=&quot;https://github.com/0xpanicError&quot;&gt;@0xpanicError&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8117&quot;&gt;8117&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Anti-Poisoning Compact EVM Address Format&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8119&quot;&gt;8119&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Parameterized Storage Keys&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Prem Makeig&amp;nbsp;(&lt;a href=&quot;https://github.com/nxt3d&quot;&gt;@nxt3d&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8121&quot;&gt;8121&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross-Chain Function Calls via Hooks&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Prem Makeig&amp;nbsp;(&lt;a href=&quot;https://github.com/nxt3d&quot;&gt;@nxt3d&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8122&quot;&gt;8122&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Minimal Agent Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Prem Makeig&amp;nbsp;(&lt;a href=&quot;https://github.com/nxt3d&quot;&gt;@nxt3d&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8127&quot;&gt;8127&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Human Readable Token Identifiers&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Prem Makeig&amp;nbsp;(&lt;a href=&quot;https://github.com/nxt3d&quot;&gt;@nxt3d&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8152&quot;&gt;8152&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Content-Addressable Logic Modules (CALM)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Radek Svarz&amp;nbsp;(&lt;a href=&quot;https://github.com/radeksvarz&quot;&gt;@radeksvarz&lt;/a&gt;), Nick Mudge&amp;nbsp;(&lt;a href=&quot;https://github.com/mudgen&quot;&gt;@mudgen&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8153&quot;&gt;8153&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Facet-Based Diamonds&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Mudge&amp;nbsp;(&lt;a href=&quot;https://github.com/mudgen&quot;&gt;@mudgen&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8183&quot;&gt;8183&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Agentic Commerce&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Davide Crapis&amp;nbsp;(&lt;a href=&quot;https://github.com/dcrapis&quot;&gt;@dcrapis&lt;/a&gt;), Bryan Lim&amp;nbsp;(&lt;a href=&quot;https://github.com/ai-virtual-b&quot;&gt;@ai-virtual-b&lt;/a&gt;), Tay Weixiong&amp;nbsp;(&lt;a href=&quot;https://github.com/twx-virtuals&quot;&gt;@twx-virtuals&lt;/a&gt;), Chooi Zuhwa&amp;nbsp;(&lt;a href=&quot;https://github.com/Zuhwa&quot;&gt;@Zuhwa&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8196&quot;&gt;8196&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;AI Agent Authenticated Wallet&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Leigh Cronian (@cybercentry)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:leigh.cronian@cybercentry.co.uk&quot;&gt;leigh.cronian@cybercentry.co.uk&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8199&quot;&gt;8199&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Sandboxed Smart Wallet&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;David Kim&amp;nbsp;(&lt;a href=&quot;https://github.com/PowerStream3604&quot;&gt;@PowerStream3604&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
    &lt;/table&gt;
  

  
  
  
    &lt;h2 id=&quot;stagnant&quot;&gt;Stagnant&lt;/h2&gt;
    &lt;table class=&quot;eiptable&quot;&gt;
      &lt;thead&gt;
        
          &lt;tr&gt;&lt;th class=&quot;eipnum&quot;&gt;Number&lt;/th&gt;&lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;&lt;th class=&quot;author&quot;&gt;Author&lt;/th&gt;&lt;/tr&gt;
        
      &lt;/thead&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-205&quot;&gt;205&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ENS support for contract ABIs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@ethereum.org&quot;&gt;nick@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-634&quot;&gt;634&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Storage of text records in ENS&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Richard Moore&amp;nbsp;(&lt;a href=&quot;https://github.com/ricmoo&quot;&gt;@ricmoo&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-801&quot;&gt;801&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Canary Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;ligi&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ligi@ligi.de&quot;&gt;ligi@ligi.de&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-823&quot;&gt;823&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Exchange Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kashish Khullar&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kkhullar7@gmail.com&quot;&gt;kkhullar7@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-831&quot;&gt;831&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;URI Format for Ethereum&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;ligi&amp;nbsp;(&lt;a href=&quot;https://github.com/ligi&quot;&gt;@ligi&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-884&quot;&gt;884&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;DGCL Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Dave Sag&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:davesag@gmail.com&quot;&gt;davesag@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-897&quot;&gt;897&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;DelegateProxy&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jorge Izquierdo&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jorge@aragon.one&quot;&gt;jorge@aragon.one&lt;/a&gt;&amp;gt;, Manuel Araoz&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:manuel@zeppelin.solutions&quot;&gt;manuel@zeppelin.solutions&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-900&quot;&gt;900&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Simple Staking Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Dean Eigenmann&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dean@tokenate.io&quot;&gt;dean@tokenate.io&lt;/a&gt;&amp;gt;, Jorge Izquierdo&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jorge@aragon.one&quot;&gt;jorge@aragon.one&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-902&quot;&gt;902&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Validation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Brooklyn Zelenka&amp;nbsp;(&lt;a href=&quot;https://github.com/expede&quot;&gt;@expede&lt;/a&gt;), Tom Carchrae&amp;nbsp;(&lt;a href=&quot;https://github.com/carchrae&quot;&gt;@carchrae&lt;/a&gt;), Gleb Naumenko&amp;nbsp;(&lt;a href=&quot;https://github.com/naumenkogs&quot;&gt;@naumenkogs&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-918&quot;&gt;918&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Mineable Token Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jay Logelin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jlogelin@alumni.harvard.edu&quot;&gt;jlogelin@alumni.harvard.edu&lt;/a&gt;&amp;gt;, Infernal_toast&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:admin@0xbitcoin.org&quot;&gt;admin@0xbitcoin.org&lt;/a&gt;&amp;gt;, Michael Seiler&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mgs33@cornell.edu&quot;&gt;mgs33@cornell.edu&lt;/a&gt;&amp;gt;, Brandon Grill&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:bg2655@columbia.edu&quot;&gt;bg2655@columbia.edu&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-926&quot;&gt;926&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Address metadata registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@ethereum.org&quot;&gt;nick@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-927&quot;&gt;927&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Generalised authorisations&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@ethereum.org&quot;&gt;nick@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1056&quot;&gt;1056&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum Lightweight Identity&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Pelle Braendgaard&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:pelle.braendgaard@consensys.net&quot;&gt;pelle.braendgaard@consensys.net&lt;/a&gt;&amp;gt;, Joel Torstensson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:oed@consensys.net&quot;&gt;oed@consensys.net&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1062&quot;&gt;1062&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Formalize IPFS hash into ENS(Ethereum Name Service) resolver&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Phyrex Tsai&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:phyrex@portal.network&quot;&gt;phyrex@portal.network&lt;/a&gt;&amp;gt;,  Portal Network Team&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1066&quot;&gt;1066&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Status Codes&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Brooklyn Zelenka&amp;nbsp;(&lt;a href=&quot;https://github.com/expede&quot;&gt;@expede&lt;/a&gt;), Tom Carchrae&amp;nbsp;(&lt;a href=&quot;https://github.com/carchrae&quot;&gt;@carchrae&lt;/a&gt;), Gleb Naumenko&amp;nbsp;(&lt;a href=&quot;https://github.com/naumenkogs&quot;&gt;@naumenkogs&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1077&quot;&gt;1077&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Gas relay for contract calls&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alex Van de Sande&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:avsa@ethereum.org&quot;&gt;avsa@ethereum.org&lt;/a&gt;&amp;gt;, Ricardo Guilherme Schmidt&amp;nbsp;(&lt;a href=&quot;https://github.com/3esmit&quot;&gt;@3esmit&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1078&quot;&gt;1078&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Universal login / signup using ENS subdomains&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alex Van de Sande&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:avsa@ethereum.org&quot;&gt;avsa@ethereum.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1080&quot;&gt;1080&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Recoverable Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bradley Leatherwood&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:bradleat@inkibra.com&quot;&gt;bradleat@inkibra.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1081&quot;&gt;1081&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Standard Bounties&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Mark Beylin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mark.beylin@consensys.net&quot;&gt;mark.beylin@consensys.net&lt;/a&gt;&amp;gt;, Kevin Owocki&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kevin.owocki@consensys.net&quot;&gt;kevin.owocki@consensys.net&lt;/a&gt;&amp;gt;, Ricardo Guilherme Schmidt&amp;nbsp;(&lt;a href=&quot;https://github.com/3esmit&quot;&gt;@3esmit&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1129&quot;&gt;1129&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Standardised DAPP announcements&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jan Turk&amp;nbsp;(&lt;a href=&quot;https://github.com/ThunderDeliverer&quot;&gt;@ThunderDeliverer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1132&quot;&gt;1132&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Extending ERC20 with token locking capability&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;nitika-goel&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nitika@govblocks.io&quot;&gt;nitika@govblocks.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1175&quot;&gt;1175&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wallet &amp;amp; shop standard for all tokens (erc20)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jet Lim&amp;nbsp;(&lt;a href=&quot;https://github.com/Nitro888&quot;&gt;@Nitro888&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1178&quot;&gt;1178&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-class Token Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Albert Chon&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:achon@stanford.edu&quot;&gt;achon@stanford.edu&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1203&quot;&gt;1203&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-1203 Multi-Class Token Standard (ERC-20 Extension)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jeff Huang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:jeffishjeff@gmail.com&quot;&gt;jeffishjeff@gmail.com&lt;/a&gt;&amp;gt;, Min Zu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:crawlregister@gmail.com&quot;&gt;crawlregister@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1207&quot;&gt;1207&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;DAuth Access Delegation Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Xiaoyu Wang&amp;nbsp;(&lt;a href=&quot;https://github.com/wxygeek&quot;&gt;@wxygeek&lt;/a&gt;), Bicong Wang&amp;nbsp;(&lt;a href=&quot;https://github.com/Wangbicong&quot;&gt;@Wangbicong&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1261&quot;&gt;1261&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Membership Verification Token (MVT)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chaitanya Potti&amp;nbsp;(&lt;a href=&quot;https://github.com/chaitanyapotti&quot;&gt;@chaitanyapotti&lt;/a&gt;), Partha Bhattacharya&amp;nbsp;(&lt;a href=&quot;https://github.com/pb25193&quot;&gt;@pb25193&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1319&quot;&gt;1319&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Smart Contract Package Registry Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Piper Merriam&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:piper@ethereum.org&quot;&gt;piper@ethereum.org&lt;/a&gt;&amp;gt;, Christopher Gewecke&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:christophergewecke@gmail.com&quot;&gt;christophergewecke@gmail.com&lt;/a&gt;&amp;gt;, g. nicholas d&apos;andrea&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick.dandrea@consensys.net&quot;&gt;nick.dandrea@consensys.net&lt;/a&gt;&amp;gt;, Nick Gheorghita&amp;nbsp;(&lt;a href=&quot;https://github.com/njgheorghita&quot;&gt;@njgheorghita&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1337&quot;&gt;1337&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Subscriptions on the blockchain&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kevin Owocki&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kevin@gitcoin.co&quot;&gt;kevin@gitcoin.co&lt;/a&gt;&amp;gt;, Andrew Redden&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:andrew@blockcrushr.com&quot;&gt;andrew@blockcrushr.com&lt;/a&gt;&amp;gt;, Scott Burke&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:scott@blockcrushr.com&quot;&gt;scott@blockcrushr.com&lt;/a&gt;&amp;gt;, Kevin Seagraves&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:k.s.seagraves@gmail.com&quot;&gt;k.s.seagraves@gmail.com&lt;/a&gt;&amp;gt;, Luka Kacil&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:luka.kacil@gmail.com&quot;&gt;luka.kacil@gmail.com&lt;/a&gt;&amp;gt;, Štefan Šimec&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:stefan.simec@gmail.com&quot;&gt;stefan.simec@gmail.com&lt;/a&gt;&amp;gt;, Piotr Kosiński&amp;nbsp;(&lt;a href=&quot;https://github.com/kosecki123&quot;&gt;@kosecki123&lt;/a&gt;), ankit raj&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:tradeninja7@gmail.com&quot;&gt;tradeninja7@gmail.com&lt;/a&gt;&amp;gt;, John Griffin&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:john@atchai.com&quot;&gt;john@atchai.com&lt;/a&gt;&amp;gt;, Nathan Creswell&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nathantr@gmail.com&quot;&gt;nathantr@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1386&quot;&gt;1386&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Attestation management contract&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Weiwu Zhang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:a@colourful.land&quot;&gt;a@colourful.land&lt;/a&gt;&amp;gt;, James Sangalli&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:j.l.sangalli@gmail.com&quot;&gt;j.l.sangalli@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1387&quot;&gt;1387&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Merkle Tree Attestations with Privacy enabled&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Weiwu Zhang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:a@colourful.land&quot;&gt;a@colourful.land&lt;/a&gt;&amp;gt;, James Sangalli&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:j.l.sangalli@gmail.com&quot;&gt;j.l.sangalli@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1388&quot;&gt;1388&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Attestation Issuers Management List&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Weiwu Zhang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:a@colourful.land&quot;&gt;a@colourful.land&lt;/a&gt;&amp;gt;, James Sangalli&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:j.l.sangalli@gmail.com&quot;&gt;j.l.sangalli@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1417&quot;&gt;1417&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Poll Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Chaitanya Potti&amp;nbsp;(&lt;a href=&quot;https://github.com/chaitanyapotti&quot;&gt;@chaitanyapotti&lt;/a&gt;), Partha Bhattacharya&amp;nbsp;(&lt;a href=&quot;https://github.com/pb25193&quot;&gt;@pb25193&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1438&quot;&gt;1438&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;dApp Components (avatar) &amp;amp; Universal Wallet&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jet Lim&amp;nbsp;(&lt;a href=&quot;https://github.com/Nitro888&quot;&gt;@Nitro888&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1444&quot;&gt;1444&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Localized Messaging with Signal-to-Text&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Brooklyn Zelenka&amp;nbsp;(&lt;a href=&quot;https://github.com/expede&quot;&gt;@expede&lt;/a&gt;), Jennifer Cooper&amp;nbsp;(&lt;a href=&quot;https://github.com/jenncoop&quot;&gt;@jenncoop&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1450&quot;&gt;1450&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-1450 A compatible security token for issuing and trading SEC-compliant securities&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;John Shiple&amp;nbsp;(&lt;a href=&quot;https://github.com/johnshiple&quot;&gt;@johnshiple&lt;/a&gt;), Howard Marks&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:howard@startengine.com&quot;&gt;howard@startengine.com&lt;/a&gt;&amp;gt;, David Zhang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:david@startengine.com&quot;&gt;david@startengine.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1462&quot;&gt;1462&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Base Security Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Maxim Kupriianov&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mk@atlant.io&quot;&gt;mk@atlant.io&lt;/a&gt;&amp;gt;, Julian Svirsky&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:js@atlant.io&quot;&gt;js@atlant.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1484&quot;&gt;1484&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Digital Identity Aggregator&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Anurag Angara&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:anurag.angara@gmail.com&quot;&gt;anurag.angara@gmail.com&lt;/a&gt;&amp;gt;, Andy Chorlian&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:andychorlian@gmail.com&quot;&gt;andychorlian@gmail.com&lt;/a&gt;&amp;gt;, Shane Hampton&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:shanehampton1@gmail.com&quot;&gt;shanehampton1@gmail.com&lt;/a&gt;&amp;gt;, Noah Zinsmeister&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:noahwz@gmail.com&quot;&gt;noahwz@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1491&quot;&gt;1491&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Human Cost Accounting Standard (Like Gas but for humans)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Iamnot Chris&amp;nbsp;(&lt;a href=&quot;https://github.com/cohabo&quot;&gt;@cohabo&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1504&quot;&gt;1504&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Upgradable Smart Contract&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kaidong Wu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:wukd94@pku.edu.cn&quot;&gt;wukd94@pku.edu.cn&lt;/a&gt;&amp;gt;, Chuqiao Ren&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:cr025@bucknell.edu&quot;&gt;cr025@bucknell.edu&lt;/a&gt;&amp;gt;, Ruthia He&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:rujiahe@gmail.com&quot;&gt;rujiahe@gmail.com&lt;/a&gt;&amp;gt;, Yun Ma&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:mayun@pku.edu.cn&quot;&gt;mayun@pku.edu.cn&lt;/a&gt;&amp;gt;, Xuanzhe Liu&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:liuxuanzhe@pku.edu.cn&quot;&gt;liuxuanzhe@pku.edu.cn&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1523&quot;&gt;1523&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Standard for Insurance Policies as ERC-721 Non Fungible Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Christoph Mussenbrock&amp;nbsp;(&lt;a href=&quot;https://github.com/christoph2806&quot;&gt;@christoph2806&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1577&quot;&gt;1577&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;contenthash field for ENS&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Dean Eigenmann&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dean@ens.domains&quot;&gt;dean@ens.domains&lt;/a&gt;&amp;gt;, Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@ens.domains&quot;&gt;nick@ens.domains&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1581&quot;&gt;1581&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-wallet usage of keys derived from BIP-32 trees&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Michele Balistreri&amp;nbsp;(&lt;a href=&quot;https://github.com/bitgamma&quot;&gt;@bitgamma&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1592&quot;&gt;1592&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Address and ERC20-compliant transfer rules&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Cyril Lapinte&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:cyril.lapinte@mtpelerin.com&quot;&gt;cyril.lapinte@mtpelerin.com&lt;/a&gt;&amp;gt;, Laurent Aapro&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:laurent.aapro@mtpelerin.com&quot;&gt;laurent.aapro@mtpelerin.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1613&quot;&gt;1613&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Gas stations network&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yoav Weiss&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:yoav@tabookey.com&quot;&gt;yoav@tabookey.com&lt;/a&gt;&amp;gt;, Dror Tirosh&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dror@tabookey.com&quot;&gt;dror@tabookey.com&lt;/a&gt;&amp;gt;, Alex Forshtat&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:alex@tabookey.com&quot;&gt;alex@tabookey.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1616&quot;&gt;1616&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Attribute Registry Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;0age&amp;nbsp;(&lt;a href=&quot;https://github.com/0age&quot;&gt;@0age&lt;/a&gt;), Santiago Palladino&amp;nbsp;(&lt;a href=&quot;https://github.com/spalladino&quot;&gt;@spalladino&lt;/a&gt;), Leo Arias&amp;nbsp;(&lt;a href=&quot;https://github.com/elopio&quot;&gt;@elopio&lt;/a&gt;), Alejo Salles&amp;nbsp;(&lt;a href=&quot;https://github.com/fiiiu&quot;&gt;@fiiiu&lt;/a&gt;), Stephane Gosselin&amp;nbsp;(&lt;a href=&quot;https://github.com/thegostep&quot;&gt;@thegostep&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1620&quot;&gt;1620&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Money Streaming&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Paul Berg&amp;nbsp;(&lt;a href=&quot;https://github.com/PaulRBerg&quot;&gt;@PaulRBerg&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1633&quot;&gt;1633&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Re-Fungible Token Standard (RFT)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Billy Rennekamp&amp;nbsp;(&lt;a href=&quot;https://github.com/okwme&quot;&gt;@okwme&lt;/a&gt;), Dan Long&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dan@artblx.com&quot;&gt;dan@artblx.com&lt;/a&gt;&amp;gt;, Kiryl Yermakou&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kiryl@artblx.com&quot;&gt;kiryl@artblx.com&lt;/a&gt;&amp;gt;, Nate van der Ende&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nate@artblx.com&quot;&gt;nate@artblx.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1710&quot;&gt;1710&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;URL Format for Web3 Browsers&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Bruno Barbieri&amp;nbsp;(&lt;a href=&quot;https://github.com/brunobar79&quot;&gt;@brunobar79&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1753&quot;&gt;1753&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Smart Contract Interface for Licences&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lucas Cullen&amp;nbsp;(&lt;a href=&quot;https://github.com/BitcoinBrisbane&quot;&gt;@BitcoinBrisbane&lt;/a&gt;), Kai Yeung&amp;nbsp;(&lt;a href=&quot;https://github.com/CivicKai&quot;&gt;@CivicKai&lt;/a&gt;), Anna Crowley&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:annaelizabethcrowley@gmail.com&quot;&gt;annaelizabethcrowley@gmail.com&lt;/a&gt;&amp;gt;, Caroline Marshall&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:caroline.marshall888@gmail.com&quot;&gt;caroline.marshall888@gmail.com&lt;/a&gt;&amp;gt;, Katrina Donaghy&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:katrina@civicledger.com&quot;&gt;katrina@civicledger.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1761&quot;&gt;1761&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Scoped Approval Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Witek Radomski&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:witek@enjin.io&quot;&gt;witek@enjin.io&lt;/a&gt;&amp;gt;, Andrew Cooke&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ac0dem0nk3y@gmail.com&quot;&gt;ac0dem0nk3y@gmail.com&lt;/a&gt;&amp;gt;, James Therien&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:james@enjin.io&quot;&gt;james@enjin.io&lt;/a&gt;&amp;gt;, Eric Binet&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:eric@enjin.io&quot;&gt;eric@enjin.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1775&quot;&gt;1775&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;App Keys, application specific wallet accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Vincent Eli&amp;nbsp;(&lt;a href=&quot;https://github.com/Bunjin&quot;&gt;@Bunjin&lt;/a&gt;), Dan Finlay&amp;nbsp;(&lt;a href=&quot;https://github.com/DanFinlay&quot;&gt;@DanFinlay&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1812&quot;&gt;1812&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum Verifiable Claims&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Pelle Braendgaard&amp;nbsp;(&lt;a href=&quot;https://github.com/pelle&quot;&gt;@pelle&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1822&quot;&gt;1822&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Universal Upgradeable Proxy Standard (UUPS)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gabriel Barros&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:gabriel@terminal.co&quot;&gt;gabriel@terminal.co&lt;/a&gt;&amp;gt;, Patrick Gallagher&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:blockchainbuddha@gmail.com&quot;&gt;blockchainbuddha@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1844&quot;&gt;1844&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ENS Interface Discovery&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1900&quot;&gt;1900&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;dType - Decentralized Type System for EVM&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Loredana Cirstea&amp;nbsp;(&lt;a href=&quot;https://github.com/loredanacirstea&quot;&gt;@loredanacirstea&lt;/a&gt;), Christian Tzurcanu&amp;nbsp;(&lt;a href=&quot;https://github.com/ctzurcanu&quot;&gt;@ctzurcanu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1921&quot;&gt;1921&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;dType Functions Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Loredana Cirstea&amp;nbsp;(&lt;a href=&quot;https://github.com/loredanacirstea&quot;&gt;@loredanacirstea&lt;/a&gt;), Christian Tzurcanu&amp;nbsp;(&lt;a href=&quot;https://github.com/ctzurcanu&quot;&gt;@ctzurcanu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1922&quot;&gt;1922&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;zk-SNARK Verifier Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Michael Connor&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:michael.connor@uk.ey.com&quot;&gt;michael.connor@uk.ey.com&lt;/a&gt;&amp;gt;, Chaitanya Konda&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chaitanya.konda@uk.ey.com&quot;&gt;chaitanya.konda@uk.ey.com&lt;/a&gt;&amp;gt;, Duncan Westland&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:duncan.westland@uk.ey.com&quot;&gt;duncan.westland@uk.ey.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1923&quot;&gt;1923&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;zk-SNARK Verifier Registry Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Michael Connor&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:michael.connor@uk.ey.com&quot;&gt;michael.connor@uk.ey.com&lt;/a&gt;&amp;gt;, Chaitanya Konda&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:chaitanya.konda@uk.ey.com&quot;&gt;chaitanya.konda@uk.ey.com&lt;/a&gt;&amp;gt;, Duncan Westland&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:duncan.westland@uk.ey.com&quot;&gt;duncan.westland@uk.ey.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1948&quot;&gt;1948&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-fungible Data Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Johann Barbie&amp;nbsp;(&lt;a href=&quot;https://github.com/johannbarbie&quot;&gt;@johannbarbie&lt;/a&gt;), Ben Bollen&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:ben@ost.com&quot;&gt;ben@ost.com&lt;/a&gt;&amp;gt;, pinkiebell&amp;nbsp;(&lt;a href=&quot;https://github.com/pinkiebell&quot;&gt;@pinkiebell&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1973&quot;&gt;1973&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Scalable Rewards&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Lee Raj&amp;nbsp;(&lt;a href=&quot;https://github.com/lerajk&quot;&gt;@lerajk&lt;/a&gt;), Qin Jian&amp;nbsp;(&lt;a href=&quot;https://github.com/qinjian&quot;&gt;@qinjian&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1996&quot;&gt;1996&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Holdable Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Julio Faura&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:julio@adhara.io&quot;&gt;julio@adhara.io&lt;/a&gt;&amp;gt;, Fernando Paris&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:fer@io.builders&quot;&gt;fer@io.builders&lt;/a&gt;&amp;gt;, Daniel Lehrner&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:daniel@io.builders&quot;&gt;daniel@io.builders&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2009&quot;&gt;2009&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Compliance Service&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Daniel Lehrner&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:daniel@io.builders&quot;&gt;daniel@io.builders&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2018&quot;&gt;2018&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Clearable Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Julio Faura&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:julio@adhara.io&quot;&gt;julio@adhara.io&lt;/a&gt;&amp;gt;, Fernando Paris&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:fer@io.builders&quot;&gt;fer@io.builders&lt;/a&gt;&amp;gt;, Daniel Lehrner&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:daniel@io.builders&quot;&gt;daniel@io.builders&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2019&quot;&gt;2019&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Fundable Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Fernando Paris&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:fer@io.builders&quot;&gt;fer@io.builders&lt;/a&gt;&amp;gt;, Julio Faura&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:julio@adhara.io&quot;&gt;julio@adhara.io&lt;/a&gt;&amp;gt;, Daniel Lehrner&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:daniel@io.builders&quot;&gt;daniel@io.builders&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2020&quot;&gt;2020&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;E-Money Standard Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Julio Faura&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:julio@adhara.io&quot;&gt;julio@adhara.io&lt;/a&gt;&amp;gt;, Fernando Paris&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:fer@io.builders&quot;&gt;fer@io.builders&lt;/a&gt;&amp;gt;, Daniel Lehrner&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:daniel@io.builders&quot;&gt;daniel@io.builders&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2021&quot;&gt;2021&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Payoutable Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Fernando Paris&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:fer@io.builders&quot;&gt;fer@io.builders&lt;/a&gt;&amp;gt;, Julio Faura&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:julio@adhara.io&quot;&gt;julio@adhara.io&lt;/a&gt;&amp;gt;, Daniel Lehrner&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:daniel@io.builders&quot;&gt;daniel@io.builders&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2157&quot;&gt;2157&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;dType Storage Extension - Decentralized Type System for EVM&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Loredana Cirstea&amp;nbsp;(&lt;a href=&quot;https://github.com/loredanacirstea&quot;&gt;@loredanacirstea&lt;/a&gt;), Christian Tzurcanu&amp;nbsp;(&lt;a href=&quot;https://github.com/ctzurcanu&quot;&gt;@ctzurcanu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2193&quot;&gt;2193&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;dType Alias Extension - Decentralized Type System&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Loredana Cirstea&amp;nbsp;(&lt;a href=&quot;https://github.com/loredanacirstea&quot;&gt;@loredanacirstea&lt;/a&gt;), Christian Tzurcanu&amp;nbsp;(&lt;a href=&quot;https://github.com/ctzurcanu&quot;&gt;@ctzurcanu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2304&quot;&gt;2304&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multichain address resolution for ENS&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@ens.domains&quot;&gt;nick@ens.domains&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2386&quot;&gt;2386&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum 2 Hierarchical Deterministic Walletstore&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jim McDonald&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:Jim@mcdee.net&quot;&gt;Jim@mcdee.net&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2390&quot;&gt;2390&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Geo-ENS&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;James Choncholas&amp;nbsp;(&lt;a href=&quot;https://github.com/james-choncholas&quot;&gt;@james-choncholas&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2400&quot;&gt;2400&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Transaction Receipt URI&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ricardo Guilherme Schmidt&amp;nbsp;(&lt;a href=&quot;https://github.com/3esmit&quot;&gt;@3esmit&lt;/a&gt;), Eric Dvorsak&amp;nbsp;(&lt;a href=&quot;https://github.com/yenda&quot;&gt;@yenda&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2470&quot;&gt;2470&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Singleton Factory&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ricardo Guilherme Schmidt&amp;nbsp;(&lt;a href=&quot;https://github.com/3esmit&quot;&gt;@3esmit&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2477&quot;&gt;2477&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Metadata Integrity&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kristijan Sedlak&amp;nbsp;(&lt;a href=&quot;https://github.com/xpepermint&quot;&gt;@xpepermint&lt;/a&gt;), William Entriken&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:github.com@phor.net&quot;&gt;github.com@phor.net&lt;/a&gt;&amp;gt;, Witek Radomski&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:witek@enjin.io&quot;&gt;witek@enjin.io&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2494&quot;&gt;2494&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Baby Jubjub Elliptic Curve&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Barry WhiteHat&amp;nbsp;(&lt;a href=&quot;https://github.com/barryWhiteHat&quot;&gt;@barryWhiteHat&lt;/a&gt;), Marta Bellés&amp;nbsp;(&lt;a href=&quot;https://github.com/bellesmarta&quot;&gt;@bellesmarta&lt;/a&gt;), Jordi Baylina&amp;nbsp;(&lt;a href=&quot;https://github.com/jbaylina&quot;&gt;@jbaylina&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2520&quot;&gt;2520&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multiple contenthash records for ENS&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Filip Štamcar&amp;nbsp;(&lt;a href=&quot;https://github.com/filips123&quot;&gt;@filips123&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2525&quot;&gt;2525&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ENSLogin&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/amxx&quot;&gt;@amxx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2544&quot;&gt;2544&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ENS Wildcard Resolution&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;), 0age&amp;nbsp;(&lt;a href=&quot;https://github.com/0age&quot;&gt;@0age&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2569&quot;&gt;2569&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Saving and Displaying Image Onchain for Universal Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Hua Zhang&amp;nbsp;(&lt;a href=&quot;https://github.com/dgczhh&quot;&gt;@dgczhh&lt;/a&gt;), Yuefei Tan&amp;nbsp;(&lt;a href=&quot;https://github.com/whtyfhas&quot;&gt;@whtyfhas&lt;/a&gt;), Derek Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/zhous&quot;&gt;@zhous&lt;/a&gt;), Ran Xing&amp;nbsp;(&lt;a href=&quot;https://github.com/lemontreeran&quot;&gt;@lemontreeran&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2615&quot;&gt;2615&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-Fungible Token with mortgage and rental functions&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Kohshi Shiba&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:kohshi.shiba@gmail.com&quot;&gt;kohshi.shiba@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2645&quot;&gt;2645&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Hierarchical Deterministic Wallet for Layer-2&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Tom Brand&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:tom@starkware.co&quot;&gt;tom@starkware.co&lt;/a&gt;&amp;gt;, Louis Guthmann&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:louis@starkware.co&quot;&gt;louis@starkware.co&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2680&quot;&gt;2680&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ethereum 2 wallet layout&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jim McDonald&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:Jim@mcdee.net&quot;&gt;Jim@mcdee.net&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2746&quot;&gt;2746&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Rules Engine Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Aaron Kendall&amp;nbsp;(&lt;a href=&quot;https://github.com/jaerith&quot;&gt;@jaerith&lt;/a&gt;), Juan Blanco&amp;nbsp;(&lt;a href=&quot;https://github.com/juanfranblanco&quot;&gt;@juanfranblanco&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2767&quot;&gt;2767&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract Ownership Governance&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Soham Zemse&amp;nbsp;(&lt;a href=&quot;https://github.com/zemse&quot;&gt;@zemse&lt;/a&gt;), Nick Mudge&amp;nbsp;(&lt;a href=&quot;https://github.com/mudgen&quot;&gt;@mudgen&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2770&quot;&gt;2770&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Meta-Transactions Forwarder Contract&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alex Forshtat&amp;nbsp;(&lt;a href=&quot;https://github.com/forshtat&quot;&gt;@forshtat&lt;/a&gt;), Dror Tirosh&amp;nbsp;(&lt;a href=&quot;https://github.com/drortirosh&quot;&gt;@drortirosh&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2848&quot;&gt;2848&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;My Own Messages (MOM)&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Giuseppe Bertone&amp;nbsp;(&lt;a href=&quot;https://github.com/Neurone&quot;&gt;@Neurone&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2876&quot;&gt;2876&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Deposit contract and address standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jonathan Underwood&amp;nbsp;(&lt;a href=&quot;https://github.com/junderw&quot;&gt;@junderw&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2917&quot;&gt;2917&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Staking Reward Calculation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Tony Carson&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:tony.carsonn@gmail.com&quot;&gt;tony.carsonn@gmail.com&lt;/a&gt;&amp;gt;, Mehmet Sabir Kiraz&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:m.kiraz@gmail.com&quot;&gt;m.kiraz@gmail.com&lt;/a&gt;&amp;gt;, Süleyman Kardaş&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:skardas@gmail.com&quot;&gt;skardas@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2942&quot;&gt;2942&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;EthPM URI Specification&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Gheorghita&amp;nbsp;(&lt;a href=&quot;https://github.com/njgheorghita&quot;&gt;@njgheorghita&lt;/a&gt;), Piper Merriam&amp;nbsp;(&lt;a href=&quot;https://github.com/pipermerriam&quot;&gt;@pipermerriam&lt;/a&gt;), g. nicholas d&apos;andrea&amp;nbsp;(&lt;a href=&quot;https://github.com/gnidan&quot;&gt;@gnidan&lt;/a&gt;), Benjamin Hauser&amp;nbsp;(&lt;a href=&quot;https://github.com/iamdefinitelyahuman&quot;&gt;@iamdefinitelyahuman&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-2980&quot;&gt;2980&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Swiss Compliant Asset Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Gianluca Perletti&amp;nbsp;(&lt;a href=&quot;https://github.com/Perlets9&quot;&gt;@Perlets9&lt;/a&gt;), Alan Scarpellini&amp;nbsp;(&lt;a href=&quot;https://github.com/alanscarpellini&quot;&gt;@alanscarpellini&lt;/a&gt;), Roberto Gorini&amp;nbsp;(&lt;a href=&quot;https://github.com/robertogorini&quot;&gt;@robertogorini&lt;/a&gt;), Manuel Olivi&amp;nbsp;(&lt;a href=&quot;https://github.com/manvel79&quot;&gt;@manvel79&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3000&quot;&gt;3000&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Optimistic enactment governance standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jorge Izquierdo&amp;nbsp;(&lt;a href=&quot;https://github.com/izqui&quot;&gt;@izqui&lt;/a&gt;), Fabien Marino&amp;nbsp;(&lt;a href=&quot;https://github.com/bonustrack&quot;&gt;@bonustrack&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3005&quot;&gt;3005&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Batched meta transactions&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Matt&amp;nbsp;(&lt;a href=&quot;https://github.com/defifuture&quot;&gt;@defifuture&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3135&quot;&gt;3135&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Exclusive Claimable Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zhenyu Sun&amp;nbsp;(&lt;a href=&quot;https://github.com/Ungigdu&quot;&gt;@Ungigdu&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3224&quot;&gt;3224&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Described Data&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Richard Moore&amp;nbsp;(&lt;a href=&quot;https://github.com/ricmoo&quot;&gt;@ricmoo&lt;/a&gt;), Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3234&quot;&gt;3234&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Batch Flash Loans&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alberto Cuesta Cañada&amp;nbsp;(&lt;a href=&quot;https://github.com/albertocuestacanada&quot;&gt;@albertocuestacanada&lt;/a&gt;), Fiona Kobayashi&amp;nbsp;(&lt;a href=&quot;https://github.com/fifikobayashi&quot;&gt;@fifikobayashi&lt;/a&gt;), fubuloubu&amp;nbsp;(&lt;a href=&quot;https://github.com/fubuloubu&quot;&gt;@fubuloubu&lt;/a&gt;), Austin Williams&amp;nbsp;(&lt;a href=&quot;https://github.com/onewayfunction&quot;&gt;@onewayfunction&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3386&quot;&gt;3386&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 and ERC-1155 to ERC-20 Wrapper&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Calvin Koder&amp;nbsp;(&lt;a href=&quot;https://github.com/ashrowz&quot;&gt;@ashrowz&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3440&quot;&gt;3440&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Editions Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nathan Ginnever&amp;nbsp;(&lt;a href=&quot;https://github.com/nginnever&quot;&gt;@nginnever&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3450&quot;&gt;3450&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Standardized Shamir Secret Sharing Scheme for BIP-39 Mnemonics&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Daniel Streit&amp;nbsp;(&lt;a href=&quot;https://github.com/danielstreit&quot;&gt;@danielstreit&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3561&quot;&gt;3561&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Trust Minimized Upgradeability Proxy&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sam Porter&amp;nbsp;(&lt;a href=&quot;https://github.com/SamPorter1984&quot;&gt;@SamPorter1984&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3569&quot;&gt;3569&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Sealed NFT Metadata Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sean Papanikolas&amp;nbsp;(&lt;a href=&quot;https://github.com/pizzarob&quot;&gt;@pizzarob&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3589&quot;&gt;3589&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Assemble assets into NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zhenyu Sun&amp;nbsp;(&lt;a href=&quot;https://github.com/Ungigdu&quot;&gt;@Ungigdu&lt;/a&gt;), Xinqi Yang&amp;nbsp;(&lt;a href=&quot;https://github.com/xinqiyang&quot;&gt;@xinqiyang&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3722&quot;&gt;3722&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Poster&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Auryn Macmillan&amp;nbsp;(&lt;a href=&quot;https://github.com/auryn-macmillan&quot;&gt;@auryn-macmillan&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3754&quot;&gt;3754&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;A Vanilla Non-Fungible Token Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Simon Tian&amp;nbsp;(&lt;a href=&quot;https://github.com/simontianx&quot;&gt;@simontianx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-3772&quot;&gt;3772&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Compressed Integers&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Soham Zemse&amp;nbsp;(&lt;a href=&quot;https://github.com/zemse&quot;&gt;@zemse&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4341&quot;&gt;4341&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ordered NFT Batch Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Simon Tian&amp;nbsp;(&lt;a href=&quot;https://github.com/simontianx&quot;&gt;@simontianx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4353&quot;&gt;4353&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Interface for Staked Tokens in NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Rex Creed&amp;nbsp;(&lt;a href=&quot;https://github.com/aug2uag&quot;&gt;@aug2uag&lt;/a&gt;), Dane Scarborough&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:dane@nftapps.us&quot;&gt;dane@nftapps.us&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4393&quot;&gt;4393&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Micropayments for NFTs and Multi Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jules Lai&amp;nbsp;(&lt;a href=&quot;https://github.com/julesl23&quot;&gt;@julesl23&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4430&quot;&gt;4430&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Described Transactions&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Richard Moore&amp;nbsp;(&lt;a href=&quot;https://github.com/ricmoo&quot;&gt;@ricmoo&lt;/a&gt;), Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4494&quot;&gt;4494&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Permit for ERC-721 NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Simon Fremaux&amp;nbsp;(&lt;a href=&quot;https://github.com/dievardump&quot;&gt;@dievardump&lt;/a&gt;), William Schwab&amp;nbsp;(&lt;a href=&quot;https://github.com/wschwab&quot;&gt;@wschwab&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4521&quot;&gt;4521&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;721/20-compatible transfer&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ross Campbell&amp;nbsp;(&lt;a href=&quot;https://github.com/z0r0z&quot;&gt;@z0r0z&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4524&quot;&gt;4524&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Safer ERC-20&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;William Schwab&amp;nbsp;(&lt;a href=&quot;https://github.com/wschwab&quot;&gt;@wschwab&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4527&quot;&gt;4527&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;QR Code transmission protocol for wallets&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Aaron Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/aaronisme&quot;&gt;@aaronisme&lt;/a&gt;), Sora Lee&amp;nbsp;(&lt;a href=&quot;https://github.com/soralit&quot;&gt;@soralit&lt;/a&gt;), ligi&amp;nbsp;(&lt;a href=&quot;https://github.com/ligi&quot;&gt;@ligi&lt;/a&gt;), Dan Miller&amp;nbsp;(&lt;a href=&quot;https://github.com/danjm&quot;&gt;@danjm&lt;/a&gt;), AndreasGassmann&amp;nbsp;(&lt;a href=&quot;https://github.com/andreasgassmann&quot;&gt;@andreasgassmann&lt;/a&gt;), xardass&amp;nbsp;(&lt;a href=&quot;https://github.com/xardass&quot;&gt;@xardass&lt;/a&gt;), Lixin Liu&amp;nbsp;(&lt;a href=&quot;https://github.com/BitcoinLixin&quot;&gt;@BitcoinLixin&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4546&quot;&gt;4546&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wrapped Deposits&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Justice Hudson&amp;nbsp;(&lt;a href=&quot;https://github.com/jchancehud&quot;&gt;@jchancehud&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4671&quot;&gt;4671&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-Tradable Tokens Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Omar Aflak&amp;nbsp;(&lt;a href=&quot;https://github.com/omaraflak&quot;&gt;@omaraflak&lt;/a&gt;),  Pol-Malo Le Bris, Marvin Martin&amp;nbsp;(&lt;a href=&quot;https://github.com/MarvinMartin24&quot;&gt;@MarvinMartin24&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4675&quot;&gt;4675&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-Fractional Non-Fungible Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;David Kim&amp;nbsp;(&lt;a href=&quot;https://github.com/powerstream3604&quot;&gt;@powerstream3604&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4799&quot;&gt;4799&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Non-Fungible Token Ownership Designation Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;David Buckman&amp;nbsp;(&lt;a href=&quot;https://github.com/davidbuckman&quot;&gt;@davidbuckman&lt;/a&gt;), Isaac Buckman&amp;nbsp;(&lt;a href=&quot;https://github.com/isaacbuckman&quot;&gt;@isaacbuckman&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4885&quot;&gt;4885&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Subscription NFTs and Multi Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jules Lai&amp;nbsp;(&lt;a href=&quot;https://github.com/julesl23&quot;&gt;@julesl23&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4886&quot;&gt;4886&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Proxy Ownership Register&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Omnus Sunmo&amp;nbsp;(&lt;a href=&quot;https://github.com/omnus&quot;&gt;@omnus&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4931&quot;&gt;4931&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Generic Token Upgrade Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;John Peterson&amp;nbsp;(&lt;a href=&quot;https://github.com/John-peterson-coinbase&quot;&gt;@John-peterson-coinbase&lt;/a&gt;), Roberto Bayardo&amp;nbsp;(&lt;a href=&quot;https://github.com/roberto-bayardo&quot;&gt;@roberto-bayardo&lt;/a&gt;), David Núñez&amp;nbsp;(&lt;a href=&quot;https://github.com/cygnusv&quot;&gt;@cygnusv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4944&quot;&gt;4944&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Contract with Exactly One Non-fungible Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Víctor Muñoz&amp;nbsp;(&lt;a href=&quot;https://github.com/victormunoz&quot;&gt;@victormunoz&lt;/a&gt;), Josep Lluis de la Rosa&amp;nbsp;(&lt;a href=&quot;https://github.com/peplluis7&quot;&gt;@peplluis7&lt;/a&gt;), Andres El-Fakdi&amp;nbsp;(&lt;a href=&quot;https://github.com/Bluezfish&quot;&gt;@Bluezfish&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4950&quot;&gt;4950&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Entangled Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Víctor Muñoz&amp;nbsp;(&lt;a href=&quot;https://github.com/victormunoz&quot;&gt;@victormunoz&lt;/a&gt;), Josep Lluis de la Rosa&amp;nbsp;(&lt;a href=&quot;https://github.com/peplluis7&quot;&gt;@peplluis7&lt;/a&gt;), Easy Innova&amp;nbsp;(&lt;a href=&quot;https://github.com/easyinnova&quot;&gt;@easyinnova&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4974&quot;&gt;4974&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Ratings&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Daniel Tedesco&amp;nbsp;(&lt;a href=&quot;https://github.com/dtedesco1&quot;&gt;@dtedesco1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-4987&quot;&gt;4987&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Held token interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Devin Conley&amp;nbsp;(&lt;a href=&quot;https://github.com/devinaconley&quot;&gt;@devinaconley&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5005&quot;&gt;5005&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Zodiac Modular Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Auryn Macmillan&amp;nbsp;(&lt;a href=&quot;https://github.com/auryn-macmillan&quot;&gt;@auryn-macmillan&lt;/a&gt;), Kei Kreutler&amp;nbsp;(&lt;a href=&quot;https://github.com/keikreutler&quot;&gt;@keikreutler&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5018&quot;&gt;5018&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Filesystem-like Interface for Contracts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Qi Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/qizhou&quot;&gt;@qizhou&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5050&quot;&gt;5050&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Interactive NFTs with Modular Environments&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alexi&amp;nbsp;(&lt;a href=&quot;https://github.com/alexi&quot;&gt;@alexi&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5058&quot;&gt;5058&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Lockable Non-Fungible Tokens&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Tyler&amp;nbsp;(&lt;a href=&quot;https://github.com/radiocaca&quot;&gt;@radiocaca&lt;/a&gt;), Alex&amp;nbsp;(&lt;a href=&quot;https://github.com/gojazdev&quot;&gt;@gojazdev&lt;/a&gt;), John&amp;nbsp;(&lt;a href=&quot;https://github.com/sfumato00&quot;&gt;@sfumato00&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5094&quot;&gt;5094&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;URL Format for Ethereum Network Switching&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Luc van Kampen&amp;nbsp;(&lt;a href=&quot;https://github.com/lucemans&quot;&gt;@lucemans&lt;/a&gt;), Jakob Helgesson&amp;nbsp;(&lt;a href=&quot;https://github.com/svemat01&quot;&gt;@svemat01&lt;/a&gt;), Joshua Hendrix&amp;nbsp;(&lt;a href=&quot;https://github.com/thejoshuahendrix&quot;&gt;@thejoshuahendrix&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5095&quot;&gt;5095&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Principal Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Julian Traversa&amp;nbsp;(&lt;a href=&quot;https://github.com/JTraversa&quot;&gt;@JTraversa&lt;/a&gt;), Robert Robbins&amp;nbsp;(&lt;a href=&quot;https://github.com/robrobbins&quot;&gt;@robrobbins&lt;/a&gt;), Alberto Cuesta Cañada&amp;nbsp;(&lt;a href=&quot;https://github.com/alcueca&quot;&gt;@alcueca&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5131&quot;&gt;5131&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;SAFE Authentication For ENS&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Wilkins Chung (@wwhchung)&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:wilkins@manifold.xyz&quot;&gt;wilkins@manifold.xyz&lt;/a&gt;&amp;gt;, Jalil Wahdatehagh&amp;nbsp;(&lt;a href=&quot;https://github.com/jwahdatehagh&quot;&gt;@jwahdatehagh&lt;/a&gt;), Cry&amp;nbsp;(&lt;a href=&quot;https://github.com/crydoteth&quot;&gt;@crydoteth&lt;/a&gt;), Sillytuna&amp;nbsp;(&lt;a href=&quot;https://github.com/sillytuna&quot;&gt;@sillytuna&lt;/a&gt;), Cyberpnk&amp;nbsp;(&lt;a href=&quot;https://github.com/CyberpnkWin&quot;&gt;@CyberpnkWin&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5139&quot;&gt;5139&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Remote Procedure Call Provider Lists&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Sam Wilson&amp;nbsp;(&lt;a href=&quot;https://github.com/SamWilsn&quot;&gt;@SamWilsn&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5143&quot;&gt;5143&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Slippage Protection for Tokenized Vault&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/amxx&quot;&gt;@amxx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5185&quot;&gt;5185&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Updatable Metadata Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Christophe Le Bars&amp;nbsp;(&lt;a href=&quot;https://github.com/clbrge&quot;&gt;@clbrge&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5187&quot;&gt;5187&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Extend EIP-1155 with rentable usage rights&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;DerivStudio&amp;nbsp;(&lt;a href=&quot;https://github.com/DerivStudio&quot;&gt;@DerivStudio&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5218&quot;&gt;5218&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Rights Management&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;James Grimmelmann&amp;nbsp;(&lt;a href=&quot;https://github.com/grimmelm&quot;&gt;@grimmelm&lt;/a&gt;), Yan Ji&amp;nbsp;(&lt;a href=&quot;https://github.com/iseriohn&quot;&gt;@iseriohn&lt;/a&gt;), Tyler Kell&amp;nbsp;(&lt;a href=&quot;https://github.com/relyt29&quot;&gt;@relyt29&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5252&quot;&gt;5252&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Account-bound Finance&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Hyungsuk Kang&amp;nbsp;(&lt;a href=&quot;https://github.com/hskang9&quot;&gt;@hskang9&lt;/a&gt;), Viktor Pernjek&amp;nbsp;(&lt;a href=&quot;https://github.com/smuxx&quot;&gt;@smuxx&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5298&quot;&gt;5298&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ENS Trust to hold NFTs under ENS name&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5334&quot;&gt;5334&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;EIP-721 User And Expires And Level Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yan&amp;nbsp;(&lt;a href=&quot;https://github.com/yan253319066&quot;&gt;@yan253319066&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5409&quot;&gt;5409&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;EIP-1155 Non-Fungible Token extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Ronan Sandford&amp;nbsp;(&lt;a href=&quot;https://github.com/wighawag&quot;&gt;@wighawag&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5437&quot;&gt;5437&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Security Contact Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5501&quot;&gt;5501&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Rental &amp;amp; Delegation NFT - EIP-721 Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Jan Smrža&amp;nbsp;(&lt;a href=&quot;https://github.com/smrza&quot;&gt;@smrza&lt;/a&gt;), David Rábel&amp;nbsp;(&lt;a href=&quot;https://github.com/rabeles11&quot;&gt;@rabeles11&lt;/a&gt;), Tomáš Janča&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:tomas.janca@jtbstorage.eu&quot;&gt;tomas.janca@jtbstorage.eu&lt;/a&gt;&amp;gt;, Jan Bureš&amp;nbsp;(&lt;a href=&quot;https://github.com/JohnyX89&quot;&gt;@JohnyX89&lt;/a&gt;), DOBBYLABS&amp;nbsp;(&lt;a href=&quot;https://github.com/DOBBYLABS&quot;&gt;@DOBBYLABS&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5505&quot;&gt;5505&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;EIP-1155 asset backed NFT extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;liszechung&amp;nbsp;(&lt;a href=&quot;https://github.com/liszechung&quot;&gt;@liszechung&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5539&quot;&gt;5539&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Revocation List Registry&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Philipp Bolte&amp;nbsp;(&lt;a href=&quot;https://github.com/strumswell&quot;&gt;@strumswell&lt;/a&gt;), Lauritz Leifermann&amp;nbsp;(&lt;a href=&quot;https://github.com/lleifermann&quot;&gt;@lleifermann&lt;/a&gt;), Dennis von der Bey&amp;nbsp;(&lt;a href=&quot;https://github.com/DennisVonDerBey&quot;&gt;@DennisVonDerBey&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5553&quot;&gt;5553&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Representing IP and its Royalty Structure&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Roy Osherove&amp;nbsp;(&lt;a href=&quot;https://github.com/royosherove&quot;&gt;@royosherove&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5554&quot;&gt;5554&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Legal Use, Repurposing, and Remixing&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Isaac Patka&amp;nbsp;(&lt;a href=&quot;https://github.com/ipatka&quot;&gt;@ipatka&lt;/a&gt;), COALA Licensing Taskforce&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:info@coala.org&quot;&gt;info@coala.org&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5559&quot;&gt;5559&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Cross Chain Write Deferral Protocol&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Paul Gauvreau&amp;nbsp;(&lt;a href=&quot;https://github.com/0xpaulio&quot;&gt;@0xpaulio&lt;/a&gt;), Nick Johnson&amp;nbsp;(&lt;a href=&quot;https://github.com/arachnid&quot;&gt;@arachnid&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5560&quot;&gt;5560&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Redeemable NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Olivier Fernandez&amp;nbsp;(&lt;a href=&quot;https://github.com/fernandezOli&quot;&gt;@fernandezOli&lt;/a&gt;), Frédéric Le Coidic&amp;nbsp;(&lt;a href=&quot;https://github.com/FredLC29&quot;&gt;@FredLC29&lt;/a&gt;), Julien Béranger&amp;nbsp;(&lt;a href=&quot;https://github.com/julienbrg&quot;&gt;@julienbrg&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5633&quot;&gt;5633&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Composable Soulbound NFT, EIP-1155 Extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;HonorLabs&amp;nbsp;(&lt;a href=&quot;https://github.com/honorworldio&quot;&gt;@honorworldio&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5635&quot;&gt;5635&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;NFT Licensing Agreements&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Timi&amp;nbsp;(&lt;a href=&quot;https://github.com/0xTimi&quot;&gt;@0xTimi&lt;/a&gt;), 0xTriple7&amp;nbsp;(&lt;a href=&quot;https://github.com/ysqi&quot;&gt;@ysqi&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5643&quot;&gt;5643&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Subscription NFTs&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;cygaar&amp;nbsp;(&lt;a href=&quot;https://github.com/cygaar&quot;&gt;@cygaar&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5719&quot;&gt;5719&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Signature replacement interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Agustin Aguilar&amp;nbsp;(&lt;a href=&quot;https://github.com/Agusx1211&quot;&gt;@Agusx1211&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5744&quot;&gt;5744&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Latent Fungible Token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Cozy Finance&amp;nbsp;(&lt;a href=&quot;https://github.com/cozyfinance&quot;&gt;@cozyfinance&lt;/a&gt;), Tony Sheng&amp;nbsp;(&lt;a href=&quot;https://github.com/tonysheng&quot;&gt;@tonysheng&lt;/a&gt;), Matt Solomon&amp;nbsp;(&lt;a href=&quot;https://github.com/mds1&quot;&gt;@mds1&lt;/a&gt;), David Laprade&amp;nbsp;(&lt;a href=&quot;https://github.com/davidlaprade&quot;&gt;@davidlaprade&lt;/a&gt;), Payom Dousti&amp;nbsp;(&lt;a href=&quot;https://github.com/payomdousti&quot;&gt;@payomdousti&lt;/a&gt;), Chad Fleming&amp;nbsp;(&lt;a href=&quot;https://github.com/chad-js&quot;&gt;@chad-js&lt;/a&gt;), Franz Chen&amp;nbsp;(&lt;a href=&quot;https://github.com/Dendrimer&quot;&gt;@Dendrimer&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5753&quot;&gt;5753&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Lockable Extension for EIP-721&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Filipp Makarov&amp;nbsp;(&lt;a href=&quot;https://github.com/filmakarov&quot;&gt;@filmakarov&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5805&quot;&gt;5805&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Voting with delegation&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Hadrien Croubois&amp;nbsp;(&lt;a href=&quot;https://github.com/Amxx&quot;&gt;@Amxx&lt;/a&gt;), Francisco Giordano&amp;nbsp;(&lt;a href=&quot;https://github.com/frangio&quot;&gt;@frangio&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5827&quot;&gt;5827&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Auto-renewable allowance extension&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;zlace&amp;nbsp;(&lt;a href=&quot;https://github.com/zlace0x&quot;&gt;@zlace0x&lt;/a&gt;), zhongfu&amp;nbsp;(&lt;a href=&quot;https://github.com/zhongfu&quot;&gt;@zhongfu&lt;/a&gt;), edison0xyz&amp;nbsp;(&lt;a href=&quot;https://github.com/edison0xyz&quot;&gt;@edison0xyz&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5850&quot;&gt;5850&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Complex Numbers stored in `bytes32` types&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Paul Edge&amp;nbsp;(&lt;a href=&quot;https://github.com/genkifs&quot;&gt;@genkifs&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5851&quot;&gt;5851&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;On-Chain Verifiable Credentials&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yu Liu&amp;nbsp;(&lt;a href=&quot;https://github.com/yuliu-debond&quot;&gt;@yuliu-debond&lt;/a&gt;), Junyi Zhong&amp;nbsp;(&lt;a href=&quot;https://github.com/Jooeys&quot;&gt;@Jooeys&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5883&quot;&gt;5883&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Token Transfer by Social Recovery&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Erhard Dinhobl&amp;nbsp;(&lt;a href=&quot;https://github.com/mrqc&quot;&gt;@mrqc&lt;/a&gt;), Kevin Riedl&amp;nbsp;(&lt;a href=&quot;https://github.com/wsdt&quot;&gt;@wsdt&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-5902&quot;&gt;5902&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Smart Contract Event Hooks&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Simon Brown&amp;nbsp;(&lt;a href=&quot;https://github.com/orbmis&quot;&gt;@orbmis&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6047&quot;&gt;6047&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;ERC-721 Balance indexing via Transfer event&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Zainan Victor Zhou&amp;nbsp;(&lt;a href=&quot;https://github.com/xinbenlv&quot;&gt;@xinbenlv&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6268&quot;&gt;6268&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Untransferability Indicator for EIP-1155&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Yuki Aoki&amp;nbsp;(&lt;a href=&quot;https://github.com/yuki-js&quot;&gt;@yuki-js&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6353&quot;&gt;6353&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Charity token&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Aubay&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:blockchain-team@aubay.com&quot;&gt;blockchain-team@aubay.com&lt;/a&gt;&amp;gt;, BOCA Jeabby&amp;nbsp;(&lt;a href=&quot;https://github.com/bjeabby1507&quot;&gt;@bjeabby1507&lt;/a&gt;), EL MERSHATI Laith&amp;nbsp;(&lt;a href=&quot;https://github.com/lth-elm&quot;&gt;@lth-elm&lt;/a&gt;), KEMP Elia&amp;nbsp;(&lt;a href=&quot;https://github.com/eliakemp&quot;&gt;@eliakemp&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6384&quot;&gt;6384&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Human-readable offline signatures&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Tal Be&apos;ery&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:tal@zengo.com&quot;&gt;tal@zengo.com&lt;/a&gt;&amp;gt;, RoiV&amp;nbsp;(&lt;a href=&quot;https://github.com/DeVaz1&quot;&gt;@DeVaz1&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6464&quot;&gt;6464&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Multi-operator, per-token ERC-721 approvals.&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Cristian Espinoza&amp;nbsp;(&lt;a href=&quot;https://github.com/crisgarner&quot;&gt;@crisgarner&lt;/a&gt;), Simon Fremaux&amp;nbsp;(&lt;a href=&quot;https://github.com/dievardump&quot;&gt;@dievardump&lt;/a&gt;), David Huber&amp;nbsp;(&lt;a href=&quot;https://github.com/cxkoda&quot;&gt;@cxkoda&lt;/a&gt;), and Arran Schlosberg&amp;nbsp;(&lt;a href=&quot;https://github.com/aschlosberg&quot;&gt;@aschlosberg&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-6506&quot;&gt;6506&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;P2P Escrowed Governance Incentives&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Josh Weintraub&amp;nbsp;(&lt;a href=&quot;https://github.com/jhweintraub&quot;&gt;@jhweintraub&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
    &lt;/table&gt;
  

  
  
  
    &lt;h2 id=&quot;withdrawn&quot;&gt;Withdrawn&lt;/h2&gt;
    &lt;table class=&quot;eiptable&quot;&gt;
      &lt;thead&gt;
        
          &lt;tr&gt;&lt;th class=&quot;eipnum&quot;&gt;Number&lt;/th&gt;&lt;th class=&quot;title&quot;&gt;Title&lt;/th&gt;&lt;th class=&quot;author&quot;&gt;Author&lt;/th&gt;&lt;/tr&gt;
        
      &lt;/thead&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-67&quot;&gt;67&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;URI Scheme with Metadata, Value and Bytecode&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alex Van de Sande&amp;nbsp;(&lt;a href=&quot;https://github.com/alexvansande&quot;&gt;@alexvansande&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-875&quot;&gt;875&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Simpler NFT standard with batching and native atomic swaps&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Weiwu Zhang&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:a@colourful.land&quot;&gt;a@colourful.land&lt;/a&gt;&amp;gt;, James Sangalli&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:j.l.sangalli@gmail.com&quot;&gt;j.l.sangalli@gmail.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1123&quot;&gt;1123&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Revised Ethereum Smart Contract Packaging Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;g. nicholas d’andrea&amp;nbsp;(&lt;a href=&quot;https://github.com/gnidan&quot;&gt;@gnidan&lt;/a&gt;), Piper Merriam&amp;nbsp;(&lt;a href=&quot;https://github.com/pipermerriam&quot;&gt;@pipermerriam&lt;/a&gt;), Nick Gheorghita&amp;nbsp;(&lt;a href=&quot;https://github.com/njgheorghita&quot;&gt;@njgheorghita&lt;/a&gt;), Danny Ryan&amp;nbsp;(&lt;a href=&quot;https://github.com/djrtwo&quot;&gt;@djrtwo&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1154&quot;&gt;1154&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Oracle Interface&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Alan Lu&amp;nbsp;(&lt;a href=&quot;https://github.com/cag&quot;&gt;@cag&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-1538&quot;&gt;1538&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Transparent Contract Standard&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Mudge&amp;nbsp;&amp;lt;&lt;a href=&quot;mailto:nick@perfectabstractions.com&quot;&gt;nick@perfectabstractions.com&lt;/a&gt;&amp;gt;&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-7897&quot;&gt;7897&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Wallet-Linked Services for Smart Accounts&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Francesco Sullo&amp;nbsp;(&lt;a href=&quot;https://github.com/sullof&quot;&gt;@sullof&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
        &lt;tr&gt;
          &lt;td class=&quot;eipnum&quot;&gt;&lt;a href=&quot;/ERCS/erc-8109&quot;&gt;8109&lt;/a&gt;&lt;/td&gt;
          
          &lt;td class=&quot;title&quot;&gt;Diamonds, Simplified&lt;/td&gt;
          &lt;td class=&quot;author&quot;&gt;Nick Mudge&amp;nbsp;(&lt;a href=&quot;https://github.com/mudgen&quot;&gt;@mudgen&lt;/a&gt;)&lt;/td&gt;
        &lt;/tr&gt;
      
    &lt;/table&gt;
  


</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/all</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/all</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;
  &lt;channel&gt;
    &lt;title&gt;Ethereum EIPs&lt;/title&gt;
    &lt;description&gt;A feed of all EIPs&lt;/description&gt;
    &lt;link&gt;{{ site.url }}&lt;/link&gt;
    &lt;atom:link href=&quot;{{ site.url }}/all.xml&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&gt;
    &lt;lastBuildDate&gt;{{ site.time | date_to_rfc822 }}&lt;/lastBuildDate&gt;
    {% assign eips = site.pages | sort: &apos;eip&apos; %}
    {% for eip in eips %}
      &lt;item&gt;
        &lt;title&gt;{{ eip.title | xml_escape }}&lt;/title&gt;
        &lt;category&gt;{{ eip.type | xml_escape }}/{{ eip.category | xml_escape }}&lt;/category&gt;
        {% if eip.discussions-to %}
          &lt;comments&gt;{{ eip.discussions-to | xml_escape }}&lt;/comments&gt;
        {% endif %}
        &lt;description&gt;{{ eip.content | xml_escape }}&lt;/description&gt;
        &lt;pubDate&gt;{{ eip.created | date_to_rfc822 }}&lt;/pubDate&gt;
        &lt;link&gt;{{ site.url }}{{ eip.url }}&lt;/link&gt;
        &lt;guid isPermaLink=&quot;true&quot;&gt;{{ site.url }}{{ eip.url }}&lt;/guid&gt;
      &lt;/item&gt;
    {% endfor %}
  &lt;/channel&gt;
&lt;/rss&gt;
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/rss/all.xml</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/rss/all.xml</guid>
      </item>
    
      <item>
        <title>Core</title>
        <category>/</category>
        
        <description>{% assign eips=site.pages|where:&quot;type&quot;,&quot;Standards Track&quot;|where:&quot;category&quot;,&quot;Core&quot; %}
{% include eiptable.html eips=eips %}
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/core</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/core</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;
  &lt;channel&gt;
    &lt;title&gt;Ethereum EIPs - Last Call Review&lt;/title&gt;
    &lt;description&gt;All EIPs which are in the &quot;last call&quot; status, please help review these and provide your feedback!&lt;/description&gt;
    &lt;link&gt;{{ site.url }}&lt;/link&gt;
    &lt;atom:link href=&quot;{{ site.url }}/rss/last-call.xml&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&gt;
    &lt;lastBuildDate&gt;{{ site.time | date_to_rfc822 }}&lt;/lastBuildDate&gt;
    {% assign eips = site.pages | sort: &apos;eip&apos; %}
    {% for eip in eips %}
      {% if eip.category == &quot;ERC&quot; %}
      {% if eip.status == &quot;Last Call&quot; %}
      {% capture description %}
        &lt;p&gt;&lt;strong&gt;EIP #{{ eip.eip }} - {{eip.title }}&lt;/strong&gt; is in Last Call status. It is authored by {{ eip.author }} and was originally created {{ eip.created }}. It is in the {{ eip.category }} category of type {{ eip.type }}. Please review and note any changes that should block acceptance.&lt;/p&gt;
        {% if eip.discussions-to %}
          &lt;p&gt;The author has requested that discussions happen at the following URL: &lt;a href=&quot;{{ eip.discussions-to }}&quot;&gt;{{ eip.discussions-to }}&lt;/a&gt;&lt;/p&gt;
        {% endif %}
        &lt;hr /&gt;
        {{ eip.content }}
      {% endcapture %}
      &lt;item&gt;
        &lt;title&gt;{{ eip.title | xml_escape }}&lt;/title&gt;
        &lt;description&gt;{{ description | xml_escape }}&lt;/description&gt;
        &lt;pubDate&gt;{{ eip.created | date_to_rfc822 }}&lt;/pubDate&gt;
        &lt;link&gt;{{ site.url }}/{{ eip.url }}&lt;/link&gt;
        &lt;guid isPermaLink=&quot;true&quot;&gt;{{ site.url }}/{{ eip.url }}&lt;/guid&gt;
      &lt;/item&gt;
      {% endif %}
      {% endif %}
    {% endfor %}
  &lt;/channel&gt;
&lt;/rss&gt;
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/rss/erc-last-call.xml</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/rss/erc-last-call.xml</guid>
      </item>
    
      <item>
        <title>ERC</title>
        <category>/</category>
        
        <description>{% assign eips=site.pages|where:&quot;type&quot;,&quot;Standards Track&quot;|where:&quot;category&quot;,&quot;ERC&quot; %}
{% include eiptable.html eips=eips %}
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/erc</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/erc</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;
  &lt;channel&gt;
    &lt;title&gt;Ethereum ERCs&lt;/title&gt;
    &lt;description&gt;All updates for ERCs&lt;/description&gt;
    &lt;link&gt;{{ site.url }}&lt;/link&gt;
    &lt;atom:link href=&quot;{{ site.url }}/rss/erc.xml&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&gt;
    &lt;lastBuildDate&gt;{{ site.time | date_to_rfc822 }}&lt;/lastBuildDate&gt;
    {% assign eips = site.pages | sort: &apos;eip&apos; %}
    {% for eip in eips %}
      {% if eip.category == &quot;ERC&quot; %}
      {% capture description %}
        &lt;p&gt;&lt;strong&gt;EIP #{{ eip.eip }} - {{eip.title }}&lt;/strong&gt; is in the {{ eip.category }} category of type {{ eip.type }} and was just updated.&lt;/p&gt;
        {% if eip.discussions-to %}
          &lt;p&gt;The author has requested that discussions happen at the following URL: &lt;a href=&quot;{{ eip.discussions-to }}&quot;&gt;{{ eip.discussions-to }}&lt;/a&gt;&lt;/p&gt;
        {% endif %}
        &lt;hr /&gt;
        {{ eip.content }}
      {% endcapture %}
      &lt;item&gt;
        &lt;title&gt;{{ eip.title | xml_escape }}&lt;/title&gt;
        &lt;description&gt;{{ description | xml_escape }}&lt;/description&gt;
        &lt;pubDate&gt;{{ eip.created | date_to_rfc822 }}&lt;/pubDate&gt;
        &lt;link&gt;{{ site.url }}/{{ eip.url }}&lt;/link&gt;
        &lt;guid isPermaLink=&quot;true&quot;&gt;{{ site.url }}/{{ eip.url }}&lt;/guid&gt;
      &lt;/item&gt;
      {% endif %}
    {% endfor %}
  &lt;/channel&gt;
&lt;/rss&gt;
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/rss/erc.xml</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/rss/erc.xml</guid>
      </item>
    
      <item>
        <title>Home</title>
        <category>/</category>
        
        <description>&lt;h1 class=&quot;page-heading&quot;&gt;EIPs
  &lt;a href=&quot;https://discord.io/EthCatHerders&quot;&gt;&lt;img src=&quot;https://dcbadge.vercel.app/api/server/Nz6rtfJ8Cu?style=flat&quot; alt=&quot;Discord channel for ECH eip-editer&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;https://discord.gg/EVTQ9crVgQ&quot;&gt;&lt;img src=&quot;https://dcbadge.vercel.app/api/server/EVTQ9crVgQ?style=flat&quot; alt=&quot;Discord channel for Eth R&amp;D eip-editing&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;https://discord.gg/mRzPXmmYEA&quot;&gt;&lt;img src=&quot;https://dcbadge.vercel.app/api/server/mRzPXmmYEA?style=flat&quot; alt=&quot;Discord server for discussions about proposals that impact Ethereum wallets&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;rss/all.xml&quot;&gt;&lt;img src=&quot;https://img.shields.io/badge/rss-Everything-red.svg&quot; alt=&quot;RSS&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;rss/last-call.xml&quot;&gt;&lt;img src=&quot;https://img.shields.io/badge/rss-Last Calls-red.svg&quot; alt=&quot;RSS&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;rss/nonerc.xml&quot;&gt;&lt;img src=&quot;https://img.shields.io/badge/rss-All except ERC-red.svg&quot; alt=&quot;RSS&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;https://eepurl.com/ikqNIP&quot;&gt;&lt;img src=&quot;https://img.shields.io/badge/-email%20alerts-red.svg&quot; alt=&quot;RSS&quot;&gt;&lt;/a&gt;
&lt;/h1&gt;
&lt;p&gt;Ethereum Improvement Proposals (EIPs) describe standards for the Ethereum platform, including core protocol specifications, client APIs, and contract standards. Network upgrades are discussed separately in the &lt;a target=&quot;_blank&quot; href=&quot;https://github.com/ethereum/pm/&quot;&gt;Ethereum Project Management&lt;/a&gt; repository.&lt;/p&gt;

&lt;h2&gt;Contributing&lt;/h2&gt;
&lt;p&gt;First review &lt;a href=&quot;EIPS/eip-1&quot;&gt;EIP-1&lt;/a&gt;. Then clone the repository and add your EIP to it. There is a &lt;a href=&quot;https://github.com/ethereum/EIPs/blob/master/eip-template.md?plain=1&quot;&gt;template EIP here&lt;/a&gt;. Then submit a Pull Request to Ethereum&apos;s &lt;a href=&quot;https://github.com/ethereum/EIPs&quot;&gt;EIPs repository&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;EIP status terms&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Idea&lt;/strong&gt; - An idea that is pre-draft. This is not tracked within the EIP Repository.
  &lt;li&gt;&lt;strong&gt;Draft&lt;/strong&gt; - The first formally tracked stage of an EIP in development. An EIP is merged by an EIP Editor into the EIP repository when properly formatted.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Review&lt;/strong&gt; - An EIP Author marks an EIP as ready for and requesting Peer Review.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Last Call&lt;/strong&gt; - This is the final review window for an EIP before moving to FINAL. An EIP editor will assign Last Call status and set a review end date (`last-call-deadline`), typically 14 days later. If this period results in necessary normative changes it will revert the EIP to Review.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Final&lt;/strong&gt; - This EIP represents the final standard. A Final EIP exists in a state of finality and should only be updated to correct errata and add non-normative clarifications.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Stagnant&lt;/strong&gt; - Any EIP in Draft or Review if inactive for a period of 6 months or greater is moved to Stagnant. An EIP may be resurrected from this state by Authors or EIP Editors through moving it back to Draft.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Withdrawn&lt;/strong&gt; - The EIP Author(s) have withdrawn the proposed EIP. This state has finality and can no longer be resurrected using this EIP number. If the idea is pursued at later date it is considered a new proposal.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Living&lt;/strong&gt; - A special status for EIPs that are designed to be continually updated and not reach a state of finality. This includes most notably EIP-1.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;EIP Types&lt;/h2&gt;

&lt;p&gt;EIPs are separated into a number of types, and each has its own list of EIPs.&lt;/p&gt;

&lt;h3&gt;Standard Track ({{site.pages|where:&quot;type&quot;,&quot;Standards Track&quot;|size}})&lt;/h3&gt;
&lt;p&gt;Describes any change that affects most or all Ethereum implementations, such as a change to the network protocol, a change in block or transaction validity rules, proposed application standards/conventions, or any change or addition that affects the interoperability of applications using Ethereum. Furthermore Standard EIPs can be broken down into the following categories.&lt;/p&gt;

&lt;h4&gt;&lt;a href=&quot;{{&quot;core&quot;|relative_url}}&quot;&gt;Core&lt;/a&gt; ({{site.pages|where:&quot;type&quot;,&quot;Standards Track&quot;|where:&quot;category&quot;,&quot;Core&quot;|size}})&lt;/h4&gt;
&lt;p&gt;Improvements requiring a consensus fork (e.g. &lt;a href=&quot;./EIPS/eip-5&quot;&gt;EIP-5&lt;/a&gt;, &lt;a href=&quot;./EIPS/eip-211&quot;&gt;EIP-211&lt;/a&gt;), as well as changes that are not necessarily consensus critical but may be relevant to “core dev” discussions (for example, the PoA algorithm for testnets described in &lt;a href=&quot;./EIPS/eip-225&quot;&gt;EIP-225&lt;/a&gt;).&lt;/p&gt;

&lt;h4&gt;&lt;a href=&quot;{{&quot;networking&quot;|relative_url}}&quot;&gt;Networking&lt;/a&gt; ({{site.pages|where:&quot;type&quot;,&quot;Standards Track&quot;|where:&quot;category&quot;,&quot;Networking&quot;|size}})&lt;/h4&gt;
&lt;p&gt;Includes improvements around devp2p (&lt;a href=&quot;./EIPS/eip-8&quot;&gt;EIP-8&lt;/a&gt;) and Light Ethereum Subprotocol, as well as proposed improvements to network protocol specifications of whisper and swarm.&lt;/p&gt;

&lt;h4&gt;&lt;a href=&quot;{{&quot;interface&quot;|relative_url}}&quot;&gt;Interface&lt;/a&gt; ({{site.pages|where:&quot;type&quot;,&quot;Standards Track&quot;|where:&quot;category&quot;,&quot;Interface&quot;|size}})&lt;/h4&gt;
&lt;p&gt;Includes improvements around client API/RPC specifications and standards, and also certain language-level standards like method names (&lt;a href=&quot;./EIPS/eip-6&quot;&gt;EIP-6&lt;/a&gt;) and contract ABIs. The label “interface” aligns with the interfaces repo and discussion should primarily occur in that repository before an EIP is submitted to the EIPs repository.&lt;/p&gt;

&lt;h4&gt;&lt;a href=&quot;{{&quot;erc&quot;|relative_url}}&quot;&gt;ERC&lt;/a&gt; ({{site.pages|where:&quot;type&quot;,&quot;Standards Track&quot;|where:&quot;category&quot;,&quot;ERC&quot;|size}})&lt;/h4&gt;
&lt;p&gt;Application-level standards and conventions, including contract standards such as token standards (&lt;a href=&quot;./EIPS/eip-20&quot;&gt;EIP-20&lt;/a&gt;), name registries (&lt;a href=&quot;./EIPS/eip-137&quot;&gt;EIP-137&lt;/a&gt;), URI schemes (&lt;a href=&quot;./EIPS/eip-681&quot;&gt;EIP-681&lt;/a&gt;), library/package formats (&lt;a href=&quot;./EIPS/eip-190&quot;&gt;EIP-190&lt;/a&gt;), and account abstraction (&lt;a href=&quot;./EIPS/eip-4337&quot;&gt;EIP-4337&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;{{&quot;meta&quot;|relative_url}}&quot;&gt;Meta&lt;/a&gt; ({{site.pages|where:&quot;type&quot;,&quot;Meta&quot;|size}})&lt;/h3&gt;
&lt;p&gt;Describes a process surrounding Ethereum or proposes a change to (or an event in) a process. Process EIPs are like Standards Track EIPs but apply to areas other than the Ethereum protocol itself. They may propose an implementation, but not to Ethereum&apos;s codebase; they often require community consensus; unlike Informational EIPs, they are more than recommendations, and users are typically not free to ignore them. Examples include procedures, guidelines, changes to the decision-making process, and changes to the tools or environment used in Ethereum development. Any meta-EIP is also considered a Process EIP.&lt;/p&gt;

&lt;h3&gt;&lt;a href=&quot;{{&quot;informational&quot;|relative_url}}&quot;&gt;Informational&lt;/a&gt; ({{site.pages|where:&quot;type&quot;,&quot;Informational&quot;|size}})&lt;/h3&gt;
&lt;p&gt;Describes a Ethereum design issue, or provides general guidelines or information to the Ethereum community, but does not propose a new feature. Informational EIPs do not necessarily represent Ethereum community consensus or a recommendation, so users and implementers are free to ignore Informational EIPs or follow their advice.&lt;/p&gt;
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/</guid>
      </item>
    
      <item>
        <title>Informational</title>
        <category>/</category>
        
        <description>{% assign eips=site.pages|where:&quot;type&quot;,&quot;Informational&quot; %}
{% include eiptable.html eips=eips %}
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/informational</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/informational</guid>
      </item>
    
      <item>
        <title>Interface</title>
        <category>/</category>
        
        <description>{% assign eips=site.pages|where:&quot;type&quot;,&quot;Standards Track&quot;|where:&quot;category&quot;,&quot;Interface&quot; %}
{% include eiptable.html eips=eips %}
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/interface</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/interface</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;
  &lt;channel&gt;
    &lt;title&gt;Ethereum EIPs - Last Call Review&lt;/title&gt;
    &lt;description&gt;All EIPs which are in the two-week &quot;last call&quot; status, please help review these and provide your feedback!&lt;/description&gt;
    &lt;link&gt;{{ site.url }}&lt;/link&gt;
    &lt;atom:link href=&quot;{{ site.url }}/rss/last-call.xml&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&gt;
    &lt;lastBuildDate&gt;{{ site.time | date_to_rfc822 }}&lt;/lastBuildDate&gt;
    {% assign eips = site.pages | sort: &apos;eip&apos; %}
    {% for eip in eips %}
      {% if eip.status == &quot;Last Call&quot; %}
      {% capture description %}
        &lt;p&gt;&lt;strong&gt;EIP #{{ eip.eip }} - {{eip.title }}&lt;/strong&gt; is in Last Call status. It is authored by {{ eip.author }} and was originally created {{ eip.created }}. It is in the {{ eip.category }} category of type {{ eip.type }}. Please review and note any changes that should block acceptance.&lt;/p&gt;
        {% if eip.discussions-to %}
          &lt;p&gt;The author has requested that discussions happen at the following URL: &lt;a href=&quot;{{ eip.discussions-to }}&quot;&gt;{{ eip.discussions-to }}&lt;/a&gt;&lt;/p&gt;
        {% endif %}
        &lt;hr /&gt;
        {{ eip.content }}
      {% endcapture %}
      &lt;item&gt;
        &lt;title&gt;{{ eip.title | xml_escape }}&lt;/title&gt;
        &lt;description&gt;{{ description | xml_escape }}&lt;/description&gt;
        &lt;pubDate&gt;{{ eip.created | date_to_rfc822 }}&lt;/pubDate&gt;
        &lt;link&gt;{{ site.url }}/{{ eip.url }}&lt;/link&gt;
        &lt;guid isPermaLink=&quot;true&quot;&gt;{{ site.url }}/{{ eip.url }}&lt;/guid&gt;
      &lt;/item&gt;
      {% endif %}
    {% endfor %}
  &lt;/channel&gt;
&lt;/rss&gt;
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/rss/last-call.xml</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/rss/last-call.xml</guid>
      </item>
    
      <item>
        <title>Meta</title>
        <category>/</category>
        
        <description>{% assign eips=site.pages|where:&quot;type&quot;,&quot;Meta&quot; %}
{% include eiptable.html eips=eips %}
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/meta</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/meta</guid>
      </item>
    
      <item>
        <title>Networking</title>
        <category>/</category>
        
        <description>{% assign eips=site.pages|where:&quot;type&quot;,&quot;Standards Track&quot;|where:&quot;category&quot;,&quot;Networking&quot; %}
{% include eiptable.html eips=eips %}
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/networking</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/networking</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;
  &lt;channel&gt;
    &lt;title&gt;Ethereum EIPs - Last Call Review&lt;/title&gt;
    &lt;description&gt;All EIPs which are in the two-week &quot;last call&quot; status, please help review these and provide your feedback!&lt;/description&gt;
    &lt;link&gt;{{ site.url }}&lt;/link&gt;
    &lt;atom:link href=&quot;{{ site.url }}/rss/last-call.xml&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&gt;
    &lt;lastBuildDate&gt;{{ site.time | date_to_rfc822 }}&lt;/lastBuildDate&gt;
    {% assign eips = site.pages | sort: &apos;eip&apos; %}
    {% for eip in eips %}
      {% unless eip.category == &quot;ERC&quot; %}
      {% if eip.status == &quot;Last Call&quot; %}
      {% capture description %}
        &lt;p&gt;&lt;strong&gt;EIP #{{ eip.eip }} - {{eip.title }}&lt;/strong&gt; is in Last Call status. It is authored by {{ eip.author }} and was originally created {{ eip.created }}. It is in the {{ eip.category }} category of type {{ eip.type }}. Please review and note any changes that should block acceptance.&lt;/p&gt;
        {% if eip.discussions-to %}
          &lt;p&gt;The author has requested that discussions happen at the following URL: &lt;a href=&quot;{{ eip.discussions-to }}&quot;&gt;{{ eip.discussions-to }}&lt;/a&gt;&lt;/p&gt;
        {% endif %}
        &lt;hr /&gt;
        {{ eip.content }}
      {% endcapture %}
      &lt;item&gt;
        &lt;title&gt;{{ eip.title | xml_escape }}&lt;/title&gt;
        &lt;description&gt;{{ description | xml_escape }}&lt;/description&gt;
        &lt;pubDate&gt;{{ eip.created | date_to_rfc822 }}&lt;/pubDate&gt;
        &lt;link&gt;{{ site.url }}/{{ eip.url }}&lt;/link&gt;
        &lt;guid isPermaLink=&quot;true&quot;&gt;{{ site.url }}/{{ eip.url }}&lt;/guid&gt;
      &lt;/item&gt;
      {% endif %}
      {% endunless %}
    {% endfor %}
  &lt;/channel&gt;
&lt;/rss&gt;
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/rss/nonerc-last-call.xml</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/rss/nonerc-last-call.xml</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;
  &lt;channel&gt;
    &lt;title&gt;Ethereum EIPs&lt;/title&gt;
    &lt;description&gt;All EIPs that are not ERCs&lt;/description&gt;
    &lt;link&gt;{{ site.url }}&lt;/link&gt;
    &lt;atom:link href=&quot;{{ site.url }}/rss/last-call.xml&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot; /&gt;
    &lt;lastBuildDate&gt;{{ site.time | date_to_rfc822 }}&lt;/lastBuildDate&gt;
    {% assign eips = site.pages | sort: &apos;eip&apos; %}
    {% for eip in eips %}
      {% unless eip.category == &quot;ERC&quot; %}
      {% if eip.status == &quot;Last Call&quot; %}
      {% capture description %}
        &lt;p&gt;&lt;strong&gt;EIP #{{ eip.eip }} - {{eip.title }}&lt;/strong&gt; is in Last Call status. It is authored by {{ eip.author }} and was originally created {{ eip.created }}. It is in the {{ eip.category }} category of type {{ eip.type }}. Please review and note any changes that should block acceptance.&lt;/p&gt;
        {% if eip.discussions-to %}
          &lt;p&gt;The author has requested that discussions happen at the following URL: &lt;a href=&quot;{{ eip.discussions-to }}&quot;&gt;{{ eip.discussions-to }}&lt;/a&gt;&lt;/p&gt;
        {% endif %}
        &lt;hr /&gt;
        {{ eip.content }}
      {% endcapture %}
      &lt;item&gt;
        &lt;title&gt;{{ eip.title | xml_escape }}&lt;/title&gt;
        &lt;description&gt;{{ description | xml_escape }}&lt;/description&gt;
        &lt;pubDate&gt;{{ eip.created | date_to_rfc822 }}&lt;/pubDate&gt;
        &lt;link&gt;{{ site.url }}/{{ eip.url }}&lt;/link&gt;
        &lt;guid isPermaLink=&quot;true&quot;&gt;{{ site.url }}/{{ eip.url }}&lt;/guid&gt;
      &lt;/item&gt;
      {% endif %}
      {% endunless %}
    {% endfor %}
  &lt;/channel&gt;
&lt;/rss&gt;
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/rss/nonerc.xml</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/rss/nonerc.xml</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>$content-width: 1152px;

@import &apos;minima&apos;;

.site-header {
  .wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

.page-content {
  a.anchor-link {
    width: 16px;
    height: 16px;
    display: inline-block;
    margin-left: -22px;
    &amp;:hover {
      background-image: url(&quot;data:image/svg+xml,%3Csvg xmlns=&apos;http://www.w3.org/2000/svg&apos; class=&apos;anchor-link-icon&apos; viewBox=&apos;0 0 16 16&apos; version=&apos;1.1&apos; width=&apos;16&apos; height=&apos;16&apos; aria-hidden=&apos;true&apos;%3E%3Cpath fill-rule=&apos;evenodd&apos; d=&apos;M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z&apos;%3E%3C/path%3E%3C/svg%3E&quot;);
    }
  }
}

.footer-col-wrapper {
  color: #111;
}

.table-borderless, .table-borderless * {
  border-style : hidden !important; // !important To override Jekyll styling
  background-color: rgba(0,0,0,0) !important;
}

table.preamble &gt; tbody &gt; tr &gt; :not(:first-child) {
  width: 100%;
}

table.preamble &gt; tbody &gt; tr &gt; :first-child {
  white-space: nowrap;
}

a, a:link {
  color: #726E97;
  text-decoration: none;
}

a:visited {
  color: #8E6680;
}

a:hover, a:active {
  color: #7F557D;
  text-decoration: underline;
}

.site-footer, .site-footer * {
  box-sizing: content-box !important; // !important To override bootstrap styling
}

.no-underline {
  text-decoration: none !important; // !important To override previous &lt;a&gt; styling
}

.badge:hover {
  filter: brightness(75%);
  transition: all 0.25s ease;
}

h1 {
  vertical-align: middle;
}

h1 a {
  height: 1em;
  display: inline-block;
  vertical-align: baseline;
}

.inline-svg {
  display: inline-block;
  vertical-align: bottom;
  fill: currentColor;
  width: 1.5ex;
  height: 100%;
  object-fit: cover;
}

@media print {

  header,
  footer {
    display: none;
  }
}

// This will make ALL tables scrollable
.page-content table {
  display: inline-block;
  width: auto !important;   /* shrink-to-fit its contents */
  max-width: 100%; /* never exceed the width of its container */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

// Fix text overflow in EIP content
.home {
  max-width: 100%;
  overflow-x: hidden;

  // Target all content that could overflow
  p, li, td, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  // Specifically handle URLs in links
  a {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
  }

  // Handle code blocks that might contain long strings
  pre {
    overflow-x: auto;
    max-width: 100%;
  }

  // Inline code should wrap
  code {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

// Specifically target lists (where references usually are)
.home ul, .home ol {
  max-width: 100%;
  padding-right: 20px; // Give some breathing room

  li {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;

    // Extra aggressive breaking for URLs
    a {
      word-break: break-all;
      hyphens: auto;
    }
  }
}

// makes an exception to code inside tables allowing them to expand the table&apos;s width since it has overflow scrolling
.page-content table code {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/css/style.css</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/css/style.css</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>@import &quot;minima&quot;;
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/main.css</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/main.css</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>Creative Commons Legal Code

CC0 1.0 Universal

    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
    LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
    INFORMATION ON AN &quot;AS-IS&quot; BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
    REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
    PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
    THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
    HEREUNDER.

Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an &quot;owner&quot;) of an original work of
authorship and/or a database (each, a &quot;Work&quot;).

Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works (&quot;Commons&quot;) that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.

For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the &quot;Affirmer&quot;), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (&quot;Copyright and
Related Rights&quot;). Copyright and Related Rights include, but are not
limited to, the following:

  i. the right to reproduce, adapt, distribute, perform, display,
     communicate, and translate a Work;
 ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person&apos;s image or
     likeness depicted in a Work;
 iv. rights protecting against unfair competition in regards to a Work,
     subject to the limitations in paragraph 4(a), below;
  v. rights protecting the extraction, dissemination, use and reuse of data
     in a Work;
 vi. database rights (such as those arising under Directive 96/9/EC of the
     European Parliament and of the Council of 11 March 1996 on the legal
     protection of databases, and under any national implementation
     thereof, including any amended or successor version of such
     directive); and
vii. other similar, equivalent or corresponding rights throughout the
     world based on applicable law or treaty, and any national
     implementations thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer&apos;s Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the &quot;Waiver&quot;). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer&apos;s heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer&apos;s express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer&apos;s express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer&apos;s Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
&quot;License&quot;). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer&apos;s
express Statement of Purpose.

4. Limitations and Disclaimers.

 a. No trademark or patent rights held by Affirmer are waived, abandoned,
    surrendered, licensed or otherwise affected by this document.
 b. Affirmer offers the Work as-is and makes no representations or
    warranties of any kind concerning the Work, express, implied,
    statutory or otherwise, including without limitation warranties of
    title, merchantability, fitness for a particular purpose, non
    infringement, or the absence of latent or other defects, accuracy, or
    the present or absence of errors, whether or not discoverable, all to
    the greatest extent permissible under applicable law.
 c. Affirmer disclaims responsibility for clearing rights of other persons
    that may apply to the Work or any use thereof, including without
    limitation any person&apos;s Copyright and Related Rights in the Work.
    Further, Affirmer disclaims responsibility for obtaining any necessary
    consents, permissions or other rights required for any use of the
    Work.
 d. Affirmer understands and acknowledges that Creative Commons is not a
    party to this document and has no duty or obligation with respect to
    this CC0 or use of the Work.
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/LICENSE</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/LICENSE</guid>
      </item>
    
      <item>
        <title>Contributors</title>
        <category>/</category>
        
        <description>## Contributors

* Andrew Redden (@androolloyd)
* Patrick Gallagher (@pi0neerpat)
* Leo Alt (@leonardoalt)
* Santiago Palladino (@spalladino)
* William Entriken (@fulldecent)
* Gonçalo Sá (@GNSPS)
* Brian Burns (@Droopy78)
* Ramesh Nair(@hiddentao)
* Jules Goddard (@JulesGoddard)
* Micah Zoltu (@MicahZoltu)
* Sam Wilson (@SamWilsn)
* William Morriss (@wjmelements)
* Zachary (@Remscar)
* Patrick Collins (@PatrickAlphaC)
* Hadrien Croubois (@Amxx)
* (@farreldarian)
* Kelvin Schoofs (@SchoofsKelvin)
* (@0xpApaSmURf)
* Nathan Sala (@nataouze)
* Anders Torbjornsen (@anders-torbjornsen)
* (@Pandapip1)
* Xavier Iturralde (@xibot)
* Coder Dan (@cinnabarhorse)
* GldnXross (@gldnxross)
* Christian Reitwiessner (@chriseth)
* Timidan (@Timidan)
* cyotee doge (@cyotee)
* Glory Praise Emmanuel (@emmaglorypraise)
* Ed Zynda (@ezynda3)
* Arthur Nesbitt (@nesbitta)
* Cliff Hall (@cliffhall)
* Tyler Scott Ward (@tylerscottward)
* Troy Murray (@DannyDesert)
* Dan Finlay (@danfinlay)
* Theodore Georgas (@tgeorgas)
* Aditya Palepu (@apalepu23)
* Ronan Sandford (@wighawag)
* Markus Waas (@gorgos)
* Blessing Emah (@BlessingEmah)
* Andrew Edwards
* Ashwin Yardi (@ashwinYardi)
* Marco Castignoli (@marcocastignoli)
* Blaine Bublitz (@phated)
* Bearded
* Nick Barry (@ItsNickBarry)
* (@Vectorized)
* Rachit Srivastava (@rachit2501)
* Neeraj Kashyap (@zomglings)
* Zac Denham (@zdenham)
* JA (@ubinatus)
* Carter Carlson (@cartercarlson)
* James Sayer (@jamessayer98)
* Arpit Temani (@temaniarpit27)
* Parv Garg (@parv3213)
* Publius (@publiuss)
* Guy Hance (@guyhance)
* Payn (@Ayuilos)
* Luis Schliesske (@gitpusha)
* Hilmar Orth (@hilmarx)
* Matthieu Marie Joseph (@Gauddel)
* David Uzochukwu (@davidpius95)
* TJ VanSlooten (@tjvsx)
* 0xFluffyBeard (@0xFluffyBeard)
* Florian Pfeiffer (@FlorianPfeifferKanaloaNetwork)
* Mick de Graaf(@MickdeGraaf)
* Alessio Delmonti (@Alexintosh)
* Neirenoir (@Neirenoir)
* Evert Kors (@Evert0x)
* Patrick Kim (@pakim249CAL)
* Ersan YAKIT (@ersanyakit)
* Matias Arazi (@MatiArazi)
* Lucas Grasso Ramos (@LucasGrasso)
* Nikolay Angelov (@NikolayAngelov)
* John Reynolds (@gweiworld)
* Viraz Malhotra (@viraj124)
* Kemal Emre Ballı (@emrbli)
* Zack Peng (@zackpeng)
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-2535/Contributors</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-2535/Contributors</guid>
      </item>
    
      <item>
        <title>Metadata standards</title>
        <category>/</category>
        
        <description># Metadata  standards 


This documentation consists of various JSON schemas (examples or standards) that can be referenced by the reader of this EIP for implementing EIP-3475 bonds storage.

## 1. Description metadata: 

```json 
[
    {
        &quot;title&quot;: &quot;defining the title information&quot;,
        &quot;_type&quot;: &quot;explaining the type of the title information added&quot;,
        &quot;description&quot;: &quot;little description about the information stored in  the bond&quot;,
    }
]
```

Example: adding details in bonds describing the local jurisdiction of the bonds where it&apos;s issued:

```json
{
&quot;title&quot;: &quot;localisation&quot;,
&quot;_type&quot;: &quot;string&quot;,
&quot;description&quot;: &quot;jurisdiction law codes compatibility&quot;
&quot;values&quot;: [&quot;fr &quot;, &quot;de&quot;, &quot;ch&quot;]
}
```
The &apos;values&apos; field defined above can also be ISO codes or other hex standard representation.
## 2. Nonce metadata:

- **Information defining the state of the bond** 

```json
[	
	{	
	&quot;title&quot;: &quot;maturity&quot;,
	&quot;_type&quot;: &quot;uint&quot;,
	&quot;description&quot;: &quot;Lorem ipsum...&quot;,
	&quot;values&quot;: [0, 0, 0]
	}
]
```


## 3. Class metadata:

```json
[ 
	{	
	&quot;title&quot;: &quot;symbol&quot;,
	&quot;_type&quot;: &quot;string&quot;,
	&quot;description&quot;: &quot;Lorem ipsum...&quot;,
	&quot;values&quot;: [&quot;Class symbol 1&quot;, &quot;Class symbol 2&quot;, &quot;Class symbol 3&quot;],
	},
	{	
	&quot;title&quot;: &quot;issuer&quot;,
	&quot;_type&quot;: &quot;string&quot;,
	&quot;description&quot;: &quot;Lorem ipsum...&quot;,
	&quot;values&quot;: [&quot;Issuer name 1&quot;, &quot;Issuer name 2&quot;, &quot;Issuer name 3&quot;],
	},

	{	
	&quot;title&quot;: &quot;issuer_address&quot;,
	&quot;_type&quot;: &quot;address&quot;,
	&quot;description&quot;: &quot;Lorem ipsum...&quot;,
	&quot;values&quot;:[&quot;Address 1.&quot;, &quot;Address 2&quot;, &quot;Address 3&quot;]
	},

	{	
	&quot;title&quot;: &quot;class_type&quot;,
	&quot;_type&quot;: &quot;string&quot;,
	&quot;description&quot;: &quot;Lorem ipsum...&quot;,
	&quot;values&quot;: [&quot;Class Type 1&quot;, &quot;Class Type 2&quot;, &quot;Class Type 3&quot;]
	},

	{	
	&quot;title&quot;: &quot;token_address&quot;,
	&quot;_type&quot;: &quot;address&quot;,
	&quot;description&quot;: &quot;Lorem ipsum...&quot;,
	&quot;values&quot;:[&quot;Address 1.&quot;, &quot;Address 2&quot;, &quot;Address 3&quot;]
	},

	{	
	&quot;title&quot;: &quot;period&quot;,
	&quot;_type&quot;: &quot;uint&quot;,
	&quot;description&quot;: &quot;Lorem ipsum...&quot;,
	&quot;values&quot;: [0, 0, 0]
	}
]
```
## Examples of other standards: 
    - ISO-20022 standard is the recently adopted standard by banks for communicating  financial operators (Banks, trading intermediaries, underwriters) that also include bond operations. 
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-3475/Metadata</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-3475/Metadata</guid>
      </item>
    
      <item>
        <title>Bundler Full Sequence Diagram</title>
        <category>/</category>
        
        <description># Bundler Full Sequence Diagram

```plantuml
title UserOperations mempool flow

actor Alice
actor Bob
participant &quot;Bundler RPC&quot;
participant &quot;Ethereum RPC&quot;
participant &quot;UserOp Mempool&quot;

group Alice Submits UserOp
note right of Alice: create UserOp
Alice-&gt;&quot;Bundler RPC&quot;: &quot;&quot;eth_sendUserOperation&quot;&quot;
&quot;Bundler RPC&quot;-&gt;&quot;Ethereum RPC&quot;: First Validation\ntrace view call to:\n&quot;&quot;handleOps([userOpA]&quot;&quot;)
&quot;Bundler RPC&quot;-&gt;&quot;UserOp Mempool&quot;: add &quot;&quot;UserOp&quot;&quot; to mempool
end
|||

group Bob Submits UserOp
note right of Bob: create UserOp
Bob-&gt;&quot;Bundler RPC&quot;: &quot;&quot;eth_sendUserOperation&quot;&quot;
&quot;Bundler RPC&quot;-&gt;&quot;Ethereum RPC&quot;: First Validation\ntrace view call to\n&quot;&quot;handleOps([userOpB]&quot;&quot;)
&quot;Bundler RPC&quot;-&gt;&quot;UserOp Mempool&quot;: add &quot;&quot;UserOp&quot;&quot; to mempool
end
|||

group Build Bundle
    &quot;Bundler RPC&quot;-&gt;&quot;UserOp Mempool&quot;: fetch pending &quot;&quot;UserOps&quot;&quot;
    return &quot;&quot;[UserOpA, UserOpB]&quot;&quot;
|||
    loop for each UserOp
        &quot;Bundler RPC&quot;-&gt;&quot;Ethereum RPC&quot;: Second Validation\ntrace view call to:\n&quot;&quot;handleOps([userOp])&quot;&quot;
|||
    end

note right of &quot;Bundler RPC&quot;: create bundle &quot;&quot;[UserOpA, UserOpB]&quot;&quot;
&quot;Bundler RPC&quot;-&gt;&quot;Ethereum RPC&quot;: Third Validation\ntrace view call to:\n&quot;&quot;handleOps([UserOpA, UserOpB])&quot;&quot;
|||
&quot;Bundler RPC&quot;-&gt;&quot;Ethereum RPC&quot;: submit transaction\n&quot;&quot;handleOps([UserOpA, UserOpB])&quot;&quot;
|||
end
```

# Bundle Sequence Diagram (Without factory)
```plantuml
@startuml
autonumber
participant &quot;EntryPoint&quot; as ep
participant &quot;Account A&quot; as account
participant &quot;Account B&quot; as account2
[-&gt;ep++ #gold: &quot;&quot;handleOps(userOps[])&quot;&quot;:
group Validations
|||
ep-&gt;account++ #blue: &lt;font color=blue&gt; &quot;&quot;validateUserOp&quot;&quot;
return &quot;&quot;deposit&quot;&quot;
|||
ep-&gt;ep: deduct &quot;&quot;Account_A&quot;&quot; deposit
|||
ep-&gt;account2++ #green: &lt;font color=green&gt; &quot;&quot;validateUserOp&quot;&quot;
return &quot;&quot;deposit&quot;&quot;
|||
ep-&gt;ep: deduct &quot;&quot;Account_B&quot;&quot; deposit
|||
end

group Executions
|||
ep-&gt;account++ #blue: &lt;font color=blue&gt; &quot;&quot;executeUserOp&quot;&quot;
deactivate account
ep-&gt;ep: refund &quot;&quot;Account_A&quot;&quot;
|||
ep-&gt;account2++ #green: &lt;font color=green&gt; &quot;&quot;executeUserOp&quot;&quot;
deactivate account2
ep-&gt;ep: refund &quot;&quot;Account_B&quot;&quot;
|||
end
ep--&gt;[: &quot;&quot;compensate(beneficiary)&quot;&quot;
hide footbox
```

# Bundle Sequence Diagram (with Paymaster)
```plantuml
@startuml
autonumber
participant &quot;EntryPoint&quot; as ep
participant &quot;Account&quot; as account
participant &quot;Paymaster&quot; as pm
[-&gt;ep++ #gold: &quot;&quot;handleOps(userOps[])&quot;&quot;:
group Validation
|||
ep-&gt;account++ #blue: &lt;font color=blue&gt; &quot;&quot;validateUserOp&quot;&quot;
deactivate account
ep-&gt;pm++ #gray: &quot;&quot;validatePaymasterUserOp&quot;&quot;
deactivate pm
ep-&gt;ep: deduct &quot;&quot;Paymaster&quot;&quot; deposit
|||
end
group Execution
|||
ep-&gt;account++ #blue: &lt;font color=blue&gt; &quot;&quot;executeUserOp&quot;&quot;
    deactivate account
ep-&gt;pm++ #gray: &quot;&quot;postOp&quot;&quot;
    deactivate pm
ep-&gt;ep: refund paymaster
|||
end
ep--&gt;[: &quot;&quot;compensate(beneficiary)&quot;&quot;
hide footbox
```

# Bundle Sequence Diagram (with Factory)
```plantuml
@startuml
autonumber
participant &quot;EntryPoint&quot; as ep
participant &quot;Factory&quot; as fact
participant &quot;Account&quot; as account
participant &quot;Account2&quot; as account2
[-&gt;ep++ #gold: handleOps(userOps[]):
group Validations
ep-&gt;fact++ #gray: create (initCode)
fact-&gt;o account: create
return account
ep-&gt;account++ #blue: &lt;font color=blue&gt; validateUserOp
return deposit
ep-&gt;ep: deduct account deposit
ep-&gt;account2++ #green: &lt;font color=green&gt; validateUserOp
return deposit
ep-&gt;ep: deduct account2 deposit
end
group Executions
ep-&gt;account++ #blue: &lt;font color=blue&gt; exec
deactivate account
ep-&gt;ep: refund account1
ep-&gt;account2++ #green: &lt;font color=green&gt; exec
deactivate account2
ep-&gt;ep: refund account2
end
ep--&gt;[: compensate(beneficiary)
hide footbox
```
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-4337/diagrams</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-4337/diagrams</guid>
      </item>
    
      <item>
        <title>SemVer Authors</title>
        <category>/</category>
        
        <description>SemVer Authors
==============

The following people have modified the Semantic Versioning 2.0.0 specification:

 - Tom Preston-Werner
 - Phil Haack
 - Haacked
 - isaacs
 - Thijs Schreijer
 - jeffhandley
 - Alexandr Tovmach
 - Adam Ralph
 - Eddie Garmon
 - Jeff Handley
 - Krzysztof Piasecki
 - Doug Beck
 - Gert de Pagter
 - Guillermo Calvo
 - Iulian Onofrei
 - Ivan Bessarabov
 - Jo Liss
 - Johanan Liebermann
 - Joseph Donahue
 - Konstantin
 - Kristian Glass
 - Mark Amery
 - OGINO Masanori
 - Oguz Bilgic
 - Slipp Douglas
 - Thomas Schraitle
 - Tim Vergenz
 - Todd Reed
 - Tristram Oaten
 - Wincent Colaiuta
 - alexandrtovmach
 - wolf99
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-5139/AUTHORS</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-5139/AUTHORS</guid>
      </item>
    
      <item>
        <title>Semantic Versioning 2.0.0</title>
        <category>/</category>
        
        <description>Semantic Versioning 2.0.0
==============================

Summary
-------

Given a version number MAJOR.MINOR.PATCH, increment the:

1. MAJOR version when you make incompatible API changes,
1. MINOR version when you add functionality in a backwards compatible
   manner, and
1. PATCH version when you make backwards compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions
to the MAJOR.MINOR.PATCH format.

Introduction
------------

In the world of software management there exists a dreaded place called
&quot;dependency hell.&quot; The bigger your system grows and the more packages you
integrate into your software, the more likely you are to find yourself, one
day, in this pit of despair.

In systems with many dependencies, releasing new package versions can quickly
become a nightmare. If the dependency specifications are too tight, you are in
danger of version lock (the inability to upgrade a package without having to
release new versions of every dependent package). If dependencies are
specified too loosely, you will inevitably be bitten by version promiscuity
(assuming compatibility with more future versions than is reasonable).
Dependency hell is where you are when version lock and/or version promiscuity
prevent you from easily and safely moving your project forward.

As a solution to this problem, we propose a simple set of rules and
requirements that dictate how version numbers are assigned and incremented.
These rules are based on but not necessarily limited to pre-existing
widespread common practices in use in both closed and open-source software.
For this system to work, you first need to declare a public API. This may
consist of documentation or be enforced by the code itself. Regardless, it is
important that this API be clear and precise. Once you identify your public
API, you communicate changes to it with specific increments to your version
number. Consider a version format of X.Y.Z (Major.Minor.Patch). Bug fixes not
affecting the API increment the patch version, backwards compatible API
additions/changes increment the minor version, and backwards incompatible API
changes increment the major version.

We call this system &quot;Semantic Versioning.&quot; Under this scheme, version numbers
and the way they change convey meaning about the underlying code and what has
been modified from one version to the next.

Semantic Versioning Specification (SemVer)
------------------------------------------

The key words &quot;MUST&quot;, &quot;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](https://tools.ietf.org/html/rfc2119).

1. Software using Semantic Versioning MUST declare a public API. This API
could be declared in the code itself or exist strictly in documentation.
However it is done, it SHOULD be precise and comprehensive.

1. A normal version number MUST take the form X.Y.Z where X, Y, and Z are
non-negative integers, and MUST NOT contain leading zeroes. X is the
major version, Y is the minor version, and Z is the patch version.
Each element MUST increase numerically. For instance: 1.9.0 -&gt; 1.10.0 -&gt; 1.11.0.

1. Once a versioned package has been released, the contents of that version
MUST NOT be modified. Any modifications MUST be released as a new version.

1. Major version zero (0.y.z) is for initial development. Anything MAY change
at any time. The public API SHOULD NOT be considered stable.

1. Version 1.0.0 defines the public API. The way in which the version number
is incremented after this release is dependent on this public API and how it
changes.

1. Patch version Z (x.y.Z | x &gt; 0) MUST be incremented if only backwards
compatible bug fixes are introduced. A bug fix is defined as an internal
change that fixes incorrect behavior.

1. Minor version Y (x.Y.z | x &gt; 0) MUST be incremented if new, backwards
compatible functionality is introduced to the public API. It MUST be
incremented if any public API functionality is marked as deprecated. It MAY be
incremented if substantial new functionality or improvements are introduced
within the private code. It MAY include patch level changes. Patch version
MUST be reset to 0 when minor version is incremented.

1. Major version X (X.y.z | X &gt; 0) MUST be incremented if any backwards
incompatible changes are introduced to the public API. It MAY also include minor
and patch level changes. Patch and minor versions MUST be reset to 0 when major
version is incremented.

1. A pre-release version MAY be denoted by appending a hyphen and a
series of dot separated identifiers immediately following the patch
version. Identifiers MUST comprise only ASCII alphanumerics and hyphens
[0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers MUST
NOT include leading zeroes. Pre-release versions have a lower
precedence than the associated normal version. A pre-release version
indicates that the version is unstable and might not satisfy the
intended compatibility requirements as denoted by its associated
normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7,
1.0.0-x.7.z.92, 1.0.0-x-y-z.--.

1. Build metadata MAY be denoted by appending a plus sign and a series of dot
separated identifiers immediately following the patch or pre-release version.
Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-].
Identifiers MUST NOT be empty. Build metadata MUST be ignored when determining
version precedence. Thus two versions that differ only in the build metadata,
have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700,
1.0.0-beta+exp.sha.5114f85, 1.0.0+21AF26D3----117B344092BD.

1. Precedence refers to how versions are compared to each other when ordered.

   1. Precedence MUST be calculated by separating the version into major,
      minor, patch and pre-release identifiers in that order (Build metadata
      does not figure into precedence).

   1. Precedence is determined by the first difference when comparing each of
      these identifiers from left to right as follows: Major, minor, and patch
      versions are always compared numerically.

      Example: 1.0.0 &lt; 2.0.0 &lt; 2.1.0 &lt; 2.1.1.

   1. When major, minor, and patch are equal, a pre-release version has lower
      precedence than a normal version:

      Example: 1.0.0-alpha &lt; 1.0.0.

   1. Precedence for two pre-release versions with the same major, minor, and
      patch version MUST be determined by comparing each dot separated identifier
      from left to right until a difference is found as follows:

      1. Identifiers consisting of only digits are compared numerically.

      1. Identifiers with letters or hyphens are compared lexically in ASCII
         sort order.

      1. Numeric identifiers always have lower precedence than non-numeric
         identifiers.

      1. A larger set of pre-release fields has a higher precedence than a
         smaller set, if all of the preceding identifiers are equal.

      Example: 1.0.0-alpha &lt; 1.0.0-alpha.1 &lt; 1.0.0-alpha.beta &lt; 1.0.0-beta &lt; 
      1.0.0-beta.2 &lt; 1.0.0-beta.11 &lt; 1.0.0-rc.1 &lt; 1.0.0.

Backus–Naur Form Grammar for Valid SemVer Versions
--------------------------------------------------
```
&lt;valid semver&gt; ::= &lt;version core&gt;
                 | &lt;version core&gt; &quot;-&quot; &lt;pre-release&gt;
                 | &lt;version core&gt; &quot;+&quot; &lt;build&gt;
                 | &lt;version core&gt; &quot;-&quot; &lt;pre-release&gt; &quot;+&quot; &lt;build&gt;

&lt;version core&gt; ::= &lt;major&gt; &quot;.&quot; &lt;minor&gt; &quot;.&quot; &lt;patch&gt;

&lt;major&gt; ::= &lt;numeric identifier&gt;

&lt;minor&gt; ::= &lt;numeric identifier&gt;

&lt;patch&gt; ::= &lt;numeric identifier&gt;

&lt;pre-release&gt; ::= &lt;dot-separated pre-release identifiers&gt;

&lt;dot-separated pre-release identifiers&gt; ::= &lt;pre-release identifier&gt;
                                          | &lt;pre-release identifier&gt; &quot;.&quot; &lt;dot-separated pre-release identifiers&gt;

&lt;build&gt; ::= &lt;dot-separated build identifiers&gt;

&lt;dot-separated build identifiers&gt; ::= &lt;build identifier&gt;
                                    | &lt;build identifier&gt; &quot;.&quot; &lt;dot-separated build identifiers&gt;

&lt;pre-release identifier&gt; ::= &lt;alphanumeric identifier&gt;
                           | &lt;numeric identifier&gt;

&lt;build identifier&gt; ::= &lt;alphanumeric identifier&gt;
                     | &lt;digits&gt;

&lt;alphanumeric identifier&gt; ::= &lt;non-digit&gt;
                            | &lt;non-digit&gt; &lt;identifier characters&gt;
                            | &lt;identifier characters&gt; &lt;non-digit&gt;
                            | &lt;identifier characters&gt; &lt;non-digit&gt; &lt;identifier characters&gt;

&lt;numeric identifier&gt; ::= &quot;0&quot;
                       | &lt;positive digit&gt;
                       | &lt;positive digit&gt; &lt;digits&gt;

&lt;identifier characters&gt; ::= &lt;identifier character&gt;
                          | &lt;identifier character&gt; &lt;identifier characters&gt;

&lt;identifier character&gt; ::= &lt;digit&gt;
                         | &lt;non-digit&gt;

&lt;non-digit&gt; ::= &lt;letter&gt;
              | &quot;-&quot;

&lt;digits&gt; ::= &lt;digit&gt;
           | &lt;digit&gt; &lt;digits&gt;

&lt;digit&gt; ::= &quot;0&quot;
          | &lt;positive digit&gt;

&lt;positive digit&gt; ::= &quot;1&quot; | &quot;2&quot; | &quot;3&quot; | &quot;4&quot; | &quot;5&quot; | &quot;6&quot; | &quot;7&quot; | &quot;8&quot; | &quot;9&quot;

&lt;letter&gt; ::= &quot;A&quot; | &quot;B&quot; | &quot;C&quot; | &quot;D&quot; | &quot;E&quot; | &quot;F&quot; | &quot;G&quot; | &quot;H&quot; | &quot;I&quot; | &quot;J&quot;
           | &quot;K&quot; | &quot;L&quot; | &quot;M&quot; | &quot;N&quot; | &quot;O&quot; | &quot;P&quot; | &quot;Q&quot; | &quot;R&quot; | &quot;S&quot; | &quot;T&quot;
           | &quot;U&quot; | &quot;V&quot; | &quot;W&quot; | &quot;X&quot; | &quot;Y&quot; | &quot;Z&quot; | &quot;a&quot; | &quot;b&quot; | &quot;c&quot; | &quot;d&quot;
           | &quot;e&quot; | &quot;f&quot; | &quot;g&quot; | &quot;h&quot; | &quot;i&quot; | &quot;j&quot; | &quot;k&quot; | &quot;l&quot; | &quot;m&quot; | &quot;n&quot;
           | &quot;o&quot; | &quot;p&quot; | &quot;q&quot; | &quot;r&quot; | &quot;s&quot; | &quot;t&quot; | &quot;u&quot; | &quot;v&quot; | &quot;w&quot; | &quot;x&quot;
           | &quot;y&quot; | &quot;z&quot;
```

Why Use Semantic Versioning?
----------------------------

This is not a new or revolutionary idea. In fact, you probably do something
close to this already. The problem is that &quot;close&quot; isn&apos;t good enough. Without
compliance to some sort of formal specification, version numbers are
essentially useless for dependency management. By giving a name and clear
definition to the above ideas, it becomes easy to communicate your intentions
to the users of your software. Once these intentions are clear, flexible (but
not too flexible) dependency specifications can finally be made.

A simple example will demonstrate how Semantic Versioning can make dependency
hell a thing of the past. Consider a library called &quot;Firetruck.&quot; It requires a
Semantically Versioned package named &quot;Ladder.&quot; At the time that Firetruck is
created, Ladder is at version 3.1.0. Since Firetruck uses some functionality
that was first introduced in 3.1.0, you can safely specify the Ladder
dependency as greater than or equal to 3.1.0 but less than 4.0.0. Now, when
Ladder version 3.1.1 and 3.2.0 become available, you can release them to your
package management system and know that they will be compatible with existing
dependent software.

As a responsible developer you will, of course, want to verify that any
package upgrades function as advertised. The real world is a messy place;
there&apos;s nothing we can do about that but be vigilant. What you can do is let
Semantic Versioning provide you with a sane way to release and upgrade
packages without having to roll new versions of dependent packages, saving you
time and hassle.

If all of this sounds desirable, all you need to do to start using Semantic
Versioning is to declare that you are doing so and then follow the rules. Link
to this website from your README so others know the rules and can benefit from
them.

FAQ
---

### How should I deal with revisions in the 0.y.z initial development phase?

The simplest thing to do is start your initial development release at 0.1.0
and then increment the minor version for each subsequent release.

### How do I know when to release 1.0.0?

If your software is being used in production, it should probably already be
1.0.0. If you have a stable API on which users have come to depend, you should
be 1.0.0. If you&apos;re worrying a lot about backwards compatibility, you should
probably already be 1.0.0.

### Doesn&apos;t this discourage rapid development and fast iteration?

Major version zero is all about rapid development. If you&apos;re changing the API
every day you should either still be in version 0.y.z or on a separate
development branch working on the next major version.

### If even the tiniest backwards incompatible changes to the public API require a major version bump, won&apos;t I end up at version 42.0.0 very rapidly?

This is a question of responsible development and foresight. Incompatible
changes should not be introduced lightly to software that has a lot of
dependent code. The cost that must be incurred to upgrade can be significant.
Having to bump major versions to release incompatible changes means you&apos;ll
think through the impact of your changes, and evaluate the cost/benefit ratio
involved.

### Documenting the entire public API is too much work!

It is your responsibility as a professional developer to properly document
software that is intended for use by others. Managing software complexity is a
hugely important part of keeping a project efficient, and that&apos;s hard to do if
nobody knows how to use your software, or what methods are safe to call. In
the long run, Semantic Versioning, and the insistence on a well defined public
API can keep everyone and everything running smoothly.

### What do I do if I accidentally release a backwards incompatible change as a minor version?

As soon as you realize that you&apos;ve broken the Semantic Versioning spec, fix
the problem and release a new minor version that corrects the problem and
restores backwards compatibility. Even under this circumstance, it is
unacceptable to modify versioned releases. If it&apos;s appropriate,
document the offending version and inform your users of the problem so that
they are aware of the offending version.

### What should I do if I update my own dependencies without changing the public API?

That would be considered compatible since it does not affect the public API.
Software that explicitly depends on the same dependencies as your package
should have their own dependency specifications and the author will notice any
conflicts. Determining whether the change is a patch level or minor level
modification depends on whether you updated your dependencies in order to fix
a bug or introduce new functionality. We would usually expect additional code
for the latter instance, in which case it&apos;s obviously a minor level increment.

### What if I inadvertently alter the public API in a way that is not compliant with the version number change (i.e. the code incorrectly introduces a major breaking change in a patch release)?

Use your best judgment. If you have a huge audience that will be drastically
impacted by changing the behavior back to what the public API intended, then
it may be best to perform a major version release, even though the fix could
strictly be considered a patch release. Remember, Semantic Versioning is all
about conveying meaning by how the version number changes. If these changes
are important to your users, use the version number to inform them.

### How should I handle deprecating functionality?

Deprecating existing functionality is a normal part of software development and
is often required to make forward progress. When you deprecate part of your
public API, you should do two things: (1) update your documentation to let
users know about the change, (2) issue a new minor release with the deprecation
in place. Before you completely remove the functionality in a new major release
there should be at least one minor release that contains the deprecation so
that users can smoothly transition to the new API.

### Does SemVer have a size limit on the version string?

No, but use good judgment. A 255 character version string is probably overkill,
for example. Also, specific systems may impose their own limits on the size of
the string.

### Is &quot;v1.2.3&quot; a semantic version?

No, &quot;v1.2.3&quot; is not a semantic version. However, prefixing a semantic version
with a &quot;v&quot; is a common way (in English) to indicate it is a version number.
Abbreviating &quot;version&quot; as &quot;v&quot; is often seen with version control. Example:
`git tag v1.2.3 -m &quot;Release version 1.2.3&quot;`, in which case &quot;v1.2.3&quot; is a tag
name and the semantic version is &quot;1.2.3&quot;.

### Is there a suggested regular expression (RegEx) to check a SemVer string?

There are two. One with named groups for those systems that support them
(PCRE [Perl Compatible Regular Expressions, i.e. Perl, PHP and R], Python
and Go).

See: &lt;https://regex101.com/r/Ly7O1x/3/&gt;

```
^(?P&lt;major&gt;0|[1-9]\d*)\.(?P&lt;minor&gt;0|[1-9]\d*)\.(?P&lt;patch&gt;0|[1-9]\d*)(?:-(?P&lt;prerelease&gt;(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P&lt;buildmetadata&gt;[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
```

And one with numbered capture groups instead (so cg1 = major, cg2 = minor,
cg3 = patch, cg4 = prerelease and cg5 = buildmetadata) that is compatible
with ECMA Script (JavaScript), PCRE (Perl Compatible Regular Expressions,
i.e. Perl, PHP and R), Python and Go.

See: &lt;https://regex101.com/r/vkijKf/1/&gt;

```
^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
```

About
-----

The Semantic Versioning specification was originally authored by [Tom
Preston-Werner](https://tom.preston-werner.com), inventor of Gravatar and
cofounder of GitHub.

If you&apos;d like to leave feedback, please [open an issue on
GitHub](https://github.com/semver/semver/issues).

License
-------

[Creative Commons ― CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-5139/semver</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-5139/semver</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>MIT License

Copyright (c) 2023 Authentic Vision GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the &quot;Software&quot;), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-6956/LICENSE</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-6956/LICENSE</guid>
      </item>
    
      <item>
        <title>Appendix: Interoperability Analysis</title>
        <category>/</category>
        
        <description>
## Appendix: Interoperability Analysis

We provide a cherrypicked list of possible points of contact between ERC-7208 and other tokenization standards and proposals.

**ERC-1400 (Security Token Standard)**: This ERC provides a suite of standard interfaces for issuing/redeeming security tokens, managing their ownership and transfer restrictions, and providing transparency to token holders on how different subsets of their token balance behave with respect to transfer restrictions, rights and obligations. ERC-7208 can enhance ERC-1400 by offering a dynamic and flexible data management architecture. **Data Objects** enable the storage and modification of on-chain data for security tokens, such as compliance information or ownership details. Assets already issued under ERC-1400 can be wrapped into a **Vault Data Object** and exposed through any **Data Manager** interface (including **ERC-3643**). Additionally, ERC-7208 enablesthe fractionalization of ERC-1400 assets. If the asset is issued through an ERC-1400 **Data Manager** with native **Data Object** storage, the integration could lead to more versatile and transparent security token offerings, as a custom Identity Management logic can be embedded within the assets.

**EIP-2981 (Royalties)**: ERC-7208 can complement EIP-2981 as a **Data Manager** by providing a flexible way to handle royalties. **Data Objects** can store and manage the low-level storage of royalty information dynamically, independently from the interface used by the end user. This enables a complex royalty structure that can change over time or respond to predefined conditions, like embedding compliance checks and simultaneously exposing multiple interfaces for fractional ownership of the underlying asset. For instance, by leveraging ERC-7208, an individual royalty-based NFT can be traded in a compliant manner, concurrently under both an ERC-721 interface as well as an ERC-20 through the use of **Data Managers** that delegate their internal storage onto the **Data Object**.

**ERC-3643 (Security Tokens)**: ERC-3643 defines a *Security Token interface for Regulated Exchanges* based on ERC-20 token standard. The ERC-7208 can be used for wrapping many tokens (irrespective of their ERC) and adapting their logic to the ERC-3643. Additionally, a **Data Object** storing native ERC-3643 asset data can be used for improving the compliance logic and enabling the trading of underlying securities simultaneously through multiple interfaces that respond to different regulatory frameworks. Moreover, the separation of the storage enables the logic to implement functionalities that were not initially a part of the original ERC-3643, such as identity-based recovery of assets, role-based access control, the introduction of cross-chain support, etc.

**ERC-4337 (Account Abstraction)**: ERC-7208 can provide a standardized method to store and manage the complex data structures required by abstracted accounts. This can include user preferences, access control lists, recovery options, and other customizable account features. The mutable states of abstracted accounts can be efficiently handled using **Data Objects**. This, in turn, improves the adaptability and security of abstracted accounts. Additionally, an ERC-7208 implementation supporting meta-transactions and **Data Points** separated by chain-id can be developed to fully abstract account management across blockchains.

**EIP-4626 (Tokenized Vaults)**: Tokenized Vaults inherit from a single ERC-20 and ERC-2612 for approvals via EIP-712 secp256k1 signatures. ERC-7208 can enhance EIP-4626 by providing a more dynamic data layer for tokenized vaults. **Data Objects** store information about the assets in the vault, conditions for access, or other relevant data, enabling more nuanced interactions with tokenized vaults. Additionally, the **Data Point** can store more than a single ERC-20, greatly increasing the capabilities of Tokenized Vaults.

**ERC-4907 (Shared Ownership)**: The integration of ERC-4907 as a **Data Manager** with ERC-7208 **Data Point** storage can enhance the rental experience by allowing for additional rental-related data directly on-chain, such as rental terms, user permissions, and other customizable settings which would be self-contained within **Data Points** and therefore automatically updated as metadata. ERC-4907&apos;s rental mechanism complements ERC-7208&apos;s ability to manage mutable on-chain data. By combining these two, NFTs can not only be rented out for specific periods but also have their traits or states dynamically managed and updated during the rental period. This combination enhances security and compliance in NFT transactions, particularly for *Real World Asset Tokenization*. Rental agreements, regulatory compliance, intellectual property, and user rights can be embedded within Data Objects to ensure that the NFT usage adheres to predefined rules.

**ERC-7540 (Asynchronous ERC-4626 Tokenized Vaults)**: ERC-7540 vaults&apos;s are focused on asynchronous deposit and redemption. Integrating ERC-7540, either by Wrapping into a **Data Object** or by exposing an ERC-7208 **Data Manager**, will facilitate more complex financial products. DeFi products like undercollateralized loans, insurance products, or tokenized stocks often require operations to be handled in a non-instantaneous manner. However, the nature of these products requires adhering to regulatory compliance and identity management solutions. This can easily be achieved by implementing the use of on-chain adapters that enhance the logic while keeping the data secure.
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7208/erc-7208-compat</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7208/erc-7208-compat</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>```mermaid
flowchart LR
    redeemer([&quot;redeemer&quot;]) --&quot;redeemDelegations&quot;--&gt; Delegation_Manager([&quot;Delegation Manager&quot;])
    Delegation_Manager -.-&gt;|validate delegation w/ Action| Delegation_Manager
    Delegation_Manager --&quot;execute delegated action&quot;--&gt; Delegator([&quot;Delegator&quot;])
    Delegator --&quot;executes CALL using Action&quot;--&gt; Target([&quot;Target&quot;])
    classDef action stroke:#333,stroke-width:2px,stroke-dasharray: 5, 5;
    classDef entity fill:#af,stroke:#333,stroke-width:2px;
    class redeemer,Delegator,Delegation_Manager,Target entity;
```
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7710/mermaid</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7710/mermaid</guid>
      </item>
    
      <item>
        <title>ERC-7738 Script Registry Contracts, deployment and test harness scripts</title>
        <category>/</category>
        
        <description># ERC-7738 Script Registry Contracts, deployment and test harness scripts

This folder contains sample (and actual deployed) ERC-7738 registry contracts and tapp scripts

## Test suite

- Init hardhat in this directory
```bash
npm install --save-dev hardhat
```

- Run the test harness
```bash
npx hardhat test
```

# Test a script on the registry

## Deploy Example Token

Deploy a test token, let&apos;s use a simple ERC-721 with a custom mint function:

```Solidity
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;

import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;@openzeppelin/contracts/access/Ownable.sol&quot;;

contract MyToken is ERC721, Ownable {
    uint256 private _tokenId;
    constructor()
        ERC721(&quot;MyToken&quot;, &quot;MTK&quot;)
        Ownable(msg.sender)
    {
        _tokenId = 1;
    }

    function mint() public {
        _safeMint(msg.sender, _tokenId);
        _tokenId++;
    }
}
```
Deploy this NFT using eg Remix and make a note of the contract address.

## Create Simple TokenScript, emulate and Deploy

First install the TokenScript CLI tool

1. Install the TokenScript build tool (see [TokenScript Quickstart](https://launchpad-doc.vercel.app/quick-start/tokenscript-cli/quick-start-tokenscript-cli))
```bash
npm install -g @tokenscript/cli
```

Here is a minimal example minting tokenscript object file: [Basic NFT TokenScript](/assets/erc-7738/tokenscript/examples/tokenscript.xml). 

2. Copy or clone this code to a directory, ensure it is called tokenscript.xml.
3. Locate the following line in the TokenScript:
```xml
&lt;ts:address network=&quot;ChainId&quot;&gt;CONTRACT_ADDRESS&lt;/ts:address&gt;
```
Replace the ChainId and CONTRACT_ADDRESS with the contract you deployed in the previous step.
4. Use Emulation to test (in the same directory as you put the examples/tokenscript.xml file):
```bash
tokenscript emulate
```
This will let you test the TokenScript functionality before deploying on the registry. The generated page will allow you to mint new tokens.

5. Upload the TokenScript to an FTP or IPFS and make a note of the URL or IPFS hash.

## Add script to the registry

1. Open the registry page:
[Holesky Registry Page](https://viewer-staging.tokenscript.org/?chain=17000&amp;contract=0x0077380bCDb2717C9640e892B9d5Ee02Bb5e0682&amp;scriptId=7738_2)
[Sepolia Registry Page](https://viewer-staging.tokenscript.org/?chain=11155111&amp;contract=0x0077380bCDb2717C9640e892B9d5Ee02Bb5e0682&amp;scriptId=7738_1)
[Base Sepolia Registry Page](https://viewer-staging.tokenscript.org/?chain=84532&amp;contract=0x0077380bCDb2717C9640e892B9d5Ee02Bb5e0682&amp;scriptId=7738_2)

Click on the onboarding button &quot;Set ScriptURI&quot;. Set the contract address and scriptURI in the card.

2. Test onboarding. Switch wallets, go to the token page of your token (eg for Holesky):

`https://viewer-staging.tokenscript.org/?chain=17000&amp;contract=&lt;YOUR CONTRACT ADDRESS&gt;`

This will open the TokenScript for your deployed contract. Click on the Mint onboarding button to generate new Tokens.


## Deploy your own registry on a testnet
For this test we will use Holesky, but you can also use Sepolia, or any testnet on which the ENS contracts has been deployed.

Add some test eth on 2 wallets (0.1 -&gt; 0.5 depending on gas price on the testnet)
Create a .env file which contains the following three keys:
```
PRIVATE_KEY_DEPLOY = &quot;0x&lt;PRIVATE KEY 1&gt;&quot;
PRIVATE_KEY_2DEPLOY = &quot;0x&lt;PRIVATE KEY 2&gt;&quot;
PRIVATE_KEY_ENS = &quot;0x&lt;PRIVATE KEY ENS&gt;&quot;
```

Create an ENS domain on Holesky using the PRIVATE_KEY_ENS wallet. Obtain a `.eth` domain, not `.box` or any other. Go to the ENS app https://app.ens.domains/ and obtain a new ENS using your Holesky.
Using the app, unwrap the domain. Click on &quot;More&quot; then &quot;Unwrap&quot;.

Now, use the script to transfer ownership of the ENS to where the ENSAssigner contract will be written:

1. Add the ENS name to your .env file (don&apos;t add the .eth suffix).
```
ENS_NAME=&quot;&lt;YOUR ENS&gt;&quot;
```

eg, if the domain you picked was &quot;kilkennycat.eth&quot;:
```
ENS_NAME=&quot;kilkennycat&quot;
```

2. Run the script (note this script changes ownership of the domain to the ENSAssigner contract that will soon be deployed)

```bash
npx hardhat run ./scripts/changeENSOwner.ts --network holesky
```

Now, ensure the change ownership transaction is written (check the console log of first deployment), and run the deploy script:

```bash
npx hardhat run ./scripts/deploy.ts --network holesky
```

Congrats your registry is deployed. Now to issue a bootstrap script for the registry.

## Generate TokenScript and upload to IPFS

1. Open the `./tokenscript` folder in your favourite editor, and find the `tokenscript.xml` file.
2. Locate the Origin contract definition line: 
```xml
&lt;ts:contract interface=&quot;erc721&quot; name=&quot;RegistryContract&quot;&gt;
```
3. Edit the contract network and address on the line below this.
4. Build the TokenScript object file (use commandline from the ./)
```bash
tokenscript build
```
5. Upload the `tokenscript.tsml` file in the `./tokenscript/out` directory to IPFS, or your publicly accessible FTP.

## Set the TokenScript entry on the Script Registry

Set the tokenscript for your registry via a script entry on the registry contract itself, using the script itself. This is akin to &apos;bootstrapping&apos; your registry. You could just as easily accomplish this by using an `ethers.js` script or verifying the contract on `https://etherscan.io` and then using etherscan&apos;s write menu.

use the tokenscript CLI `emulate` feature:
```bash
tokenscript emulate
```
This will automatically open an emulator browser page. Connect your Ethereum wallet which is holding the key you used to deploy the registry contract.
Now use the &apos;Onboarding card&apos; which is defined in the TokenScript xml - click the `Set ScriptURI` button.

This will open the card defined in `./onboard.html`. This card invites you to set the contract address - which in this case is your registry contract - and the URI of the Tokenscript TSML you uploaded in step 5. (eg `ipfs://QmRaVBN4NBevk1j4HHfCLrMjjLrYNnsnJS2caJs9smYAtq`).

Once you click on the `Set Script URI` button your wallet will ask permission to call the `setScriptURI(address contractAddress, string[] uri)` function.

## Test your registry

1. switch to a new directory and clone the tokenscript viewer repo:
```bash
git clone https://github.com/SmartTokenLabs/tokenscript-engine.git
```
```bash
cd ./tokenscript-engine/javascript/tokenscript-viewer
```
2. update the registry contract address: open `javascript/engine-js/src/repo/sources/RegistryScriptURI.ts` and change `const REGISTRY_7738` to your deployed registry address.
3. Add your Infura API key to the .env (you will have to create the .env file):
```
INFURA_API_KEY=1234567890ABCDEF1234567890ABCDEF
```
4. Install dependencies and run
```bash
npm i
```
```bash
npm run start
```
4. On the opened webpage, open your deployed registry script:
`http://localhost:3333/?chain=17000&amp;contract=&lt;YOUR DEPLOYED REGISTRY CONTRACT ADDRESS&gt;`
5. Set the ScriptURI for the NFT contract you deployed in the first step, by clicking the &quot;Set ScriptURI&quot; button from your deployed tokenscript. Set the NFT contract address and URI path you uploaded to.
6. (Optional) Set a name and icon for the registry script, by clicking on the &apos;Set Name&apos; and &apos;Set Icon&apos; buttons on the token that is now displayed.
7. Use the script served from your new registry:
`http://localhost:3333/?chain=17000&amp;contract=&lt;YOUR NFT Contract address&gt;`</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7738/tests</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7738/tests</guid>
      </item>
    
      <item>
        <title>EIP-3525</title>
        <category>/</category>
        
        <description># EIP-3525

## Demonstration only

The code included in this directory is ONLY for the purpose of demonstrating how to implement this proposal, it is not a full-featured implementation ready for production.

So please DO NOT use the code here for purposes other than study.
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-3525/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-3525/</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;div align=&quot;center&quot;&gt;

# ERC721 Consumable Extension

[![License: CC0-1.0](https://img.shields.io/badge/License-CC0-yellow.svg)](https://creativecommons.org/publicdomain/zero/1.0/)

&lt;/div&gt;

This project provides a reference implementation of the proposed `ERC721Consumer` OPTIONAL extension.

## Install

In order to install the required dependencies you need to execute:
```shell
npm install
```

## Compile

In order to compile the solidity contracts you need to execute:
```shell
npx hardhat compile
```

## Tests

```shell
npx hardhat test
```</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-4400/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-4400/</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>#EIP4519 Proof of Concept - Firmware
This firmware is designed for a device using an ESP32 as a smart asset associated with an EIP4519 SmartNFT. The device has two operation modes: registration mode and application mode.
##Registration mode 
In this mode, the device generates 51 bytes  with the TRNG of the ESP32 core. Those bytes are used for the initial values of a CTR-DRBG PRNG to generate the private key of the Ethereum account. Only the address of this account is shared. The UART port is needed for communications with this device.
The commands in this mode are:
&gt;‘0’ – Check if the device is ready.
&gt;‘1’ – Share the address of the account.
&gt;‘2’ – Save the initial values of CTR-DRBG PRNG in an EEPROM and changes the operation mode.
##Application Mode
The device reads the EEPROM to obtain the initial values of the CTR-DRBG PRNG and recover the Ethereum account. The device connects to a WiFi station. With Infura, the device checks the state of its associated SmartNFT registered on an EIP4519 Smart Contract and also checks if the device must be engaged with the owner or the user. The UART port is needed for communications with this device.
The commands in this mode are:
&gt;&apos;Z&apos;+OWNER/USER_ADDRESS – The device checks if the address must be authenticated and generates a nonce.
&gt;&apos;Y&apos;+SIGN_D+&apos;#&apos;+NONCE_D – The device checks the signature, signs NONCE_D, and sends the signature.
&gt;&apos;Y&apos;+SIGNED_PK+&apos;#&apos;+PK – The device checks the signature, generates the shared key, and sends the transaction to the EIP4519 Smart Contract.
&gt;&apos;C&apos; – The EEPROM is cleared, only for debug process.
&gt;&apos;R&apos; – The device is restarted to refresh the SmartNFT state, only for debug process.
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-4519/ESP32_Firmware/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-4519/ESP32_Firmware/</guid>
      </item>
    
      <item>
        <title>Proof of concept of an implementation of an Smart Non Fungible Token</title>
        <category>/</category>
        
        <description># Proof of concept of an implementation of an Smart Non Fungible Token
This proof of concept is launch in the Ethereum Kovan Testnet with the address 0x7eB5A03E7ED70ABf70fee48965D0411d37F335aC.
Use the proposal Non Fungible Token binding assets with SmartNFT and define the user management of the assets.
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-4519/PoC_SmartNFT/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-4519/PoC_SmartNFT/</guid>
      </item>
    
      <item>
        <title>Multi-Fractional Non-Fungible Token</title>
        <category>/</category>
        
        <description># Multi-Fractional Non-Fungible Token
Solidity Implementation of Multi-Fractional Non-Fungible Token.

## Problem Trying to solve
Before, ERC20 Token contract should be deployed every time when fractionalizing a specific NFT.

To solve this problem, this standard proposes a token standard to cover multiple fractionalized nft in a contract without having to deploy each time.

Issue : https://github.com/ethereum/EIPs/issues/4674

PR : https://github.com/ethereum/EIPs/pull/4675

## How to use
```
contracts/
        helper/
        interface/
        math/
        MFNFT.sol
        NFT.sol
        ERC20Token.sol
```

### Contracts
``MFNFT.sol`` : Multi-Fractional Non-Fungible Token Contract

``NFT.sol`` : Non-Fungible Token Contract

``ERC20Token.sol`` : Sample ERC-20 Token Contract

``helper/Verifier.sol`` : Contract that verifies the ownership of NFT before fractionalization

``math/SafeMath.sol`` : Openzeppelin SafeMath Library

``interface/IERC20.sol`` : ERC-20 Token Interface

``interface/IERC721.sol`` : ERC-721 Token Interface

``interface/IMFNFT`` : MFNFT Token Interface

### Install &amp; Test

Installation
```
npm install
```

Test
```
npx hardhat test
```

Coverage
```
npx hardhat coverage
```
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-4675/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-4675/</guid>
      </item>
    
      <item>
        <title>EIP-4907</title>
        <category>/</category>
        
        <description># EIP-4907
EIP-4907 is an extension of ERC-721. It proposes an additional role **user** and a valid duration indicator **expires**. It allows users and developers manage the use right more simple and efficient.

### Tools
* [Visual Studio Code](https://code.visualstudio.com/)
* [Solidity](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity) - Solidity support for Visual Studio code
* [Truffle](https://truffleframework.com/) - the most popular development framework for Ethereum

### Install
```
npm install
```

### Test
```
truffle test
```

### Additional Resources
* [Official Truffle Documentation](http://truffleframework.com/docs/) for complete and detailed guides, tips, and sample code.</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-4907/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-4907/</guid>
      </item>
    
      <item>
        <title>EIP-5007</title>
        <category>/</category>
        
        <description># EIP-5007
This standard is an extension of [ERC-721](../../EIPS/eip-721.md). It proposes some additional functions (`startTime`, `endTime`) to help with on-chain time management.

## Tools
* [Truffle](https://truffleframework.com/) - a development framework for Ethereum

## Install
```
npm install truffle -g
npm install
```

## Test
```
truffle test
```
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-5007/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-5007/</guid>
      </item>
    
      <item>
        <title>EIP-5218 Reference Implementations</title>
        <category>/</category>
        
        <description># EIP-5218 Reference Implementations

This is the source code for a reference implementation of EIP-5218.

## Build and Test

The repo expects a Foundry build system, optionally using visual studio code for editing. You can run the test suite with:

```bash
forge test -vvvvv
```

</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-5218/contracts/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-5218/contracts/</guid>
      </item>
    
      <item>
        <title>EIP 5252 implementation</title>
        <category>/</category>
        
        <description># EIP 5252 implementation

This project is a reference implementation of EIP-5252.

Try running some of the following tasks:

```shell
npx hardhat help
npx hardhat test
GAS_REPORT=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts
```
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-5252/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-5252/</guid>
      </item>
    
      <item>
        <title>EIP-5725: Transferrable Vesting NFT - Reference Implementation</title>
        <category>/</category>
        
        <description># EIP-5725: Transferrable Vesting NFT - Reference Implementation

This repository serves as a reference implementation for **EIP-5725 Transferrable Vesting NFT Standard**. A Non-Fungible Token (NFT) standard used to vest ERC-20 tokens over a vesting release curve.

## Contents

- [EIP-5725 Specification](/assets/erc-5725/contracts/IERC5725.sol): Interface and definitions for the EIP-5725 specification.
- [ERC-5725 Implementation (abstract)](/assets/erc-5725/contracts/ERC5725.sol): ERC-5725 contract which can be extended to implement the specification.
- [VestingNFT Implementation](/assets/erc-5725/contracts/reference/LinearVestingNFT.sol): Full ERC-5725 implementation using cliff vesting curve.
- [LinearVestingNFT Implementation](/assets/erc-5725/contracts/reference/VestingNFT.sol): Full ERC-5725 implementation using linear vesting curve.
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-5725/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-5725/</guid>
      </item>
    
      <item>
        <title>SDC Solidity implementation</title>
        <category>/</category>
        
        <description># SDC Solidity implementation

## Description

The reference SDC implementation can be unit tested with Hardhat to understand the trade process logic.

### Compile and run tests with Hardhat

We provide the essential steps to compile the contracts and run the provided unit tests.

### Provided Contracts and Tests

#### Interfaces

- `contracts/ISDC.sol` - Interface contract (aggregation of `ISDCTrade`, `ISDCSettlement`, `IAsyncTransferCallback`)
- `contracts/ISDCTrade.sol` - Interface related to trade incept/confirm/terminate
- `contracts/ISDCSettlement.sol` - Interface related to settlement initiate/perform/after
- `contracts/IAsyncTransferCallback.sol` - Interface related to transfer.

- `contracts/IAsyncTransfer.sol` - Interface (extending the ERC-20) for settlement tokens used in `SDCPledgedBalance`.

#### Implementations

- `contracts/SDCSingleTrade.sol` - SDC abstract contract for an OTC Derivative (single trade case only)
- `contracts/SDCSingleTradePledgedBalance.sol` - SDC full implementation for an OTC Derivative (single trade case only)
- `contracts/ERC20Settlement.sol` - Mintable settlement token contract implementing `IERC20Settlement` for unit tests

#### Tests

- `test/SDCTests.js` - Unit tests for the life-cycle of the sdc implementation

### Compile and run tests with Hardhat

Install dependencies:
```shell
npm i
```

Compile:
```shell
npx hardhat compile
```

Run all tests:
```shell
npx hardhat test
```

### Configuration files

- `package.js` - Javascript package definition.
- `hardhat.config.js` - Hardhat config.

### Used javascript-based testing libraries for solidity

- `ethereum-waffle`: Waffle is a Solidity testing library. It allows you to write tests for your contracts with JavaScript.
- `chai`: Chai is an assertion library and provides functions like expect.
- `ethers`: This is a popular Ethereum client library. It allows you to interface with blockchains that implement the Ethereum API.
- `solidity-coverage`: This library gives you coverage reports on unit tests with the help of Istanbul.

## Version history / release notes

### 0.8.0

- Re-introduced the method `afterSettlement` that can be used to check pre-conditions of the next settlement cycle, e.g., triggered by a time-oracle.
- Added the event `SettlementAwaitingInitiation` which should be issued when the trade goes active and when `afterSettlement` veryfied that the trade is ready for the next settlement.
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-6123/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-6123/</guid>
      </item>
    
      <item>
        <title>Example implementation of EIP-6358</title>
        <category>/</category>
        
        <description># Example implementation of EIP-6358

## Prerequisites
- truffle &gt;= v5.7.9
- node &gt;= v18.12.1
- npm &gt;= 8.19.2
- npx &gt;= 8.19.2

## Installation
```
npm install
```

Add the configuration file `truffle-config.js` into the directory `./`. The file `truffle-config.js` can be generated by executing the command in an $empty directory$:
```
npx truffle init
```

**Note that:**  

- type `N` when asked `Overwrite contracts?`
- type `N` when asked `Overwrite migrations?`
- type `N` when asked `Overwrite test?`

After `truffle-config.js` is generated, then:  

- Uncommnet the content of `development`, like this:

```
development: {
     host: &quot;127.0.0.1&quot;,     // Localhost (default: none)
     port: 8545,            // Standard Ethereum port (default: none)
     network_id: &quot;*&quot;,       // Any network (default: none)
    },
```

## Compilation
```
touch .secret
npx truffle compile
```

## Unit test
### Launch local testnet
```
npx ganache -s 0
```

### Test
Open another terminate

```
npx truffle test
```</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-6358/src/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-6358/src/</guid>
      </item>
    
      <item>
        <title>ERC-6604</title>
        <category>/</category>
        
        <description>ERC-6604
========

 * [`AbstractERC20.sol`](/assets/erc-6604/contracts/AbstractERC20.sol)
 * [`AbstractToken.sol`](/assets/erc-6604/contracts/AbstractToken.sol)
 * [`GenericEIP712.sol`](/assets/erc-6604/contracts/GenericEIP712.sol)
 * [`IAbstractToken.sol`](/assets/erc-6604/contracts/IAbstractToken.sol)
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-6604/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-6604/</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;div align=&quot;center&quot;&gt;

# ERC6786 Royalty Debt Registry

&lt;/div&gt;

This project provides a reference implementation of the proposed `ERC-6786 Royalty Debt Registry`.

## Install

In order to install the required dependencies you need to execute:
```shell
npm install
```

## Compile

In order to compile the solidity contracts you need to execute:
```shell
npx hardhat compile
```

## Tests

```shell
npx hardhat test
```</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-6786/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-6786/</guid>
      </item>
    
      <item>
        <title>EIP-6808 implementation</title>
        <category>/</category>
        
        <description># EIP-6808 implementation

This project is a reference implementation of EIP-6808.

Try running some of the following tasks:

```shell
npm i
truffle compile
truffle test
```
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-6808/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-6808/</guid>
      </item>
    
      <item>
        <title>EIP 6809 implementation</title>
        <category>/</category>
        
        <description># EIP 6809 implementation

This project is a reference implementation of EIP-6809.

Try running some of the following tasks:

```shell
npm i
truffle compile
truffle test
```
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-6809/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-6809/</guid>
      </item>
    
      <item>
        <title>ERCxxxx Reference implementation</title>
        <category>/</category>
        
        <description># ERCxxxx Reference implementation
This reference implementation is [MIT](/assets/erc-6956/LICENSE) licensed and can therefore be freely used in any project.

## Getting started
From this directory, run 

```
npm install &amp;&amp; npx hardhat test
```



</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-6956/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-6956/</guid>
      </item>
    
      <item>
        <title>EIP 6982 implementation</title>
        <category>/</category>
        
        <description># EIP 6982 implementation

As a reference implementation of EIP-6982 we use the Nduja Labs ERC721Lockable contract.

To run the tests, run the following commands:

```shell
npm i -g pnpm
pnpm i
pnpm test
```
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-6982/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-6982/</guid>
      </item>
    
      <item>
        <title>ERC-7007 Reference Implementation</title>
        <category>/</category>
        
        <description># ERC-7007 Reference Implementation

This is a WIP implementation of ERC-7007 based on the discussions in the [EIP-7007 issue thread](https://github.com/ethereum/EIPs/issues/7007).

## Setup
Run `npm install` in the root directory.

## Testing
Try running some of the following tasks:

```shell
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
```

## Metadata Standard

```json
{
    &quot;title&quot;: &quot;AIGC Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset to which this NFT represents&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset to which this NFT represents&quot;
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
        },

        &quot;prompt&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the prompt from which this AIGC NFT generated&quot;
        },
        &quot;seed&quot;: {
            &quot;type&quot;: &quot;uint256&quot;,
            &quot;description&quot;: &quot;Identifies the seed from which this AIGC NFT generated&quot;
        },
        &quot;aigc_type&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;image/video/audio...&quot;
        },
        &quot;aigc_data&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* representing the asset to which this AIGC 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.&quot;
        }
    }
}
```</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7007/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7007/</guid>
      </item>
    
      <item>
        <title>Reference implementation of ERC-7208 and usage examples</title>
        <category>/</category>
        
        <description># Reference implementation of ERC-7208 and usage examples
## List of contracts
### Interfaces
- [IDataIndex](/assets/erc-7208/contracts/interfaces/IDataIndex.sol) - Interface of **DataIndex**
- [IDataObject](/assets/erc-7208/contracts/interfaces/IDataObject.sol) - Interface of **DataObject**
- [IDataPointRegistry](/assets/erc-7208/contracts/interfaces/IDataPointRegistry.sol) - Interface of Data Point Registry
- [IIDManager](/assets/erc-7208/contracts/interfaces/IIDManager.sol) - Interface for building and querying Data Index user identifiers

### Implementation
- [DataIndex](/assets/erc-7208/contracts/DataIndex.sol) - Data Index (implements `IDataIndex` and `IIDManager`)
- [DataPointRegistry](/assets/erc-7208/contracts/DataPointRegistry.sol) - Data Point Registry (implements `IDataPointRegistry`)
- [DataPoints](/assets/erc-7208/contracts/utils/DataPoints.sol) - Library implementing DataPoint type and its encode/decode functions
- [ChainidTools](/assets/erc-7208/contracts/utils/ChainidTools.sol) - Library implementing utility functions to work with chain ids

### Usage examples
- [IFractionTransferEventEmitter](/assets/erc-7208/contracts/interfaces/IFractionTransferEventEmitter.sol) - Interface used for **DataManagers** communication to emit ERC20 Transfer events
- [IFungibleFractionsOperations](/assets/erc-7208/contracts/interfaces/IFungibleFractionsOperations.sol) - Interface defines **DataObject** operations, which can be called by **DataManager**
- [MinimalisticFungibleFractionsDO](/assets/erc-7208/contracts/dataobjects/MinimalisticFungibleFractionsDO.sol) - **DataObject** implements data storage and related logic for token  with Fungible Fractions (like ERC1155)
- [MinimalisticERC1155WithERC20FractionsDataManager](/assets/erc-7208/contracts/datamanagers/MinimalisticERC1155WithERC20FractionsDataManager.sol) - **DataManager** implements token with fungible fractions with ERC1155 interface, linked to a DataManager which implements ERC20 interface for same token
- [MinimalisticERC20FractionDataManager](/assets/erc-7208/contracts/datamanagers/MinimalisticERC20FractionDataManager.sol) - implements token with ERC20 interface, linked to a **DataManager** which implements ERC1155 interface for same token
- [MinimalisticERC20FractionDataManagerFactory](/assets/erc-7208/contracts/datamanagers/MinimalisticERC20FractionDataManagerFactory.sol) - factory of **DataManagers** implementing ERC20 interface for token with fungible fractions

---

An audited implementation can be found [here](https://github.com/Nexera-Foundation/Minimalistic-ERC-7208/).</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7208/contracts/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7208/contracts/</guid>
      </item>
    
      <item>
        <title>PBM Solidity implementation</title>
        <category>/</category>
        
        <description># PBM Solidity implementation

## Description

We provide a list of sample PBM implementation for reference.

### Provided Contracts and Tests

&lt;!-- TBD: Explain the folder structure --&gt;

- `contracts/preloaded-pbm/XXXX.sol` - PBMRC1 implementation contract to demonstrate preloaded PBMs
- `contracts/non-preloaded-pbm/XXXX.sol` - Interface contract
&lt;!-- - `contracts/attest-unlock-pbm/XXXX.sol` - contract to demonstrate a 3rd party attestation to allow unwrap of a PBM --&gt;
- `contracts/XXXX.sol` - Interface contract
- `contracts/ERC20.sol` - ERC20 token contract for unit tests
- `test/XXXXX.js` - Unit tests for livecycle of the PBM implementation

### Used javascript based testing libraries for solidity

&lt;!-- TBD: Fill this up with libraries used --&gt;

- `hardhat`: hardhat allows for testing of contracts with JavaScript via Mocha as the test runner
- `chai`: Chai is an assertion library and provides functions like expect.
- `ethers`: This is a popular Ethereum client library. It allows you to interface with blockchains that implement the Ethereum API.

### Compile and run tests with hardhat

&lt;!-- TBD: Improve this with nix file --&gt;

We provide the essential steps to compile the contracts and run provided unit tests
Check that you have the latest version of npm and node via `npm -version` and `node -v` (should be a LTS version for hardhat support)

1. Check out project
2. Go to folder and initialise a new npm project: `npm init -y`. A basic `package.json` file should occur
3. Install Hardhat as local solidity dev environment: `npx hardhat`
4. Select following option: Create an empty hardhat.config.js
5. Install Hardhat as a development dependency: `npm install --save-dev hardhat`
6. Install further testing dependencies:
   `npm install --save-dev @nomiclabs/hardhat-waffle @nomiclabs/hardhat-ethers ethereum-waffle chai  ethers solidity-coverage`
7. Install open zeppelin contracts: `npm install @openzeppelin/contracts`
8. add plugins to hardhat.config.ts:

```
require(&quot;@nomiclabs/hardhat-waffle&quot;);
require(&apos;solidity-coverage&apos;);
```

9. Adding commands to `package.json`:

```
&quot;scripts&quot;: {
    &quot;build&quot;: &quot;hardhat compile&quot;,
    &quot;test:light&quot;: &quot;hardhat test&quot;,
    &quot;test&quot;: &quot;hardhat coverage&quot;
  },
```

9. run `npm run build`
10. run `npm run test`
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7291/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7291/</guid>
      </item>
    
      <item>
        <title>Ethereum Entity Component System</title>
        <category>/</category>
        
        <description># Ethereum Entity Component System

World contracts are containers for entities, component contracts, and system contracts. Its core principle is to establish the relationship between entities and component contracts, and different entities will attach different components. And use the system contract to dynamically change the data of the entity in the component.
Usual workflow when building ECS-based programs

1. Implement the `IWorld` interface to create a world contract.
2. Call `createEntity()` of the world contract to create an entity.
3. Implement the `IComponent` interface to create a Component contract.
4. Call `registerComponent()` of the world contract to register the component contract.
5. Call `addComponent()` of the world contract to attach the component to the entity.
6. Create a system contract, which is a contract without interface restrictions, and you can define any function in the system contract.
7. Call `registerSystem()` of the world contract to register the system contract.
8. Run the system.

- [`System.sol`](/assets/erc-7509/System.sol)
- [`Types.sol`](/assets/erc-7509/Types.sol)
- [`World.sol`](/assets/erc-7509/World.sol)
- [`Component.sol`](/assets/erc-7509/Component.sol)</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7509/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7509/</guid>
      </item>
    
      <item>
        <title>DvP Solidity implementation</title>
        <category>/</category>
        
        <description># DvP Solidity implementation

## Description

The interfaces in this proposal model a functional transaction scheme to establish a secure *delivery-versus-payment*
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, *delivery-versus-payment* 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).

The scheme is realized by two smart contracts, one on each chain.
One smart contract implements the `ILockingContract` interface on one chain (e.g. the &quot;asset chain&quot;), and another smart contract implements the `IDecryptionContract` interface on the other chain (e.g., the &quot;payment chain&quot;).
The smart contract implementing `ILockingContract` 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 `IDecryptionContract`, 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 `IDecryptionContract` for the decryption.

### Provided Contracts

#### DvP

- `contracts/ILockingContract.sol` - Contract locking transfer with given encrypted keys or hashes.
- `contracts/IDecryptionContract.sol` - Contract performing conditional upon transfer decryption (possibly based on an external oracle).

#### Decryption Oracle

- `contracts/IKeyDecryptionOracle.sol` - Interface implemented by a decryption oracle proxy contract.
- `contracts/IKeyDecryptionOracleCallback.sol` - Interface to be implemented by a callback receiving the decrypted key.

### Documentation

- `doc/DvP-Seq-Diag.png` - Sequence diagram of the DvP
- `doc/multi-party-dvp.svg` - Sequence diagram of a multi-party-dvp.

</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7573/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7573/</guid>
      </item>
    
      <item>
        <title>ERC7641: Intrinsic RevShare Token</title>
        <category>/</category>
        
        <description># ERC7641: Intrinsic RevShare Token

An ERC-20 extension that integrates a revenue-sharing mechanism, ensuring tokens intrinsically represent a share of a communal revenue pool
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7641/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7641/</guid>
      </item>
    
      <item>
        <title>References for ERC-7746</title>
        <category>/</category>
        
        <description># References for ERC-7746

In this directory you can find a reference implementation of the ILayer interface and a sample MockERC20 contract.

In this test, a [Protected.sol](/assets/erc-7746/test/Protected.sol) contract is protected by a [RateLimitLayer.sol](/assets/erc-7746/test/RateLimitLayer.sol) layer. The RateLimitLayer implements the ILayer interface and enforces a rate which client has configured.
The Drainer simulates a vulnerable contract that acts in a malicious way. In the `test.ts` The Drainer contract is trying to drain the funds from the Protected contract. It is assumed that Protected contract has bug that allows partial unauthorized access to the state.
The RateLimitLayer is configured to allow only 10 transactions per block from same sender. The test checks that the Drainer contract is not able to drain the funds from the Protected contract.</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7746/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7746/</guid>
      </item>
    
      <item>
        <title>ERC-7818</title>
        <category>/</category>
        
        <description># ERC-7818

This is reference implementation of ERC-7818

## Implementation Describe

#### Sliding Window Algorithm to look for expiration balance

This contract creates an abstract implementation that adopts the `Sliding Window Algorithm` to maintain a window over a period of time (block height). This efficient approach allows for the look back and calculation of `usable balances` for each account within that window period. With this approach, the contract does not require a variable acting as a `counter` or a `state` to keep updating the latest state, nor does it need any interaction calls to keep updating the current period, which is an effortful and costly design.

&lt;p align=&quot;center&quot;&gt;
    &lt;img src=&quot;implementation.svg&quot; alt=&quot;Sliding Window Maintain Balance is Epoch&quot;&gt;
&lt;/p&gt;

#### `epoch` and `list` for storing data in vertical and horizontal way

```solidity
    // skipping

    struct Epoch {
        uint256 totalBalance;
        mapping(uint256 =&gt; uint256) blockBalances;
        SortedList.List list;
    }

    // skipping

    // O(n→) fot traversal each epoch.
    // O(n↓) for traversal each element in list.
    mapping(uint256 =&gt; mapping(address =&gt; Epoch))) private _balances;
    mapping(uint256 =&gt; uint256) private _worldStateBalance;
```

With `epoch` it provides an abstract loop in a horizontal way more efficient for calculating the usable balance of the account because it provides `totalBalance` which acts as suffix balance, so you don&apos;t need to get to iterate or traversal over the `list` in vertical to calculate the entire balance if the `epoch` can presume not to expire.
The `_worldStateBalance` mapping tracks the total token balance across all accounts that minted tokens within a particular block. This structure allows the contract to trace expired balances easily. By consolidating balance data for each block.

#### Buffering 1 `epoch` rule for ensuring safety

In this design, the buffering slot is the critical element that requires careful calculation to ensure accurate handling of balances nearing expiration. By incorporating this buffer, the contract guarantees that any expiring balance is correctly accounted for within the sliding window mechanism, ensuring reliability and preventing premature expiration or missed balances.

#### First-In-First-Out (FIFO) priority to enforce token expiration rules

Enforcing `FIFO` priority ensures that tokens nearing expiration are processed before newer ones, aligning with the token lifecycle and expiration rules. This method eliminates the need for additional `off-chain` computation and ensures that all token processing occurs efficiently `on-chain`, fully compliant with the ERC20 interface.
A **sorted** list is integral to this approach. Each `epoch` maintains its own list, sorted by token creation which is can be `block.timestamp` or `blocknumber`, preventing any overlap with other `epoch`. This separation ensures that tokens in one `epoch` do not interfere with the balance handling in another. The contract can then independently manage token expirations within each `epoch`, minimizing computation while maintaining accuracy and predictability in processing balances.

---

#### Token Receipt and Transaction Likelihood across various blocktime

Assuming each year contains 4 `epoch`, which aligns with familiar time-based divisions like a year being divided into four quarters, the following table presents various scenarios based on block time and token receipt intervals. It illustrates the potential transaction frequency and likelihood of receiving tokens within a given period.

| Block Time (ms) | Receive Token Every (ms) | Index/Epoch | Frequency           | Likelihood    |
| --------------- | ------------------------ | ----------- | ------------------- | ------------- |
| 100             | 100                      | 78,892,315  | 864,000 _times/day_ | Very Unlikely |
| 500             | 500                      | 15,778,463  | 172,800 _times/day_ | Very Unlikely |
| 1000            | 1000                     | 7,889,231   | 86,400 _times/day_  | Very Unlikely |
| 1000            | 28,800,000               | 273         | 3 _times/day_       | Unlikely      |
| 1000            | 86,400,000               | 91          | 1 _times/day_       | Possible      |
| 5000            | 86,400,000               | 18          | 1 _times/month_     | Very Likely   |
| 10000           | 86,400,000               | 9           | 3 _times/month_     | Very Likely   |

&gt; [!IMPORTANT]  
&gt; - Transactions per day are assumed based on loyalty point earnings.
&gt; - Likelihood varies depending on the use case; for instance, gaming use cases may have higher transaction volumes than the given estimates.

## Security Considerations in The Reference Implementation

- Solidity Division Rounding Down This implementation contract may encounter scenarios where the calculated expiration block is shorter than the actual expiration block. However, contract mitigates this risk by enforcing valid block times within the defined limits of `MINIMUM_BLOCK_TIME` and `MAXIMUM_BLOCK_TIME`.

## Usage

#### Install Dependencies
```bash
yarn install
```

#### Compile the Contract
Compile the reference implementation
```bash
yarn compile
```

#### Run Tests
Execute the provided test suite to verify the contract&apos;s functionality and integrity
```bash
yarn test
```

### Cleaning Build Artifacts
To clean up compiled files and artifacts generated during testing or deployment
```bash
yarn clean
```</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7818/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7818/</guid>
      </item>
    
      <item>
        <title>ERC-7858</title>
        <category>/</category>
        
        <description># ERC-7858

This is reference implementation of ERC-7858

## Implementation Describe

### Per-Token Expiry

Default `ERC7858` is each token has its own independent start and end date, stored using `block.timestamp` or `block.number`. This provides flexibility, allowing tokens to expire at different dates/blocks.

### Epoch-based Expiry

`ERC7858Epoch` similar to ERC-7818, this method enforces a shared lifetime duration for all tokens, ensuring they expire simultaneously. This can be useful for fixed-term subscriptions or time-based access control.

## Usage

#### Install Dependencies
```bash
yarn install
```

#### Compile the Contract
Compile the reference implementation
```bash
yarn compile
```

#### Run Tests
Execute the provided test suite to verify the contract&apos;s functionality and integrity
```bash
yarn test
```

### Cleaning Build Artifacts
To clean up compiled files and artifacts generated during testing or deployment
```bash
yarn clean
```
</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7858/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7858/</guid>
      </item>
    
      <item>
        <title>ERC-7943 uRWA Minimal Package</title>
        <category>/</category>
        
        <description># ERC-7943 uRWA Minimal Package

## Install dependencies
```bash
forge install OpenZeppelin/openzeppelin-contracts
forge install foundry-rs/forge-std
```

## Build
```bash
forge build
```

## Test
```bash
forge test -vv
```

## Gas report
```bash
forge test --gas-report
```

## Coverage
```bash
forge coverage
```</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-7943/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-7943/</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>Groups reference implementation assets

- After creating the Ethereum Magicians discussion, update `discussions-to` in `ERCS/erc-8063.md` with the live URL.
- Contracts:
  - `IERC8063.sol`: interface
  - `ERC8063.sol`: minimal implementation
  - `ERC8063ERC20.sol`: optional ERC-20 compatibility implementation (decimals=0)


</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/assets/erc-8063/</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/assets/erc-8063/</guid>
      </item>
    
      <item>
        <title></title>
        <category>/</category>
        
        <description>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;{% if page.xsl %}&lt;?xml-stylesheet type=&quot;text/xml&quot; href=&quot;{{ &apos;/feed.xslt.xml&apos; | absolute_url }}&quot;?&gt;{% endif %}&lt;feed xmlns=&quot;http://www.w3.org/2005/Atom&quot; {% if site.lang %}xml:lang=&quot;{{ site.lang }}&quot;{% endif %}&gt;&lt;generator uri=&quot;https://jekyllrb.com/&quot; version=&quot;{{ jekyll.version }}&quot;&gt;Jekyll&lt;/generator&gt;&lt;link href=&quot;{{ page.url | absolute_url }}&quot; rel=&quot;self&quot; type=&quot;application/atom+xml&quot; /&gt;&lt;link href=&quot;{{ &apos;/&apos; | absolute_url }}&quot; rel=&quot;alternate&quot; type=&quot;text/html&quot; {% if site.lang %}hreflang=&quot;{{ site.lang }}&quot; {% endif %}/&gt;&lt;updated&gt;{{ site.time | date_to_xmlschema }}&lt;/updated&gt;&lt;id&gt;{{ page.url | absolute_url | xml_escape }}&lt;/id&gt;{% assign title = site.title | default: site.name %}{% if page.collection != &quot;posts&quot; %}{% assign collection = page.collection | capitalize %}{% assign title = title | append: &quot; | &quot; | append: collection %}{% endif %}{% if page.category %}{% assign category = page.category | capitalize %}{% assign title = title | append: &quot; | &quot; | append: category %}{% endif %}{% if title %}&lt;title type=&quot;html&quot;&gt;{{ title | smartify | xml_escape }}&lt;/title&gt;{% endif %}{% if site.description %}&lt;subtitle&gt;{{ site.description | xml_escape }}&lt;/subtitle&gt;{% endif %}{% if site.author %}&lt;author&gt;&lt;name&gt;{{ site.author.name | default: site.author | xml_escape }}&lt;/name&gt;{% if site.author.email %}&lt;email&gt;{{ site.author.email | xml_escape }}&lt;/email&gt;{% endif %}{% if site.author.uri %}&lt;uri&gt;{{ site.author.uri | xml_escape }}&lt;/uri&gt;{% endif %}&lt;/author&gt;{% endif %}{% if page.tags %}{% assign posts = site.tags[page.tags] %}{% else %}{% assign posts = site[page.collection] %}{% endif %}{% if page.category %}{% assign posts = posts | where: &quot;category&quot;, page.category %}{% endif %}{% unless site.show_drafts %}{% assign posts = posts | where_exp: &quot;post&quot;, &quot;post.draft != true&quot; %}{% endunless %}{% assign posts = posts | sort: &quot;date&quot; | reverse %}{% assign posts_limit = site.feed.posts_limit | default: 10 %}{% for post in posts limit: posts_limit %}&lt;entry{% if post.lang %}{{&quot; &quot;}}xml:lang=&quot;{{ post.lang }}&quot;{% endif %}&gt;{% assign post_title = post.title | smartify | strip_html | normalize_whitespace | xml_escape %}&lt;title type=&quot;html&quot;&gt;{{ post_title }}&lt;/title&gt;&lt;link href=&quot;{{ post.url | absolute_url }}&quot; rel=&quot;alternate&quot; type=&quot;text/html&quot; title=&quot;{{ post_title }}&quot; /&gt;&lt;published&gt;{{ post.date | date_to_xmlschema }}&lt;/published&gt;&lt;updated&gt;{{ post.last_modified_at | default: post.date | date_to_xmlschema }}&lt;/updated&gt;&lt;id&gt;{{ post.id | absolute_url | xml_escape }}&lt;/id&gt;{% assign excerpt_only = post.feed.excerpt_only | default: site.feed.excerpt_only %}{% unless excerpt_only %}&lt;content type=&quot;html&quot; xml:base=&quot;{{ post.url | absolute_url | xml_escape }}&quot;&gt;{{ post.content | strip | xml_escape }}&lt;/content&gt;{% endunless %}{% assign post_author = post.author | default: post.authors[0] | default: site.author %}{% assign post_author = site.data.authors[post_author] | default: post_author %}{% assign post_author_email = post_author.email | default: nil %}{% assign post_author_uri = post_author.uri | default: nil %}{% assign post_author_name = post_author.name | default: post_author %}&lt;author&gt;&lt;name&gt;{{ post_author_name | default: &quot;&quot; | xml_escape }}&lt;/name&gt;{% if post_author_email %}&lt;email&gt;{{ post_author_email | xml_escape }}&lt;/email&gt;{% endif %}{% if post_author_uri %}&lt;uri&gt;{{ post_author_uri | xml_escape }}&lt;/uri&gt;{% endif %}&lt;/author&gt;{% if post.category %}&lt;category term=&quot;{{ post.category | xml_escape }}&quot; /&gt;{% elsif post.categories %}{% for category in post.categories %}&lt;category term=&quot;{{ category | xml_escape }}&quot; /&gt;{% endfor %}{% endif %}{% for tag in post.tags %}&lt;category term=&quot;{{ tag | xml_escape }}&quot; /&gt;{% endfor %}{% if post.excerpt and post.excerpt != empty %}&lt;summary type=&quot;html&quot;&gt;{{ post.excerpt | strip_html | normalize_whitespace | xml_escape }}&lt;/summary&gt;{% endif %}{% assign post_image = post.image.path | default: post.image %}{% if post_image %}{% unless post_image contains &quot;://&quot; %}{% assign post_image = post_image | absolute_url %}{% endunless %}&lt;media:thumbnail xmlns:media=&quot;http://search.yahoo.com/mrss/&quot; url=&quot;{{ post_image | xml_escape }}&quot; /&gt;&lt;media:content medium=&quot;image&quot; url=&quot;{{ post_image | xml_escape }}&quot; xmlns:media=&quot;http://search.yahoo.com/mrss/&quot; /&gt;{% endif %}&lt;/entry&gt;{% endfor %}&lt;/feed&gt;</description>
        <pubDate></pubDate>
        <link>https://ercs.ethereum.org/feed.xml</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/feed.xml</guid>
      </item>
    
      <item>
        <title>EIP Purpose and Guidelines</title>
        <category>Meta/</category>
        
        <description>## What is an EIP?

EIP stands for Ethereum Improvement Proposal. An EIP is a design document providing information to the Ethereum community, or describing a new feature for Ethereum or its processes or environment. The EIP should provide a concise technical specification of the feature and a rationale for the feature. The EIP author is responsible for building consensus within the community and documenting dissenting opinions.

## EIP Rationale

We intend EIPs to be the primary mechanisms for proposing new features, for collecting community technical input on an issue, and for documenting the design decisions that have gone into Ethereum. Because the EIPs are maintained as text files in a versioned repository, their revision history is the historical record of the feature proposal.

For Ethereum implementers, EIPs are a convenient way to track the progress of their implementation. Ideally, each implementation maintainer would list the EIPs that they have implemented. This will give end users a convenient way to know the current status of a given implementation or library.

## EIP Types

There are three types of EIP:

- A **Standards Track EIP** describes any change that affects most or all Ethereum implementations, such as: a change to the network protocol, a change in block or transaction validity rules, proposed application standards/conventions, or any change or addition that affects the interoperability of applications using Ethereum. Standards Track EIPs consist of three parts—a design document, an implementation, and (if warranted) an update to the [formal specification](https://github.com/ethereum/yellowpaper). Furthermore, Standards Track EIPs can be broken down into the following categories:
  - **Core**: improvements requiring a consensus fork (e.g. [EIP-5](./eip-5.md), [EIP-101](./eip-101.md)), as well as changes that are not necessarily consensus critical but may be relevant to [“core dev” discussions](https://github.com/ethereum/pm) (for example, [EIP-90], and the miner/node strategy changes 2, 3, and 4 of [EIP-86](./eip-86.md)).
  - **Networking**: includes improvements around [devp2p](https://github.com/ethereum/devp2p/blob/readme-spec-links/rlpx.md) ([EIP-8](./eip-8.md)) and [Light Ethereum Subprotocol](https://ethereum.org/en/developers/docs/nodes-and-clients/#light-node), as well as proposed improvements to network protocol specifications of [whisper](https://github.com/ethereum/go-ethereum/issues/16013#issuecomment-364639309) and [swarm](https://github.com/ethereum/go-ethereum/pull/2959).
  - **Interface**: includes improvements around language-level standards like method names ([EIP-6](./eip-6.md)) and [contract ABIs](https://docs.soliditylang.org/en/develop/abi-spec.html).
  - **ERC**: application-level standards and conventions, including contract standards such as token standards ([ERC-20](./eip-20.md)), name registries ([ERC-137](./eip-137.md)), URI schemes, library/package formats, and wallet formats.

- A **Meta EIP** describes a process surrounding Ethereum or proposes a change to (or an event in) a process. Process EIPs are like Standards Track EIPs but apply to areas other than the Ethereum protocol itself. They may propose an implementation, but not to Ethereum&apos;s codebase; they often require community consensus; unlike Informational EIPs, they are more than recommendations, and users are typically not free to ignore them. Examples include procedures, guidelines, changes to the decision-making process, and changes to the tools or environment used in Ethereum development. Any meta-EIP is also considered a Process EIP.

- An **Informational EIP** describes an Ethereum design issue, or provides general guidelines or information to the Ethereum community, but does not propose a new feature. Informational EIPs do not necessarily represent Ethereum community consensus or a recommendation, so users and implementers are free to ignore Informational EIPs or follow their advice.

It is highly recommended that a single EIP contain a single key proposal or new idea. The more focused the EIP, the more successful it tends to be. A change to one client doesn&apos;t require an EIP; a change that affects multiple clients, or defines a standard for multiple apps to use, does.

An EIP must meet certain minimum criteria. It must be a clear and complete description of the proposed enhancement. The enhancement must represent a net improvement. The proposed implementation, if applicable, must be solid and must not complicate the protocol unduly.

### Special requirements for Core EIPs

If a **Core** EIP mentions or proposes changes to the EVM (Ethereum Virtual Machine), it should refer to the instructions by their mnemonics and define the opcodes of those mnemonics at least once. A preferred way is the following:

```
REVERT (0xfe)
```

## EIP Work Flow

### Shepherding an EIP

Parties involved in the process are you, the champion or *EIP author*, the [*EIP editors*](#eip-editors), and the [*Ethereum Core Developers*](https://github.com/ethereum/pm).

Before you begin writing a formal EIP, you should vet your idea. Ask the Ethereum community first if an idea is original to avoid wasting time on something that will be rejected based on prior research. It is thus recommended to open a discussion thread on [the Ethereum Magicians forum](https://ethereum-magicians.org/) to do this.

Once the idea has been vetted, your next responsibility will be to present (by means of an EIP) the idea to the reviewers and all interested parties, invite editors, developers, and the community to give feedback on the aforementioned channels. You should try and gauge whether the interest in your EIP is commensurate with both the work involved in implementing it and how many parties will have to conform to it. For example, the work required for implementing a Core EIP will be much greater than for an ERC and the EIP will need sufficient interest from the Ethereum client teams. Negative community feedback will be taken into consideration and may prevent your EIP from moving past the Draft stage.

### Core EIPs

For Core EIPs, given that they require client implementations to be considered **Final** (see &quot;EIPs Process&quot; below), you will need to either provide an implementation for clients or convince clients to implement your EIP.

The best way to get client implementers to review your EIP is to present it on an AllCoreDevs call. You can request to do so by posting a comment linking your EIP on an [AllCoreDevs agenda GitHub Issue](https://github.com/ethereum/pm/issues).  

The AllCoreDevs call serves as a way for client implementers to do three things. First, to discuss the technical merits of EIPs. Second, to gauge what other clients will be implementing. Third, to coordinate EIP implementation for network upgrades.

These calls generally result in a &quot;rough consensus&quot; around what EIPs should be implemented. This &quot;rough consensus&quot; rests on the assumptions that EIPs are not contentious enough to cause a network split and that they are technically sound.

:warning: The EIPs process and AllCoreDevs call were not designed to address contentious non-technical issues, but, due to the lack of other ways to address these, often end up entangled in them. This puts the burden on client implementers to try and gauge community sentiment, which hinders the technical coordination function of EIPs and AllCoreDevs calls. If you are shepherding an EIP, you can make the process of building community consensus easier by making sure that [the Ethereum Magicians forum](https://ethereum-magicians.org/) thread for your EIP includes or links to as much of the community discussion as possible and that various stakeholders are well-represented.

*In short, your role as the champion is to write the EIP using the style and format described below, shepherd the discussions in the appropriate forums, and build community consensus around the idea.*

### EIP Process

The following is the standardization process for all EIPs in all tracks:

![EIP Status Diagram](/assets/eip-1/EIP-process-update.jpg)

**Idea** - An idea that is pre-draft. This is not tracked within the EIP Repository.

**Draft** - The first formally tracked stage of an EIP in development. An EIP is merged by an EIP Editor into the EIP repository when properly formatted.

**Review** - An EIP Author marks an EIP as ready for and requesting Peer Review.

**Last Call** - This is the final review window for an EIP before it is moved to `Final`. An EIP enters `Last Call` when the specification is stable and the author opens a PR with a review end date (`last-call-deadline`), typically 14 days later. 

If this period results in necessary normative changes it will revert the EIP to `Review`.

**Final** - This EIP represents the final standard. A Final EIP exists in a state of finality and should only be updated to correct errata and add non-normative clarifications.

A PR moving an EIP from Last Call to Final SHOULD contain no changes other than the status update. Any content or editorial proposed change SHOULD be separate from this status-updating PR and committed prior to it.

**Stagnant** - Any EIP in `Draft` or `Review` or `Last Call` if inactive for a period of 6 months or greater is moved to `Stagnant`. An EIP may be resurrected from this state by Authors or EIP Editors through moving it back to `Draft` or its earlier status. If not resurrected, a proposal may stay forever in this status.

&gt;*EIP Authors are notified of any algorithmic change to the status of their EIP*

**Withdrawn** - The EIP Author(s) have withdrawn the proposed EIP. This state has finality and can no longer be resurrected using this EIP number. If the idea is pursued at a later date, it is considered a new proposal.

**Living** - A special status for EIPs that are designed to be continually updated and not reach a state of finality. This includes most notably EIP-1.

## What belongs in a successful EIP?

Each EIP should have the following parts:

- Preamble - RFC 822 style headers containing metadata about the EIP, including the EIP number, a short descriptive title (limited to a maximum of 44 characters), a description (limited to a maximum of 140 characters), and the author details. Irrespective of the category, the title and description should not include EIP number. See [below](/ERCS/eip-1#eip-header-preamble) for details.
- Abstract - Abstract is a multi-sentence (short paragraph) technical summary. This should be a very terse and human-readable version of the specification section. Someone should be able to read only the abstract to get the gist of what this specification does.
- Motivation *(optional)* - A motivation section is critical for EIPs that want to change the Ethereum protocol. It should clearly explain why the existing protocol specification is inadequate to address the problem that the EIP solves. This section may be omitted if the motivation is evident.
- Specification - The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Ethereum platforms (besu, erigon, ethereumjs, go-ethereum, nethermind, or others).
- Rationale - 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 rationale should discuss important objections or concerns raised during discussion around the EIP.
- Backwards Compatibility *(optional)* - All EIPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their consequences. The EIP must explain how the author proposes to deal with these incompatibilities. This section may be omitted if the proposal does not introduce any backward incompatibilities, but this section must be included if backward incompatibilities exist.
- Test Cases *(optional)* - Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. Tests should either be inlined in the EIP as data (such as input/expected output pairs) or included in `../assets/eip-###/&lt;filename&gt;`. This section may be omitted for non-Core proposals.
- Reference Implementation *(optional)* - An optional section that contains a reference/example implementation that people can use to assist in understanding or implementing this specification. This section may be omitted for all EIPs.
- Security Considerations - All EIPs must contain a section that discusses the security implications/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. E.g., 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.
- Copyright Waiver - All EIPs must be in the public domain. The copyright waiver MUST link to the license file and use the following wording: `Copyright and related rights waived via [CC0](/LICENSE).`

## EIP Formats and Templates

EIPs should be written in [markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) format. There is a [template](https://github.com/ethereum/EIPs/blob/master/eip-template.md) and [contributor](https://github.com/ethereum/EIPs/blob/master/CONTRIBUTING.md) guidelines to follow.

## EIP Header Preamble

Each EIP must begin with an [RFC 822](https://www.ietf.org/rfc/rfc822.txt) style header preamble, preceded and followed by three hyphens (`---`). This header is also termed [&quot;front matter&quot; by Jekyll](https://jekyllrb.com/docs/front-matter/). The headers must appear in the following order.

`eip`: *EIP number*

`title`: *The EIP title is a few words, not a complete sentence*

`description`: *Description is one full (short) sentence*

`author`: *The list of the author&apos;s or authors&apos; name(s) and/or username(s), or name(s) and email(s). Details are below.*

`discussions-to`: *The url pointing to the official discussion thread*

`status`: *Draft, Review, Last Call, Final, Stagnant, Withdrawn, Living*

`last-call-deadline`: *The date last call period ends on* (Optional field, only needed when status is `Last Call`)

`type`: *One of `Standards Track`, `Meta`, or `Informational`*

`category`: *One of `Core`, `Networking`, `Interface`, or `ERC`* (Optional field, only needed for `Standards Track` EIPs)

`created`: *Date the EIP was created on*

`requires`: *EIP number(s)* (Optional field)

`withdrawal-reason`: *A sentence explaining why the EIP was withdrawn.* (Optional field, only needed when status is `Withdrawn`)

Headers that permit lists must separate elements with commas.

Headers requiring dates will always do so in the format of ISO 8601 (yyyy-mm-dd).

### `author` header

The `author` header lists the names, email addresses or usernames of the authors/owners of the EIP. Those who prefer anonymity may use a username only, or a first name and a username. The format of the `author` header value must be:

&gt; Random J. User &amp;lt;address@dom.ain&amp;gt;

or

&gt; Random J. User (@username)

or

&gt; Random J. User (@username) &amp;lt;address@dom.ain&amp;gt;

if the email address and/or GitHub username is included, and

&gt; Random J. User

if neither the email address nor the GitHub username are given.

At least one author must use a GitHub username, in order to get notified on change requests and have the capability to approve or reject them.

### `discussions-to` header

While an EIP is a draft, a `discussions-to` header will indicate the URL where the EIP is being discussed.

The preferred discussion URL is a topic on [Ethereum Magicians](https://ethereum-magicians.org/). The URL cannot point to Github pull requests, any URL which is ephemeral, and any URL which can get locked over time (i.e. Reddit topics).

### `type` header

The `type` header specifies the type of EIP: Standards Track, Meta, or Informational. If the track is Standards please include the subcategory (core, networking, interface, or ERC).

### `category` header

The `category` header specifies the EIP&apos;s category. This is required for standards-track EIPs only.

### `created` header

The `created` header records the date that the EIP was assigned a number. Both headers should be in yyyy-mm-dd format, e.g. 2001-08-14.

### `requires` header

EIPs may have a `requires` header, indicating the EIP numbers that this EIP depends on. If such a dependency exists, this field is required.

A `requires` dependency is created when the current EIP cannot be understood or implemented without a concept or technical element from another EIP. Merely mentioning another EIP does not necessarily create such a dependency.

## Linking to External Resources

Other than the specific exceptions listed below, links to external resources **SHOULD NOT** be included. External resources may disappear, move, or change unexpectedly.

The process governing permitted external resources is described in [EIP-5757](./eip-5757.md).

### Execution Client Specifications

Links to the Ethereum Execution Client Specifications may be included using normal markdown syntax, such as:

```markdown
[Ethereum Execution Client Specifications](https://github.com/ethereum/execution-specs/blob/9a1f22311f517401fed6c939a159b55600c454af/README.md)
```

Which renders to:

[Ethereum Execution Client Specifications](https://github.com/ethereum/execution-specs/blob/9a1f22311f517401fed6c939a159b55600c454af/README.md)

Permitted Execution Client Specifications URLs must anchor to a specific commit, and so must match this regular expression:

```regex
^(https://github.com/ethereum/execution-specs/(blob|commit)/[0-9a-f]{40}/.*|https://github.com/ethereum/execution-specs/tree/[0-9a-f]{40}/.*)$
```

### Execution Specification Tests

Links to the Ethereum Execution Specification Tests (EEST) may be included using normal markdown syntax, such as:

```markdown
[Ethereum Execution Specification Tests](https://github.com/ethereum/execution-spec-tests/blob/c9b9307ff320c9bb0ecb9a951aeab0da4d9d1684/README.md)
```

Which renders to:

[Ethereum Execution Specification Tests](https://github.com/ethereum/execution-spec-tests/blob/c9b9307ff320c9bb0ecb9a951aeab0da4d9d1684/README.md)

Permitted Execution Specification Tests URLs must anchor to a specific commit, and so must match one of these regular expressions:

```regex
^https://(www\.)?github\.com/ethereum/execution-spec-tests/(blob|tree)/[a-f0-9]{40}/.+$
```

```regex
^https://(www\.)?github\.com/ethereum/execution-spec-tests/commit/[a-f0-9]{40}$
```

### Consensus Layer Specifications

Links to specific commits of files within the Ethereum Consensus Layer Specifications may be included using normal markdown syntax, such as:

```markdown
[Beacon Chain](https://github.com/ethereum/consensus-specs/blob/26695a9fdb747ecbe4f0bb9812fedbc402e5e18c/specs/sharding/beacon-chain.md)
```

Which renders to:

[Beacon Chain](https://github.com/ethereum/consensus-specs/blob/26695a9fdb747ecbe4f0bb9812fedbc402e5e18c/specs/sharding/beacon-chain.md)

Permitted Consensus Layer Specifications URLs must anchor to a specific commit, and so must match this regular expression:

```regex
^https://github.com/ethereum/consensus-specs/(blob|commit)/[0-9a-f]{40}/.*$
```

### Networking Specifications

Links to specific commits of files within the Ethereum Networking Specifications may be included using normal markdown syntax, such as:

```markdown
[Ethereum Wire Protocol](https://github.com/ethereum/devp2p/blob/40ab248bf7e017e83cc9812a4e048446709623e8/caps/eth.md)
```

Which renders as:

[Ethereum Wire Protocol](https://github.com/ethereum/devp2p/blob/40ab248bf7e017e83cc9812a4e048446709623e8/caps/eth.md)

Permitted Networking Specifications URLs must anchor to a specific commit, and so must match this regular expression:

```regex
^https://github.com/ethereum/devp2p/(blob|commit)/[0-9a-f]{40}/.*$
```

### Portal Specifications

Links to specific commits of files within the Ethereum Portal Specifications may be included using normal markdown syntax, such as:

```markdown
[Portal Wire Protocol](https://github.com/ethereum/portal-network-specs/blob/5e321567b67bded7527355be714993c24371de1a/portal-wire-protocol.md)
```

Which renders as:

[Portal Wire Protocol](https://github.com/ethereum/portal-network-specs/blob/5e321567b67bded7527355be714993c24371de1a/portal-wire-protocol.md)

Permitted Networking Specifications URLs must anchor to a specific commit, and so must match this regular expression:

```regex
^https://github.com/ethereum/portal-network-specs/(blob|commit)/[0-9a-f]{40}/.*$
```

### World Wide Web Consortium (W3C)

Links to a W3C &quot;Recommendation&quot; status specification may be included using normal markdown syntax. For example, the following link would be allowed:

```markdown
[Secure Contexts](https://www.w3.org/TR/2021/CRD-secure-contexts-20210918/)
```

Which renders as:

[Secure Contexts](https://www.w3.org/TR/2021/CRD-secure-contexts-20210918/)

Permitted W3C recommendation URLs MUST anchor to a specification in the technical reports namespace with a date, and so MUST match this regular expression:

```regex
^https://www\.w3\.org/TR/[0-9][0-9][0-9][0-9]/.*$
```

### Web Hypertext Application Technology Working Group (WHATWG)

Links to WHATWG specifications may be included using normal markdown syntax, such as:

```markdown
[HTML](https://html.spec.whatwg.org/commit-snapshots/578def68a9735a1e36610a6789245ddfc13d24e0/)
```

Which renders as:

[HTML](https://html.spec.whatwg.org/commit-snapshots/578def68a9735a1e36610a6789245ddfc13d24e0/)

Permitted WHATWG specification URLs must anchor to a specification defined in the `spec` subdomain (idea specifications are not allowed) and to a commit snapshot, and so must match this regular expression:

```regex
^https:\/\/[a-z]*\.spec\.whatwg\.org/commit-snapshots/[0-9a-f]{40}/$
```

Although not recommended by WHATWG, EIPs must anchor to a particular commit so that future readers can refer to the exact version of the living standard that existed at the time the EIP was finalized. This gives readers sufficient information to maintain compatibility, if they so choose, with the version referenced by the EIP and the current living standard.

### Internet Engineering Task Force (IETF)

Links to an IETF Request For Comment (RFC) specification may be included using normal markdown syntax, such as:

```markdown
[RFC 8446](https://www.rfc-editor.org/rfc/rfc8446)
```

Which renders as:

[RFC 8446](https://www.rfc-editor.org/rfc/rfc8446)

Permitted IETF specification URLs MUST anchor to a specification with an assigned RFC number (meaning cannot reference internet drafts), and so MUST match this regular expression:

```regex
^https:\/\/www.rfc-editor.org\/rfc\/.*$
```

### Bitcoin Improvement Proposal

Links to Bitcoin Improvement Proposals may be included using normal markdown syntax, such as:

```markdown
[BIP 38](https://github.com/bitcoin/bips/blob/3db736243cd01389a4dfd98738204df1856dc5b9/bip-0038.mediawiki)
```

Which renders to:

[BIP 38](https://github.com/bitcoin/bips/blob/3db736243cd01389a4dfd98738204df1856dc5b9/bip-0038.mediawiki)

Permitted Bitcoin Improvement Proposal URLs must anchor to a specific commit, and so must match this regular expression:

```regex
^(https://github.com/bitcoin/bips/blob/[0-9a-f]{40}/bip-[0-9]+\.mediawiki)$
```

### National Vulnerability Database (NVD)

Links to the Common Vulnerabilities and Exposures (CVE) system as published by the National Institute of Standards and Technology (NIST) may be included, provided they are qualified by the date of the most recent change, using the following syntax:

```markdown
[CVE-2023-29638 (2023-10-17T10:14:15)](https://nvd.nist.gov/vuln/detail/CVE-2023-29638)
```

Which renders to:

[CVE-2023-29638 (2023-10-17T10:14:15)](https://nvd.nist.gov/vuln/detail/CVE-2023-29638)

### Chain Agnostic Improvement Proposals (CAIPs)

Links to a Chain Agnostic Improvement Proposals (CAIPs) specification may be included using normal markdown syntax, such as:

```markdown
[CAIP 10](https://github.com/ChainAgnostic/CAIPs/blob/5dd3a2f541d399a82bb32590b52ca4340b09f08b/CAIPs/caip-10.md)
```

Which renders to:

[CAIP 10](https://github.com/ChainAgnostic/CAIPs/blob/5dd3a2f541d399a82bb32590b52ca4340b09f08b/CAIPs/caip-10.md)

Permitted Chain Agnostic URLs must anchor to a specific commit, and so must match this regular expression:

```regex
^(https://github.com/ChainAgnostic/CAIPs/blob/[0-9a-f]{40}/CAIPs/caip-[0-9]+\.md)$
```

### Ethereum Yellow Paper

Links to the Ethereum Yellow Paper may be included using normal markdown syntax, such as:

```markdown
[Ethereum Yellow Paper](https://github.com/ethereum/yellowpaper/blob/9c601d6a58c44928d4f2b837c0350cec9d9259ed/paper.pdf)
```

Which renders to:

[Ethereum Yellow Paper](https://github.com/ethereum/yellowpaper/blob/9c601d6a58c44928d4f2b837c0350cec9d9259ed/paper.pdf)

Permitted Yellow Paper URLs must anchor to a specific commit, and so must match this regular expression:

```regex
^(https://github\.com/ethereum/yellowpaper/blob/[0-9a-f]{40}/paper\.pdf)$
```

### Execution Client Specification Tests

Links to the Ethereum Execution Client Specification Tests may be included using normal markdown syntax, such as:

```markdown
[Ethereum Execution Client Specification Tests](https://github.com/ethereum/execution-spec-tests/blob/d5a3188f122912e137aa2e21ed2a1403e806e424/README.md)
```

Which renders to:

[Ethereum Execution Client Specification Tests](https://github.com/ethereum/execution-spec-tests/blob/d5a3188f122912e137aa2e21ed2a1403e806e424/README.md)

Permitted Execution Client Specification Tests URLs must anchor to a specific commit, and so must match this regular expression:

```regex
^(https://github.com/ethereum/execution-spec-tests/(blob|commit)/[0-9a-f]{40}/.*|https://github.com/ethereum/execution-spec-tests/tree/[0-9a-f]{40}/.*)$
```

### Digital Object Identifier System

Links qualified with a Digital Object Identifier (DOI) may be included using the following syntax:

````markdown
This is a sentence with a footnote.[^1]

[^1]:
    ```csl-json
    {
      &quot;type&quot;: &quot;article&quot;,
      &quot;id&quot;: 1,
      &quot;author&quot;: [
        {
          &quot;family&quot;: &quot;Jameson&quot;,
          &quot;given&quot;: &quot;Hudson&quot;
        }
      ],
      &quot;DOI&quot;: &quot;00.0000/a00000-000-0000-y&quot;,
      &quot;title&quot;: &quot;An Interesting Article&quot;,
      &quot;original-date&quot;: {
        &quot;date-parts&quot;: [
          [2022, 12, 31]
        ]
      },
      &quot;URL&quot;: &quot;https://sly-hub.invalid/00.0000/a00000-000-0000-y&quot;,
      &quot;custom&quot;: {
        &quot;additional-urls&quot;: [
          &quot;https://example.com/an-interesting-article.pdf&quot;
        ]
      }
    }
    ```
````

Which renders to:

&lt;!-- markdownlint-capture --&gt;
&lt;!-- markdownlint-disable code-block-style --&gt;

This is a sentence with a footnote.[^1]

[^1]:
    ```csl-json
    {
      &quot;type&quot;: &quot;article&quot;,
      &quot;id&quot;: 1,
      &quot;author&quot;: [
        {
          &quot;family&quot;: &quot;Jameson&quot;,
          &quot;given&quot;: &quot;Hudson&quot;
        }
      ],
      &quot;DOI&quot;: &quot;00.0000/a00000-000-0000-y&quot;,
      &quot;title&quot;: &quot;An Interesting Article&quot;,
      &quot;original-date&quot;: {
        &quot;date-parts&quot;: [
          [2022, 12, 31]
        ]
      },
      &quot;URL&quot;: &quot;https://sly-hub.invalid/00.0000/a00000-000-0000-y&quot;,
      &quot;custom&quot;: {
        &quot;additional-urls&quot;: [
          &quot;https://example.com/an-interesting-article.pdf&quot;
        ]
      }
    }
    ```

&lt;!-- markdownlint-restore --&gt;

See the [Citation Style Language Schema](https://resource.citationstyles.org/schema/v1.0/input/json/csl-data.json) for the supported fields. In addition to passing validation against that schema, references must include a DOI and at least one URL.

The top-level URL field must resolve to a copy of the referenced document which can be viewed at zero cost. Values under `additional-urls` must also resolve to a copy of the referenced document, but may charge a fee.

### Execution API Specification

Links to the Ethereum Execution API Specification may be included using normal markdown syntax, such as:

```markdown
[Ethereum Execution API Specification](https://github.com/ethereum/execution-apis/blob/dd00287101e368752ba264950585dde4b61cdc17/README.md)
```

Which renders to:

[Ethereum Execution API Specification](https://github.com/ethereum/execution-apis/blob/dd00287101e368752ba264950585dde4b61cdc17/README.md)

Permitted Execution API Specification URLs must anchor to a specific commit, and so must match this regular expression:

```regex
^(https://github.com/ethereum/execution-apis/(blob|commit)/[0-9a-f]{40}/.*|https://github.com/ethereum/execution-apis/tree/[0-9a-f]{40}/.*)$
```

## Linking to other EIPs

References to other EIPs should follow the format `EIP-N` where `N` is the EIP number you are referring to.  Each EIP that is referenced in an EIP **MUST** be accompanied by a relative markdown link the first time it is referenced, and **MAY** be accompanied by a link on subsequent references.  The link **MUST** always be done via relative paths so that the links work in this GitHub repository, forks of this repository, the main EIPs site, mirrors of the main EIP site, etc.  For example, you would link to this EIP as `./eip-1.md`.

## Auxiliary Files

Images, diagrams and auxiliary files should be included in a subdirectory of the `assets` folder for that EIP as follows: `assets/eip-N` (where **N** is to be replaced with the EIP number). When linking to an image in the EIP, use relative links such as `../assets/eip-1/image.png`. Prefer SVG diagrams, then PNG, and finally everything else.

## Transferring EIP Ownership

It occasionally becomes necessary to transfer ownership of EIPs to a new champion. In general, we&apos;d like to retain the original author as a co-author of the transferred EIP, but that&apos;s really up to the original author. A good reason to transfer ownership is because the original author no longer has the time or interest in updating it or following through with the EIP process, or has fallen off the face of the &apos;net (i.e. is unreachable or isn&apos;t responding to email). A bad reason to transfer ownership is because you don&apos;t agree with the direction of the EIP. We try to build consensus around an EIP, but if that&apos;s not possible, you can always submit a competing EIP.

If you are interested in assuming ownership of an EIP, send a message asking to take over, addressed to both the original author and the EIP editor. If the original author doesn&apos;t respond to the email in a timely manner, the EIP editor will make a unilateral decision (it&apos;s not like such decisions can&apos;t be reversed :)).

## EIP Editors

The current EIP editors are

- Matt Garnett (@lightclient)
- Sam Wilson (@SamWilsn)
- Zainan Victor Zhou (@xinbenlv)
- Gajinder Singh (@g11tech)
- Jochem Brouwer (@jochem-brouwer)

Emeritus EIP editors are

- Alex Beregszaszi (@axic)
- Casey Detrio (@cdetrio)
- Gavin John (@Pandapip1)
- Greg Colvin (@gcolvin)
- Hudson Jameson (@Souptacular)
- Martin Becze (@wanderer)
- Micah Zoltu (@MicahZoltu)
- Nick Johnson (@arachnid)
- Nick Savers (@nicksavers)
- Vitalik Buterin (@vbuterin)

If you would like to become an EIP editor, please check [EIP-5069](./eip-5069.md).

## EIP Editor Responsibilities

For each new EIP that comes in, an editor does the following:

- Read the EIP to check if it is ready: sound and complete. The ideas must make technical sense, even if they don&apos;t seem likely to get to final status.
- The title should accurately describe the content.
- Check the EIP for language (spelling, grammar, sentence structure, etc.), markup (GitHub flavored Markdown), code style

If the EIP isn&apos;t ready, the editor will send it back to the author for revision, with specific instructions.

Once the EIP is ready for the repository, the EIP editor will:

- Assign an EIP number (generally incremental; editors can reassign if number sniping is suspected)
- Merge the corresponding [pull request](https://github.com/ethereum/EIPs/pulls)
- Send a message back to the EIP author with the next step.

Many EIPs are written and maintained by developers with write access to the Ethereum codebase. The EIP editors monitor EIP changes, and correct any structure, grammar, spelling, or markup mistakes we see.

The editors don&apos;t pass judgment on EIPs. We merely do the administrative &amp; editorial part.

## Style Guide

### Titles

The `title` field in the preamble:

- Should be in title case.
- Should not include the word &quot;standard&quot; or any variation thereof; and
- Should not include the EIP&apos;s number.

### Descriptions

The `description` field in the preamble:

- Should be in sentence case.
- Should not include the word &quot;standard&quot; or any variation thereof; and
- Should not include the EIP&apos;s number.

### EIP numbers

When referring to an EIP with a `category` of `ERC`, it must be written in the hyphenated form `ERC-X` where `X` is that EIP&apos;s assigned number. When referring to EIPs with any other `category`, it must be written in the hyphenated form `EIP-X` where `X` is that EIP&apos;s assigned number.

### RFC 2119 and RFC 8174

EIPs are encouraged to follow [RFC 2119](https://www.ietf.org/rfc/rfc2119.html) and [RFC 8174](https://www.ietf.org/rfc/rfc8174.html) for terminology and to insert the following at the beginning of the Specification section:

&gt; The key words &quot;MUST&quot;, &quot;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.

Don&apos;t use RFC 2119 keywords (all-caps SHOULD/MUST/etc.) outside of the specification section.

## History

This document was derived heavily from [Bitcoin&apos;s BIP-0001](https://github.com/bitcoin/bips) written by Amir Taaki which in turn was derived from [Python&apos;s PEP-0001](https://peps.python.org/). In many places text was simply copied and modified. Although the PEP-0001 text was written by Barry Warsaw, Jeremy Hylton, and David Goodger, they are not responsible for its use in the Ethereum Improvement Process, and should not be bothered with technical questions specific to Ethereum or the EIP. Please direct all comments to the EIP editors.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 27 Oct 2015 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/eip-1</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/eip-1</guid>
      </item>
    
      <item>
        <title>Token Standard</title>
        <category>Standards Track/ERC</category>
        
        <description>## Simple Summary

A standard interface for tokens.


## Abstract

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.


## Motivation

A standard interface allows any tokens on Ethereum to be re-used by other applications: from wallets to decentralized exchanges.


## Specification

## Token
### Methods

**NOTES**:
 - The following specifications use syntax from Solidity `0.4.17` (or above)
 - Callers MUST handle `false` from `returns (bool success)`.  Callers MUST NOT assume that `false` is never returned!


#### name

Returns the name of the token - e.g. `&quot;MyToken&quot;`.

OPTIONAL - This method can be used to improve usability,
but interfaces and other contracts MUST NOT expect these values to be present.


``` js
function name() public view returns (string)
```


#### symbol

Returns the symbol of the token. E.g. &quot;HIX&quot;.

OPTIONAL - This method can be used to improve usability,
but interfaces and other contracts MUST NOT expect these values to be present.

``` js
function symbol() public view returns (string)
```



#### decimals

Returns the number of decimals the token uses - e.g. `8`, means to divide the token amount by `100000000` to get its user representation.

OPTIONAL - This method can be used to improve usability,
but interfaces and other contracts MUST NOT expect these values to be present.

``` js
function decimals() public view returns (uint8)
```


#### totalSupply

Returns the total token supply.

``` js
function totalSupply() public view returns (uint256)
```



#### balanceOf

Returns the account balance of another account with address `_owner`.

``` js
function balanceOf(address _owner) public view returns (uint256 balance)
```



#### transfer

Transfers `_value` amount of tokens to address `_to`, and MUST fire the `Transfer` event.
The function SHOULD `throw` if the message caller&apos;s account balance does not have enough tokens to spend.

*Note* Transfers of 0 values MUST be treated as normal transfers and fire the `Transfer` event.

``` js
function transfer(address _to, uint256 _value) public returns (bool success)
```



#### transferFrom

Transfers `_value` amount of tokens from address `_from` to address `_to`, and MUST fire the `Transfer` event.

The `transferFrom` 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/or to charge fees in sub-currencies.
The function SHOULD `throw` unless the `_from` account has deliberately authorized the sender of the message via some mechanism.

*Note* Transfers of 0 values MUST be treated as normal transfers and fire the `Transfer` event.

``` js
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
```



#### approve

Allows `_spender` to withdraw from your account multiple times, up to the `_value` amount. If this function is called again it overwrites the current allowance with `_value`.

**NOTE**: To prevent attack vectors like the one [described here](https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/) and discussed [here](https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729),
clients SHOULD make sure to create user interfaces in such a way that they set the allowance first to `0` before setting it to another value for the same spender.
THOUGH The contract itself shouldn&apos;t enforce it, to allow backwards compatibility with contracts deployed before

``` js
function approve(address _spender, uint256 _value) public returns (bool success)
```


#### allowance

Returns the amount which `_spender` is still allowed to withdraw from `_owner`.

``` js
function allowance(address _owner, address _spender) public view returns (uint256 remaining)
```



### Events


#### Transfer

MUST trigger when tokens are transferred, including zero value transfers.

A token contract which creates new tokens SHOULD trigger a Transfer event with the `_from` address set to `0x0` when tokens are created.

``` js
event Transfer(address indexed _from, address indexed _to, uint256 _value)
```



#### Approval

MUST trigger on any successful call to `approve(address _spender, uint256 _value)`.

``` js
event Approval(address indexed _owner, address indexed _spender, uint256 _value)
```



## Implementation

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.

#### Example implementations are available at
- [OpenZeppelin implementation](../assets/eip-20/OpenZeppelin-ERC20.sol)
- [ConsenSys implementation](../assets/eip-20/Consensys-EIP20.sol)


## History

Historical links related to this standard:

- Original proposal from Vitalik Buterin: https://github.com/ethereum/wiki/wiki/Standardized_Contract_APIs/499c882f3ec123537fc2fccd57eaa29e6032fe4a
- Reddit discussion: https://www.reddit.com/r/ethereum/comments/3n8fkn/lets_talk_about_the_coin_standard/
- Original Issue #20: https://github.com/ethereum/EIPs/issues/20



## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 19 Nov 2015 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-20</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-20</guid>
      </item>
    
      <item>
        <title>Mixed-case checksum address encoding</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/eips/issues/55</comments>
        
        <description># Specification

Code:

``` python
import eth_utils


def checksum_encode(addr): # Takes a 20-byte binary address as input
    hex_addr = addr.hex()
    checksummed_buffer = &quot;&quot;

    # Treat the hex address as ascii/utf-8 for keccak256 hashing
    hashed_address = eth_utils.keccak(text=hex_addr).hex()

    # Iterate over each character in the hex address
    for nibble_index, character in enumerate(hex_addr):

        if character in &quot;0123456789&quot;:
            # We can&apos;t upper-case the decimal digits
            checksummed_buffer += character
        elif character in &quot;abcdef&quot;:
            # Check if the corresponding hex digit (nibble) in the hash is 8 or higher
            hashed_address_nibble = int(hashed_address[nibble_index], 16)
            if hashed_address_nibble &gt; 7:
                checksummed_buffer += character.upper()
            else:
                checksummed_buffer += character
        else:
            raise eth_utils.ValidationError(
                f&quot;Unrecognized hex character {character!r} at position {nibble_index}&quot;
            )

    return &quot;0x&quot; + checksummed_buffer


def test(addr_str):
    addr_bytes = eth_utils.to_bytes(hexstr=addr_str)
    checksum_encoded = checksum_encode(addr_bytes)
    assert checksum_encoded == addr_str, f&quot;{checksum_encoded} != expected {addr_str}&quot;


test(&quot;0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed&quot;)
test(&quot;0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359&quot;)
test(&quot;0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB&quot;)
test(&quot;0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb&quot;)

```

In English, convert the address to hex, but if the `i`th digit is a letter (ie. it&apos;s one of `abcdef`) print it in uppercase if the `4*i`th bit of the hash of the lowercase hexadecimal address is 1 otherwise print it in lowercase.

# Rationale

Benefits:
- Backwards compatible with many hex parsers that accept mixed case, allowing it to be easily introduced over time
- Keeps the length at 40 characters
- 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.

# Implementation

In javascript:

```js
const createKeccakHash = require(&apos;keccak&apos;)

function toChecksumAddress (address) {
  address = address.toLowerCase().replace(&apos;0x&apos;, &apos;&apos;)
  var hash = createKeccakHash(&apos;keccak256&apos;).update(address).digest(&apos;hex&apos;)
  var ret = &apos;0x&apos;

  for (var i = 0; i &lt; address.length; i++) {
    if (parseInt(hash[i], 16) &gt;= 8) {
      ret += address[i].toUpperCase()
    } else {
      ret += address[i]
    }
  }

  return ret
}
```

```
&gt; toChecksumAddress(&apos;0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359&apos;)
&apos;0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359&apos;
```

Note that the input to the Keccak256 hash is the lowercase hexadecimal string (i.e. the hex address encoded as ASCII):

```
    var hash = createKeccakHash(&apos;keccak256&apos;).update(Buffer.from(address.toLowerCase(), &apos;ascii&apos;)).digest()
```

# Test Cases

```
# All caps
0x52908400098527886E0F7030069857D2E4169EE7
0x8617E340B3D01FA5F11F306F4090FD50E238070D
# All Lower
0xde709f2102306220921060314715629080e2fb77
0x27b1fdb04752bbc536007a920d24acb045561c26
# Normal
0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed
0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359
0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB
0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb
```
</description>
        <pubDate>Thu, 14 Jan 2016 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-55</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-55</guid>
      </item>
    
      <item>
        <title>URI Scheme with Metadata, Value and Bytecode</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/67</comments>
        
        <description>## Abstract

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.

## Motivation

Imagine these scenarios:

    * 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.
    * 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.
    * 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.
    * A dapp in Mist wants to simply ask the user to sign a transaction with a specific ABI in a single call.


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.

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&apos;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.

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.

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.

## Specification

If we follow the bitcoin standard, the result would be:

```
 ethereum:&lt;address&gt;[?value=&lt;value&gt;][?gas=&lt;suggestedGas&gt;][?data=&lt;bytecode&gt;]
```

Other data could be added, but ideally the client should take them from elsewhere in the blockchain, so instead of having a `label` or a `message` to be displayed to the users, these should be read from an identity system or metadata on the transaction itself.

### Example 1

Clicking this link would open a transaction that would try to send _5 unicorns_ to address _deadbeef_. The user would then simply approve, based on each wallet UI.

```
 ethereum:0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7?gas=100000&amp;data=0xa9059cbb00000000000000000000000000000000000000000000000000000000deadbeef0000000000000000000000000000000000000000000000000000000000000005
```

#### Without Bytecode

Alternatively, the bytecode could be generated by the client and the request would be in plain text:

```
 ethereum:&lt;address&gt;[?value=&lt;value&gt;][?gas=&lt;suggestedGas&gt;][?function=nameOfFunction(param)]
```

### Example 2

This is the same function as above, to send 5 unicorns from he sender to _deadbeef_, but now with a more readable function, which the client converts to bytecode.

```
 ethereum:0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7?gas=100000&amp;function=transfer(address 0xdeadbeef, uint 5)
```

## Rationale

TODO

## Security Considerations

TODO

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 17 Feb 2016 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-67</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-67</guid>
      </item>
    
      <item>
        <title>Ethereum Domain Name Service - Specification</title>
        <category>Standards Track/ERC</category>
        
        <description># Abstract

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.

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 &apos;vitalik.wallet&apos; or &apos;www.mysite.swarm&apos;, 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 &apos;mysite.swarm&apos; 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.
# Motivation

Existing [specifications](https://github.com/ethereum/wiki/wiki/Registrar-ABI) and [implementations](https://ethereum.gitbooks.io/frontier-guide/content/registrar_services.html) for name resolution in Ethereum provide basic functionality, but suffer several shortcomings that will significantly limit their long-term usefulness:
- A single global namespace for all names with a single &apos;centralised&apos; resolver.
- Limited or no support for delegation and sub-names/sub-domains.
- Only one record type, and no support for associating multiple copies of a record with a domain.
- Due to a single global implementation, no support for multiple different name allocation systems.
- Conflation of responsibilities: Name resolution, registration, and whois information.

Use-cases that these features would permit include:
- Support for subnames/sub-domains - eg, live.mysite.tld and forum.mysite.tld.
- Multiple services under a single name, such as a DApp hosted in Swarm, a Whisper address, and a mail server.
- Support for DNS record types, allowing blockchain hosting of &apos;legacy&apos; 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.
- DNS gateways, exposing ENS domains via the Domain Name Service, providing easier means for legacy clients to resolve and connect to blockchain services.

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.

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.

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.

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.
# Specification
## Overview

The ENS system comprises three main parts:
- The ENS registry
- Resolvers
- Registrars

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.

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.

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.

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.

For example, suppose you wish to find the address of the token contract associated with &apos;beercoin.eth&apos;. First, get the resolver:

```javascript
var node = namehash(&quot;beercoin.eth&quot;);
var resolver = ens.resolver(node);
```

Then, ask the resolver for the address for the contract:

```javascript
var address = resolver.addr(node);
```

Because the `namehash` 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.
## Name Syntax

ENS names must conform to the following syntax:

&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://unicode.org/reports/tr46/)
&lt;/pre&gt;

In short, names consist of a series of dot-separated labels. Each label must be a valid normalised label as described in [UTS46](https://unicode.org/reports/tr46/) with the options `transitional=false` and `useSTD3AsciiRules=true`. For Javascript implementations, a [library](https://www.npmjs.com/package/idna-uts46) is available that normalises and checks names.

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.

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.

## namehash algorithm

Before being used in ENS, names are hashed using the &apos;namehash&apos; 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 &apos;node&apos;.

Pseudocode for the namehash algorithm is as follows:

```
def namehash(name):
  if name == &apos;&apos;:
    return &apos;\0&apos; * 32
  else:
    label, _, remainder = name.partition(&apos;.&apos;)
    return sha3(namehash(remainder) + sha3(label))
```

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 &apos;0&apos; bytes. Thus, &apos;mysite.swarm&apos; is processed as follows:

```
node = &apos;\0&apos; * 32
node = sha3(node + sha3(&apos;swarm&apos;))
node = sha3(node + sha3(&apos;mysite&apos;))
```

Implementations should conform to the following test vectors for namehash:

    namehash(&apos;&apos;) = 0x0000000000000000000000000000000000000000000000000000000000000000
    namehash(&apos;eth&apos;) = 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae
    namehash(&apos;foo.eth&apos;) = 0xde9b09fd7c5f901e23a3f19fecc54828e9c848539801e86591bd9801b019f84f

## Registry specification

The ENS registry contract exposes the following functions:

```solidity
function owner(bytes32 node) constant returns (address);
```

Returns the owner (registrar) of the specified node.

```solidity
function resolver(bytes32 node) constant returns (address);
```

Returns the resolver for the specified node.

```solidity
function ttl(bytes32 node) constant returns (uint64);
```

Returns the time-to-live (TTL) of the node; that is, the maximum duration for which a node&apos;s information may be cached.

```solidity
function setOwner(bytes32 node, address owner);
```

Transfers ownership of a node to another registrar. This function may only be called by the current owner of `node`. A successful call to this function logs the event `Transfer(bytes32 indexed, address)`.

```solidity
function setSubnodeOwner(bytes32 node, bytes32 label, address owner);
```

Creates a new node, `sha3(node, label)` and sets its owner to `owner`, or updates the node with a new owner if it already exists. This function may only be called by the current owner of `node`. A successful call to this function logs the event `NewOwner(bytes32 indexed, bytes32 indexed, address)`.

```solidity
function setResolver(bytes32 node, address resolver);
```

Sets the resolver address for `node`. This function may only be called by the owner of `node`. A successful call to this function logs the event `NewResolver(bytes32 indexed, address)`.

```solidity
function setTTL(bytes32 node, uint64 ttl);
```

Sets the TTL for a node. A node&apos;s TTL applies to the &apos;owner&apos; and &apos;resolver&apos; records in the registry, as well as to any information returned by the associated resolver.
## Resolver specification

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.

Resolvers have one mandatory function:

```solidity
function supportsInterface(bytes4 interfaceID) constant returns (bool)
```

The `supportsInterface` function is documented in [EIP-165](./eip-165.md), 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 `true` for `supportsInterface()`, it must implement the functions specified in that interface.

`supportsInterface` must always return true for `0x01ffc9a7`, which is the interface ID of `supportsInterface` itself.

 Currently standardised resolver interfaces are specified in the table below.

The following interfaces are defined:

| Interface name | Interface hash | Specification |
| --- | --- | --- |
| `addr` | 0x3b3b57de | [Contract address](#addr) |
| `name`      | 0x691f3431   | #181    |
| `ABI`       | 0x2203ab56   | #205    |
| `pubkey`    | 0xc8690233   | #619    |

EIPs may define new interfaces to be added to this registry.

### &lt;a name=&quot;addr&quot;&gt;&lt;/a&gt;Contract Address Interface

Resolvers wishing to support contract address resources must provide the following function:

```solidity
function addr(bytes32 node) constant returns (address);
```

If the resolver supports `addr` lookups but the requested node does not have an addr record, the resolver MUST return the zero address.

Clients resolving the `addr` 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.

Changes to an address MUST trigger the following event:

```solidity
event AddrChanged(bytes32 indexed node, address a);
```
# Appendix A: Registry Implementation

```solidity
contract ENS {
    struct Record {
        address owner;
        address resolver;
        uint64 ttl;
    }

    mapping(bytes32=&gt;Record) records;

    event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
    event Transfer(bytes32 indexed node, address owner);
    event NewResolver(bytes32 indexed node, address resolver);

    modifier only_owner(bytes32 node) {
        if(records[node].owner != msg.sender) throw;
        _
    }

    function ENS(address owner) {
        records[0].owner = owner;
    }

    function owner(bytes32 node) constant returns (address) {
        return records[node].owner;
    }

    function resolver(bytes32 node) constant returns (address) {
        return records[node].resolver;
    }

    function ttl(bytes32 node) constant returns (uint64) {
        return records[node].ttl;
    }

    function setOwner(bytes32 node, address owner) only_owner(node) {
        Transfer(node, owner);
        records[node].owner = owner;
    }

    function setSubnodeOwner(bytes32 node, bytes32 label, address owner) only_owner(node) {
        var subnode = sha3(node, label);
        NewOwner(node, label, owner);
        records[subnode].owner = owner;
    }

    function setResolver(bytes32 node, address resolver) only_owner(node) {
        NewResolver(node, resolver);
        records[node].resolver = resolver;
    }

    function setTTL(bytes32 node, uint64 ttl) only_owner(node) {
        NewTTL(node, ttl);
        records[node].ttl = ttl;
    }
}
```
# Appendix B: Sample Resolver Implementations
### Built-in resolver

The simplest possible resolver is a contract that acts as its own name resolver by implementing the contract address resource profile:

```solidity
contract DoSomethingUseful {
    // Other code

    function addr(bytes32 node) constant returns (address) {
        return this;
    }

    function supportsInterface(bytes4 interfaceID) constant returns (bool) {
        return interfaceID == 0x3b3b57de || interfaceID == 0x01ffc9a7;
    }

    function() {
        throw;
    }
}
```

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 &apos;throw&apos; on unknown function calls may interfere with normal operation of some types of contract.

### Standalone resolver

A basic resolver that implements the contract address profile, and allows only its owner to update records:

```solidity
contract Resolver {
    event AddrChanged(bytes32 indexed node, address a);

    address owner;
    mapping(bytes32=&gt;address) addresses;

    modifier only_owner() {
        if(msg.sender != owner) throw;
        _
    }

    function Resolver() {
        owner = msg.sender;
    }

    function addr(bytes32 node) constant returns(address) {
        return addresses[node];    
    }

    function setAddr(bytes32 node, address addr) only_owner {
        addresses[node] = addr;
        AddrChanged(node, addr);
    }

    function supportsInterface(bytes4 interfaceID) constant returns (bool) {
        return interfaceID == 0x3b3b57de || interfaceID == 0x01ffc9a7;
    }

    function() {
        throw;
    }
}
```

After deploying this contract, use it by updating the ENS registry to reference this contract for a name, then calling `setAddr()` with the same node to set the contract address it will resolve to.
### Public resolver

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:

```solidity
contract PublicResolver {
    event AddrChanged(bytes32 indexed node, address a);
    event ContentChanged(bytes32 indexed node, bytes32 hash);

    ENS ens;
    mapping(bytes32=&gt;address) addresses;

    modifier only_owner(bytes32 node) {
        if(ens.owner(node) != msg.sender) throw;
        _
    }

    function PublicResolver(address ensAddr) {
        ens = ENS(ensAddr);
    }

    function addr(bytes32 node) constant returns (address ret) {
        ret = addresses[node];
    }

    function setAddr(bytes32 node, address addr) only_owner(node) {
        addresses[node] = addr;
        AddrChanged(node, addr);
    }

    function supportsInterface(bytes4 interfaceID) constant returns (bool) {
        return interfaceID == 0x3b3b57de || interfaceID == 0x01ffc9a7;
    }

    function() {
        throw;
    }
}
```
# Appendix C: Sample Registrar Implementation

This registrar allows users to register names at no cost if they are the first to request them.

```solidity
contract FIFSRegistrar {
    ENS ens;
    bytes32 rootNode;

    function FIFSRegistrar(address ensAddr, bytes32 node) {
        ens = ENS(ensAddr);
        rootNode = node;
    }

    function register(bytes32 subnode, address owner) {
        var node = sha3(rootNode, subnode);
        var currentOwner = ens.owner(node);
        if(currentOwner != 0 &amp;&amp; currentOwner != msg.sender)
            throw;

        ens.setSubnodeOwner(rootNode, subnode, owner);
    }
}
```
</description>
        <pubDate>Mon, 04 Apr 2016 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-137</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-137</guid>
      </item>
    
      <item>
        <title>Initial ENS Hash Registrar</title>
        <category>Standards Track/ERC</category>
        
        <description>## Contents
- Abstract
- Motivations
- Specification
  - Initial restrictions
  - Name format for hash registration
  - Auctioning names
  - Deeds
  - Deployment and Upgrade process
  - Registrar Interface
- Rationale
  - Not committing to a permanent registrar at the outset
  - Valid names &gt;= 7 characters
  - Restricting TLD to `.eth`
  - Holding ether as collateral
- Prior work

&lt;!-- /MarkdownTOC --&gt;

## Abstract

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 [here](https://github.com/ethereum/ens/blob/mainnet/contracts/HashRegistrarSimplified.sol).

For more background, refer to [EIP-137](./eip-137.md).

&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.
&gt;
&gt; \- EIP 137

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.

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 `.eth` top level domain, and subdomain shorter than 7 characters in length disallowed. This specification largely describes @alexvandesande and @arachnid&apos;s [hash registrar implementation](https://github.com/ethereum/ens/blob/mainnet/contracts/HashRegistrarSimplified.sol) in order to facilitate discussion.

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.

## Motivations

The following factors should be considered in order to optimize for adoption of the ENS, and good governance of the Initial Registrar&apos;s namespace.

**Upgradability:** 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.

**Effective allocation:** 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.

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.

**Security:** The registrar will hold a balance of ether without an explicit limit. It must be designed securely.

**Simplicity:** 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.

**Adoption:** 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.

## Specification

### Initial restrictions

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.

During the initial two year period, the available name space will be restricted to the `.eth` TLD.

This restriction is enforced by the owner of the ENS root node who should not assign any nodes other than `.eth` to the Initial Registrar. The ENS&apos;s root node should be controlled by multiple parties using a multisig contract.

The Initial Registrar will also prohibit registration of names 6 characters or less in length.

### Name format for hash registration

Names submitted to the initial registrar must be hashed using Ethereum&apos;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.

For example, in order to register `abcdefg.eth`, one should submit `sha3(&apos;abcdefg&apos;)`, not `sha3(sha3(0, &apos;eth&apos;), &apos;abcdefg&apos;)`.

### Auctioning names

The registrar will allocate the available names through a Vickrey auction:

&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.
&gt;
&gt; \- [Vickrey Auction, Wikipedia](https://en.wikipedia.org/wiki/Vickrey_auction)

The auction lifecycle of a name has 5 possible states, or Modes.

1. **Not-yet-available:** The majority of names will be initially unavailable for auction, and will become available some time during the 8 weeks after launch.
2. **Open:** The earliest availability for a name is determined by the most significant byte of its sha3 hash. `0x00` would become available immediately, `0xFF` 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.
3. **Auction:** 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 `sha3(bytes32 hash, address owner, uint value, bytes32 salt)`. The bidder may obfuscate the true bid value by sending a greater amount of ether.
4. **Reveal:** 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.
5. **Owned:** After the reveal period has finished, the winning bidder must submit a transaction to finalize the auction, which then calls the ENS&apos;s `setSubnodeOwner` function, recording the winning bidder&apos;s address as the owner of the hash of the name.

The following table outlines important parameters which define the Registrar&apos;s auction mechanism.

#### Registrar Parameters

|        Name        |                                            Description                                             |   Value    |
|--------------------|----------------------------------------------------------------------------------------------------|------------|
| totalAuctionLength | The full time period from start of auction to end of the reveal period.                            | 5 days     |
| revealPeriod       | The length of the time period during which bidding is no longer allowed, and bids must be revealed. | 48 hours   |
| launchLength       | The time period during which all names will become available for auction.                          | 8 weeks    |
| minPrice           | The minimum amount of ether which must be locked up in exchange for ownership of a name.           | 0.01 ether |

### Deeds

The Initial Registrar contract does not hold a balance itself. All ether sent to the Registrar will be held in a separate `Deed` 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.

A deed for an owned name may be transferred to another account by its owner, thus transferring ownership and control of the name.

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.

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.

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.

#### Refund schedule

| Reason for Deed closure | Refund Recipient | Refund Percentage |
| --- | --- | --- |
| A valid non-winning bid is revealed. | Bidder | 99.5% |
| A bid submitted after the auction period is revealed. | Bidder | 99.5% |
| An otherwise valid bid is revealed on an owned name. &lt;sup&gt;1&lt;/sup&gt; | Bidder | 0.5% |
| An expired sealed bid is cancelled. &lt;sup&gt;2&lt;/sup&gt; | Canceler | 0.5% |
| A registered hash is reported as invalid. &lt;sup&gt;3&lt;/sup&gt; | Reporter | 50% |
| A registered hash is reported as invalid. &lt;sup&gt;3&lt;/sup&gt; | Owner | 50% |

##### Notes:

1. 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.
2. A bid which remains sealed after more than 2 weeks and 5 days may be cancelled by anyone to collect a small reward.
2. 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.

### Deployment and Upgrade process

The Initial Registrar requires the ENS&apos;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&apos;s address as owner of the `eth` node.

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:
1. The Permanent Registrar contract will be deployed.
2. The multisig account owning the root node in the ENS will assign ownership of the `.eth` node to the Permanent Registrar.
3. Owners of hashes in the Initial Registrar will be responsible for registering their deeds to the Permanent Registrar. A couple options are considered here:
   1. Require owners to transfer their ownership prior to a cutoff date in order to maintain ownership and/or continue name resolution services.
   2. Have the Permanent Registrar query the Initial Registrar for ownership if it is lacking an entry.

### Planned deactivation

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.

### Registrar Interface

`function state(bytes32 _hash) constant returns (Mode)`
- Implements a state machine returning the current state of a name

`function entries(bytes32 _hash) constant returns (Mode, address, uint, uint, uint)`
- Returns the following information regarding a registered name:
  * state
  * deed address
  * registration date
  * balance of the deed
  * highest value bid at auction

`function getAllowedTime(bytes32 _hash) constant returns (uint timestamp)`
- Returns the time at which the hash will no longer be in the initial `not-yet-available` state.

`function isAllowed(bytes32 _hash, uint _timestamp) constant returns (bool allowed)`
- Takes a hash and a time, returns true if and only if it has passed the initial `not-yet-available` state.

`function startAuction(bytes32 _hash);`
- Moves the state of a hash from Open to Auction. Throws if state is not Open.

`function startAuctions(bytes32[] _hashes);`
- 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.

`function shaBid(bytes32 hash, address owner, uint value, bytes32 salt) constant returns (bytes32 sealedBid);`
- 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.

`function newBid(bytes32 sealedBid);`
- 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.

`function startAuctionsAndBid(bytes32[] hashes, bytes32 sealedBid)`
- A utility function allowing a call to `startAuctions` followed by `newBid` in a single transaction.


`function unsealBid(bytes32 _hash, address _owner, uint _value, bytes32 _salt);`
- 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 `shaBid()` 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.

`function cancelBid(bytes32 seal);`
- Cancels an unrevealed bid according to the rules described in the notes on the refund schedule above.

`function finalizeAuction(bytes32 _hash);`

After the registration date has passed, this function can be called to finalize the auction, which then calls the ENS function `setSubnodeOwner()`  updating the ENS record to set the winning bidder as owner of the node.

`function transfer(bytes32 _hash, address newOwner);`
- 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.

`function releaseDeed(bytes32 _hash);`
- After some time, the owner can release the property and get their ether back.

`function invalidateName(string unhashedName);`
- 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.

`function eraseNode(bytes32[] labels)`
- 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 `foo.bar.eth` on a registrar that owns `.eth`, pass an array containing `[sha3(&apos;foo&apos;), sha3(&apos;bar&apos;)]`.

`function transferRegistrars(bytes32 _hash) onlyOwner(_hash);`
- 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.

## Rationale

### Starting with a temporary registrar

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.

### Valid names &gt;= 7 characters

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).

### Delayed release of names

A slower release allows for extra time to identify, and address any issues which may arise after launch.

### Restricting TLD to `.eth`

Choosing a single TLD helps to maximize network effects by focusing on one namespace.

A three letter TLD is a pattern made familiar by it&apos;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 [special-use domain name](https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml#special-use-domain).  A recent precedent for this is the [reservation of the `.onion` domain](https://tools.ietf.org/html/rfc7686).

### Holding ether as collateral

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.

## Prior work

This document borrows heavily from several sources:
- [EIP-137](./eip-137.md) outlines the initial implementation of the Registry Contract (ENS.sol) and associated Resolver contracts.
- [ERC-26](https://github.com/ethereum/EIPs/issues/26) was the first ERC to propose a name service at the contract layer
- @alexvandesande&apos;s current implementation of the [HashRegistrar](https://github.com/ethereum/ens/blob/mainnet/contracts/HashRegistrarSimplified.sol)

### Edits:
- 2016-10-26 Added link Alex&apos;s design in abstract
- 2016-11-01 change &apos;Planned deactivation&apos; to h3&apos;
- 2017-03-13 Update timelines for bidding and reveal periods

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 25 Oct 2016 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-162</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-162</guid>
      </item>
    
      <item>
        <title>Standard Interface Detection</title>
        <category>Standards Track/ERC</category>
        
        <description>## Simple Summary

Creates a standard method to publish and detect what interfaces a smart contract implements.

## Abstract

Herein, we standardize the following:

1. How interfaces are identified
2. How a contract will publish the interfaces it implements
3. How to detect if a contract implements ERC-165
4. How to detect if a contract implements any given interface

## Motivation

For some &quot;standard interfaces&quot; like [the ERC-20 token interface](./eip-20.md), 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.

## Specification

### How Interfaces are Identified

For this standard, an *interface* is a set of [function selectors as defined by the Ethereum ABI](https://solidity.readthedocs.io/en/develop/abi-spec.html#function-selector). This a subset of [Solidity&apos;s concept of interfaces](https://solidity.readthedocs.io/en/develop/abi-spec.html) and the  `interface` keyword definition which also defines return types, mutability and events.

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:

```solidity
pragma solidity ^0.4.20;

interface Solidity101 {
    function hello() external pure;
    function world(int) external pure;
}

contract Selector {
    function calculateSelector() public pure returns (bytes4) {
        Solidity101 i;
        return i.hello.selector ^ i.world.selector;
    }
}
```

Note: interfaces do not permit optional functions, therefore, the interface identity will not include them.

### How a Contract will Publish the Interfaces it Implements

A contract that is compliant with ERC-165 shall implement the following interface (referred as `ERC165.sol`):

```solidity
pragma solidity ^0.4.20;

interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

The interface identifier for this interface is `0x01ffc9a7`. You can calculate this by running `bytes4(keccak256(&apos;supportsInterface(bytes4)&apos;));` or using the `Selector` contract above.

Therefore the implementing contract will have a `supportsInterface` function that returns:

- `true` when `interfaceID` is `0x01ffc9a7` (EIP165 interface)
- `false` when `interfaceID` is `0xffffffff`
- `true` for any other `interfaceID` this contract implements
- `false` for any other `interfaceID`

This function must return a bool and use at most 30,000 gas.

Implementation note, there are several logical ways to implement this function. Please see the example implementations and the discussion on gas usage.

### How to Detect if a Contract Implements ERC-165

1. The source contract makes a `STATICCALL` to the destination address with input data: `0x01ffc9a701ffc9a700000000000000000000000000000000000000000000000000000000` and gas 30,000. This corresponds to `contract.supportsInterface(0x01ffc9a7)`.
2. If the call fails or return false, the destination contract does not implement ERC-165.
3. If the call returns true, a second call is made with input data `0x01ffc9a7ffffffff00000000000000000000000000000000000000000000000000000000`.
4. If the second call fails or returns true, the destination contract does not implement ERC-165.
5. Otherwise it implements ERC-165.

### How to Detect if a Contract Implements any Given Interface

1. If you are not sure if the contract implements ERC-165, use the above procedure to confirm.
2. If it does not implement ERC-165, then you will have to see what methods it uses the old-fashioned way.
3. If it implements ERC-165 then just call `supportsInterface(interfaceID)` to determine if it implements an interface you can use.

## Rationale

We tried to keep this specification as simple as possible. This implementation is also compatible with the current Solidity version.

## Backwards Compatibility

The mechanism described above (with `0xffffffff`) should work with most of the contracts previous to this standard to determine that they do not implement ERC-165.

Also [the ENS](./eip-137.md) already implements this EIP.

## Test Cases

Following is a contract that detects which interfaces other contracts implement. From @fulldecent and @jbaylina.

```solidity
pragma solidity ^0.4.20;

contract ERC165Query {
    bytes4 constant InvalidID = 0xffffffff;
    bytes4 constant ERC165ID = 0x01ffc9a7;

    function doesContractImplementInterface(address _contract, bytes4 _interfaceId) external view returns (bool) {
        uint256 success;
        uint256 result;

        (success, result) = noThrowCall(_contract, ERC165ID);
        if ((success==0)||(result==0)) {
            return false;
        }

        (success, result) = noThrowCall(_contract, InvalidID);
        if ((success==0)||(result!=0)) {
            return false;
        }

        (success, result) = noThrowCall(_contract, _interfaceId);
        if ((success==1)&amp;&amp;(result==1)) {
            return true;
        }
        return false;
    }

    function noThrowCall(address _contract, bytes4 _interfaceId) constant internal returns (uint256 success, uint256 result) {
        bytes4 erc165ID = ERC165ID;

        assembly {
                let x := mload(0x40)               // Find empty storage location using &quot;free memory pointer&quot;
                mstore(x, erc165ID)                // Place signature at beginning of empty storage
                mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature

                success := staticcall(
                                    30000,         // 30k gas
                                    _contract,     // To addr
                                    x,             // Inputs are stored at location x
                                    0x24,          // Inputs are 36 bytes long
                                    x,             // Store output over input (saves space)
                                    0x20)          // Outputs are 32 bytes long

                result := mload(x)                 // Load the result
        }
    }
}
```

## Implementation

This approach uses a `view` function implementation of `supportsInterface`. The execution cost is 586 gas for any input. But contract initialization requires storing each interface (`SSTORE` is 20,000 gas). The `ERC165MappingImplementation` contract is generic and reusable.

```solidity
pragma solidity ^0.4.20;

import &quot;./ERC165.sol&quot;;

contract ERC165MappingImplementation is ERC165 {
    /// @dev You must not set element 0xffffffff to true
    mapping(bytes4 =&gt; bool) internal supportedInterfaces;

    function ERC165MappingImplementation() internal {
        supportedInterfaces[this.supportsInterface.selector] = true;
    }

    function supportsInterface(bytes4 interfaceID) external view returns (bool) {
        return supportedInterfaces[interfaceID];
    }
}

interface Simpson {
    function is2D() external returns (bool);
    function skinColor() external returns (string);
}

contract Lisa is ERC165MappingImplementation, Simpson {
    function Lisa() public {
        supportedInterfaces[this.is2D.selector ^ this.skinColor.selector] = true;
    }

    function is2D() external returns (bool){}
    function skinColor() external returns (string){}
}
```

Following is a `pure` function implementation of `supportsInterface`. The worst-case execution cost is 236 gas, but increases linearly with a higher number of supported interfaces.

```solidity
pragma solidity ^0.4.20;

import &quot;./ERC165.sol&quot;;

interface Simpson {
    function is2D() external returns (bool);
    function skinColor() external returns (string);
}

contract Homer is ERC165, Simpson {
    function supportsInterface(bytes4 interfaceID) external view returns (bool) {
        return
          interfaceID == this.supportsInterface.selector || // ERC165
          interfaceID == this.is2D.selector
                         ^ this.skinColor.selector; // Simpson
    }

    function is2D() external returns (bool){}
    function skinColor() external returns (string){}
}
```

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).

## Version history
* 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 [#1640](https://github.com/ethereum/EIPs/pull/1640).

* EIP 165, finalized 2018-04-20 -- Original published version.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 23 Jan 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-165</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-165</guid>
      </item>
    
      <item>
        <title>Contract Ownership Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/173</comments>
        
        <description>## Abstract

This specification defines standard functions for owning or controlling a contract. 

An implementation allows reading the current owner (`owner() returns (address)`) and transferring ownership (`transferOwnership(address newOwner)`) along with a standardized event for when ownership is changed (`OwnershipTransferred(address indexed previousOwner, address indexed newOwner)`).

## Motivation

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.

Here are some examples of kinds of contracts and applications that can benefit from this standard:
1. Exchanges that buy/sell/auction ethereum contracts. This is only widely possible if there is a standard for getting the owner of a contract and transferring ownership.
2. Contract wallets that hold the ownership of contracts and that can transfer the ownership of contracts.
3. Contract registries. It makes sense for some registries to only allow the owners of contracts to add/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.
4. User interfaces that show and transfer ownership of contracts.

## Specification

Every ERC-173 compliant contract must implement the `ERC173` interface. Contracts should also implement `ERC165` for the ERC-173 interface.

```solidity

/// @title ERC-173 Contract Ownership Standard
///  Note: the ERC-165 identifier for this interface is 0x7f5828d0
interface ERC173 /* is ERC165 */ {
    /// @dev This emits when ownership of a contract changes.    
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /// @notice Get the address of the owner    
    /// @return The address of the owner.
    function owner() view external returns(address);
	
    /// @notice Set the address of the new owner of the contract
    /// @dev Set _newOwner to address(0) to renounce any ownership.
    /// @param _newOwner The address of the new owner of the contract    
    function transferOwnership(address _newOwner) external;	
}

interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. 
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

The `owner()` function may be implemented as `pure` or `view`.

The `transferOwnership(address _newOwner)` function may be implemented as `public` or `external`.

To renounce any ownership of a contract set `_newOwner` to the zero address: `transferOwnership(address(0))`. If this is done then a contract is no longer owned by anybody.

The OwnershipTransferred event should be emitted when a contract is created.

## Rationale

Key factors influencing the standard: 
- Keeping the number of functions in the interface to a minimum to prevent contract bloat.
- Backwards compatibility with existing contracts.
- Simplicity
- Gas efficient

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.

Here are other schemes that were considered:
1. **Associating an Ethereum Name Service (ENS) domain name with a contract.** A contract&apos;s `owner()` 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.
2. **Associating an ERC721-based non-fungible token (NFT) with a contract.** 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/buy/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.

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.

This standard can be (and has been) extended by other standards to add additional ownership functionality. 

## Security Considerations

If the address returned by `owner()` is an externally owned account then its private key must not be lost or compromised.

## Backwards Compatibility

Many existing contracts already implement this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 07 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-173</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-173</guid>
      </item>
    
      <item>
        <title>ENS support for reverse resolution of Ethereum addresses</title>
        <category>Standards Track/ERC</category>
        
        <description># Abstract
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.

# Motivation
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:

 - 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.
 - Attaching metadata such as descriptive information to an address allows retrieving this information regardless of how the address was originally discovered.
 - 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.

# Specification
Reverse ENS records are stored in the ENS hierarchy in the same fashion as regular records, under a reserved domain, `addr.reverse`. To generate the ENS name for a given account&apos;s reverse records, convert the account to hexadecimal representation in lower-case, and append `addr.reverse`. For instance, the ENS registry&apos;s address at `0x112234455c3a32fd11230c42e7bccd4a84e02010` has any reverse records stored at `112234455c3a32fd11230c42e7bccd4a84e02010.addr.reverse`.

Note that this means that contracts wanting to do dynamic reverse resolution of addresses will need to perform hex encoding in the contract.

## Registrar
The owner of the `addr.reverse` 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:

### function claim(address owner) returns (bytes32 node)

When called by account `x`, instructs the ENS registry to transfer ownership of the name `hex(x) + &apos;.addr.reverse&apos;` to the provided address, and return the namehash of the ENS record thus transferred.

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:

    reverseRegistrar.claim(msg.sender)

### function claimWithResolver(address owner, address resolver) returns (bytes32 node)

When called by account `x`, instructs the ENS registry to set the resolver of the name `hex(x) + &apos;.addr.reverse&apos;` 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 `claim`.

### function setName(string name) returns (bytes32 node)

When called by account `x`, sets the resolver for the name `hex(x) + &apos;.addr.reverse&apos;` 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.

## Resolver interface
A new resolver interface is defined, consisting of the following method:

    function name(bytes32 node) constant returns (string);

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.

The interface ID of this interface is 0x691f3431.

Future EIPs may specify more record types appropriate to reverse ENS records.

# Appendix 1: Registrar implementation

This registrar, written in Solidity, implements the specifications outlined above.

    pragma solidity ^0.4.10;

    import &quot;./AbstractENS.sol&quot;;

    contract Resolver {
        function setName(bytes32 node, string name) public;
    }

    /**
     * @dev Provides a default implementation of a resolver for reverse records,
     * which permits only the owner to update it.
     */
    contract DefaultReverseResolver is Resolver {
        AbstractENS public ens;
        mapping(bytes32=&gt;string) public name;

        /**
         * @dev Constructor
         * @param ensAddr The address of the ENS registry.
         */
        function DefaultReverseResolver(AbstractENS ensAddr) {
            ens = ensAddr;
        }

        /**
         * @dev Only permits calls by the reverse registrar.
         * @param node The node permission is required for.
         */
        modifier owner_only(bytes32 node) {
            require(msg.sender == ens.owner(node));
            _;
        }

        /**
         * @dev Sets the name for a node.
         * @param node The node to update.
         * @param _name The name to set.
         */
        function setName(bytes32 node, string _name) public owner_only(node) {
            name[node] = _name;
        }
    }

    contract ReverseRegistrar {
        // namehash(&apos;addr.reverse&apos;)
        bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;

        AbstractENS public ens;
        Resolver public defaultResolver;

        /**
         * @dev Constructor
         * @param ensAddr The address of the ENS registry.
         * @param resolverAddr The address of the default reverse resolver.
         */
        function ReverseRegistrar(AbstractENS ensAddr, Resolver resolverAddr) {
            ens = ensAddr;
            defaultResolver = resolverAddr;
        }

        /**
         * @dev Transfers ownership of the reverse ENS record associated with the
         *      calling account.
         * @param owner The address to set as the owner of the reverse record in ENS.
         * @return The ENS node hash of the reverse record.
         */
        function claim(address owner) returns (bytes32 node) {
            return claimWithResolver(owner, 0);
        }

        /**
         * @dev Transfers ownership of the reverse ENS record associated with the
         *      calling account.
         * @param owner The address to set as the owner of the reverse record in ENS.
         * @param resolver The address of the resolver to set; 0 to leave unchanged.
         * @return The ENS node hash of the reverse record.
         */
        function claimWithResolver(address owner, address resolver) returns (bytes32 node) {
            var label = sha3HexAddress(msg.sender);
            node = sha3(ADDR_REVERSE_NODE, label);
            var currentOwner = ens.owner(node);

            // Update the resolver if required
            if(resolver != 0 &amp;&amp; resolver != ens.resolver(node)) {
                // Transfer the name to us first if it&apos;s not already
                if(currentOwner != address(this)) {
                    ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, this);
                    currentOwner = address(this);
                }
                ens.setResolver(node, resolver);
            }

            // Update the owner if required
            if(currentOwner != owner) {
                ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, owner);
            }

            return node;
        }

        /**
         * @dev Sets the `name()` record for the reverse ENS record associated with
         * the calling account. First updates the resolver to the default reverse
         * resolver if necessary.
         * @param name The name to set for this address.
         * @return The ENS node hash of the reverse record.
         */
        function setName(string name) returns (bytes32 node) {
            node = claimWithResolver(this, defaultResolver);
            defaultResolver.setName(node, name);
            return node;
        }

        /**
         * @dev Returns the node hash for a given account&apos;s reverse records.
         * @param addr The address to hash
         * @return The ENS node hash.
         */
        function node(address addr) constant returns (bytes32 ret) {
            return sha3(ADDR_REVERSE_NODE, sha3HexAddress(addr));
        }

        /**
         * @dev An optimised function to compute the sha3 of the lower-case
         *      hexadecimal representation of an Ethereum address.
         * @param addr The address to hash
         * @return The SHA3 hash of the lower-case hexadecimal encoding of the
         *         input address.
         */
        function sha3HexAddress(address addr) private returns (bytes32 ret) {
            addr; ret; // Stop warning us about unused variables
            assembly {
                let lookup := 0x3031323334353637383961626364656600000000000000000000000000000000
                let i := 40
            loop:
                i := sub(i, 1)
                mstore8(i, byte(and(addr, 0xf), lookup))
                addr := div(addr, 0x10)
                i := sub(i, 1)
                mstore8(i, byte(and(addr, 0xf), lookup))
                addr := div(addr, 0x10)
                jumpi(loop, i)
                ret := sha3(0, 40)
            }
        }
    }

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 01 Dec 2016 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-181</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-181</guid>
      </item>
    
      <item>
        <title>Ethereum Smart Contract Packaging Standard</title>
        <category>Standards Track/ERC</category>
        
        <description># Abstract

This ERC proposes a specification for Ethereum smart contract packages.  

The specification was collaboratively developed by the following Ethereum development framework maintainers.

* Tim Coulter (Truffle)
* Denis Erfurt (Dapple)
* Piper Merriam (Populus)
* RJ Catalano (Eris PM)
* Iuri Matias (Embark)

# Motivation

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.

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.

A packaging standard should have the following positive effects on the ecosystem:

* Greater overall productivity caused by the ability to reuse existing code.
* Increased security caused by the ability to reuse existing well audited implementations of common patterns (ERC20, crowdfunding, etc).

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 [ENS](./eip-137.md) 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.


# Specification

The full specification for this standard is maintained separately in the repository [epm/epm-spec](https://github.com/ethpm/epm-spec).

This EIP refers to the `1.0.0` version of the specification: [https://github.com/ethpm/epm-spec/tree/v1.0.0](https://github.com/ethpm/epm-spec/tree/v1.0.0)

The specification contains details for a single document referred to as a *&quot;Release Lockfile&quot;*.  

* Release Lockfile Specification: [https://github.com/ethpm/epm-spec/blob/v1.0.0/release-lockfile.spec.md](https://github.com/ethpm/epm-spec/blob/v1.0.0/release-lockfile.spec.md).
* JSON Schema for Release Lockfile: [https://github.com/ethpm/epm-spec/blob/v1.0.0/spec/release-lockfile.spec.json](https://github.com/ethpm/epm-spec/blob/v1.0.0/spec/release-lockfile.spec.json)

&gt; These documents have not been inlined into this ERC to ensure that there is a single source of truth for the specification.


# Use Cases

This specification covers the following types of smart contract packages.

1. Packages with contracts intended to be used as base contract such as the common `owned` pattern.
2. Packages with contracts that are ready to use as-is such as an ERC20 token contract.
3. Packages with deployed contracts such as libraries or services.

Full explanations and examples of these use cases can be found in the [`README.md`](https://github.com/ethpm/epm-spec/blob/v1.0.0/README.md#use-cases) from the `epm/epm-spec` repository.


# Package Managers

The *Release Lockfile* 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.


## Deterministic builds

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.


## Bytecode verification

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.


## Multi-chain deploys

Supports deployments across multiple chains, allowing a package to define addresses on both the public mainnet and testnet.


## Trusted packages

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.


# Framework support and integration

Support for ERC190 is either implemented or in progress for the following:

* [Truffle](https://truffleframework.com/)
* [Populus](https://populus.readthedocs.io/en/latest/)
* [Dapple](https://dapple.readthedocs.io/en/master/)
* [Eris PM](https://github.com/eris-ltd/eris-cli)
* [Embark](https://github.com/iurimatias/embark-framework)
* [Browser Solidity](https://github.com/ethereum/remix-ide/issues/386)
</description>
        <pubDate>Tue, 10 Jan 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-190</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-190</guid>
      </item>
    
      <item>
        <title>Signed Data Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/191</comments>
        
        <description># Abstract

This ERC proposes a specification about how to handle signed data in Ethereum contracts.

# Motivation

Several multisignature wallet implementations have been created which accepts `presigned` transactions. A `presigned` transaction is a chunk of binary `signed_data`, along with signature (`r`, `s` and `v`). The interpretation of the `signed_data` has not been specified, leading to several problems:

* Standard Ethereum transactions can be submitted as `signed_data`. An Ethereum transaction can be unpacked, into the following components: `RLP&lt;nonce, gasPrice, startGas, to, value, data&gt;` (hereby called `RLPdata`), `r`, `s` and `v`. If there are no syntactical constraints on `signed_data`, this means that `RLPdata` can be used as a syntactically valid `presigned` transaction.
* Multisignature wallets have also had the problem that a `presigned` transaction has not been tied to a particular `validator`, i.e a specific wallet. Example:
    1. Users `A`, `B` and `C` have the `2/3`-wallet `X`
    2. Users `A`, `B` and `D` have the `2/3`-wallet `Y`
    3. User `A` and `B` submit `presigned` transactions to `X`.
    4. Attacker can now reuse their presigned transactions to `X`, and submit to `Y`.

## Specification

We propose the following format for `signed_data`

```
0x19 &lt;1 byte version&gt; &lt;version specific data&gt; &lt;data to sign&gt;.
```

The initial `0x19` byte is intended to ensure that the `signed_data` is not valid RLP.

&gt; For a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.

That means that any `signed_data` cannot be one RLP-structure, but a 1-byte `RLP` payload followed by something else. Thus, any EIP-191 `signed_data` can never be an Ethereum transaction.

Additionally, `0x19` has been chosen because since ethereum/go-ethereum#2940 , the following is prepended before hashing in personal_sign:

```
&quot;\x19Ethereum Signed Message:\n&quot; + len(message).
```

Using `0x19` thus makes it possible to extend the scheme by defining a version `0x45` (`E`) to handle these kinds of signatures.

### Registry of version bytes

| Version byte | EIP            | Description
| ------------ | -------------- | -----------
|    `0x00`    | [191][eip-191] | Data with intended validator
|    `0x01`    | [712][eip-712] | Structured data
|    `0x45`    | [191][eip-191] | `personal_sign` messages

#### Version `0x00`

```
0x19 &lt;0x00&gt; &lt;intended validator address&gt; &lt;data to sign&gt;
```

The version `0x00` has `&lt;intended validator address&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.

#### Version `0x01`

The version `0x01` is for structured data as defined in [EIP-712]

#### Version `0x45` (E)

```
0x19 &lt;0x45 (E)&gt; &lt;thereum Signed Message:\n&quot; + len(message)&gt; &lt;data to sign&gt;
```

The version `0x45` (E) has `&lt;thereum Signed Message:\n&quot; + len(message)&gt;` for the version-specific data. The data to sign can be any arbitrary data.

&gt; NB: The `E` in `Ethereum Signed Message` refers to the version byte 0x45. The character `E` is `0x45` in hexadecimal which makes the remainder, `thereum Signed Message:\n + len(message)`, the version-specific data.

[EIP-191]: ./eip-191.md
[EIP-712]: ./eip-712.md

### Example

The following snippets has been written in Solidity 0.8.0.

#### Version `0x00`

```solidity
function signatureBasedExecution(address target, uint256 nonce, bytes memory payload, uint8 v, bytes32 r, bytes32 s) public payable {
        
    // Arguments when calculating hash to validate
    // 1: byte(0x19) - the initial 0x19 byte
    // 2: byte(0) - the version byte
    // 3: address(this) - the validator address
    // 4-6 : Application specific data

    bytes32 hash = keccak256(abi.encodePacked(byte(0x19), byte(0), address(this), msg.value, nonce, payload));

    // recovering the signer from the hash and the signature
    addressRecovered = ecrecover(hash, v, r, s);
   
    // logic of the wallet
    // if (addressRecovered == owner) executeOnTarget(target, payload);
}
```
## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 20 Jan 2016 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-191</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-191</guid>
      </item>
    
      <item>
        <title>ENS support for contract ABIs</title>
        <category>Standards Track/ERC</category>
        
        <description>## Simple Summary
This EIP proposes a mechanism for storing ABI definitions in ENS, for easy lookup of contract interfaces by callers.

## Abstract
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.

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.

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.

## Specification
### ABI encodings
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.

The currently recognised encodings are:

| ID | Description          |
|----|----------------------|
| 1  | JSON                 |
| 2  | zlib-compressed JSON |
| 4  | CBOR                 |
| 8  | URI                  |

This table may be extended in future through the EIP process.

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.

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.

Encoding type 4 is [CBOR](https://cbor.io/). 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 [stringref extension](http://cbor.schmorp.de/stringref) to CBOR, which provides significant additional reduction in encoded size.

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.

### Resolver profile
A new resolver interface is defined, consisting of the following method:

    function ABI(bytes32 node, uint256 contentType) constant returns (uint256, bytes);

The interface ID of this interface is 0x2203ab56.

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 `(0, &quot;&quot;)` if they do not have an ABI for this function, or do not support any of the requested formats.

The `abi` resolver profile is valid on both forward and reverse records.

### ABI lookup process

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.

Implementers should support as many of the ABI encoding formats as practical.

## Rationale

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.

The two-step resolution process permits different names to provide different ABIs for the same contract, such as in the case where it&apos;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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 06 Feb 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-205</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-205</guid>
      </item>
    
      <item>
        <title>Token with transaction handling model</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-223-token-standard/12894</comments>
        
        <description>## Abstract

The following describes an interface and logic for fungible tokens that supports a `tokenReceived` callback to notify contract recipients when tokens are received. This makes tokens behave identical to ether.

## Motivation

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:

1. Informs receiving contracts of incoming token transfers, as opposed to [ERC-20](./eip-20.md) where the recipient of a token transfer gets no notification.
2. Is more gas-efficient when depositing tokens to contracts.
3. Allows for `_data` recording for financial transfers.

## Specification

Contracts intending to receive these tokens MUST implement `tokenReceived`.

Token transfers to contracts not implementing `tokenReceived` as described below MUST revert.

### Token contract

#### Token Methods

##### `totalSupply`

```solidity
function totalSupply() view returns (uint256)
```

Returns the total supply of the token. The functionality of this method is identical to that of ERC-20.

##### `name`

```solidity
function name() view returns (string memory)
```

Returns the name of the token.  The functionality of this method is identical to that of ERC-20.

OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.

##### `symbol`

```solidity
function symbol() view returns (string memory)
```

Returns the symbol of the token. The functionality of this method is identical to that of ERC-20.

OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.

##### `decimals`

```solidity
function decimals() view returns (uint8)
```

Returns the number of decimals of the token. The functionality of this method is identical to that of ERC-20.

OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present. 

##### `balanceOf`

```solidity
function balanceOf(address _owner) view returns (uint256)
```

Returns the account balance of another account with address `_owner`. The functionality of this method is identical to that of ERC-20.

##### `transfer(address, uint)`

```solidity
function transfer(address _to, uint _value) returns (bool)
```

This function must transfer tokens, and if `_to` is a contract, it must call the `tokenReceived(address, uint256, bytes calldata)` function of `_to`. If the `tokenReceived` function is not implemented in `_to` (recipient contract), then the transaction must fail and the transfer of tokens must be reverted.
If `_to` is an externally owned address, then the transaction must be sent without executing `tokenReceived` in `_to`.
 `_data` can be attached to this token transaction, but it requires more gas. `_data` can be empty.
 
The `tokenReceived` function of `_to` MUST be called after all other operations to avoid re-entrancy attacks.
 
NOTE: If `transfer` function is `payable` and ether was deposited then the amount of deposited ether MUST be delivered to `_to` 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 `tokenReceived` function MUST be called in `_to` if it is a contract.

##### `transfer(address, uint, bytes)`

```solidity
function transfer(address _to, uint _value, bytes calldata _data) returns (bool)
```

This function must transfer tokens and invoke the function `tokenReceived (address, uint256, bytes)` in `_to`, if `_to` is a contract. If the `tokenReceived` function is not implemented in `_to` (recipient contract), then the transaction must fail and the transfer of tokens must not occur. 
If `_to` is an externally owned address (determined by the code size being zero), then the transaction must be sent without executing `tokenReceived` in `_to`.
 `_data` can be attached to this token transaction, but it requires more gas. `_data` can be empty.

NOTE: A possible way to check whether the `_to` is a contract or an address is to assemble the code of `_to`. If there is no code in `_to`, then this is an externally owned address, otherwise it&apos;s a contract. If `transfer` function is `payable` and ether was deposited then the amount of deposited ether MUST be delivered to `_to` address alongside tokens.

The `tokenReceived` function of `_to` MUST be called after all other operations to avoid re-entrancy attacks.

#### Events

##### `Transfer`

```solidity
event Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data)
```

Triggered when tokens are transferred. Compatible with and similar to the ERC-20 `Transfer` event.

### [ERC-223](./eip-223.md) Token Receiver

#### Receiver Methods

```solidity
function tokenReceived(address _from, uint _value, bytes calldata _data) returns (bytes4)
```

A function for handling token transfers, which is called from the token contract, when a token holder sends tokens. `_from` is the address of the sender of the token, `_value` is the amount of incoming tokens, and `_data` is attached data similar to `msg.data` of ether transactions. It works by analogy with the fallback function of Ether transactions and returns nothing.

NOTE: `msg.sender` will be a token-contract inside the `tokenReceived` 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 `_from` inside the `tokenReceived` function. The `tokenReceived` function must return `0x8943ec02` after handling an incoming token transfer. The `tokenReceived` 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).

IMPORTANT: This function must be named `tokenReceived` and take parameters `address`, `uint256`, `bytes` to match the function signature `0x8943ec02`. This function can be manually called by a EOA.

## Rationale

This standard introduces a communication model by enforcing the `transfer` 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.

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 `approve` and the second that will invoke `transferFrom`).

- [ERC-20](./eip-20.md) deposit: `approve` ~46 gas, `transferFrom` ~75K gas

- ERC-223 deposit: `transfer` and handling on the receivers side ~54K gas

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.

One downside of the commonly used [ERC-20](./eip-20.md) standard that ERC-223 is intended to solve is that [ERC-20](./eip-20.md) implements two methods of token transferring: (1) `transfer` function and (2) `approve + transferFrom` pattern. Transfer function of [ERC-20](./eip-20.md) standard does not notify the receiver and therefore if any tokens are sent to a contract with the `transfer` 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. [ERC-20](./eip-20.md) 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.

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 `transfer` function. This is one transaction as opposed to two step process of `approve + transferFrom` depositing.

This standard allows payloads to be attached to transactions using the `bytes calldata _data` parameter, which can encode a second function call in the destination address, similar to how `msg.data` does in an ether transaction, or allow for public logging on chain should it be necessary for financial transactions.

## Backwards Compatibility

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. 
`transfer(address, uint256, bytes calldata)` function is not backwards compatible with ERC-20 interface.

ERC-20 tokens can be delivered to a non-contract address with `transfer` function. ERC-20 tokens can be deposited to a contract address with `approve` + `transferFrom` pattern. Depositing ERC-20 tokens to the contract address with `transfer` function will always result in token deposit not being recognized by the recipient contract.

Here is an example of the contract code that handles ERC-20 token deposit. The following contract can accepts `tokenA` deposits. It is impossible to prevent deposits of non-tokenA to this contract. If tokenA is deposited with `transfer` 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 `deposits` variable in the `ERC20Receiver` will not be increased i.e. the deposit will not be credited. As of 5/9/2023 **$201M worth of 50 examined ERC-20 tokens are already lost** in this way on Ethereum mainnet.

```solidity
contract ERC20Receiver
{
    address tokenA;
    mapping (address =&gt; uint256) deposits;
    function deposit(uint _value, address _token) public
    {
        require(_token == tokenA);
        IERC20(_token).transferFrom(msg.sender, address(this), _value);
        deposits[msg.sender] += _value;
    }
}
```

ERC-223 tokens must be delivered to non-contract address or contract address in the same way with `transfer` function.

Here is an example of the contract code that handles ERC-223 token deposit. The following contract can filter tokens and only accepts `tokenA`. Other ERC-223 tokens would be rejected.

```solidity
contract ERC223Receiver
{
    address tokenA;
    mapping (address =&gt; uint256) deposits;
    function tokenReceived(address _from, uint _value, bytes memory _data) public returns (bytes4)
    {
        require(msg.sender == tokenA);
        deposits[_from] += _value;
        return 0x8943ec02;
    }
}
```

## Security Considerations

This token utilizes the model similar to plain ether behavior. Therefore replay issues must be taken into account.

### Reference Implementation

```solidity
pragma solidity ^0.8.19;

library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * This test is non-exhaustive, and there may be false-negatives: during the
     * execution of a contract&apos;s constructor, its address will be reported as
     * not containing a contract.
     *
     * &gt; It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size &gt; 0;
    }
}

abstract contract IERC223Recipient {
/**
 * @dev Standard ERC-223 receiving function that will handle incoming token transfers.
 *
 * @param _from  Token sender address.
 * @param _value Amount of tokens.
 * @param _data  Transaction metadata.
 */
    function tokenReceived(address _from, uint _value, bytes memory _data) public virtual returns (bytes4);
}

/**
 * @title Reference implementation of the ERC223 standard token.
 */
contract ERC223Token {

     /**
     * @dev Event that is fired on successful transfer.
     */
    event Transfer(address indexed from, address indexed to, uint value, bytes data);

    string  private _name;
    string  private _symbol;
    uint8   private _decimals;
    uint256 private _totalSupply;
    
    mapping(address =&gt; uint256) private balances; // List of user balances.

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
     
    constructor(string memory new_name, string memory new_symbol, uint8 new_decimals)
    {
        _name     = new_name;
        _symbol   = new_symbol;
        _decimals = new_decimals;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory)
    {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory)
    {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC223} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC223-balanceOf} and {IERC223-transfer}.
     */
    function decimals() public view returns (uint8)
    {
        return _decimals;
    }

    /**
     * @dev See {IERC223-totalSupply}.
     */
    function totalSupply() public view returns (uint256)
    {
        return _totalSupply;
    }

    /**
     * @dev See {IERC223-standard}.
     */
    function standard() public view returns (string memory)
    {
        return &quot;223&quot;;
    }

    
    /**
     * @dev Returns balance of the `_owner`.
     *
     * @param _owner   The address whose balance will be returned.
     * @return balance Balance of the `_owner`.
     */
    function balanceOf(address _owner) public view returns (uint256)
    {
        return balances[_owner];
    }
    
    /**
     * @dev Transfer the specified amount of tokens to the specified address.
     *      Invokes the `tokenFallback` function if the recipient is a contract.
     *      The token transfer fails if the recipient is a contract
     *      but does not implement the `tokenFallback` function
     *      or the fallback function to receive funds.
     *
     * @param _to    Receiver address.
     * @param _value Amount of tokens that will be transferred.
     * @param _data  Transaction metadata.
     */
    function transfer(address _to, uint _value, bytes calldata _data) public returns (bool success)
    {
        // Standard function transfer similar to ERC20 transfer with no _data .
        // Added due to backwards compatibility reasons .
        balances[msg.sender] = balances[msg.sender] - _value;
        balances[_to] = balances[_to] + _value;
        if(Address.isContract(_to)) {
            IERC223Recipient(_to).tokenReceived(msg.sender, _value, _data);
        }
        emit Transfer(msg.sender, _to, _value, _data);
        return true;
    }
    
    /**
     * @dev Transfer the specified amount of tokens to the specified address.
     *      This function works the same with the previous one
     *      but doesn&apos;t contain `_data` param.
     *      Added due to backwards compatibility reasons.
     *
     * @param _to    Receiver address.
     * @param _value Amount of tokens that will be transferred.
     */
    function transfer(address _to, uint _value) public returns (bool success)
    {
        bytes memory _empty = hex&quot;00000000&quot;;
        balances[msg.sender] = balances[msg.sender] - _value;
        balances[_to] = balances[_to] + _value;
        if(Address.isContract(_to)) {
            IERC223Recipient(_to).tokenReceived(msg.sender, _value, _empty);
        }
        emit Transfer(msg.sender, _to, _value, _empty);
        return true;
    }
}
```

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 03 May 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-223</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-223</guid>
      </item>
    
      <item>
        <title>Ethereum purpose allocation for Deterministic Wallets</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-erc-app-keys-application-specific-wallet-accounts/2742</comments>
        
        <description>## Abstract
This EIP defines a logical hierarchy for deterministic wallets based on [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki), the purpose scheme defined in [BIP43](https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki) and [this proposed change to BIP43](https://github.com/bitcoin/bips/pull/523).

This EIP is a particular application of BIP43.

## Motivation
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&apos;s unique requirements.

## Specification
We define the following 2 levels in BIP32 path:

&lt;pre&gt;
m / purpose&apos; / subpurpose&apos; / EIP&apos;
&lt;/pre&gt;

Apostrophe in the path indicates that BIP32 hardened derivation is used.

Each level has a special meaning, described in the chapters below.

### Purpose

Purpose is set to 43, as documented in [this proposed change to BIP43](https://github.com/bitcoin/bips/pull/523).

The purpose field indicates that this path is for a non-bitcoin cryptocurrency.

Hardened derivation is used at this level.

### Subpurpose
Subpurpose is set to 60, the SLIP-44 code for Ethereum.

Hardened derivation is used at this level.

### EIP
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.

Hardened derivation is used at this level.

## Rationale
The existing convention is to use the &apos;Ethereum&apos; coin type, leading to paths starting with `m/44&apos;/60&apos;/*`. 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.

## Backwards Compatibility
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.

## Test Cases
TBD

## Implementation
None yet.

## References
[This discussion on derivation paths](https://github.com/ethereum/EIPs/issues/84)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 13 Apr 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-600</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-600</guid>
      </item>
    
      <item>
        <title>Ethereum hierarchy for deterministic wallets</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-erc-app-keys-application-specific-wallet-accounts/2742</comments>
        
        <description>## Abstract
This EIP defines a logical hierarchy for deterministic wallets based on [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki), the purpose scheme defined in [BIP43](https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki) and eip-draft-ethereum-purpose.

This EIP is a particular application of eip-draft-ethereum-purpose.

## Motivation
At present, different Ethereum clients and wallets use different derivation paths; a summary of them can be found [here](https://github.com/ethereum/EIPs/issues/84#issuecomment-292324521). Some of these paths violate BIP44, the standard defining derivation paths starting with `m/44&apos;/`. 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.

Further, BIP44 was designed with UTXO-based blockchains in mind, and is a poor fit for Ethereum, which uses an accounts abstraction instead.

As an alternative, we propose a deterministic wallet hierarchy better tailored to Ethereum&apos;s unique requirements.

## Specification
We define the following 4 levels in BIP32 path:

&lt;pre&gt;
m / purpose&apos; / subpurpose&apos; / EIP&apos; / wallet&apos;
&lt;/pre&gt;

Apostrophe in the path indicates that BIP32 hardened derivation is used.

Each level has a special meaning, described in the chapters below.

### Purpose

Purpose is a constant set to 43, indicating the key derivation is for a non-bitcoin cryptocurrency.

Hardened derivation is used at this level.

### Subpurpose
Subpurpose is set to 60, the SLIP-44 code for Ethereum.

Hardened derivation is used at this level.

### EIP
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.

Hardened derivation is used at this level.

### Wallet
This component of the path splits the wallet into different user identities, allowing a single wallet to have multiple public identities.

Accounts are numbered from index 0 in sequentially increasing manner. This number is used as child index in BIP32 derivation.

Hardened derivation is used at this level.

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).

Software needs to discover all used accounts after importing the seed from an external source.

## Rationale
The existing convention is to use the &apos;Ethereum&apos; coin type, leading to paths starting with `m/44&apos;/60&apos;/*`. 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.

## Backwards Compatibility
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.

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.

## Test Cases
TBD

## Implementation
None yet.

## References
[This discussion on derivation paths](https://github.com/ethereum/EIPs/issues/84)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 13 Apr 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-601</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-601</guid>
      </item>
    
      <item>
        <title>Storage of text records in ENS</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2439</comments>
        
        <description>## Abstract
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.


## Motivation
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.

In this EIP we define a simple resolver profile for ENS that permits ENS names to
associate arbitrary key-value text.


## Specification

### Resolver Profile

A new resolver interface is defined, consisting of the following method:

```solidity
interface IERC634 {
  /// @notice Returns the text data associated with a key for an ENS name
  /// @param node A nodehash for an ENS name
  /// @param key A key to lookup text data for
  /// @return The text data
  function text(bytes32 node, string key) view returns (string text);
}
```

The [EIP-165](./eip-165.md) interface ID of this interface is `0x59d1d43c`.

The `text` data may be any arbitrary UTF-8 string. If the key is not present, the empty string
must be returned.


### Global Keys

Global Keys must be made up of lowercase letters, numbers and
the hyphen (-).

- **avatar** - a URL to an image used as an avatar or logo
- **description** - A description of the name
- **display** - 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. `&quot;ricmoo.eth&quot;` could set this to `&quot;RicMoo.eth&quot;`)
- **email** - an e-mail address
- **keywords** - A list of comma-separated keywords, ordered by most significant first; clients that interpresent this field may choose a threshold beyond which to ignore
- **mail** - A physical mailing address
- **notice** - A notice regarding this name
- **location** - A generic location (e.g. `&quot;Toronto, Canada&quot;`)
- **phone** - A phone number as an E.164 string
- **url** - a website URL

### Service Keys

Service Keys must be made up of a *reverse dot notation* for
a namespace which the service owns, for example, DNS names
(e.g. `.com`, `.io`, etc) or ENS name (i.e. `.eth`). Service
Keys must contain at least one dot.

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.

The following services are common, which is why recommendations are
provided here, but ideally a service would declare its own key.

- **com.github** - a GitHub username
- **com.peepeth** - a Peepeth username
- **com.linkedin** - a LinkedIn username
- **com.twitter** - a Twitter username
- **io.keybase** - a Keybase username
- **org.telegram** - a Telegram username

This technique also allows for a service owner to specify a hierarchy
for their keys, such as:

- **com.example.users**
- **com.example.groups**
- **com.example.groups.public**
- **com.example.groups.private**


### Legacy Keys

The following keys were specified in earlier versions of this EIP,
which is still in draft.

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.

- **vnd.github** - a GitHub username (renamed to `com.github`)
- **vnd.peepeth** - a peepeth username (renamced to `com.peepeth`)
- **vnd.twitter** - a twitter username (renamed to `com.twitter`)


## Rationale

### Application-specific vs general-purpose record types

Rather than define a large number of specific record types (each for generally human-readable
data) such as `url` and `email`, we follow an adapted model of DNS&apos;s `TXT` 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.


## Backwards Compatibility
Not applicable.


## Security Considerations
None.


## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 17 May 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-634</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-634</guid>
      </item>
    
      <item>
        <title>URL Format for Transaction Requests</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-681-representing-various-transactions-as-urls</comments>
        
        <description>## Simple Summary
A standard way of representing various transactions, especially payment requests in ether and [ERC-20](./eip-20.md) tokens as URLs.

## Abstract
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&apos;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.

## Motivation
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.

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.

## Specification

### Syntax
Payment request URLs contain &quot;ethereum&quot; in their schema (protocol) part and are constructed as follows:

    request                 = schema_prefix target_address [ &quot;@&quot; chain_id ] [ &quot;/&quot; function_name ] [ &quot;?&quot; parameters ]
    schema_prefix           = &quot;ethereum&quot; &quot;:&quot; [ &quot;pay-&quot; ]
    target_address          = ethereum_address
    chain_id                = 1*DIGIT
    function_name           = STRING
    ethereum_address        = ( &quot;0x&quot; 40*HEXDIG ) / ENS_NAME
    parameters              = parameter *( &quot;&amp;&quot; parameter )
    parameter               = key &quot;=&quot; value
    key                     = &quot;value&quot; / &quot;gas&quot; / &quot;gasLimit&quot; / &quot;gasPrice&quot; / TYPE
    value                   = number / ethereum_address / STRING
    number                  = [ &quot;-&quot; / &quot;+&quot; ] *DIGIT [ &quot;.&quot; 1*DIGIT ] [ ( &quot;e&quot; / &quot;E&quot; ) [ 1*DIGIT ] ]


Where `TYPE` is a standard ABI type name, as defined in [Ethereum Contract ABI specification](https://solidity.readthedocs.io/en/develop/abi-spec.html). `STRING` is a URL-encoded unicode string of arbitrary length, where delimiters and the
percentage symbol (`%`) are mandatorily hex-encoded with a `%` prefix.

Note that a `number` can be expressed in *scientific notation*, 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.

If *key* in the parameter list is `value`, `gasLimit`, `gasPrice` or `gas` then *value* MUST be a `number`. Otherwise, it must correspond to the `TYPE` string used as *key*.

For the syntax of ENS_NAME, please consult [ERC-137](./eip-137.md) defining Ethereum Name Service.

### Semantics

`target_address` 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.

`chain_id` is optional and contains the decimal chain ID, such that transactions on various test- and private networks can be requested. If no `chain_id` is present, the client&apos;s current network setting remains effective.

If `function_name` 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 `value` parameter, in the atomic unit (i.e. wei). The use of scientific notation is strongly encouraged. For example, requesting 2.014 ETH to address `0xfb6916095ca1df60bb79Ce92ce3ea74c37c5d359` would look as follows:
[ethereum:0xfb6916095ca1df60bb79Ce92ce3ea74c37c5d359?value=2.014e18](ethereum:0xfb6916095ca1df60bb79Ce92ce3ea74c37c5d359?value=2.014e18)

Requesting payments in [ERC-20](./eip-20.md) tokens involves a request to call the `transfer` function of the token contract with an `address` and a `uint256` typed parameter, containing the *beneficiary address* and the *amount in atomic units*, respectively. For example,
requesting a Unicorn to address `0x8e23ee67d1332ad560396262c48ffbb01f93d052` looks as follows:
[ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7/transfer?address=0x8e23ee67d1332ad560396262c48ffbb01f93d052&amp;uint256=1](ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7/transfer?address=0x8e23ee67d1332ad560396262c48ffbb01f93d052&amp;uint256=1)

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 `0x` followed by 40 hexadecimal digits, it should never be resolved. Instead, the hexadecimal address should be used directly.

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.

Similarly `gasLimit` and `gasPrice` are suggested user-editable values for *gas limit* and *gas price*, respectively, for the requested transaction. It is acceptable to abbreviate `gasLimit` as `gas`, the two are treated synonymously.

## Rationale
The proposed format is chosen to resemble `bitcoin:` 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 `bitcoin:`. The use of scientific notation is strongly encouraged when expressing monetary value in ether or [ERC-20](./eip-20.md) tokens. For better human readability, the exponent should be the decimal value of the nominal unit: 18 for ether or the value returned by `decimals()` of the token contract for [ERC-20](./eip-20.md) tokens. Additional parameters may be added, if popular use cases requiring them emerge in practice.

The `0x` 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.

Future upgrades that are partially or fully incompatible with this proposal must use a prefix other than `pay-` that is separated by a dash (`-`) character from whatever follows it.

## Backwards Compatibility

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.

## Security Considerations

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.

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.

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 [ERC-20](./eip-20.md) 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 01 Aug 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-681</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-681</guid>
      </item>
    
      <item>
        <title>Non-Fungible Token Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/eips/issues/721</comments>
        
        <description>## Simple Summary

A standard interface for non-fungible tokens, also known as deeds.

## Abstract

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.

We considered use cases of NFTs being owned and transacted by individuals as well as consignment to third party brokers/wallets/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:

- Physical property — houses, unique artwork
- Virtual collectibles — unique pictures of kittens, collectible cards
- &quot;Negative value&quot; assets — loans, burdens and other responsibilities

In general, all houses are distinct and no two kittens are alike. NFTs are *distinguishable* and you must track the ownership of each one separately.

## Motivation

A standard interface allows wallet/broker/auction applications to work with any NFT on Ethereum. We provide for simple ERC-721 smart contracts as well as contracts that track an *arbitrarily large* number of NFTs. Additional applications are discussed below.

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).

Differences between this standard and EIP-20 are examined below.

## Specification

The key words &quot;MUST&quot;, &quot;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.

**Every ERC-721 compliant contract must implement the `ERC721` and `ERC165` interfaces** (subject to &quot;caveats&quot; below):

```solidity
pragma solidity ^0.4.20;

/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://eips.ethereum.org/EIPS/eip-721
///  Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ {
    /// @dev This emits when ownership of any NFT changes by any mechanism.
    ///  This event emits when NFTs are created (`from` == 0) and destroyed
    ///  (`to` == 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.
    event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);

    /// @dev This emits when the approved address for an NFT is changed or
    ///  reaffirmed. The zero address indicates there is no approved address.
    ///  When a Transfer event emits, this also indicates that the approved
    ///  address for that NFT (if any) is reset to none.
    event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);

    /// @dev This emits when an operator is enabled or disabled for an owner.
    ///  The operator can manage all NFTs of the owner.
    event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

    /// @notice Count all NFTs assigned to an owner
    /// @dev NFTs assigned to the zero address are considered invalid, and this
    ///  function throws for queries about the zero address.
    /// @param _owner An address for whom to query the balance
    /// @return The number of NFTs owned by `_owner`, possibly zero
    function balanceOf(address _owner) external view returns (uint256);

    /// @notice Find the owner of an NFT
    /// @dev NFTs assigned to zero address are considered invalid, and queries
    ///  about them do throw.
    /// @param _tokenId The identifier for an NFT
    /// @return The address of the owner of the NFT
    function ownerOf(uint256 _tokenId) external view returns (address);

    /// @notice Transfers the ownership of an NFT from one address to another address
    /// @dev Throws unless `msg.sender` is the current owner, an authorized
    ///  operator, or the approved address for this NFT. Throws if `_from` is
    ///  not the current owner. Throws if `_to` is the zero address. Throws if
    ///  `_tokenId` is not a valid NFT. When transfer is complete, this function
    ///  checks if `_to` is a smart contract (code size &gt; 0). If so, it calls
    ///  `onERC721Received` on `_to` and throws if the return value is not
    ///  `bytes4(keccak256(&quot;onERC721Received(address,address,uint256,bytes)&quot;))`.
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    /// @param data Additional data with no specified format, sent in call to `_to`
    function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;

    /// @notice Transfers the ownership of an NFT from one address to another address
    /// @dev This works identically to the other function with an extra data parameter,
    ///  except this function just sets data to &quot;&quot;.
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;

    /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
    ///  TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
    ///  THEY MAY BE PERMANENTLY LOST
    /// @dev Throws unless `msg.sender` is the current owner, an authorized
    ///  operator, or the approved address for this NFT. Throws if `_from` is
    ///  not the current owner. Throws if `_to` is the zero address. Throws if
    ///  `_tokenId` is not a valid NFT.
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    function transferFrom(address _from, address _to, uint256 _tokenId) external payable;

    /// @notice Change or reaffirm the approved address for an NFT
    /// @dev The zero address indicates there is no approved address.
    ///  Throws unless `msg.sender` is the current NFT owner, or an authorized
    ///  operator of the current owner.
    /// @param _approved The new approved NFT controller
    /// @param _tokenId The NFT to approve
    function approve(address _approved, uint256 _tokenId) external payable;

    /// @notice Enable or disable approval for a third party (&quot;operator&quot;) to manage
    ///  all of `msg.sender`&apos;s assets
    /// @dev Emits the ApprovalForAll event. The contract MUST allow
    ///  multiple operators per owner.
    /// @param _operator Address to add to the set of authorized operators
    /// @param _approved True if the operator is approved, false to revoke approval
    function setApprovalForAll(address _operator, bool _approved) external;

    /// @notice Get the approved address for a single NFT
    /// @dev Throws if `_tokenId` is not a valid NFT.
    /// @param _tokenId The NFT to find the approved address for
    /// @return The approved address for this NFT, or the zero address if there is none
    function getApproved(uint256 _tokenId) external view returns (address);

    /// @notice Query if an address is an authorized operator for another address
    /// @param _owner The address that owns the NFTs
    /// @param _operator The address that acts on behalf of the owner
    /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
    function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}

interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

A wallet/broker/auction application MUST implement the **wallet interface** if it will accept safe transfers.

```solidity
/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02.
interface ERC721TokenReceiver {
    /// @notice Handle the receipt of an NFT
    /// @dev The ERC721 smart contract calls this function on the recipient
    ///  after a `transfer`. This function MAY throw to revert and reject the
    ///  transfer. Return of other than the magic value MUST result in the
    ///  transaction being reverted.
    ///  Note: the contract address is always the message sender.
    /// @param _operator The address which called `safeTransferFrom` function
    /// @param _from The address which previously owned the token
    /// @param _tokenId The NFT identifier which is being transferred
    /// @param _data Additional data with no specified format
    /// @return `bytes4(keccak256(&quot;onERC721Received(address,address,uint256,bytes)&quot;))`
    ///  unless throwing
    function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes _data) external returns(bytes4);
}
```

The **metadata extension** 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.

```solidity
/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
/// @dev See https://eips.ethereum.org/EIPS/eip-721
///  Note: the ERC-165 identifier for this interface is 0x5b5e139f.
interface ERC721Metadata /* is ERC721 */ {
    /// @notice A descriptive name for a collection of NFTs in this contract
    function name() external view returns (string _name);

    /// @notice An abbreviated name for NFTs in this contract
    function symbol() external view returns (string _symbol);

    /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
    /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC
    ///  3986. The URI may point to a JSON file that conforms to the &quot;ERC721
    ///  Metadata JSON Schema&quot;.
    function tokenURI(uint256 _tokenId) external view returns (string);
}
```

This is the &quot;ERC721 Metadata JSON Schema&quot; referenced above.

```json
{
    &quot;title&quot;: &quot;Asset Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset to which this NFT represents&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset to which this NFT represents&quot;
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
        }
    }
}
```

The **enumeration extension** 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.

```solidity
/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
/// @dev See https://eips.ethereum.org/EIPS/eip-721
///  Note: the ERC-165 identifier for this interface is 0x780e9d63.
interface ERC721Enumerable /* is ERC721 */ {
    /// @notice Count NFTs tracked by this contract
    /// @return A count of valid NFTs tracked by this contract, where each one of
    ///  them has an assigned and queryable owner not equal to the zero address
    function totalSupply() external view returns (uint256);

    /// @notice Enumerate valid NFTs
    /// @dev Throws if `_index` &gt;= `totalSupply()`.
    /// @param _index A counter less than `totalSupply()`
    /// @return The token identifier for the `_index`th NFT,
    ///  (sort order not specified)
    function tokenByIndex(uint256 _index) external view returns (uint256);

    /// @notice Enumerate NFTs assigned to an owner
    /// @dev Throws if `_index` &gt;= `balanceOf(_owner)` or if
    ///  `_owner` is the zero address, representing invalid NFTs.
    /// @param _owner An address where we are interested in NFTs owned by them
    /// @param _index A counter less than `balanceOf(_owner)`
    /// @return The token identifier for the `_index`th NFT assigned to `_owner`,
    ///   (sort order not specified)
    function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
}
```

### Caveats

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:

- Solidity issue #3412: The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: `payable`, implicit nonpayable, `view`, and `pure`. Your implementation MUST meet the mutability guarantee in this interface and you MAY meet a stronger guarantee. For example, a `payable` 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.
- Solidity issue #3419: A contract that implements `ERC721Metadata` or `ERC721Enumerable` SHALL also implement `ERC721`. ERC-721 implements the requirements of interface ERC-165.
- Solidity issue #2330: If a function is shown in this specification as `external` then a contract will be compliant if it uses `public` visibility. As a workaround for version 0.4.20, you can edit this interface to switch to `public` before inheriting from your contract.
- Solidity issues #3494, #3544: Use of `this.*.selector` is marked as a warning by Solidity, a future version of Solidity will not mark this as an error.

*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.*

## Rationale

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.

**&quot;NFT&quot; Word Choice**

&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).

*Alternatives considered: distinguishable asset, title, token, asset, equity, ticket*

**NFT Identifiers**

Every NFT is identified by a unique `uint256` ID inside the ERC-721 smart contract. This identifying number SHALL NOT change for the life of the contract. The pair `(contract address, uint256 tokenId)` 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.

The choice of `uint256` allows a wide variety of applications because UUIDs and sha3 hashes are directly convertible to `uint256`.

**Transfer Mechanism**

ERC-721 standardizes a safe transfer function `safeTransferFrom` (overloaded with and without a `bytes` parameter) and an unsafe function `transferFrom`. Transfers may be initiated by:

- The owner of an NFT
- The approved address of an NFT
- An authorized operator of the current owner of an NFT

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 *large* number of NFTs.

The transfer and accept functions&apos; documentation only specify conditions when the transaction MUST throw. Your implementation MAY also throw in other situations. This allows implementations to achieve interesting results:

- **Disallow transfers if the contract is paused** — prior art, CryptoKitties deployed contract, line 611
- **Blocklist certain address from receiving NFTs** — prior art, CryptoKitties deployed contract, lines 565, 566
- **Disallow unsafe transfers** — `transferFrom` throws unless `_to` equals `msg.sender` or `countOf(_to)` is non-zero or was non-zero previously (because such cases are safe)
- **Charge a fee to both parties of a transaction** — require payment when calling `approve` with a non-zero `_approved` if it was previously the zero address, refund payment if calling `approve` with the zero address if it was previously a non-zero address, require payment when calling any transfer function, require transfer parameter `_to` to equal `msg.sender`, require transfer parameter `_to` to be the approved address for the NFT
- **Read only NFT registry** — always throw from `safeTransferFrom`, `transferFrom`, `approve` and `setApprovalForAll`

Failed transactions will throw, a best practice identified in ERC-223, ERC-677, ERC-827 and OpenZeppelin&apos;s implementation of SafeERC20.sol. ERC-20 defined an `allowance` 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&apos;s original design without problems that have been later discovered.

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 `event` documentation for your responsibilities when creating or destroying NFTs.

We questioned if the `operator` parameter on `onERC721Received` 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 `from` 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.

*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.*

**ERC-165 Interface**

We chose Standard Interface Detection (ERC-165) to expose the interfaces that a ERC-721 smart contract supports.

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 `ERC721Enumerable`, `ERC721Metadata`, or other interfaces by delegating to a separate contract.

**Gas and Complexity** (regarding the enumeration extension)

This specification contemplates implementations that manage a few and *arbitrarily large* numbers of NFTs. If your application is able to grow then avoid using for/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.

We have deployed a contract, XXXXERC721, to Testnet which instantiates and tracks 340282366920938463463374607431768211456 different deeds (2^128). That&apos;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.

This illustration makes clear: the ERC-721 standard scales.

*Alternatives considered: remove the asset enumeration function if it requires a for-loop, return a Solidity array type from enumeration functions.*

**Privacy**

Wallets/brokers/auctioneers identified in the motivation section have a strong need to identify which NFTs an owner owns.

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 `ownerOf` for every possible `tokenId`.

**Metadata Choices** (metadata extension)

We have required `name` and `symbol` 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.

We remind implementation authors that the empty string is a valid response to `name` and `symbol` 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 *your* contract. How a client may determine which ERC-721 smart contracts are well-known (canonical) is outside the scope of this standard.

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.

Metadata is returned as a string value. Currently this is only usable as calling from `web3`, not from other contracts. This is acceptable because we have not considered a use case where an on-blockchain application would query such information.

*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)*

**Community Consensus**

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:

- [@ImAllInNow](https://github.com/imallinnow) Rob from DEC Gaming / Presenting Michigan Ethereum Meetup Feb 7
- [@Arachnid](https://github.com/arachnid) Nick Johnson
- [@jadhavajay](https://github.com/jadhavajay) Ajay Jadhav from AyanWorks
- [@superphly](https://github.com/superphly) Cody Marx Bailey - XRAM Capital / Sharing at hackathon Jan 20 / UN Future of Finance Hackathon.
- [@fulldecent](https://github.com/fulldecent) William Entriken

A second event was held at ETHDenver 2018 to discuss distinguishable asset standards (notes to be published).

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.

## Backwards Compatibility

We have adopted `balanceOf`, `totalSupply`, `name` and `symbol` semantics from the ERC-20 specification. An implementation may also include a function `decimals` that returns `uint8(0)` 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 `decimals` function.

Example NFT implementations as of February 2018:

- CryptoKitties -- Compatible with an earlier version of this standard.
- 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;.
- 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, `approve()` functionality, and metadata. This effort is referenced in the discussion for EIP-173.

Note: &quot;Limited edition, collectible tokens&quot; like Curio Cards and Rare Pepe are *not* distinguishable assets. They&apos;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 `1` in extreme cases).

The `onERC721Received` function specifically works around old deployed contracts which may inadvertently return 1 (`true`) in certain circumstances even if they don&apos;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 `true`s.

## Test Cases

0xcert ERC-721 Token includes test cases written using Truffle.

## Implementations

0xcert ERC721 -- a reference implementation

- MIT licensed, so you can freely use it for your projects
- Includes test cases
- Active bug bounty, you will be paid if you find errors

Su Squares -- an advertising platform where you can rent space and place images

- Complete the Su Squares Bug Bounty Program to seek problems with this standard or its implementation
- Implements the complete standard and all optional interfaces

ERC721ExampleDeed -- an example implementation

- Implements using the OpenZeppelin project format

XXXXERC721, by William Entriken -- a scalable example implementation

- Deployed on testnet with 1 billion assets and supporting all lookups with the metadata extension. This demonstrates that scaling is NOT a problem.

## References

**Standards**

1. [ERC-20](./eip-20.md) Token Standard.
1. [ERC-165](./eip-165.md) Standard Interface Detection.
1. [ERC-173](./eip-173.md) Owned Standard.
1. [ERC-223](https://github.com/ethereum/EIPs/issues/223) Token Standard.
1. [ERC-677](https://github.com/ethereum/EIPs/issues/677) `transferAndCall` Token Standard.
1. [ERC-827](https://github.com/ethereum/EIPs/issues/827) Token Standard.
1. Ethereum Name Service (ENS). https://ens.domains
1. Instagram -- What&apos;s the Image Resolution? https://help.instagram.com/1631821640426723
1. JSON Schema. https://json-schema.org/
1. Multiaddr. https://github.com/multiformats/multiaddr
1. RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https://www.ietf.org/rfc/rfc2119.txt

**Issues**

1. The Original ERC-721 Issue. https://github.com/ethereum/eips/issues/721
1. Solidity Issue \#2330 -- Interface Functions are External. https://github.com/ethereum/solidity/issues/2330
1. Solidity Issue \#3412 -- Implement Interface: Allow Stricter Mutability. https://github.com/ethereum/solidity/issues/3412
1. Solidity Issue \#3419 -- Interfaces Can&apos;t Inherit. https://github.com/ethereum/solidity/issues/3419
1. Solidity Issue \#3494 -- Compiler Incorrectly Reasons About the `selector` Function. https://github.com/ethereum/solidity/issues/3494
1. Solidity Issue \#3544 -- Cannot Calculate Selector of Function Named `transfer`. https://github.com/ethereum/solidity/issues/3544
1. CryptoKitties Bounty Issue \#4 -- Listing all Kitties Owned by a User is `O(n^2)`. https://github.com/axiomzen/cryptokitties-bounty/issues/4
1. OpenZeppelin Issue \#438 -- Implementation of `approve` method violates ERC20 standard. https://github.com/OpenZeppelin/zeppelin-solidity/issues/438
1. Solidity DelegateCallReturnValue Bug. https://solidity.readthedocs.io/en/develop/bugs.html#DelegateCallReturnValue

**Discussions**

1. Reddit (announcement of first live discussion). https://www.reddit.com/r/ethereum/comments/7r2ena/friday_119_live_discussion_on_erc_nonfungible/
1. Gitter #EIPs (announcement of first live discussion). https://gitter.im/ethereum/EIPs?at=5a5f823fb48e8c3566f0a5e7
1. ERC-721 (announcement of first live discussion). https://github.com/ethereum/eips/issues/721#issuecomment-358369377
1. ETHDenver 2018. https://ethdenver.com

**NFT Implementations and Other Projects**

1. CryptoKitties. https://www.cryptokitties.co
1. 0xcert ERC-721 Token. https://github.com/0xcert/ethereum-erc721
1. Su Squares. https://tenthousandsu.com
1. Decentraland. https://decentraland.org
1. CryptoPunks. https://www.larvalabs.com/cryptopunks
1. DMarket. https://www.dmarket.io
1. Enjin Coin. https://enjincoin.io
1. Ubitquity. https://www.ubitquity.io
1. Propy. https://tokensale.propy.com
1. CryptoKitties Deployed Contract. https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code
1. Su Squares Bug Bounty Program. https://github.com/fulldecent/su-squares-bounty
1. XXXXERC721. https://github.com/fulldecent/erc721-example
1. ERC721ExampleDeed. https://github.com/nastassiasachs/ERC721ExampleDeed
1. Curio Cards. https://mycuriocards.com
1. Rare Pepe. https://rarepepewallet.com
1. Auctionhouse Asset Interface. https://github.com/dob/auctionhouse/blob/master/contracts/Asset.sol
1. [OpenZeppelin `SafeERC20.sol` Implementation](../assets/eip-721/SafeERC20.sol).

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 24 Jan 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-721</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-721</guid>
      </item>
    
      <item>
        <title>General data key/value store and execution</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/discussion-for-eip725/12158</comments>
        
        <description>## Abstract

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.

## Motivation

The initial motivation came out of the need to create a smart contract account system that&apos;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.

This standard consists of two sub-standards, a generic data key/value store (`ERC725Y`) and a generic execute function (`ERC725X`). Both of these in combination allow for a very flexible and long-lasting account system. The account version of `ERC725` is standardized under `LSP0-ERC725Account`.

These standards (`ERC725` X and Y) can also be used separately as `ERC725Y` can be used to enhance NFTs and Token metadata or other types of smart contracts. `ERC725X` allows for a generic execution through a smart contract, functioning as an account or actor.

## Specification

### Ownership

This contract is controlled by a single owner. The owner can be a smart contract or an external account.
This standard requires [ERC-173](./eip-173.md) and SHOULD implement the functions:

- `owner() view`
- `transferOwnership(address newOwner)`

And the event:

- `OwnershipTransferred(address indexed previousOwner, address indexed newOwner)`

---

### `ERC725X`

**`ERC725X`** interface id according to [ERC-165](./eip-165.md): `0x7545acac`.

Smart contracts implementing the `ERC725X` standard MUST implement the [ERC-165](./eip-165.md) `supportsInterface(..)` function and MUST support the `ERC165` and `ERC725X` interface ids.

### `ERC725X` Methods

Smart contracts implementing the `ERC725X` standard SHOULD implement all of the functions listed below:

#### execute

```solidity
function execute(uint256 operationType, address target, uint256 value, bytes memory data) external payable returns(bytes memory)
```

Function Selector: `0x44c028fe`

Executes a call on any other smart contracts or address, transfers the blockchains native token, or deploys a new smart contract.


_Parameters:_

- `operationType`: the operation type used to execute.
- `target`: the smart contract or address to call. `target` will be unused if a contract is created (operation types 1 and 2).
- `value`: the amount of native tokens to transfer (in Wei).
- `data`: the call data, or the creation bytecode of the contract to deploy.


_Requirements:_

- MUST only be called by the current owner of the contract.
- MUST revert when the execution or the contract creation fails.
- `target` SHOULD be address(0) in case of contract creation with `CREATE` and `CREATE2` (operation types 1 and 2).
- `value` SHOULD be zero in case of `STATICCALL` or `DELEGATECALL` (operation types 3 and 4).


_Returns:_ `bytes` , the returned data of the called function, or the address of the contract deployed (operation types 1 and 2).

**Triggers Event:** [ContractCreated](#contractcreated), [Executed](#executed)

The following `operationType` COULD exist:

- `0` for `CALL`
- `1` for `CREATE`
- `2` for `CREATE2`
- `3` for `STATICCALL`
- `4` for `DELEGATECALL` - **NOTE** This is a potentially dangerous operation type

Others may be added in the future.

#### data parameter

- For operationType, `CALL`, `STATICCALL` and `DELEGATECALL` the data field can be random bytes or an abi-encoded function call.

- For operationType, `CREATE` the `data` field is the creation bytecode of the contract to deploy appended with the constructor argument(s) abi-encoded.

- For operationType, `CREATE2` the `data` field is the creation bytecode of the contract to deploy appended with:
  1. the constructor argument(s) abi-encoded
  2. a `bytes32` salt.

```
data = &lt;contract-creation-code&gt; + &lt;abi-encoded-constructor-arguments&gt; + &lt;bytes32-salt&gt;
```

&gt; See [EIP-1014: Skinny CREATE2](./eip-1014.md) for more information.

#### executeBatch

```solidity
function executeBatch(uint256[] memory operationsType, address[] memory targets, uint256[] memory values, bytes[] memory datas) external payable returns(bytes[] memory)
```

Function Selector: `0x31858452`

Executes a batch of calls on any other smart contracts, transfers the blockchain native token, or deploys a new smart contract.

_Parameters:_

- `operationsType`: the list of operations type used to execute.
- `targets`: the list of addresses to call. `targets` will be unused if a contract is created (operation types 1 and 2).
- `values`: the list of native token amounts to transfer (in Wei).
- `datas`: the list of call data, or the creation bytecode of the contract to deploy.

_Requirements:_

- Parameters array MUST have the same length.
- MUST only be called by the current owner of the contract.
- MUST revert when the execution or the contract creation fails.
- `target` SHOULD be address(0) in case of contract creation with `CREATE` and `CREATE2` (operation types 1 and 2).
- `value` SHOULD be zero in case of `STATICCALL` or `DELEGATECALL` (operation types 3 and 4).

_Returns:_ `bytes[]` , array list of returned data of the called function, or the address(es) of the contract deployed (operation types 1 and 2).

**Triggers Event:** [ContractCreated](#contractcreated), [Executed](#executed) on each call iteration

### `ERC725X` Events

#### Executed

```solidity
event Executed(uint256 indexed operationType, address indexed target, uint256 indexed value, bytes4 data);
```

MUST be triggered when `execute` creates a new call using the `operationType` `0`, `3`, `4`.

#### ContractCreated

```solidity
event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt);
```

MUST be triggered when `execute` creates a new contract using the `operationType` `1`, `2`.

---

### `ERC725Y`

**`ERC725Y`** interface id according to [ERC-165](./eip-165.md): `0x629aa694`.

Smart contracts implementing the `ERC725Y` standard MUST implement the [ERC-165](./eip-165.md) `supportsInterface(..)` function and MUST support the `ERC165` and `ERC725Y` interface ids.

### `ERC725Y` Methods

Smart contracts implementing the `ERC725Y` standard MUST implement all of the functions listed below:

#### getData

```solidity
function getData(bytes32 dataKey) external view returns(bytes memory)
```

Function Selector: `0x54f6127f`

Gets the data set for the given data key.

_Parameters:_

- `dataKey`: the data key which value to retrieve.

_Returns:_ `bytes` , The data for the requested data key.

#### getDataBatch

```solidity
function getDataBatch(bytes32[] memory dataKeys) external view returns(bytes[] memory)
```

Function Selector: `0xdedff9c6`

Gets array of data at multiple given data keys.

_Parameters:_

- `dataKeys`: the data keys which values to retrieve.

_Returns:_ `bytes[]` , array of data values for the requested data keys.

#### setData

```solidity
function setData(bytes32 dataKey, bytes memory dataValue) external
```

Function Selector: `0x7f23690c`

Sets data as bytes in the storage for a single data key. 

_Parameters:_

- `dataKey`: the data key which value to set.
- `dataValue`: the data to store.

_Requirements:_

- MUST only be called by the current owner of the contract.

**Triggers Event:** [DataChanged](#datachanged)

#### setDataBatch

```solidity
function setDataBatch(bytes32[] memory dataKeys, bytes[] memory dataValues) external
```

Function Selector: `0x97902421`

Sets array of data at multiple data keys. MUST only be called by the current owner of the contract.

_Parameters:_

- `dataKeys`: the data keys which values to set.
- `dataValues`: the array of bytes to set.

_Requirements:_

- Array parameters MUST have the same length.
- MUST only be called by the current owner of the contract.

**Triggers Event:** [DataChanged](#datachanged)

### `ERC725Y` Events

#### DataChanged

```solidity
event DataChanged(bytes32 indexed dataKey, bytes dataValue)
```

MUST be triggered when a data key was successfully set.

### `ERC725Y` Data keys

Data keys, are the way to retrieve values via `getData()`. These `bytes32` 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. `keccak256(&apos;ERCXXXMyNewKeyType&apos;)` which results in: `0x6935a24ea384927f250ee0b954ed498cd9203fc5d2bf95c735e52e6ca675e047`

The `LSP2-ERC725JSONSchema` standard is a more explicit `ERC725Y` data key standard, that defines key types and value types, and their encoding and decoding.

## Rationale

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 `ERC725` smart contract differently.

The data stored in an `ERC725Y` smart contract is not only readable/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.

## Backwards Compatibility

All contracts since `ERC725v2` from 2018/19 should be compatible with the current version of the standard. Mainly interface ID and Event parameters have changed, while `getData(bytes32[])` and `setData(bytes32[], bytes[])` was added as an efficient way to set/get multiple keys at once. The same applies to execution, as `execute(..[])` was added as an efficient way to batch calls.

From 2023 onward, overloading was removed from `ERC-725` (including `ERC725-X` and `ERC725-Y`). This is because, while overloading is accommodated in Solidity, it isn&apos;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.

## Reference Implementation

Reference implementations can be found in [`ERC725.sol`](../assets/eip-725/ERC725.sol).

## Security Considerations

This contract allows generic executions, therefore special care needs to be taken to prevent re-entrancy attacks and other forms of call chain attacks.

When using the operation type `4` for `delegatecall`, it is important to consider that the called contracts can alter the state of the calling contract and also change owner variables and `ERC725Y` data storage entries at will. Additionally calls to `selfdestruct` are possible and other harmful state-changing operations.

### Solidity Interfaces

```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity &gt;=0.5.0 &lt;0.7.0;

// ERC165 identifier: `0x7545acac`
interface IERC725X  /* is ERC165, ERC173 */ {

    event Executed(uint256 indexed operationType, address indexed target, uint256 indexed  value, bytes4 data);
    event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt);


    function execute(uint256 operationType, address target, uint256 value, bytes memory data) external payable returns(bytes memory);

    function executeBatch(uint256[] memory operationsType, address[] memory targets, uint256[] memory values, bytes memory datas) external payable returns(bytes[] memory);
}

// ERC165 identifier: `0x629aa694`
interface IERC725Y /* is ERC165, ERC173 */ {
    
    event DataChanged(bytes32 indexed dataKey, bytes dataValue);

    function getData(bytes32 dataKey) external view returns(bytes memory);
    function getDataBatch(bytes32[] memory dataKeys) external view returns(bytes[] memory);

    function setData(bytes32 dataKey, bytes memory dataValue) external;
    function setDataBatch(bytes32[] memory dataKeys, bytes[] memory dataValues) external;
}
interface IERC725 /* is IERC725X, IERC725Y */ {
}
```

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 02 Oct 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-725</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-725</guid>
      </item>
    
      <item>
        <title>Token Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/777</comments>
        
        <description>## Simple Summary

This EIP defines standard interfaces and behaviors for token contracts.

## Abstract

This standard defines a new way to interact with a token contract while remaining backward compatible with [ERC-20].

It defines advanced features to interact with tokens.
Namely, *operators* to send tokens on behalf of another address&amp;mdash;contract or regular account&amp;mdash;and
send/receive *hooks* to offer token holders more control over their tokens.

It takes advantage of [ERC-1820] 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.

## Motivation

This standard tries to improve upon the widely used [ERC-20] token standard.
The main advantages of this standard are:

1. Uses the same philosophy as Ether in that tokens are sent with `send(dest, value, data)`.

2. Both contracts and regular addresses can control and reject which token they send
   by registering a `tokensToSend` hook.
   (Rejection is done by `revert`ing in the hook function.)

3. Both contracts and regular addresses can control and reject which token they receive
   by registering a `tokensReceived` hook.
   (Rejection is done by `revert`ing in the hook function.)

4. The `tokensReceived` hook allows to send tokens to a contract and notify it in a single transaction,
   unlike [ERC-20] which requires a double call (`approve`/`transferFrom`) to achieve this.

5. 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.

6. Every token transaction contains `data` and `operatorData` bytes fields
   to be used freely to pass data from the holder and the operator, respectively.

7. It is backward compatible with wallets that do not contain the `tokensReceived` hook function
   by deploying a proxy contract implementing the `tokensReceived` hook for the wallet.

## Specification

### ERC777Token (Token Contract)

``` solidity
interface ERC777Token {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function totalSupply() external view returns (uint256);
    function balanceOf(address holder) external view returns (uint256);
    function granularity() external view returns (uint256);

    function defaultOperators() external view returns (address[] memory);
    function isOperatorFor(
        address operator,
        address holder
    ) external view returns (bool);
    function authorizeOperator(address operator) external;
    function revokeOperator(address operator) external;

    function send(address to, uint256 amount, bytes calldata data) external;
    function operatorSend(
        address from,
        address to,
        uint256 amount,
        bytes calldata data,
        bytes calldata operatorData
    ) external;

    function burn(uint256 amount, bytes calldata data) external;
    function operatorBurn(
        address from,
        uint256 amount,
        bytes calldata data,
        bytes calldata operatorData
    ) external;

    event Sent(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256 amount,
        bytes data,
        bytes operatorData
    );
    event Minted(
        address indexed operator,
        address indexed to,
        uint256 amount,
        bytes data,
        bytes operatorData
    );
    event Burned(
        address indexed operator,
        address indexed from,
        uint256 amount,
        bytes data,
        bytes operatorData
    );
    event AuthorizedOperator(
        address indexed operator,
        address indexed holder
    );
    event RevokedOperator(address indexed operator, address indexed holder);
}
```

The token contract MUST implement the above interface.
The implementation MUST follow the specifications described below.

The token contract MUST register the `ERC777Token` interface with its own address via [ERC-1820].

&gt; This is done by calling the `setInterfaceImplementer` function on the [ERC-1820] registry
&gt; with the token contract address as both the address and the implementer
&gt; and the `keccak256` hash of `ERC777Token` (`0xac7fbab5f54a3ca8194167523c6753bfeb96a445279294b6125b68cce2177054`)
&gt; as the interface hash.

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 `ERC777Token` interface for its own address accordingly via ERC1820.
Unregistering implies calling the `setInterfaceImplementer` with the token contract address as the address,
the `keccak256` hash of `ERC777Token` as the interface hash and `0x0` as the implementer.
(See [Set An Interface For An Address][erc1820-set] in [ERC-1820] for more details.)

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&amp;mdash;to display any amount to the end user&amp;mdash;MUST
be 10&lt;sup&gt;18&lt;/sup&gt; of the internal denomination.

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 [ERC-20]&apos;s `decimals` function returning `18`.
E.g. if a token contract returns a balance of `500,000,000,000,000,000` (0.5&amp;times;10&lt;sup&gt;18&lt;/sup&gt;) for a user,
the user interface MUST show `0.5` tokens to the user.
If the user wishes to send `0.3` tokens,
the contract MUST be called with an amount of `300,000,000,000,000,000` (0.3&amp;times;10&lt;sup&gt;18&lt;/sup&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 `uint256` type.

#### **View Functions**

The `view` functions detailed below MUST be implemented.

**`name` function**

``` solidity
function name() external view returns (string memory)
```

Get the name of the token, e.g., `&quot;MyToken&quot;`.

&gt; &lt;small&gt;**identifier:** `06fdde03`&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** Name of the token.&lt;/small&gt;

**`symbol` function**

``` solidity
function symbol() external view returns (string memory)
```

Get the symbol of the token, e.g., `&quot;MYT&quot;`.

&gt; &lt;small&gt;**identifier:** `95d89b41`&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** Symbol of the token.&lt;/small&gt;

**`totalSupply` function**

``` solidity
function totalSupply() external view returns (uint256)
```

Get the total number of minted tokens.

*NOTE*: The total supply MUST be equal to the sum of the balances of all addresses&amp;mdash;as
returned by the `balanceOf` function.

*NOTE*: The total supply MUST be equal to the sum of all the minted tokens
as defined in all the `Minted` events minus the sum of all the burned tokens as defined in all the `Burned` events.

&gt; &lt;small&gt;**identifier:** `18160ddd`&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** Total supply of tokens currently in circulation.&lt;/small&gt;

**`balanceOf` function**

``` solidity
function balanceOf(address holder) external view returns (uint256)
```

Get the balance of the account with address `holder`.

The balance MUST be zero (`0`) or higher.

&gt; &lt;small&gt;**identifier:** `70a08231`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`holder`: Address for which the balance is returned.&lt;/small&gt;
&gt;
&gt; &lt;small&gt;**returns:** Amount of tokens held by `holder` in the token contract.&lt;/small&gt;

**`granularity` function**

``` solidity
function granularity() external view returns (uint256)
```

Get the smallest part of the token that&apos;s not divisible.

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.

The following rules MUST be applied regarding the *granularity*:

- The *granularity* value MUST be set at creation time.

- The *granularity* value MUST NOT be changed, ever.

- The *granularity* value MUST be greater than or equal to `1`.

- All balances MUST be a multiple of the granularity.

- Any amount of tokens (in the internal denomination) minted, sent or burned
  MUST be a multiple of the *granularity* value.

- Any operation that would result in a balance that&apos;s not a multiple of the *granularity* value
  MUST be considered invalid, and the transaction MUST `revert`.

*NOTE*: Most tokens SHOULD be fully partition-able.
I.e., this function SHOULD return `1` unless there is a good reason for not allowing any fraction of the token.

&gt; &lt;small&gt;**identifier:** `556f0dc7`&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** The smallest non-divisible part of the token.&lt;/small&gt;

*NOTE*: [`defaultOperators`][defaultOperators] and [`isOperatorFor`][isOperatorFor] are also `view` functions,
defined under the [operators] for consistency.

*[ERC-20] compatibility requirement*:  
The decimals of the token MUST always be `18`.
For a *pure* ERC-777 token the [ERC-20] `decimals` function is OPTIONAL,
and its existence SHALL NOT be relied upon when interacting with the token contract.
(The decimal value of `18` is implied.)
For an [ERC-20] compatible token, the `decimals` function is REQUIRED and MUST return `18`.
(In [ERC-20], the `decimals` function is OPTIONAL.
If the function is not present, the `decimals` value is not clearly defined and may be assumed to be `0`.
Hence for compatibility reasons, `decimals` MUST be implemented for [ERC-20] compatible tokens.)

#### **Operators**

An `operator` is an address which is allowed to send and burn tokens on behalf of some *holder*.

When an address becomes an *operator* for a *holder*, an `AuthorizedOperator` event MUST be emitted.
The `AuthorizedOperator`&apos;s `operator` (topic 1) and `holder` (topic 2)
MUST be the addresses of the *operator* and the *holder* respectively.

When a *holder* revokes an *operator*, a `RevokedOperator` event MUST be emitted.
The `RevokedOperator`&apos;s `operator` (topic 1) and `holder` (topic 2)
MUST be the addresses of the *operator* and the *holder* respectively.

*NOTE*: A *holder* MAY have multiple *operators* at the same time.

The token MAY define *default operators*.
A *default operator* is an implicitly authorized *operator* for all *holders*.
`AuthorizedOperator` events MUST NOT be emitted when defining the *default operators*.
The rules below apply to *default operators*:

- The token contract MUST define *default operators* at creation time.

- The *default operators* MUST be invariants. I.e., the token contract MUST NOT add or remove *default operators* ever.

- `AuthorizedOperator` events MUST NOT be emitted when defining *default operators*.

- A *holder* MUST be allowed to revoke a *default operator*
  (unless the *holder* is the *default operator* in question).

- A *holder* MUST be allowed to re-authorize a previously revoked *default operator*.

- When a *default operator* is explicitly authorized or revoked for a specific *holder*,
  an `AuthorizedOperator` or `RevokedOperator` event (respectively) MUST be emitted.

The following rules apply to any *operator*:

- An address MUST always be an *operator* for itself. Hence an address MUST NOT ever be revoked as its own *operator*.

- If an address is an *operator* for a *holder*, `isOperatorFor` MUST return `true`.

- If an address is not an *operator* for a *holder*, `isOperatorFor` MUST return `false`.

- The token contract MUST emit an `AuthorizedOperator` event with the correct values
  when a *holder* authorizes an address as its *operator* as defined in the
  [`AuthorizedOperator` Event][authorizedoperator].

- The token contract MUST emit a `RevokedOperator` event with the correct values
  when a *holder* revokes an address as its *operator* as defined in the
  [`RevokedOperator` Event][revokedoperator].

*NOTE*: A *holder* MAY authorize an already authorized *operator*.
An `AuthorizedOperator` MUST be emitted each time.

*NOTE*: A *holder* MAY revoke an already revoked *operator*.
A `RevokedOperator` MUST be emitted each time.

**`AuthorizedOperator` event** &lt;a id=&quot;authorizedoperator&quot;&gt;&lt;/a&gt;

``` solidity
event AuthorizedOperator(address indexed operator, address indexed holder)
```

Indicates the authorization of `operator` as an *operator* for `holder`.

*NOTE*: This event MUST NOT be emitted outside of an *operator* authorization process.

&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address which became an *operator* of `holder`.&lt;/small&gt;  
&gt; &lt;small&gt;`holder`: Address of a *holder* which authorized the `operator` address as an *operator*.&lt;/small&gt;

**`RevokedOperator` event** &lt;a id=&quot;revokedoperator&quot;&gt;&lt;/a&gt;

``` solidity
event RevokedOperator(address indexed operator, address indexed holder)
```

Indicates the revocation of `operator` as an *operator* for `holder`.

*NOTE*: This event MUST NOT be emitted outside of an *operator* revocation process.

&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address which was revoked as an *operator* of `holder`.&lt;/small&gt;  
&gt; &lt;small&gt;`holder`: Address of a *holder* which revoked the `operator` address as an *operator*.&lt;/small&gt;

The `defaultOperators`, `authorizeOperator`, `revokeOperator` and `isOperatorFor` functions described below
MUST be implemented to manage *operators*.
Token contracts MAY implement other functions to manage *operators*.

**`defaultOperators` function** &lt;a id=&quot;defaultOperators&quot;&gt;&lt;/a&gt;

``` solidity
function defaultOperators() external view returns (address[] memory)
```

Get the list of *default operators* as defined by the token contract.

*NOTE*: If the token contract does not have any *default operators*, this function MUST return an empty list.

&gt; &lt;small&gt;**identifier:** `06e48538`&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** List of addresses of all the *default operators*.&lt;/small&gt;

**`authorizeOperator` function**

``` solidity
function authorizeOperator(address operator) external
```

Set a third party `operator` address as an *operator* of `msg.sender` to send and burn tokens on its behalf.

*NOTE*: The *holder* (`msg.sender`) is always an *operator* for itself.
This right SHALL NOT be revoked.
Hence this function MUST `revert` if it is called to authorize the holder (`msg.sender`)
as an *operator* for itself (i.e. if `operator` is equal to `msg.sender`).

&gt; &lt;small&gt;**identifier:** `959b8c3f`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address to set as an *operator* for `msg.sender`.&lt;/small&gt;

**`revokeOperator` function**

``` solidity
function revokeOperator(address operator) external
```

Remove the right of the `operator` address to be an *operator* for `msg.sender`
and to send and burn tokens on its behalf.

*NOTE*: The *holder* (`msg.sender`) is always an *operator* for itself.
This right SHALL NOT be revoked.
Hence this function MUST `revert` if it is called to revoke the holder (`msg.sender`)
as an *operator* for itself (i.e., if `operator` is equal to `msg.sender`).

&gt; &lt;small&gt;**identifier:** `fad8b32a`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address to rescind as an *operator* for `msg.sender`.&lt;/small&gt;

**`isOperatorFor` function** &lt;a id=&quot;isOperatorFor&quot;&gt;&lt;/a&gt;

``` solidity
function isOperatorFor(
    address operator,
    address holder
) external view returns (bool)
```

Indicate whether the `operator` address is an *operator* of the `holder` address.

&gt; &lt;small&gt;**identifier:** `d95b6371`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address which may be an *operator* of `holder`.&lt;/small&gt;  
&gt; &lt;small&gt;`holder`: Address of a *holder* which may have the `operator` address as an *operator*.&lt;/small&gt;
&gt;
&gt; &lt;small&gt;**returns:** `true` if `operator` is an *operator* of `holder` and `false` otherwise.&lt;/small&gt;

*NOTE*: To know which addresses are *operators* for a given *holder*,
one MUST call `isOperatorFor` with the *holder* for each *default operator*
and parse the `AuthorizedOperator`, and `RevokedOperator` events for the *holder* in question.

#### **Sending Tokens**

When an *operator* sends an `amount` of tokens from a *holder* to a *recipient*
with the associated `data` and `operatorData`, the token contract MUST apply the following rules:

- Any authorized *operator* MAY send tokens to any *recipient* (except to `0x0`).

- The balance of the *holder* MUST be decreased by the `amount`.

- The balance of the *recipient* MUST be increased by the `amount`.

- The balance of the *holder* MUST be greater or equal to the `amount`&amp;mdash;such
  that its resulting balance is greater or equal to zero (`0`) after the send.

- The token contract MUST emit a `Sent` event with the correct values as defined in the [`Sent` Event][sent].

- The *operator* MAY include information in the `operatorData`.

- The token contract MUST call the `tokensToSend` hook of the *holder*
  if the *holder* registers an `ERC777TokensSender` implementation via [ERC-1820].

- The token contract MUST call the `tokensReceived` hook of the *recipient*
  if the *recipient* registers an `ERC777TokensRecipient` implementation via [ERC-1820].

- The `data` and `operatorData` MUST be immutable during the entire send process&amp;mdash;hence
  the same `data` and `operatorData` MUST be used to call both hooks and emit the `Sent` event.

The token contract MUST `revert` when sending in any of the following cases:

- The *operator* address is not an authorized operator for the *holder*.

- The resulting *holder* balance or *recipient* balance after the send
  is not a multiple of the *granularity* defined by the token contract.

- The *recipient* is a contract, and it does not implement the `ERC777TokensRecipient` interface via [ERC-1820].

- The address of the *holder* or the *recipient* is `0x0`.

- Any of the resulting balances becomes negative, i.e. becomes less than zero (`0`).

- The `tokensToSend` hook of the *holder* `revert`s.

- The `tokensReceived` hook of the *recipient* `revert`s.

The token contract MAY send tokens from many *holders*, to many *recipients*, or both. In this case:

- The previous send rules MUST apply to all the *holders* and all the *recipients*.
- The sum of all the balances incremented MUST be equal to the total sent `amount`.
- The sum of all the balances decremented MUST be equal to the total sent `amount`.
- A `Sent` event MUST be emitted for every *holder* and *recipient* pair with the corresponding amount for each pair.
- The sum of all the amounts from the `Sent` event MUST be equal to the total sent `amount`.

*NOTE*: Mechanisms such as applying a fee on a send is considered as a send to multiple *recipients*:
the intended *recipient* and the fee *recipient*.

*NOTE*: 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.

*NOTE*: Sending an amount of zero (`0`) tokens is valid and MUST be treated as a regular send.

*Implementation Requirement*:  
- The token contract MUST call the `tokensToSend` hook *before* updating the state.
- The token contract MUST call the `tokensReceived` hook *after* updating the state.  
I.e., `tokensToSend` MUST be called first,
then the balances MUST be updated to reflect the send,
and finally `tokensReceived` MUST be called *afterward*.
Thus a `balanceOf` call within `tokensToSend` returns the balance of the address *before* the send
and a `balanceOf` call within `tokensReceived` returns the balance of the address *after* the send.

*NOTE*: The `data` field contains information provided by the *holder*&amp;mdash;similar
to the data field in a regular ether send transaction.
The `tokensToSend()` hook, the `tokensReceived()`, or both
MAY use the information to decide if they wish to reject the transaction.

*NOTE*: The `operatorData` field is analogous to the `data` field except it SHALL be provided by the *operator*.

The `operatorData` MUST only be provided by the *operator*.
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 `operatorData`, or at most, it would log the `operatorData`.

**`Sent` event** &lt;a id=&quot;sent&quot;&gt;&lt;/a&gt;

``` solidity
event Sent(
    address indexed operator,
    address indexed from,
    address indexed to,
    uint256 amount,
    bytes data,
    bytes operatorData
)
```

Indicate a send of `amount` of tokens from the `from` address to the `to` address by the `operator` address.

*NOTE*: This event MUST NOT be emitted outside of a send or an [ERC-20] transfer process.

&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address which triggered the send.&lt;/small&gt;  
&gt; &lt;small&gt;`from`: *Holder* whose tokens were sent.&lt;/small&gt;  
&gt; &lt;small&gt;`to`: Recipient of the tokens.&lt;/small&gt;  
&gt; &lt;small&gt;`amount`: Number of tokens sent.&lt;/small&gt;  
&gt; &lt;small&gt;`data`: Information provided by the *holder*.&lt;/small&gt;  
&gt; &lt;small&gt;`operatorData`: Information provided by the *operator*.&lt;/small&gt;

The `send` and `operatorSend` functions described below MUST be implemented to send tokens.
Token contracts MAY implement other functions to send tokens.

**`send` function**

``` solidity
function send(address to, uint256 amount, bytes calldata data) external
```

Send the `amount` of tokens from the address `msg.sender` to the address `to`.

The *operator* and the *holder* MUST both be the `msg.sender`.

&gt; &lt;small&gt;**identifier:** `9bd9bbc6`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`to`: Recipient of the tokens.&lt;/small&gt;  
&gt; &lt;small&gt;`amount`: Number of tokens to send.&lt;/small&gt;  
&gt; &lt;small&gt;`data`: Information provided by the *holder*.&lt;/small&gt;

**`operatorSend` function**

``` solidity
function operatorSend(
    address from,
    address to,
    uint256 amount,
    bytes calldata data,
    bytes calldata operatorData
) external
```

Send the `amount` of tokens on behalf of the address `from` to the address `to`.

*Reminder*: If the *operator* address is not an authorized operator of the `from` address,
then the send process MUST `revert`.

*NOTE*: `from` and `msg.sender` MAY be the same address.
I.e., an address MAY call `operatorSend` for itself.
This call MUST be equivalent to `send` with the addition
that the *operator* MAY specify an explicit value for `operatorData`
(which cannot be done with the `send` function).

&gt; &lt;small&gt;**identifier:** `62ad1b83`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`from`: *Holder* whose tokens are being sent.&lt;/small&gt;  
&gt; &lt;small&gt;`to`: Recipient of the tokens.&lt;/small&gt;  
&gt; &lt;small&gt;`amount`: Number of tokens to send.&lt;/small&gt;  
&gt; &lt;small&gt;`data`: Information provided by the *holder*.&lt;/small&gt;  
&gt; &lt;small&gt;`operatorData`: Information provided by the *operator*.&lt;/small&gt;

#### **Minting Tokens**

Minting tokens is the act of producing new tokens.
[ERC-777] intentionally does not define specific functions to mint tokens.
This intent comes from the wish not to limit the use of the [ERC-777] standard
as the minting process is generally specific for every token.

Nonetheless, the rules below MUST be respected when minting for a *recipient*:

- Tokens MAY be minted for any *recipient* address (except `0x0`).

- The total supply MUST be increased by the amount of tokens minted.

- The balance of `0x0` MUST NOT be decreased.

- The balance of the *recipient* MUST be increased by the amount of tokens minted.

- The token contract MUST emit a `Minted` event with the correct values as defined in the [`Minted` Event][minted].

- The token contract MUST call the `tokensReceived` hook of the *recipient*
  if the *recipient* registers an `ERC777TokensRecipient` implementation via [ERC-1820].

- The `data` and `operatorData` MUST be immutable during the entire mint process&amp;mdash;hence
  the same `data` and `operatorData` MUST be used to call the `tokensReceived` hook and emit the `Minted` event.

The token contract MUST `revert` when minting in any of the following cases:

- The resulting *recipient* balance after the mint is not a multiple of the *granularity* defined by the token contract.
- The *recipient* is a contract, and it does not implement the `ERC777TokensRecipient` interface via [ERC-1820].
- The address of the *recipient* is `0x0`.
- The `tokensReceived` hook of the *recipient* `revert`s.

*NOTE*: 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 `Minted` events must be emitted
and the `tokensReceived` hook of the recipient(s) MUST be called.

*[ERC-20] compatibility requirement*:  
While a `Sent` event MUST NOT be emitted when minting,
if the token contract is [ERC-20] backward compatible,
a `Transfer` event with the `from` parameter set to `0x0` SHOULD be emitted as defined in the [ERC-20] standard.

The token contract MAY mint tokens for multiple *recipients* at once. In this case:

- The previous mint rules MUST apply to all the *recipients*.
- The sum of all the balances incremented MUST be equal to the total minted amount.
- A `Minted` event MUST be emitted for every *recipient* with the corresponding amount for each *recipient*.
- The sum of all the amounts from the `Minted` event MUST be equal to the total minted `amount`.

*NOTE*: Minting an amount of zero (`0`) tokens is valid and MUST be treated as a regular mint.

*NOTE*: While during a send or a burn, the data is provided by the *holder*, it is inapplicable for a mint.
In this case the data MAY be provided by the token contract or the *operator*,
for example to ensure a successful minting to a *holder* expecting specific data.

*NOTE*: The `operatorData` field contains information provided by the *operator*&amp;mdash;similar
to the data field in a regular ether send transaction.
The `tokensReceived()` hooks MAY use the information to decide if it wish to reject the transaction.

**`Minted` event** &lt;a id=&quot;minted&quot;&gt;&lt;/a&gt;

``` solidity
event Minted(
    address indexed operator,
    address indexed to,
    uint256 amount,
    bytes data,
    bytes operatorData
)
```

Indicate the minting of `amount` of tokens to the `to` address by the `operator` address.

*NOTE*: This event MUST NOT be emitted outside of a mint process.

&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address which triggered the mint.&lt;/small&gt;  
&gt; &lt;small&gt;`to`: Recipient of the tokens.&lt;/small&gt;  
&gt; &lt;small&gt;`amount`: Number of tokens minted.&lt;/small&gt;  
&gt; &lt;small&gt;`data`: Information provided for the *recipient*.&lt;/small&gt;  
&gt; &lt;small&gt;`operatorData`: Information provided by the *operator*.&lt;/small&gt;

#### **Burning Tokens**

Burning tokens is the act of destroying existing tokens.
[ERC-777] explicitly defines two functions to burn tokens (`burn` and `operatorBurn`).
These functions facilitate the integration of the burning process in wallets and dapps.
However, the token contract MAY prevent some or all *holders* from burning tokens for any reason.
The token contract MAY also define other functions to burn tokens.

The rules below MUST be respected when burning the tokens of a *holder*:

- Tokens MAY be burned from any *holder* address (except `0x0`).

- The total supply MUST be decreased by the amount of tokens burned.

- The balance of `0x0` MUST NOT be increased.

- The balance of the *holder* MUST be decreased by amount of tokens burned.

- The token contract MUST emit a `Burned` event with the correct values as defined in the [`Burned` Event][burned].

- The token contract MUST call the `tokensToSend` hook of the *holder*
  if the *holder* registers an `ERC777TokensSender` implementation via [ERC-1820].

- The `operatorData` MUST be immutable during the entire burn process&amp;mdash;hence
  the same `operatorData` MUST be used to call the `tokensToSend` hook and emit the `Burned` event.

The token contract MUST `revert` when burning in any of the following cases:

- The *operator* address is not an authorized operator for the *holder*.

- The resulting *holder* balance after the burn is not a multiple of the *granularity*
  defined by the token contract.

- The balance of *holder* is inferior to the amount of tokens to burn
  (i.e., resulting in a negative balance for the *holder*).

- The address of the *holder* is `0x0`.

- The `tokensToSend` hook of the *holder* `revert`s.

*[ERC-20] compatibility requirement*:  
While a `Sent` event MUST NOT be emitted when burning;
if the token contract is [ERC-20] enabled, a `Transfer` event with the `to` parameter set to `0x0` SHOULD be emitted.
The [ERC-20] standard does not define the concept of burning tokens, but this is a commonly accepted practice.

The token contract MAY burn tokens for multiple *holders* at once. In this case:

- The previous burn rules MUST apply to each *holders*.
- The sum of all the balances decremented MUST be equal to the total burned amount.
- A `Burned` event MUST be emitted for every *holder* with the corresponding amount for each *holder*.
- The sum of all the amounts from the `Burned` event MUST be equal to the total burned `amount`.

*NOTE*: Burning an amount of zero (`0`) tokens is valid and MUST be treated as a regular burn.

*NOTE*: The `data` field contains information provided by the holder&amp;mdash;similar
to the data field in a regular ether send transaction.
The `tokensToSend()` hook, the `tokensReceived()`, or both
MAY use the information to decide if they wish to reject the transaction.

*NOTE*: The `operatorData` field is analogous to the `data` field except it SHALL be provided by the *operator*.

**`Burned` event** &lt;a id=&quot;burned&quot;&gt;&lt;/a&gt;

``` solidity
event Burned(
    address indexed operator,
    address indexed from,
    uint256 amount,
    bytes data,
    bytes operatorData
);
```

Indicate the burning of `amount` of tokens from the `from` address by the `operator` address.

*NOTE*: This event MUST NOT be emitted outside of a burn process.

&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address which triggered the burn.&lt;/small&gt;  
&gt; &lt;small&gt;`from`: *Holder* whose tokens were burned.&lt;/small&gt;  
&gt; &lt;small&gt;`amount`: Number of tokens burned.&lt;/small&gt;  
&gt; &lt;small&gt;`data`: Information provided by the *holder*.&lt;/small&gt;  
&gt; &lt;small&gt;`operatorData`: Information provided by the *operator*.&lt;/small&gt;

The `burn` and `operatorBurn` functions described below MUST be implemented to burn tokens.
Token contracts MAY implement other functions to burn tokens.

**`burn` function**

``` solidity
function burn(uint256 amount, bytes calldata data) external
```

Burn the `amount` of tokens from the address `msg.sender`.

The *operator* and the *holder* MUST both be the `msg.sender`.

&gt; &lt;small&gt;**identifier:** `fe9d9303`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`amount`: Number of tokens to burn.&lt;/small&gt;  
&gt; &lt;small&gt;`data`: Information provided by the *holder*.&lt;/small&gt;

**`operatorBurn` function**

``` solidity
function operatorBurn(
    address from,
    uint256 amount,
    bytes calldata data,
    bytes calldata operatorData
) external
```

Burn the `amount` of tokens on behalf of the address `from`.

*Reminder*: If the *operator* address is not an authorized operator of the `from` address,
then the burn process MUST `revert`.

&gt; &lt;small&gt;**identifier:** `fc673c4f`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`from`: *Holder* whose tokens will be burned.&lt;/small&gt;  
&gt; &lt;small&gt;`amount`: Number of tokens to burn.&lt;/small&gt;  
&gt; &lt;small&gt;`data`: Information provided by the *holder*.&lt;/small&gt;  
&gt; &lt;small&gt;`operatorData`: Information provided by the *operator*.&lt;/small&gt;

*NOTE*: The *operator* MAY pass any information via `operatorData`.
The `operatorData` MUST only be provided by the *operator*.

*NOTE*: `from` and `msg.sender` MAY be the same address.
I.e., an address MAY call `operatorBurn` for itself.
This call MUST be equivalent to `burn`
with the addition that the *operator* MAY specify an explicit value for `operatorData`
(which cannot be done with the `burn` function).

#### **`ERC777TokensSender` And The `tokensToSend` Hook**

The `tokensToSend` hook notifies of any request to decrement the balance (send and burn) for a given *holder*.
Any address (regular or contract) wishing to be notified of token debits from their address
MAY register the address of a contract implementing the `ERC777TokensSender` interface described below via [ERC-1820].

&gt; This is done by calling the `setInterfaceImplementer` function on the [ERC-1820] registry
&gt; with the *holder* address as the address,
&gt; the `keccak256` hash of `ERC777TokensSender`
&gt; (`0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895`) as the interface hash,
&gt; and the address of the contract implementing the `ERC777TokensSender` as the implementer.

``` solidity
interface ERC777TokensSender {
    function tokensToSend(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes calldata userData,
        bytes calldata operatorData
    ) external;
}
```

*NOTE*: A regular address MAY register a different address&amp;mdash;the address of a contract&amp;mdash;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.

**`tokensToSend`**

``` solidity
function tokensToSend(
    address operator,
    address from,
    address to,
    uint256 amount,
    bytes calldata userData,
    bytes calldata operatorData
) external
```

Notify a request to send or burn (if `to` is `0x0`) an `amount` tokens from the `from` address to the `to` address
by the `operator` address.

*NOTE*: This function MUST NOT be called outside of a burn, send or [ERC-20] transfer process.

&gt; &lt;small&gt;**identifier:** `75ab9782`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address which triggered the balance decrease (through sending or burning).&lt;/small&gt;  
&gt; &lt;small&gt;`from`: *Holder* whose tokens were sent.&lt;/small&gt;  
&gt; &lt;small&gt;`to`: Recipient of the tokens for a send (or `0x0` for a burn).&lt;/small&gt;  
&gt; &lt;small&gt;`amount`: Number of tokens the *holder* balance is decreased by.&lt;/small&gt;  
&gt; &lt;small&gt;`data`: Information provided by the *holder*.&lt;/small&gt;  
&gt; &lt;small&gt;`operatorData`: Information provided by the *operator*.&lt;/small&gt;

The following rules apply when calling the `tokensToSend` hook:

- The `tokensToSend` hook MUST be called for every send and burn processes.

- The `tokensToSend` hook MUST be called *before* the state is updated&amp;mdash;i.e. *before* the balance is decremented.

- `operator` MUST be the address which triggered the send or burn process.

- `from` MUST be the address of the *holder* whose tokens are sent or burned.

- `to` MUST be the address of the *recipient* which receives the tokens for a send.

- `to` MUST be `0x0` for a burn.

- `amount` MUST be the number of tokens the *holder* sent or burned.

- `data` MUST contain the extra information (if any) provided to the send or the burn process.

- `operatorData` MUST contain the extra information provided by the address
  which triggered the decrease of the balance (if any).

- The *holder* MAY block a send or burn process by `revert`ing.
  (I.e., reject the withdrawal of tokens from its account.)

*NOTE*: Multiple *holders* MAY use the same implementation of `ERC777TokensSender`.

*NOTE*: An address can register at most one implementation at any given time for all [ERC-777] tokens.
Hence the `ERC777TokensSender` MUST expect to be called by different token contracts.
The `msg.sender` of the `tokensToSend` call is expected to be the address of the token contract.

*[ERC-20] compatibility requirement*:  
This hook takes precedence over [ERC-20] and MUST be called (if registered)
when calling [ERC-20]&apos;s `transfer` and `transferFrom` event.
When called from a `transfer`, `operator` MUST be the same value as the `from`.
When called from a `transferFrom`, `operator` MUST be the address which issued the `transferFrom` call.

#### **`ERC777TokensRecipient` And The `tokensReceived` Hook**

The `tokensReceived` hook notifies of any increment of the balance (send and mint) for a given *recipient*.
Any address (regular or contract) wishing to be notified of token credits to their address
MAY register the address of a contract implementing the `ERC777TokensRecipient` interface described below via [ERC-1820].

&gt; This is done by calling the `setInterfaceImplementer` function on the [ERC-1820] registry
&gt; with the *recipient* address as the address,
&gt; the `keccak256` hash of `ERC777TokensRecipient`
&gt; (`0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b`) as the interface hash,
&gt; and the address of the contract implementing the `ERC777TokensRecipient` as the implementer.

``` solidity
interface ERC777TokensRecipient {
    function tokensReceived(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes calldata data,
        bytes calldata operatorData
    ) external;
}
```

If the *recipient* is a contract, which has not registered an `ERC777TokensRecipient` implementation;
then the token contract:

- MUST `revert` if the `tokensReceived` hook is called from a mint or send call.

- SHOULD continue processing the transaction
  if the `tokensReceived` hook is called from an ERC-20 `transfer` or `transferFrom` call.

*NOTE*: A regular address MAY register a different address&amp;mdash;the address of a contract&amp;mdash;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.

**`tokensReceived`**

``` solidity
function tokensReceived(
    address operator,
    address from,
    address to,
    uint256 amount,
    bytes calldata data,
    bytes calldata operatorData
) external
```

Notify a send or mint (if `from` is `0x0`) of `amount` tokens from the `from` address to the `to` address
by the `operator` address.

*NOTE*: This function MUST NOT be called outside of a mint, send or [ERC-20] transfer process.

&gt; &lt;small&gt;**identifier:** `0023de29`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`operator`: Address which triggered the balance increase (through sending or minting).&lt;/small&gt;  
&gt; &lt;small&gt;`from`: *Holder* whose tokens were sent (or `0x0` for a mint).&lt;/small&gt;  
&gt; &lt;small&gt;`to`: Recipient of the tokens.&lt;/small&gt;  
&gt; &lt;small&gt;`amount`: Number of tokens the *recipient* balance is increased by.&lt;/small&gt;  
&gt; &lt;small&gt;`data`: Information provided by the *holder*.&lt;/small&gt;  
&gt; &lt;small&gt;`operatorData`: Information provided by the *operator*.&lt;/small&gt;

The following rules apply when calling the `tokensReceived` hook:

- The `tokensReceived` hook MUST be called for every send and mint processes.

- The `tokensReceived` hook MUST be called *after* the state is updated&amp;mdash;i.e. *after* the balance is incremented.

- `operator` MUST be the address which triggered the send or mint process.

- `from` MUST be the address of the *holder* whose tokens are sent for a send.

- `from` MUST be `0x0` for a mint.

- `to` MUST be the address of the *recipient* which receives the tokens.

- `amount` MUST be the number of tokens the *recipient* sent or minted.

- `data` MUST contain the extra information (if any) provided to the send or the mint process.

- `operatorData` MUST contain the extra information provided by the address
  which triggered the increase of the balance (if any).

- The *holder* MAY block a send or mint process by `revert`ing.
  (I.e., reject the reception of tokens.)

*NOTE*: Multiple *holders* MAY use the same implementation of `ERC777TokensRecipient`.

*NOTE*: An address can register at most one implementation at any given time for all [ERC-777] tokens.
Hence the `ERC777TokensRecipient` MUST expect to be called by different token contracts.
The `msg.sender` of the `tokensReceived` call is expected to be the address of the token contract.

*[ERC-20] compatibility requirement*:  
This hook takes precedence over [ERC-20] and MUST be called (if registered)
when calling [ERC-20]&apos;s `transfer` and `transferFrom` event.
When called from a `transfer`, `operator` MUST be the same value as the `from`.
When called from a `transferFrom`, `operator` MUST be the address which issued the `transferFrom` call.

#### **Note On Gas Consumption**

Dapps and wallets SHOULD first estimate the gas required when sending, minting, or burning tokens&amp;mdash;using
[`eth_estimateGas`][eth_estimateGas]&amp;mdash;to avoid running out of gas during the transaction.

### Logo

| **Image** | ![beige logo] | ![white logo] | ![light grey logo] | ![dark grey logo] | ![black logo] |
|----------:|:-------------:|:-------------:|:------------------:|:-----------------:|:-------------:|
| **Color** | beige         | white         | light grey         | dark grey         | black         |
| **Hex**   | `#C99D66`     | `#FFFFFF`     | `#EBEFF0`          | `#3C3C3D`         | `#000000`     |

The logo MAY be used, modified and adapted to promote valid [ERC-777] token implementations
and [ERC-777] compliant technologies such as wallets and dapps.

[ERC-777] token contract authors MAY create a specific logo for their token based on this logo.

The logo MUST NOT be used to advertise, promote or associate in any way technology&amp;mdash;such
as tokens&amp;mdash;which is not [ERC-777] compliant.

The logo for the standard can be found in the [`/assets/eip-777/logo`][logos] folder in `SVG` and `PNG` formats.
The `PNG` version of the logo offers a few sizes in pixels.
If needed, other sizes MAY be created by converting from `SVG` into `PNG`.

## Rationale

The principal intent for this standard is
to solve some of the shortcomings of [ERC-20] while maintaining backward compatibility with [ERC-20],
and avoiding the problems and vulnerabilities of [EIP-223].

Below are the rationales for the decisions regarding the main aspects of the standards.

*NOTE*: Jacques Dafflon ([0xjac]), one of the authors of the standard,
conjointly wrote his [master thesis] 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.

### Lifecycle

More than just sending tokens, [ERC-777] defines the entire lifecycle of a token,
starting with the minting process, followed by the sending process and terminating with the burn process.

Having a lifecycle clearly defined is important for consistency and accuracy,
especially when value is derived from scarcity.
In contrast when looking at some [ERC-20] tokens, a discrepancy can be observed
between the value returned by the `totalSupply` and the actual circulating supply,
as the standard does not clearly define a process to create and destroy tokens.

### Data

The mint, send and burn processes can all make use of a `data` and `operatorData` 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.

The use of a `data` field is equally present in other standard proposals such as [EIP-223],
and was requested by multiple members of the community who reviewed this standard.

### Hooks

In most cases, [ERC-20] requires two calls to safely transfer tokens to a contract without locking them.
A call from the sender, using the `approve` function
and a call from the recipient using `transferFrom`.
Furthermore, this requires extra communication between the parties which is not clearly defined.
Finally, holders can get confused between `transfer` and `approve`/`transferFrom`.
Using the former to transfer tokens to a contract will most likely result in locked tokens.

Hooks allow streamlining of the sending process and offer a single way to send tokens to any recipient.
Thanks to the `tokensReceived` hook, contracts are able to react and prevent locking tokens upon reception.

#### **Greater Control For Holders**

The `tokensReceived` 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 `data` or `operatorData` fields.

Following the same intentions and based on suggestions from the community,
the `tokensToSend` hook was added to give control over and prevent the movement of outgoing tokens.

#### **[ERC-1820] Registry**

The [ERC-1820] Registry allows holders to register their hooks.
Other alternatives were examined beforehand to link hooks and holders.

The first was for hooks to be defined at the sender&apos;s or recipient&apos;s address.
This approach is similar to [EIP-223] which proposes a `tokenFallback` function on recipient contracts
to be called when receiving tokens,
but improves on it by relying on [ERC-165] 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.

The second approach considered was to use [ERC-672] 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.

The third solution&amp;mdash;used in this standard&amp;mdash;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.

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 [ERC-777] and tokens.
The first proposal for this registry was [ERC-820].
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 [ERC-820a], were rejected.
Hence the standard for the registry used for [ERC-777] became [ERC-1820].
[ERC-1820] and [ERC-820] are functionally equivalent. [ERC-1820] simply contains the fix for newer versions of Solidity.

### Operators

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 [ERC-20] where the role of an approved address is not clearly defined,
[ERC-777] 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.

#### **Default Operators**

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.

## Backward Compatibility

This EIP does not introduce backward incompatibilities and is backward compatible with the older [ERC-20] token standard.

This EIP does not use `transfer` and `transferFrom` and uses `send` and `operatorSend`
to avoid confusion and mistakes when deciphering which token standard is being used.

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 `18`.

Therefore a token contract MAY implement both [ERC-20] and [ERC-777] in parallel.
The specification of the `view` functions (such as `name`, `symbol`, `balanceOf`, `totalSupply`) and internal data
(such as the mapping of balances) overlap without problems.
Note however that the following functions are mandatory in [ERC-777] and MUST be implemented:
`name`, `symbol` `balanceOf` and `totalSupply`
(`decimals` is not part of the [ERC-777] standard).

The state-modifying functions from both standards are decoupled and can operate independently from each other.
Note that [ERC-20] functions SHOULD be limited to only being called from old contracts.

If the token implements [ERC-20],
it MUST register the `ERC20Token` interface with its own address via [ERC-1820].
This is done by calling the `setInterfaceImplementer` function on the ERC-1820 registry
with the token contract address as both the address and the implementer
and the `keccak256` hash of `ERC20Token` (`0xaea199e31a596269b42cdafd93407f14436db6e4cad65417994c2eb37381e05a`)
as the interface hash.

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 `ERC20Token` interface for its own address accordingly via ERC1820.
Unregistering implies calling the `setInterfaceImplementer` with the token contract address as the address,
the `keccak256` hash of `ERC20Token` as the interface hash and `0x0` as the implementer.
(See [Set An Interface For An Address][erc1820-set] in [ERC-1820] for more details.)

The difference for new contracts implementing [ERC-20] is that
`tokensToSend` and `tokensReceived` hooks take precedence over [ERC-20].
Even with an [ERC-20] `transfer` and `transferFrom` call, the token contract MUST check via [ERC-1820]
if the `from` and the `to` address implement `tokensToSend` and `tokensReceived` hook respectively.
If any hook is implemented, it MUST be called.
Note that when calling [ERC-20] `transfer` on a contract, if the contract does not implement `tokensReceived`,
the `transfer` call SHOULD still be accepted even if this means the tokens will probably be locked.

The table below summarizes the different actions the token contract MUST take
when sending, minting and transferring token via [ERC-777] and [ERC-20]:

&lt;table&gt;
  &lt;tr&gt;
    &lt;th align=&quot;right&quot;&gt;ERC1820&lt;/th&gt;
    &lt;th&gt;&lt;code&gt;to&lt;/code&gt; address&lt;/th&gt;
    &lt;th align=&quot;center&quot;&gt;ERC777 Sending And Minting&lt;/th&gt;
    &lt;th align=&quot;center&quot;&gt;ERC20 &lt;code&gt;transfer&lt;/code&gt;/&lt;code&gt;transferFrom&lt;/code&gt;&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td rowspan=&quot;2&quot; align=&quot;right&quot;&gt;
      &lt;code&gt;ERC777TokensRecipient&lt;/code&gt;&lt;br/&gt;registered
    &lt;/td&gt;
    &lt;td&gt;regular address&lt;/td&gt;
    &lt;td colspan=&quot;2&quot; rowspan=&quot;2&quot; align=&quot;center&quot;&gt;
      MUST call &lt;code&gt;tokensReceived&lt;/code&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;contract&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td rowspan=&quot;2&quot; align=&quot;right&quot;&gt;
      &lt;code&gt;ERC777TokensRecipient&lt;/code&gt;&lt;br/&gt;not registered
    &lt;/td&gt;
    &lt;td&gt;regular address&lt;/td&gt;
    &lt;td colspan=&quot;2&quot; align=&quot;center&quot;&gt;continue&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;contract&lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;MUST &lt;code&gt;revert&lt;/code&gt;&lt;/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;/a&gt;&lt;/sup&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&gt; &lt;a href=&quot;#continue-footnote-backlink&quot;&gt;&lt;small id=&quot;continue-footnote&quot;&gt;1.&lt;/small&gt;&lt;/a&gt;
&gt; &lt;small&gt;The transaction SHOULD continue for clarity as ERC20 is not aware of hooks.&lt;/small&gt;  
&gt; &lt;small&gt;However, this can result in accidentally locked tokens.&lt;/small&gt;
&gt; &lt;small&gt;If avoiding accidentally locked tokens is paramount, the transaction MAY &lt;code&gt;revert&lt;/code&gt;.&lt;/small&gt;


There is no particular action to take if `tokensToSend` is not implemented.
The movement MUST proceed and only be canceled if another condition is not respected
such as lack of funds or a `revert` in `tokensReceived` (if present).

During a send, mint and burn, the respective `Sent`, `Minted` and `Burned` events MUST be emitted.
Furthermore, if the token contract declares that it implements `ERC20Token` via [ERC-1820],
the token contract SHOULD emit a `Transfer` event for minting and burning
and MUST emit a `Transfer` event for sending (as specified in the [ERC-20] standard).
During an [ERC-20]&apos;s `transfer` or `transferFrom` functions, a valid `Sent` event MUST be emitted.

Hence for any movement of tokens, two events MAY be emitted:
an [ERC-20] `Transfer` and an [ERC-777] `Sent`, `Minted` or `Burned` (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 `Transfer` event MUST be taken into account.
If the application considers the token as an ERC777 token,
then only the `Sent`, `Minted` and `Burned` events MUST be considered.

## Test Cases

The [repository with the reference implementation][0xjac/ERC777] contains all the [tests][ref tests].

## Implementation

The GitHub repository [0xjac/ERC777] contains the [reference implementation].
The reference implementation is also available via [npm][npm/erc777] and can be installed with `npm install erc777`.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

[operators]: #operators

[ERC-20]: ./eip-20.md
[ERC-165]: ./eip-165.md
[ERC-672]: https://github.com/ethereum/EIPs/issues/672
[ERC-777]: ./eip-777.md
[ERC-820]: ./eip-820.md
[ERC-820a]: https://github.com/ethereum/EIPs/pull/1758
[ERC-1820]: ./eip-1820.md
[erc1820-set]: ./eip-1820.md#set-an-interface-for-an-address
[0xjac]: https://github.com/0xjac
[0xjac/ERC777]: https://github.com/0xjac/ERC777
[master thesis]: https://github.com/0xjac/master-thesis
[npm/erc777]: https://www.npmjs.com/package/erc777
[ref tests]: https://github.com/0xjac/ERC777/blob/master/test/ReferenceToken.test.js
[reference implementation]: https://github.com/0xjac/ERC777/blob/master/contracts/examples/ReferenceToken.sol
[EIP-223]: https://github.com/ethereum/EIPs/issues/223
[eth_estimateGas]: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas

[authorizedoperator]: #authorizedoperator
[revokedoperator]: #revokedoperator
[isOperatorFor]: #isOperatorFor
[defaultOperators]: #defaultOperators
[sent]: #sent
[minted]: #minted
[burned]: #burned

[logos]: https://github.com/ethereum/EIPs/tree/master/assets/eip-777/logo
[beige logo]: ../assets/eip-777/logo/png/ERC-777-logo-beige-48px.png
[white logo]: ../assets/eip-777/logo/png/ERC-777-logo-white-48px.png
[light grey logo]: ../assets/eip-777/logo/png/ERC-777-logo-light_grey-48px.png
[dark grey logo]: ../assets/eip-777/logo/png/ERC-777-logo-dark_grey-48px.png
[black logo]: ../assets/eip-777/logo/png/ERC-777-logo-black-48px.png
</description>
        <pubDate>Mon, 20 Nov 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-777</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-777</guid>
      </item>
    
      <item>
        <title>Canary Standard</title>
        <category>Standards Track/ERC</category>
        
        <description>## Simple Summary

A standard interface for canary contracts.

## Abstract

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.

## Motivation

The canary can e.g. be used as a [warrant canary](https://en.wikipedia.org/wiki/Warrant_canary).
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.

## Specification

### Methods

#### isAlive()

Returns if the canary was fed properly to signal e.g. that no warrant was received.

``` js
function isAlive() constant returns (bool alive)
```

#### getBlockOfDeath()

Returns the block the canary died.
Throws if the canary is alive.

``` js
function getBlockOfDeath() constant returns (uint256 block)
```

#### getType()

Returns the type of the canary:

* `1` = Simple (just the pure interface as defined in this ERC)
* `2` = Single feeder (as defined in ERC-TBD)
* `3` = Single feeder with bad food (as defined in ERC-TBD)
* `4` = Multiple feeders (as defined in ERC-TBD)
* `5` = Multiple mandatory feeders (as defined in ERC-TBD)
* `6` = IOT (as defined in ERC-TBD)

`1` 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.

``` js
function getType() constant returns (uint8 type)
```

### Events

#### RIP

MUST trigger when the contract is called the first time after the canary died.

``` js
event RIP()
```

## Implementation

TODO

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 16 Dec 2017 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-801</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-801</guid>
      </item>
    
      <item>
        <title>Pseudo-introspection Registry Contract</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/820</comments>
        
        <description>&gt; :information_source: **[ERC-1820] has superseded [ERC-820].** :information_source:  
&gt; [ERC-1820] fixes the incompatibility in the [ERC-165] logic which was introduced by the Solidty 0.5 update.  
&gt; Have a look at the [official announcement][erc1820-annoucement], and the comments about the [bug][erc820-bug] and the [fix][erc820-fix].  
&gt; Apart from this fix, [ERC-1820] is functionally equivalent to [ERC-820].
&gt;
&gt; :warning: [ERC-1820] MUST be used in lieu of [ERC-820]. :warning:


## Simple Summary

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.

This standard keeps backward compatibility with [ERC-165].

## Abstract

This standard defines a registry where smart contracts and regular accounts can publish which functionalities they implement---either directly or through a proxy contract.

Anyone can query this registry to ask if a specific address implements a given interface and which smart contract handles its implementation.

This registry MAY be deployed on any chain and shares the same address on all chains.

Interfaces with zeroes (`0`) as the last 28 bytes are considered [ERC-165] interfaces, and this registry SHALL forward the call to the contract to see if it implements the interface.

This contract also acts as an [ERC-165] cache to reduce gas consumption.

## Motivation

There have been different approaches to define pseudo-introspection in Ethereum. The first is [ERC-165] which has the limitation that it cannot be used by regular accounts. The second attempt is [ERC-672] which uses reverse [ENS]. Using reverse [ENS] has two issues. First, it is unnecessarily complicated, and second, [ENS] is still a centralized contract controlled by a multisig. This multisig theoretically would be able to modify the system.

This standard is much simpler than [ERC-672], and it is *fully* decentralized.

This standard also provides a *unique* address for all chains. Thus solving the problem of resolving the correct registry address for different chains.

## Specification

### [ERC-820] Registry Smart Contract

&gt; This is an exact copy of the code of the [ERC820 registry smart contract].

``` solidity
/* ERC820 Pseudo-introspection Registry Contract
 * 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.
 *
 * Written in 2018 by Jordi Baylina and Jacques Dafflon
 *
 * To the extent possible under law, the author(s) have dedicated all copyright
 * and related and neighboring rights to this software to the public domain
 * worldwide. This software is distributed without any warranty.
 *
 * You should have received a copy of the CC0 Public Domain Dedication along
 * with this software. If not, see
 * &lt;https://creativecommons.org/publicdomain/zero/1.0/&gt;.
 *
 *    ███████╗██████╗  ██████╗ █████╗ ██████╗  ██████╗
 *    ██╔════╝██╔══██╗██╔════╝██╔══██╗╚════██╗██╔═████╗
 *    █████╗  ██████╔╝██║     ╚█████╔╝ █████╔╝██║██╔██║
 *    ██╔══╝  ██╔══██╗██║     ██╔══██╗██╔═══╝ ████╔╝██║
 *    ███████╗██║  ██║╚██████╗╚█████╔╝███████╗╚██████╔╝
 *    ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚════╝ ╚══════╝ ╚═════╝
 *
 *    ██████╗ ███████╗ ██████╗ ██╗███████╗████████╗██████╗ ██╗   ██╗
 *    ██╔══██╗██╔════╝██╔════╝ ██║██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝
 *    ██████╔╝█████╗  ██║  ███╗██║███████╗   ██║   ██████╔╝ ╚████╔╝
 *    ██╔══██╗██╔══╝  ██║   ██║██║╚════██║   ██║   ██╔══██╗  ╚██╔╝
 *    ██║  ██║███████╗╚██████╔╝██║███████║   ██║   ██║  ██║   ██║
 *    ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝
 *
 */
pragma solidity 0.4.24;
// IV is value needed to have a vanity address starting with `0x820`.
// IV: 9513

/// @dev The interface a contract MUST implement if it is the implementer of
/// some (other) interface for any address other than itself.
interface ERC820ImplementerInterface {
    /// @notice Indicates whether the contract implements the interface `interfaceHash` for the address `addr` or not.
    /// @param interfaceHash keccak256 hash of the name of the interface
    /// @param addr Address for which the contract will implement the interface
    /// @return ERC820_ACCEPT_MAGIC only if the contract implements `interfaceHash` for the address `addr`.
    function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32);
}


/// @title ERC820 Pseudo-introspection Registry Contract
/// @author Jordi Baylina and Jacques Dafflon
/// @notice This contract is the official implementation of the ERC820 Registry.
/// @notice For more details, see https://eips.ethereum.org/EIPS/eip-820
contract ERC820Registry {
    /// @notice ERC165 Invalid ID.
    bytes4 constant INVALID_ID = 0xffffffff;
    /// @notice Method ID for the ERC165 supportsInterface method (= `bytes4(keccak256(&apos;supportsInterface(bytes4)&apos;))`).
    bytes4 constant ERC165ID = 0x01ffc9a7;
    /// @notice Magic value which is returned if a contract implements an interface on behalf of some other address.
    bytes32 constant ERC820_ACCEPT_MAGIC = keccak256(abi.encodePacked(&quot;ERC820_ACCEPT_MAGIC&quot;));

    mapping (address =&gt; mapping(bytes32 =&gt; address)) interfaces;
    mapping (address =&gt; address) managers;
    mapping (address =&gt; mapping(bytes4 =&gt; bool)) erc165Cached;

    /// @notice Indicates a contract is the `implementer` of `interfaceHash` for `addr`.
    event InterfaceImplementerSet(address indexed addr, bytes32 indexed interfaceHash, address indexed implementer);
    /// @notice Indicates `newManager` is the address of the new manager for `addr`.
    event ManagerChanged(address indexed addr, address indexed newManager);

    /// @notice Query if an address implements an interface and through which contract.
    /// @param _addr Address being queried for the implementer of an interface.
    /// (If `_addr == 0` then `msg.sender` is assumed.)
    /// @param _interfaceHash keccak256 hash of the name of the interface as a string.
    /// E.g., `web3.utils.keccak256(&apos;ERC777Token&apos;)`.
    /// @return The address of the contract which implements the interface `_interfaceHash` for `_addr`
    /// or `0x0` if `_addr` did not register an implementer for this interface.
    function getInterfaceImplementer(address _addr, bytes32 _interfaceHash) external view returns (address) {
        address addr = _addr == 0 ? msg.sender : _addr;
        if (isERC165Interface(_interfaceHash)) {
            bytes4 erc165InterfaceHash = bytes4(_interfaceHash);
            return implementsERC165Interface(addr, erc165InterfaceHash) ? addr : 0;
        }
        return interfaces[addr][_interfaceHash];
    }

    /// @notice 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.)
    /// @param _addr Address to define the interface for. (If `_addr == 0` then `msg.sender` is assumed.)
    /// @param _interfaceHash keccak256 hash of the name of the interface as a string.
    /// For example, `web3.utils.keccak256(&apos;ERC777TokensRecipient&apos;)` for the `ERC777TokensRecipient` interface.
    /// @param _implementer Contract address implementing _interfaceHash for _addr.
    function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) external {
        address addr = _addr == 0 ? msg.sender : _addr;
        require(getManager(addr) == msg.sender, &quot;Not the manager&quot;);

        require(!isERC165Interface(_interfaceHash), &quot;Must not be a ERC165 hash&quot;);
        if (_implementer != 0 &amp;&amp; _implementer != msg.sender) {
            require(
                ERC820ImplementerInterface(_implementer)
                    .canImplementInterfaceForAddress(_interfaceHash, addr) == ERC820_ACCEPT_MAGIC,
                &quot;Does not implement the interface&quot;
            );
        }
        interfaces[addr][_interfaceHash] = _implementer;
        emit InterfaceImplementerSet(addr, _interfaceHash, _implementer);
    }

    /// @notice Sets the `_newManager` as manager for the `_addr` address.
    /// The new manager will be able to call `setInterfaceImplementer` for `_addr`.
    /// @param _addr Address for which to set the new manager.
    /// @param _newManager Address of the new manager for `addr`.
    function setManager(address _addr, address _newManager) external {
        require(getManager(_addr) == msg.sender, &quot;Not the manager&quot;);
        managers[_addr] = _newManager == _addr ? 0 : _newManager;
        emit ManagerChanged(_addr, _newManager);
    }

    /// @notice Get the manager of an address.
    /// @param _addr Address for which to return the manager.
    /// @return Address of the manager for a given address.
    function getManager(address _addr) public view returns(address) {
        // By default the manager of an address is the same address
        if (managers[_addr] == 0) {
            return _addr;
        } else {
            return managers[_addr];
        }
    }

    /// @notice Compute the keccak256 hash of an interface given its name.
    /// @param _interfaceName Name of the interface.
    /// @return The keccak256 hash of an interface name.
    function interfaceHash(string _interfaceName) external pure returns(bytes32) {
        return keccak256(abi.encodePacked(_interfaceName));
    }

    /* --- ERC165 Related Functions --- */
    /* --- Developed in collaboration with William Entriken. --- */

    /// @notice Updates the cache with whether the contract implements an ERC165 interface or not.
    /// @param _contract Address of the contract for which to update the cache.
    /// @param _interfaceId ERC165 interface for which to update the cache.
    function updateERC165Cache(address _contract, bytes4 _interfaceId) external {
        interfaces[_contract][_interfaceId] = implementsERC165InterfaceNoCache(_contract, _interfaceId) ? _contract : 0;
        erc165Cached[_contract][_interfaceId] = true;
    }

    /// @notice Checks whether a contract implements an ERC165 interface or not.
    /// The result may be cached, if not a direct lookup is performed.
    /// @param _contract Address of the contract to check.
    /// @param _interfaceId ERC165 interface to check.
    /// @return `true` if `_contract` implements `_interfaceId`, false otherwise.
    function implementsERC165Interface(address _contract, bytes4 _interfaceId) public view returns (bool) {
        if (!erc165Cached[_contract][_interfaceId]) {
            return implementsERC165InterfaceNoCache(_contract, _interfaceId);
        }
        return interfaces[_contract][_interfaceId] == _contract;
    }

    /// @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.
    /// @param _contract Address of the contract to check.
    /// @param _interfaceId ERC165 interface to check.
    /// @return `true` if `_contract` implements `_interfaceId`, false otherwise.
    function implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) public view returns (bool) {
        uint256 success;
        uint256 result;

        (success, result) = noThrowCall(_contract, ERC165ID);
        if (success == 0 || result == 0) {
            return false;
        }

        (success, result) = noThrowCall(_contract, INVALID_ID);
        if (success == 0 || result != 0) {
            return false;
        }

        (success, result) = noThrowCall(_contract, _interfaceId);
        if (success == 1 &amp;&amp; result == 1) {
            return true;
        }
        return false;
    }

    /// @notice Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.
    /// @param _interfaceHash The hash to check.
    /// @return `true` if the hash is a ERC165 interface (ending with 28 zeroes), `false` otherwise.
    function isERC165Interface(bytes32 _interfaceHash) internal pure returns (bool) {
        return _interfaceHash &amp; 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0;
    }

    /// @dev Make a call on a contract without throwing if the function does not exist.
    function noThrowCall(address _contract, bytes4 _interfaceId)
        internal view returns (uint256 success, uint256 result)
    {
        bytes4 erc165ID = ERC165ID;

        assembly {
                let x := mload(0x40)               // Find empty storage location using &quot;free memory pointer&quot;
                mstore(x, erc165ID)                // Place signature at beginning of empty storage
                mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature

                success := staticcall(
                    30000,                         // 30k gas
                    _contract,                     // To addr
                    x,                             // Inputs are stored at location x
                    0x08,                          // Inputs are 8 bytes long
                    x,                             // Store output over input (saves space)
                    0x20                           // Outputs are 32 bytes long
                )

                result := mload(x)                 // Load the result
        }
    }
}

```

### Deployment Transaction

Below is the raw transaction which MUST be used to deploy the smart contract on any chain.

```
0xf90a2a8085174876e800830c35008080b909d7608060405234801561001057600080fd5b506109b7806100206000396000f30060806040526004361061008d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166329965a1d81146100925780633d584063146100bf5780635df8122f146100fc57806365ba36c114610123578063a41e7d5114610155578063aabbb8ca14610183578063b7056765146101a7578063f712f3e8146101e9575b600080fd5b34801561009e57600080fd5b506100bd600160a060020a036004358116906024359060443516610217565b005b3480156100cb57600080fd5b506100e0600160a060020a0360043516610512565b60408051600160a060020a039092168252519081900360200190f35b34801561010857600080fd5b506100bd600160a060020a036004358116906024351661055e565b34801561012f57600080fd5b506101436004803560248101910135610655565b60408051918252519081900360200190f35b34801561016157600080fd5b506100bd600160a060020a0360043516600160e060020a0319602435166106e3565b34801561018f57600080fd5b506100e0600160a060020a036004351660243561076d565b3480156101b357600080fd5b506101d5600160a060020a0360043516600160e060020a0319602435166107e7565b604080519115158252519081900360200190f35b3480156101f557600080fd5b506101d5600160a060020a0360043516600160e060020a03196024351661089c565b6000600160a060020a0384161561022e5783610230565b335b90503361023c82610512565b600160a060020a03161461029a576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6102a38361091c565b156102f8576040805160e560020a62461bcd02815260206004820152601960248201527f4d757374206e6f74206265206120455243313635206861736800000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103195750600160a060020a0382163314155b156104a15760405160200180807f4552433832305f4143434550545f4d414749430000000000000000000000000081525060130190506040516020818303038152906040526040518082805190602001908083835b6020831061038d5780518252601f19909201916020918201910161036e565b51815160209384036101000a6000190180199092169116179052604080519290940182900382207f249cb3fa000000000000000000000000000000000000000000000000000000008352600483018a9052600160a060020a0388811660248501529451909650938816945063249cb3fa936044808401945091929091908290030181600087803b15801561042057600080fd5b505af1158015610434573d6000803e3d6000fd5b505050506040513d602081101561044a57600080fd5b5051146104a1576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03808216600090815260016020526040812054909116151561053c575080610559565b50600160a060020a03808216600090815260016020526040902054165b919050565b3361056883610512565b600160a060020a0316146105c6576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146105e557806105e8565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b60008282604051602001808383808284378201915050925050506040516020818303038152906040526040518082805190602001908083835b602083106106ad5780518252601f19909201916020918201910161068e565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902090505b92915050565b6106ed82826107e7565b6106f85760006106fa565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b60008080600160a060020a038516156107865784610788565b335b91506107938461091c565b156107b85750826107a4828261089c565b6107af5760006107b1565b815b92506107df565b600160a060020a038083166000908152602081815260408083208884529091529020541692505b505092915050565b60008080610815857f01ffc9a70000000000000000000000000000000000000000000000000000000061093e565b9092509050811580610825575080155b1561083357600092506107df565b61084585600160e060020a031961093e565b909250905081158061085657508015155b1561086457600092506107df565b61086e858561093e565b90925090506001821480156108835750806001145b1561089157600192506107df565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108e4576108dd83836107e7565b90506106dd565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160088189617530fa9051909690955093505050505600a165627a7a723058204fc4461c9d5a247b0eafe0f9c508057bc0ad72bc24668cb2a35ea65850e10d3100291ba08208208208208208208208208208208208208208208208208208208208208200a00820820820820820820820820820820820820820820820820820820820820820
```

The strings of `820`&apos;s at the end of the transaction are the `r` and `s` 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.

### Deployment Method

This contract is going to be deployed using the keyless deployment method---also known as [Nick]&apos;s method---which relies on a single-use address. (See [Nick&apos;s article] for more details). This method works as follows:

1. Generate a transaction which deploys the contract from a new random account.
  - This transaction MUST NOT use [EIP-155] in order to work on any chain.
  - 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.

2. Set the `v`, `r`, `s` of the transaction signature to the following values:

   ```
   v: 27
   r: 0x8208208208208208208208208208208208208208208208208208208208208200
   s: 0x0820820820820820820820820820820820820820820820820820820820820820
   ```

   Those `r` and `s` values---made of a repeating pattern of `820`&apos;s---are predictable &quot;random numbers&quot; generated deterministically by a human.

   &gt; The values of `r` and `s` must be 32 bytes long each---or 64 characters in hexadecimal. Since `820` is 3 characters long and 3 is not a divisor of 64, but it is a divisor of 63, the `r` and `s` values are padded with one extra character.  
   &gt; The `s` value is prefixed with a single zero (`0`). The `0` prefix also guarantees that `s &lt; secp256k1n ÷ 2 + 1`.  
   &gt; The `r` value, cannot be prefixed with a zero, as the transaction becomes invalid. Instead it is suffixed with a zero (`0`) which still respects the condition `s &lt; secp256k1n`.

3. We recover the sender of this transaction, i.e., the single-use deployment account.

    &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.

4. Send exactly 0.08 ethers to this single-use deployment account.

5. Broadcast the deployment transaction.

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.


### Single-use Registry Deployment Account

```
0xE6C244a1C10Aa0085b0cf92f04cdaD947C2988b8
```

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.

&gt; To deploy the registry, 0.08 ethers MUST be sent to this account *first*.

### Registry Contract Address

```
0x820b586C8C28125366C998641B09DCbE7d4cBF06
```

The contract has the address above for every chain on which it is deployed.

&lt;details&gt;
&lt;summary&gt;Raw metadata of &lt;code&gt;./contracts/ERC820Registry.sol&lt;/code&gt;&lt;/summary&gt;

```json
{
  &quot;compiler&quot;: {
    &quot;version&quot;: &quot;0.4.24+commit.e67f0147&quot;
  },
  &quot;language&quot;: &quot;Solidity&quot;,
  &quot;output&quot;: {
    &quot;abi&quot;: [
      {
        &quot;constant&quot;: false,
        &quot;inputs&quot;: [
          {
            &quot;name&quot;: &quot;_addr&quot;,
            &quot;type&quot;: &quot;address&quot;
          },
          {
            &quot;name&quot;: &quot;_interfaceHash&quot;,
            &quot;type&quot;: &quot;bytes32&quot;
          },
          {
            &quot;name&quot;: &quot;_implementer&quot;,
            &quot;type&quot;: &quot;address&quot;
          }
        ],
        &quot;name&quot;: &quot;setInterfaceImplementer&quot;,
        &quot;outputs&quot;: [],
        &quot;payable&quot;: false,
        &quot;stateMutability&quot;: &quot;nonpayable&quot;,
        &quot;type&quot;: &quot;function&quot;
      },
      {
        &quot;constant&quot;: true,
        &quot;inputs&quot;: [
          {
            &quot;name&quot;: &quot;_addr&quot;,
            &quot;type&quot;: &quot;address&quot;
          }
        ],
        &quot;name&quot;: &quot;getManager&quot;,
        &quot;outputs&quot;: [
          {
            &quot;name&quot;: &quot;&quot;,
            &quot;type&quot;: &quot;address&quot;
          }
        ],
        &quot;payable&quot;: false,
        &quot;stateMutability&quot;: &quot;view&quot;,
        &quot;type&quot;: &quot;function&quot;
      },
      {
        &quot;constant&quot;: false,
        &quot;inputs&quot;: [
          {
            &quot;name&quot;: &quot;_addr&quot;,
            &quot;type&quot;: &quot;address&quot;
          },
          {
            &quot;name&quot;: &quot;_newManager&quot;,
            &quot;type&quot;: &quot;address&quot;
          }
        ],
        &quot;name&quot;: &quot;setManager&quot;,
        &quot;outputs&quot;: [],
        &quot;payable&quot;: false,
        &quot;stateMutability&quot;: &quot;nonpayable&quot;,
        &quot;type&quot;: &quot;function&quot;
      },
      {
        &quot;constant&quot;: true,
        &quot;inputs&quot;: [
          {
            &quot;name&quot;: &quot;_interfaceName&quot;,
            &quot;type&quot;: &quot;string&quot;
          }
        ],
        &quot;name&quot;: &quot;interfaceHash&quot;,
        &quot;outputs&quot;: [
          {
            &quot;name&quot;: &quot;&quot;,
            &quot;type&quot;: &quot;bytes32&quot;
          }
        ],
        &quot;payable&quot;: false,
        &quot;stateMutability&quot;: &quot;pure&quot;,
        &quot;type&quot;: &quot;function&quot;
      },
      {
        &quot;constant&quot;: false,
        &quot;inputs&quot;: [
          {
            &quot;name&quot;: &quot;_contract&quot;,
            &quot;type&quot;: &quot;address&quot;
          },
          {
            &quot;name&quot;: &quot;_interfaceId&quot;,
            &quot;type&quot;: &quot;bytes4&quot;
          }
        ],
        &quot;name&quot;: &quot;updateERC165Cache&quot;,
        &quot;outputs&quot;: [],
        &quot;payable&quot;: false,
        &quot;stateMutability&quot;: &quot;nonpayable&quot;,
        &quot;type&quot;: &quot;function&quot;
      },
      {
        &quot;constant&quot;: true,
        &quot;inputs&quot;: [
          {
            &quot;name&quot;: &quot;_addr&quot;,
            &quot;type&quot;: &quot;address&quot;
          },
          {
            &quot;name&quot;: &quot;_interfaceHash&quot;,
            &quot;type&quot;: &quot;bytes32&quot;
          }
        ],
        &quot;name&quot;: &quot;getInterfaceImplementer&quot;,
        &quot;outputs&quot;: [
          {
            &quot;name&quot;: &quot;&quot;,
            &quot;type&quot;: &quot;address&quot;
          }
        ],
        &quot;payable&quot;: false,
        &quot;stateMutability&quot;: &quot;view&quot;,
        &quot;type&quot;: &quot;function&quot;
      },
      {
        &quot;constant&quot;: true,
        &quot;inputs&quot;: [
          {
            &quot;name&quot;: &quot;_contract&quot;,
            &quot;type&quot;: &quot;address&quot;
          },
          {
            &quot;name&quot;: &quot;_interfaceId&quot;,
            &quot;type&quot;: &quot;bytes4&quot;
          }
        ],
        &quot;name&quot;: &quot;implementsERC165InterfaceNoCache&quot;,
        &quot;outputs&quot;: [
          {
            &quot;name&quot;: &quot;&quot;,
            &quot;type&quot;: &quot;bool&quot;
          }
        ],
        &quot;payable&quot;: false,
        &quot;stateMutability&quot;: &quot;view&quot;,
        &quot;type&quot;: &quot;function&quot;
      },
      {
        &quot;constant&quot;: true,
        &quot;inputs&quot;: [
          {
            &quot;name&quot;: &quot;_contract&quot;,
            &quot;type&quot;: &quot;address&quot;
          },
          {
            &quot;name&quot;: &quot;_interfaceId&quot;,
            &quot;type&quot;: &quot;bytes4&quot;
          }
        ],
        &quot;name&quot;: &quot;implementsERC165Interface&quot;,
        &quot;outputs&quot;: [
          {
            &quot;name&quot;: &quot;&quot;,
            &quot;type&quot;: &quot;bool&quot;
          }
        ],
        &quot;payable&quot;: false,
        &quot;stateMutability&quot;: &quot;view&quot;,
        &quot;type&quot;: &quot;function&quot;
      },
      {
        &quot;anonymous&quot;: false,
        &quot;inputs&quot;: [
          {
            &quot;indexed&quot;: true,
            &quot;name&quot;: &quot;addr&quot;,
            &quot;type&quot;: &quot;address&quot;
          },
          {
            &quot;indexed&quot;: true,
            &quot;name&quot;: &quot;interfaceHash&quot;,
            &quot;type&quot;: &quot;bytes32&quot;
          },
          {
            &quot;indexed&quot;: true,
            &quot;name&quot;: &quot;implementer&quot;,
            &quot;type&quot;: &quot;address&quot;
          }
        ],
        &quot;name&quot;: &quot;InterfaceImplementerSet&quot;,
        &quot;type&quot;: &quot;event&quot;
      },
      {
        &quot;anonymous&quot;: false,
        &quot;inputs&quot;: [
          {
            &quot;indexed&quot;: true,
            &quot;name&quot;: &quot;addr&quot;,
            &quot;type&quot;: &quot;address&quot;
          },
          {
            &quot;indexed&quot;: true,
            &quot;name&quot;: &quot;newManager&quot;,
            &quot;type&quot;: &quot;address&quot;
          }
        ],
        &quot;name&quot;: &quot;ManagerChanged&quot;,
        &quot;type&quot;: &quot;event&quot;
      }
    ],
    &quot;devdoc&quot;: {
      &quot;author&quot;: &quot;Jordi Baylina and Jacques Dafflon&quot;,
      &quot;methods&quot;: {
        &quot;getInterfaceImplementer(address,bytes32)&quot;: {
          &quot;params&quot;: {
            &quot;_addr&quot;: &quot;Address being queried for the implementer of an interface. (If `_addr == 0` then `msg.sender` is assumed.)&quot;,
            &quot;_interfaceHash&quot;: &quot;keccak256 hash of the name of the interface as a string. E.g., `web3.utils.keccak256(&apos;ERC777Token&apos;)`.&quot;
          },
          &quot;return&quot;: &quot;The address of the contract which implements the interface `_interfaceHash` for `_addr` or `0x0` if `_addr` did not register an implementer for this interface.&quot;
        },
        &quot;getManager(address)&quot;: {
          &quot;params&quot;: {
            &quot;_addr&quot;: &quot;Address for which to return the manager.&quot;
          },
          &quot;return&quot;: &quot;Address of the manager for a given address.&quot;
        },
        &quot;implementsERC165Interface(address,bytes4)&quot;: {
          &quot;params&quot;: {
            &quot;_contract&quot;: &quot;Address of the contract to check.&quot;,
            &quot;_interfaceId&quot;: &quot;ERC165 interface to check.&quot;
          },
          &quot;return&quot;: &quot;`true` if `_contract` implements `_interfaceId`, false otherwise.&quot;
        },
        &quot;implementsERC165InterfaceNoCache(address,bytes4)&quot;: {
          &quot;params&quot;: {
            &quot;_contract&quot;: &quot;Address of the contract to check.&quot;,
            &quot;_interfaceId&quot;: &quot;ERC165 interface to check.&quot;
          },
          &quot;return&quot;: &quot;`true` if `_contract` implements `_interfaceId`, false otherwise.&quot;
        },
        &quot;interfaceHash(string)&quot;: {
          &quot;params&quot;: {
            &quot;_interfaceName&quot;: &quot;Name of the interface.&quot;
          },
          &quot;return&quot;: &quot;The keccak256 hash of an interface name.&quot;
        },
        &quot;setInterfaceImplementer(address,bytes32,address)&quot;: {
          &quot;params&quot;: {
            &quot;_addr&quot;: &quot;Address to define the interface for. (If `_addr == 0` then `msg.sender` is assumed.)&quot;,
            &quot;_implementer&quot;: &quot;Contract address implementing _interfaceHash for _addr.&quot;,
            &quot;_interfaceHash&quot;: &quot;keccak256 hash of the name of the interface as a string. For example, `web3.utils.keccak256(&apos;ERC777TokensRecipient&apos;)` for the `ERC777TokensRecipient` interface.&quot;
          }
        },
        &quot;setManager(address,address)&quot;: {
          &quot;params&quot;: {
            &quot;_addr&quot;: &quot;Address for which to set the new manager.&quot;,
            &quot;_newManager&quot;: &quot;Address of the new manager for `addr`.&quot;
          }
        },
        &quot;updateERC165Cache(address,bytes4)&quot;: {
          &quot;params&quot;: {
            &quot;_contract&quot;: &quot;Address of the contract for which to update the cache.&quot;,
            &quot;_interfaceId&quot;: &quot;ERC165 interface for which to update the cache.&quot;
          }
        }
      },
      &quot;title&quot;: &quot;ERC820 Pseudo-introspection Registry Contract&quot;
    },
    &quot;userdoc&quot;: {
      &quot;methods&quot;: {
        &quot;getInterfaceImplementer(address,bytes32)&quot;: {
          &quot;notice&quot;: &quot;Query if an address implements an interface and through which contract.&quot;
        },
        &quot;getManager(address)&quot;: {
          &quot;notice&quot;: &quot;Get the manager of an address.&quot;
        },
        &quot;implementsERC165Interface(address,bytes4)&quot;: {
          &quot;notice&quot;: &quot;Checks whether a contract implements an ERC165 interface or not. The result may be cached, if not a direct lookup is performed.&quot;
        },
        &quot;implementsERC165InterfaceNoCache(address,bytes4)&quot;: {
          &quot;notice&quot;: &quot;Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.&quot;
        },
        &quot;interfaceHash(string)&quot;: {
          &quot;notice&quot;: &quot;Compute the keccak256 hash of an interface given its name.&quot;
        },
        &quot;setInterfaceImplementer(address,bytes32,address)&quot;: {
          &quot;notice&quot;: &quot;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.)&quot;
        },
        &quot;setManager(address,address)&quot;: {
          &quot;notice&quot;: &quot;Sets the `_newManager` as manager for the `_addr` address. The new manager will be able to call `setInterfaceImplementer` for `_addr`.&quot;
        },
        &quot;updateERC165Cache(address,bytes4)&quot;: {
          &quot;notice&quot;: &quot;Updates the cache with whether the contract implements an ERC165 interface or not.&quot;
        }
      }
    }
  },
  &quot;settings&quot;: {
    &quot;compilationTarget&quot;: {
      &quot;./contracts/ERC820Registry.sol&quot;: &quot;ERC820Registry&quot;
    },
    &quot;evmVersion&quot;: &quot;byzantium&quot;,
    &quot;libraries&quot;: {},
    &quot;optimizer&quot;: {
      &quot;enabled&quot;: true,
      &quot;runs&quot;: 200
    },
    &quot;remappings&quot;: []
  },
  &quot;sources&quot;: {
    &quot;./contracts/ERC820Registry.sol&quot;: {
      &quot;content&quot;: &quot;/* ERC820 Pseudo-introspection Registry Contract\n * This standard defines a universal registry smart contract where any address\n * (contract or regular account) can register which interface it supports and\n * which smart contract is responsible for its implementation.\n *\n * Written in 2018 by Jordi Baylina and Jacques Dafflon\n *\n * To the extent possible under law, the author(s) have dedicated all copyright\n * and related and neighboring rights to this software to the public domain\n * worldwide. This software is distributed without any warranty.\n *\n * You should have received a copy of the CC0 Public Domain Dedication along\n * with this software. If not, see\n * &lt;https://creativecommons.org/publicdomain/zero/1.0/&gt;.\n *\n *    ███████╗██████╗  ██████╗ █████╗ ██████╗  ██████╗\n *    ██╔════╝██╔══██╗██╔════╝██╔══██╗╚════██╗██╔═████╗\n *    █████╗  ██████╔╝██║     ╚█████╔╝ █████╔╝██║██╔██║\n *    ██╔══╝  ██╔══██╗██║     ██╔══██╗██╔═══╝ ████╔╝██║\n *    ███████╗██║  ██║╚██████╗╚█████╔╝███████╗╚██████╔╝\n *    ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚════╝ ╚══════╝ ╚═════╝\n *\n *    ██████╗ ███████╗ ██████╗ ██╗███████╗████████╗██████╗ ██╗   ██╗\n *    ██╔══██╗██╔════╝██╔════╝ ██║██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝\n *    ██████╔╝█████╗  ██║  ███╗██║███████╗   ██║   ██████╔╝ ╚████╔╝\n *    ██╔══██╗██╔══╝  ██║   ██║██║╚════██║   ██║   ██╔══██╗  ╚██╔╝\n *    ██║  ██║███████╗╚██████╔╝██║███████║   ██║   ██║  ██║   ██║\n *    ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝\n *\n */\npragma solidity 0.4.24;\n// IV is value needed to have a vanity address starting with `0x820`.\n// IV: 9513\n\n/// @dev The interface a contract MUST implement if it is the implementer of\n/// some (other) interface for any address other than itself.\ninterface ERC820ImplementerInterface {\n    /// @notice Indicates whether the contract implements the interface `interfaceHash` for the address `addr` or not.\n    /// @param interfaceHash keccak256 hash of the name of the interface\n    /// @param addr Address for which the contract will implement the interface\n    /// @return ERC820_ACCEPT_MAGIC only if the contract implements `interfaceHash` for the address `addr`.\n    function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32);\n}\n\n\n/// @title ERC820 Pseudo-introspection Registry Contract\n/// @author Jordi Baylina and Jacques Dafflon\n/// @notice This contract is the official implementation of the ERC820 Registry.\n/// @notice For more details, see https://eips.ethereum.org/EIPS/eip-820\ncontract ERC820Registry {\n    /// @notice ERC165 Invalid ID.\n    bytes4 constant INVALID_ID = 0xffffffff;\n    /// @notice Method ID for the ERC165 supportsInterface method (= `bytes4(keccak256(&apos;supportsInterface(bytes4)&apos;))`).\n    bytes4 constant ERC165ID = 0x01ffc9a7;\n    /// @notice Magic value which is returned if a contract implements an interface on behalf of some other address.\n    bytes32 constant ERC820_ACCEPT_MAGIC = keccak256(abi.encodePacked(\&quot;ERC820_ACCEPT_MAGIC\&quot;));\n\n    mapping (address =&gt; mapping(bytes32 =&gt; address)) interfaces;\n    mapping (address =&gt; address) managers;\n    mapping (address =&gt; mapping(bytes4 =&gt; bool)) erc165Cached;\n\n    /// @notice Indicates a contract is the `implementer` of `interfaceHash` for `addr`.\n    event InterfaceImplementerSet(address indexed addr, bytes32 indexed interfaceHash, address indexed implementer);\n    /// @notice Indicates `newManager` is the address of the new manager for `addr`.\n    event ManagerChanged(address indexed addr, address indexed newManager);\n\n    /// @notice Query if an address implements an interface and through which contract.\n    /// @param _addr Address being queried for the implementer of an interface.\n    /// (If `_addr == 0` then `msg.sender` is assumed.)\n    /// @param _interfaceHash keccak256 hash of the name of the interface as a string.\n    /// E.g., `web3.utils.keccak256(&apos;ERC777Token&apos;)`.\n    /// @return The address of the contract which implements the interface `_interfaceHash` for `_addr`\n    /// or `0x0` if `_addr` did not register an implementer for this interface.\n    function getInterfaceImplementer(address _addr, bytes32 _interfaceHash) external view returns (address) {\n        address addr = _addr == 0 ? msg.sender : _addr;\n        if (isERC165Interface(_interfaceHash)) {\n            bytes4 erc165InterfaceHash = bytes4(_interfaceHash);\n            return implementsERC165Interface(addr, erc165InterfaceHash) ? addr : 0;\n        }\n        return interfaces[addr][_interfaceHash];\n    }\n\n    /// @notice Sets the contract which implements a specific interface for an address.\n    /// Only the manager defined for that address can set it.\n    /// (Each address is the manager for itself until it sets a new manager.)\n    /// @param _addr Address to define the interface for. (If `_addr == 0` then `msg.sender` is assumed.)\n    /// @param _interfaceHash keccak256 hash of the name of the interface as a string.\n    /// For example, `web3.utils.keccak256(&apos;ERC777TokensRecipient&apos;)` for the `ERC777TokensRecipient` interface.\n    /// @param _implementer Contract address implementing _interfaceHash for _addr.\n    function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) external {\n        address addr = _addr == 0 ? msg.sender : _addr;\n        require(getManager(addr) == msg.sender, \&quot;Not the manager\&quot;);\n\n        require(!isERC165Interface(_interfaceHash), \&quot;Must not be a ERC165 hash\&quot;);\n        if (_implementer != 0 &amp;&amp; _implementer != msg.sender) {\n            require(\n                ERC820ImplementerInterface(_implementer)\n                    .canImplementInterfaceForAddress(_interfaceHash, addr) == ERC820_ACCEPT_MAGIC,\n                \&quot;Does not implement the interface\&quot;\n            );\n        }\n        interfaces[addr][_interfaceHash] = _implementer;\n        emit InterfaceImplementerSet(addr, _interfaceHash, _implementer);\n    }\n\n    /// @notice Sets the `_newManager` as manager for the `_addr` address.\n    /// The new manager will be able to call `setInterfaceImplementer` for `_addr`.\n    /// @param _addr Address for which to set the new manager.\n    /// @param _newManager Address of the new manager for `addr`.\n    function setManager(address _addr, address _newManager) external {\n        require(getManager(_addr) == msg.sender, \&quot;Not the manager\&quot;);\n        managers[_addr] = _newManager == _addr ? 0 : _newManager;\n        emit ManagerChanged(_addr, _newManager);\n    }\n\n    /// @notice Get the manager of an address.\n    /// @param _addr Address for which to return the manager.\n    /// @return Address of the manager for a given address.\n    function getManager(address _addr) public view returns(address) {\n        // By default the manager of an address is the same address\n        if (managers[_addr] == 0) {\n            return _addr;\n        } else {\n            return managers[_addr];\n        }\n    }\n\n    /// @notice Compute the keccak256 hash of an interface given its name.\n    /// @param _interfaceName Name of the interface.\n    /// @return The keccak256 hash of an interface name.\n    function interfaceHash(string _interfaceName) external pure returns(bytes32) {\n        return keccak256(abi.encodePacked(_interfaceName));\n    }\n\n    /* --- ERC165 Related Functions --- */\n    /* --- Developed in collaboration with William Entriken. --- */\n\n    /// @notice Updates the cache with whether the contract implements an ERC165 interface or not.\n    /// @param _contract Address of the contract for which to update the cache.\n    /// @param _interfaceId ERC165 interface for which to update the cache.\n    function updateERC165Cache(address _contract, bytes4 _interfaceId) external {\n        interfaces[_contract][_interfaceId] = implementsERC165InterfaceNoCache(_contract, _interfaceId) ? _contract : 0;\n        erc165Cached[_contract][_interfaceId] = true;\n    }\n\n    /// @notice Checks whether a contract implements an ERC165 interface or not.\n    /// The result may be cached, if not a direct lookup is performed.\n    /// @param _contract Address of the contract to check.\n    /// @param _interfaceId ERC165 interface to check.\n    /// @return `true` if `_contract` implements `_interfaceId`, false otherwise.\n    function implementsERC165Interface(address _contract, bytes4 _interfaceId) public view returns (bool) {\n        if (!erc165Cached[_contract][_interfaceId]) {\n            return implementsERC165InterfaceNoCache(_contract, _interfaceId);\n        }\n        return interfaces[_contract][_interfaceId] == _contract;\n    }\n\n    /// @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.\n    /// @param _contract Address of the contract to check.\n    /// @param _interfaceId ERC165 interface to check.\n    /// @return `true` if `_contract` implements `_interfaceId`, false otherwise.\n    function implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) public view returns (bool) {\n        uint256 success;\n        uint256 result;\n\n        (success, result) = noThrowCall(_contract, ERC165ID);\n        if (success == 0 || result == 0) {\n            return false;\n        }\n\n        (success, result) = noThrowCall(_contract, INVALID_ID);\n        if (success == 0 || result != 0) {\n            return false;\n        }\n\n        (success, result) = noThrowCall(_contract, _interfaceId);\n        if (success == 1 &amp;&amp; result == 1) {\n            return true;\n        }\n        return false;\n    }\n\n    /// @notice Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.\n    /// @param _interfaceHash The hash to check.\n    /// @return `true` if the hash is a ERC165 interface (ending with 28 zeroes), `false` otherwise.\n    function isERC165Interface(bytes32 _interfaceHash) internal pure returns (bool) {\n        return _interfaceHash &amp; 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0;\n    }\n\n    /// @dev Make a call on a contract without throwing if the function does not exist.\n    function noThrowCall(address _contract, bytes4 _interfaceId)\n        internal view returns (uint256 success, uint256 result)\n    {\n        bytes4 erc165ID = ERC165ID;\n\n        assembly {\n                let x := mload(0x40)               // Find empty storage location using \&quot;free memory pointer\&quot;\n                mstore(x, erc165ID)                // Place signature at beginning of empty storage\n                mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature\n\n                success := staticcall(\n                    30000,                         // 30k gas\n                    _contract,                     // To addr\n                    x,                             // Inputs are stored at location x\n                    0x08,                          // Inputs are 8 bytes long\n                    x,                             // Store output over input (saves space)\n                    0x20                           // Outputs are 32 bytes long\n                )\n\n                result := mload(x)                 // Load the result\n        }\n    }\n}\n&quot;,
      &quot;keccak256&quot;: &quot;0x8eecce3912a15087b3f5845d5a74af7712c93d0a8fcd6f2d40f07ed5032022ab&quot;
    }
  },
  &quot;version&quot;: 1
}
```

&lt;/details&gt;

### Interface Name

Any interface name is hashed using `keccak256` and sent to `getInterfaceImplementer()`.

If the interface is part of a standard, it is best practice to explicitly state the interface name and link to this published [ERC-820] such that other people don&apos;t have to come here to look up these rules.

For convenience, the registry provides a function to compute the hash on-chain:

``` solidity
function interfaceHash(string _interfaceName) public pure returns(bytes32)
```

Compute the keccak256 hash of an interface given its name.

&gt; &lt;small&gt;**identifier:** `65ba36c1`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceName`: Name of the interface.&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** The `keccak256` hash of an interface name.&lt;/small&gt;

#### **Approved ERCs**

If the interface is part of an approved ERC, it MUST be named `ERC###XXXXX` where `###` 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.

Examples:

- `keccak256(&quot;ERC20Token&quot;)`
- `keccak256(&quot;ERC777Token&quot;)`
- `keccak256(&quot;ERC777TokensSender&quot;)`
- `keccak256(&quot;ERC777TokensRecipient&quot;)`

#### **[ERC-165] Compatible Interfaces**

&gt; The compatibility with [ERC-165], including the [ERC165 Cache], has been designed and developed with [William Entriken].

Any interface where the last 28 bytes are zeroes (`0`) SHALL be considered an [ERC-165] interface.

**[ERC-165] Lookup**

Anyone can explicitly check if a contract implements an [ERC-165] interface using the registry by calling one of the two functions below:

``` solidity
function implementsERC165Interface(address _contract, bytes4 _interfaceId) public view returns (bool)
```

Checks whether a contract implements an [ERC-165] interface or not.

*NOTE*: The result is cached. If the cache is out of date, it MUST be updated by calling `updateERC165Cache`. (See [ERC165 Cache] for more details.)

&gt; &lt;small&gt;**identifier:** `f712f3e8`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_contract`: Address of the contract to check.&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceId`: [ERC-165] interface to check.&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** `true` if `_contract` implements `_interfaceId`, false otherwise.&lt;/small&gt;

``` solidity
function implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) public view returns (bool)
```

Checks whether a contract implements an [ERC-165] interface or not without using nor updating the cache.

&gt; &lt;small&gt;**identifier:** `b7056765`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_contract`: Address of the contract to check.&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceId`: [ERC-165] interface to check.&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** `true` if `_contract` implements `_interfaceId`, false otherwise.&lt;/small&gt;

**[ERC-165] Cache** &lt;a id=&quot;erc165-cache&quot;&gt;&lt;/a&gt;

Whether a contract implements an [ERC-165] interface or not can be cached manually to save gas.

If a contract dynamically changes its interface and relies on the [ERC-165] cache of the [ERC-820] 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&apos;s behalf.

The cache update MUST be done using the `updateERC165Cache` function:

``` solidity
function updateERC165Cache(address _contract, bytes4 _interfaceId) public
```

&gt; &lt;small&gt;**identifier:** `a41e7d51`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_contract`: Address of the contract for which to update the cache.&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceId`: [ERC-165] interface for which to update the cache.&lt;/small&gt;

#### **Private User-defined Interfaces**

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.

### Set An Interface For An Address

For any address to set a contract as the interface implementation, it must call the following function of the [ERC-820] registry:

``` solidity
function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) public
```

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, see the [manager] section for more details.)

*NOTE*: If  `_addr` and `_implementer` are two different addresses, then:

- The `_implementer` MUST implement the `ERC820ImplementerInterface` (detailed below).
- Calling `canImplementInterfaceForAddress` on `_implementer` with the given `_addr` and  `_interfaceHash` MUST return the `ERC820_ACCEPT_MAGIC` value.

*NOTE*: The `_interfaceHash` MUST NOT be an [ERC-165] interface---it MUST NOT end with 28 zeroes (`0`).

*NOTE*: The `_addr` MAY be `0`, then `msg.sender` 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.

&gt; &lt;small&gt;**identifier:** `29965a1d`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_addr`: Address to define the interface for (if `_addr == 0` them `msg.sender`: is assumed)&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceHash`: `keccak256` hash of the name of the interface as a string, for example `web3.utils.keccak256(&apos;ERC777TokensRecipient&apos;)` for the ERC777TokensRecipient interface.&lt;/small&gt;  
&gt; &lt;small&gt;`_implementer`: Contract implementing `_interfaceHash` for `_addr`.&lt;/small&gt;

### Get An Implementation Of An Interface For An Address

Anyone MAY query the [ERC-820] Registry to obtain the address of a contract implementing an interface on behalf of some address using the `getInterfaceImplementer` function.

``` solidity
function getInterfaceImplementer(address _addr, bytes32 _interfaceHash) public view returns (address)
```

Query if an address implements an interface and through which contract.

*NOTE*: If the last 28 bytes of the `_interfaceHash` are zeroes (`0`), then the first 4 bytes are considered an [ERC-165] interface and the registry SHALL forward the call to the contract at `_addr` to see if it implements the [ERC-165] interface (the first 4 bytes of `_interfaceHash`). The registry SHALL also cache [ERC-165] queries to reduce gas consumption. Anyone MAY call the `erc165UpdateCache` function to update whether a contract implements an interface or not.

*NOTE*: The `_addr` MAY be `0`, then `msg.sender` is assumed. This default value is consistent with the behavior of the `setInterfaceImplementer` function and simplifies interactions via multisigs where the data of the transaction to sign is constant regardless of the address of the multisig instance.

&gt; &lt;small&gt;**identifier:** `aabbb8ca`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_addr`: Address being queried for the implementer of an interface. (If `_addr == 0` them `msg.sender` is assumed.)&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceHash`: keccak256 hash of the name of the interface as a string. E.g. `web3.utils.keccak256(&apos;ERC777Token&apos;)`&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** 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;/small&gt;


### Interface Implementation (`ERC820ImplementerInterface`)

``` solidity
interface ERC820ImplementerInterface {
    /// @notice Indicates whether the contract implements the interface `interfaceHash` for the address `addr`.
    /// @param addr Address for which the contract will implement the interface
    /// @param interfaceHash keccak256 hash of the name of the interface
    /// @return ERC820_ACCEPT_MAGIC only if the contract implements `ìnterfaceHash` for the address `addr`.
    function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) public view returns(bytes32);
}
```

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 `ERC820ImplementerInterface` shown above.

``` solidity
function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) view public returns(bytes32);
```

Indicates whether a contract implements an interface (`interfaceHash`) for a given address (`addr`).

If a contract implements the interface (`interfaceHash`) for a given address (`addr`), it MUST return `ERC820_ACCEPT_MAGIC` when called with the `addr` and the `interfaceHash`. If it does not implement the `interfaceHash` for a given address (`addr`), it MUST NOT return `ERC820_ACCEPT_MAGIC`.

&gt; &lt;small&gt;**identifier:** `f0083250`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`interfaceHash`: Hash of the interface which is implemented&lt;/small&gt;  
&gt; &lt;small&gt;`addr`: Address for which the interface is implemented&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** `ERC820_ACCEPT_MAGIC` only if the contract implements `ìnterfaceHash` for the address `addr`.&lt;/small&gt;

The special value `ERC820_ACCEPT_MAGIC` is defined as the `keccka256` hash of the string `&quot;ERC820_ACCEPT_MAGIC&quot;`.

``` solidity
bytes32 constant ERC820_ACCEPT_MAGIC = keccak256(&quot;ERC820_ACCEPT_MAGIC&quot;);
```

&gt; The reason to return `ERC820_ACCEPT_MAGIC` instead of a boolean is to prevent cases where a contract fails to implement the `canImplementInterfaceForAddress` but implements a fallback function which does not throw. In this case, since `canImplementInterfaceForAddress` does not exist, the fallback function is called instead, executed without throwing and returns `1`. Thus making it appear as if `canImplementInterfaceForAddress` returned `true`.

### Manager

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.

The manager can transfer its role to another address by calling `setManager` on the registry contract with the address for which to transfer the manager and the address of the new manager.

**`setManager` Function**

``` solidity
function setManager(address _addr, address _newManager) public
```

Sets the `_newManager` as manager for the `_addr` address.

The new manager will be able to call `setInterfaceImplementer` for `_addr`.

If `_newManager` is `0x0`, the manager is reset to `_addr` itself as the manager.

&gt; &lt;small&gt;**identifier:** `5df8122f`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_addr`: Address for which to set the new manager.&lt;/small&gt;  
&gt; &lt;small&gt;`_newManager`: The address of the new manager for `_addr`. (Pass `0x0` to reset the manager to `_addr`.)&lt;/small&gt;

**`getManager` Function**

``` solidity
function getManager(address _addr) public view returns(address)
```

Get the manager of an address.

&gt; &lt;small&gt;**identifier:** `3d584063`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_addr`: Address for which to return the manager.&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** Address of the manager for a given address.&lt;/small&gt;

## Rationale

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.

The registry can also act as a [ERC-165] cache in order to save gas when looking up if a contract implements a specific [ERC-165] 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 `updateERC165Cache` function.

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.

## Backward Compatibility

This standard is backward compatible with [ERC-165], as both methods MAY be implemented without conflicting with each other.

## Test Cases

Please check the [jbaylina/ERC820] repository for the full test suite.

## Implementation

The implementation is available in the repo: [jbaylina/ERC820].

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

[EIP-155]: ./eip-155.md
[ERC-165]: ./eip-165.md
[ERC-672]: https://github.com/ethereum/EIPs/issues/672
[ERC-820]: ./eip-820.md
[ERC820 registry smart contract]: https://github.com/jbaylina/ERC820/blob/master/contracts/ERC820Registry.sol
[manager]: #manager
[lookup]: #get-an-implementation-of-an-interface-for-an-address
[ERC165 Cache]: #erc165-cache
[Nick&apos;s article]: https://medium.com/@weka/how-to-send-ether-to-11-440-people-187e332566b7
[jbaylina/ERC820]: https://github.com/jbaylina/ERC820
[Nick]: https://github.com/Arachnid/
[William Entriken]: https://github.com/fulldecent
[ENS]: https://ens.domains/
[ERC-1820]: ./eip-1820.md
[erc1820-annoucement]: https://github.com/ethereum/EIPs/issues/820#issuecomment-464109166
[erc820-bug]: https://github.com/ethereum/EIPs/issues/820#issuecomment-452465748
[erc820-fix]: https://github.com/ethereum/EIPs/issues/820#issuecomment-454021564
</description>
        <pubDate>Fri, 05 Jan 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-820</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-820</guid>
      </item>
    
      <item>
        <title>Token Exchange Standard</title>
        <category>Standards Track/ERC</category>
        
        <description>## Simple Summary
A standard for token contracts, providing token exchange services thereby facilitating cross token payments.

## Abstract
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.

## Motivation
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.

## Specification
### Sender Interface
This interface must be inherited by a ERC20 token contract that wants to exchange its tokens with another token.

#### Storage Variables
##### exchnagedWith
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.

```solidity
mapping ( address =&gt; uint ) private exchangedWith;
```
##### exchangedBy
This mapping stores the address of the person who initiated the exchange and the amount of tokens exchanged.

```solidity
mapping ( address =&gt; uint ) private exhangedBy;
```

#### Methods

NOTE: Callers MUST handle false from returns (bool success). Callers MUST NOT assume that false is never returned!

##### exchangeToken
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 `success` and `creditedAmount`.

```solidity
function exchangeToken(address _targetContract, uint _amount) public returns(bool success, uint creditedAmount)
```

##### exchangeAndSpend
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 `success`.

```solidity
function exchangeAndSpend(address _targetContract, uint _amount,address _to) public returns(bool success)
```

##### __exchangerCallback
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 `success`.

NOTE: It is required that only the exchange service contract has the authority to call this function.

```solidity
function __exchangerCallback(address _targetContract,address _exchanger, uint _amount) public returns(bool success)
```

#### Events

##### Exchange
This event logs any new exchanges that have taken place.

```solidity
event Exchange(address _from, address _ targetContract, uint _amount)
```

##### ExchangeSpent
This event logs any new exchange that have taken place and have been spent immediately.

```solidity
event ExchangeSpent(address _from, address _targetContract, address _to, uint _amount)
```

### Receiver Interface
This interface must be inherited by a ERC20 token contract that wants to receive exchanged tokens.

#### Storage Variables
##### exchangesRecieved
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.

```solidity
mapping ( address =&gt; uint ) private exchnagesReceived;
```
#### Methods

NOTE: Callers MUST handle false from returns (bool success). Callers MUST NOT assume that false is never returned!

##### __targetExchangeCallback
This function is called by the intermediate exchange service contract. This function should add `_amount` tokens of the target contract to the exchangers address for exchange to be completed successfully.

NOTE: It is required that only the exchange service contract has the authority to call this function.

```solidity
function __targetExchangeCallback (uint _to, uint _amount) public returns(bool success)
```

##### __targetExchangeAndSpendCallback
This function is called by the intermediate exchange service contract. This function should add `_amount` tokens of the target contract to the exchangers address and transfer it to the `_to` address for the exchange and expenditure to be completed successfully.

NOTE: It is required that only the exchange service contract has the authority to call this function.

```solidity
function __targetExchangeAndSpendCallback (address _from, address _to, uint _amount) public returns(bool success)
```

#### Events
##### Exchange
This event logs any new exchanges that have taken place.

```solidity
event Exchange(address _from, address _with, uint _amount)
```

##### ExchangeSpent
This event logs any new exchange that have taken place and have been spent immediately.
```solidity
event ExchangeSpent(address _from, address _ targetContract, address _to, uint _amount)
```

### Exchange Service Contract

This is an intermediate contract that provides a gateway for exchanges and expenditure. This contract uses oracles to get the authenticated exchange rates.

#### Storage Variables

##### registeredTokens

This array stores all the tokens that are registered for exchange. Only register tokens can participate in exchanges.

```solidity
address[] private registeredTokens;
```

#### Methods

##### registerToken

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 `success`.

NOTE: Before any exchange it must be ensured that the token is registered.

```solidity
function registerToken(address _token) public returns(bool success)
```

##### exchangeToken

This function is called by the token holder who wants to exchange his token with the `_targetContract` tokens. This function queries the exchange rate, calculates the converted amount, calls `__exchangerCallback` and calls the `__targetExchangeCallback`. It takes address of the target contract and amount to exchange as parameter and returns boolean `success` and amount credited.

```solidity
function exchangeToken(address _targetContract, uint _amount, address _from) public returns(bool success, uint creditedAmount)
```

##### exchangeAndSpend

This function is called by the token holder who wants to exchange his token with the `_targetContract` tokens. This function queries the exchange rate, calculates the converted amount, calls `__exchangerCallback` and calls the `__targetExchangeAndSpendCallback`. It takes address of the target contract and amount to exchange as parameter and returns boolean `success` and amount credited.

```solidity
function exchangeAndSpend(address _targetContract, uint _amount, address _from, address _to) public returns(bool success)
```

#### Events

##### Exchanges

This event logs any new exchanges that have taken place.

```solidity
event Exchange( address _from, address _by, uint _value ,address _target )
```
##### ExchangeAndSpent

This event logs any new exchange that have taken place and have been spent immediately.

```solidity
event ExchangeAndSpent ( address _from, address _by, uint _value ,address _target ,address _to)
```

### Diagramatic Explanation

#### Exchanging Tokens
![token-exchange-standard-visual-representation-1](../assets/eip-823/eip-823-token-exchange-standard-visual-representation-1.png)

NOTE: After the successful exchange the contract on right owns some tokens of the contract on the left.

#### Exchanging And Spending Tokens

![token-exchange-standard-visual-representation-2](../assets/eip-823/eip-823-token-exchange-standard-visual-representation-2.png)

NOTE: After the successful exchange the contract on right owns some tokens of the contract on the left.

## Rationale

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.

## Backward Compatibility

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Sat, 06 Jan 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-823</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-823</guid>
      </item>
    
      <item>
        <title>URI Format for Ethereum</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-831-uri-format-for-ethereum/10105</comments>
        
        <description>## Abstract

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&apos;s preferred wallet application.

## Specification

### Syntax

Ethereum URIs contain &quot;ethereum&quot; or &quot;eth&quot; in their schema (protocol) part and are constructed as follows:

    request                 = &quot;eth&quot; [ &quot;ereum&quot; ] &quot;:&quot; [ prefix &quot;-&quot; ] payload
    prefix                  = STRING
    payload                 = STRING

### Semantics

`prefix` 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 [EIP-67](./eip-67.md). When the prefix is omitted, the payload must start with `0x`. Also prefixes must not start with `0x`. So starting with `0x` can be used as a clear signal that there is no prefix.

`payload` 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 [EIP-681](./eip-681) for the pay- prefix.

## Rationale

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.

## Security Considerations

There are no known security considerations at this time.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 15 Jan 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-831</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-831</guid>
      </item>
    
      <item>
        <title>ABI specification for REVERT reason string</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-838-what-is-the-current-status/14671</comments>
        
        <description>## Abstract

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.


## Motivation

It&apos;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.

The key words &quot;MUST&quot;, &quot;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.

## Specification

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;.

Example:

```
{ &quot;type&quot;: &quot;error&quot;, &quot;name&quot;: &quot;InsufficientBalance&quot;, &quot;arguments&quot;: [ { &quot;name&quot;: &quot;amount&quot;, &quot;type&quot;: &quot;uint256&quot; } ] }
```

A selector for this error can be computed from its signature (InsufficientBalance() for the example above) in the same way that it&apos;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).

A high-level language like Solidity can then implement a syntax like this:

```
contract MyToken {
  error InsufficientFunds(uint256 amount);

  function transfer(address _to, uint256 _amount) {
    if (balances[msg.sender] &lt;= _amount)
       throw InsufficientFunds(_amount);
    ...
  }
  ...
}
```

### Possible extensions


1. 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.

```
/// @notice You don&apos;t have enough funds to transfer `amount`.
error InsufficientFunds(uint256 amount);
```

2. 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 `errors` key. Example:

```
function transfer(address _to, uint256 _amount) throws(InsufficientFunds);
```

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.

## Rationale

Needs discussion. &lt;!-- TODO --&gt;

## Backwards Compatibility

Apps and tools that have not implemented this spec can ignore the encoded reason string when it&apos;s not prefixed by zero.

## Security Considerations

Needs discussion. &lt;!-- TODO --&gt;

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 20 Aug 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-838</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-838</guid>
      </item>
    
      <item>
        <title>Simpler NFT standard with batching and native atomic swaps</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/875</comments>
        
        <description>## Summary
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://rinkeby.etherscan.io/address/0xffab5ce7c012bc942f5ca0cd42c3c2e1ae5f0005 and view the repo here: https://github.com/alpha-wallet/ERC-Example

## Purpose
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.

## Rinkeby example
This standard has been implemented in an example contract on rinkeby: https://rinkeby.etherscan.io/address/0xffab5ce7c012bc942f5ca0cd42c3c2e1ae5f0005

## Specification

### function name() constant returns (string name)

returns the name of the contract e.g. CarLotContract

### function symbol() constant returns (string symbol)

Returns a short string of the symbol of the in-fungible token, this should be short and generic as each token is non-fungible.

### function balanceOf(address _owner) public view returns (uint256[] balance)

Returns an array of the users balance.

### function transfer(address _to, uint256[] _tokens) public;

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.

### function transferFrom(address _from, address _to, uint256[] _tokens) public;

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.

## Optional functions

### function totalSupply() constant returns (uint256 totalSupply);

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.

### function ownerOf(uint256 _tokenId) public view returns (address _owner);

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.

### function trade(uint256 expiryTimeStamp, uint256[] tokenIndices, uint8 v, bytes32 r, bytes32 s) public payable

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.

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.

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.

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.

## Interface

```solidity
contract ERC165 
{
            /// @notice Query if a contract implements an interface
            /// @param interfaceID The interface identifier, as specified in ERC-165
            /// @dev Interface identification is specified in ERC-165. This function
            ///  uses less than 30,000 gas.
            /// @return `true` if the contract implements `interfaceID` and
            ///  `interfaceID` is not 0xffffffff, `false` otherwise
            function supportsInterface(bytes4 interfaceID) external view returns (bool);
}

interface ERC875 /* is ERC165 */
{
  event Transfer(address indexed _from, address indexed _to, uint256[] tokenIndices);

  function name() constant public returns (string name);
  function symbol() constant public returns (string symbol);
  function balanceOf(address _owner) public view returns (uint256[] _balances);
  function transfer(address _to, uint256[] _tokens) public;
  function transferFrom(address _from, address _to, uint256[] _tokens) public;
}

//If you want the standard functions with atomic swap trading added
interface ERC875WithAtomicSwapTrading is ERC875 {
    function trade(
        uint256 expiryTimeStamp, 
        uint256[] tokenIndices,
        uint8 v, 
        bytes32 r, 
        bytes32 s
    ) public payable;
}
```

## Example implementation

Please visit this [repo](https://github.com/alpha-wallet/ERC875) to see an example implementation  

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 08 Feb 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-875</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-875</guid>
      </item>
    
      <item>
        <title>DGCL Token</title>
        <category>Standards Track/ERC</category>
        
        <description># Delaware General Corporations Law (DGCL) compatible share token

Ref: [proposing-an-eip-for-DGCL-tokens](https://forum.ethereum.org/discussion/17200/proposing-an-eip-for-regulation-a-Tokens)

## Simple Summary

An `ERC-20` compatible token that conforms to [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](https://legis.delaware.gov/json/BillDetail/GenerateHtmlDocument?legislationId=25730&amp;legislationTypeId=1&amp;docTypeId=2&amp;legislationName=SB69), henceforth referred to as &apos;The Act&apos;.

## Abstract

The recently amended &apos;Title 8 of the Delaware Code Relating to the General Corporation Law&apos; now explicitly allows for the use of blockchains to maintain corporate share registries. This means it is now possible to create a tradable `ERC-20` 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 `ERC-20` standard.

1. Token owners must have their identity verified.
2. The token contract must provide the following three functions of a `Corporations Stock ledger` (Ref: Section 224 of The Act):

    1. Reporting:

        It must enable the corporation to prepare the list of shareholders specified in Sections 219 and 220 of The Act.

    2. It must record the information specified in Sections 156, 159, 217(a) and 218 of The Act:

        - Partly paid shares
        - Total amount paid
        - Total amount to be paid

    3. Transfers of shares as per section 159 of The Act:

        It must record transfers of shares as governed by Article 8 of subtitle I of Title 6.

3. 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.

4. 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 `cancelled` and the tokens re-issued to a new address.

## Motivation

1. Delaware General Corporation Law requires that shares issued by a Delaware corporation be recorded in a share registry.
2. The share registry can be represented by an `ERC-20` token contract that is compliant with Delaware General Corporation Law.
3. This standard can cover equity issued by any Delaware corporation, whether private or public.

By using a `DGCL` 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.

There are currently no token standards that conform to the `DGCL` rules. `ERC-20` tokens do not support KYC/AML rules required by the General Corporation Law, and do not provide facilities for the exporting of lists of shareholders.

### What about ERC-721?

The proposed standard could easily be used to enhance `ERC-721`, adding features for associating tokens with assets such as share certificates.

While the `ERC-721` token proposal allows for some association of metadata with an Ethereum address, its uses are _not completely aligned_ with The Act, and it is not, in its current form, fully `ERC-20` compatible.

## Specification

The `ERC-20` token provides the following basic features:

    contract ERC20 {
      function totalSupply() public view returns (uint256);
      function balanceOf(address who) public view returns (uint256);
      function transfer(address to, uint256 value) public returns (bool);
      function allowance(address owner, address spender) public view returns (uint256);
      function transferFrom(address from, address to, uint256 value) public returns (bool);
      function approve(address spender, uint256 value) public returns (bool);
      event Approval(address indexed owner, address indexed spender, uint256 value);
      event Transfer(address indexed from, address indexed to, uint256 value);
    }

This will be extended as follows:

    /**
     *  An `ERC20` compatible token that conforms to 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.
     *
     *  Implementation Details.
     *
     *  An implementation of this token standard SHOULD provide the following:
     *
     *  `name` - for use by wallets and exchanges.
     *  `symbol` - for use by wallets and exchanges.
     *
     *  The implementation MUST take care not to allow unauthorised access to
     *  share-transfer functions.
     *
     *  In addition to the above the following optional `ERC20` function MUST be defined.
     *
     *  `decimals` — MUST return `0` as each token represents a single share and shares are non-divisible.
     *
     *  @dev Ref https://github.com/ethereum/EIPs/pull/884
     */
    contract ERC884 is ERC20 {

        /**
         *  This event is emitted when a verified address and associated identity hash are
         *  added to the contract.
         *  @param addr The address that was added.
         *  @param hash The identity hash associated with the address.
         *  @param sender The address that caused the address to be added.
         */
        event VerifiedAddressAdded(
            address indexed addr,
            bytes32 hash,
            address indexed sender
        );

        /**
         *  This event is emitted when a verified address and associated identity hash are
         *  removed from the contract.
         *  @param addr The address that was removed.
         *  @param sender The address that caused the address to be removed.
         */
        event VerifiedAddressRemoved(address indexed addr, address indexed sender);

        /**
         *  This event is emitted when the identity hash associated with a verified address is updated.
         *  @param addr The address whose hash was updated.
         *  @param oldHash The identity hash that was associated with the address.
         *  @param hash The hash now associated with the address.
         *  @param sender The address that caused the hash to be updated.
         */
        event VerifiedAddressUpdated(
            address indexed addr,
            bytes32 oldHash,
            bytes32 hash,
            address indexed sender
        );

        /**
         *  This event is emitted when an address is cancelled and replaced with
         *  a new address.  This happens in the case where a shareholder has
         *  lost access to their original address and needs to have their share
         *  reissued to a new address.  This is the equivalent of issuing replacement
         *  share certificates.
         *  @param original The address being superseded.
         *  @param replacement The new address.
         *  @param sender The address that caused the address to be superseded.
         */
        event VerifiedAddressSuperseded(
            address indexed original,
            address indexed replacement,
            address indexed sender
        );

        /**
         *  Add a verified address, along with an associated verification hash to the contract.
         *  Upon successful addition of a verified address, the contract must emit
         *  `VerifiedAddressAdded(addr, hash, msg.sender)`.
         *  It MUST throw if the supplied address or hash are zero, or if the address has already been supplied.
         *  @param addr The address of the person represented by the supplied hash.
         *  @param hash A cryptographic hash of the address holder&apos;s verified information.
         */
        function addVerified(address addr, bytes32 hash) public;

        /**
         *  Remove a verified address, and the associated verification hash. If the address is
         *  unknown to the contract then this does nothing. If the address is successfully removed, this
         *  function must emit `VerifiedAddressRemoved(addr, msg.sender)`.
         *  It MUST throw if an attempt is made to remove a verifiedAddress that owns tokens.
         *  @param addr The verified address to be removed.
         */
        function removeVerified(address addr) public;

        /**
         *  Update the hash for a verified address known to the contract.
         *  Upon successful update of a verified address the contract must emit
         *  `VerifiedAddressUpdated(addr, oldHash, hash, msg.sender)`.
         *  If the hash is the same as the value already stored then
         *  no `VerifiedAddressUpdated` event is to be emitted.
         *  It MUST throw if the hash is zero, or if the address is unverified.
         *  @param addr The verified address of the person represented by the supplied hash.
         *  @param hash A new cryptographic hash of the address holder&apos;s updated verified information.
         */
        function updateVerified(address addr, bytes32 hash) public;

        /**
         *  Cancel the original address and reissue the tokens to the replacement address.
         *  Access to this function MUST be strictly controlled.
         *  The `original` address MUST be removed from the set of verified addresses.
         *  Throw if the `original` address supplied is not a shareholder.
         *  Throw if the `replacement` address is not a verified address.
         *  Throw if the `replacement` address already holds tokens.
         *  This function MUST emit the `VerifiedAddressSuperseded` event.
         *  @param original The address to be superseded. This address MUST NOT be reused.
         */
        function cancelAndReissue(address original, address replacement) public;

        /**
         *  The `transfer` function MUST NOT allow transfers to addresses that
         *  have not been verified and added to the contract.
         *  If the `to` address is not currently a shareholder then it MUST become one.
         *  If the transfer will reduce `msg.sender`&apos;s balance to 0 then that address
         *  MUST be removed from the list of shareholders.
         */
        function transfer(address to, uint256 value) public returns (bool);

        /**
         *  The `transferFrom` function MUST NOT allow transfers to addresses that
         *  have not been verified and added to the contract.
         *  If the `to` address is not currently a shareholder then it MUST become one.
         *  If the transfer will reduce `from`&apos;s balance to 0 then that address
         *  MUST be removed from the list of shareholders.
         */
        function transferFrom(address from, address to, uint256 value) public returns (bool);

        /**
         *  Tests that the supplied address is known to the contract.
         *  @param addr The address to test.
         *  @return true if the address is known to the contract.
         */
        function isVerified(address addr) public view returns (bool);

        /**
         *  Checks to see if the supplied address is a shareholder.
         *  @param addr The address to check.
         *  @return true if the supplied address owns a token.
         */
        function isHolder(address addr) public view returns (bool);

        /**
         *  Checks that the supplied hash is associated with the given address.
         *  @param addr The address to test.
         *  @param hash The hash to test.
         *  @return true if the hash matches the one supplied with the address in `addVerified`, or `updateVerified`.
         */
        function hasHash(address addr, bytes32 hash) public view returns (bool);

        /**
         *  The number of addresses that hold tokens.
         *  @return the number of unique addresses that hold tokens.
         */
        function holderCount() public view returns (uint);

        /**
         *  By counting the number of token holders using `holderCount`
         *  you can retrieve the complete list of token holders, one at a time.
         *  It MUST throw if `index &gt;= holderCount()`.
         *  @param index The zero-based index of the holder.
         *  @return the address of the token holder with the given index.
         */
        function holderAt(uint256 index) public view returns (address);

        /**
         *  Checks to see if the supplied address was superseded.
         *  @param addr The address to check.
         *  @return true if the supplied address was superseded by another address.
         */
        function isSuperseded(address addr) public view returns (bool);

        /**
         *  Gets the most recent address, given a superseded one.
         *  Addresses may be superseded multiple times, so this function needs to
         *  follow the chain of addresses until it reaches the final, verified address.
         *  @param addr The superseded address.
         *  @return the verified address that ultimately holds the share.
         */
        function getCurrentFor(address addr) public view returns (address);
    }

### Securities Exchange Commission Requirements

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.

For example: The SEC requires a crowdsale&apos;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.

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 `holderCount` and `isHolder` functions which a crowdsale can invoke to check that limits have not been exceeded.

### Use of the Identity `hash` value

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.

Implementers should maintain an off-chain private database that records the owner&apos;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 `hasHash` function. The specific details of this system are left to the implementer.

It is also desirable that the implementers offer a REST API endpoint along the lines of

    GET https://&lt;host&gt;/&lt;pathPrefix&gt;/:ethereumAddress -&gt; [true|false]

to enable third party auditors to verify that a given Ethereum address is known to the implementers as a verified address.

How the implementers verify a person&apos;s identity is up to them and beyond the scope of this standard.

### Handling users who have lost access to their addresses

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.

Token implementers can handle that via the `cancelAndReissue` 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.

### Permissions management

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.

## Rationale

The proposed standard offers as minimal an extension as possible over the existing `ERC-20` standard in order to conform to the requirements of The Act. Rather than return a `bool` for successful or unsuccessful completion of state-changing functions such as `addVerified`, `removeVerified`, and `updateVerified`, we have opted to require that implementations `throw` (preferably by using the [forthcoming `require(condition, &apos;fail message&apos;)` syntax](https://github.com/ethereum/solidity/issues/1686#issuecomment-328181514)).

## Backwards Compatibility

The proposed standard is designed to maintain compatibility with `ERC-20` tokens with the following provisos:

1. The `decimals` function MUST return `0` as the tokens MUST NOT be divisible,
2. The `transfer` and `transferFrom` functions MUST NOT allow transfers to non-verified addresses, and MUST maintain a list of shareholders.
3. Shareholders who transfer away their remaining tokens must be pruned from the list of shareholders.

Proviso 1 will not break compatibility with modern wallets or exchanges as they all appear to use that information if available.

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.

Proviso 3 is an implementation detail.

## Test Cases and Reference Implementation

Test cases and a reference implementation are available at [github.com/davesag/ERC884-reference-implementation](https://github.com/davesag/ERC884-reference-implementation).

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 14 Feb 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-884</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-884</guid>
      </item>
    
      <item>
        <title>DelegateProxy</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/pull/897</comments>
        
        <description>## Simple Summary
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.

## Abstract
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.

We don&apos;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.

## Implementations

- **aragonOS**: [AppProxyUpgradeable](https://github.com/aragon/aragonOS/blob/master/contracts/apps/AppProxyUpgradeable.sol), [AppProxyPinned](https://github.com/aragon/aragonOS/blob/master/contracts/apps/AppProxyPinned.sol) and [KernelProxy](https://github.com/aragon/aragonOS/blob/master/contracts/kernel/KernelProxy.sol)

- **zeppelinOS**: [Proxy](https://github.com/zeppelinos/labs/blob/2da9e859db81a61f2449d188e7193788ca721c65/upgradeability_ownership/contracts/Proxy.sol)

## Standardized interface

```solidity
interface ERCProxy {
  function proxyType() public pure returns (uint256 proxyTypeId);
  function implementation() public view returns (address codeAddr);
}
```

### Code address (`implementation()`)
The returned code address is the address the proxy would delegate calls to at that
moment in time, for that message.

### Proxy Type (`proxyType()`)

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.

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.

- **Forwarding proxy** (`id = 1`): 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.

- **Upgradeable proxy** (`id = 2`): The proxy code address can be changed depending
on some arbitrary logic implemented either at the proxy level or in its forwarded
logic.

## Benefits

- **Source code verification**: 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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 21 Feb 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-897</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-897</guid>
      </item>
    
      <item>
        <title>Simple Staking Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/900</comments>
        
        <description>## Abstract

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.

## Motivation

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.

## Specification

```solidity
interface Staking {

    event Staked(address indexed user, uint256 amount, uint256 total, bytes data);
    event Unstaked(address indexed user, uint256 amount, uint256 total, bytes data);

    function stake(uint256 amount, bytes data) public;
    function stakeFor(address user, uint256 amount, bytes data) public;
    function unstake(uint256 amount, bytes data) public;
    function totalStakedFor(address addr) public view returns (uint256);
    function totalStaked() public view returns (uint256);
    function token() public view returns (address);
    function supportsHistory() public pure returns (bool);

    // optional
    function lastStakedFor(address addr) public view returns (uint256);
    function totalStakedForAt(address addr, uint256 blockNumber) public view returns (uint256);
    function totalStakedAt(uint256 blockNumber) public view returns (uint256);
}
```

### stake

Stakes a certain amount of tokens, this MUST transfer the given amount from the user.

*The data field can be used to add signalling information in more complex staking applications*

MUST trigger ```Staked``` event.

### stakeFor

Stakes a certain amount of tokens, this MUST transfer the given amount from the caller.

*The data field can be used to add signalling information in more complex staking applications*

MUST trigger ```Staked``` event.

### unstake

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.

*The data field can be used to remove signalling information in more complex staking applications*

MUST trigger ```Unstaked``` event.

### totalStakedFor

Returns the current total of tokens staked for an address.

### totalStaked

Returns the current total of tokens staked.

### token

Address of the token being used by the staking interface.

### supportsHistory

MUST return true if the optional history functions are implemented, otherwise false.

### lastStakedFor

***OPTIONAL:** As not all staking systems require a complete history, this function is optional.*

Returns last block address staked at.

### totalStakedForAt

***OPTIONAL:** As not all staking systems require a complete history, this function is optional.*

Returns total amount of tokens staked at block for address.

### totalStakedAt

***OPTIONAL:** As not all staking systems require a complete history, this function is optional.*

Returns the total tokens staked at block.

## Implementation

- [Stakebank](https://github.com/HarbourProject/stakebank)
- [Aragon](https://github.com/aragon/aragon-apps/pull/101)
- [PoS Staking](https://github.com/maticnetwork/contracts/blob/master/contracts/StakeManager.sol)
- [BasicStakeContract](https://github.com/codex-protocol/contract.erc-900)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 22 Feb 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-900</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-900</guid>
      </item>
    
      <item>
        <title>Token Validation</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/update-on-erc902-validated-token/1639</comments>
        
        <description># Simple Summary
A protocol for services providing token ownership and transfer validation.

# Abstract
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.

# Motivation
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.

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.

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.

# Specification

## `TokenValidator`

```solidity
interface TokenValidator {
    function check(
        address _token,
        address _subject
    ) public returns(byte statusCode)

    function check(
        address _token,
        address _from,
        address _to,
        uint256 _amount
    ) public returns (byte statusCode)
}
```

### Methods

#### `check`/2

`function check(address _token, address _subject) public returns (byte _resultCode)`

&gt; parameters
&gt; * `_token`: the token under review
&gt; * `_subject`: the user or contract to check
&gt;
&gt; *returns* an ERC1066 status code

#### `check`/4

`function check(address token, address from, address to, uint256 amount) public returns (byte resultCode)`

&gt; parameters
&gt; * `_token`: the token under review
&gt; * `_from`: in the case of a transfer, who is relinquishing token ownership
&gt; * `_to`: in the case of a transfer, who is accepting token ownership
&gt; * `_amount`: The number of tokens being transferred
&gt;
&gt; *returns* an ERC1066 status code

## `ValidatedToken`

```solidity
interface ValidatedToken {
    event Validation(
        address indexed subject,
        byte   indexed result
    )

    event Validation(
        address indexed from,
        address indexed to,
        uint256 value,
        byte   indexed statusCode
    )
}
```

### Events

#### `Validation`/2

`event Validation(address indexed subject, byte indexed resultCode)`

This event MUST be fired on return from a call to a `TokenValidator.check/2`.

&gt; parameters
&gt; * `subject`: the user or contract that was checked
&gt; * `statusCode`: an ERC1066 status code


#### `Validation`/4

```solidity
event Validation(
    address indexed from,
    address indexed to,
    uint256 amount,
    byte   indexed statusCode
)
```

This event MUST be fired on return from a call to a `TokenValidator.check/4`.

&gt; parameters
&gt; * `from`: in the case of a transfer, who is relinquishing token ownership
&gt; * `to`: in the case of a transfer, who is accepting token ownership
&gt; * `amount`: The number of tokens being transferred
&gt; * `statusCode`: an ERC1066 status code

# Rationale

This proposal includes a financial permissions system on top of any financial token. This design is not a general roles/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.

The events are fired by the calling token. Since `Validator`s may aggregate or delegate to other `Validator`s, it would generate a lot of useless events were it the
`Validator`&apos;s responsibility. This is also the reason why we include the `token` in the `call/4` arguments: a `Validator` cannot rely on `msg.sender` to determine the token that the call is concerning.

We have also seen a similar design from [R-Token](https://github.com/harborhq/r-token) that uses an additional field: `spender`. While there are potential use cases for this, it&apos;s not widely used enough to justify passing a dummy value along with every call. Instead, such a call would look more like this:

```solidity
function approve(address spender, uint amount) public returns (bool success) {
    if (validator.check(this, msg.sender, spender, amount) == okStatusCode) {
        allowed[msg.sender][spender] = amount;
        Approval(msg.sender, spender, amount);
        return true;
    } else {
        return false;
    }
}
```

A second `check/2` 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;c), or if a user is on a simple whitelist.

We have left the decision to make associated `Validator` 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 `Validated` contract. A token may require one or many `Validator`s for different purposes, requiring different validations for different, or just a single `Validator`. The potential use cases are too varied to provide a single unified set of methods. We have provided a set of example contracts [here](https://github.com/Finhaven/ValidatedToken/) that may be inherited from for common use cases.

The status codes in the `byte` returns are unspecified. Any status code scheme may be used, though a general status code proposal is fortcoming.

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.

# Implementation
[Reference implementation](https://github.com/expede/validated-token/)

# Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 14 Feb 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-902</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-902</guid>
      </item>
    
      <item>
        <title>Mineable Token Standard</title>
        <category>Standards Track/ERC</category>
        
        <description>### Simple Summary

A specification for a standardized Mineable Token that uses a Proof of Work algorithm for distribution. 

### Abstract

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.

### Motivation

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 &apos;Initial Mining Offering&apos; (or IMO), the ownership of the token contract no longer belongs with the deployer at all and the deployer is &apos;just another user.&apos; 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.

### Specification

#### Interface
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 &apos;Abstract Contract&apos; below)

``` solidity
interface ERC918  {
   
   function mint(uint256 nonce) public returns (bool success);

   function getAdjustmentInterval() public view returns (uint);

   function getChallengeNumber() public view returns (bytes32);

   function getMiningDifficulty() public view returns (uint);

   function getMiningTarget() public view returns (uint);

   function getMiningReward() public view returns (uint);
   
   function decimals() public view returns (uint8);

   event Mint(address indexed from, uint rewardAmount, uint epochCount, bytes32 newChallengeNumber);
}
```

#### Abstract Contract (Optional)

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.

### Fields

#### adjustmentInterval
The amount of time between difficulty adjustments in seconds.

``` solidity
bytes32 public adjustmentInterval;
```

#### challengeNumber
The current challenge number. It is expected that a new challenge number is generated after a new reward is minted.

``` solidity
bytes32 public challengeNumber;
```

#### difficulty
The current mining difficulty which should be adjusted via the \_adjustDifficulty minting phase

``` solidity
uint public difficulty;
```

#### tokensMinted
Cumulative counter of the total minted tokens, usually modified during the \_reward phase

``` solidity
uint public tokensMinted;
```

#### epochCount
Number of &apos;blocks&apos; mined

``` solidity
uint public epochCount;
```

### Mining Operations

#### mint

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&apos;s address. Once verified, the mint function calculates and delivers a mining reward to the sender and performs internal accounting operations on the contract&apos;s supply.

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.

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.

``` solidity
contract AbstractERC918 is EIP918Interface {

    // the amount of time between difficulty adjustments
    uint public adjustmentInterval;
     
    // generate a new challenge number after a new reward is minted
    bytes32 public challengeNumber;
    
    // the current mining target
    uint public miningTarget;

    // cumulative counter of the total minted tokens
    uint public tokensMinted;

    // number of blocks per difficulty readjustment
    uint public blocksPerReadjustment;

    //number of &apos;blocks&apos; mined
    uint public epochCount;
   
    /*
     * Externally facing mint function that 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 success indicator.
     **/
    function mint(uint256 nonce) public returns (bool success) {
        require(msg.sender != address(0));

        // perform the hash function validation
        hash(nonce);
        
        // calculate the current reward
        uint rewardAmount = _reward();
        
        // increment the minted tokens amount
        tokensMinted += rewardAmount;
        
        epochCount = _epoch();

        //every so often, readjust difficulty. Don&apos;t readjust when deploying
        if(epochCount % blocksPerReadjustment == 0){
            _adjustDifficulty();
        }
       
        // send Mint event indicating a successful implementation
        emit Mint(msg.sender, rewardAmount, epochCount, challengeNumber);
        
        return true;
    }
}
```

##### *Mint Event*

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.

``` solidity
event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber);
```

#### hash

Public interface function hash, meant to be overridden in implementation to define hashing algorithm and validation. Returns the validated digest

``` solidity
function hash(uint256 nonce) public returns (bytes32 digest);
```

#### \_reward

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.

``` solidity
function _reward() internal returns (uint);
```

#### \_newEpoch

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.

``` solidity
function _newEpoch(uint256 nonce) internal returns (uint);
```
 
#### \_adjustDifficulty
 
Internal interface function \_adjustDifficulty, meant to be overridden in implementation to adjust the difficulty (via field difficulty) of the mining as required

``` solidity
function _adjustDifficulty() internal returns (uint);
```

#### getAdjustmentInterval

The amount of time, in seconds, between difficulty adjustment operations.

``` solidity
function getAdjustmentInterval() public view returns (uint);
```

#### getChallengeNumber

Recent ethereum block hash, used to prevent pre-mining future blocks.

``` solidity
function getChallengeNumber() public view returns (bytes32);
```

#### getMiningDifficulty

The number of digits that the digest of the PoW solution requires which typically auto adjusts during reward generation.

``` solidity
function getMiningDifficulty() public view returns (uint)
```

#### getMiningReward

Return the current reward amount. Depending on the algorithm, typically rewards are divided every reward era as tokens are mined to provide scarcity.

``` solidity
function getMiningReward() public view returns (uint)
```

### Example mining function
A general mining function written in python for finding a valid nonce for keccak256 mined token, is as follows: 
``` python
def generate_nonce():
  myhex =  b&apos;%064x&apos; % getrandbits(32*8)
  return codecs.decode(myhex, &apos;hex_codec&apos;)
  
def mine(challenge, public_address, difficulty):
  while True:
    nonce = generate_nonce()
    hash1 = int(sha3.keccak_256(challenge+public_address+nonce).hexdigest(), 16)
    if hash1 &lt; difficulty:
      return nonce, hash1
```

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.

### Merged Mining Extension (Optional)
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.

``` solidity
/**
 * @title ERC-918 Mineable Token Standard, optional merged mining functionality
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-918.md
 * 
 */
contract ERC918Merged is AbstractERC918 {
    /*
     * @notice Externally facing merge function that is called by miners to validate challenge digests, calculate reward,
     * populate statistics, mutate state variables and adjust the solution difficulty as required. Additionally, the
     * merge function takes an array of target token addresses to be used in merged rewards. Once complete,
     * a Mint event is emitted before returning a success indicator.
     *
     * @param _nonce the solution nonce
     **/
    function merge(uint256 _nonce, address[] _mineTokens) public returns (bool) {
      for (uint i = 0; i &lt; _mineTokens.length; i++) {
        address tokenAddress = _mineTokens[i];
        ERC918Interface(tokenAddress).mint(_nonce);
      }
    }

    /*
     * @notice Externally facing merge function kept for backwards compatibility with previous definition
     *
     * @param _nonce the solution nonce
     * @param _challenge_digest the keccak256 encoded challenge number + message sender + solution nonce
     **/
     function merge(uint256 _nonce, bytes32 _challenge_digest, address[] _mineTokens) public returns (bool) {
       //the challenge digest must match the expected
       bytes32 digest = keccak256( abi.encodePacked(challengeNumber, msg.sender, _nonce) );
       require(digest == _challenge_digest, &quot;Challenge digest does not match expected digest on token contract [ ERC918Merged.mint() ]&quot;);
       return merge(_nonce, _mineTokens);
     }
}
```

### Delegated Minting Extension (Optional)
In order to facilitate a third party minting submission paradigm, such as the case of miners submitting solutions to a pool operator and/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.

The ERC918 Mineable Mint Packet Metadata should be prepared using following schema:
``` solidity
{
    &quot;title&quot;: &quot;Mineable Mint Packet Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;nonce&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the target solution nonce&quot;,
        },
        &quot;origin&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the original user that mined the solution nonce&quot;,
        },
        &quot;signature&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;The signed hash of tightly packed variables sha3(&apos;delegatedMintHashing(uint256,address)&apos;)+nonce+origin_account&quot;,
        }
    }
}
```
The preparation of a mineable mint packet on a JavaScript client would appear as follows:

``` solidity
function prepareDelegatedMintTxn(nonce, account) {
  var functionSig = web3.utils.sha3(&quot;delegatedMintHashing(uint256,address)&quot;).substring(0,10)
  var data = web3.utils.soliditySha3( functionSig, nonce, account.address )
  var sig = web3.eth.accounts.sign(web3.utils.toHex(data), account.privateKey )
  // prepare the mint packet
  var packet = {}
  packet.nonce = nonce
  packet.origin = account.address
  packet.signature = sig.signature
  // deliver resulting JSON packet to pool or third party
  var mineableMintPacket = JSON.stringify(packet, null, 4)
  /* todo: send mineableMintPacket to submitter */
  ...
}
```
Once the packet is prepared and formatted it can then be routed to a third party that will submit the transaction to the contract&apos;s delegatedMint() function, thereby paying for the transaction gas and receiving the resulting tokens. The pool/third party must then manually payback the minted tokens minus fees to the original minter.

The following code sample exemplifies third party packet relaying:
``` solidity
//received by minter
var mineableMintPacket = ...
var packet = JSON.parse(mineableMintPacket)
erc918MineableToken.delegatedMint(packet.nonce, packet.origin, packet.signature)
```
The Delegated Mint Extension expands upon ERC918 realized as a sub-contract:
``` js
import &apos;openzeppelin-solidity/contracts/contracts/cryptography/ECDSA.sol&apos;;

contract ERC918DelegatedMint is AbstractERC918, ECDSA {
   /**
     * @notice Hash (keccak256) of the payload used by delegatedMint
     * @param _nonce the golden nonce
     * @param _origin the original minter
     * @param _signature the original minter&apos;s elliptical curve signature
     */
    function delegatedMint(uint256 _nonce, address _origin, bytes _signature) public returns (bool success) {
        bytes32 hashedTx = delegatedMintHashing(_nonce, _origin);
        address minter = recover(hashedTx, _signature);
        require(minter == _origin, &quot;Origin minter address does not match recovered signature address [ AbstractERC918.delegatedMint() ]&quot;);
        require(minter != address(0), &quot;Invalid minter address recovered from signature [ ERC918DelegatedMint.delegatedMint() ]&quot;);
        success = mintInternal(_nonce, minter);
    }

    /**
     * @notice Hash (keccak256) of the payload used by delegatedMint
     * @param _nonce the golden nonce
     * @param _origin the original minter
     */
    function delegatedMintHashing(uint256 _nonce, address _origin) public pure returns (bytes32) {
        /* &quot;0x7b36737a&quot;: delegatedMintHashing(uint256,address) */
        return toEthSignedMessageHash(keccak256(abi.encodePacked( bytes4(0x7b36737a), _nonce, _origin)));
    }
}
```

### Mineable Token Metadata (Optional)
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 &apos;metadataURI()&apos; that returns a JSON string encoded with the string fields symbol, name, description, website, image, and type.

Solidity interface for Mineable Token Metadata:
``` solidity
/**
 * @title ERC-918 Mineable Token Standard, optional metadata extension
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-918.md
 * 
 */
interface ERC918Metadata is AbstractERC918 {
    /**
     * @notice A distinct Uniform Resource Identifier (URI) for a mineable asset.
     */
    function metadataURI() external view returns (string);
}
```

Mineable Token Metadata JSON schema definition:
``` solidity
{
    &quot;title&quot;: &quot;Mineable Token Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;symbol&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the Mineable Token&apos;s symbol&quot;,
        },
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the Mineable Token&apos;s name&quot;,
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the Mineable Token&apos;s long description&quot;,
        },
        &quot;website&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the Mineable Token&apos;s homepage URI&quot;,
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the Mineable Token&apos;s image URI&quot;,
        },
        &quot;type&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the Mineable Token&apos;s hash algorithm ( ie.keccak256 ) used to encode the solution&quot;,
        }
    }
}
```

### Rationale

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&apos;s address in the hash algorithm.  

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.

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.


### Backwards Compatibility
Earlier versions of this standard incorporated a redundant &apos;challenge_digest&apos; 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:

``` solidity
/**
 * @title ERC-918 Mineable Token Standard, optional backwards compatibility function
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-918.md
 * 
 */
contract ERC918BackwardsCompatible is AbstractERC918 {

    /*
     * @notice Externally facing mint function kept for backwards compatibility with previous mint() definition
     * @param _nonce the solution nonce
     * @param _challenge_digest the keccak256 encoded challenge number + message sender + solution nonce
     **/
    function mint(uint256 _nonce, bytes32 _challenge_digest) public returns (bool success) {
        //the challenge digest must match the expected
        bytes32 digest = keccak256( abi.encodePacked(challengeNumber, msg.sender, _nonce) );
        require(digest == _challenge_digest, &quot;Challenge digest does not match expected digest on token contract [ AbstractERC918.mint() ]&quot;);
        success = mint(_nonce);
    }
}
```

### Test Cases
(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.)


### Implementation

Simple Example:
https://github.com/0xbitcoin/EIP918-Mineable-Token/blob/master/contracts/SimpleERC918.sol

Complex Examples:

https://github.com/0xbitcoin/EIP918-Mineable-Token/blob/master/contracts/0xdogeExample.sol
https://github.com/0xbitcoin/EIP918-Mineable-Token/blob/master/contracts/0xdogeExample2.sol
https://github.com/0xbitcoin/EIP918-Mineable-Token/blob/master/contracts/0xBitcoinBase.sol

0xBitcoin Token Contract: 
https://etherscan.io/address/0xb6ed7644c69416d67b522e20bc294a9a9b405b31

MVI OpenCL Token Miner 
https://github.com/mining-visualizer/MVis-tokenminer/releases

PoWAdv Token Contract:
https://etherscan.io/address/0x1a136ae98b49b92841562b6574d1f3f5b0044e4c


### Copyright
Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Wed, 07 Mar 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-918</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-918</guid>
      </item>
    
      <item>
        <title>Address metadata registry</title>
        <category>Standards Track/ERC</category>
        
        <description>## Abstract
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.

## Motivation
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.

## Specification
The metadata registry has the following interface:
```solidity
interface AddressMetadataRegistry {
  function provider(address target) view returns(address);
  function setProvider(address _provider);
}
```

`setProvider` specifies the metadata registry to be associated with the caller&apos;s address, while `provider` returns the address of the metadata registry for the supplied address.

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.

## Provider specification

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.

Providers have one mandatory function:

```solidity
function supportsInterface(bytes4 interfaceID) constant returns (bool)
```

The `supportsInterface` function is documented in [EIP-165](./eip-165.md), 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 `true` for `supportsInterface()`, it must implement the functions specified in that interface.

`supportsInterface` must always return true for `0x01ffc9a7`, which is the interface ID of `supportsInterface` itself.

The first argument to all provider functions MUST be the address being queried; this facilitates the creation of multi-user provider contracts.

Currently standardised provider interfaces are specified in the table below.

| Interface name | Interface hash | Specification |
| --- | --- | --- |

EIPs may define new interfaces to be added to this registry.

## Rationale
There are two obvious approaches for a generic metadata registry: the indirection approach employed here, or a generalised key/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/value store; for that reason we selected this approach.

## Backwards Compatibility
There are no backwards compatibility concerns.

## Implementation
The canonical implementation of the metadata registry is as follows:
```solidity
contract AddressMetadataRegistry {
  mapping(address=&gt;address) public provider;
  
  function setProvider(address _provider) {
    provider[msg.sender] = _provider;
  }
}
```

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 12 Mar 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-926</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-926</guid>
      </item>
    
      <item>
        <title>Generalised authorisations</title>
        <category>Standards Track/ERC</category>
        
        <description>## Abstract
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.

## Motivation
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/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.

The pattern implemented here is inspired by [ds-auth](https://github.com/dapphub/ds-auth) and by OAuth.

## Specification
The generalised authorisation interface is implemented as a metadata provider, as specified in EIP 926. The following mandatory function is implemented:

```solidity
function canCall(address owner, address caller, address callee, bytes4 func) view returns(bool);
```

Where:
 - `owner` is the owner of the resource. If approved the function call is treated as being made by this address.
 - `caller` is the address making the present call.
 - `callee` is the address of the contract being called.
 - `func` is the 4-byte signature of the function being called.

For example, suppose Alice authorises Bob to transfer tokens on her behalf. When Bob does so, Alice is the `owner`, Bob is the `caller`, the token contract is the `callee`, and the function signature for the transfer function is `func`.

As this standard uses EIP 926, the authorisation flow is as follows:

 1. The callee contract fetches the provider for the `owner` address from the metadata registry contract, which resides at a well-known address.
 2. The callee contract calls `canCall()` with the parameters described above. If the function returns false, the callee reverts execution.

Commonly, providers will wish to supply a standardised interface for users to set and unset their own authorisations. They SHOULD implement the following interface:

```solidity
function authoriseCaller(address owner, address caller, address callee, bytes4 func);
function revokeCaller(address owner, address caller, address callee, bytes4 func);
```

Arguments have the same meaning as in `canCall`. Implementing contracts MUST ensure that `msg.sender` is authorised to call `authoriseCaller` or `revokeCaller` on behalf of `owner`; this MUST always be true if `owner == msg.sender`. Implementing contracts SHOULD use the standard specified here to determine if other callers may provide authorisations as well.

Implementing contracts SHOULD treat a `func` of 0 as authorising calls to all functions on `callee`. If `authorised` is `false` and `func` is 0, contracts need only clear any blanket authorisation; individual authorisations may remain in effect.

## Backwards Compatibility
There are no backwards compatibility concerns.

## Implementation
Example implementation TBD.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 12 Mar 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-927</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-927</guid>
      </item>
    
      <item>
        <title>Composable Non-Fungible Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-998-composable-non-fungible-tokens-cnfts/387</comments>
        
        <description>## Abstract

An extension of the [ERC-721 standard](./eip-721.md) to enable ERC-721 tokens to own other ERC-721 tokens and [ERC-20](./eip-20.md) tokens.

An extension of the [ERC-20](./eip-20.md) and `ERC-223 https://github.com/ethereum/EIPs/issues/223` standards to enable ERC-20 and `ERC-223` tokens to be owned by ERC-721 tokens.

This specification covers four different kinds of composable tokens:

1. [`ERC998ERC721` top-down composable tokens that receive, hold and transfer ERC-721 tokens](#erc-721-top-down-composable)
2. [`ERC998ERC20` top-down composable tokens that receive, hold and transfer ERC-20 tokens](#erc-20-top-down-composable)
3. [`ERC998ERC721` bottom-up composable tokens that attach themselves to other ERC-721 tokens.](#erc-721-bottom-up-composable)
4. [`ERC998ERC20` bottom-up composable tokens that attach themselves to ERC-721 tokens.](#erc-20-bottom-up-composable)

which map to

1. An `ERC998ERC721` top-down composable is an ERC-721 token with additional functionality for owning other ERC-721 tokens. 
2. An `ERC998ERC20` top-down composable is an ERC-721 token with additional functionality for owning ERC-20 tokens. 
3. An `ERC998ERC721` bottom-up composable is an ERC-721 token with additional functionality for being owned by an ERC-721 token.
4. An `ERC998ERC20` bottom-up composable is an ERC-20 token with additional functionality for being owned by an ERC-721 token.

A top-down composable contract stores and keeps track of child tokens for each of its tokens.

A bottom-up composable contract stores and keeps track of a parent token for each its tokens.

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.

Different composables, top-down and bottom-up, have their advantages and disadvantages which are explained in the [Rational section](#rationale). It is possible for a token to be one or more kinds of composable token.

A non-fungible token is compliant and Composable of this EIP if it implements one or more of the following interfaces:

* `ERC998ERC721TopDown`
* `ERC998ERC20TopDown`
* `ERC998ERC721BottomUp`
* `ERC998ERC20BottomUp`

## Specification

### ERC-721

`ERC998ERC721` top-down, `ERC998ERC20` top-down, and `ERC998ERC721` bottom-up composable contracts must implement the [ERC-721 interface](./eip-721.md).

### ERC-20

`ERC998ERC20` bottom-up composable contracts must implement the [ERC-20 interface](./eip-20.md).

### [ERC-165](./eip-165.md)

The [ERC-165 standard](./eip-165.md) must be applied to each [ERC-998](./eip-998.md) interface that is used.

### Authentication

Authenticating whether a user or contract can execute some action works the same for both `ERC998ERC721` top-down and `ERC998ERC721` bottom-up composables.

A `rootOwner` refers to the owner address at the top of a tree of composables and ERC-721 tokens. 

Authentication within any composable is done by finding the rootOwner and comparing it to `msg.sender`, the return result of `getApproved(tokenId)` and the return result of `isApprovedForAll(rootOwner, msg.sender)`. If a match is found then authentication passes, otherwise authentication fails and the contract throws.

Here is an example of authentication code:

```solidity
address rootOwner = address(rootOwnerOf(_tokenId));
require(rootOwner == msg.sender || 
  isApprovedForAll(rootOwner,msg.sender) ||
  getApproved(tokenId) == msg.sender;
```

The `approve(address _approved, uint256 _tokenId)` and `getApproved(uint256 _tokenId)` 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.

Here are example implementations:

```solidity
function approve(address _approved, uint256 _tokenId) external {
  address rootOwner = address(rootOwnerOf(_tokenId));	
  require(rootOwner == msg.sender || isApprovedForAll(rootOwner,msg.sender));

  rootOwnerAndTokenIdToApprovedAddress[rootOwner][_tokenId] = _approved;
  emit Approval(rootOwner, _approved, _tokenId);
}

function getApproved(uint256 _tokenId) public view returns (address)  {
  address rootOwner = address(rootOwnerOf(_tokenId));
  return rootOwnerAndTokenIdToApprovedAddress[rootOwner][_tokenId];
}
```

### Traversal

The rootOwner of a composable is gotten by calling `rootOwnerOf(uint256 _tokenId)` or `rootOwnerOfChild(address _childContract, uint256 _childTokenId)`. 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.

`ERC998ERC721` 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 `rootOwnerOf(uint256 _tokenID)` on a composable will return the root owner address at the top of the ownership tree.

It is important to get the traversal logic of `rootOwnerOf` right. The logic for `rootOwnerOf` is the same whether or not a composable is bottom-up or top-down or both.
Here is the logic:

```
Logic for rootOwnerOf(uint256 _tokenId)

If the token is a bottom-up composable and has a parent token then call rootOwnerOf for the parent token.
    If the call was successful then the returned address is the rootOwner.
    Otherwise call rootOwnerOfChild for the parent token.
        If the call was successful then the returned address is the rootOwner.
        Otherwise get the owner address of the token and that is the rootOwner.
Otherwise call rootOwnerOfChild for the token
    If the call was successful then the returned address is the rootOwner.
    Otherwise get the owner address of the token and that is the rootOwner.
```

Calling `rootOwnerOfChild` for a token means the following logic:

```solidity
// Logic for calling rootOwnerOfChild for a tokenId
address tokenOwner = ownerOf(tokenId);
address childContract = address(this);
bytes32 rootOwner = ERC998ERC721(tokenOwner).rootOwnerOfChild(childContract, tokenId);
```

But understand that the real call to `rootOwnerOfChild` should be made with assembly so that the code can check if the call failed and so that the `staticcall` opcode is used to ensure that no state is modified.

Tokens/contracts that implement the above authentication and traversal functionality are &quot;composable aware&quot;.

### Composable Transfer Function Parameter Format

Composable functions that make transfers follow the same parameter format: **from:to:what**.

For example the `getChild(address _from, uint256 _tokenId, address _childContract, uint256 _childTokenId)` composable function transfers an ERC-721 token from an address to a top-down composable. The `_from` parameter is the **from**, the `_tokenId` parameter is the **to** and the `address _childContract, uint256 _childTokenId` parameters are the **what**.

Another example is the `safeTransferChild(uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId)` function. The `_fromTokenId` is the **from**, the `_to` is the **to** and the `address _childContract, address _childTokenId` parameters are the **what**.

### transferFrom/safeTransferFrom Functions Do Not Transfer Tokens Owned By Tokens

In bottom-up and top-down composable contracts the `transferFrom` and `safeTransferFrom` functions must throw if they are called directly to transfer a token that is owned by another token.

The reason for this is that these functions do not explicitly specify which token owns a token to be transferred. [See the rational section for more information about this.](#explicit-transfer-parameters)

`transferFrom/safeTransferFrom` functions must be used to transfer tokens that are owned by an address.


### ERC-721 Top-Down Composable

ERC-721 top-down composables act as containers for ERC-721 tokens. 

ERC-721 top-down composables are ERC-721 tokens that can receive, hold and transfer ERC-721 tokens.

There are two ways to transfer a ERC-721 token to a top-down composable:

1. Use the `function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data)` function. The `_to` argument is the top-down composable contract address. The `bytes data` argument holds the integer value of the top-down composable tokenId that the ERC-721 token is transferred to.
2. Call `approve` in the ERC-721 token contract for the top-down composable contract. Then call `getChild` in the composable contract.

The first ways is for ERC-721 contracts that have a `safeTransferFrom` function. The second way is for contracts that do not have this function such as cryptokitties.

Here is an example of transferring ERC-721 token 3 from an address to top-down composable token 6:

```solidity
uint256 tokenId = 6;
bytes memory tokenIdBytes = new bytes(32);
assembly { mstore(add(tokenIdBytes, 32), tokenId) }
ERC721(contractAddress).safeTransferFrom(userAddress, composableAddress, 3, tokenIdBytes);
```

Every ERC-721 top-down composable compliant contract must implement the `ERC998ERC721TopDown` interface.

The `ERC998ERC721TopDownEnumerable` and `ERC998ERC20TopDownEnumerable` interfaces are optional.

```solidity
pragma solidity ^0.4.24;

/// @title `ERC998ERC721` Top-Down Composable Non-Fungible Token
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-998.md
///  Note: the ERC-165 identifier for this interface is 0xcde244d9
interface ERC998ERC721TopDown {

  /// @dev This emits when a token receives a child token.
  /// @param _from The prior owner of the token.
  /// @param _toTokenId The token that receives the child token.
  event ReceivedChild(
    address indexed _from, 
    uint256 indexed _toTokenId, 
    address indexed _childContract, 
    uint256 _childTokenId
  );
  
  /// @dev This emits when a child token is transferred from a token to an address.
  /// @param _fromTokenId The parent token that the child token is being transferred from.
  /// @param _to The new owner address of the child token.
  event TransferChild(
    uint256 indexed _fromTokenId, 
    address indexed _to, 
    address indexed _childContract, 
    uint256 _childTokenId
  );

  /// @notice Get the root owner of tokenId.
  /// @param _tokenId The token to query for a root owner address
  /// @return rootOwner The root owner at the top of tree of tokens and ERC-998 magic value.
  function rootOwnerOf(uint256 _tokenId) public view returns (bytes32 rootOwner);
  
  /// @notice Get the root owner of a child token.
  /// @param _childContract The contract address of the child token.
  /// @param _childTokenId The tokenId of the child.
  /// @return rootOwner The root owner at the top of tree of tokens and ERC-998 magic value.
  function rootOwnerOfChild(
    address _childContract, 
    uint256 _childTokenId
  ) 
    public 
    view
    returns (bytes32 rootOwner);
  
  /// @notice Get the parent tokenId of a child token.
  /// @param _childContract The contract address of the child token.
  /// @param _childTokenId The tokenId of the child.
  /// @return parentTokenOwner The parent address of the parent token and ERC-998 magic value
  /// @return parentTokenId The parent tokenId of _tokenId
  function ownerOfChild(
    address _childContract, 
    uint256 _childTokenId
  ) 
    external 
    view 
    returns (
      bytes32 parentTokenOwner, 
      uint256 parentTokenId
    );
  
  /// @notice A token receives a child token
  /// @param _operator The address that caused the transfer.
  /// @param _from The owner of the child token.
  /// @param _childTokenId The token that is being transferred to the parent.
  /// @param _data Up to the first 32 bytes contains an integer which is the receiving parent tokenId.  
  function onERC721Received(
    address _operator, 
    address _from, 
    uint256 _childTokenId, 
    bytes _data
  ) 
    external 
    returns(bytes4);
    
  /// @notice Transfer child token from top-down composable to address.
  /// @param _fromTokenId The owning token to transfer from.
  /// @param _to The address that receives the child token
  /// @param _childContract The ERC-721 contract of the child token.
  /// @param _childTokenId The tokenId of the token that is being transferred.
  function transferChild(
    uint256 _fromTokenId,
    address _to, 
    address _childContract, 
    uint256 _childTokenId
  ) 
    external;
  
  /// @notice Transfer child token from top-down composable to address.
  /// @param _fromTokenId The owning token to transfer from.
  /// @param _to The address that receives the child token
  /// @param _childContract The ERC-721 contract of the child token.
  /// @param _childTokenId The tokenId of the token that is being transferred.
  function safeTransferChild(
    uint256 _fromTokenId,
    address _to, 
    address _childContract, 
    uint256 _childTokenId
  ) 
    external;
  
  /// @notice Transfer child token from top-down composable to address.
  /// @param _fromTokenId The owning token to transfer from.
  /// @param _to The address that receives the child token
  /// @param _childContract The ERC-721 contract of the child token.
  /// @param _childTokenId The tokenId of the token that is being transferred.
  /// @param _data Additional data with no specified format
  function safeTransferChild(
    uint256 _fromTokenId,
    address _to, 
    address _childContract, 
    uint256 _childTokenId, 
    bytes _data
  ) 
    external;
  
  /// @notice Transfer bottom-up composable child token from top-down composable to other ERC-721 token.
  /// @param _fromTokenId The owning token to transfer from.
  /// @param _toContract The ERC-721 contract of the receiving token
  /// @param _toTokenId The receiving token  
  /// @param _childContract The bottom-up composable contract of the child token.
  /// @param _childTokenId The token that is being transferred.
  /// @param _data Additional data with no specified format
  function transferChildToParent(
    uint256 _fromTokenId, 
    address _toContract, 
    uint256 _toTokenId, 
    address _childContract, 
    uint256 _childTokenId, 
    bytes _data
  ) 
    external;
  
  /// @notice Get a child token from an ERC-721 contract.
  /// @param _from The address that owns the child token.
  /// @param _tokenId The token that becomes the parent owner
  /// @param _childContract The ERC-721 contract of the child token
  /// @param _childTokenId The tokenId of the child token
  function getChild(
    address _from, 
    uint256 _tokenId, 
    address _childContract, 
    uint256 _childTokenId
  ) 
    external;
}
```

#### `rootOwnerOf` 1

```solidity
/// @notice Get the root owner of tokenId.
/// @param _tokenId The token to query for a root owner address
/// @return rootOwner The root owner at the top of tree of tokens and ERC-998 magic value.
function rootOwnerOf(uint256 _tokenId) public view returns (bytes32 rootOwner);
```

This function traverses token owners until the root owner address of `_tokenId` is found.

The first 4 bytes of rootOwner contain the ERC-998 magic value `0xcd740db5`. The last 20 bytes contain the root owner address.

The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a `rootOwnerOf` function. The magic value is used in such calls to ensure a valid return value is received.

If it is unknown whether a contract has the `rootOwnerOf` function then the first four bytes of the `rootOwner` return value must be compared to `0xcd740db5`. 

`0xcd740db5` is equal to:

```solidity
this.rootOwnerOf.selector ^ this.rootOwnerOfChild.selector ^ 
this.tokenOwnerOf.selector ^ this.ownerOfChild.selector;
```

Here is an example of a value returned by `rootOwnerOf`.
`0xcd740db50000000000000000e5240103e1ff986a2c8ae6b6728ffe0d9a395c59`

#### rootOwnerOfChild

```solidity
/// @notice Get the root owner of a child token.
/// @param _childContract The contract address of the child token.
/// @param _childTokenId The tokenId of the child.
/// @return rootOwner The root owner at the top of tree of tokens and ERC-998 magic value.
function rootOwnerOfChild(
  address _childContract, 
  uint256 _childTokenId
) 
  public 
  view 
  returns (bytes32 rootOwner);
```

This function traverses token owners until the root owner address of the supplied child token is found.

The first 4 bytes of rootOwner contain the ERC-998 magic value `0xcd740db5`. The last 20 bytes contain the root owner address.

The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a `rootOwnerOf` function. The magic value is used in such calls to ensure a valid return value is received.

If it is unknown whether a contract has the `rootOwnerOfChild` function then the first four bytes of the `rootOwner` return value must be compared to `0xcd740db5`. 

#### ownerOfChild

```solidity
/// @notice Get the parent tokenId of a child token.
/// @param _childContract The contract address of the child token.
/// @param _childTokenId The tokenId of the child.
/// @return parentTokenOwner The parent address of the parent token and ERC-998 magic value
/// @return parentTokenId The parent tokenId of _tokenId
function ownerOfChild(
  address _childContract, 
  uint256 _childTokenId
) 
  external 
  view 
  returns (
    address parentTokenOwner, 
    uint256 parentTokenId
  );
```

This function is used to get the parent tokenId of a child token and get the owner address of the parent token.

The first 4 bytes of parentTokenOwner contain the ERC-998 magic value `0xcd740db5`. The last 20 bytes contain the parent token owner address.

The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a `ownerOfChild` function. The magic value is used in such calls to ensure a valid return value is received.

If it is unknown whether a contract has the `ownerOfChild` function then the first four bytes of the `parentTokenOwner` return value must be compared to `0xcd740db5`. 

#### `onERC721Received`

```solidity
/// @notice A token receives a child token
/// @param _operator The address that caused the transfer.
/// @param _from The prior owner of the child token.
/// @param _childTokenId The token that is being transferred to the parent.
/// @param _data Up to the first 32 bytes contains an integer which is the receiving parent tokenId.  
function onERC721Received(
  address _operator, 
  address _from, 
  uint256 _childTokenId, 
  bytes _data
) 
  external 
  returns(bytes4);
```

This is a function defined in the ERC-721 standard. This function is called in an ERC-721 contract when `safeTransferFrom` is called. The `bytes _data` argument contains an integer value from 1 to 32 bytes long that is the parent tokenId that an ERC-721 token is transferred to. 

The `onERC721Received` 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.

The return value for `onERC721Received` is the magic value `0x150b7a02` which is equal to `bytes4(keccak256(abi.encodePacked(&quot;onERC721Received(address,address,uint256,bytes)&quot;)))`.

#### transferChild

```solidity
/// @notice Transfer child token from top-down composable to address.
/// @param _fromTokenId The owning token to transfer from.
/// @param _to The address that receives the child token
/// @param _childContract The ERC-721 contract of the child token.
/// @param _childTokenId The tokenId of the token that is being transferred.
function transferChild(
  uint256 _fromTokenId,
  address _to, 
  address _childContract, 
  uint256 _childTokenId
) 
  external;
```

This function authenticates `msg.sender` and transfers a child token from a top-down composable to a different address. 

This function makes this call within it:

```solidity
ERC721(_childContract).transferFrom(this, _to, _childTokenId);
```

#### safeTransferChild 1

```solidity
/// @notice Transfer child token from top-down composable to address.
/// @param _fromTokenId The owning token to transfer from.
/// @param _to The address that receives the child token
/// @param _childContract The ERC-721 contract of the child token.
/// @param _childTokenId The tokenId of the token that is being transferred.
function safeTransferChild(
  uint256 _fromTokenId,
  address _to, 
  address _childContract, 
  uint256 _childTokenId
) 
  external;
```

This function authenticates `msg.sender` and transfers a child token from a top-down composable to a different address. 

This function makes this call within it:

```solidity
ERC721(_childContract).safeTransferFrom(this, _to, _childTokenId);
```

#### safeTransferChild 2

```solidity
/// @notice Transfer child token from top-down composable to address or other top-down composable.
/// @param _fromTokenId The owning token to transfer from.
/// @param _to The address that receives the child token
/// @param _childContract The ERC721 contract of the child token.
/// @param _childTokenId The tokenId of the token that is being transferred.
/// @param _data Additional data with no specified format, can be used to specify tokenId to transfer to
function safeTransferChild(
  uint256 _fromTokenId,
  address _to, 
  address _childContract, 
  uint256 _childTokenId, 
  bytes _data
) 
  external;
```

This function authenticates `msg.sender` and transfers a child token from a top-down composable to a different address or to a different top-down composable.

A child token is transferred to a different top-down composable if the `_to` address is a top-down composable contract and `bytes _data` is supplied an integer representing the parent tokenId.

This function makes this call within it: 

```solidity
ERC721(_childContract).safeTransferFrom(this, _to, _childTokenId, _data);
```

#### transferChildToParent

```solidity
/// @notice Transfer bottom-up composable child token from top-down composable to other ERC-721 token.
/// @param _fromTokenId The owning token to transfer from.
/// @param _toContract The ERC-721 contract of the receiving token
/// @param _toToken The receiving token  
/// @param _childContract The bottom-up composable contract of the child token.
/// @param _childTokenId The token that is being transferred.
/// @param _data Additional data with no specified format
function transferChildToParent(
  uint256 _fromTokenId, 
  address _toContract, 
  uint256 _toTokenId, 
  address _childContract, 
  uint256 _childTokenId, 
  bytes _data
) 
  external
```

This function authenticates `msg.sender` 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.

This function makes this call within it:

```solidity
ERC998ERC721BottomUp(_childContract).transferToParent(
  address(this), 
  _toContract, 
  _toTokenId, 
  _childTokenId, 
  _data
);
```

#### getChild 

```solidity
/// @notice Get a child token from an ERC-721 contract.
/// @param _from The address that owns the child token.
/// @param _tokenId The token that becomes the parent owner
/// @param _childContract The ERC-721 contract of the child token
/// @param _childTokenId The tokenId of the child token
function getChild(
  address _from, 
  uint256 _tokenId, 
  address _childContract, 
  uint256 _childTokenId
) 
  external;
```

This function is used to transfer an ERC-721 token when its contract does not have a `safeTransferChild(uint256 _fromTokenId, address _to, address _childContract, uint256 _childTokenId, bytes _data)` function.

A transfer with this function is done in two steps:

1. The owner of the ERC-721 token calls `approve` or `setApprovalForAll` in the ERC-721 contract for the top-down composable contract.
2. The owner of the ERC-721 token calls `getChild` in the top-down composable contract for the ERC-721 token.

The `getChild` function must authenticate that `msg.sender` 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.

#### ERC-721 Top-Down Composable Enumeration

Optional interface for top-down composable enumeration:

```solidity
///  @dev The ERC-165 identifier for this interface is 0xa344afe4
interface ERC998ERC721TopDownEnumerable {

  /// @notice Get the total number of child contracts with tokens that are owned by tokenId.
  /// @param _tokenId The parent token of child tokens in child contracts
  /// @return uint256 The total number of child contracts with tokens owned by tokenId.
  function totalChildContracts(uint256 _tokenId) external view returns(uint256);
  
  /// @notice Get child contract by tokenId and index
  /// @param _tokenId The parent token of child tokens in child contract
  /// @param _index The index position of the child contract
  /// @return childContract The contract found at the tokenId and index.
  function childContractByIndex(
    uint256 _tokenId, 
    uint256 _index
  ) 
    external 
    view 
    returns (address childContract);
  
  /// @notice Get the total number of child tokens owned by tokenId that exist in a child contract.
  /// @param _tokenId The parent token of child tokens
  /// @param _childContract The child contract containing the child tokens
  /// @return uint256 The total number of child tokens found in child contract that are owned by tokenId.
  function totalChildTokens(
    uint256 _tokenId, 
    address _childContract
  ) 
    external 
    view 
    returns(uint256);
  
  /// @notice Get child token owned by tokenId, in child contract, at index position
  /// @param _tokenId The parent token of the child token
  /// @param _childContract The child contract of the child token
  /// @param _index The index position of the child token.
  /// @return childTokenId The child tokenId for the parent token, child token and index
  function childTokenByIndex(
    uint256 _tokenId, 
    address _childContract, 
    uint256 _index
  )
    external 
    view 
    returns (uint256 childTokenId);
}
```

### ERC-20 Top-Down Composable

ERC-20 top-down composables act as containers for ERC-20 tokens.
  
ERC-20 top-down composables are ERC-721 tokens that can receive, hold and transfer ERC-20 tokens.

There are two ways to transfer ERC-20 tokens to an ERC-20 Top-Down Composable:

1. Use the `transfer(address _to, uint256 _value, bytes _data);` function from the `ERC-223` contract. The `_to` argument is the ERC-20 top-down composable contract address. The `_value` argument is how many ERC-20 tokens to transfer. The `bytes` argument holds the integer value of the top-down composable tokenId that receives the ERC-20 tokens.
2. Call `approve` in the ERC-20 contract for the ERC-20 top-down composable contract. Then call `getERC20(address _from, uint256 _tokenId, address _erc20Contract, uint256 _value)` from the ERC-20 top-down composable contract.

The first way is for ERC-20 contracts that support the `ERC-223` standard. The second way is for contracts that do not.

ERC-20 top-down composables implement the following interface:
  
```solidity
/// @title `ERC998ERC20` Top-Down Composable Non-Fungible Token
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-998.md
///  Note: the ERC-165 identifier for this interface is 0x7294ffed
interface ERC998ERC20TopDown {

  /// @dev This emits when a token receives ERC-20 tokens.
  /// @param _from The prior owner of the token.
  /// @param _toTokenId The token that receives the ERC-20 tokens.
  /// @param _erc20Contract The ERC-20 contract.
  /// @param _value The number of ERC-20 tokens received.
  event ReceivedERC20(
    address indexed _from, 
    uint256 indexed _toTokenId, 
    address indexed _erc20Contract, 
    uint256 _value
  );
  
  /// @dev This emits when a token transfers ERC-20 tokens.
  /// @param _tokenId The token that owned the ERC-20 tokens.
  /// @param _to The address that receives the ERC-20 tokens.
  /// @param _erc20Contract The ERC-20 contract.
  /// @param _value The number of ERC-20 tokens transferred.
  event TransferERC20(
    uint256 indexed _fromTokenId, 
    address indexed _to, 
    address indexed _erc20Contract, 
    uint256 _value
  );

  /// @notice A token receives ERC-20 tokens
  /// @param _from The prior owner of the ERC-20 tokens
  /// @param _value The number of ERC-20 tokens received
  /// @param _data Up to the first 32 bytes contains an integer which is the receiving tokenId.  
  function tokenFallback(address _from, uint256 _value, bytes _data) external;
  
  /// @notice Look up the balance of ERC-20 tokens for a specific token and ERC-20 contract
  /// @param _tokenId The token that owns the ERC-20 tokens
  /// @param _erc20Contract The ERC-20 contract
  /// @return The number of ERC-20 tokens owned by a token from an ERC-20 contract
  function balanceOfERC20(
    uint256 _tokenId, 
    address _erc20Contract
  ) 
    external 
    view 
    returns(uint256);
  
  /// @notice Transfer ERC-20 tokens to address
  /// @param _tokenId The token to transfer from
  /// @param _value The address to send the ERC-20 tokens to
  /// @param _erc20Contract The ERC-20 contract
  /// @param _value The number of ERC-20 tokens to transfer
  function transferERC20(
    uint256 _tokenId, 
    address _to, 
    address _erc20Contract, 
    uint256 _value
  ) 
    external;
  
  /// @notice Transfer ERC-20 tokens to address or ERC-20 top-down composable
  /// @param _tokenId The token to transfer from
  /// @param _value The address to send the ERC-20 tokens to
  /// @param _erc223Contract The `ERC-223` token contract
  /// @param _value The number of ERC-20 tokens to transfer
  /// @param _data Additional data with no specified format, can be used to specify tokenId to transfer to
  function transferERC223(
    uint256 _tokenId, 
    address _to, 
    address _erc223Contract, 
    uint256 _value, 
    bytes _data
  )
    external;
  
  /// @notice Get ERC-20 tokens from ERC-20 contract.
  /// @param _from The current owner address of the ERC-20 tokens that are being transferred.
  /// @param _tokenId The token to transfer the ERC-20 tokens to.
  /// @param _erc20Contract The ERC-20 token contract
  /// @param _value The number of ERC-20 tokens to transfer  
  function getERC20(
    address _from, 
    uint256 _tokenId, 
    address _erc20Contract, 
    uint256 _value
  ) 
    external;
}
```

#### tokenFallback

```solidity
/// @notice A token receives ERC-20 tokens
/// @param _from The prior owner of the ERC-20 tokens
/// @param _value The number of ERC-20 tokens received
/// @param _data Up to the first 32 bytes contains an integer which is the receiving tokenId.  
function tokenFallback(address _from, uint256 _value, bytes _data) external;  
```

This function comes from the `ERC-223` 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 `_data` parameter.

#### `balanceOfERC20`

```solidity
/// @notice Look up the balance of ERC-20 tokens for a specific token and ERC-20 contract
/// @param _tokenId The token that owns the ERC-20 tokens
/// @param _erc20Contract The ERC-20 contract
/// @return The number of ERC-20 tokens owned by a token from an ERC-20 contract
function balanceOfERC20(
  uint256 _tokenId, 
  address _erc20Contract
) 
  external 
  view 
  returns(uint256);
```

Gets the balance of ERC-20 tokens owned by a token from a specific ERC-20 contract.

#### `transferERC20`

```solidity
/// @notice Transfer ERC-20 tokens to address
/// @param _tokenId The token to transfer from
/// @param _value The address to send the ERC-20 tokens to
/// @param _erc20Contract The ERC-20 contract
/// @param _value The number of ERC-20 tokens to transfer
function transferERC20(
  uint256 _tokenId, 
  address _to, 
  address _erc20Contract, 
  uint256 _value
)
  external;
```

This is used to transfer ERC-20 tokens from a token to an address. This function calls `ERC20(_erc20Contract).transfer(_to, _value)`;

This function must authenticate `msg.sender`.

#### `transferERC223`

```solidity
  /// @notice Transfer ERC-20 tokens to address or ERC-20 top-down composable
  /// @param _tokenId The token to transfer from
  /// @param _value The address to send the ERC-20 tokens to
  /// @param _erc223Contract The `ERC-223` token contract
  /// @param _value The number of ERC-20 tokens to transfer
  /// @param _data Additional data with no specified format, can be used to specify tokenId to transfer to
  function transferERC223(
    uint256 _tokenId, 
    address _to, 
    address _erc223Contract, 
    uint256 _value, 
    bytes _data
  )
    external;
```

This function is from the `ERC-223`. 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 `_data` argument.

This function must authenticate `msg.sender`.

#### `getERC20`

```solidity
/// @notice Get ERC-20 tokens from ERC-20 contract.
/// @param _from The current owner address of the ERC-20 tokens that are being transferred.
/// @param _tokenId The token to transfer the ERC-20 tokens to.
/// @param _erc20Contract The ERC-20 token contract
/// @param _value The number of ERC-20 tokens to transfer  
function getERC20(
  address _from, 
  uint256 _tokenId, 
  address _erc20Contract, 
  uint256 _value
) 
  external;
```

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 `transferERC223(uint256 _tokenId, address _to, address _erc223Contract, uint256 _value, bytes _data)` function.

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.

This function must authenticate that `msg.sender` equals `_from` or has been approved in the ERC-20 contract.

#### ERC-20 Top-Down Composable Enumeration

Optional interface for top-down composable enumeration:

```solidity
/// @dev The ERC-165 identifier for this interface is 0xc5fd96cd
interface ERC998ERC20TopDownEnumerable {
  
  /// @notice Get the number of ERC-20 contracts that token owns ERC-20 tokens from
  /// @param _tokenId The token that owns ERC-20 tokens.
  /// @return uint256 The number of ERC-20 contracts
  function totalERC20Contracts(uint256 _tokenId) external view returns(uint256);
  
  /// @notice Get an ERC-20 contract that token owns ERC-20 tokens from by index
  /// @param _tokenId The token that owns ERC-20 tokens.
  /// @param _index The index position of the ERC-20 contract.
  /// @return address The ERC-20 contract
  function erc20ContractByIndex(
    uint256 _tokenId, 
    uint256 _index
  ) 
    external 
    view 
    returns(address);
}
```

### ERC-721 Bottom-Up Composable

ERC-721 bottom-up composables are ERC-721 tokens that attach themselves to other ERC-721 tokens.

ERC-721 bottom-up composable contracts store the owning address of a token and the parent tokenId if any.

```solidity
/// @title `ERC998ERC721` Bottom-Up Composable Non-Fungible Token
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-998.md
///  Note: the ERC-165 identifier for this interface is 0xa1b23002
interface ERC998ERC721BottomUp {

  /// @dev This emits when a token is transferred to an ERC-721 token
  /// @param _toContract The contract the token is transferred to
  /// @param _toTokenId The token the token is transferred to
  /// @param _tokenId The token that is transferred  
  event TransferToParent(
    address indexed _toContract, 
    uint256 indexed _toTokenId, 
    uint256 _tokenId
  );
  
  /// @dev This emits when a token is transferred from an ERC-721 token
  /// @param _fromContract The contract the token is transferred from
  /// @param _fromTokenId The token the token is transferred from
  /// @param _tokenId The token that is transferred  
  event TransferFromParent(
    address indexed _fromContract, 
    uint256 indexed _fromTokenId, 
    uint256 _tokenId
  );
  
  /// @notice Get the root owner of tokenId.
  /// @param _tokenId The token to query for a root owner address
  /// @return rootOwner The root owner at the top of tree of tokens and ERC-998 magic value.
  function rootOwnerOf(uint256 _tokenId) external view returns (bytes32 rootOwner);

  /// @notice Get the owner address and parent token (if there is one) of a token
  /// @param _tokenId The tokenId to query.
  /// @return tokenOwner The owner address of the token
  /// @return parentTokenId The parent owner of the token and ERC-998 magic value
  /// @return isParent True if parentTokenId is a valid parent tokenId and false if there is no parent tokenId
  function tokenOwnerOf(
    uint256 _tokenId
  )
    external 
    view
    returns (
      bytes32 tokenOwner, 
      uint256 parentTokenId, 
      bool isParent
    );
 
  /// @notice Transfer token from owner address to a token
  /// @param _from The owner address
  /// @param _toContract The ERC-721 contract of the receiving token
  /// @param _toToken The receiving token
  /// @param _data Additional data with no specified format
  function transferToParent(
    address _from, 
    address _toContract, 
    uint256 _toTokenId, 
    uint256 _tokenId, 
    bytes _data
  )
    external;
   
  /// @notice Transfer token from a token to an address
  /// @param _fromContract The address of the owning contract
  /// @param _fromTokenId The owning token
  /// @param _to The address the token is transferred to.
  /// @param _tokenId The token that is transferred
  /// @param _data Additional data with no specified format
  function transferFromParent(
    address _fromContract, 
    uint256 _fromTokenId, 
    address _to, 
    uint256 _tokenId, 
    bytes _data
  )
    external;
  
  /// @notice Transfer a token from a token to another token
  /// @param _fromContract The address of the owning contract
  /// @param _fromTokenId The owning token
  /// @param _toContract The ERC-721 contract of the receiving token
  /// @param _toToken The receiving token
  /// @param _tokenId The token that is transferred
  /// @param _data Additional data with no specified format
  function transferAsChild(
    address _fromContract, 
    uint256 _fromTokenId, 
    address _toContract, 
    uint256 _toTokenId, 
    uint256 _tokenId, 
    bytes _data
  )
    external;
}
```

#### `rootOwnerOf`

```solidity
/// @notice Get the root owner of tokenId.
/// @param _tokenId The token to query for a root owner address
/// @return rootOwner The root owner at the top of tree of tokens and ERC-998 magic value.
function rootOwnerOf(uint256 _tokenId) public view returns (bytes32 rootOwner);
```

This function traverses token owners until the root owner address of `_tokenId` is found.

The first 4 bytes of rootOwner contain the ERC-998 magic value `0xcd740db5`. The last 20 bytes contain the root owner address.

The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a `rootOwnerOf` function. The magic value is used in such calls to ensure a valid return value is received.

If it is unknown whether a contract has the `rootOwnerOf` function then the first four bytes of the `rootOwner` return value must be compared to `0xcd740db5`. 

`0xcd740db5` is equal to:

```solidity
this.rootOwnerOf.selector ^ this.rootOwnerOfChild.selector ^ 
this.tokenOwnerOf.selector ^ this.ownerOfChild.selector;
```

Here is an example of a value returned by `rootOwnerOf`.
`0xcd740db50000000000000000e5240103e1ff986a2c8ae6b6728ffe0d9a395c59`

#### tokenOwnerOf

```solidity
/// @notice Get the owner address and parent token (if there is one) of a token
/// @param _tokenId The tokenId to query.
/// @return tokenOwner The owner address of the token and ERC-998 magic value.
/// @return parentTokenId The parent owner of the token
/// @return isParent True if parentTokenId is a valid parent tokenId and false if there is no parent tokenId
function tokenOwnerOf(
  uint256 _tokenId
)
  external 
  view 
  returns (
    bytes32 tokenOwner, 
    uint256 parentTokenId, 
    bool isParent
  );
```

This function is used to get the owning address and parent tokenId of a token if there is one stored in the contract.

If `isParent` is true then `tokenOwner` is the owning ERC-721 contract address and `parentTokenId` is a valid parent tokenId. If `isParent` is false then `tokenOwner` is a user address and `parentTokenId` does not contain a valid parent tokenId and must be ignored.

The first 4 bytes of `tokenOwner` contain the ERC-998 magic value `0xcd740db5`. The last 20 bytes contain the token owner address.

The magic value is returned because this function may be called on contracts when it is unknown if the contracts have a `tokenOwnerOf` function. The magic value is used in such calls to ensure a valid return value is received.

If it is unknown whether a contract has the `rootOwnerOf` function then the first four bytes of the `tokenOwner` return value must be compared to `0xcd740db5`. 

#### transferToParent

```solidity
/// @notice Transfer token from owner address to a token
/// @param _from The owner address
/// @param _toContract The ERC-721 contract of the receiving token
/// @param _toToken The receiving token
/// @param _data Additional data with no specified format
function transferToParent(
  address _from, 
  address _toContract, 
  uint256 _toTokenId, 
  uint256 _tokenId, 
  bytes _data
)
  external;
```

This function is used to transfer a token from an address to a token. `msg.sender` must be authenticated.

This function must check that `_toToken` exists in `_toContract` and throw if not.

#### transferFromParent

```solidity
/// @notice Transfer token from a token to an address
/// @param _fromContract The address of the owning contract
/// @param _fromTokenId The owning token
/// @param _to The address the token is transferred to.
/// @param _tokenId The token that is transferred
/// @param _data Additional data with no specified format
function transferFromParent(
  address _fromContract, 
  uint256 _fromTokenId, 
  address _to, 
  uint256 _tokenId, 
  bytes _data
)
  external;
```

This function is used to transfer a token from a token to an address. `msg.sender` must be authenticated.

This function must check that `_fromContract` and `_fromTokenId` own `_tokenId` and throw not.

#### transferAsChild

```solidity
/// @notice Transfer a token from a token to another token
/// @param _fromContract The address of the owning contract
/// @param _fromTokenId The owning token
/// @param _toContract The ERC-721 contract of the receiving token
/// @param _toToken The receiving token
/// @param _tokenId The token that is transferred
/// @param _data Additional data with no specified format
function transferAsChild(
  address _fromContract, 
  uint256 _fromTokenId, 
  address _toContract, 
  uint256 _toTokenId, 
  uint256 _tokenId, 
  bytes _data
)
  external;
```

This function is used to transfer a token from a token to another token. `msg.sender` must be authenticated.

This function must check that `_toToken` exists in `_toContract` and throw if not.

This function must check that `_fromContract` and `_fromTokenId` own `_tokenId` and throw if not.

#### ERC-721 Bottom-Up Composable Enumeration

Optional interface for bottom-up composable enumeration:

```solidity
/// @dev The ERC-165 identifier for this interface is 0x8318b539
interface ERC998ERC721BottomUpEnumerable {
  
  /// @notice Get the number of ERC-721 tokens owned by parent token.
  /// @param _parentContract The contract the parent ERC-721 token is from.
  /// @param _parentTokenId The parent tokenId that owns tokens
  //  @return uint256 The number of ERC-721 tokens owned by parent token.
  function totalChildTokens(
    address _parentContract, 
    uint256 _parentTokenId
  ) 
    external 
    view 
    returns (uint256);
  
  /// @notice Get a child token by index
  /// @param _parentContract The contract the parent ERC-721 token is from.
  /// @param _parentTokenId The parent tokenId that owns the token
  /// @param _index The index position of the child token
  /// @return uint256 The child tokenId owned by the parent token
  function childTokenByIndex(
    address _parentContract, 
    uint256 _parentTokenId, 
    uint256 _index
  ) 
    external 
    view 
    returns (uint256);
}
```

### ERC-20 Bottom-Up Composable

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.

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 `ERC-223` interfaces allowing for querying the balance of parent tokens, and transferring tokens to, from, and between parent tokens.

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.

```solidity
/// @dev This mapping tracks standard ERC20/`ERC-223` ownership, where an address owns
///  a particular amount of tokens.
mapping(address =&gt; uint) userBalances;

/// @dev This additional mapping tracks ERC-998 ownership, where an ERC-721 token owns
///  a particular amount of tokens. This tracks contractAddres =&gt; tokenId =&gt; balance
mapping(address =&gt; mapping(uint =&gt; uint)) nftBalances;
```

The complete interface is below.

```solidity
/// @title `ERC998ERC20` Bottom-Up Composable Fungible Token
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-998.md
/// Note: The ERC-165 identifier for this interface is 0xffafa991
interface ERC998ERC20BottomUp {
  
  /// @dev This emits when a token is transferred to an ERC-721 token
  /// @param _toContract The contract the token is transferred to
  /// @param _toTokenId The token the token is transferred to
  /// @param _amount The amount of tokens transferred
  event TransferToParent(
    address indexed _toContract, 
    uint256 indexed _toTokenId, 
    uint256 _amount
  );

  /// @dev This emits when a token is transferred from an ERC-721 token
  /// @param _fromContract The contract the token is transferred from
  /// @param _fromTokenId The token the token is transferred from
  /// @param _amount The amount of tokens transferred
  event TransferFromParent(
    address indexed _fromContract, 
    uint256 indexed _fromTokenId, 
    uint256 _amount
  );

  /// @notice Get the balance of a non-fungible parent token
  /// @param _tokenContract The contract tracking the parent token
  /// @param _tokenId The ID of the parent token
  /// @return amount The balance of the token
  function balanceOfToken(
    address _tokenContract, 
    uint256 _tokenId
  )
    external
    view
    returns (uint256 amount);

  /// @notice Transfer tokens from owner address to a token
  /// @param _from The owner address
  /// @param _toContract The ERC-721 contract of the receiving token
  /// @param _toToken The receiving token
  /// @param _amount The amount of tokens to transfer
  function transferToParent(
    address _from, 
    address _toContract, 
    uint256 _toTokenId, 
    uint256 _amount
  )
    external;

  /// @notice Transfer token from a token to an address
  /// @param _fromContract The address of the owning contract
  /// @param _fromTokenId The owning token
  /// @param _to The address the token is transferred to
  /// @param _amount The amount of tokens to transfer
  function transferFromParent(
    address _fromContract, 
    uint256 _fromTokenId, 
    address _to, 
    uint256 _amount
  )
    external;

  /// @notice Transfer token from a token to an address, using `ERC-223` semantics
  /// @param _fromContract The address of the owning contract
  /// @param _fromTokenId The owning token
  /// @param _to The address the token is transferred to
  /// @param _amount The amount of tokens to transfer
  /// @param _data Additional data with no specified format, can be used to specify the sender tokenId
  function transferFromParentERC223(
    address _fromContract, 
    uint256 _fromTokenId, 
    address _to, 
    uint256 _amount, 
    bytes _data
  )
    external;

  /// @notice Transfer a token from a token to another token
  /// @param _fromContract The address of the owning contract
  /// @param _fromTokenId The owning token
  /// @param _toContract The ERC-721 contract of the receiving token
  /// @param _toToken The receiving token
  /// @param _amount The amount tokens to transfer
  function transferAsChild(
    address _fromContract, 
    uint256 _fromTokenId, 
    address _toContract, 
    uint256 _toTokenId, 
    uint256 _amount
   )
    external;
}
```

#### balanceOfToken

```solidity
/// @notice Get the balance of a non-fungible parent token
/// @param _tokenContract The contract tracking the parent token
/// @param _tokenId The ID of the parent token
/// @return amount The balance of the token
function balanceOfToken(
  address _tokenContract, 
  uint256 _tokenId
)
  external
  view
  returns (uint256 amount);
```

This function returns the balance of a non-fungible token. It mirrors the standard ERC-20 method `balanceOf`, but accepts the address of the parent token&apos;s contract, and the parent token&apos;s ID. This method behaves identically to `balanceOf`, but checks for ownership by ERC-721 tokens rather than user addresses.

#### `transferToParent`

```solidity
/// @notice Transfer tokens from owner address to a token
/// @param _from The owner address
/// @param _toContract The ERC-721 contract of the receiving token
/// @param _toToken The receiving token
/// @param _amount The amount of tokens to transfer
function transferToParent(
  address _from, 
  address _toContract, 
  uint256 _toTokenId, 
  uint256 _amount
)
  external;
```

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 `supportsInterface` function. This function SHOULD ensure that the recipient token actually exists, by calling `ownerOf` on the recipient token&apos;s contract, and ensuring it neither throws nor returns the zero address. This function MUST emit the `TransferToParent` event upon a successful transfer (in addition to the standard ERC-20 `Transfer` event!). This function MUST throw if the `_from` account balance does not have enough tokens to spend.

#### `transferFromParent`

```solidity
/// @notice Transfer token from a token to an address
/// @param _fromContract The address of the owning contract
/// @param _fromTokenId The owning token
/// @param _to The address the token is transferred to
/// @param _amount The amount of tokens to transfer
function transferFromParent(
  address _fromContract, 
  uint256 _fromTokenId, 
  address _to, 
  uint256 _amount
)
  external;
```

This function transfers an amount of tokens from an ERC-721 token to an address. This function MUST emit the `TransferFromParent` event upon a successful transfer (in addition to the standard ERC-20 `Transfer` event!). This function MUST throw if the balance of the sender ERC-721 token is less than the `_amount` specified. This function MUST verify that the `msg.sender` owns the sender ERC-721 token, and MUST throw otherwise.

#### `transferFromParentERC223`

```solidity
/// @notice Transfer token from a token to an address, using `ERC-223` semantics
/// @param _fromContract The address of the owning contract
/// @param _fromTokenId The owning token
/// @param _to The address the token is transferred to
/// @param _amount The amount of tokens to transfer
/// @param _data Additional data with no specified format, can be used to specify the sender tokenId
function transferFromParentERC223(
  address _fromContract, 
  uint256 _fromTokenId, 
  address _to, 
  uint256 _amount, 
  bytes _data
)
  external;
```

This function transfers an amount of tokens from an ERC-721 token to an address. This function has identical requirements to `transferFromParent`, except that it additionally MUST invoke `tokenFallback` on the recipient address, if the address is a contract, as specified by `ERC-223`.

#### transferAsChild 1

```solidity
/// @notice Transfer a token from a token to another token
/// @param _fromContract The address of the owning contract
/// @param _fromTokenId The owning token
/// @param _toContract The ERC-721 contract of the receiving token
/// @param _toToken The receiving token
/// @param _amount The amount tokens to transfer
function transferAsChild(
  address _fromContract, 
  uint256 _fromTokenId, 
  address _toContract, 
  uint256 _toTokenId, 
  uint256 _amount
)
  external;
```

This function transfers an amount of tokens from an ERC-721 token to another ERC-721 token. This function MUST emit BOTH the `TransferFromParent` and `TransferToParent` events (in addition to the standard ERC-20 `Transfer` event!). This function MUST throw if the balance of the sender ERC-721 token is less than the `_amount` specified. This function MUST verify that the `msg.sender` 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 `supportsInterface` function. This function SHOULD ensure that the recipient token actually exists, by calling `ownerOf` on the recipient token&apos;s contract, and ensuring it neither throws nor returns the zero address.

### Notes

For backwards-compatibility, implementations MUST emit the standard ERC-20 `Transfer` 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 `Transfer` event SHOULD be the contract address of the token.

Implementations MUST implement all ERC-20 and `ERC-223` functions in addition to the functions specified in this interface.

## Rationale

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.

### Which Kind of Composable To Use?

If you want to transfer regular ERC-721 tokens to non-fungible tokens, then use top-down composables.

If you want to transfer non-fungible tokens to regular ERC-721 tokens then use bottom-up composables.

### Explicit Transfer Parameters

Every ERC-998 transfer function includes explicit parameters to specify the prior owner and the new owner of a token. Explicitly providing **from** and **to** is done intentionally to avoid situations where tokens are transferred in unintended ways.

Here is an example of what could occur if **from** was not explicitly provided in transfer functions:
&gt; An exchange contract is an approved operator in a specific composable contract for user A, user B and user C.
&gt;
&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&apos;t because no explicit **from** was provided to ensure that token 1 came from user A.

## Backwards Compatibility

Composables are designed to work with ERC-721, `ERC-223` and ERC-20 tokens.

Some older ERC-721 contracts do not have a `safeTransferFrom` function. The `getChild` function can still be used to transfer a token to an ERC-721 top-down composable.

If an ERC-20 contract does not have the `ERC-223` function `transfer(address _to, uint _value, bytes _data)` then the `getERC20` function can still be used to transfer ERC-20 tokens to an ERC-20 top-down composable.

## Reference Implementation

An implementation can be found here: `https://github.com/mattlockyer/composables-998`

## Security Considerations

Needs discussion.


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).



</description>
        <pubDate>Sat, 07 Jul 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-998</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-998</guid>
      </item>
    
      <item>
        <title>tokenURI Interoperability</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-1046-erc-20-metadata-extension/13036</comments>
        
        <description>## Abstract

[ERC-721](./eip-721.md) introduced a `tokenURI` function for non-fungible tokens to handle miscellaneous metadata such as:

- thumbnail image
- title
- description
- special asset properties
- etc.

This ERC adds a `tokenURI` function to [ERC-20](./eip-20.md), and extends [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md) to enable interoperability between all three types of token URI.

## Motivation

See the note about the metadata extension in [ERC-721](./eip-721.md#rationale). The same arguments apply to ERC-20.

Being able to use similar mechanisms to extract metadata for ERC-20, ERC-721, ERC-1155, and future standards is useful for determining:

- What type of token a contract is (if any);
- How to display a token to a user, either in an asset listing page or on a dedicated token page; and
- Determining the capabilities of the token

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Interoperability Metadata

The following TypeScript interface is used in later sections:

```typescript
/**
 * Interoperability metadata.
 * This can be extended by other proposals.
 * 
 * All fields MUST be optional.
 * **Not every field has to be a boolean.** Any optional JSON-serializable object can be used by extensions.
 */
interface InteroperabilityMetadata {
    /**
     * This MUST be true if this is ERC-1046 Token Metadata, otherwise, this MUST be omitted.
     * Setting this to true indicates to wallets that the address should be treated as an ERC-20 token.
     **/
    erc1046?: boolean | undefined;

    /**
     * This MUST be true if this is ERC-721 Token Metadata, otherwise, this MUST be omitted.
     * Setting this to true indicates to wallets that the address should be treated as an ERC-721 token.
     **/
    erc721?: boolean | undefined;

    /**
     * This MUST be true if this is ERC-1155 Token Metadata, otherwise, this MUST be omitted.
     * Setting this to true indicates to wallets that the address should be treated as an ERC-1155 token.
     **/
    erc1155?: boolean | undefined;
}
```

### ERC-20 Extension

#### ERC-20 Interface Extension

Compliant contracts MUST implement the following Solidity interface:

```solidity
pragma solidity ^0.8.0;

/// @title  ERC-20 Metadata Extension
interface ERC20TokenMetadata /* is ERC20 */ {
    /// @notice     Gets an ERC-721-like token URI
    /// @dev        The resolved data MUST be in JSON format and support ERC-1046&apos;s ERC-20 Token Metadata Schema
    function tokenURI() external view returns (string);
}
```

#### ERC-20 Token Metadata Schema

The resolved JSON of the `tokenURI` described in the ERC-20 Interface Extension section MUST conform to the following TypeScript interface:

```typescript
/**
 * Asset Metadata
 */
interface ERC20TokenMetadata {
    /**
     * Interoperability, to differentiate between different types of tokens and their corresponding URIs.
     **/
    interop: InteroperabilityMetadata;
    
    /**
     * The name of the ERC-20 token. 
     * If the `name()` function is present in the ERC-20 token and returns a nonempty string, these MUST be the same value.
     */
    name?: string;
    
    /**
     * The symbol of the ERC-20 token. 
     * If the `symbol()` function is present in the ERC-20 token and returns a nonempty string, these MUST be the same value.
     */
    symbol?: string;
    
    /**
     * The decimals of the ERC-20 token. 
     * If the `decimals()` function is present in the ERC-20 token, these MUST be the same value.
     * Defaults to 18 if neither this parameter nor the ERC-20 `decimals()` function are present.
     */
    decimals?: number;
    
    /**
     * Provides a short one-paragraph description of the ERC-20 token, without any markup or newlines.
     */
    description?: string;
    
    /**
     * A URI pointing to a resource with mime type `image/*` that represents this token.
     * If the image is a bitmap, it SHOULD have a width between 320 and 1080 pixels
     * The image SHOULD have an aspect ratio between 1.91:1 and 4:5 inclusive.
     */
    image?: string;
    
    /**
     * One or more URIs each pointing to a resource with mime type `image/*` that represents this token.
     * If an image is a bitmap, it SHOULD have a width between 320 and 1080 pixels
     * Images SHOULD have an aspect ratio between 1.91:1 and 4:5 inclusive.
     */
    images?: string[];
    
    /**
     * One or more URIs each pointing to a resource with mime type `image/*` that represent an icon for this token.
     * 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
     * Images MUST have an aspect ratio of 1:1, and use a transparent background
     */
    icons?: string[];
}
```

### ERC-721 Extension

#### Extension to the ERC-721 Metadata Schema

Contracts that implement ERC-721 and use its token metadata URI SHOULD to use the following TypeScript extension to the metadata URI:

```typescript
interface ERC721TokenMetadataInterop extends ERC721TokenMetadata {
    /**
     * Interoperability, to avoid confusion between different token URIs
     **/
    interop: InteroperabilityMetadata;
}
```

### ERC-1155 Extension

#### ERC-1155 Interface Extension

[ERC-1155](./eip-1155.md)-compliant contracts using the metadata extension SHOULD implement the following Solidity interface:

```solidity
pragma solidity ^0.8.0;

/// @title  ERC-1155 Metadata URI Interoperability Extension
interface ERC1155TokenMetadataInterop /* is ERC1155 */ {
    /// @notice         Gets an ERC-1046-compliant ERC-1155 token URI
    /// @param  tokenId The token ID to get the URI of
    /// @dev            The resolved data MUST be in JSON format and support ERC-1046&apos;s Extension to the ERC-1155 Token Metadata Schema
    ///                 This MUST be the same URI as the `uri(tokenId)` function, if present.
    function tokenURI(uint256 tokenId) external view returns (string);
}
```

#### Extension to the ERC-1155 Metadata Schema

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:

```typescript
interface ERC1155TokenMetadataInterop extends ERC1155TokenMetadata {
    /**
     * Interoperability, to avoid confusion between different token URIs
     **/
    interop: InteroperabilityMetadata;
}
```

### Miscellaneous Recommendations

To save gas, it is RECOMMENDED for compliant contracts not to implement the `name()`, `symbol()`, or `decimals()` functions, and instead to only include them in the metadata URI. Additionally, for ERC-20 tokens, if the decimals is `18`, then it is NOT RECOMMENDED to include the `decimals` field in the metadata.

## Rationale

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.

Additionally, the recommendations not to use ERC-20&apos;s `name`, `symbol`, and `decimals` functions save gas.

Built-in interoperability is useful as otherwise it might not be easy to differentiate the type of the token. Interoperability could be done using [ERC-165](./eip-165.md), 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.

## Backwards Compatibility

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.

## Security Considerations

### Server-Side Request Forgery (SSRF)

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 13 Apr 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1046</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1046</guid>
      </item>
    
      <item>
        <title>Ethereum Lightweight Identity</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1056</comments>
        
        <description>## Simple Summary

A registry for key and attribute management of lightweight blockchain identities.

## Abstract

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 `delegates` and `attributes` associated with it. Identity creation is as simple as creating a regular key pair ethereum account, which means that it&apos;s free (no gas costs) and all ethereum accounts are valid identities. Furthermore this ERC is fully [DID compliant](https://w3c-ccg.github.io/did-spec/).

## Motivation

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 [ERC-725](./eip-725.md) 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.

## Definitions

* `Identifier`: a piece of data that uniquely identifies the identity, an ethereum address

* `delegate`: an address that is delegated for a specific time to perform some sort of function on behalf of an identity

* `delegateType`: the type of a delegate, is determined by a protocol or application higher up
  Examples:
  
  * `did-jwt`
  * `raiden`

* `attribute`: a piece of data associated with the identity

## Specification

This ERC specifies a contract called `EthereumDIDRegistry` that is deployed once and can then be commonly used by everyone.

### Identity ownership

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.

#### identityOwner

Returns the owner of the given identity.

```js
function identityOwner(address identity) public view returns(address);
```

#### changeOwner

Sets the owner of the given identity to another ethereum account.

```js
function changeOwner(address identity, address newOwner) public;
```

#### changeOwnerSigned

Same as above but with raw signature.


```js
function changeOwnerSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, address newOwner) public;
```

### Delegate management

Delegates can be used both on- and off-chain. They all have a `delegateType` which can be used to specify the purpose of the delegate.

#### validDelegate

Returns true if the given `delegate` is a delegate with type `delegateType` of `identity`.

```js
function validDelegate(address identity, bytes32 delegateType, address delegate) public view returns(bool);
```

#### addDelegate

Adds a new delegate with the given type. `validity` indicates the number of seconds that the delegate will be valid for, after which it will no longer be a delegate of `identity`.

```js
function addDelegate(address identity, bytes32 delegateType, address delegate, uint validity) public;
```


#### addDelegateSigned

Same as above but with raw signature.


```js
function addDelegateSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 delegateType, address delegate, uint validity) public;
```


#### revokeDelegate

Revokes the given `delegate` for the given `identity`.


```js
function revokeDelegate(address identity, bytes32 delegateType, address delegate) public;
```


#### revokeDelegateSigned

Same as above but with raw signature.


```js
function revokeDelegateSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 delegateType, address delegate) public;
```


### Attribute management

Attributes contain simple data about the identity. They can be managed only by the owner of the identity.


#### setAttribute

Sets an attribute with the given `name` and `value`, valid for `validity` seconds.


```js
function setAttribute(address identity, bytes32 name, bytes value, uint validity) public;
```


#### setAttributeSigned

Same as above but with raw signature.


```js
function setAttributeSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 name, bytes value, uint validity) public;
```


#### revokeAttribute

Revokes an attribute.


```js
function revokeAttribute(address identity, bytes32 name, bytes value) public;
```


#### revokeAttributeSigned

Same as above but with raw signature.


```js
function revokeAttributeSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 name, bytes value) public;
```


### Events

#### DIDOwnerChanged

MUST be triggered when `changeOwner` or `changeOwnerSigned` was successfully called.


```js
event DIDOwnerChanged(
  address indexed identity,
  address owner,
  uint previousChange
);
```


#### DIDDelegateChanged

MUST be triggered when a change to a delegate was successfully made.


```js
event DIDDelegateChanged(
  address indexed identity,
  bytes32 delegateType,
  address delegate,
  uint validTo,
  uint previousChange
);
```


#### DIDAttributeChanged

MUST be triggered when a change to an attribute was successfully made.


```js
event DIDAttributeChanged(
  address indexed identity,
  bytes32 name,
  bytes value,
  uint validTo,
  uint previousChange
);
```


### Efficient lookup of events through linked identity events

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 `changed` mapping.



1. Lookup `previousChange` block for identity

2. Lookup all events for given identity address using web3, but only for the `previousChange` block

3. Do something with the event

4. Find `previousChange` from the event  and repeat



Example code:


```js
const history = []
previousChange = await didReg.changed(identity)
while (previousChange) {
  const filter = await didReg.allEvents({topics: [identity], fromBlock: previousChange, toBlock: previousChange})
  const events = await getLogs(filter)
  previousChange = undefined
  for (let event of events) {
    history.unshift(event)
    previousChange = event.args.previousChange
  }
}     
```


### Building a DID document for an identity

The primary owner key should be looked up using `identityOwner(identity)`.  This should be the first of the publicKeys listed. Iterate through the `DIDDelegateChanged` 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 `DIDAttributeChanged` events for service entries, encryption public keys and other public names. The attribute names are still to be determined.


## Rationale

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 `msg.sender` as the verified send of the transaction.


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.


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.


## Backwards Compatibility

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 `delegate` and `attribute` functionality by simply using the `ethr-did` referenced below. As the **DID Auth** standard solidifies it also means that all of these wallets will be compatible with the [DID decentralized login system](https://github.com/decentralized-identity).


## Implementation

[ethr-did-registry](https://github.com/uport-project/ethr-did-registry/blob/develop/contracts/EthereumDIDRegistry.sol) (`EthereumDIDRegistry` contract implementation)

[ethr-did-resolver](https://github.com/uport-project/ethr-did-resolver) (DID compatible resolver)

[ethr-did](https://github.com/uport-project/ethr-did) (javascript library for using the identity)


### Deployment

The address for the `EthereumDIDRegistry` is `0xdca7ef03e98e0dc2b855be647c39abe984fcf21b` on Mainnet, Ropsten, Rinkeby and Kovan.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Thu, 03 May 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1056</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1056</guid>
      </item>
    
      <item>
        <title>Formalize IPFS hash into ENS(Ethereum Name Service) resolver</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-1062-formalize-ipfs-hash-into-ens-ethereum-name-service-resolver/281</comments>
        
        <description>## Simple Summary
To specify the mapping protocol between resources stored on IPFS and ENS(Ethereum Naming Service).

## Abstract
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.
  
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.

## Motivation
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 :
- Address large amounts of data, and has unique cryptographic hash for every record.
- 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.
- IPFS stores files in high efficient way via tracking version history for every file, and removing the duplications across the network.
  
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.


## Specification
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.
  
To solve these requirements, we can use binary buffer bridging that gap.  
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.


## Rationale
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 `setMultihash` method below :
  
```solidity
function setMultihash(bytes32 node, bytes hash) public only_owner(node);
```
  
Whenever users need to visit the ENS content, we call the `multihash` method to get the IPFS hex data, transfer to the Base58 format, and return the IPFS resources to use.
  
```solidity
function multihash(bytes32 node) public view returns (bytes);
```

## Test Cases

To implement the way to transfer from base58 to hex format and the reverse one, using the ‘multihashes’ library to deal with the problem.  
The library link : [https://www.npmjs.com/package/multihashes](https://www.npmjs.com/package/multihashes)  
To implement the method transfer from IPFS(Base58) to hex format :
  
```javascript
import multihash from &apos;multihashes&apos;

export const toHex = function(ipfsHash) {
  let buf = multihash.fromB58String(ipfsHash);
  return &apos;0x&apos; + multihash.toHexString(buf);
}
```
  
To implement the method transfer from hex format to IPFS(Base58) :
  
```javascript
import multihash from &apos;multihashes&apos;

export const toBase58 = function(contentHash) {
  let hex = contentHash.substring(2)
  let buf = multihash.fromHexString(hex);
  return multihash.toB58String(buf);
}
```

## Implementation
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.

The workable implementation repository : [https://github.com/PortalNetwork/portal-network-browser-extension](https://github.com/PortalNetwork/portal-network-browser-extension)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).


</description>
        <pubDate>Wed, 02 May 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1062</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1062</guid>
      </item>
    
      <item>
        <title>Status Codes</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-1066-ethereum-status-codes-esc/</comments>
        
        <description>## Simple Summary

Broadly applicable status codes for smart contracts.

## Abstract

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.

The current state of the art is to either `revert` on anything other than a clear success (ie: require human intervention), or return a low-context `true` or `false`. Status codes are similar-but-orthogonal to `revert`ing with a reason, but aimed at automation, debugging, and end-user feedback (including translation). _They are fully compatible with both `revert` and `revert`-with-reason._

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.

## Motivation

### Semantic Density

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.

Status codes convey a much richer set of information [than Booleans](https://existentialtype.wordpress.com/2011/03/15/boolean-blindness/), and are able to be reacted to autonomously unlike arbitrary strings.

### User Experience (UX)

_End users get little to no feedback, and there is no translation layer._

Since ERC1066 status codes are finite and known in advance, we can leverage [ERC-1444](./eip-1444.md) to provide global, human-readable sets of status messages. These may also be translated into any language, differing levels of technical detail, added as `revert` messages, natspecs, and so on.

Status codes convey a much richer set of information than Booleans, and are able to be reacted to autonomously unlike arbitrary strings.

### Developer Experience (DX)

_Developers currently have very little context exposed by their smart contracts._

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, `event`s, and `revert`s.

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.

We also see a desire for this [in transactions](./eip-658.md), and there&apos;s no reason that these status codes couldn&apos;t be used by the EVM itself.

### Smart Contract Autonomy

_Smart contracts don’t know much about the result of a request beyond pass/fail; they can be smarter with more context._

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.

While clearly related, status codes are complementary to `revert`-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.

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.

## Specification

### Format

Codes are returned either on their own, or as the first value of a multiple return.

```solidity
// Status only

function isInt(uint num) public pure returns (byte status) {
    return hex&quot;01&quot;;
}

// Status and value

uint8 private counter;

function safeIncrement(uint8 interval) public returns (byte status, uint8 newCounter) {
    uint8 updated = counter + interval;

    if (updated &gt;= counter) {
        counter = updated;
        return (hex&quot;01&quot;, updated);
    } else {
        return (hex&quot;00&quot;, counter);
    }
}
```

### Code Table

Codes break nicely into a 16x16 matrix, represented as a 2-digit hex number. The high nibble represents the code&apos;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.

**NB: Unspecified codes are _not_ free for arbitrary use, but rather open for further specification.**

#### `0x0*` Generic

General codes. These double as bare &quot;reasons&quot;, since `0x01 == 1`.

| Code   | Description                             |
|--------|-----------------------------------------|
| `0x00` | Failure                                 |
| `0x01` | Success                                 |
| `0x02` | Awaiting Others                         |
| `0x03` | Accepted                                |
| `0x04` | Lower Limit or Insufficient             |
| `0x05` | Receiver Action Requested               |
| `0x06` | Upper Limit                             |
| `0x07` | [reserved]                              |
| `0x08` | Duplicate, Unnecessary, or Inapplicable |
| `0x09` | [reserved]                              |
| `0x0A` | [reserved]                              |
| `0x0B` | [reserved]                              |
| `0x0C` | [reserved]                              |
| `0x0D` | [reserved]                              |
| `0x0E` | [reserved]                              |
| `0x0F` | Informational or Metadata               |

#### `0x1*` Permission &amp; Control

Also used for common state machine actions (ex. &quot;stoplight&quot; actions).

| Code   | Description                                       |
|--------|---------------------------------------------------|
| `0x10` | Disallowed or Stop                                |
| `0x11` | Allowed or Go                                     |
| `0x12` | Awaiting Other&apos;s Permission                       |
| `0x13` | Permission Requested                              |
| `0x14` | Too Open / Insecure                               |
| `0x15` | Needs Your Permission or Request for Continuation |
| `0x16` | Revoked or Banned                                 |
| `0x17` | [reserved]                                        |
| `0x18` | Not Applicable to Current State                 |
| `0x19` | [reserved]                                        |
| `0x1A` | [reserved]                                        |
| `0x1B` | [reserved]                                        |
| `0x1C` | [reserved]                                        |
| `0x1D` | [reserved]                                        |
| `0x1E` | [reserved]                                        |
| `0x1F` | Permission Details or Control Conditions          |

#### `0x2*` Find, Inequalities &amp; Range

This range is broadly intended for finding and matching. Data lookups and order matching are two common use cases.

| Code   | Description                         |
|--------|-------------------------------------|
| `0x20` | Not Found, Unequal, or Out of Range |
| `0x21` | Found, Equal or In Range            |
| `0x22` | Awaiting Match                      |
| `0x23` | Match Request Sent                  |
| `0x24` | Below Range or Underflow            |
| `0x25` | Request for Match                   |
| `0x26` | Above Range or Overflow             |
| `0x27` | [reserved]                          |
| `0x28` | Duplicate, Conflict, or Collision   |
| `0x29` | [reserved]                          |
| `0x2A` | [reserved]                          |
| `0x2B` | [reserved]                          |
| `0x2C` | [reserved]                          |
| `0x2D` | [reserved]                          |
| `0x2E` | [reserved]                          |
| `0x2F` | Matching Meta or Info               |

#### `0x3*` Negotiation &amp; Governance

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).

| Code   | Description                             |
|--------|-----------------------------------------|
| `0x30` | Sender Disagrees or Nay                 |
| `0x31` | Sender Agrees or Yea                    |
| `0x32` | Awaiting Ratification                   |
| `0x33` | Offer Sent or Voted                     |
| `0x34` | Quorum Not Reached                      |
| `0x35` | Receiver&apos;s Ratification Requested       |
| `0x36` | Offer or Vote Limit Reached             |
| `0x37` | [reserved]                              |
| `0x38` | Already Voted                           |
| `0x39` | [reserved]                              |
| `0x3A` | [reserved]                              |
| `0x3B` | [reserved]                              |
| `0x3C` | [reserved]                              |
| `0x3D` | [reserved]                              |
| `0x3E` | [reserved]                              |
| `0x3F` | Negotiation Rules or Participation Info |

#### `0x4*` Availability &amp; Time

Service or action availability.

| Code   | Description                                          |
|--------|------------------------------------------------------|
| `0x40` | Unavailable                                          |
| `0x41` | Available                                            |
| `0x42` | Paused                                               |
| `0x43` | Queued                                               |
| `0x44` | Not Available Yet                                    |
| `0x45` | Awaiting Your Availability                           |
| `0x46` | Expired                                              |
| `0x47` | [reserved]                                           |
| `0x48` | Already Done                                         |
| `0x49` | [reserved]                                           |
| `0x4A` | [reserved]                                           |
| `0x4B` | [reserved]                                           |
| `0x4C` | [reserved]                                           |
| `0x4D` | [reserved]                                           |
| `0x4E` | [reserved]                                           |
| `0x4F` | Availability Rules or Info (ex. time since or until) |

#### `0x5*` Tokens, Funds &amp; Finance

Special token and financial concepts. Many related concepts are included in other ranges.

| Code   | Description                     |
|--------|---------------------------------|
| `0x50` | Transfer Failed                 |
| `0x51` | Transfer Successful             |
| `0x52` | Awaiting Payment From Others    |
| `0x53` | Hold or Escrow                  |
| `0x54` | Insufficient Funds              |
| `0x55` | Funds Requested                 |
| `0x56` | Transfer Volume Exceeded        |
| `0x57` | [reserved]                      |
| `0x58` | Funds Not Required              |
| `0x59` | [reserved]                      |
| `0x5A` | [reserved]                      |
| `0x5B` | [reserved]                      |
| `0x5C` | [reserved]                      |
| `0x5D` | [reserved]                      |
| `0x5E` | [reserved]                      |
| `0x5F` | Token or Financial Information |

#### `0x6*` TBD

Currently unspecified. (Full range reserved)

#### `0x7*` TBD

Currently unspecified. (Full range reserved)

#### `0x8*` TBD

Currently unspecified. (Full range reserved)

#### `0x9*` TBD

Currently unspecified. (Full range reserved)

#### `0xA*` Application-Specific Codes

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.

| Code   | Description                            |
|--------|----------------------------------------|
| `0xA0` | App-Specific Failure                   |
| `0xA1` | App-Specific Success                   |
| `0xA2` | App-Specific Awaiting Others           |
| `0xA3` | App-Specific Acceptance                |
| `0xA4` | App-Specific Below Condition           |
| `0xA5` | App-Specific Receiver Action Requested |
| `0xA6` | App-Specific Expiry or Limit           |
| `0xA7` | [reserved]                             |
| `0xA8` | App-Specific Inapplicable Condition    |
| `0xA9` | [reserved]                             |
| `0xAA` | [reserved]                             |
| `0xAB` | [reserved]                             |
| `0xAC` | [reserved]                             |
| `0xAD` | [reserved]                             |
| `0xAE` | [reserved]                             |
| `0xAF` | App-Specific Meta or Info              |

#### `0xB*` TBD

Currently unspecified. (Full range reserved)

#### `0xC*` TBD

Currently unspecified. (Full range reserved)

#### `0xD*` TBD

Currently unspecified. (Full range reserved)

#### `0xE*` Encryption, Identity &amp; Proofs

Actions around signatures, cryptography, signing, and application-level authentication.

The meta code `0xEF` is often used to signal a payload describing the algorithm or process used.

| Code   | Description                         |
|--------|-------------------------------------|
| `0xE0` | Decrypt Failure                     |
| `0xE1` | Decrypt Success                     |
| `0xE2` | Awaiting Other Signatures or Keys   |
| `0xE3` | Signed                              |
| `0xE4` | Unsigned or Untrusted               |
| `0xE5` | Signature Required                  |
| `0xE6` | Known to be Compromised             |
| `0xE7` | [reserved]                          |
| `0xE8` | Already Signed or Not Encrypted     |
| `0xE9` | [reserved]                          |
| `0xEA` | [reserved]                          |
| `0xEB` | [reserved]                          |
| `0xEC` | [reserved]                          |
| `0xED` | [reserved]                          |
| `0xEE` | [reserved]                          |
| `0xEF` | Cryptography, ID, or Proof Metadata |

#### `0xF*` Off-Chain

For off-chain actions. Much like th `0x0*: Generic` range, `0xF*` is very general, and does little to modify the reason.

Among other things, the meta code `0xFF` may be used to describe what the off-chain process is.

| Code   | Description                       |
|--------|-----------------------------------|
| `0xF0` | Off-Chain Failure                 |
| `0xF1` | Off-Chain Success                 |
| `0xF2` | Awaiting Off-Chain Process        |
| `0xF3` | Off-Chain Process Started         |
| `0xF4` | Off-Chain Service Unreachable     |
| `0xF5` | Off-Chain Action Required         |
| `0xF6` | Off-Chain Expiry or Limit Reached |
| `0xF7` | [reserved]                        |
| `0xF8` | Duplicate Off-Chain Request       |
| `0xF9` | [reserved]                        |
| `0xFA` | [reserved]                        |
| `0xFB` | [reserved]                        |
| `0xFC` | [reserved]                        |
| `0xFD` | [reserved]                        |
| `0xFE` | [reserved]                        |
| `0xFF` | Off-Chain Info or Meta            |

### As a Grid

|        | `0x0*` General                                 | `0x1*` Permission &amp; Control                              | `0x2*` Find, Inequalities &amp; Range          | `0x3*` Negotiation &amp; Governance                | `0x4*` Availability &amp; Time                                  | `0x5*` Tokens, Funds &amp; Finance         | `0x6*` TBD        | `0x7*` TBD        | `0x8*` TBD        | `0x9*` TBD        | `0xA*` Application-Specific Codes             | `0xB*` TBD        | `0xC*` TBD        | `0xD*` TBD        | `0xE*` Encryption, Identity &amp; Proofs       | `0xF*` Off-Chain                         |
|--------|------------------------------------------------|----------------------------------------------------------|--------------------------------------------|------------------------------------------------|-------------------------------------------------------------|----------------------------------------|-------------------|-------------------|-------------------|-------------------|-----------------------------------------------|-------------------|-------------------|-------------------|--------------------------------------------|------------------------------------------|
| `0x*0` | `0x00` Failure                                 | `0x10` Disallowed or Stop                                | `0x20` Not Found, Unequal, or Out of Range | `0x30` Sender Disagrees or Nay                 | `0x40` Unavailable                                          | `0x50` Transfer Failed                 | `0x60` [reserved] | `0x70` [reserved] | `0x80` [reserved] | `0x90` [reserved] | `0xA0` App-Specific Failure                   | `0xB0` [reserved] | `0xC0` [reserved] | `0xD0` [reserved] | `0xE0` Decrypt Failure                     | `0xF0` Off-Chain Failure                 |
| `0x*1` | `0x01` Success                                 | `0x11` Allowed or Go                                     | `0x21` Found, Equal or In Range            | `0x31` Sender Agrees or Yea                    | `0x41` Available                                            | `0x51` Transfer Successful             | `0x61` [reserved] | `0x71` [reserved] | `0x81` [reserved] | `0x91` [reserved] | `0xA1` App-Specific Success                   | `0xB1` [reserved] | `0xC1` [reserved] | `0xD1` [reserved] | `0xE1` Decrypt Success                     | `0xF1` Off-Chain Success                 |
| `0x*2` | `0x02` Awaiting Others                         | `0x12` Awaiting Other&apos;s Permission                       | `0x22` Awaiting Match                      | `0x32` Awaiting Ratification                   | `0x42` Paused                                               | `0x52` Awaiting Payment From Others    | `0x62` [reserved] | `0x72` [reserved] | `0x82` [reserved] | `0x92` [reserved] | `0xA2` App-Specific Awaiting Others           | `0xB2` [reserved] | `0xC2` [reserved] | `0xD2` [reserved] | `0xE2` Awaiting Other Signatures or Keys   | `0xF2` Awaiting Off-Chain Process        |
| `0x*3` | `0x03` Accepted                                | `0x13` Permission Requested                              | `0x23` Match Request Sent                  | `0x33` Offer Sent or Voted                     | `0x43` Queued                                               | `0x53` Hold or Escrow                  | `0x63` [reserved] | `0x73` [reserved] | `0x83` [reserved] | `0x93` [reserved] | `0xA3` App-Specific Acceptance                | `0xB3` [reserved] | `0xC3` [reserved] | `0xD3` [reserved] | `0xE3` Signed                              | `0xF3` Off-Chain Process Started         |
| `0x*4` | `0x04` Lower Limit or Insufficient             | `0x14` Too Open / Insecure                               | `0x24` Below Range or Underflow            | `0x34` Quorum Not Reached                      | `0x44` Not Available Yet                                    | `0x54` Insufficient Funds              | `0x64` [reserved] | `0x74` [reserved] | `0x84` [reserved] | `0x94` [reserved] | `0xA4` App-Specific Below Condition           | `0xB4` [reserved] | `0xC4` [reserved] | `0xD4` [reserved] | `0xE4` Unsigned or Untrusted               | `0xF4` Off-Chain Service Unreachable     |
| `0x*5` | `0x05` Receiver Action Required                | `0x15` Needs Your Permission or Request for Continuation | `0x25` Request for Match                   | `0x35` Receiver&apos;s Ratification Requested       | `0x45` Awaiting Your Availability                           | `0x55` Funds Requested                 | `0x65` [reserved] | `0x75` [reserved] | `0x85` [reserved] | `0x95` [reserved] | `0xA5` App-Specific Receiver Action Requested | `0xB5` [reserved] | `0xC5` [reserved] | `0xD5` [reserved] | `0xE5` Signature Required                  | `0xF5` Off-Chain Action Required         |
| `0x*6` | `0x06` Upper Limit                             | `0x16` Revoked or Banned                                 | `0x26` Above Range or Overflow             | `0x36` Offer or Vote Limit Reached             | `0x46` Expired                                              | `0x56` Transfer Volume Exceeded        | `0x66` [reserved] | `0x76` [reserved] | `0x86` [reserved] | `0x96` [reserved] | `0xA6` App-Specific Expiry or Limit           | `0xB6` [reserved] | `0xC6` [reserved] | `0xD6` [reserved] | `0xE6` Known to be Compromised             | `0xF6` Off-Chain Expiry or Limit Reached |
| `0x*7` | `0x07` [reserved]                              | `0x17` [reserved]                                        | `0x27` [reserved]                          | `0x37` [reserved]                              | `0x47` [reserved]                                           | `0x57` [reserved]                      | `0x67` [reserved] | `0x77` [reserved] | `0x87` [reserved] | `0x97` [reserved] | `0xA7` [reserved]                             | `0xB7` [reserved] | `0xC7` [reserved] | `0xD7` [reserved] | `0xE7` [reserved]                          | `0xF7` [reserved]                        |
| `0x*8` | `0x08` Duplicate, Unnecessary, or Inapplicable | `0x18` Not Applicable to Current State                 | `0x28` Duplicate, Conflict, or Collision   | `0x38` Already Voted                           | `0x48` Already Done                                         | `0x58` Funds Not Required              | `0x68` [reserved] | `0x78` [reserved] | `0x88` [reserved] | `0x98` [reserved] | `0xA8` App-Specific Inapplicable Condition    | `0xB8` [reserved] | `0xC8` [reserved] | `0xD8` [reserved] | `0xE8` Already Signed or Not Encrypted     | `0xF8` Duplicate Off-Chain Request       |
| `0x*9` | `0x09` [reserved]                              | `0x19` [reserved]                                        | `0x29` [reserved]                          | `0x39` [reserved]                              | `0x49` [reserved]                                           | `0x59` [reserved]                      | `0x69` [reserved] | `0x79` [reserved] | `0x89` [reserved] | `0x99` [reserved] | `0xA9` [reserved]                             | `0xB9` [reserved] | `0xC9` [reserved] | `0xD9` [reserved] | `0xE9` [reserved]                          | `0xF9` [reserved]                        |
| `0x*A` | `0x0A` [reserved]                              | `0x1A` [reserved]                                        | `0x2A` [reserved]                          | `0x3A` [reserved]                              | `0x4A` [reserved]                                           | `0x5A` [reserved]                      | `0x6A` [reserved] | `0x7A` [reserved] | `0x8A` [reserved] | `0x9A` [reserved] | `0xAA` [reserved]                             | `0xBA` [reserved] | `0xCA` [reserved] | `0xDA` [reserved] | `0xEA` [reserved]                          | `0xFA` [reserved]                        |
| `0x*B` | `0x0B` [reserved]                              | `0x1B` [reserved]                                        | `0x2B` [reserved]                          | `0x3B` [reserved]                              | `0x4B` [reserved]                                           | `0x5B` [reserved]                      | `0x6B` [reserved] | `0x7B` [reserved] | `0x8B` [reserved] | `0x9B` [reserved] | `0xAB` [reserved]                             | `0xBB` [reserved] | `0xCB` [reserved] | `0xDB` [reserved] | `0xEB` [reserved]                          | `0xFB` [reserved]                        |
| `0x*C` | `0x0C` [reserved]                              | `0x1C` [reserved]                                        | `0x2C` [reserved]                          | `0x3C` [reserved]                              | `0x4C` [reserved]                                           | `0x5C` [reserved]                      | `0x6C` [reserved] | `0x7C` [reserved] | `0x8C` [reserved] | `0x9C` [reserved] | `0xAC` [reserved]                             | `0xBC` [reserved] | `0xCC` [reserved] | `0xDC` [reserved] | `0xEC` [reserved]                          | `0xFC` [reserved]                        |
| `0x*D` | `0x0D` [reserved]                              | `0x1D` [reserved]                                        | `0x2D` [reserved]                          | `0x3D` [reserved]                              | `0x4D` [reserved]                                           | `0x5D` [reserved]                      | `0x6D` [reserved] | `0x7D` [reserved] | `0x8D` [reserved] | `0x9D` [reserved] | `0xAD` [reserved]                             | `0xBD` [reserved] | `0xCD` [reserved] | `0xDD` [reserved] | `0xED` [reserved]                          | `0xFD` [reserved]                        |
| `0x*E` | `0x0E` [reserved]                              | `0x1E` [reserved]                                        | `0x2E` [reserved]                          | `0x3E` [reserved]                              | `0x4E` [reserved]                                           | `0x5E` [reserved]                      | `0x6E` [reserved] | `0x7E` [reserved] | `0x8E` [reserved] | `0x9E` [reserved] | `0xAE` [reserved]                             | `0xBE` [reserved] | `0xCE` [reserved] | `0xDE` [reserved] | `0xEE` [reserved]                          | `0xFE` [reserved]                        |
| `0x*F` | `0x0F` Informational or Metadata               | `0x1F` Permission Details or Control Conditions          | `0x2F` Matching Meta or Info               | `0x3F` Negotiation Rules or Participation Info | `0x4F` Availability Rules or Info (ex. time since or until) | `0x5F` Token or Financial Information  | `0x6F` [reserved] | `0x7F` [reserved] | `0x8F` [reserved] | `0x9F` [reserved] | `0xAF` App-Specific Meta or Info              | `0xBF` [reserved] | `0xCF` [reserved] | `0xDF` [reserved] | `0xEF` Cryptography, ID, or Proof Metadata | `0xFF` Off-Chain Info or Meta            |

### Example Function Change

```solidity
uint256 private startTime;
mapping(address =&gt; uint) private counters;

// Before
function increase() public returns (bool _available) {
    if (now &lt; startTime &amp;&amp; counters[msg.sender] == 0) {
        return false;
    };

    counters[msg.sender] += 1;
    return true;
}

// After
function increase() public returns (byte _status) {
    if (now &lt; start) { return hex&quot;44&quot;; } // Not yet available
    if (counters[msg.sender] == 0) { return hex&quot;10&quot;; } // Not authorized

    counters[msg.sender] += 1;
    return hex&quot;01&quot;; // Success
}
```

### Example Sequence Diagrams

```
0x03 = Waiting
0x31 = Other Party (ie: not you) Agreed
0x41 = Available
0x44 = Not Yet Available


                          Exchange


AwesomeCoin                 DEX                     TraderBot
     +                       +                          +
     |                       |       buy(AwesomeCoin)   |
     |                       | &lt;------------------------+
     |         buy()         |                          |
     | &lt;---------------------+                          |
     |                       |                          |
     |     Status [0x44]     |                          |
     +---------------------&gt; |       Status [0x44]      |
     |                       +------------------------&gt; |
     |                       |                          |
     |                       |        isDoneYet()       |
     |                       | &lt;------------------------+
     |                       |                          |
     |                       |       Status [0x44]      |
     |                       +------------------------&gt; |
     |                       |                          |
     |                       |                          |
     |     Status [0x41]     |                          |
     +---------------------&gt; |                          |
     |                       |                          |
     |       buy()           |                          |
     | &lt;---------------------+                          |
     |                       |                          |
     |                       |                          |
     |     Status [0x31]     |                          |
     +---------------------&gt; |      Status [0x31]       |
     |                       +------------------------&gt; |
     |                       |                          |
     |                       |                          |
     |                       |                          |
     |                       |                          |
     +                       +                          +
```



```
0x01 = Generic Success
0x10 = Disallowed
0x11 = Allowed

                                              Token Validation


           Buyer                  RegulatedToken           TokenValidator               IDChecker          SpendLimiter
             +                          +                         +                         +                   +
             |        buy()             |                         |                         |                   |
             +------------------------&gt; |          check()        |                         |                   |
             |                          +-----------------------&gt; |          check()        |                   |
             |                          |                         +-----------------------&gt; |                   |
             |                          |                         |                         |                   |
             |                          |                         |         Status [0x10]   |                   |
             |                          |       Status [0x10]     | &lt;-----------------------+                   |
             |        revert()          | &lt;-----------------------+                         |                   |
             | &lt;------------------------+                         |                         |                   |
             |                          |                         |                         |                   |
+---------------------------+           |                         |                         |                   |
|                           |           |                         |                         |                   |
| Updates ID with provider  |           |                         |                         |                   |
|                           |           |                         |                         |                   |
+---------------------------+           |                         |                         |                   |
             |                          |                         |                         |                   |
             |         buy()            |                         |                         |                   |
             +------------------------&gt; |        check()          |                         |                   |
             |                          +-----------------------&gt; |         check()         |                   |
             |                          |                         +-----------------------&gt; |                   |
             |                          |                         |                         |                   |
             |                          |                         |       Status [0x11]     |                   |
             |                          |                         | &lt;-----------------------+                   |
             |                          |                         |                         |                   |
             |                          |                         |                         |   check()         |
             |                          |                         +-------------------------------------------&gt; |
             |                          |                         |                         |                   |
             |                          |                         |                         |  Status [0x11]    |
             |                          |       Status [0x11]     | &lt;-------------------------------------------+
             |        Status [0x01]     | &lt;-----------------------+                         |                   |
             | &lt;------------------------+                         |                         |                   |
             |                          |                         |                         |                   |
             |                          |                         |                         |                   |
             |                          |                         |                         |                   |
             +                          +                         +                         +                   +
```

## Rationale

### Encoding

Status codes are encoded as a `byte`. Hex values break nicely into high and low nibbles: `category` and `reason`. For instance, `0x01` stands for general success (ie: `true`) and `0x00` for general failure (ie: `false`).

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.

`bytes1` is very lightweight, portable, easily interoperable with `uint8`, cast from `enum`s, and so on.

#### Alternatives

Alternate schemes include `bytes32` and `uint8`. While these work reasonably well, they have drawbacks.

`uint8` feels even more similar to HTTP status codes, and enums don&apos;t require as much casting. However does not break as evenly as a square table (256 doesn&apos;t look as nice in base 10).

Packing multiple codes into a single `bytes32` is nice in theory, but poses additional challenges. Unused space may be interpreted as `0x00 Failure`, 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 `0x00` and `0x01` together), or greater resources allocated to interpreting 256&lt;sup&gt;4&lt;/sup&gt; (4.3 billion) permutations.

### Multiple Returns

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.

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.

### Human Readable

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. `0x10` and `0x11` belong to the same category, and `0x04` shares a reason with `0x24`

While this repository includes helper enums, we have found working directly in the hex values to be quite natural. Status code `0x10` is just as comfortable as HTTP 401, for example.

#### Localizations

One commonly requested application of this spec is human-readable translations of codes. This has been moved to its own proposal: [ERC-1444](./eip-1444.md), primarily due to a desire to keep both specs focused.

### Extensibility

The `0xA` category is reserved for application-specific statuses. In the case that 256 codes become insufficient, `bytes1` may be embedded in larger byte arrays.

### EVM Codes

The EVM also returns a status code in transactions; specifically `0x00` and `0x01`. This proposal both matches the meanings of those two codes, and could later be used at the EVM level.

### Empty Space

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.

### Beyond Errors

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.

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.

### Fully `revert`able

_This spec is fully compatible with `revert`-with-reason and does not intend to supplant it in any way._ Both by reverting with a common code, the developer can determine what went wrong from a set of known error states.

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.

### Nibble Order

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&apos;s a different scheme from HTTP, it may feel strange initially, but becomes very natural after a couple hours of use.

#### Short Forms

Generic is `0x0*`, general codes are consistent with their integer representations

```solidity
hex&quot;1&quot; == hex&quot;01&quot; == 1 // with casting
```

#### Contract Categories

Many applications will always be part of the same category. For instance, validation will generally be in the `0x10` range.

```solidity
contract Whitelist {
    mapping(address =&gt; bool) private whitelist;
    uint256 private deadline;
    byte constant private prefix = hex&quot;10&quot;;

    check(address _, address _user) returns (byte _status) {
        if (now &gt;= deadline)  { return prefix | 5; }
        if (whitelist[_user]) { return prefix | 1; }
        return prefix;
    }
}
```

#### Helpers

This above also means that working with app-specific enums is slightly easier, and also saves gas (fewer operations required).

```solidity
enum Sleep {
    Awake,
    Asleep,
    BedOccupied,
    WindingDown
}

// From the helper library

function appCode(Sleep _state) returns (byte code) {
    return byte(160 + _state); // 160 = 0xA0
}

// Versus

function appCode(Sleep _state) returns (byte code) {
    return byte((16 * _state) + 10); // 10 = 0xA
}
```

## Implementation

Reference cases and helper libraries (Solidity and JS) can be found at:
* [Source Code](https://github.com/fission-suite/fission-codes/)
* [Package on npm](https://www.npmjs.com/package/fission-codes/)

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 05 May 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1066</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1066</guid>
      </item>
    
      <item>
        <title>Gas relay for contract calls</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc1077-and-1078-the-magic-of-executable-signed-messages-to-login-and-do-actions/351</comments>
        
        <description>## Simple Summary

A standard interface for gas abstraction in top of smart contracts. 

Allows users to offer [EIP-20] token for paying the gas used in a call. 

## Abstract

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&apos;s possible for smart contract to take [EIP-191] signatures and forward a payment incentive to an untrusted party with ETH for executing the transaction. 

## Motivation

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.


## Specification 

### Methods

#### executeGasRelay

Executes `_execData` with current `lastNonce()` and pays `msg.sender` the gas used in specified `_gasToken`.

```solidity
function executeGasRelay(bytes calldata _execData, uint256 _gasPrice, uint256 _gasLimit, address _gasToken, address _gasRelayer, bytes calldata _signature) external;	
```

### executeGasRelayMsg

Returns the `executeGasRelay` message used for signing messages..

```solidity
function executeGasRelayMsg(uint256 _nonce, bytes memory _execData, uint256 _gasPrice, uint256 _gasLimit, address _gasToken, address _gasRelayer) public pure returns (bytes memory);
```

#### executeGasRelayERC191Msg

Returns the [EIP-191] of `executeGasRelayMsg` used for signing messages and for verifying the execution.

```solidity
function executeGasRelayERC191Msg(uint256 _nonce, bytes memory _execData, uint256 _gasPrice, uint256 _gasLimit, address _gasToken, address _gasRelayer) public view returns (bytes memory);
```

#### lastNonce

Returns the current nonce for the gas relayed messages.

```solidity
function lastNonce() public returns (uint nonce);
```

### Signed Message

The signed message require the following fields:

* Nonce: A nonce *or* a timestamp;
* Execute Data: the bytecode to be executed by the account contract;
* Gas Price: The gas price (paid in the selected token);
* Gas Limit: The gas reserved to the relayed execution;
* Gas Token: A token in which the gas will be paid (leave 0 for ether);
* Gas Relayer: the beneficiary of gas refund for this call (leave 0 for `block.coinbase`) .

#### Signing the message

The message **MUST** be signed as [EIP-191] standard, and the called contract **MUST** also implement [EIP-1271] which must validate the signed messages.

Messages **MUST** be signed by the owner of the account contract executing. If the owner is a contract, it must implement [EIP-1271] interface and forward validation to it. 

In order to be compliant, the transaction **MUST** request to sign a &quot;messageHash&quot; that is a concatenation of multiple fields.

The fields **MUST** be constructed as this method:

The first and second fields are to make it [EIP-191] compliant. Starting a transaction with `byte(0x19)` ensure the signed data from being a [valid ethereum transaction](https://github.com/ethereum/wiki/wiki/RLP). The second argument is a version control byte. The third being the validator address (the account contract address) according to version 0 of [EIP-191]. The remaining arguments being the application specific data for the gas relay: chainID as per [EIP-1344], 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.

The [EIP-191] message must be constructed as follows:
```solidity
keccak256(
	abi.encodePacked(
        byte(0x19), //ERC-191 - the initial 0x19 byte
        byte(0x0), //ERC-191 - the version byte
        address(this), //ERC-191 - version data (validator address)
        chainID,
        bytes4(
            keccak256(&quot;executeGasRelay(uint256,bytes,uint256,uint256,address,address)&quot;)
        ),
        _nonce, 
        _execData,
        _gasPrice,
        _gasLimit,
        _gasToken,
        _gasRelayer
    )
)
```

## Rationale

User pain points:

* users don&apos;t want to think about ether
* users don&apos;t want to think about backing up private keys or seed phrases
* 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
* Users don’t want to sign a new transaction at every move
* Users don’t want to download apps/extensions (at least on the desktop) to connect to their apps

App developer pain points:
* Many apps use their own token and would prefer to use those as the main accounting
* 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
* Token developers want to be able for their users to be able to move funds and pay fees in the token
* 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)

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.

### Multiple signatures

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 `messageSignatures` 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.

If multiple signatures are required, then all signatures should then be *ordered by account* and the account contract should implement signatures checks locally (`JUMP`) on [EIP-1271] interface which might forward (`STATIC_CALL`) the [EIP-1271] signature check to owner contract.

### Keep track of nonces:

Note that `executeGasRelay` function does not take a `_nonce` as parameter. The contract knows what is the current nonce, and can only execute the transactions in order, therefore there is no reason

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 `lastNonce` will be updated to the current one. This prevents transactions to be executed out of order or more than once.

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&apos;s some dispute.

### Execute transaction

After signature validation, the evaluation of `_execBytes` is up to the account contract implementation, it&apos;s role of the wallet to properly use the account contract and it&apos;s gas relay method. 
A common pattern is to expose an interface which can be only called by the contract itself. The `_execBytes` could entirely forward the call in this way, as example: `address(this).call.gas(_gasLimit)(_execData);`
Where `_execData` could call any method of the contract itself, for example:

- `call(address to, uint256 value, bytes data)`:  allow any type of ethereum call be performed; 
- `create(uint256 value, bytes deployData)`: allows create contract 
- `create2(uint256 value, bytes32 salt, bytes deployData)`: allows create contract with deterministic address 
- `approveAndCall(address token, address to, uint256 value, bytes data)`: allows safe approve and call of an ERC20 token.
- `delegatecall(address codeBase, bytes data)`: allows executing code stored on other contract
- `changeOwner(address newOwner)`: Some account contracts might allow change of owner
- `foo(bytes bar)`: Some account contracts might have custom methods of any format.

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 `_execBytes` is not mandatory, depending on the account contract logic, the evaluation could be done locally. 

### Gas accounting and refund

The implementing contract must keep track of the gas spent. One way to do it is to first call `gasLeft()` at the beginning of the function and then after executing the desired action and compare the difference.

The contract then will make a token transfer (or ether, if `tokenAddress` is nil) in the value of `gasSpent * gasPrice` to the `_gasRelayer`, that is the account that deployed the message.

If `_gasRelayer` is zero, then the funds **MUST** go to `block.coinbase`.

If there are not enough funds, or if the total surpasses `gasLimit` then the transaction **MUST** revert.

If the executed transaction fails internally, nonces should still be updated and gas needs to be paid.

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.

### Usage examples

This scheme opens up a great deal of possibilities on interaction as well as different experiments on business models:

* 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.
* 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.
* 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 **ethereum based game in which gamers can play by spending apple, google or xbox credits**.
* 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. **The result is a token that the end users never need to keep any ether and can pay fees in the token itself.**
* 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&apos;t need to keep ether, and **the contract ends up paying for it&apos;s own gas usage**.

## Backwards Compatibility

There is no issues with backwards compatibility, however for future upgrades, as `_execData` contains arbitrary data evaluated by the account contract, it&apos;s up to the contract to handle properly this data and therefore contracts can gas relay any behavior with the current interface.

## Test Cases

TBD

## Implementation

One initial implementation of such a contract can be found at [Status.im account-contracts repository](https://github.com/status-im/account-contracts/blob/develop/contracts/account/AccountGasAbstract.sol)

Other version is implemented as Gnosis Safe variant in: https://github.com/status-im/safe-contracts

### Similar implementations

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:

* [EIP-877](https://github.com/ethereum/EIPs/pull/877) An attempt of doing the same but with a change in the protocol
* [Status](https://github.com/status-im/ideas/issues/73)
* [Aragon](https://github.com/aragonlabs/pay-protocol) (this might not be the best link to show their work in this area)
* [Token Standard Functions for Preauthorized Actions](https://github.com/ethereum/EIPs/issues/662)
* [Token Standard Extension 865](https://github.com/ethereum/EIPs/issues/865)
* [Iuri Matias: Transaction Relay](https://github.com/iurimatias/TransactionRelay)
* [uPort: Meta transactions](https://github.com/uport-project/uport-identity#send-a-meta-tx)
* [uPort: safe Identities](https://github.com/uport-project/uport-identity/blob/develop/docs/txRelay.md)
* [Gnosis safe contracts](https://github.com/gnosis/safe-contracts)

Swarm city uses a similar proposition for etherless transactions, called [Gas Station Service](https://github.com/swarmcity/SCLabs-gasstation-service), but it&apos;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.

## Security Considerations

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 **estimate the outcome of a transaction**, and only include/sign transactions which have a desired outcome. 

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 `gasPrice` they’re willing to deploy transactions.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

## References

* [Universal Logins talk at UX Unconf, Toronto](https://www.youtube.com/watch?v=qF2lhJzngto)

[EIP-20]: ./eip-20.md
[EIP-191]: ./eip-191.md
[EIP-1271]: ./eip-1271.md
[EIP-1344]: ./eip-1344.md
</description>
        <pubDate>Fri, 04 May 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1077</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1077</guid>
      </item>
    
      <item>
        <title>Universal login / signup using ENS subdomains</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc1077-and-1078-the-magic-of-executable-signed-messages-to-login-and-do-actions/351</comments>
        
        <description>## Abstract

This presents a method to replace the usual signup/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&apos;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.


## Simple Summary

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).  

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&apos;s funds are kept on the identity contract.

In this context, ethereum accounts are used in a manner more similar to auth tokens, rather than unique keys.

The login process is as follows:

#### 1) Request a name from the user

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.

**UX Note:** there are many ways to provide this interface, the app can ask if they want to signup/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.

#### 2.a) Create a new identity

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:

1. Generate a private key which it will keep saved locally on the device or browser, the safest way possible.
2. Create (or set up) an identity contract which supports both ERC720 and ERC1077
3. Register the private key created on step 1 as the *only* admin key of the contract (the app must not add any app-controlled key, except as a recovery option - see 5)
4. 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)
5. (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.

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)

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.

**Implementation note:** 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/icon.

#### 2.b) Connect to an existing identity

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:

**Manager** 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.

**Action** 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.

**Encryption** 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/browser of the user to sign messages using the ethereum URI standard.

Once the desired level is known, the app must take these steps:

1. **Generate a private key** which it will keep saved locally on the device or browser, the safest way possible.
2. **Query ens** to figure the existing address of the identity
3. **Generate the bytecode** for a transaction calling the function `addKey(PUBLICKEY,LEVEL)`.
4. **Broadcast a transaction request on a whisper channel** or some other decentralized network of peers. Details on this step require further discussions
1. **If web3 is available** then attempt calling web3.eth.sendTransaction. This can be automatic or prompted by user action.
1. **Attempt calling a URI** if the app supports [URL format for transaction requests EIP](./eip-681.md) then attempt calling this. This can be automatic or prompted by user action.
1. **Show a QR code**: 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&apos;t need to use the QR code.

Here&apos;s an example of a EIP681 compatible address to add a public key generated locally in the app:

`ethereum:bob.example.eth?function=addKey(address=&apos;0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef&apos;,uint=1)`

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.

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.



#### 3) Request transactions

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.

**Not all transactions need to be on chain**, 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).

Once you decided you actually need an on-chain transaction, follow these steps:

1. **Figure out the TO, FROM, VALUE and DATA**. These are the basics of any ethereum transaction. `from` is the compatible contract you want the transaction to be deployed from.
2. **Check the privilege level you need:** if the `to` and `from` 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&apos;s 2 (action). Verify if the key your app owns correspond to the required level.
3. **Verify how many keys are required** by calling `requiredSignatures(uint level)` on the target contract
4. **Figure out gasLimit**: Estimate the gas cost of the desired transaction, and add a margin (recommended: add 100k gas)
5. **Figure out gasToken and gasPrice**:  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.
6. **Sign an executable signed transaction** by following that standard.

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 `from` address and attempt to call the function `executeSigned`, using the parameters and signature you just collected.

If the transaction need to collect more signatures or the app doesn&apos;t have a deployable server, the app should follow these steps:

1. **Broadcast the transaction on a whisper channel** or some other decentralized network of peers. Details on this step require further discussions
2. **If web3 is available** then attempt calling web3.eth.personal_sign. This can be automatic or prompted by user action.
3. **Show a QR code**: 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&apos;t need to use the QR code.

The goal is to keep broadcasting signatures via whisper until a node that is willing to deploy them is able to collect all messages.

Once you&apos;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 `ExecutedSigned` 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.


### Implementation

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.

### Conclusion and future improvements

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.

### References

* [Universal Logins talk at UX Unconf, Toronto](https://www.youtube.com/watch?v=qF2lhJzngto)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 04 May 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1078</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1078</guid>
      </item>
    
      <item>
        <title>Recoverable Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-1080-recoverabletoken-standard/364</comments>
        
        <description>## Simple Summary

A standard interface for tokens that support chargebacks, theft prevention, and lost &amp; found resolutions.

## Abstract

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.

## Motivation

To mitigate the effects of reasonably provable token or asset loss or theft and to help resolve other conflicts. Ethereum&apos;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.

## Specification

## RecoverableToken

### Methods

#### claimLost

Reports the `lostAccount` address as being lost. MUST trigger the `AccountClaimedLost` event.

After the time configured in `getLostAccountRecoveryTimeInMinutes` the implementer MUST provide a mechanism for determining the correct owner of the tokens held and moving the tokens to a new account.

Account recoveries must trigger the `AccountRecovered` event.

``` js
function claimLost(address lostAccount) returns (bool success)
```

#### cancelLostClaim

Reports the `msg.sender`&apos;s account as being not being lost. MUST trigger the `AccountClaimedLostCanceled` event.

MUST fail if an account recovery process has already begun.

Otherwise, this method MUST stop a dispute from being started to recover funds.

``` js
function claimLost() returns (bool success)
```

#### reportStolen

Reports the current address as being stolen. MUST trigger the `AccountFrozen` event.
Successful calls MUST result in the `msg.sender`&apos;s tokens being frozen.

The implementer MUST provide a mechanism for determining the correct owner of the tokens held and moving the tokens to a new account.

Account recoveries must trigger the `AccountRecovered` event.

``` js
function reportStolen() returns (bool success)
```

#### chargeback

Requests a reversal of transfer on behalf of `msg.sender`.

The implementer MUST provide a mechanism for determining the correct owner of the tokens disputed and moving the tokens to the correct account.

MUST comply with sender&apos;s chargeback window as value configured by `setPendingTransferTimeInMinutes`.

``` js
function chargeback(uint256 pendingTransferNumber) returns (bool success)
```

#### getPendingTransferTimeInMinutes

Get the time an account has to chargeback a transfer.

``` js
function getPendingTransferTime(address account) view returns (uint256 minutes)
```

#### setPendingTransferTimeInMinutes

Sets the time `msg.sender`&apos;s account has to chargeback a transfer.

MUST NOT change the time if the account has any pending transfers.

``` js
function setPendingTransferTime(uint256 minutes) returns (bool success)
```

#### getLostAccountRecoveryTimeInMinutes

Get the time account has to wait before a lost account dispute can start.

``` js
function getLostAccountRecoveryTimeInMinutes(address account) view returns (uint256 minutes)
```

#### setLostAccountRecoveryTimeInMinutes

Sets the time `msg.sender`&apos;s account has to sit before a lost account dispute can start.

MUST NOT change the time if the account has open disputes.

``` js
function setLostAccountRecoveryTimeInMinutes(uint256 minutes) returns (bool success)
```

### Events

#### AccountRecovered

The recovery of an account that was lost or stolen.

``` js
event AccountClaimedLost(address indexed account, address indexed newAccount)
```

#### AccountClaimedLostCanceled

An account claimed as being lost.

``` js
event AccountClaimedLost(address indexed account)
```

#### AccountClaimedLost

An account claimed as being lost.

``` js
event AccountClaimedLost(address indexed account)
```

#### PendingTransfer

A record of a transfer pending. 

``` js
event PendingTransfer(address indexed from, address indexed to, uint256 value, uint256 pendingTransferNumber)
```

#### ChargebackRequested

A record of a chargeback being requested.

``` js
event ChargebackRequested(address indexed from, address indexed to, uint256 value, uint256 pendingTransferNumber)
```

#### Chargeback

A record of a transfer being reversed.

``` js
event Chargeback(address indexed from, address indexed to, uint256 value, uint256 indexed pendingTransferNumber)
```

#### AccountFrozen

A record of an account being frozen. MUST trigger when an account is frozen.

``` js
event AccountFrozen(address indexed reported)
```

## Rationale

* A recoverable token standard can provide configurable safety for users or contracts who desire this safety.
* 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.


## Implementation

Pending.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 02 May 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1080</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1080</guid>
      </item>
    
      <item>
        <title>Standard Bounties</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://gitter.im/bounties-network/Lobby</comments>
        
        <description>## Simple Summary
A standard contract and interface for issuing bounties on Ethereum, usable for any type of task, paying in any ERC20 token or in ETH.

## Abstract
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.

## Motivation
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).

## Specification
After studying bounties as they&apos;ve existed for thousands of years (and after implementing and processing over 300 of them on main-net in beta), we&apos;ve discovered that there are 3 core steps to every bounty:
- a bounty is **issued**: an `issuer` 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).
- a bounty is **fulfilled**: a bounty `fulfiller` 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.
- a fulfillment is **accepted**: a bounty `issuer` or `arbiter` 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 `issuer`.

To implement these steps, a number of functions are needed:
- `initializeBounty(address _issuer, address _arbiter, string _data, uint _deadline)`: 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).
- `fulfillBounty(address[] _fulfillers, uint[] _numerators, uint _denomenator, string _data)`: 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.
- `acceptFulfillment(uint _fulfillmentId, StandardToken[] _payoutTokens, uint[] _tokenAmounts)`: This is called by the `issuer` or the `arbiter` 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&apos;s balance among several fulfillments, if the need should arise.
   - `drainBounty(StandardToken[] _payoutTokens)`: This may be called by the `issuer` to drain a bounty of it&apos;s funds, if the need should arise.
- `changeBounty(address _issuer, address _arbiter, string _data, uint _deadline)`: This may be called by the `issuer` to change the `issuer`, `arbiter`, `data`, and `deadline` fields of their bounty.
- `changeIssuer(address _issuer)`: This may be called by the `issuer` to change to a new `issuer` if need be
- `changeArbiter(address _arbiter)`: This may be called by the `issuer` to change to a new `arbiter` if need be
- `changeData(string _data)`: This may be called by the `issuer` to change just the `data`
- `changeDeadline(uint _deadline)`: This may be called by the `issuer` to change just the `deadline`

Optional Functions:
- `acceptAndFulfill(address[] _fulfillers, uint[] _numerators, uint _denomenator, string _data, StandardToken[] _payoutTokens, uint[] _tokenAmounts)`: 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&apos;s `issuer` 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.
- `changeMasterCopy(StandardBounty _masterCopy)`: For `issuer`s to be able to change the masterCopy which their proxy contract relies on, if the proxy design pattern is being employed.
- `refundableContribute(uint[] _amounts, StandardToken[] _tokens)`: 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.
`refundContribution(uint _contributionId)`: If a bounty hasn&apos;t yet paid out to any correct submissions and is past it&apos;s deadline, those individuals who employed the `refundableContribute` function may retrieve their funds from the contract.

**Schemas**
Persona Schema:
```
{
   name: // optional - A string representing the name of the persona
   email: // optional - A string representing the preferred contact email of the persona
   githubUsername: // optional - A string representing the github username of the persona
   address: // required - A string web3 address of the persona
}
```
Bounty issuance `data` Schema:
```
{
  payload: {
    title: // A string representing the title of the bounty
    description: // A string representing the description of the bounty, including all requirements
    issuer: {
       // persona for the issuer of the bounty
    },
    funders:[
       // array of personas of those who funded the issue.
    ],
    categories: // an array of strings, representing the categories of tasks which are being requested
    tags: // an array of tags, representing various attributes of the bounty
    created: // the timestamp in seconds when the bounty was created
    tokenSymbol: // the symbol for the token which the bounty pays out
    tokenAddress: // the address for the token which the bounty pays out (0x0 if ETH)

    // ------- add optional fields here -------
    sourceFileName: // A string representing the name of the file
    sourceFileHash: // The IPFS hash of the file associated with the bounty
    sourceDirectoryHash: // The IPFS hash of the directory which can be used to access the file
    webReferenceURL: // The link to a relevant web reference (ie github issue)
  },
  meta: {
    platform: // a string representing the original posting platform (ie &apos;gitcoin&apos;)
    schemaVersion: // a string representing the version number (ie &apos;0.1&apos;)
    schemaName: // a string representing the name of the schema (ie &apos;standardSchema&apos; or &apos;gitcoinSchema&apos;)
  }
}
```
Bounty `fulfillment` data Schema:

```
{
  payload: {
    description: // A string representing the description of the fulfillment, and any necessary links to works
    sourceFileName: // A string representing the name of the file being submitted
    sourceFileHash: // A string representing the IPFS hash of the file being submitted
    sourceDirectoryHash: // A string representing the IPFS hash of the directory which holds the file being submitted
    fulfillers: {
      // personas for the individuals whose work is being submitted
    }

    // ------- add optional fields here -------
  },
  meta: {
    platform: // a string representing the original posting platform (ie &apos;gitcoin&apos;)
    schemaVersion: // a string representing the version number (ie &apos;0.1&apos;)
    schemaName: // a string representing the name of the schema (ie &apos;standardSchema&apos; or &apos;gitcoinSchema&apos;)
  }
}
```
## Rationale
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&apos;s `data` could not be changed after issuance (it seemed unfair for bounty `issuer`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). 

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 `issuer` 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.

## Test Cases
Tests for our implementation can be found here: https://github.com/Bounties-Network/StandardBounties/tree/develop/test

## Implementation
A reference implementation can be found here: https://github.com/Bounties-Network/StandardBounties/blob/develop/contracts/StandardBounty.sol
**Although this code has been tested, it has not yet been audited or bug-bountied, so we cannot make any assertions about it&apos;s correctness, nor can we presently encourage it&apos;s use to hold funds on the Ethereum mainnet.**

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 14 May 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1081</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1081</guid>
      </item>
    
      <item>
        <title>Revised Ethereum Smart Contract Packaging Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1123</comments>
        
        <description>This ERC has been abandoned in favor of the EthPM V3 smart contract packaging standard defined in [ERC-2678](./eip-2678.md)

Simple Summary
==============

A data format describing a smart contract software package.


Abstract
==========

This EIP defines a data format for *package manifest* documents,
representing a package of one or more smart contracts, optionally
including source code and any/all deployed instances across multiple
networks. Package manifests are minified JSON objects, to be distributed
via content addressable storage networks, such as IPFS.

This document presents a natural language description of a formal
specification for version **2** of this format.


Motivation
==========

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.

As version 2 of this specification, this standard seeks to address a
number of areas of improvement found for the previous version (defined
in
[EIP-190](./eip-190.md)).
This version:

-   Generalizes storage URIs to represent any content addressable URI
    scheme, not only IPFS.

-   Renames *release lockfile* to *package manifest*.

-   Adds support for languages other than Solidity by generalizing the
    compiler information format.

-   Redefines link references to be more flexible, to represent
    arbitrary gaps in bytecode (besides only addresses), in a more
    straightforward way.

-   Forces format strictness, requiring that package manifests contain
    no extraneous whitespace, and sort object keys in alphabetical
    order, to prevent hash mismatches.


&lt;div id=&quot;package-specification&quot;&gt;&lt;/div&gt;

Specification
=============

This document defines the specification for an EthPM package manifest. A
package manifest provides metadata about a [Package](#term-package), and
in most cases should provide sufficient information about the packaged
contracts and its dependencies to do bytecode verification of its
contracts.

&gt; **Note**
&gt;
&gt; A [hosted
&gt; version](https://ethpm.github.io/ethpm-spec) of this
&gt; specification is available via GitHub Pages. This EIP and the hosted
&gt; HTML document were both autogenerated from the same documentation
&gt; source.


Guiding Principles
------------------

This specification makes the following assumptions about the document
lifecycle.

1.  Package manifests are intended to be generated programmatically by
    package management software as part of the release process.

2.  Package manifests will be consumed by package managers during tasks
    like installing package dependencies or building and deploying new
    releases.

3.  Package manifests will typically **not** be stored alongside the
    source, but rather by package registries *or* referenced by package
    registries and stored in something akin to IPFS.


Conventions
-----------


### RFC2119

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;https://www.ietf.org/rfc/rfc2119.txt&gt;


### Prefixed vs Unprefixed

A [prefixed](#term-prefixed) hexadecimal value begins with `0x`.
[Unprefixed](#term-unprefixed) values have no prefix. Unless otherwise
specified, all hexadecimal values **should** be represented with the
`0x` prefix.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Prefixed&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0xdeadbeef&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Unprefixed&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;deadbeef&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


Document Format
---------------

The canonical format is a single JSON object. Packages **must** conform
to the following serialization rules.

-   The document **must** be tightly packed, meaning no linebreaks or
    extra whitespace.

-   The keys in all objects must be sorted alphabetically.

-   Duplicate keys in the same object are invalid.

-   The document **must** use
    [UTF-8](https://en.wikipedia.org/wiki/UTF-8)
    encoding.

-   The document **must** not have a trailing newline.


Document Specification
----------------------

The following fields are defined for the package. Custom fields **may**
be included. Custom fields **should** be prefixed with `x-` to prevent
name collisions with future versions of the specification.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;See Also&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Formalized (&lt;a href=&quot;https://json-schema.org&quot;&gt;JSON-Schema&lt;/a&gt;) version of this specification: &lt;a href=&quot;https://github.com/ethpm/ethpm-spec/tree/v2.0.0/spec/package.spec.json&quot;&gt;package.spec.json&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Jump To&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;a href=&quot;#definitions&quot;&gt;Definitions&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;manifest-version&quot;&gt;&lt;/div&gt;

### EthPM Manifest Version: `manifest_version`

The `manifest_version` field defines the specification version that this
document conforms to. Packages **must** include this field.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;manifest_version&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Allowed Values&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;2&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;package-names&quot;&gt;&lt;/div&gt;

### Package Name: `package_name`

The `package_name` field defines a human readable name for this package.
Packages **must** include this field. Package names **must** begin with
a lowercase letter and be comprised of only lowercase letters, numeric
characters, and the dash character `-`. Package names **must** not
exceed 214 characters in length.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;package_name&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;/strong&gt; match the regular expression &lt;code&gt;^[a-zA-Z][a-zA-Z0-9_]{0,255}$&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


### Package Meta: `meta`

The `meta` 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 **should**
be included in all Packages.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;meta&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;a href=&quot;#package-meta-object&quot;&gt;Package Meta Object&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


### Version: `version`

The `version` field declares the version number of this release. This
value **must** be included in all Packages. This value **should**
conform to the [semver](https://semver.org/) version
numbering specification.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;version&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


### Sources: `sources`

The `sources` field defines a source tree that **should** comprise the
full source tree necessary to recompile the contracts contained in this
release. Sources are declared in a key/value mapping.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;sources&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object (String: String)&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;See Below.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Format

Keys **must** be relative filesystem paths beginning with a `./`.

Paths **must** resolve to a path that is within the current working
directory.

Values **must** conform to *one of* the following formats.

-   Source string.

-   [Content Addressable URI](#term-content-addressable-uri).

When the value is a source string the key should be interpreted as a
file path.

-   If the resulting document is a directory the key should be
    interpreted as a directory path.

-   If the resulting document is a file the key should be interpreted as
    a file path.


### Contract Types: `contract_types`

The `contract_types` field holds the [Contract
Types](#term-contract-type) which have been included in this release.
[Packages](#term-package) **should** only include contract types that
can be found in the source files for this package. Packages **should
not** include contract types from dependencies. Packages **should not**
include abstract contracts in the contract types section of a release.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;contract_types&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object (String: &lt;a href=&quot;#contract-type-object&quot;&gt;Contract Type Object&lt;/a&gt;)&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Keys &lt;strong&gt;must&lt;/strong&gt; be valid &lt;a href=&quot;#term-contract-alias&quot;&gt;Contract Aliases&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Values &lt;strong&gt;must&lt;/strong&gt; conform to the &lt;a href=&quot;#contract-type-object&quot;&gt;Contract Type Object&lt;/a&gt; definition.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


### Deployments: `deployments`

The `deployments` field holds the information for the chains on which
this release has [Contract Instances](#term-contract-instance) as well
as the [Contract Types](#term-contract-type) and other deployment
details for those deployed contract instances. The set of chains defined
by the `*BIP122 URI &lt;#bip122-uris&gt;*` keys for this object **must** be
unique.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;deployments&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/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;/a&gt;))&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;See Below.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Format

Keys **must** be a valid BIP122 URI chain definition.

Values **must** be objects which conform to the following format.

-   Keys **must** be valid [Contract Instance
    Names](#term-contract-instance-name).

-   Values **must** be a valid [Contract Instance
    Object](#contract-instance-object).


### Build Dependencies: `build_dependencies`

The `build_dependencies` field defines a key/value mapping of Ethereum
[Packages](#term-package) that this project depends on.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;build_dependencies&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object (String: String)&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Keys &lt;strong&gt;must&lt;/strong&gt; be valid &lt;a href=&quot;#package-names&quot;&gt;package names&lt;/a&gt; matching the regular expression &lt;code&gt;[a-z][-a-z0-9]{0,213}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Values &lt;strong&gt;must&lt;/strong&gt; be valid IPFS URIs which resolve to a valid package.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


Definitions
-----------

Definitions for different objects used within the Package. All objects
allow custom fields to be included. Custom fields **should** be prefixed
with `x-` to prevent name collisions with future versions of the
specification.


&lt;div id=&quot;link-reference-object&quot;&gt;&lt;/div&gt;

### The *Link Reference* Object

A [Link Reference](#term-link-reference) object has the following
key/value pairs. All link references are assumed to be associated with
some corresponding [Bytecode](#term-bytecode).


#### Offsets: `offsets`

The `offsets` 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;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Array&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Length: `length`

The `length` 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;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Integer&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Name: `name`

The `name` field is a string which **must** be a valid
[Identifier](#term-identifier). Any link references which **should** be
linked with the same link value **should** be given the same name.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;/strong&gt; conform to the &lt;a href=&quot;#term-identifier&quot;&gt;Identifier&lt;/a&gt; format.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;link-value-object&quot;&gt;&lt;/div&gt;

### The *Link Value* Object

Describes a single [Link Value](#term-link-value).

A **Link Value object** is defined to have the following key/value
pairs.


&lt;div id=&quot;offset-offset-1&quot;&gt;&lt;/div&gt;

#### Offsets: `offsets`

The `offsets` field defines the locations within the corresponding
bytecode where the `value` for this link value was written. These
locations are 0-indexed from the beginning of the bytes representation
of the corresponding bytecode.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Integer&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;See Below.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

**Format**

Array of integers, where each integer **must** conform to all of the
following.

-   greater than or equal to zero

-   strictly less than the length of the unprefixed hexadecimal
    representation of the corresponding bytecode.


#### Type: `type`

The `type` field defines the `value` type for determining what is
encoded when [linking](#term-linking) the corresponding bytecode.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Allowed Values&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;&amp;quot;literal&amp;quot;&lt;/code&gt; for bytecode literals&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;quot;reference&amp;quot;&lt;/code&gt; for named references to a particular &lt;a href=&quot;#term-contract-instance&quot;&gt;Contract Instance&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Value: `value`

The `value` field defines the value which should be written when
[linking](#term-linking) the corresponding bytecode.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Determined based on &lt;code&gt;type&lt;/code&gt;, see below.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

**Format**

For static value *literals* (e.g. address), value **must** be a *byte
string*

To reference the address of a [Contract
Instance](#term-contract-instance) from the current package the value
should be the name of that contract instance.

-   This value **must** be a valid contract instance name.

-   The chain definition under which the contract instance that this
    link value belongs to must contain this value within its keys.

-   This value **may not** reference the same contract instance that
    this link value belongs to.

To reference a contract instance from a [Package](#term-package) from
somewhere within the dependency tree the value is constructed as
follows.

-   Let `[p1, p2, .. pn]` define a path down the dependency tree.

-   Each of `p1, p2, pn` **must** be valid package names.

-   `p1` **must** be present in keys of the `build_dependencies` for the
    current package.

-   For every `pn` where `n &gt; 1`, `pn` **must** be present in the keys
    of the `build_dependencies` of the package for `pn-1`.

-   The value is represented by the string
    `&lt;p1&gt;:&lt;p2&gt;:&lt;...&gt;:&lt;pn&gt;:&lt;contract-instance&gt;` where all of `&lt;p1&gt;`,
    `&lt;p2&gt;`, `&lt;pn&gt;` are valid package names and `&lt;contract-instance&gt;` is
    a valid [Contract Name](#term-contract-name).

-   The `&lt;contract-instance&gt;` value **must** be a valid [Contract
    Instance Name](#term-contract-instance-name).

-   Within the package of the dependency defined by `&lt;pn&gt;`, all of the
    following must be satisfiable:

    -   There **must** be *exactly* one chain defined under the
        `deployments` key which matches the chain definition that this
        link value is nested under.

    -   The `&lt;contract-instance&gt;` value **must** be present in the keys
        of the matching chain.


### The *Bytecode* Object

A bytecode object has the following key/value pairs.


#### Bytecode: `bytecode`

The `bytecode` field is a string containing the `0x` prefixed
hexadecimal representation of the bytecode.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0x&lt;/code&gt; prefixed hexadecimal.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Link References: `link_references`

The `link_references` field defines the locations in the corresponding
bytecode which require [linking](#term-linking).

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Array&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;All values &lt;strong&gt;must&lt;/strong&gt; be valid &lt;a href=&quot;#link-reference-object&quot;&gt;Link Reference objects&lt;/a&gt;. See also below.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

**Format**

This field is considered invalid if *any* of the [Link
References](#term-link-reference) are invalid when applied to the
corresponding `bytecode` field, *or* if any of the link references
intersect.

Intersection is defined as two link references which overlap.


#### Link Dependencies: `link_dependencies`

The `link_dependencies` defines the [Link Values](#term-link-value) that
have been used to link the corresponding bytecode.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Array&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;All values &lt;strong&gt;must&lt;/strong&gt; be valid &lt;a href=&quot;#link-value-object&quot;&gt;Link Value objects&lt;/a&gt;. See also below.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

**Format**

Validation of this field includes the following:

-   Two link value objects **must not** contain any of the same values
    for `offsets`.

-   Each [link value object](#link-value-object) **must** have a
    corresponding [link reference object](#link-reference-object) under
    the `link_references` field.

-   The length of the resolved `value` **must** be equal to the `length`
    of the corresponding [Link Reference](#term-link-reference).


&lt;div id=&quot;package-meta-object&quot;&gt;&lt;/div&gt;

### The *Package Meta* Object

The *Package Meta* object is defined to have the following key/value
pairs.


#### Authors: `authors`

The `authors` field defines a list of human readable names for the
authors of this package. Packages **may** include this field.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;authors&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Array (String)&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### License: `license`

The `license` field declares the license under which this package is
released. This value **should** conform to the
[SPDX](https://en.wikipedia.org/wiki/Software_Package_Data_Exchange)
format. Packages **should** include this field.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;license&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Description: `description`

The `description` field provides additional detail that may be relevant
for the package. Packages **may** include this field.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;description&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Keywords: `keywords`

The `keywords` field provides relevant keywords related to this package.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;keywords&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;List of Strings&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Links: `links`

The `links` field provides URIs to relevant resources associated with
this package. When possible, authors **should** use the following keys
for the following common resources.

-   `website`: Primary website for the package.

-   `documentation`: Package Documentation

-   `repository`: Location of the project source code.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;links&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object (String: String)&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;contract-type-object&quot;&gt;&lt;/div&gt;

### The *Contract Type* Object

A *Contract Type* object is defined to have the following key/value
pairs.


#### Contract Name: `contract_name`

The `contract_name` field defines the [Contract
Name](#term-contract-name) for this [Contract
Type](#term-contract-type).

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;If the &lt;a href=&quot;#term-contract-name&quot;&gt;Contract Name&lt;/a&gt; and &lt;a href=&quot;#term-contract-alias&quot;&gt;Contract Alias&lt;/a&gt; are not the same.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;/strong&gt; be a valid &lt;a href=&quot;#term-contract-name&quot;&gt;Contract Name&lt;/a&gt;.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Deployment Bytecode: `deployment_bytecode`

The `deployment_bytecode` field defines the bytecode for this [Contract
Type](#term-contract-type).

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;/strong&gt; conform to &lt;a href=&quot;#the-bytecode-object&quot;&gt;the Bytecode Object&lt;/a&gt; format.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Runtime Bytecode: `runtime_bytecode`

The `runtime_bytecode` field defines the unlinked `0x`-prefixed runtime
portion of [Bytecode](#term-bytecode) for this [Contract
Type](#term-contract-type).

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;/strong&gt; conform to &lt;a href=&quot;#the-bytecode-object&quot;&gt;the Bytecode Object&lt;/a&gt; format.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### ABI: `abi`

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;List&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;/strong&gt; conform to the &lt;a href=&quot;https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#json&quot;&gt;Ethereum Contract ABI JSON format&lt;/a&gt;.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Natspec: `natspec`

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;The union of the &lt;a href=&quot;https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format#user-documentation&quot;&gt;UserDoc&lt;/a&gt; and &lt;a href=&quot;https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format#developer-documentation&quot;&gt;DevDoc&lt;/a&gt; formats.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Compiler: `compiler`

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;/strong&gt; conform to &lt;a href=&quot;#the-compiler-information-object&quot;&gt;the Compiler Information object&lt;/a&gt; format.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;contract-instance-object&quot;&gt;&lt;/div&gt;

### The *Contract Instance* Object

A **Contract Instance Object** represents a single deployed [Contract
Instance](#term-contract-instance) and is defined to have the following
key/value pairs.


#### Contract Type: `contract_type`

The `contract_type` field defines the [Contract
Type](#term-contract-type) for this [Contract
Instance](#term-contract-instance). This can reference any of the
contract types included in this [Package](#term-package) *or* any of the
contract types found in any of the package dependencies from the
`build_dependencies` section of the [Package
Manifest](#term-package-manifest).

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;See Below.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

**Format**

Values for this field **must** conform to *one of* the two formats
herein.

To reference a contract type from this Package, use the format
`&lt;contract-alias&gt;`.

-   The `&lt;contract-alias&gt;` value **must** be a valid [Contract
    Alias](#term-contract-alias).

-   The value **must** be present in the keys of the `contract_types`
    section of this Package.

To reference a contract type from a dependency, use the format
`&lt;package-name&gt;:&lt;contract-alias&gt;`.

-   The `&lt;package-name&gt;` value **must** be present in the keys of the
    `build_dependencies` of this Package.

-   The `&lt;contract-alias&gt;` value **must** be a valid [Contract
    Alias](#term-contract-alias).

-   The resolved package for `&lt;package-name&gt;` must contain the
    `&lt;contract-alias&gt;` value in the keys of the `contract_types`
    section.


#### Address: `address`

The `address` field defines the [Address](#term-address) of the
[Contract Instance](#term-contract-instance).

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Hex encoded &lt;code&gt;0x&lt;/code&gt; prefixed Ethereum address matching the regular expression &lt;code&gt;0x[0-9a-fA-F]{40}&lt;/code&gt;.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Transaction: `transaction`

The `transaction` field defines the transaction hash in which this
[Contract Instance](#term-contract-instance) was created.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0x&lt;/code&gt; prefixed hex encoded transaction hash.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Block: `block`

The `block` field defines the block hash in which this the transaction
which created this *contract instance* was mined.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0x&lt;/code&gt; prefixed hex encoded block hash.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;runtime-bytecode-runtime-bytecode-1&quot;&gt;&lt;/div&gt;

#### Runtime Bytecode: `runtime_bytecode`

The `runtime_bytecode` field defines the runtime portion of bytecode for
this [Contract Instance](#term-contract-instance). When present, the
value from this field supersedes the `runtime_bytecode` from the
[Contract Type](#term-contract-type) for this [Contract
Instance](#term-contract-instance).

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;/strong&gt; conform to &lt;a href=&quot;#the-bytecode-object&quot;&gt;the Bytecode Object&lt;/a&gt; format.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

Every entry in the `link_references` for this bytecode **must** have a
corresponding entry in the `link_dependencies` section.


#### Compiler: `compiler`

The `compiler` field defines the compiler information that was used
during compilation of this [Contract Instance](#term-contract-instance).
This field **should** be present in all [Contract
Types](#term-contract-type) which include `bytecode` or
`runtime_bytecode`.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Format&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;strong&gt;must&lt;/strong&gt; conform to the &lt;a href=&quot;#compiler-information-object&quot;&gt;Compiler Information Object&lt;/a&gt; format.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;compiler-information-object&quot;&gt;&lt;/div&gt;

### The *Compiler Information* Object

The `compiler` field defines the compiler information that was used
during compilation of this [Contract Instance](#term-contract-instance).
This field **should** be present in all contract instances that locally
declare `runtime_bytecode`.

A *Compiler Information* object is defined to have the following
key/value pairs.


#### Name `name`

The `name` field defines which compiler was used in compilation.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;name&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Version: `version`

The `version` field defines the version of the compiler. The field
**should** be OS agnostic (OS not included in the string) and take the
form of either the stable version in
[semver](https://semver.org/) format or if built on a
nightly should be denoted in the form of `&lt;semver&gt;-&lt;commit-hash&gt;` ex:
`0.4.8-commit.60cc1668`.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Yes&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;version&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;String&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


#### Settings: `settings`

The `settings` field defines any settings or configuration that was used
in compilation. For the `&quot;solc&quot;` compiler, this **should** conform to
the [Compiler Input and Output
Description](https://solidity.readthedocs.io/en/latest/using-the-compiler.html#compiler-input-and-output-json-description).

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Required&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;No&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Key&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;settings&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Object&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


### BIP122 URIs

BIP122 URIs are used to define a blockchain via a subset of the
[BIP-122](https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki)
spec.

    blockchain://&lt;genesis_hash&gt;/block/&lt;latest confirmed block hash&gt;

The `&lt;genesis hash&gt;` represents the blockhash of the first block on the
chain, and `&lt;latest confirmed block hash&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).


Rationale
=========

The following use cases were considered during the creation of this
specification.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;owned&lt;/p&gt;&lt;/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;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;transferable&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;A package which has a single dependency.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;standard-token&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;A package which contains a reusable contract.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;safe-math-lib&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;A package which contains deployed instance of one of the package contracts.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;piper-coin&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;A package which contains a deployed instance of a reusable contract from a dependency.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;escrow&lt;/p&gt;&lt;/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;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;wallet&lt;/p&gt;&lt;/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;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;wallet-with-send&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;A package with a deployed instance which links against a deep dependency.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

Each use case builds incrementally on the previous one.

A full listing of [Use
Cases](https://ethpm.github.io/ethpm-spec/use-cases.html)
can be found on the hosted version of this specification.


Glossary
==========


&lt;div id=&quot;term-abi&quot;&gt;&lt;/div&gt;

ABI
---

The JSON representation of the application binary interface. See the
official
[specification](https://solidity.readthedocs.io/en/develop/abi-spec.html)
for more information.


&lt;div id=&quot;term-address&quot;&gt;&lt;/div&gt;

Address
-------

A public identifier for an account on a particular chain


&lt;div id=&quot;term-bytecode&quot;&gt;&lt;/div&gt;

Bytecode
--------

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 [prefixed](#term-prefixed) with `0x`.

Bytecode can either be linked or unlinked. (see
[Linking](#term-linking))

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Unlinked Bytecode&lt;/p&gt;&lt;/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;/a&gt; for the contract to be functional.&lt;/p&gt;
&lt;p&gt;The sections of code which are unlinked &lt;strong&gt;must&lt;/strong&gt; be filled in with zero bytes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: &lt;code&gt;0x606060405260e06000730000000000000000000000000000000000000000634d536f&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;Linked Bytecode&lt;/p&gt;&lt;/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;/a&gt; replaced with the desired &lt;a href=&quot;#term-link-value&quot;&gt;Link Values&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: &lt;code&gt;0x606060405260e06000736fe36000604051602001526040518160e060020a634d536f&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;term-chain-definition&quot;&gt;&lt;/div&gt;

Chain Definition
----------------

This definition originates from [BIP122
URI](https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki).

A URI in the format `blockchain://&lt;chain_id&gt;/block/&lt;block_hash&gt;`

-   `chain_id` is the unprefixed hexadecimal representation of the
    genesis hash for the chain.

-   `block_hash` is the unprefixed hexadecimal representation of the
    hash of a block on the chain.

A chain is considered to match a chain definition if the genesis
block hash matches the `chain_id` and the block defined by `block_hash`
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;div id=&quot;term-content-addressable-uri&quot;&gt;&lt;/div&gt;

Content Addressable URI
-----------------------

Any URI which contains a cryptographic hash which can be used to verify
the integrity of the content found at the URI.

The URI format is defined in RFC3986

It is **recommended** that tools support IPFS and Swarm.


&lt;div id=&quot;term-contract-alias&quot;&gt;&lt;/div&gt;

Contract Alias
--------------

This is a name used to reference a specific [Contract
Type](#term-contract-type). Contract aliases **must** be unique within a
single [Package](#term-package).

The contract alias **must** use *one of* the following naming schemes:

-   `&lt;contract-name&gt;`

-   `&lt;contract-name&gt;[&lt;identifier&gt;]`

The `&lt;contract-name&gt;` portion **must** be the same as the [Contract
Name](#term-contract-name) for this contract type.

The `[&lt;identifier&gt;]` portion **must** match the regular expression
`\[[-a-zA-Z0-9]{1,256}]`.


&lt;div id=&quot;term-contract-instance&quot;&gt;&lt;/div&gt;

Contract Instance
-----------------

A contract instance a specific deployed version of a [Contract
Type](#term-contract-type).

All contract instances have an [Address](#term-address) on some specific
chain.


&lt;div id=&quot;term-contract-instance-name&quot;&gt;&lt;/div&gt;

Contract Instance Name
----------------------

A name which refers to a specific [Contract
Instance](#term-contract-instance) on a specific chain from the
deployments of a single [Package](#term-package). This name **must** be
unique across all other contract instances for the given chain. The name
must conform to the regular expression `[a-zA-Z][a-zA-Z0-9_]{0,255}`

In cases where there is a single deployed instance of a given [Contract
Type](#term-contract-type), package managers **should** use the
[Contract Alias](#term-contract-alias) for that contract type for this
name.

In cases where there are multiple deployed instances of a given contract
type, package managers **should** use a name which provides some added
semantic information as to help differentiate the two deployed instances
in a meaningful way.


&lt;div id=&quot;term-contract-name&quot;&gt;&lt;/div&gt;

Contract Name
-------------

The name found in the source code that defines a specific [Contract
Type](#term-contract-type). These names **must** conform to the regular
expression `[a-zA-Z][-a-zA-Z0-9_]{0,255}`.

There can be multiple contracts with the same contract name in a
projects source files.


&lt;div id=&quot;term-contract-type&quot;&gt;&lt;/div&gt;

Contract Type
-------------

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.

Example:

    contract Wallet {
        ...
    }

A deployed instance of the `Wallet` contract would be of type
`Wallet`.


&lt;div id=&quot;term-identifier&quot;&gt;&lt;/div&gt;

Identifier
----------

Refers generally to a named entity in the [Package](#term-package).

A string matching the regular expression `[a-zA-Z][-_a-zA-Z0-9]{0,255}`


&lt;div id=&quot;term-link-reference&quot;&gt;&lt;/div&gt;

Link Reference
--------------

A location within a contract’s bytecode which needs to be linked. A link
reference has the following properties.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;offset&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Defines the location within the bytecode where the link reference begins.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;even&quot;&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;length&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Defines the length of the reference.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;name&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;(optional.) A string to identify the reference&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;term-link-value&quot;&gt;&lt;/div&gt;

Link Value
----------

A link value is the value which can be inserted in place of a [Link
Reference](#term-link-reference)


&lt;div id=&quot;term-linking&quot;&gt;&lt;/div&gt;

Linking
-------

The act of replacing [Link References](#term-link-reference) with [Link
Values](#term-link-value) within some [Bytecode](#term-bytecode).


&lt;div id=&quot;term-package&quot;&gt;&lt;/div&gt;

Package
-------

Distribution of an application’s source or compiled bytecode along with
metadata related to authorship, license, versioning, et al.

For brevity, the term **Package** is often used metonymously to mean
[Package Manifest](#term-package-manifest).


&lt;div id=&quot;term-package-manifest&quot;&gt;&lt;/div&gt;

Package Manifest
----------------

A machine-readable description of a package (See
[Specification](#package-specification) for information about the format
for package manifests.)


&lt;div id=&quot;term-prefixed&quot;&gt;&lt;/div&gt;

Prefixed
--------

[Bytecode](#term-bytecode) string with leading `0x`.

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Example&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;0xdeadbeef&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;div id=&quot;term-unprefixed&quot;&gt;&lt;/div&gt;

Unprefixed
----------

Not [Prefixed](#term-prefixed).

&lt;table&gt;
&lt;colgroup&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;col style=&quot;width: 50%&quot; /&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr class=&quot;odd&quot;&gt;
&lt;td&gt;&lt;p&gt;Example&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;code&gt;deadbeef&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


Backwards Compatibility
=======================

This specification supports backwards compatibility by use of the
[manifest\_version](#manifest-version) property. This
specification corresponds to version `2` as the value for that field.


Implementations
===============

This submission aims to coincide with development efforts towards
widespread implementation in commonly-used development tools.

The following tools are known to have begun or are nearing completion of
a supporting implementation.

-   [Truffle](https://trufflesuite.com/)

-   [Populus](https://populus.readthedocs.io/en/latest/)

-   [Embark](https://embark.status.im/)

Full support in implementation **may** require [Further
Work](#further-work), specified below.


Further Work
============

This EIP addresses only the data format for package descriptions.
Excluded from the scope of this specification are:

-   Package registry interface definition

-   Tooling integration, or how packages are stored on disk.

These efforts **should** be considered separate, warranting future
dependent EIP submssions.


Acknowledgements
================

The authors of this document would like to thank the original authors of
[EIP-190](./eip-190.md),
[ETHPrize](http://ethprize.io/) for their funding
support, all community
[contributors](https://github.com/ethpm/ethpm-spec/graphs/contributors),
and the Ethereum community at large.


Copyright
=========

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 01 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1123</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1123</guid>
      </item>
    
      <item>
        <title>Standardised DAPP announcements</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-sda-standardised-dapp-announcements/508?u=thunderdeliverer</comments>
        
        <description>## Simple Summary
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.

## Abstract
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.

## Motivation
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&apos;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&apos;s status.

## Specification

### Structures

#### Announcer

Stores information about the announcement maker. The `allowedToPost` stores posting permissions and is used for modifiers limiting announcement posting only to authorised entities. The `name` is used for human friendly identifier of the author to be stored.

``` js
struct Announcer{
  bool allowedToPost;
  string name;
}
```


#### Announcement

Stores information about the individual announcement. The human friendly author identifier is stored in `author`. Ethereum address associated with the author is stored in `authorAddress`. The announcement itself is stored in `post`.

``` js
struct Announcement{
  string author;
  address authorAddress;
  string post;
}
```



### Methods
#### the number of announcements

Returns the number of announcements currently active.

OPTIONAL - this method can be used to provide quicker information for the UI, but could also be retrieved from `numberOfMessages` variable.

``` js
function theNumberOfAnnouncements() public constant returns(uint256 _numberOfAnnouncements)
```


#### read posts

Returns the specified announcement as well as human friendly poster identificator (name or nickname).

``` js
function readPosts(uint256 _postNumber) public constant returns(string _author, string _post)
```


#### give posting permission

Sets posting permissions of the address `_newAnnouncer` to `_postingPrivileges` and can also be used to revoke those permissions. The `_posterName` is human friendly author identificator used in the announcement data.

``` js
function givePostingPermission(address _newAnnouncer, bool _postingPrivileges, string _posterName) public onlyOwner returns(bool success)
```


#### can post

Checks if the entity that wants to post an announcement has the posting privilieges.

``` js
modifier canPost{
 require(posterData[msg.sender].allowedToPost);
 _;
}
```


#### post announcement

Lets user post announcements, but only if they have their posting privileges set to `true`. The announcement is sent in `_message` variable.

``` js
function postAnnouncement(string _message) public canPost
```


#### remove announcement

Removes an announcement with `_messageNumber` announcement identifier and rearranges the mapping so there are no empty slots. The `_removalReason` is used to update users if the issue that caused the announcement is resolved or what are the next steps from the service provider / DAPP development team.

``` js
function removeAnnouncement(uint256 _messageNumber, string _removalReason) public
```



### Events

#### New announcement

MUST trigger when new announcement is created.

Every time there is a new announcement it should be advertised in this event. It holds the information about author `author` and the announcement istelf `message`.

``` js
event NewAnnouncement(string author, string message)
```


#### Removed announcement

MUST trigger when an announcement is removed.

Every time an announcement is removed it should be advertised in this event. It holds the information about author `author`, the announcement itself `message`, the reason for removal or explanation of the solution `reason` and the address of the entity that removed the announcement `remover`.

``` js
event RemovedAnnouncement(string author, string message, string reason, address remover);
```

## Rationale
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.

## Test Cases
The proposed version is deployed on Ropsten testnet all of the information can be found [here](https://ropsten.etherscan.io/address/0xb04f67172b9733837e59ebaf03d277279635c8e6#readContract).

## Implementation

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 31 May 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1129</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1129</guid>
      </item>
    
      <item>
        <title>Extending ERC20 with token locking capability</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1132</comments>
        
        <description>## Simple Summary

An extension to the ERC20 standard with methods for time-locking of tokens within a contract.

## Abstract

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. 

Time-locking can also be achieved via staking (#900), but that requires transfer of tokens to an escrow contract / stake manager, resulting in the following six concerns: 

1. additional trust on escrow contract / stake manager 
2. additional approval process for token transfer
3. increased ops costs due to gas requirements in transfers
4. tough user experience as the user needs to claim the amount back from external escrows 
5. inability for the user to track their true token balance / token activity 
6. inability for the user to utilize their locked tokens within the token ecosystem.

## Motivation

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. 

In [Nexus Mutual](https://nexusmutual.io), 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/identity verification or participation in gamified token curated registries where time-locked tokens are required as well. 

In [GovBlocks](https://govblocks.io), 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. 

In addition to locking functionality, I have proposed a `Lock()` and `Unlock()` event, just like the `Transfer()` 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 `balanceOf()` queries are triggered on token holder’s account – the result does not include locked tokens. A `totalBalanceOf()` function intends to solve this problem.  

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 / stake manager and at the same time allow members to use the locked tokens for multiple utilities.

## Specification

I’ve extended the ERC20 interface with the following enhancements:

### Locking of tokens
```solidity
/**
  * @dev Locks a specified amount of tokens against an address,
  *      for a specified reason and time
  * @param _reason The reason to lock tokens
  * @param _amount Number of tokens to be locked
  * @param _time Lock time in seconds
  */
function lock(bytes32 _reason, uint256 _amount, uint256 _time) public returns (bool)
```

### Fetching number of tokens locked under each utility
```solidity
/**
  * @dev Returns tokens locked for a specified address for a
  *      specified reason
  *
  * @param _of The address whose tokens are locked
  * @param _reason The reason to query the lock tokens for
  */
   tokensLocked(address _of, bytes32 _reason) view returns (uint256 amount)
```

### Fetching number of tokens locked under each utility at a future timestamp
```solidity
/**
  * @dev Returns tokens locked for a specified address for a
  *      specified reason at a specific time
  *
  * @param _of The address whose tokens are locked
  * @param _reason The reason to query the lock tokens for
  * @param _time The timestamp to query the lock tokens for
  */
  function tokensLockedAtTime(address _of, bytes32 _reason, uint256 _time) public view returns (uint256 amount)
```

### Fetching number of tokens held by an address
```solidity
/**
  * @dev @dev Returns total tokens held by an address (locked + transferable)
  * @param _of The address to query the total balance of
  */
function totalBalanceOf(address _of)  view returns (uint256 amount)
```

### Extending lock period
```solidity
/**
  * @dev Extends lock for a specified reason and time
  * @param _reason The reason to lock tokens
  * @param _time Lock extension time in seconds
  */
  function extendLock(bytes32 _reason, uint256 _time) public returns (bool)
```

### Increasing number of tokens locked
```solidity
/**
  * @dev Increase number of tokens locked for a specified reason
  * @param _reason The reason to lock tokens
  * @param _amount Number of tokens to be increased
  */
  function increaseLockAmount(bytes32 _reason, uint256 _amount) public returns (bool)
```
### Fetching number of unlockable tokens under each utility
```solidity
/**
  * @dev Returns unlockable tokens for a specified address for a specified reason
  * @param _of The address to query the unlockable token count of
  * @param _reason The reason to query the unlockable tokens for
  */
  function tokensUnlockable(address _of, bytes32 _reason) public view returns (uint256 amount)
 ```    
### Fetching number of unlockable tokens
```solidity
/**
  * @dev Gets the unlockable tokens of a specified address
  * @param _of The address to query the unlockable token count of
  */
  function getUnlockableTokens(address _of) public view returns (uint256 unlockableTokens)
```
### Unlocking tokens
```solidity
/**
  * @dev Unlocks the unlockable tokens of a specified address
  * @param _of Address of user, claiming back unlockable tokens
  */
  function unlock(address _of) public returns (uint256 unlockableTokens)
```

### Lock event recorded in the token contract
`event Locked(address indexed _of, uint256 indexed _reason, uint256 _amount, uint256 _validity)`

### Unlock event recorded in the token contract
`event Unlocked(address indexed _of, uint256 indexed _reason, uint256 _amount)`

## Test Cases

Test cases are available at [https://github.com/nitika-goel/lockable-token](https://github.com/nitika-goel/lockable-token).

## Implementation

- Complete implementation available at https://github.com/nitika-goel/lockable-token
- [GovBlocks](https://govblocks.io) Project specific implementation available at https://github.com/somish/govblocks-protocol/blob/Locking/contracts/GBTStandardToken.sol

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 03 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1132</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1132</guid>
      </item>
    
      <item>
        <title>Oracle Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1161</comments>
        
        <description>## Simple Summary
A standard interface for oracles.

## Abstract
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.

## Motivation
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/ports specific to the oracle system chosen in a given project.

Beyond naming differences, there is also the issue of whether or not an oracle report-resolving transaction _pushes_ state changes by calling affected contracts, or changes the oracle state allowing dependent contracts to _pull_ the updated value from the oracle. These differing system semantics could introduce inefficiencies when adapting between them.

Ultimately, the value in different oracle systems comes from their underlying resolution mechanics, and points where these systems are virtually identical should be standardized.

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).

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.

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.

## Specification

&lt;dl&gt;
  &lt;dt&gt;Oracle&lt;/dt&gt;
  &lt;dd&gt;An entity which reports data to the blockchain.&lt;/dd&gt;

  &lt;dt&gt;Oracle consumer&lt;/dt&gt;
  &lt;dd&gt;A smart contract which receives data from an oracle.&lt;/dd&gt;

  &lt;dt&gt;ID&lt;/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;/dd&gt;

  &lt;dt&gt;Result&lt;/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;/dd&gt;

  &lt;dt&gt;Report&lt;/dt&gt;
  &lt;dd&gt;A pair (ID, result) which an oracle sends to an oracle consumer.&lt;/dd&gt;
&lt;/dl&gt;

```solidity
interface OracleConsumer {
    function receiveResult(bytes32 id, bytes result) external;
}
```

`receiveResult` MUST revert if the `msg.sender` is not an oracle authorized to provide the `result` for that `id`.

`receiveResult` MUST revert if `receiveResult` has been called with the same `id` before.

`receiveResult` MAY revert if the `id` or `result` cannot be handled by the consumer.

Consumers MUST coordinate with oracles to determine how to encode/decode results to and from `bytes`. For example, `abi.encode` and `abi.decode` may be used to implement a codec for results in Solidity. `receiveResult` SHOULD revert if the consumer receives a unexpected result format from the oracle.

The oracle can be any Ethereum account.

## Rationale
The specs are currently very similar to what is implemented by ChainLink (which can use any arbitrarily-named callback) and Oraclize (which uses `__callback`).

With this spec, the oracle _pushes_ state to the consumer, which must react accordingly to the updated state. An alternate _pull_-based interface can be prescribed, as follows:

### Alternate Pull-based Interface
Here are alternate specs loosely based on Gnosis prediction market contracts v1. Reality Check also exposes a similar endpoint (`getFinalAnswer`).

```solidity
interface Oracle {
    function resultFor(bytes32 id) external view returns (bytes result);
}
```

`resultFor` MUST revert if the result for an `id` is not available yet.

`resultFor` MUST return the same result for an `id` after that result is available.

### Push vs Pull
Note that push-based interfaces may be adapted into pull-based interfaces. Simply deploy an oracle consumer which stores the result received and implements `resultFor` accordingly.

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 `receiveResult` on that address.

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.

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.

#### Multiple Oracle Consumers
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).

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.

Transaction-wise, both systems are roughly equivalent in efficiency in this scenario, but in the push-based system, there&apos;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.

#### Result Immutability
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.

For data which mutates over time, the `id` 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).

## Implementation

* [Tidbit](https://github.com/levelkdev/tidbit) tracks this EIP.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 13 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1154</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1154</guid>
      </item>
    
      <item>
        <title>Multi Token Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1155</comments>
        
        <description>## Simple Summary

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).

## Abstract

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&apos;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.

The `_id` argument contained in each function&apos;s argument set indicates a specific token or token type in a transaction.

## Motivation

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.

New functionality is possible with this design such as transferring multiple token types at once, saving on transaction costs. Trading (escrow / 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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

**Smart contracts implementing the ERC-1155 standard MUST implement all of the functions in the `ERC1155` interface.**

**Smart contracts implementing the ERC-1155 standard MUST implement the ERC-165 `supportsInterface` function and MUST return the constant value `true` if `0xd9b67a26` is passed through the `interfaceID` argument.**

```solidity
pragma solidity ^0.5.9;

/**
    @title ERC-1155 Multi Token Standard
    @dev See https://eips.ethereum.org/EIPS/eip-1155
    Note: The ERC-165 identifier for this interface is 0xd9b67a26.
 */
interface ERC1155 /* is ERC165 */ {
    /**
        @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see &quot;Safe Transfer Rules&quot; section of the standard).
        The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
        The `_from` argument MUST be the address of the holder whose balance is decreased.
        The `_to` argument MUST be the address of the recipient whose balance is increased.
        The `_id` argument MUST be the token type being transferred.
        The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
        When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
        When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).        
    */
    event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);

    /**
        @dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see &quot;Safe Transfer Rules&quot; section of the standard).      
        The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
        The `_from` argument MUST be the address of the holder whose balance is decreased.
        The `_to` argument MUST be the address of the recipient whose balance is increased.
        The `_ids` argument MUST be the list of tokens being transferred.
        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.
        When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
        When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).                
    */
    event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);

    /**
        @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absence of an event assumes disabled).        
    */
    event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

    /**
        @dev MUST emit when the URI is updated for a token ID.
        URIs are defined in RFC 3986.
        The URI MUST point to a JSON file that conforms to the &quot;ERC-1155 Metadata URI JSON Schema&quot;.
    */
    event URI(string _value, uint256 indexed _id);

    /**
        @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
        @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see &quot;Approval&quot; section of the standard).
        MUST revert if `_to` is the zero address.
        MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
        MUST revert on any other error.
        MUST emit the `TransferSingle` event to reflect the balance change (see &quot;Safe Transfer Rules&quot; section of the standard).
        After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size &gt; 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see &quot;Safe Transfer Rules&quot; section of the standard).        
        @param _from    Source address
        @param _to      Target address
        @param _id      ID of the token type
        @param _value   Transfer amount
        @param _data    Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
    */
    function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;

    /**
        @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
        @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see &quot;Approval&quot; section of the standard).
        MUST revert if `_to` is the zero address.
        MUST revert if length of `_ids` is not the same as length of `_values`.
        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.
        MUST revert on any other error.        
        MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see &quot;Safe Transfer Rules&quot; section of the standard).
        Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
        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 &gt; 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see &quot;Safe Transfer Rules&quot; section of the standard).                      
        @param _from    Source address
        @param _to      Target address
        @param _ids     IDs of each token type (order and length must match _values array)
        @param _values  Transfer amounts per token type (order and length must match _ids array)
        @param _data    Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
    */
    function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;

    /**
        @notice Get the balance of an account&apos;s tokens.
        @param _owner  The address of the token holder
        @param _id     ID of the token
        @return        The _owner&apos;s balance of the token type requested
     */
    function balanceOf(address _owner, uint256 _id) external view returns (uint256);

    /**
        @notice Get the balance of multiple account/token pairs
        @param _owners The addresses of the token holders
        @param _ids    ID of the tokens
        @return        The _owner&apos;s balance of the token types requested (i.e. balance for each (owner, id) pair)
     */
    function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);

    /**
        @notice Enable or disable approval for a third party (&quot;operator&quot;) to manage all of the caller&apos;s tokens.
        @dev MUST emit the ApprovalForAll event on success.
        @param _operator  Address to add to the set of authorized operators
        @param _approved  True if the operator is approved, false to revoke approval
    */
    function setApprovalForAll(address _operator, bool _approved) external;

    /**
        @notice Queries the approval status of an operator for a given owner.
        @param _owner     The owner of the tokens
        @param _operator  Address of authorized operator
        @return           True if the operator is approved, false if not
    */
    function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}
```

### ERC-1155 Token Receiver

**Smart contracts MUST implement all of the functions in the `ERC1155TokenReceiver` interface to accept transfers. See &quot;Safe Transfer Rules&quot; for further detail.**

**Smart contracts MUST implement the ERC-165 `supportsInterface` function and signify support for the `ERC1155TokenReceiver` interface to accept transfers. See &quot;ERC1155TokenReceiver ERC-165 rules&quot; for further detail.**

```solidity
pragma solidity ^0.5.9;

/**
    Note: The ERC-165 identifier for this interface is 0x4e2312e0.
*/
interface ERC1155TokenReceiver {
    /**
        @notice Handle the receipt of a single ERC1155 token type.
        @dev 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.        
        This function MUST return `bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;))` (i.e. 0xf23a6e61) if it accepts the transfer.
        This function MUST revert if it rejects the transfer.
        Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.
        @param _operator  The address which initiated the transfer (i.e. msg.sender)
        @param _from      The address which previously owned the token
        @param _id        The ID of the token being transferred
        @param _value     The amount of tokens being transferred
        @param _data      Additional data with no specified format
        @return           `bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;))`
    */
    function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _value, bytes calldata _data) external returns(bytes4);

    /**
        @notice Handle the receipt of multiple ERC1155 token types.
        @dev 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.        
        This function MUST return `bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))` (i.e. 0xbc197c81) if it accepts the transfer(s).
        This function MUST revert if it rejects the transfer(s).
        Return of any other value than the prescribed keccak256 generated value MUST result in the transaction being reverted by the caller.
        @param _operator  The address which initiated the batch transfer (i.e. msg.sender)
        @param _from      The address which previously owned the token
        @param _ids       An array containing ids of each token being transferred (order and length must match _values array)
        @param _values    An array containing amounts of each token being transferred (order and length must match _ids array)
        @param _data      Additional data with no specified format
        @return           `bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))`
    */
    function onERC1155BatchReceived(address _operator, address _from, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external returns(bytes4);       
}
```

### Safe Transfer Rules

To be more explicit about how the standard `safeTransferFrom` and `safeBatchTransferFrom` functions MUST operate with respect to the `ERC1155TokenReceiver` hook functions, a list of scenarios and rules follows.

#### Scenarios

**_Scenario#1 :_** The recipient is not a contract.
* `onERC1155Received` and `onERC1155BatchReceived` MUST NOT be called on an EOA (Externally Owned Account).

**_Scenario#2 :_** The transaction is not a mint/transfer of a token.
* `onERC1155Received` and `onERC1155BatchReceived` MUST NOT be called outside of a mint or transfer process.

**_Scenario#3 :_** The receiver does not implement the necessary `ERC1155TokenReceiver` interface function(s).
* The transfer MUST be reverted with the one caveat below.
    - If the token(s) being sent are part of a hybrid implementation of another standard, that particular standard&apos;s rules on sending to a contract MAY now be followed instead. See &quot;Backwards Compatibility&quot; section.

**_Scenario#4 :_** The receiver implements the necessary `ERC1155TokenReceiver` interface function(s) but returns an unknown value.
* The transfer MUST be reverted.

**_Scenario#5 :_** The receiver implements the necessary `ERC1155TokenReceiver` interface function(s) but throws an error.
* The transfer MUST be reverted.

**_Scenario#6 :_** The receiver implements the `ERC1155TokenReceiver` interface and is the recipient of one and only one balance change (e.g. `safeTransferFrom` called).
* The balances for the transfer MUST have been updated before the `ERC1155TokenReceiver` hook is called on a recipient contract.
* The transfer event MUST have been emitted to reflect the balance changes before the `ERC1155TokenReceiver` hook is called on the recipient contract.
* One of `onERC1155Received` or `onERC1155BatchReceived` MUST be called on the recipient contract.
* The `onERC1155Received` hook SHOULD be called on the recipient contract and its rules followed.
    - See &quot;onERC1155Received rules&quot; for further rules that MUST be followed.
* The `onERC1155BatchReceived` hook MAY be called on the recipient contract and its rules followed.
    - See &quot;onERC1155BatchReceived rules&quot; for further rules that MUST be followed.

**_Scenario#7 :_** The receiver implements the `ERC1155TokenReceiver` interface and is the recipient of more than one balance change (e.g. `safeBatchTransferFrom` called).
* All balance transfers that are referenced in a call to an `ERC1155TokenReceiver` hook MUST be updated before the `ERC1155TokenReceiver` hook is called on the recipient contract.
* All transfer events MUST have been emitted to reflect current balance changes before an `ERC1155TokenReceiver` hook is called on the recipient contract.
* `onERC1155Received` or `onERC1155BatchReceived` 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.
    - 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;.
* The `onERC1155BatchReceived` hook SHOULD be called on the recipient contract and its rules followed.    
    - See &quot;onERC1155BatchReceived rules&quot; for further rules that MUST be followed.
* The `onERC1155Received` hook MAY be called on the recipient contract and its rules followed.    
    - See &quot;onERC1155Received rules&quot; for further rules that MUST be followed.
    
**_Scenario#8 :_** You are the creator of a contract that implements the `ERC1155TokenReceiver` interface and you forward the token(s) onto another address in one or both of `onERC1155Received` and `onERC1155BatchReceived`.
* Forwarding should be considered acceptance and then initiating a new `safeTransferFrom` or `safeBatchTransferFrom` in a new context.
    - The prescribed keccak256 acceptance value magic for the receiver hook being called MUST be returned after forwarding is successful.
* The `_data` argument MAY be re-purposed for the new context.
* If forwarding fails the transaction MAY be reverted.
    - If the contract logic wishes to keep the ownership of the token(s) itself in this case it MAY do so.
    
**_Scenario#9 :_** You are transferring tokens via a non-standard API call i.e. an implementation specific API and NOT `safeTransferFrom` or `safeBatchTransferFrom`.
* In this scenario all balance updates and events output rules are the same as if a standard transfer function had been called.
    - 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 `TransferSingle` and `TransferBatch` events alone.
* If the receiver is a contract the `ERC1155TokenReceiver` hooks still need to be called on it and the return values respected the same as if a standard transfer function had been called. 
    - However while the `safeTransferFrom` or `safeBatchTransferFrom` functions MUST revert if a receiving contract does not implement the `ERC1155TokenReceiver` interface, a non-standard function MAY proceed with the transfer.
    - See &quot;Implementation specific transfer API rules&quot;.


#### Rules

**_safeTransferFrom rules:_**
* Caller must be approved to manage the tokens being transferred out of the `_from` account (see &quot;Approval&quot; section).
* MUST revert if `_to` is the zero address.
* MUST revert if balance of holder for token `_id` is lower than the `_value` sent to the recipient.
* MUST revert on any other error.
* MUST emit the `TransferSingle` event to reflect the balance change (see &quot;TransferSingle and TransferBatch event rules&quot; section).
* After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size &gt; 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see &quot;onERC1155Received rules&quot; section).
    - The `_data` argument provided by the sender for the transfer MUST be passed with its contents unaltered to the `onERC1155Received` hook function via its `_data` argument.

**_safeBatchTransferFrom rules:_**
* Caller must be approved to manage all the tokens being transferred out of the `_from` account (see &quot;Approval&quot; section).
* MUST revert if `_to` is the zero address.
* MUST revert if length of `_ids` is not the same as length of `_values`.
* 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.
* MUST revert on any other error.
* MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see &quot;TransferSingle and TransferBatch event rules&quot; section).
* The balance changes and events MUST occur in the array order they were submitted (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
* After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size &gt; 0). If so, it MUST call `onERC1155Received` or `onERC1155BatchReceived` on `_to` and act appropriately (see &quot;onERC1155Received and onERC1155BatchReceived rules&quot; section).
    - The `_data` argument provided by the sender for the transfer MUST be passed with its contents unaltered to the `ERC1155TokenReceiver` hook function(s) via their `_data` argument.

**_TransferSingle and TransferBatch event rules:_**
* `TransferSingle` SHOULD be used to indicate a single balance transfer has occurred between a `_from` and `_to` pair.
    - It MAY be emitted multiple times to indicate multiple balance changes in the transaction, but note that `TransferBatch` is designed for this to reduce gas consumption.
    - The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
    - The `_from` argument MUST be the address of the holder whose balance is decreased.
    - The `_to` argument MUST be the address of the recipient whose balance is increased.
    - The `_id` argument MUST be the token type being transferred.
    - The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
    - When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). See &quot;Minting/creating and burning/destroying rules&quot;.
    - When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). See &quot;Minting/creating and burning/destroying rules&quot;.
* `TransferBatch` SHOULD be used to indicate multiple balance transfers have occurred between a `_from` and `_to` pair.
    - It MAY be emitted with a single element in the list to indicate a singular balance change in the transaction, but note that `TransferSingle` is designed for this to reduce gas consumption.
    - The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
    - The `_from` argument MUST be the address of the holder whose balance is decreased for each entry pair in `_ids` and `_values`.
    - The `_to` argument MUST be the address of the recipient whose balance is increased for each entry pair in `_ids` and `_values`.
    - The `_ids` array argument MUST contain the ids of the tokens being transferred.
    - The `_values` array argument MUST contain the number of token to be transferred for each corresponding entry in `_ids`.
    - `_ids` and `_values` MUST have the same length.
    - When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). See &quot;Minting/creating and burning/destroying rules&quot;.
    - When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). See &quot;Minting/creating and burning/destroying rules&quot;.
* The total value transferred from address `0x0` minus the total value transferred to `0x0` observed via the `TransferSingle` and `TransferBatch` events MAY be used by clients and exchanges to determine the &quot;circulating supply&quot; for a given token ID.
* To broadcast the existence of a token ID with no initial balance, the contract SHOULD emit the `TransferSingle` event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_value` of 0.
* All `TransferSingle` and `TransferBatch` events MUST be emitted to reflect all the balance changes that have occurred before any call(s) to `onERC1155Received` or `onERC1155BatchReceived`.
    - 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.

**_onERC1155Received rules:_**
- The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
* The `_from` argument MUST be the address of the holder whose balance is decreased.
    - `_from` MUST be 0x0 for a mint.
* The `_id` argument MUST be the token type being transferred.
* The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
* The `_data` argument MUST contain the information provided by the sender for the transfer with its contents unaltered.
    - i.e. it MUST pass on the unaltered `_data` argument sent via the `safeTransferFrom` or `safeBatchTransferFrom` call for this transfer.
* The recipient contract MAY accept an increase of its balance by returning the acceptance magic value `bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;))`
    - If the return value is `bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;))` the transfer MUST be completed or MUST revert if any other conditions are not met for success.
* The recipient contract MAY reject an increase of its balance by calling revert.
    - If the recipient contract throws/reverts the transaction MUST be reverted.
* If the return value is anything other than `bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;))` the transaction MUST be reverted.
* `onERC1155Received` (and/or `onERC1155BatchReceived`) MAY be called multiple times in a single transaction and the following requirements must be met:
    - All callbacks represent mutually exclusive balance changes.
    - The set of all calls to `onERC1155Received` and `onERC1155BatchReceived` describes all balance changes that occurred during the transaction in the order submitted.
* A contract MAY skip calling the `onERC1155Received` hook function if the transfer operation is transferring the token to itself.

**_onERC1155BatchReceived rules:_**
- The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender).
* The `_from` argument MUST be the address of the holder whose balance is decreased.
    - `_from` MUST be 0x0 for a mint.    
* The `_ids` argument MUST be the list of tokens being transferred.
* 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.
* The `_data` argument MUST contain the information provided by the sender for the transfer with its contents unaltered.
    - i.e. it MUST pass on the unaltered `_data` argument sent via the `safeBatchTransferFrom` call for this transfer.
* The recipient contract MAY accept an increase of its balance by returning the acceptance magic value `bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))`
    - If the return value is `bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))` the transfer MUST be completed or MUST revert if any other conditions are not met for success.
* The recipient contract MAY reject an increase of its balance by calling revert.
    - If the recipient contract throws/reverts the transaction MUST be reverted.
* If the return value is anything other than `bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))` the transaction MUST be reverted.
* `onERC1155BatchReceived` (and/or `onERC1155Received`) MAY be called multiple times in a single transaction and the following requirements must be met:
    - All callbacks represent mutually exclusive balance changes.
    - The set of all calls to `onERC1155Received` and `onERC1155BatchReceived` describes all balance changes that occurred during the transaction in the order submitted.
* A contract MAY skip calling the `onERC1155BatchReceived` hook function if the transfer operation is transferring the token(s) to itself.
    
**_ERC1155TokenReceiver ERC-165 rules:_**
* The implementation of the ERC-165 `supportsInterface` function SHOULD be as follows:
    ```solidity
    function supportsInterface(bytes4 interfaceID) external view returns (bool) {
        return  interfaceID == 0x01ffc9a7 ||    // ERC-165 support (i.e. `bytes4(keccak256(&apos;supportsInterface(bytes4)&apos;))`).
                interfaceID == 0x4e2312e0;      // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;)) ^ bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))`).
    }
    ```
* The implementation MAY differ from the above but:
  - It MUST return the constant value `true` if `0x01ffc9a7` is passed through the `interfaceID` argument. This signifies ERC-165 support.
  - It MUST return the constant value `true` if `0x4e2312e0` is passed through the `interfaceID` argument. This signifies ERC-1155 `ERC1155TokenReceiver` support.
  - It MUST NOT consume more than 10,000 gas.
    - 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.

**_Implementation specific transfer API rules:_**
* If an implementation specific API function is used to transfer ERC-1155 token(s) to a contract, the `safeTransferFrom` or `safeBatchTransferFrom` (as appropriate) rules MUST still be followed if the receiver implements the `ERC1155TokenReceiver` interface. If it does not the non-standard implementation SHOULD revert but MAY proceed.    
* An example:
    1. An approved user calls a function such as `function myTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values);`.
    2. `myTransferFrom` updates the balances for `_from` and `_to` addresses for all `_ids` and `_values`.
    3. `myTransferFrom` emits `TransferBatch` with the details of what was transferred from address `_from` to address `_to`.
    4. `myTransferFrom` checks if `_to` is a contract address and determines that it is so (if not, then the transfer can be considered successful).
    5. `myTransferFrom` calls `onERC1155BatchReceived` on `_to` and it reverts or returns an unknown value (if it had returned `bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))` the transfer can be considered successful).    
    6. At this point `myTransferFrom` SHOULD revert the transaction immediately as receipt of the token(s) was not explicitly accepted by the `onERC1155BatchReceived` function.            
    7. If however `myTransferFrom` wishes to continue it MUST call `supportsInterface(0x4e2312e0)` on `_to` and if it returns the constant value `true` the transaction MUST be reverted, as it is now known to be a valid receiver and the previous acceptance step failed. 
        - NOTE: You could have called `supportsInterface(0x4e2312e0)` at a previous step if you wanted to gather and act upon that information earlier, such as in a hybrid standards scenario.
    8. If the above call to `supportsInterface(0x4e2312e0)` on `_to` reverts or returns a value other than the constant value `true` the `myTransferFrom` function MAY consider this transfer successful.
        - __NOTE__: this MAY result in unrecoverable tokens if sent to an address that does not expect to receive ERC-1155 tokens.
* The above example is not exhaustive but illustrates the major points (and shows that most are shared with `safeTransferFrom` and `safeBatchTransferFrom`):
    - Balances that are updated MUST have equivalent transfer events emitted.
    - A receiver address has to be checked if it is a contract and if so relevant `ERC1155TokenReceiver` hook function(s) have to be called on it. 
    - Balances (and events associated) that are referenced in a call to an `ERC1155TokenReceiver` hook MUST be updated (and emitted) before the `ERC1155TokenReceiver` hook is called.
    - The return values of the `ERC1155TokenReceiver` hook functions that are called MUST be respected if they are implemented.    
    - Only non-standard transfer functions MAY allow tokens to be sent to a recipient contract that does NOT implement the necessary `ERC1155TokenReceiver` hook functions. `safeTransferFrom` and `safeBatchTransferFrom` MUST revert in that case (unless it is a hybrid standards implementation see &quot;Backwards Compatibility&quot;).

**_Minting/creating and burning/destroying rules:_**
* A mint/create operation is essentially a specialized transfer and MUST follow these rules:
    - To broadcast the existence of a token ID with no initial balance, the contract SHOULD emit the `TransferSingle` event from `0x0` to `0x0`, with the token creator as `_operator`, and a `_value` of 0.
    - The &quot;TransferSingle and TransferBatch event rules&quot; MUST be followed as appropriate for the mint(s) (i.e. singles or batches) however the `_from` argument MUST be set to `0x0` (i.e. zero address) to flag the transfer as a mint to contract observers.
        - __NOTE:__ 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.            
* A burn/destroy operation is essentially a specialized transfer and MUST follow these rules:
    - The &quot;TransferSingle and TransferBatch event rules&quot; MUST be followed as appropriate for the burn(s) (i.e. singles or batches) however the `_to` argument MUST be set to `0x0` (i.e. zero address) to flag the transfer as a burn to contract observers.           
    - When burning/destroying you do not have to actually transfer to `0x0` (that is impl specific), only the `_to` argument in the event MUST be set to `0x0` as above.
* The total value transferred from address `0x0` minus the total value transferred to `0x0` observed via the `TransferSingle` and `TransferBatch` events MAY be used by clients and exchanges to determine the &quot;circulating supply&quot; for a given token ID.
* As mentioned above mint/create and burn/destroy operations are specialized transfers and so will likely be accomplished with custom transfer functions rather than `safeTransferFrom` or `safeBatchTransferFrom`. If so the &quot;Implementation specific transfer API rules&quot; section would be appropriate.   
    - Even in a non-safe API and/or hybrid standards case the above event rules MUST still be adhered to when minting/creating or burning/destroying.
* A contract MAY skip calling the `ERC1155TokenReceiver` hook function(s) if the mint operation is transferring the token(s) to itself. In all other cases the `ERC1155TokenReceiver` rules MUST be followed as appropriate for the implementation (i.e. safe, custom and/or hybrid). 


##### A solidity example of the keccak256 generated constants for the various magic values (these MAY be used by implementation):

```solidity
bytes4 constant public ERC1155_ERC165 = 0xd9b67a26; // ERC-165 identifier for the main token standard.
bytes4 constant public ERC1155_ERC165_TOKENRECEIVER = 0x4e2312e0; // ERC-165 identifier for the `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;)) ^ bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))`).
bytes4 constant public ERC1155_ACCEPTED = 0xf23a6e61; // Return value from `onERC1155Received` call if a contract accepts receipt (i.e `bytes4(keccak256(&quot;onERC1155Received(address,address,uint256,uint256,bytes)&quot;))`).
bytes4 constant public ERC1155_BATCH_ACCEPTED = 0xbc197c81; // Return value from `onERC1155BatchReceived` call if a contract accepts receipt (i.e `bytes4(keccak256(&quot;onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)&quot;))`).
```

### Metadata

The URI value allows for ID substitution by clients. If the string `{id}` 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.

* The string format of the substituted hexadecimal ID MUST be lowercase alphanumeric: `[0-9a-f]` with no 0x prefix.
* 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: `https://token-cdn-domain/{id}.json` would be replaced with `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` if the client is referring to token ID 314592/0x4CCE0.

#### Metadata Extensions

The optional `ERC1155Metadata_URI` extension can be identified with the [ERC-165 Standard Interface Detection](./eip-165.md).

If the optional `ERC1155Metadata_URI` extension is included:
* The ERC-165 `supportsInterface` function MUST return the constant value `true` if `0x0e89341c` is passed through the `interfaceID` argument.
* _Changes_ to the URI MUST emit the `URI` event if the change can be expressed with an event (i.e. it isn&apos;t dynamic/programmatic).
    - An implementation MAY emit the `URI` event during a mint operation but it is NOT mandatory. An observer MAY fetch the metadata uri at mint time from the `uri` function if it was not emitted.    
* The `uri` function SHOULD be used to retrieve values if no event was emitted. 
* The `uri` function MUST return the same value as the latest event for an `_id` if it was emitted.
* The `uri` 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.

```solidity
pragma solidity ^0.5.9;

/**
    Note: The ERC-165 identifier for this interface is 0x0e89341c.
*/
interface ERC1155Metadata_URI {
    /**
        @notice A distinct Uniform Resource Identifier (URI) for a given token.
        @dev URIs are defined in RFC 3986.
        The URI MUST point to a JSON file that conforms to the &quot;ERC-1155 Metadata URI JSON Schema&quot;.        
        @return URI string
    */
    function uri(uint256 _id) external view returns (string memory);
}
```

#### ERC-1155 Metadata URI JSON Schema

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 `{id}` exists in any JSON value, it MUST be replaced with the actual token ID, by all client software that follows this standard.

* The string format of the substituted hexadecimal ID MUST be lowercase alphanumeric: `[0-9a-f]` with no 0x prefix.
* The string format of the substituted hexadecimal ID MUST be leading zero padded to 64 hex characters length if necessary.

```json
{
    &quot;title&quot;: &quot;Token Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset to which this token represents&quot;
        },
        &quot;decimals&quot;: {
            &quot;type&quot;: &quot;integer&quot;,
            &quot;description&quot;: &quot;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.&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset to which this token represents&quot;
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
        },
        &quot;properties&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;description&quot;: &quot;Arbitrary properties. Values may be strings, numbers, object or arrays.&quot;
        }
    }
}
```

An example of an ERC-1155 Metadata JSON file follows. The properties array proposes some SUGGESTED formatting for token-specific display properties and metadata.

```json
{
	&quot;name&quot;: &quot;Asset Name&quot;,
	&quot;description&quot;: &quot;Lorem ipsum...&quot;,
	&quot;image&quot;: &quot;https:\/\/s3.amazonaws.com\/your-bucket\/images\/{id}.png&quot;,
	&quot;properties&quot;: {
		&quot;simple_property&quot;: &quot;example value&quot;,
		&quot;rich_property&quot;: {
			&quot;name&quot;: &quot;Name&quot;,
			&quot;value&quot;: &quot;123&quot;,
			&quot;display_value&quot;: &quot;123 Example Value&quot;,
			&quot;class&quot;: &quot;emphasis&quot;,
			&quot;css&quot;: {
				&quot;color&quot;: &quot;#ffffff&quot;,
				&quot;font-weight&quot;: &quot;bold&quot;,
				&quot;text-decoration&quot;: &quot;underline&quot;
			}
		},
		&quot;array_property&quot;: {
			&quot;name&quot;: &quot;Name&quot;,
			&quot;value&quot;: [1,2,3,4],
			&quot;class&quot;: &quot;emphasis&quot;
		}
	}
}
```

##### Localization

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 `localization` attribute, its content MAY be used to provide localized values for fields that need it. The `localization` attribute should be a sub-object with three attributes: `uri`, `default` and `locales`. If the string `{locale}` exists in any URI, it MUST be replaced with the chosen locale by all client software.

##### JSON Schema

```json
{
    &quot;title&quot;: &quot;Token Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset to which this token represents&quot;,
        },
        &quot;decimals&quot;: {
            &quot;type&quot;: &quot;integer&quot;,
            &quot;description&quot;: &quot;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.&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset to which this token represents&quot;
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
        },
        &quot;properties&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;description&quot;: &quot;Arbitrary properties. Values may be strings, numbers, object or arrays.&quot;,
        },
        &quot;localization&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;required&quot;: [&quot;uri&quot;, &quot;default&quot;, &quot;locales&quot;],
            &quot;properties&quot;: {
                &quot;uri&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;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.&quot;
                },
                &quot;default&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;The locale of the default data within the base JSON&quot;
                },
                &quot;locales&quot;: {
                    &quot;type&quot;: &quot;array&quot;,
                    &quot;description&quot;: &quot;The list of locales for which data is available. These locales should conform to those defined in the Unicode Common Locale Data Repository (http://cldr.unicode.org/).&quot;
                }
            }
        }
    }
}
```

##### Localized Sample

Base URI:
```json
{
  &quot;name&quot;: &quot;Advertising Space&quot;,
  &quot;description&quot;: &quot;Each token represents a unique Ad space in the city.&quot;,
  &quot;localization&quot;: {
    &quot;uri&quot;: &quot;ipfs://QmWS1VAdMD353A6SDk9wNyvkT14kyCiZrNDYAad4w1tKqT/{locale}.json&quot;,
    &quot;default&quot;: &quot;en&quot;,
    &quot;locales&quot;: [&quot;en&quot;, &quot;es&quot;, &quot;fr&quot;]
  }
}
```

es.json:
```json
{
  &quot;name&quot;: &quot;Espacio Publicitario&quot;,
  &quot;description&quot;: &quot;Cada token representa un espacio publicitario único en la ciudad.&quot;
}
```

fr.json:
```json
{
  &quot;name&quot;: &quot;Espace Publicitaire&quot;,
  &quot;description&quot;: &quot;Chaque jeton représente un espace publicitaire unique dans la ville.&quot;
}
```

### Approval

The function `setApprovalForAll` allows an operator to manage one&apos;s entire set of tokens on behalf of the approver. To permit approval of a subset of token IDs, an interface such as [ERC-1761 Scoped Approval Interface](./eip-1761.md) is suggested.
The counterpart `isApprovedForAll` provides introspection into any status set by `setApprovalForAll`.

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 `setApprovalForAll` to approve themselves as an operator before they can operate on them.  

## Rationale

### Metadata Choices

The `symbol` 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 / asset and are also prone to collisions. Short-hand symbols are used in tickers and currency trading, but they aren&apos;t as useful outside of that space.

The `name` 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.

### Upgrades

The requirement to emit `TransferSingle` or `TransferBatch` 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 [EIP-2535](./eip-2535.md). This will also have the added benefit of providing a stable contract address for users.

### Design decision: Supporting non-batch

The standard supports `safeTransferFrom` and `onERC1155Received` functions because they are significantly cheaper for single token-type transfers, which is arguably a common use case.

### Design decision: Safe transfers only

The standard only supports safe-style transfers, making it possible for receiver contracts to depend on `onERC1155Received` or `onERC1155BatchReceived` function to be always called at the end of a transfer.

### Guaranteed log trace

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.

### Approval

The function `setApprovalForAll` allows an operator to manage one&apos;s entire set of tokens on behalf of the approver. It enables frictionless interaction with exchange and trade contracts.

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 [ERC-1761 Scoped Approval Interface](./eip-1761.md) which is compatible with ERC-1155.

## Backwards Compatibility

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 `ERC1155TokenReceiver` as per &quot;Safe Transfer Rules&quot; section above, specifically &quot;Scenario#3 : The receiver does not implement the necessary `ERC1155TokenReceiver` interface function(s)&quot;.

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 `onERC1155Received` or `onERC1155BatchReceived` are made.
Order of operation MUST therefore be:
1. The implementation MUST call the function `supportsInterface(0x4e2312e0)` on the recipient contract, providing at least 10,000 gas.
2. If the function call succeeds and the return value is the constant value `true` the implementation proceeds as a regular ERC-1155 implementation, with the call(s) to the `onERC1155Received` or `onERC1155BatchReceived` hooks and rules associated.
3. If the function call fails or the return value is NOT the constant value `true` the implementation can assume the recipient contract is not an `ERC1155TokenReceiver` and follow its other standard&apos;s rules for transfers. 
   
*__Note that a pure implementation of a single standard is recommended__* rather than a hybrid solution, but an example of a hybrid ERC-1155/ERC-721 contract is linked in the references section under implementations.

An important consideration is that even if the tokens are sent with another standard&apos;s rules the *__ERC-1155 transfer events MUST still be emitted.__* This is so the balances can still be determined via events alone as per ERC-1155 standard rules.

## Usage

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.

### Batch Transfers

The `safeBatchTransferFrom` 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.

Another advantage of standardized batch transfers is the ability for a smart contract to respond to the batch transfer in a single operation using `onERC1155BatchReceived`.

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 [Horizon Games - Multi-Token Standard](https://github.com/horizon-games/multi-token-standard) &quot;packed balance&quot; implementation for an example of this.

### Batch Balance

The `balanceOfBatch` function allows clients to retrieve balances of multiple owners and token IDs with a single call.

### Enumerating from events

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.

ERC-1155 contracts must therefore carefully emit `TransferSingle` or `TransferBatch` events in any instance where tokens are created, minted, transferred or destroyed.

### Non-Fungible Tokens

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. 

##### Split ID bits

The top 128 bits of the uint256 `_id` 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.

Non-fungible tokens can be interacted with using an index based accessor into the contract/token data set. Therefore to access a particular token set within a mixed data contract and a particular non-fungible within that set, `_id` could be passed as `&lt;uint128: base token id&gt;&lt;uint128: index of non-fungible&gt;`.

To identify a non-fungible set/category as a whole (or a fungible) you COULD just pass in the base id via the `_id` argument as `&lt;uint128: base token id&gt;&lt;uint128: zero&gt;`. If your implementation uses this technique this naturally means the index of a non-fungible SHOULD be 1-based.

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.

```solidity
uint256 baseTokenNFT = 12345 &lt;&lt; 128;
uint128 indexNFT = 50;

uint256 baseTokenFT = 54321 &lt;&lt; 128;

balanceOf(msg.sender, baseTokenNFT); // 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).
balanceOf(msg.sender, baseTokenNFT + indexNFT); // 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).
balanceOf(msg.sender, baseTokenFT); // Get balance of the fungible base token 54321.
```

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.

The [ERC-1155 Reference Implementation](https://github.com/enjin/erc-1155) is an example of the split ID bits strategy.

##### Natural Non-Fungible tokens

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.

## References

**Standards**
- [ERC-721 Non-Fungible Token Standard](./eip-721.md)
- [ERC-165 Standard Interface Detection](./eip-165.md)
- [ERC-1538 Transparent Contract Standard](./eip-1538.md)
- [JSON Schema](https://json-schema.org/)
- [RFC 2119 Key words for use in RFCs to Indicate Requirement Levels](https://www.ietf.org/rfc/rfc2119.txt)

**Implementations**
- [ERC-1155 Reference Implementation](https://github.com/enjin/erc-1155)
- [Horizon Games - Multi-Token Standard](https://github.com/horizon-games/multi-token-standard)
- [Enjin Coin](https://enjincoin.io) ([GitHub](https://github.com/enjin))
- [The Sandbox - Dual ERC-1155/721 Contract](https://github.com/pixowl/thesandbox-contracts/tree/master/src/Asset)

**Articles &amp; Discussions**
- [GitHub - Original Discussion Thread](https://github.com/ethereum/EIPs/issues/1155)
- [ERC-1155 - The Crypto Item Standard](https://blog.enjincoin.io/erc-1155-the-crypto-item-standard-ac9cf1c5a226)
- [Here Be Dragons - Going Beyond ERC-20 and ERC-721 To Reduce Gas Cost by ~80%](https://medium.com/horizongames/going-beyond-erc20-and-erc721-9acebd4ff6ef)
- [Blockonomi - Ethereum ERC-1155 Token Perfect for Online Games, Possibly More](https://blockonomi.com/erc1155-gaming-token/)
- [Beyond Gaming - Exploring the Utility of ERC-1155 Token Standard!](https://blockgeeks.com/erc-1155-token/)
- [ERC-1155: A new standard for The Sandbox](https://medium.com/sandbox-game/erc-1155-a-new-standard-for-the-sandbox-c95ee1e45072)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 17 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1155</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1155</guid>
      </item>
    
      <item>
        <title>Minimal Proxy Contract</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/optionality/clone-factory/issues/10</comments>
        
        <description>## Simple Summary
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.  
## Abstract
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).

## Motivation
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.

## Specification
The exact bytecode of the standard clone contract is this: `363d3d373d3d3d363d73bebebebebebebebebebebebebebebebebebebebe5af43d82803e903d91602b57fd5bf3` wherein the bytes at indices 10 - 29 (inclusive) are replaced with the 20 byte address of the master functionality contract.  

A reference implementation of this can be found at the [optionality/clone-factory](https://github.com/optionality/clone-factory) github repo. 

## Rationale
The goals of this effort have been the following:
- inexpensive deployment (low gas to deploy clones)
- support clone initialization in creation transaction (through factory contract model)
- simple clone bytecode to encourage directly bytecode interrogation (see CloneProbe.sol in the clone-factory project)
- dependable, locked-down behavior - this is not designed to handle upgradability, nor should it as the representation we are seeking is stronger.
- small operational overhead - adds a single call cost to each call
- handles error return bubbling for revert messages

## Backwards Compatibility
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.

## Test Cases
Test cases include:
- invocation with no arguments
- invocation with arguments
- invocation with fixed length return values
- invocation with variable length return values
- invocation with revert (confirming reverted payload is transferred)
  
Tests for these cases are included in the reference implementation project.

## Implementation
Deployment bytecode is not included in this specification.  One approach is defined in the proxy-contract reference implementation.

### Standard Proxy
The disassembly of the standard deployed proxy contract code (from r2 and edited to include stack visualization)

```
|           0x00000000      36             calldatasize          cds
|           0x00000001      3d             returndatasize        0 cds
|           0x00000002      3d             returndatasize        0 0 cds
|           0x00000003      37             calldatacopy          
|           0x00000004      3d             returndatasize        0
|           0x00000005      3d             returndatasize        0 0 
|           0x00000006      3d             returndatasize        0 0 0
|           0x00000007      36             calldatasize          cds 0 0 0
|           0x00000008      3d             returndatasize        0 cds 0 0 0
|           0x00000009      73bebebebebe.  push20 0xbebebebe     0xbebe 0 cds 0 0 0
|           0x0000001e      5a             gas                   gas 0xbebe 0 cds 0 0 0
|           0x0000001f      f4             delegatecall          suc 0
|           0x00000020      3d             returndatasize        rds suc 0
|           0x00000021      82             dup3                  0 rds suc 0
|           0x00000022      80             dup1                  0 0 rds suc 0
|           0x00000023      3e             returndatacopy        suc 0
|           0x00000024      90             swap1                 0 suc
|           0x00000025      3d             returndatasize        rds 0 suc
|           0x00000026      91             swap2                 suc 0 rds
|           0x00000027      602b           push1 0x2b            0x2b suc 0 rds
|       ,=&lt; 0x00000029      57             jumpi                 0 rds
|       |   0x0000002a      fd             revert
|       `-&gt; 0x0000002b      5b             jumpdest              0 rds
\           0x0000002c      f3             return

```

NOTE: as an effort to reduce gas costs as much as possible, the above bytecode depends on EIP-211 specification that `returndatasize` returns zero prior to any calls within the call-frame. `returndatasize` uses 1 less gas than `dup*`.

### Vanity Address Optimization
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 `push20` opcode with `pushN` (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:
```
|           0x00000000      36             calldatasize          cds
|           0x00000001      3d             returndatasize        0 cds
|           0x00000002      3d             returndatasize        0 0 cds
|           0x00000003      37             calldatacopy          
|           0x00000004      3d             returndatasize        0
|           0x00000005      3d             returndatasize        0 0 
|           0x00000006      3d             returndatasize        0 0 0
|           0x00000007      36             calldatasize          cds 0 0 0
|           0x00000008      3d             returndatasize        0 cds 0 0 0
|           0x00000009      6fbebebebebe.  push16 0xbebebebe     0xbebe 0 cds 0 0 0
|           0x0000001a      5a             gas                   gas 0xbebe 0 cds 0 0 0
|           0x0000001b      f4             delegatecall          suc 0
|           0x0000001c      3d             returndatasize        rds suc 0
|           0x0000001d      82             dup3                  0 rds suc 0
|           0x0000001e      80             dup1                  0 0 rds suc 0
|           0x0000001f      3e             returndatacopy        suc 0
|           0x00000020      90             swap1                 0 suc
|           0x00000021      3d             returndatasize        rds 0 suc
|           0x00000022      91             swap2                 suc 0 rds
|           0x00000023      6027           push1 0x27            0x27 suc 0 rds
|       ,=&lt; 0x00000025      57             jumpi                 0 rds
|       |   0x00000026      fd             revert
|       `-&gt; 0x00000027      5b             jumpdest              0 rds
\           0x00000028      f3             return
```
This saves 4 bytes of proxy contract size (savings on each deployment) and has zero impact on runtime gas costs.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 22 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1167</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1167</guid>
      </item>
    
      <item>
        <title>Wallet &amp; shop standard for all tokens (erc20)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1182</comments>
        
        <description># All tokens go to heaven
## Simple Summary
Make wallets and shops created from certified contracts make erc20 tokens easy to use for commerce.

![wallet](../assets/eip-1175/wallet.png)

## Abstract
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.

## Motivation
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, `approve (address _spender, uint256 _value)` and `transferFrom (address _from, address _to, uint256 _value)`, but when using the wallet contract, `paySafe (address _shop, uint256 _item)`will be traded only in one call.
And if you only reuse the store interface, you can also trade using `payUnsafe (address _shop, uint256 _item)`.

## Specification
![workflow](../assets/eip-1175/workflow.png)
## WalletCenter
### Methods
#### createWallet
Create wallet contract and add to list. Returns the address of new wallet.

``` js
function createWallet() public returns (address _wallet)
```

#### isWallet
Returns true or false value for test this address is a created by createWallet.

``` js
function isWallet(address _wallet) public constant returns (bool)
```

#### createShop
Create Shop contract and add to list. Returns the address of new Shop with erc20 token address.

``` js
function createShop(address _erc20) public returns (address _shop)
```

#### isShop
Returns true or false value for test this address is a created by createWallet.

``` js
function isShop(address _shop) public constant returns (bool)
```

### Events
#### Wallet
Search for my wallet.
``` js
event Wallet(address indexed _owner, address indexed _wallet)
```

#### Shop
Search for my shop.
``` js
event Shop(address indexed _owner, address indexed _shop, address indexed _erc20)
```

## Wallet
Wallet must be created by wallet center.
### Methods
#### balanceOf
Returns the account balance of Wallet.
``` js
function balanceOf(address _erc20) public constant returns (uint256 balance)
```

#### withdrawal
withdrawal `_value` amount of `_erc20` token to `_owner`.
``` js
function withdrawal(address _erc20, uint256 _value) onlyOwner public returns (bool success)
```

#### paySafe
Pay for safe shop (created by contract) item with item index `_item`.
``` js
function paySafe(address _shop, uint256 _item) onlyOwner onlyShop(_shop) public payable returns (bool success)
```

#### payUnsafe
Pay for unsafe shop (did not created by contract) item with item index `_item`.
``` js
function payUnsafe(address _shop, uint256 _item) onlyOwner public payable returns (bool success)
```

#### payCancel
Cancel pay and refund. (only weekly model)
``` js
function payCancel(address _shop, uint256 _item) onlyOwner public returns (bool success)
```

#### refund
Refund from shop with item index `_item`.
``` js
function refund(uint256 _item, uint256 _value) public payable returns (bool success)
```

### Events
#### Pay
``` js
event Pay(address indexed _shop, uint256 indexed _item, uint256 indexed _value)
```

#### Refund
``` js
event Refund(address indexed _shop, uint256 indexed _item, uint256 indexed _value)
```

## Shop
Shop is created by wallet center or not. but Shop that created by wallet center is called safe shop.
### Methods
#### balanceOf
Returns the account balance of Shop.
``` js
function balanceOf(address _erc20) public constant returns (uint256 balance)
```

#### withdrawal
withdrawal `_value` amount of `_erc20` token to `_owner`.
``` js
function withdrawal(address _erc20, uint256 _value) onlyOwner public returns (bool success)
```

#### pay
Pay from buyer with item index `_item`.
``` js
function pay(uint256 _item) onlyWallet(msg.sender) public payable returns (bool success)
```

#### refund
refund token to `_to`.
``` js
function refund(address _buyer, uint256 _item, uint256 _value) onlyWallet(_buyer) onlyOwner public payable returns (bool success)
```

#### resister
Listing item for sell.
``` js
function resister(uint8 _category, uint256 _price, uint256 _stock) onlyOwner public returns (uint256 _itemId)
```

#### update
Update item state for sell. (change item `_price` or add item `_stock`)
``` js
function update(uint256 _item, uint256 _price, uint256 _stock) onlyOwner public
```

#### price
Get token address and price from buyer with item index `_item`.
``` js
function price(uint256 _item) public constant returns (address _erc20, uint256 _value)
```

#### canBuy
`_who` can Buy `_item`.
``` js
function canBuy(address _who, uint256 _item) public constant returns (bool _canBuy)
```

#### isBuyer
`_who` is buyer of `_item`.
``` js
function isBuyer(address _who, uint256 _item) public constant returns (bool _buyer)
```

#### info
Set shop information bytes.
``` js
function info(bytes _msgPack)
```

#### upVote
Up vote for this shop.
``` js
function upVote()
```

#### dnVote
Down vote for this shop.
``` js
function dnVote()
```

#### about
Get shop token, up vote and down vote.
``` js
function about() view returns (address _erc20, uint256 _up, uint256 _down)
```

#### infoItem
Set item information bytes.
``` js
function infoItem(uint256 _item, bytes _msgPack)
```

#### upVoteItem
Up vote for this item.
``` js
function upVoteItem(uint256 _item)
```

#### dnVoteItem
Down vote for this item.
``` js
function dnVoteItem(uint256 _item)
```

#### aboutItem
Get Item price, up vote and down vote.
``` js
function aboutItem(uint256 _item) view returns (uint256 _price, uint256 _up, uint256 _down)
```

### Events
#### Pay
``` js
event Pay(address indexed _buyer, uint256 indexed _item, uint256 indexed _value)
```

#### Refund
``` js
event Refund(address indexed _to, uint256 indexed _item, uint256 indexed _value)
```

#### Item
``` js
event Item(uint256 indexed _item, uint256 _price)
```

#### Info
``` js
event Info(bytes _msgPack)
```

#### InfoItem
``` js
event InfoItem(uint256 indexed _item, bytes _msgPack)
```

## Implementation
Sample token contract address is [0x393dd70ce2ae7b30501aec94727968c517f90d52](https://ropsten.etherscan.io/address/0x393dd70ce2ae7b30501aec94727968c517f90d52)

WalletCenter contract address is [0x1fe0862a4a8287d6c23904d61f02507b5044ea31](https://ropsten.etherscan.io/address/0x1fe0862a4a8287d6c23904d61f02507b5044ea31)

WalletCenter create shop contract address is [0x59117730D02Ca3796121b7975796d479A5Fe54B0](https://ropsten.etherscan.io/address/0x59117730D02Ca3796121b7975796d479A5Fe54B0)

WalletCenter create wallet contract address is [0x39da7111844df424e1d0a0226183533dd07bc5c6](https://ropsten.etherscan.io/address/0x39da7111844df424e1d0a0226183533dd07bc5c6)


## Appendix
``` js
pragma solidity ^0.4.24;

contract ERC20Interface {
    function totalSupply() public constant returns (uint);
    function balanceOf(address tokenOwner) public constant returns (uint balance);
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom(address from, address to, uint tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}

contract SafeMath {
    function safeAdd(uint a, uint b) public pure returns (uint c) {
        c = a + b;
        require(c &gt;= a);
    }
    function safeSub(uint a, uint b) public pure returns (uint c) {
        require(b &lt;= a);
        c = a - b;
    }
    function safeMul(uint a, uint b) public pure returns (uint c) {
        c = a * b;
        require(a == 0 || c / a == b);
    }
    function safeDiv(uint a, uint b) public pure returns (uint c) {
        require(b &gt; 0);
        c = a / b;
    }
}

contract _Base {
    address internal owner;
    address internal walletCenter;
    
    modifier onlyOwner {
        require(owner == msg.sender);
        _;
    }
    modifier onlyWallet(address _addr) {
        require(WalletCenter(walletCenter).isWallet(_addr));
        _;
    }
    modifier onlyShop(address _addr) {
        require(WalletCenter(walletCenter).isShop(_addr));
        _;
    }

    function balanceOf(address _erc20) public constant returns (uint256 balance) {
        if(_erc20==address(0))
            return address(this).balance;
        return ERC20Interface(_erc20).balanceOf(this);
    }

    function transfer(address _to, address _erc20, uint256 _value) internal returns (bool success) {
        require((_erc20==address(0)?address(this).balance:ERC20Interface(_erc20).balanceOf(this))&gt;=_value);
        if(_erc20==address(0))
            _to.transfer(_value);
        else
            ERC20Interface(_erc20).approve(_to,_value);
        return true;
    }
    
    function withdrawal(address _erc20, uint256 _value) public returns (bool success);
    
    event Pay(address indexed _who, uint256 indexed _item, uint256 indexed _value);
    event Refund(address indexed _who, uint256 indexed _item, uint256 indexed _value);
    event Prize(address indexed _who, uint256 indexed _item, uint256 indexed _value);
}

contract _Wallet is _Base {
    constructor(address _who) public {
        owner           = _who;
        walletCenter    = msg.sender;
    }
    
    function pay(address _shop, uint256 _item) private {
        require(_Shop(_shop).canBuy(this,_item));

        address _erc20;
        uint256 _value;
        (_erc20,_value) = _Shop(_shop).price(_item);
        
        transfer(_shop,_erc20,_value);
        _Shop(_shop).pay(_item);
        emit Pay(_shop,_item,_value);
    }
    
    function paySafe(address _shop, uint256 _item) onlyOwner onlyShop(_shop) public payable returns (bool success) {
        pay(_shop,_item);
        return true;
    }
    function payUnsafe(address _shop, uint256 _item) onlyOwner public payable returns (bool success) {
        pay(_shop,_item);
        return true;
    }
    function payCancel(address _shop, uint256 _item) onlyOwner public returns (bool success) {
        _Shop(_shop).payCancel(_item);
        return true;
    }

    function refund(address _erc20, uint256 _item, uint256 _value) public payable returns (bool success) {
        require((_erc20==address(0)?msg.value:ERC20Interface(_erc20).allowance(msg.sender,this))==_value);
        if(_erc20!=address(0))
            ERC20Interface(_erc20).transferFrom(msg.sender,this,_value);
        emit Refund(msg.sender,_item,_value);
        return true;
    }
    function prize(address _erc20, uint256 _item, uint256 _value) public payable returns (bool success) {
        require((_erc20==address(0)?msg.value:ERC20Interface(_erc20).allowance(msg.sender,this))==_value);
        if(_erc20!=address(0))
            ERC20Interface(_erc20).transferFrom(msg.sender,this,_value);
        emit Prize(msg.sender,_item,_value);
        return true;
    }
    
    function withdrawal(address _erc20, uint256 _value) onlyOwner public returns (bool success) {
        require((_erc20==address(0)?address(this).balance:ERC20Interface(_erc20).balanceOf(this))&gt;=_value);
        if(_erc20==address(0))
            owner.transfer(_value);
        else
            ERC20Interface(_erc20).transfer(owner,_value);
        return true;
    }
}

contract _Shop is _Base, SafeMath{
    address erc20;
    constructor(address _who, address _erc20) public {
        owner           = _who;
        walletCenter    = msg.sender;
        erc20           = _erc20;
    }
    
    struct item {
        uint8                       category;   // 0 = disable, 1 = non Stock, non Expire, 2 = can Expire (after 1 week), 3 = stackable
        uint256                     price;
        uint256                     stockCount;

        mapping(address=&gt;uint256)   customer;
    }

    uint                    index;
    mapping(uint256=&gt;item)  items;
    
    function pay(uint256 _item) onlyWallet(msg.sender) public payable returns (bool success) {
        require(canBuy(msg.sender, _item));
        require((erc20==address(0)?msg.value:ERC20Interface(erc20).allowance(msg.sender,this))==items[_item].price);
        
        if(erc20!=address(0))
            ERC20Interface(erc20).transferFrom(msg.sender,this,items[_item].price);
        
        if(items[_item].category==1 || items[_item].category==2 &amp;&amp; now &gt; safeAdd(items[_item].customer[msg.sender], 1 weeks))
            items[_item].customer[msg.sender]   = now;
        else if(items[_item].category==2 &amp;&amp; now &lt; safeAdd(items[_item].customer[msg.sender], 1 weeks) )
            items[_item].customer[msg.sender]   = safeAdd(items[_item].customer[msg.sender], 1 weeks);
        else if(items[_item].category==3) {
            items[_item].customer[msg.sender]   = safeAdd(items[_item].customer[msg.sender],1);
            items[_item].stockCount             = safeSub(items[_item].stockCount,1);
        }

        emit Pay(msg.sender,_item,items[_item].customer[msg.sender]);
        return true;
    }
    
    function payCancel(uint256 _item) onlyWallet(msg.sender) public returns (bool success) {
        require (items[_item].category==2&amp;&amp;safeAdd(items[_item].customer[msg.sender],2 weeks)&gt;now&amp;&amp;balanceOf(erc20)&gt;=items[_item].price);

        items[_item].customer[msg.sender]  = safeSub(items[_item].customer[msg.sender],1 weeks);
        transfer(msg.sender, erc20, items[_item].price);
        _Wallet(msg.sender).refund(erc20,_item,items[_item].price);
        emit Refund(msg.sender,_item,items[_item].price);

        return true;
    }
    function refund(address _to, uint256 _item) onlyWallet(_to) onlyOwner public payable returns (bool success) {
        require(isBuyer(_to,_item)&amp;&amp;items[_item].category&gt;0&amp;&amp;(items[_item].customer[_to]&gt;0||(items[_item].category==2&amp;&amp;safeAdd(items[_item].customer[_to],2 weeks)&gt;now)));
        require((erc20==address(0)?address(this).balance:ERC20Interface(erc20).balanceOf(this))&gt;=items[_item].price);

        if(items[_item].category==1)
            items[_item].customer[_to]  = 0;
        else if(items[_item].category==2)
            items[_item].customer[_to]  = safeSub(items[_item].customer[_to],1 weeks);
        else
            items[_item].customer[_to]  = safeSub(items[_item].customer[_to],1);
            
        transfer(_to, erc20, items[_item].price);
        _Wallet(_to).refund(erc20,_item,items[_item].price);
        emit Refund(_to,_item,items[_item].price);

        return true;
    }
    
    event Item(uint256 indexed _item, uint256 _price);
    function resister(uint8 _category, uint256 _price, uint256 _stock) onlyOwner public returns (uint256 _itemId) {
        require(_category&gt;0&amp;&amp;_category&lt;4);
        require(_price&gt;0);
        items[index]    = item(_category,_price,_stock);
        index = safeAdd(index,1);
        emit Item(index,_price);
        return safeSub(index,1);
    }
    function update(uint256 _item, uint256 _price, uint256 _stock) onlyOwner public {
        require(items[_item].category&gt;0);
        require(_price&gt;0);
        uint256 temp = items[_item].price;
        items[_item].price      = _price;
        items[_item].stockCount = safeAdd(items[_item].stockCount,_stock);
        
        if(temp!=items[_item].price)
            emit Item(index,items[_item].price);
    }
    
    function price(uint256 _item) public constant returns (address _erc20, uint256 _value) {
        return (erc20,items[_item].price);
    }
    
    function canBuy(address _who, uint256 _item) public constant returns (bool _canBuy) {
        return  (items[_item].category&gt;0) &amp;&amp;
                !(items[_item].category==1&amp;&amp;items[_item].customer[_who]&gt;0) &amp;&amp;
                (items[_item].stockCount&gt;0);
    }
    
    function isBuyer(address _who, uint256 _item) public constant returns (bool _buyer) {
        return (items[_item].category==1&amp;&amp;items[_item].customer[_who]&gt;0)||(items[_item].category==2&amp;&amp;safeAdd(items[_item].customer[_who],1 weeks)&gt;now)||(items[_item].category==3&amp;&amp;items[_item].customer[_who]&gt;0);
    }
    
    uint lastWithdrawal;
    function withdrawal(address _erc20, uint256 _value) onlyOwner public returns (bool success) {
        require(safeAdd(lastWithdrawal,1 weeks)&lt;=now);
        require((_erc20==address(0)?address(this).balance:ERC20Interface(_erc20).balanceOf(this))&gt;=_value);
        if(_erc20==address(0))
            owner.transfer(_value);
        else
            ERC20Interface(_erc20).transfer(owner,_value);
        lastWithdrawal = now;
        return true;
    }
}

contract WalletCenter {
    mapping(address=&gt;bool) public     wallet;
    event Wallet(address indexed _owner, address indexed _wallet);
    function createWallet() public returns (address _wallet) {
        _wallet = new _Wallet(msg.sender);
        wallet[_wallet] = true;
        emit Wallet(msg.sender,_wallet);
        return _wallet;
    }
    function isWallet(address _wallet) public constant returns (bool) {
        return wallet[_wallet];
    }
    mapping(address=&gt;bool) public     shop;
    event Shop(address indexed _owner, address indexed _shop, address indexed _erc20);
    function createShop(address _erc20) public returns (address _shop) {
        _shop   = new _Shop(msg.sender,_erc20);
        shop[_shop] = true;
        emit Shop(msg.sender,_shop,_erc20);
        return _shop;
    }
    function isShop(address _shop) public constant returns (bool) {
        return shop[_shop];
    }
}
```
## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 21 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1175</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1175</guid>
      </item>
    
      <item>
        <title>Multi-class Token Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1179</comments>
        
        <description>## Simple Summary
A standard interface for multi-class fungible tokens.
## Abstract
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.
## Motivation
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/common/restricted shares of a company). Yet, such nuance cannot be supported in today&apos;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.

&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.

## Specification
### ERC-20 Compatibility (partial)
**name**

```solidity    
function name() constant returns (string name)
```

*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.*

Returns the name of the aggregate collection of MCFTs managed by this contract. - e.g. `&quot;My Company Tokens&quot;`.

**class name**

```solidity    
function className(uint256 classId) constant returns (string name)
```

*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.*

Returns the name of the class of MCFT managed by this contract. - e.g. `&quot;My Company Preferred Shares Token&quot;`.

**symbol**
```solidity    
function symbol() constant returns (string symbol)
```

*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.*

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).

**totalSupply**
```solidity    
function totalSupply() constant returns (uint256 totalSupply)
```
Returns the total number of all MCFTs currently tracked by this contract.

**individualSupply**
```solidity    
function individualSupply(uint256 _classId) constant returns (uint256 individualSupply)
```
Returns the total number of MCFTs of class `_classId` currently tracked by this contract.

**balanceOf**
```solidity
function balanceOf(address _owner, uint256 _classId) constant returns (uint256 balance)
```

Returns the number of MCFTs of token class `_classId` assigned to address `_owner`.

**classesOwned**
```solidity
function classesOwned(address _owner) constant returns (uint256[] classes)
```

Returns an array of `_classId`&apos;s of MCFTs that address `_owner` owns in the contract. 
&gt; NOTE: returning an array is supported by `pragma experimental ABIEncoderV2`

## Basic Ownership

**approve**
```solidity    
function approve(address _to, uint256 _classId, uint256 quantity)
```
Grants approval for address `_to` to take possession `quantity` amount of the MCFT with ID `_classId`. This method MUST `throw` if `balanceOf(msg.sender, _classId) &lt; quantity`, or if `_classId` does not represent an MCFT class currently tracked by this contract, or if `msg.sender == _to`.

Only one address can &quot;have approval&quot; at any given time for a given address and `_classId`. Calling `approve` with a new address and `_classId` revokes approval for the previous address and `_classId`. Calling this method with 0 as the `_to` argument clears approval for any address and the specified `_classId`.

Successful completion of this method MUST emit an `Approval` 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 `_to` address is zero and there is some outstanding approval. Additionally, an Approval event MUST be fired if `_to` is already the currently approved address and this call otherwise has no effect. (i.e. An `approve()` call that &quot;reaffirms&quot; an existing approval MUST fire an event.)

&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;

**transfer**
```solidity
function transfer(address _to, uint256 _classId, uint256 quantity)
```
Assigns the ownership of `quantity` MCFT&apos;s with ID `_classId` to `_to` if and only if `quantity == balanceOf(msg.sender, _classId)`. A successful transfer MUST fire the `Transfer` event (defined below).

This method MUST transfer ownership to `_to` or `throw`, no other outcomes can be possible. Reasons for failure include (but are not limited to):

* `msg.sender` is not the owner of `quantity` amount of tokens of `_classId`&apos;s. 
* `_classId` does not represent an MCFT class currently tracked by this contract

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 `_to == msg.sender` if `balanceOf(msg.sender, _classId) &gt;= balance`.) This &quot;no-op transfer&quot; MUST be considered a successful transfer, and therefore MUST fire a `Transfer` event (with the same address for `_from` and `_to`).

## Advanced Ownership and Exchange
```solidity
function approveForToken(uint256 classIdHeld, uint256 quantityHeld, uint256 classIdWanted, uint256 quantityWanted)
```
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. 

```solidity
function exchange(address to, uint256 classIdPosted, uint256 quantityPosted, uint256 classIdWanted, uint256 quantityWanted)
```
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. 

```solidity
transferFrom(address from, address to, uint256 classId)
```
Allows a third party to initiate a transfer of tokens from `from` to `to` assuming the approvals have been granted.

## Events
**Transfer**

This event MUST trigger when MCFT ownership is transferred via any mechanism.

Additionally, the creation of new MCFTs MUST trigger a Transfer event for each newly created MCFTs, with a `_from` address of 0 and a `_to` 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 `_to` address of 0 and a `_from` address of the owner of the MCFT (now former owner!).

NOTE: A Transfer event with `_from == _to` is valid. See the `transfer()` documentation for details.

```solidity
event Transfer(address indexed _from, address indexed _to, uint256 _classId)
```
    
**Approval**
This event MUST trigger on any successful call to `approve(_to, _classId, quantity)` (unless the caller is attempting to clear approval when there is no pending approval).

```solidity
event Approval(address indexed _owner, address indexed _approved, uint256 _classId)
```
## Rationale
### Current Limitations
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. 


## Backwards Compatibility
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&apos;t be entirely compatible with it due to the fundamental differences between multi-class fungible and non-fungible tokens. For example, the `ownerOf`, `takeOwnership`, and `tokenOfOwnerByIndex` methods in the ERC-721 token standard cannot be implemented in this standard. Furthermore, the function arguments to `balanceOf`, `approve`, and `transfer` differ as well. 

## Implementation
A sample implementation can be found [here](https://github.com/achon22/ERC-1178/blob/master/erc1178-sample.sol)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Fri, 22 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1178</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1178</guid>
      </item>
    
      <item>
        <title>Storage of DNS Records in ENS</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip1185-dns-resolver-profile-for-ens/1589</comments>
        
        <description>## Abstract

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.

## Motivation

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&apos;s subdomains to be irrevocably assigned to another entity.

## Specification

The resolver profile to support DNS on ENS follows the resolver specification as defined in [ERC-137](./eip-137.md).

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 `(domain, name, resource record type)`, for example the tuple `(example.com, www.example.com, A)` defines the record set of `A` records for the name `www.example.com` in the domain `example.com`.  A record set can contain 0 or more values, for example if `www.example.com` has `A` records `1.2.3.4` and `5.6.7.8` then the aforementioned tuple will have two values.

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.

The DNS resolver interface consists of two functions to set DNS information and two functions to query DNS information.

### setDNSRecords(bytes32 node, bytes data)

`setDNSRecords()` sets, updates or clears 1 or more DNS records for a given node.  It has function signature `0x0af179d7`.

The arguments for the function are as follows:

  - node: the namehash of the fully-qualified domain in ENS for which to set the records.  Namehashes are defined in [ERC-137](./eip-137.md)
  - 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)


### clearDNSZone(bytes32 node)

`clearDNSZone()` removes all DNS records for the domain.  It has function signature `0xad5780af`.

Although it is possible to clear records individually with `setDNSRecords()` 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.  `clearDNSZone()` removes all zone information in a single operation.

The arguments for the function is as follows:

  - node: the namehash of the fully-qualified domain in ENS for which to clear the records.  Namehashes are defined in [ERC-137](./eip-137.md)

### dnsRecords(bytes32 node, bytes32 name, uint16 resource) view returns (bytes)

`dnsRecords()` obtains the DNS records for a given node, name and resource.  It has function signature `0x2461e851`.

The arguments for the function are as follows:

  - node: the namehash of the fully-qualified domain in ENS for which to set the records.  Namehashes are defined in [ERC-137](./eip-137.md)
  - name: the `keccak256()` hash of the name of the record in DNS wire format.
  - resource: the resource record ID.  Resource record IDs are defined in RFC1035 and subsequent RFCs.

The function returns all matching records in DNS wire format.  If there are no records present the function will return nothing.

### hasDNSRecords(bytes32 node, bytes32 name) view returns (bool)

`hasDNSRecords()` reports if there are any records for the provided name in the domain.  It has function signature `0x4cbf6ba4`.

This function is needed by DNS resolvers when working with wildcard resources as defined in RFC4592.

The arguments for the function are as follows:

  - node: the namehash of the fully-qualified domain in ENS for which to set the records.  Namehashes are defined in [ERC-137](./eip-137.md)
  - name: the `keccak256()` hash of the name of the record in DNS wire format.

The function returns `true` if there are any records for the provided node and name, otherwise `false`.

## Rationale

DNS is a federated system of naming, and the higher-level entities control availability of everything beneath them (_e.g._ `.org` controls the availability of `ethereum.org`).  A decentralized version of DNS would not have this constraint, and allow lookups directly for any domain with relevant records within ENS.

## Backwards Compatibility

Not applicable.

## Reference Implementation

The reference implementation of the DNS resolver is as follows:

```solidity
pragma solidity ^0.7.4;
import &quot;../ResolverBase.sol&quot;;
import &quot;@ensdomains/dnssec-oracle/contracts/RRUtils.sol&quot;;

abstract contract DNSResolver is ResolverBase {
    using RRUtils for *;
    using BytesUtils for bytes;

    bytes4 constant private DNS_RECORD_INTERFACE_ID = 0xa8fa5682;
    bytes4 constant private DNS_ZONE_INTERFACE_ID = 0x5c47637c;

    // DNSRecordChanged is emitted whenever a given node/name/resource&apos;s RRSET is updated.
    event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record);
    // DNSRecordDeleted is emitted whenever a given node/name/resource&apos;s RRSET is deleted.
    event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource);
    // DNSZoneCleared is emitted whenever a given node&apos;s zone information is cleared.
    event DNSZoneCleared(bytes32 indexed node);

    // DNSZonehashChanged is emitted whenever a given node&apos;s zone hash is updated.
    event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash);

    // Zone hashes for the domains.
    // A zone hash is an ERC-1577 content hash in binary format that should point to a
    // resource containing a single zonefile.
    // node =&gt; contenthash
    mapping(bytes32=&gt;bytes) private zonehashes;

    // Version the mapping for each zone.  This allows users who have lost
    // track of their entries to effectively delete an entire zone by bumping
    // the version number.
    // node =&gt; version
    mapping(bytes32=&gt;uint256) private versions;

    // The records themselves.  Stored as binary RRSETs
    // node =&gt; version =&gt; name =&gt; resource =&gt; data
    mapping(bytes32=&gt;mapping(uint256=&gt;mapping(bytes32=&gt;mapping(uint16=&gt;bytes)))) private records;

    // Count of number of entries for a given name.  Required for DNS resolvers
    // when resolving wildcards.
    // node =&gt; version =&gt; name =&gt; number of records
    mapping(bytes32=&gt;mapping(uint256=&gt;mapping(bytes32=&gt;uint16))) private nameEntriesCount;

    /**
     * Set one or more DNS records.  Records are supplied in wire-format.
     * Records with the same node/name/resource must be supplied one after the
     * other to ensure the data is updated correctly. For example, if the data
     * was supplied:
     *     a.example.com IN A 1.2.3.4
     *     a.example.com IN A 5.6.7.8
     *     www.example.com IN CNAME a.example.com.
     * then this would store the two A records for a.example.com correctly as a
     * single RRSET, however if the data was supplied:
     *     a.example.com IN A 1.2.3.4
     *     www.example.com IN CNAME a.example.com.
     *     a.example.com IN A 5.6.7.8
     * then this would store the first A record, the CNAME, then the second A
     * record which would overwrite the first.
     *
     * @param node the namehash of the node for which to set the records
     * @param data the DNS wire format records to set
     */
    function setDNSRecords(bytes32 node, bytes calldata data) external authorised(node) {
        uint16 resource = 0;
        uint256 offset = 0;
        bytes memory name;
        bytes memory value;
        bytes32 nameHash;
        // Iterate over the data to add the resource records
        for (RRUtils.RRIterator memory iter = data.iterateRRs(0); !iter.done(); iter.next()) {
            if (resource == 0) {
                resource = iter.dnstype;
                name = iter.name();
                nameHash = keccak256(abi.encodePacked(name));
                value = bytes(iter.rdata());
            } else {
                bytes memory newName = iter.name();
                if (resource != iter.dnstype || !name.equals(newName)) {
                    setDNSRRSet(node, name, resource, data, offset, iter.offset - offset, value.length == 0);
                    resource = iter.dnstype;
                    offset = iter.offset;
                    name = newName;
                    nameHash = keccak256(name);
                    value = bytes(iter.rdata());
                }
            }
        }
        if (name.length &gt; 0) {
            setDNSRRSet(node, name, resource, data, offset, data.length - offset, value.length == 0);
        }
    }

    /**
     * Obtain a DNS record.
     * @param node the namehash of the node for which to fetch the record
     * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record
     * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types
     * @return the DNS record in wire format if present, otherwise empty
     */
    function dnsRecord(bytes32 node, bytes32 name, uint16 resource) public view returns (bytes memory) {
        return records[node][versions[node]][name][resource];
    }

    /**
     * Check if a given node has records.
     * @param node the namehash of the node for which to check the records
     * @param name the namehash of the node for which to check the records
     */
    function hasDNSRecords(bytes32 node, bytes32 name) public view returns (bool) {
        return (nameEntriesCount[node][versions[node]][name] != 0);
    }

    /**
     * Clear all information for a DNS zone.
     * @param node the namehash of the node for which to clear the zone
     */
    function clearDNSZone(bytes32 node) public authorised(node) {
        versions[node]++;
        emit DNSZoneCleared(node);
    }

    /**
     * setZonehash sets the hash for the zone.
     * May only be called by the owner of that node in the ENS registry.
     * @param node The node to update.
     * @param hash The zonehash to set
     */
    function setZonehash(bytes32 node, bytes calldata hash) external authorised(node) {
        bytes memory oldhash = zonehashes[node];
        zonehashes[node] = hash;
        emit DNSZonehashChanged(node, oldhash, hash);
    }

    /**
     * zonehash obtains the hash for the zone.
     * @param node The ENS node to query.
     * @return The associated contenthash.
     */
    function zonehash(bytes32 node) external view returns (bytes memory) {
        return zonehashes[node];
    }

    function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {
        return interfaceID == DNS_RECORD_INTERFACE_ID ||
               interfaceID == DNS_ZONE_INTERFACE_ID ||
               super.supportsInterface(interfaceID);
    }

    function setDNSRRSet(
        bytes32 node,
        bytes memory name,
        uint16 resource,
        bytes memory data,
        uint256 offset,
        uint256 size,
        bool deleteRecord) private
    {
        uint256 version = versions[node];
        bytes32 nameHash = keccak256(name);
        bytes memory rrData = data.substring(offset, size);
        if (deleteRecord) {
            if (records[node][version][nameHash][resource].length != 0) {
                nameEntriesCount[node][version][nameHash]--;
            }
            delete(records[node][version][nameHash][resource]);
            emit DNSRecordDeleted(node, name, resource);
        } else {
            if (records[node][version][nameHash][resource].length == 0) {
                nameEntriesCount[node][version][nameHash]++;
            }
            records[node][version][nameHash][resource] = rrData;
            emit DNSRecordChanged(node, name, resource, rrData);
        }
    }
}
```

## Security Considerations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 26 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1185</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1185</guid>
      </item>
    
      <item>
        <title>Add chain id to mixed-case checksum address encoding</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1121</comments>
        
        <description>## Simple Summary

This EIP extends [EIP-55](./eip-55.md) by optionally adding a chain id defined by [EIP-155](./eip-155.md) to the checksum calculation.

## Abstract

The [EIP-55](./eip-55.md) was created to prevent users from losing funds by sending them to invalid addresses. This EIP extends [EIP-55](./eip-55.md) 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.  

## Motivation

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 [EIP-55](./eip-55.md) checksum algorithm it is possible to achieve this objective.

## Specification

Convert the address using the same algorithm defined by [EIP-55](./eip-55.md) 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 `0x` separator before calculating the hash. Then convert the address to hexadecimal, but if the ith digit is a letter (ie. it&apos;s one of `abcdef`) print it in uppercase if the 4*ith bit of the calculated hash is 1 otherwise print it in lowercase.

## Rationale

 Benefits:
 
 - By means of a minimal code change on existing libraries, users are protected from losing funds by mixing addresses of different Ethereum based networks.

## Implementation

```python
#!/usr/bin/python3
from sha3 import keccak_256
import random
&quot;&quot;&quot;
   addr (str): Hexadecimal address, 40 characters long with 2 characters prefix
   chainid (int): chain id from EIP-155 &quot;&quot;&quot;
def eth_checksum_encode(addr, chainid=1):
    adopted_eip1191 = [30, 31]
    hash_input = str(chainid) + addr.lower() if chainid in adopted_eip1191 else addr[2:].lower()
    hash_output = keccak_256(hash_input.encode(&apos;utf8&apos;)).hexdigest()
    aggregate = zip(addr[2:].lower(),hash_output)
    out = addr[:2] + &apos;&apos;.join([c.upper() if int(a,16) &gt;= 8 else c for c,a in aggregate])
    return out
```

## Test Cases

```python
eth_mainnet = [
&quot;0x27b1fdb04752bbc536007a920d24acb045561c26&quot;,
&quot;0x3599689E6292b81B2d85451025146515070129Bb&quot;,
&quot;0x42712D45473476b98452f434e72461577D686318&quot;,
&quot;0x52908400098527886E0F7030069857D2E4169EE7&quot;,
&quot;0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed&quot;,
&quot;0x6549f4939460DE12611948b3f82b88C3C8975323&quot;,
&quot;0x66f9664f97F2b50F62D13eA064982f936dE76657&quot;,
&quot;0x8617E340B3D01FA5F11F306F4090FD50E238070D&quot;,
&quot;0x88021160C5C792225E4E5452585947470010289D&quot;,
&quot;0xD1220A0cf47c7B9Be7A2E6BA89F429762e7b9aDb&quot;,
&quot;0xdbF03B407c01E7cD3CBea99509d93f8DDDC8C6FB&quot;,
&quot;0xde709f2102306220921060314715629080e2fb77&quot;,
&quot;0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359&quot;,
]
rsk_mainnet = [
&quot;0x27b1FdB04752BBc536007A920D24ACB045561c26&quot;,
&quot;0x3599689E6292B81B2D85451025146515070129Bb&quot;,
&quot;0x42712D45473476B98452f434E72461577d686318&quot;,
&quot;0x52908400098527886E0F7030069857D2E4169ee7&quot;,
&quot;0x5aaEB6053f3e94c9b9a09f33669435E7ef1bEAeD&quot;,
&quot;0x6549F4939460DE12611948B3F82B88C3C8975323&quot;,
&quot;0x66F9664f97f2B50F62d13EA064982F936de76657&quot;,
&quot;0x8617E340b3D01Fa5f11f306f4090fd50E238070D&quot;,
&quot;0x88021160c5C792225E4E5452585947470010289d&quot;,
&quot;0xD1220A0Cf47c7B9BE7a2e6ba89F429762E7B9adB&quot;,
&quot;0xDBF03B407c01E7CD3cBea99509D93F8Dddc8C6FB&quot;,
&quot;0xDe709F2102306220921060314715629080e2FB77&quot;,
&quot;0xFb6916095cA1Df60bb79ce92cE3EA74c37c5d359&quot;,
]
rsk_testnet = [
&quot;0x27B1FdB04752BbC536007a920D24acB045561C26&quot;,
&quot;0x3599689e6292b81b2D85451025146515070129Bb&quot;,
&quot;0x42712D45473476B98452F434E72461577D686318&quot;,
&quot;0x52908400098527886E0F7030069857D2e4169EE7&quot;,
&quot;0x5aAeb6053F3e94c9b9A09F33669435E7EF1BEaEd&quot;,
&quot;0x6549f4939460dE12611948b3f82b88C3c8975323&quot;,
&quot;0x66f9664F97F2b50f62d13eA064982F936DE76657&quot;,
&quot;0x8617e340b3D01fa5F11f306F4090Fd50e238070d&quot;,
&quot;0x88021160c5C792225E4E5452585947470010289d&quot;,
&quot;0xd1220a0CF47c7B9Be7A2E6Ba89f429762E7b9adB&quot;,
&quot;0xdbF03B407C01E7cd3cbEa99509D93f8dDDc8C6fB&quot;,
&quot;0xDE709F2102306220921060314715629080e2Fb77&quot;,
&quot;0xFb6916095CA1dF60bb79CE92ce3Ea74C37c5D359&quot;,
]
test_cases = {30 : rsk_mainnet, 31 : rsk_testnet, 1 : eth_mainnet}

for chainid, cases in test_cases.items():
    for addr in cases:
        assert ( addr == eth_checksum_encode(addr,chainid) )
```

## Usage

### Usage  Table

| Network      | Chain id | Supports this EIP |
|-|-|-|
| RSK Mainnet  | 30       | Yes               |
| RSK Testnet  | 31       | Yes               |

### Implementation Table

| Project         | EIP Usage        | Implementation |
|-|-|-|
| MyCrypto       | Yes              | [JavaScript](https://github.com/MyCryptoHQ/MyCrypto/blob/develop/common/utils/formatters.ts#L126) |
| MyEtherWallet  | Yes              | [JavaScript](https://github.com/MyEtherWallet/MyEtherWallet/blob/73c4a24f8f67c655749ac990c5b62efd92a2b11a/src/helpers/addressUtils.js#L22) |
| Ledger         | Yes              | [C](https://github.com/LedgerHQ/ledger-app-eth/blob/master/src_common/ethUtils.c#L203) |
| Trezor         | Yes              | [Python](https://github.com/trezor/trezor-core/blob/270bf732121d004a4cd1ab129adaccf7346ff1db/src/apps/ethereum/get_address.py#L32) and [C](https://github.com/trezor/trezor-crypto/blob/4153e662b60a0d83c1be15150f18483a37e9092c/address.c#L62) |
| Web3.js           | Yes              | [JavaScript](https://github.com/ethereum/web3.js/blob/aaf26c8806bc9fb60cf6dcb6658104963c6c7fc7/packages/web3-utils/src/Utils.js#L140) |
| EthereumJS-util   | Yes              | [JavaScript](https://github.com/ethereumjs/ethereumjs-util/pull/204/commits/cdf0b3c996b05ac5b1f758f17ea9f9ed1847c1eb) |
| ENS address-encoder | Yes | [TypeScript](https://github.com/ensdomains/address-encoder/commit/5bf53b13fa014646ea28c9e5f937361dc9b40590) |

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Sun, 18 Mar 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1191</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1191</guid>
      </item>
    
      <item>
        <title>Voting Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-1202-voting-interface/11484</comments>
        
        <description>## Abstract

This EIP defines an API for implementing voting with smart contracts. This standard provides functionality for voting, viewing vote results, and setting voting status.

## Motivation

Voting is one of the earliest examples of EVM programming and is also a key part of DAO and organizational governance processes. We expect many DAOs will ultimately need to leverage voting as an important part of their governance. By creating a voting standard for smart contracts and tokens, we can have the following benefits:

### Benefits of having a standard

1. Allow general UIs and applications to be built on top of a standardized voting interface so that more users can participate, and encourage more dApps and DAOs to think about their governance.
2. Allow delegated voting, smart-contract voting, and automatic voting.
3. Allow voting results to be recorded on-chain in a standard way, and allow DAOs and dApps to honor the voting results programmatically.
4. Allow compatibility with token standards such as [ERC-20](./eip-20.md) and newer standards such as [ERC-777](./eip-777.md), as well as item standards such as [ERC-721](./eip-721.md).
5. Create massive potential for interoperability within Ethereum ecosystems and other systems.
6. Allow setting voting deadlines, determining single or multiple options, and requiring voting order. (The trade-off is interface complexity; we might need an [ERC-20](./eip-20.md)-style approach first and later an [ERC-777](./eip-777.md)-style approach for advanced voting.)
7. Record voting weights based on token amounts.
8. Possibly allow trustworthy, privacy-safe voting and anonymous voting (with the voter address not being associated with the vote they cast, given a list of randomized or obfuscated voting options).
9. Possibly allow rewards based on voting participation or voting results.

### Non-Goal / Out of Scope

1. **Delegation**: We intentionally leave delegation out of scope. A separate EIP could be proposed to address this particular use case.
2. **Eligibility or Weights**: Some implementations may want voting weights or voting eligibility to be configurable. For example, OpenZeppelin&apos;s implementation of GovernorBravo uses snapshots. Weight calculations such as quadratic voting are also outside the scope of this EIP. This EIP is intended to be flexible enough for current and future voting-weight calculations.
3. **Proposal**: We intentionally leave proposals out of scope. Proposals are identified by `proposalId`, but the information included in a proposal, whether it is on-chain or off-chain, and whether it is executable are all left out of this proposal. A separate EIP could be proposed to address this particular use case. See one such proposal: [ERC-5247](./eip-5247.md).
4. **Signature Aggregations / Endorsement**: When implementing contracts want to allow users to submit their vote or vote approval offline and have another account generate the transaction, signature aggregations or endorsements are outside the scope of this EIP. A separate EIP could be proposed to address this particular use case. See one such proposal here: [ERC-5453](./eip-5453.md).

### Use-cases

1. Decide on issuing a new token, issuing more tokens, or issuing a sub-token.
2. Decide on creating a new item under [ERC-721](./eip-721.md).
3. Decide on electing a certain person or smart contract to be the delegated leader for a project or subproject.
4. Decide on audit-result ownership that allows migration of a smart-contract proxy address.

## Specification

1. Compliant contracts MUST implement the `IERC1202Core` below

```solidity
interface IERC1202Core {
    event VoteCast(
        address indexed voter,
        uint256 indexed proposalId,
        uint8 support,
        uint256 weight,
        string reason,
        bytes extraParams
    );

    function castVote(
        uint256 proposalId,
        uint8 support,
        uint256 weight,
        string calldata reasonUri,
        bytes calldata extraParams
    ) external payable returns;

    function castVoteFrom(
        address from,
        uint256 proposalId,
        uint8 support,
        uint256 weight,
        string calldata reasonUri,
        bytes calldata extraParams
    ) external payable returns;

    function execute(uint256 proposalId, bytes memory extraParams) payable external;
}
```

2. Compliant contracts MAY implement the `IERC1202MultiVote` Interface. If the intention is for multi-options to be supported, e.g. for ranked-choices
or variant weights voting, Compliant contracts MUST implement `IERC1202MultiVote` Interface.

```solidity
interface IERC1202MultiVote {
    event MultiVoteCast(
        address indexed voter,
        uint256 indexed proposalId,
        uint8[] support,
        uint256[] weight,
        string reason,
        bytes extraParams
    );

    function castMultiVote(
        uint256 proposalId,
        uint8[] support,
        uint256[] weight,
        string calldata reasonUri,
        bytes calldata extraParams
    ) external payable;
}
```

3. The compliant contract SHOULD implement the [ERC-5269](./eip-5269.md) interface.


### Getting Info: Voting Period, Eligibility, Weight

```solidity
interface IERC1202Info {
    function votingPeriodFor(uint256 proposalId) external view returns (uint256 startPointOfTime, uint256 endPointOfTime);
    function eligibleVotingWeight(uint256 proposalId, address voter) external view returns (uint256);
}
```

## Rationale

We made the following design decisions, and here are the rationales.

### Granularity and Anonymity

We created a `view` function, `ballotOf`, primarily to make it easier for people to check the vote from a certain address. This has the following assumptions:

- It is possible to check someone&apos;s vote directly given an address. If implementers do not want to make this so easy, they can simply reject all calls to this function. We want to make sure that we support both anonymous and non-anonymous voting. However, since all calls to a smart contract are logged in block history, there is not much secrecy unless cryptographic techniques are used. I am not sufficiently cryptography-savvy to comment on that possibility. Please see &quot;Second Feedback Questions 2018&quot; for a related topic.

- It assumes that each individual address can vote for only one decision. Users can distribute their available voting power at a more granular level. If implementers want to allow this, they can ask the user to create another wallet address and grant that new address a certain amount of power. For example, in token-based voting where voting weight is determined by the amount of tokens held by a voter, a voter who wants to distribute their voting power across two different options (or option sets) can transfer some of the tokens to the new account and cast votes from both accounts.

### Weights

We assume votes have `weight`, which can be checked by calling `eligibleVotingWeight(proposalId, address voter)`, and that the weight distribution is either determined internally or set by the constructor.

## Backwards Compatibility

1. The `support` options are chosen to be `uint8` for the purpose of being backward-compatible with GovernorBravo. This can be increased in the future.

## Security Considerations

We expect the voting standard to be used in connection with other contracts such as token distributions, actions conducted by consensus or on behalf of an entity, multi-signature wallets, and similar systems.

The major security consideration is ensuring that the standard interface is used only for performing downstream actions or receiving upstream input (vote casting). We expect future audit tools to be based on standard interfaces.

It is also important to note, as discussed in this standard, that for the sake of simplicity this EIP is kept in a very basic form. It can be extended to support many different implementation variations. Such variations might contain different assumptions about the behavior and interpretation of actions. One example is: what does it mean if someone votes multiple times through `vote`?

- Would that mean the voter is increasing their weight?
- Would that mean they vote for multiple options in the meantime?
- Does the latter vote override the previous vote?

Because of the flexible nature of voting, we expect that many subsequent standards will need to be created as extensions of this EIP. We suggest that any extension or implementation of this standard be thoroughly audited before being included in large-scale or high-asset-volume applications.

The third consideration is non-triviality. Some voting applications assume **_anonymity_**, **_randomness_**, **_time-based deadline_**, **_ordering_**, etc. These requirements are known to be non-trivial to achieve on Ethereum. We suggest that any applications or organizations rely on audited and time-proven shared libraries when these requirements need to be enforced in their applications.

The fourth consideration is potential abuse. When voting is standardized and put on-chain, it is possible to write another contract that rewards a voter for voting in a certain way. This creates potential issues of bribery and conflict-of-interest abuse that were previously hard to implement.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 08 Jul 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1202</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1202</guid>
      </item>
    
      <item>
        <title>ERC-1203 Multi-Class Token Standard (ERC-20 Extension)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1203</comments>
        
        <description>## Simple Summary

A standard interface for multi-class tokens (MCTs).

## Abstract

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.

## Motivation

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/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.

MCTs are useful in representing various structures with heterogeneous components, such as:

- **Abstract Concepts:** 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&apos;s position of such company composites of zero or more shares in each class.

- **Virtual Items:** 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&apos;s inventory has any combination and quantity of these resources

- **Physical Items:** 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&apos;s cart as it moves down the aisle.

It&apos;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.

## Specification

```solidity
contract ERC20 {
    function totalSupply() public view returns (uint256);
    function balanceOf(address _owner) public view returns (uint256);
    function transfer(address _to, uint256 _value) public returns (bool);
    function approve(address _spender, uint256 _value) public returns (bool);
    function allowance(address _owner, address _spender) public view returns (uint256);
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool);

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}

contract ERC1203 is ERC20 {
    function totalSupply(uint256 _class) public view returns (uint256);
    function balanceOf(address _owner, uint256 _class) public view returns (uint256);
    function transfer(address _to, uint256 _class, uint256 _value) public returns (bool);
    function approve(address _spender, uint256 _class, uint256 _value) public returns (bool);
    function allowance(address _owner, address _spender, uint256 _class) public view returns (uint256);
    function transferFrom(address _from, address _to, uint256 _class, uint256 _value) public returns (bool);

    function fullyDilutedTotalSupply() public view returns (uint256);
    function fullyDilutedBalanceOf(address _owner) public view returns (uint256);
    function fullyDilutedAllowance(address _owner, address _spender) public view returns (uint256);
    function convert(uint256 _fromClass, uint256 _toClass, uint256 _value) public returns (bool);

    event Transfer(address indexed _from, address indexed _to, uint256 _class, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _class, uint256 _value);
    event Convert(uint256 indexed _fromClass, uint256 indexed _toClass, uint256 _value);
}
```

### ERC-20 Methods and Events (fully compatible)

Please see [ERC-20 Token Standard](./eip-20.md) for detailed specifications. Do note that these methods and events only work on the &quot;default&quot; class of an MCT.

```solidity
    function totalSupply() public view returns (uint256);
    function balanceOf(address _owner) public view returns (uint256);
    function transfer(address _to, uint256 _value) public returns (bool);
    function approve(address _spender, uint256 _value) public returns (bool);
    function allowance(address _owner, address _spender) public view returns (uint256);
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool);

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
```

### Tracking and Transferring

**totalSupply**

Returns the total number of tokens in the specified `_class`

```solidity
    function totalSupply(uint256 _class) public view returns (uint256);
```

**balanceOf**

Returns the number of tokens of a specified `_class` that the `_owner` has

```solidity
    function balanceOf(address _owner, uint256 _class) public view returns (uint256);
```

**transfer**

Transfer `_value` tokens of `_class` to address specified by `_to`, return `true` if successful

```solidity
    function transfer(address _to, uint256 _class, uint256 _value) public returns (bool);
```

**approve**

Grant `_spender` the right to transfer `_value` tokens of `_class`, return `true` if successful

```solidity
    function approve(address _spender, uint256 _class, uint256 _value) public returns (bool);
```

**allowance**

Return the number of tokens of `_class` that `_spender` is authorized to transfer on the behalf of `_owner`

```solidity
    function allowance(address _owner, address _spender, uint256 _class) public view returns (uint256);
```

**transferFrom**

Transfer `_value` tokens of `_class` from address specified by `_from` to address specified by `_to` as previously approved, return `true` if successful

```solidity
    function transferFrom(address _from, address _to, uint256 _class, uint256 _value) public returns (bool);
```

**Transfer**

Triggered when tokens are transferred or created, including zero value transfers

```solidity
    event Transfer(address indexed _from, address indexed _to, uint256 _class, uint256 _value);
```

**Approval**

Triggered on successful `approve`

```solidity
    event Approval(address indexed _owner, address indexed _spender, uint256 _class, uint256 _value);
```

### Conversion and Dilution

**fullyDilutedTotalSupply**

Return the total token supply as if all converted to the lowest common denominator class

```solidity
    function fullyDilutedTotalSupply() public view returns (uint256);
```

**fullyDilutedBalanceOf**

Return the total token owned by `_owner` as if all converted to the lowest common denominator class

```solidity
    function fullyDilutedBalanceOf(address _owner) public view returns (uint256);
```

**fullyDilutedAllowance**

Return the total token `_spender` is authorized to transfer on behalf of `_owner` as if all converted to the lowest common denominator class

```solidity
    function fullyDilutedAllowance(address _owner, address _spender) public view returns (uint256);
```

**convert**

Convert `_value` of `_fromClass` to `_toClass`, return `true` if successful

```solidity
    function convert(uint256 _fromClass, uint256 _toClass, uint256 _value) public returns (bool);
```

**Conversion**

Triggered on successful `convert`

```solidity
    event Conversion(uint256 indexed _fromClass, uint256 indexed _toClass, uint256 _value);
```

## Rationale
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.

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.

**Using multiple ERC-20 tokens**

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.

**Shoehorning ERC-721 token**

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.

**Using ERC-1178 token**

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&apos;re a few key advantages this one has over ERC-1178.

- 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
- By the same token, existing ERC-20 contracts can extend themselves to adopt this standard and support additional classes without affecting their current behaviors
- 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

## Backwards Compatibility
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/gold coin/money in the abstract/virtual/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.

We find it contrived to require the optional methods of ERC20 Token Standard, `name()`, `symbol()`, and `decimals()`, but developers are certainly free to implement these as they wish.

## Test Cases
The repository at [jeffishjeff/ERC-1203](https://github.com/jeffishjeff/ERC-1203) contains the [sample test cases](https://github.com/jeffishjeff/ERC-1203/blob/master/token.test.js).

## Implementation
The repository at [jeffishjeff/ERC-1203](https://github.com/jeffishjeff/ERC-1203) contains the [sample implementation](https://github.com/jeffishjeff/ERC-1203/blob/master/token.sol).

## References
- ERC-20 Token Standard. ./eip-20.md
- ERC-721 Non-Fungible Token Standard. ./eip-721.md
- ERC-1178 Multi-class Token Standard. ./eip-1178.md

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 01 Jul 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1203</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1203</guid>
      </item>
    
      <item>
        <title>DAuth Access Delegation Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1207</comments>
        
        <description>DAuth Access Delegation Standard
=====

## Simple Summary
DAuth is a standard interface for accessing authorization delegation between smart contracts and users.

## Abstract
The DAuth protocol defines a set of standard API allowing identity delegations between smart contracts without the user&apos;s private key.  Identity delegations include accessing and operating a user&apos;s data and assets contained in the delegated contracts.

## Motivation
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.

## Specification
![Rationale](../assets/eip-1207/rationale.png)

**Resource owner**: the authorizer

**Resource contract**: the contract providing data and operators

**API**: the resource contract APIs that the grantee contract can invoke

**Client contract**: the grantee contract using authorization to access and operate the data

**Grantee request**: the client contract calls the resource contract with the authorizer authorization


**AuthInfo**
``` js
struct AuthInfo {
    string[] funcNames;
    uint expireAt;
}
```
Required - The struct contains user authorization information
* `funcNames`: a list of function names callable by the granted contract
* `expireAt`: the authorization expire timestamp in seconds

**userAuth**
```  js
mapping(address =&gt; mapping(address =&gt; AuthInfo)) userAuth;
```
Required - userAuth maps (authorizer address, grantee contract address) pair to the user’s authorization AuthInfo object

**callableFuncNames**
```  js
string[] callableFuncNames;
```
Required - All methods that are allowed other contracts to call
* The callable function MUST verify the grantee’s authorization

**updateCallableFuncNames**
```  js
function updateCallableFuncNames(string _invokes) public returns (bool success);
```
Optional - Update the callable function list for the client contract by the resource contract&apos;s administrator
* `_invokes`: the invoke methods that the client contract can call
* return: Whether the callableFuncNames is updated or not
* This method MUST return success or throw, no other outcomes can be possible

**verify**
```  js
function verify(address _authorizer, string _invoke) internal returns (bool success);
```
Required - check the invoke method authority for the client contract
* `_authorizer`: the user address that the client contract agents
* `_invoke`: the invoke method that the client contract wants to call
* return: Whether the grantee request is authorized or not
* This method MUST return success or throw, no other outcomes can be possible

**grant**
```  js
function grant(address _grantee, string _invokes, uint _expireAt) public returns (bool success);
```
Required - delegate a client contract to access the user&apos;s resource
* `_grantee`: the client contract address
* `_invokes`: the callable methods that the client contract can access. It is a string which contains all function names split by spaces
* `_expireAt`: the authorization expire timestamp in seconds
* return: Whether the grant is successful or not
* This method MUST return success or throw, no other outcomes can be possible
* A successful grant MUST fire the Grant event(defined below)

**regrant**
```  js
function regrant(address _grantee, string _invokes, uint _expireAt) public returns (bool success);
```
Optional - alter a client contract&apos;s delegation

**revoke**
```  js
function revoke(address _grantee) public returns (bool success);
```
Required - delete a client contract&apos;s delegation
* `_grantee`: the client contract address
* return: Whether the revoke is successful or not
* A successful revoke MUST fire the Revoke event(defined below).

**Grant**
```  js
event Grant(address _authorizer, address _grantee, string _invokes, uint _expireAt);
```
* This event MUST trigger when the authorizer grant a new authorization when `grant` or `regrant` processes successfully

**Revoke**
```  js
event Revoke(address _authorizer, address _grantee);
```
* This event MUST trigger when the authorizer revoke a specific authorization successfully

**Callable Resource Contract Functions**

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.

Example:
```  js
function approve(address _spender, uint256 _value) public returns (bool success) {
    return _approve(msg.sender, _spender, _value);
}

function approve(address _spender, uint256 _value, address _authorizer) public returns (bool success) {
    verify(_authorizer, &quot;approve&quot;);

    return _approve(_authorizer, _spender, _value);
}

function _approve(address sender, address _spender, uint256 _value) internal returns (bool success) {
    allowed[sender][_spender] = _value;
    emit Approval(sender, _spender, _value);
    return true;
}
```

## Rationale

**Current Limitations**

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.

**Rationale**

On the Ethereum platform, all storage is transparent and the `msg.sender` is reliable. Therefore, the DAuth don&apos;t need an `access_token` like OAuth. DAuth just recodes the users&apos; authorization for the specific client smart contract&apos;s address. It is simple and reliable on the Ethereum platform.

## Backwards Compatibility
This EIP introduces no backward compatibility issues. In the future, the new version protocol has to keep these interfaces.

## Implementation
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.

* ERC-DAuth Interface implementation is available at:

  https://github.com/DIA-Network/ERC-DAuth/blob/master/ERC-DAuth-Interface.sol

* Example implementation with EIP20 Interface and ERC-DAuth Interface is available at:

  https://github.com/DIA-Network/ERC-DAuth/blob/master/eip20-dauth-example/EIP20DAuth.sol


## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 10 Jul 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1207</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1207</guid>
      </item>
    
      <item>
        <title>Membership Verification Token (MVT)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1261</comments>
        
        <description>## Simple Summary

A standard interface for Membership Verification Token(MVT).

## Abstract

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.

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:

- 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.
- 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)
- 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.
- Software licencing: Software companies like game developers can use the protocol to authorize certain hardware units(consoles) to download and use specific software(games)

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&apos;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.

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.

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: [ +, - ]

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.

## Motivation

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.

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.

We have also reviewed other Membership EIPs including EIP-725/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.

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&apos;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/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.

**Trade-off between trustlessness and usability:**
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/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/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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

**Every ERC-1261 compliant contract must implement the `ERC1261`, `ERC173` and `ERC165` interfaces** (subject to &quot;caveats&quot; below):

```solidity
/// @title ERC-1261 MVT Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1261.md
///  The constructor should define the attribute set for this MVT.
///  Note: the ERC-165 identifier for this interface is 0x1d8362cf.
interface IERC1261 {/* is ERC173, ERC165 */
    /// @dev This emits when a token is assigned to a member.
    event Assigned(address indexed _to, uint[] attributeIndexes);

    /// @dev This emits when a membership is revoked.
    event Revoked(address indexed _to);

    /// @dev This emits when a user forfeits his membership
    event Forfeited(address indexed _to);

    /// @dev This emits when a membership request is accepted
    event ApprovedMembership(address indexed _to, uint[] attributeIndexes);

    /// @dev This emits when a membership is requested by an user
    event RequestedMembership(address indexed _to);

    /// @dev This emits when data of a member is modified.
    ///  Doesn&apos;t emit when a new membership is created and data is assigned.
    event ModifiedAttributes(address indexed _to, uint attributeIndex, uint attributeValueIndex);

    /// @notice Adds a new attribute (key, value) pair to the set of pre-existing attributes.
    /// @dev Adds a new attribute at the end of the array of attributes and maps it to `values`.
    ///  Contract can set a max number of attributes and throw if limit is reached.
    /// @param _name Name of the attribute which is to be added.
    /// @param values List of values of the specified attribute.
    function addAttributeSet(bytes32 _name, bytes32[] calldata values) external;

    /// @notice Modifies the attribute value of a specific attribute for a given `_to` address.
    /// @dev Use appropriate checks for whether a user/admin can modify the data.
    ///  Best practice is to use onlyOwner modifier from ERC173.
    /// @param _to The address whose attribute is being modified.
    /// @param _attributeIndex The index of attribute which is being modified.
    /// @param _modifiedValueIndex The index of the new value which is being assigned to the user attribute.
    function modifyAttributeByIndex(address _to, uint _attributeIndex, uint _modifiedValueIndex) external;

    /// @notice Requests membership from any address.
    /// @dev Throws if the `msg.sender` already has the token.
    ///  The individual `msg.sender` can request for a membership if some existing criteria are satisfied.
    ///  When a membership is requested, this function emits the RequestedMembership event.
    ///  dev can store the membership request and use `approveRequest` to assign membership later
    ///  dev can also oraclize the request to assign membership later
    /// @param _attributeIndexes the attribute data associated with the member.
    ///  This is an array which contains indexes of attributes.
    function requestMembership(uint[] calldata _attributeIndexes) external payable;

    /// @notice User can forfeit his membership.
    /// @dev Throws if the `msg.sender` already doesn&apos;t have the token.
    ///  The individual `msg.sender` can revoke his/her membership.
    ///  When the token is revoked, this function emits the Revoked event.
    function forfeitMembership() external payable;

    /// @notice Owner approves membership from any address.
    /// @dev Throws if the `_user` doesn&apos;t have a pending request.
    ///  Throws if the `msg.sender` is not an owner.
    ///  Approves the pending request
    ///  Make oraclize callback call this function
    ///  When the token is assigned, this function emits the `ApprovedMembership` and `Assigned` events.
    /// @param _user the user whose membership request will be approved.
    function approveRequest(address _user) external;

    /// @notice Owner discards membership from any address.
    /// @dev Throws if the `_user` doesn&apos;t have a pending request.
    ///  Throws if the `msg.sender` is not an owner.
    ///  Discards the pending request
    ///  Make oraclize callback call this function if criteria are not satisfied
    /// @param _user the user whose membership request will be discarded.
    function discardRequest(address _user) external;

    /// @notice Assigns membership of an MVT from owner address to another address.
    /// @dev Throws if the member already has the token.
    ///  Throws if `_to` is the zero address.
    ///  Throws if the `msg.sender` is not an owner.
    ///  The entity assigns the membership to each individual.
    ///  When the token is assigned, this function emits the Assigned event.
    /// @param _to The address to which the token is assigned.
    /// @param _attributeIndexes The attribute data associated with the member.
    ///  This is an array which contains indexes of attributes.
    function assignTo(address _to, uint[] calldata _attributeIndexes) external;

    /// @notice Only Owner can revoke the membership.
    /// @dev This removes the membership of the user.
    ///  Throws if the `_from` is not an owner of the token.
    ///  Throws if the `msg.sender` is not an owner.
    ///  Throws if `_from` is the zero address.
    ///  When transaction is complete, this function emits the Revoked event.
    /// @param _from The current owner of the MVT.
    function revokeFrom(address _from) external;

    /// @notice Queries whether a member is a current member of the organization.
    /// @dev MVT&apos;s assigned to the zero address are considered invalid, and this
    ///  function throws for queries about the zero address.
    /// @param _to An address for whom to query the membership.
    /// @return Whether the member owns the token.
    function isCurrentMember(address _to) external view returns (bool);

     /// @notice Gets the value collection of an attribute.
    /// @dev Returns the values of attributes as a bytes32 array.
    /// @param _name Name of the attribute whose values are to be fetched
    /// @return The values of attributes.
    function getAttributeExhaustiveCollection(bytes32 _name) external view returns (bytes32[] memory);

    /// @notice Returns the list of all past and present members.
    /// @dev Use this function along with isCurrentMember to find wasMemberOf() in Js.
    ///  It can be calculated as present in getAllMembers() and !isCurrentMember().
    /// @return List of addresses who have owned the token and currently own the token.
    function getAllMembers() external view returns (address[]);

    /// @notice Returns the count of all current members.
    /// @dev Use this function in polls as denominator to get percentage of members voted.
    /// @return Count of current Members.
    function getCurrentMemberCount() external view returns (uint);

    /// @notice Returns the list of all attribute names.
    /// @dev Returns the names of attributes as a bytes32 array.
    ///  AttributeNames are stored in a bytes32 Array.
    ///  Possible values for each attributeName are stored in a mapping(attributeName =&gt; attributeValues).
    ///  AttributeName is bytes32 and attributeValues is bytes32[].
    ///  Attributes of a particular user are stored in bytes32[].
    ///  Which has a single attributeValue for each attributeName in an array.
    ///  Use web3.toAscii(data[0]).replace(/\u0000/g, &quot;&quot;) to convert to string in JS.
    /// @return The names of attributes.
    function getAttributeNames() external view returns (bytes32[] memory);

    /// @notice Returns the attributes of `_to` address.
    /// @dev Throws if `_to` is the zero address.
    ///  Use web3.toAscii(data[0]).replace(/\u0000/g, &quot;&quot;) to convert to string in JS.
    /// @param _to The address whose current attributes are to be returned.
    /// @return The attributes associated with `_to` address.
    function getAttributes(address _to) external view returns (bytes32[]);

    /// @notice Returns the `attribute` stored against `_to` address.
    /// @dev Finds the index of the `attribute`.
    ///  Throws if the attribute is not present in the predefined attributes.
    ///  Returns the attributeValue for the specified `attribute`.
    /// @param _to The address whose attribute is requested.
    /// @param _attributeIndex The attribute Index which is required.
    /// @return The attribute value at the specified name.
    function getAttributeByIndex(address _to, uint _attributeIndex) external view returns (bytes32);
}

interface ERC173 /* is ERC165 */ {
    /// @dev This emits when ownership of a contract changes.
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /// @notice Get the address of the owner
    /// @return The address of the owner.
    function owner() external view;

    /// @notice Set the address of the new owner of the contract
    /// @param _newOwner The address of the new owner of the contract
    function transferOwnership(address _newOwner) external;
}

interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

The **metadata extension** 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.

```solidity
/// @title ERC-1261 MVT Standard, optional metadata extension
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1261.md
interface ERC1261Metadata /* is ERC1261 */ {
    /// @notice A descriptive name for a collection of MVTs in this contract
    function name() external view returns (string _name);

    /// @notice An abbreviated name for MVTs in this contract
    function symbol() external view returns (string _symbol);
}
```

This is the &quot;ERC1261 Metadata JSON Schema&quot; referenced above.

```json
{
  &quot;title&quot;: &quot;Organization Metadata&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Identifies the organization to which this MVT represents&quot;
    },
    &quot;description&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Describes the organization to which this MVT represents&quot;
    }
  }
}
```

### Caveats

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:

- Solidity issue #3412: The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: `payable`, implicit nonpayable, `view`, and `pure`. Your implementation MUST meet the mutability guarantee in this interface and you MAY meet a stronger guarantee. For example, a `payable` 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.
- Solidity issue #3419: A contract that implements `ERC1261Metadata` SHALL also implement `ERC1261`.
- Solidity issue #2330: If a function is shown in this specification as `external` then a contract will be compliant if it uses `public` visibility. As a workaround for version 0.4.24, you can edit this interface to switch to `public` before inheriting from your contract.
- Solidity issues #3494, #3544: Use of `this.*.selector` is marked as a warning by Solidity, a future version of Solidity will not mark this as an error.

_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._

## Rationale

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.

**MVT Word Choice:**

Since the tokens are non transferable and revocable, they function like membership cards. Hence the word membership verification token.

**Transfer Mechanism**

MVTs can&apos;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.

**Assign and Revoke mechanism**

The assign and revoke functions&apos; documentation only specify conditions when the transaction MUST throw. Your implementation MAY also throw in other situations. This allows implementations to achieve interesting results:

- **Disallow additional memberships after a condition is met** — Sample contract available on GitHub
- **Blacklist certain address from receiving MV tokens** — Sample contract available on GitHub
- **Disallow additional memberships after a certain time is reached** — Sample contract available on GitHub
- **Charge a fee to user of a transaction** — require payment when calling `assign` and `revoke` so that condition checks from external sources can be made

**ERC-173 Interface**

We chose Standard Interface for Ownership (ERC-173) to manage the ownership of a ERC-1261 contract.

A future EIP/ 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 `ERC1261Metadata`, or other interfaces by delegating to a separate contract.

**ERC-165 Interface**

We chose Standard Interface Detection (ERC-165) to expose the interfaces that a ERC-1261 smart contract supports.

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 `ERC1261Metadata`, or other interfaces by delegating to a separate contract.

**Gas and Complexity** (regarding the enumeration extension)

This specification contemplates implementations that manage a few and _arbitrarily large_ numbers of MVTs. If your application is able to grow then avoid using for/while loops in your code. These indicate your contract may be unable to scale and gas costs will rise over time without bound

**Privacy**

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/aren’t members. Without making that information public, it would not be possible to independently audit governance activity or track admin(entity owner) activity.

**Metadata Choices** (metadata extension)

We have required `name` and `symbol` 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.

We remind implementation authors that the empty string is a valid response to `name` and `symbol` 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 _your_ contract. How a client may determine which ERC-1261 smart contracts are well-known (canonical) is outside the scope of this standard.

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.

Metadata is returned as a string value. Currently this is only usable as calling from `web3`, not from other contracts. This is acceptable because we have not considered a use case where an on-blockchain application would query such information.

_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)_

**Community Consensus**

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.

## Backwards Compatibility

We have adopted `name` and `symbol` semantics from the ERC-20 specification.

Example MVT implementations as of July 2018:

- Membership Verification Token(https://github.com/chaitanyapotti/MembershipVerificationToken)

## Test Cases

Membership Verification Token ERC-1261 Token includes test cases written using Truffle.

## Implementations

Membership Verification Token ERC1261 -- a reference implementation

- MIT licensed, so you can freely use it for your projects
- Includes test cases
- Also available as a npm package - npm i membershipverificationtoken

## References

**Standards**

1. ERC-20 Token Standard. ./eip-20.md
1. ERC-165 Standard Interface Detection. ./eip-165.md
1. ERC-725/735 Claim Registry ./eip-725.md
1. ERC-173 Owned Standard. ./eip-173.md
1. JSON Schema. https://json-schema.org/
1. Multiaddr. https://github.com/multiformats/multiaddr
1. RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https://www.ietf.org/rfc/rfc2119.txt

**Issues**

1. The Original ERC-1261 Issue. https://github.com/ethereum/eips/issues/1261
1. Solidity Issue \#2330 -- Interface Functions are Axternal. https://github.com/ethereum/solidity/issues/2330
1. Solidity Issue \#3412 -- Implement Interface: Allow Stricter Mutability. https://github.com/ethereum/solidity/issues/3412
1. Solidity Issue \#3419 -- Interfaces Can&apos;t Inherit. https://github.com/ethereum/solidity/issues/3419

**Discussions**

1. Gitter #EIPs (announcement of first live discussion). https://gitter.im/ethereum/EIPs?at=5b5a1733d2f0934551d37642
1. ERC-1261 (announcement of first live discussion). https://github.com/ethereum/eips/issues/1261

**MVT Implementations and Other Projects**

1. Membership Verification Token ERC-1261 Token. https://github.com/chaitanyapotti/MembershipVerificationToken

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 14 Jul 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1261</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1261</guid>
      </item>
    
      <item>
        <title>Standard Signature Validation Method for Contracts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1271</comments>
        
        <description>## Abstract
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 `isValidSignature(hash, signature)` function on the signing contract, which can be called to validate a signature.

## Motivation

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.

One example of an application that requires signatures to be provided would be decentralized exchanges with off-chain orderbook, where buy/sell orders are signed messages. In these applications, EOAs sign orders, signaling their desire to buy/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.

## Specification

The key words &quot;MUST&quot;, &quot;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](https://www.ietf.org/rfc/rfc2119.txt).

```javascript
pragma solidity ^0.5.0;

contract ERC1271 {

  // bytes4(keccak256(&quot;isValidSignature(bytes32,bytes)&quot;)
  bytes4 constant internal MAGICVALUE = 0x1626ba7e;

  /**
   * @dev Should return whether the signature provided is valid for the provided hash
   * @param _hash      Hash of the data to be signed
   * @param _signature Signature byte array associated with _hash
   *
   * MUST return the bytes4 magic value 0x1626ba7e when function passes.
   * MUST NOT modify state (using STATICCALL for solc &lt; 0.5, view modifier for solc &gt; 0.5)
   * MUST allow external calls
   */ 
  function isValidSignature(
    bytes32 _hash, 
    bytes memory _signature)
    public
    view 
    returns (bytes4 magicValue);
}
```

`isValidSignature` 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. 

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.


## Rationale
We believe the name of the proposed function to be appropriate considering that an *authorized* 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. 

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 [EIP-712](./eip-712.md). 

`isValidSignature()` should not be able to modify states in order to prevent `GasToken` 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.

The specific return value is expected to be returned instead of a boolean in order to have stricter and simpler verification of a signature. 

## Backwards Compatibility

This EIP is backward compatible with previous work on signature validation since this method is specific to contract based signatures and not EOA signatures. 

## Reference Implementation

Example implementation of a signing contract:

```solidity

  /**
   * @notice Verifies that the signer is the owner of the signing contract.
   */
  function isValidSignature(
    bytes32 _hash,
    bytes calldata _signature
  ) external override view returns (bytes4) {
    // Validate signatures
    if (recoverSigner(_hash, _signature) == owner) {
      return 0x1626ba7e;
    } else {
      return 0xffffffff;
    }
  }

 /**
   * @notice Recover the signer of hash, assuming it&apos;s an EOA account
   * @dev Only for EthSign signatures
   * @param _hash       Hash of message that was signed
   * @param _signature  Signature encoded as (bytes32 r, bytes32 s, uint8 v)
   */
  function recoverSigner(
    bytes32 _hash,
    bytes memory _signature
  ) internal pure returns (address signer) {
    require(_signature.length == 65, &quot;SignatureValidator#recoverSigner: invalid signature length&quot;);

    // Variables are not scoped in Solidity.
    uint8 v = uint8(_signature[64]);
    bytes32 r = _signature.readBytes32(0);
    bytes32 s = _signature.readBytes32(32);

    // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
    // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
    // the valid range for s in (281): 0 &lt; s &lt; secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
    // signatures from current libraries generate a unique signature with an s-value in the lower half order.
    //
    // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
    // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
    // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
    // these malleable signatures as well.
    //
    // Source OpenZeppelin
    // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol

    if (uint256(s) &gt; 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
      revert(&quot;SignatureValidator#recoverSigner: invalid signature &apos;s&apos; value&quot;);
    }

    if (v != 27 &amp;&amp; v != 28) {
      revert(&quot;SignatureValidator#recoverSigner: invalid signature &apos;v&apos; value&quot;);
    }

    // Recover ECDSA signer
    signer = ecrecover(_hash, v, r, s);
    
    // Prevent signer from being 0x0
    require(
      signer != address(0x0),
      &quot;SignatureValidator#recoverSigner: INVALID_SIGNER&quot;
    );

    return signer;
  }
```

Example implementation of a contract calling the isValidSignature() function on an external signing contract ; 

```solidity
  function callERC1271isValidSignature(
    address _addr,
    bytes32 _hash,
    bytes calldata _signature
  ) external view {
    bytes4 result = IERC1271Wallet(_addr).isValidSignature(_hash, _signature);
    require(result == 0x1626ba7e, &quot;INVALID_SIGNATURE&quot;);
  }
```

## Security Considerations
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.

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.


## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 25 Jul 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1271</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1271</guid>
      </item>
    
      <item>
        <title>Smart Contract Package Registry Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1319</comments>
        
        <description>## Simple Summary
A standard interface for smart contract package registries.

## Abstract
This EIP specifies an interface for publishing to and retrieving assets from smart contract package registries. It is a companion EIP to [1123](./eip-1123.md) which defines a standard for smart contract package manifests.

## Motivation
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.

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 `npm` and other package managers.

**Examples**
```shell
$ ethpm install packages.zeppelin.eth/Ownership
```

```javascript
const SimpleToken = await web3.packaging
                              .registry(&apos;packages.ethpm.eth&apos;)
                              .getPackage(&apos;simple-token&apos;)
                              .getVersion(&apos;^1.1.5&apos;);
```

## Specification
The specification describes a small read/write API whose components are mandatory. It allows registries to manage versioned releases using the conventions of [semver](https://semver.org/) without imposing this as a requirement. It assumes registries will share the following structure and conventions:

+ a **registry** is a deployed contract which manages a collection of **packages**.
+ a **package** is a collection of **releases**
+ a **package** is identified by a unique string name and unique bytes32 **packageId** within a given **registry**
+ a **release** is identified by a `bytes32` **releaseId** which must be unique for a given package name and release version string pair.
+ a **releaseId** maps to a set of data that includes a **manifestURI** string which describes the location of an [EIP 1123 package manifest](./eip-1123.md). This manifest contains data about the release including the location of its component code assets.
+ a **manifestURI** is a URI as defined by [RFC3986](https://tools.ietf.org/html/rfc3986) which can be used to retrieve the contents of the package manifest. In addition to validation against RFC3986, each **manifestURI** must also contain a hash of the content as specified in the [EIP-1123](./eip-1123.md).

### Examples

**Package Names / Release Versions**

```shell
&quot;simple-token&quot; # package name
&quot;1.0.1&quot;        # version string
```

**Release IDs**

Implementations are free to choose any scheme for generating a **releaseId**. A common approach would be to hash the strings together as below:

```solidity
// Hashes package name and a release version string
function generateReleaseId(string packageName, string version)
  public
  view
  returns (bytes32 releaseId)
  {
    return keccak256(abi.encodePacked(packageName, version));
  }
```
Implementations **must** expose this id generation logic as part of their public `read` API so
tooling can easily map a string based release query to the registry&apos;s unique identifier for that release.

**Manifest URIs**

Any IPFS or Swarm URI meets the definition of **manifestURI**.

Another example is content on GitHub addressed by its SHA-1 hash. The Base64 encoded content at this hash can be obtained by running:
```shell
$ curl https://api.github.com/repos/:owner/:repo/git/blobs/:file_sha

# Example
$ curl https://api.github.com/repos/rstallman/hello/git/blobs/ce013625030ba8dba906f756967f9e9ca394464a
```

The string &quot;hello&quot; can have its GitHub SHA-1 hash independently verified by comparing it to the output of:
```shell
$ printf &quot;blob 6\000hello\n&quot; | sha1sum
&gt; ce013625030ba8dba906f756967f9e9ca394464a
```

### Write API Specification
The write API consists of a single method, `release`. 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.
```solidity
function release(string packageName, string version, string manifestURI) public
  returns (bytes32 releaseId);
```

### Events

#### VersionRelease
MUST be triggered when `release` is successfully called.

```solidity
event VersionRelease(string packageName, string version, string manifestURI)
```

### Read API Specification

The read API consists of a set of methods that allows tooling to extract all consumable data from a registry.

```solidity
// Retrieves a slice of the list of all unique package identifiers in a registry.
// `offset` and `limit` enable paginated responses / retrieval of the complete set.  (See note below)
function getAllPackageIds(uint offset, uint limit) public view
  returns (
    bytes32[] packageIds,
    uint pointer
  );

// Retrieves the unique string `name` associated with a package&apos;s id.
function getPackageName(bytes32 packageId) public view returns (string packageName);

// Retrieves the registry&apos;s unique identifier for an existing release of a package.
function getReleaseId(string packageName, string version) public view returns (bytes32 releaseId);

// Retrieves a slice of the list of all release ids for a package.
// `offset` and `limit` enable paginated responses / retrieval of the complete set. (See note below)
function getAllReleaseIds(string packageName, uint offset, uint limit) public view
  returns (
    bytes32[] releaseIds,
    uint pointer
  );

// Retrieves package name, release version and URI location data for a release id.
function getReleaseData(bytes32 releaseId) public view
  returns (
    string packageName,
    string version,
    string manifestURI
  );

// Retrieves the release id a registry *would* generate for a package name and version pair
// when executing a release.
function generateReleaseId(string packageName, string version)
  public
  view
  returns (bytes32 releaseId);

// Returns the total number of unique packages in a registry.
function numPackageIds() public view returns (uint totalCount);

// Returns the total number of unique releases belonging to the given packageName in a registry.
function numReleaseIds(string packageName) public view returns (uint totalCount);
```
**Pagination**

`getAllPackageIds` and `getAllReleaseIds` support paginated requests because it&apos;s possible that the return values for these methods could become quite large. The methods should return a `pointer` 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 [here](https://mixmax.com/blog/api-paging-built-the-right-way) for a discussion of the merits and demerits of various pagination strategies.) The `limit` parameter defines the maximum number of items a registry should return per request.

## Rationale
The proposal hopes to accomplish the following:

+ 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.
+ 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.
+ 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&apos;s releases.

Registries may offer more complex `read` APIs that manage requests for packages within a semver range or at `latest` etc. This EIP is agnostic about how tooling or registries might implement these. It recommends that registries implement [EIP-165](./eip-165.md) and avail themselves of resources to publish more complex interfaces such as [EIP-926](./eip-926.md).

## Backwards Compatibility
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.

## Implementation
A reference implementation of this proposal is in active development at the EthPM organization on GitHub [here](https://github.com/ethpm/escape-truffle).

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 13 Aug 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1319</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1319</guid>
      </item>
    
      <item>
        <title>WalletConnect URI Format</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/wallet-connect-eip/850</comments>
        
        <description>## Abstract

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.

## Specification

### Syntax

WalletConnect request URI with the following parameters:

    request       = &quot;wc&quot; &quot;:&quot; topic [ &quot;@&quot; version ][ &quot;?&quot; parameters ]
    topic         = STRING
    version       = 1*DIGIT
    parameters    = parameter *( &quot;&amp;&quot; parameter )
    parameter     = key &quot;=&quot; value
    key           = STRING
    value         = STRING

### Semantics

Required parameters are dependent on the WalletConnect protocol version:

For WalletConnect v1.0 protocol (`version`=`1`) the parameters are:

- `key` - symmetric key used for encryption
- `bridge` - url of the bridge server for relaying messages

For WalletConnect v2.0 protocol (`version`=`2`) the parameters are:

- `symKey` - symmetric key used for encrypting messages over relay
- `methods` - jsonrpc methods supported for pairing topic
- `relay-protocol` - transport protocol for relaying messages
- `relay-data` - (optional) transport data for relaying messages
- `expiryTimestamp` - (optional) unix epoch in seconds when pairing expires

### Example

```
# 1.0
wc:8a5e5bdc-a0e4-4702-ba63-8f1a5655744f@1?bridge=https%3A%2F%2Fbridge.walletconnect.org&amp;key=41791102999c339c844880b23950704cc43aa840f3739e365323cda4dfa89e7a

# 2.0
wc:7f6e504bfad60b485450578e05678ed3e8e8c4751d3c6160be17160d63ec90f9@2?relay-protocol=irn&amp;symKey=587d5484ce2a2a6ee3ba1962fdd7e8588e06200c46823bd18fbd67def96ad303&amp;methods=[wc_sessionPropose],[wc_authRequest,wc_authBatchRequest]&quot;&amp;expiryTimestamp=1705934757
```

## Rationale

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.

## Backwards Compatibility

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.

## Security Considerations

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&apos;s private keys.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 15 Aug 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1328</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1328</guid>
      </item>
    
      <item>
        <title>Subscriptions on the blockchain</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-1337-subscriptions-on-the-blockchain/4422</comments>
        
        <description>## Simple Summary
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/surveillance) based models.  They are arguably more healthy than a token based economic system (depending upon the vesting model of the ICO) because

##### For a user:
 * you don&apos;t have to read a complex whitepaper to use a dapps utility (as opposed to utility tokens)
* you don&apos;t have to understand the founder&apos;s vesting schedules
* you can cancel anytime

##### For a Service Provider:
* since you know your subscriber numbers, churn numbers, conversion rate, you get consistent cash flow, and accurate projections
* you get to focus on making your customers happy 
* enables you to remove speculators from your ecosystem

For these reasons, we think it&apos;s imperative to create a standard way to do &apos;subscriptions&apos; on Ethereum.

## Abstract
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.

## Motivation
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.

## Specification
#### Enum Contract

EIP-1337 Contracts should be compiled with a contract that references all the enumerations that are required for operation

```SOLIDITY
/// @title Enum - Collection of enums
/// Original concept from Richard Meissner - &lt;richard@gnosis.pm&gt; Gnosis safe contracts
contract Enum {
    enum Operation {
        Call,
        DelegateCall,
        Create,
        ERC20, 
        ERC20Approve
    }
    enum SubscriptionStatus {
        ACTIVE,
        PAUSED,
        CANCELLED,
        EXPIRED
    }
    
    enum Period {
        INIT,
        DAY,
        WEEK,
        MONTH
    }
}
```

#### EIP-165

EIP-1337 compliant contracts support EIP-165 announcing what interfaces they support 

```SOLIDITY
interface ERC165 {
  /**
   * @notice Query if a contract implements an interface
   * @param interfaceID The interface identifier, as specified in ERC-165
   * @dev Interface identification is specified in ERC-165. This function
   * uses less than 30,000 gas.
   * @return `true` if the contract implements `interfaceID` and
   * `interfaceID` is not 0xffffffff, `false` otherwise
   **/
  function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

#### Public View Functions

###### isValidSubscription
```SOLIDITY

/** @dev Checks if the subscription is valid.
  * @param bytes subscriptionHash is the identifier of the customer&apos;s subscription with its relevant details.
  * @return success is the result of whether the subscription is valid or not.
  **/

function isValidSubscription(
            uint256 subscriptionHash
        ) 
        public 
        view 
        returns (
            bool success
        )
```
###### getSubscriptionStatus
```SOLIDITY

/** @dev returns the value of the subscription
  * @param bytes subscriptionHash is the identifier of the customer&apos;s subscription with its relevant details.
  * @return status is the enumerated status of the current subscription, 0 expired, 1 active, 2 paused, 3 cancelled
  **/
function getSubscriptionStatus(
        uint256 subscriptionHash
    )
    public 
    view 
    returns (
        uint256 status, 
        uint256 nextWithdraw
    )
```

###### getSubscriptionHash

```SOLIDITY
/** @dev returns the hash of cocatenated inputs to the address of the contract holding the logic.,
  * the owner would sign this hash and then provide it to the party for execution at a later date,
  * this could be viewed like a cheque, with the exception that unless you specifically
  * 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.
  * @param address recipient the address of the person who is getting the funds.
  * @param uint256 value the value of the transaction
  * @param bytes data the data the user is agreeing to
  * @param uint256 txGas the cost of executing one of these transactions in gas(probably safe to pad this)
  * @param uint256 dataGas the cost of executing the data portion of the transaction(delegate calls etc)
  * @param uint 256 gasPrice the agreed upon gas cost of Execution of this subscription(cost incurment is up to implementation, ie, sender or receiver)
  * @param address 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)
  * @param bytes meta dynamic bytes array with 4 slots, 2 required, 2 optional // address refundAddress / uint256 period / uint256 offChainID / uint256 expiration (uinx timestamp)
  * @return bytes32, return the hash input arguments concatenated to the address of the contract that holds the logic.
  **/
function getSubscriptionHash(
        address recipient,
        uint256 value,
        bytes data,
        Enum.Operation operation,
        uint256 txGas,
        uint256 dataGas,
        uint256 gasPrice,
        address gasToken,
        bytes meta
    )
    public
    view
    returns (
        bytes32 subscriptionHash
    )
```


###### getModifyStatusHash

```SOLIDITY
/** @dev returns the hash of concatenated inputs that the owners user would sign with their public keys
  * @param address recipient the address of the person who is getting the funds.
  * @param uint256 value the value of the transaction
  * @return bytes32 returns the hash of concatenated inputs with the address of the contract holding the subscription hash
  **/
function getModifyStatusHash(
        bytes32 subscriptionHash
        Enum.SubscriptionStatus status
    )
    public
    view
    returns (
        bytes32 modifyStatusHash
    )
```
#### Public Functions

###### modifyStatus
```SOLIDITY

/** @dev modifys the current subscription status
  * @param uint256 subscriptionHash is the identifier of the customer&apos;s subscription with its relevant details.
  * @param Enum.SubscriptionStatus status the new status of the subscription
  * @param bytes signatures of the requested method being called
  * @return success is the result of the subscription being paused
  **/
function modifyStatus(
        uint256 subscriptionHash, 
        Enum.SubscriptionStatus status, 
        bytes signatures
    ) 
    public 
    returns (
        bool success
    )
```

###### executeSubscription
```SOLIDITY

/** @dev returns the hash of cocatenated inputs to the address of the contract holding the logic.,
  * the owner would sign this hash and then provide it to the party for execution at a later date,
  * this could be viewed like a cheque, with the exception that unless you specifically
  * 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.
  * @param address recipient the address of the person who is getting the funds.
  * @param uint256 value the value of the transaction
  * @param bytes data the data the user is agreeing to
  * @param uint256 txGas the cost of executing one of these transactions in gas(probably safe to pad this)
  * @param uint256 dataGas the cost of executing the data portion of the transaction(delegate calls etc)
  * @param uint 256 gasPrice the agreed upon gas cost of Execution of this subscription(cost incurment is up to implementation, ie, sender or receiver)
  * @param address 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)
  * @param bytes meta dynamic bytes array with 4 slots, 2 required, 2 optional // address refundAddress / uint256 period / uint256 offChainID / uint256 expiration (uinx timestamp)
  * @param bytes signatures signatures concatenated that have signed the inputs as proof of valid execution
  * @return bool success something to note that a failed execution will still pay the issuer of the transaction for their gas costs.
  **/
function executeSubscription(
        address to,
        uint256 value,
        bytes data,
        Enum.Operation operation,
        uint256 txGas,
        uint256 dataGas,
        uint256 gasPrice,
        address gasToken,
        bytes meta,
        bytes signatures
    )
    public 
    returns (
        bool success
    )
```

## Rationale
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&apos;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.

## Backwards Compatibility
N/A

## Test Cases
TBD

## Implementation
TBD

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 01 Aug 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1337</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1337</guid>
      </item>
    
      <item>
        <title>Payable Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/eips/issues/1363</comments>
        
        <description>## Simple Summary
Defines a token interface for [ERC-20](./eip-20.md) tokens that supports executing recipient code after `transfer` or `transferFrom`, or spender code after `approve`.

## Abstract
Standard functions a token contract and contracts working with tokens can implement to make a token Payable.

`transferAndCall` and `transferFromAndCall` will call an `onTransferReceived` on a `ERC1363Receiver` contract.  

`approveAndCall` will call an `onApprovalReceived` on a `ERC1363Spender` contract.

## Motivation
There is no way to execute code after a [ERC-20](./eip-20.md) transfer or approval (i.e. making a payment), so to make an action it is required to send another transaction and pay GAS twice.

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.

There are many proposed uses of Ethereum smart contracts that can accept [ERC-20](./eip-20.md) payments. 

Examples could be 
* to create a token payable crowdsale
* selling services for tokens 
* paying invoices
* making subscriptions

For these reasons it was named as **&quot;Payable Token&quot;**.

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.

This proposal has been inspired by the [ERC-721](./eip-721.md) `onERC721Received` and `ERC721TokenReceiver` behaviours. 

## Specification
Implementing contracts **MUST** implement the [ERC-1363](./eip-1363.md) interface as well as the [ERC-20](./eip-20.md) and [ERC-165](./eip-165.md) interfaces.

```solidity
pragma solidity ^0.8.0;

interface ERC1363 /* is ERC20, ERC165 */ {
  /*
   * Note: the ERC-165 identifier for this interface is 0xb0202a11.
   * 0xb0202a11 ===
   *   bytes4(keccak256(&apos;transferAndCall(address,uint256)&apos;)) ^
   *   bytes4(keccak256(&apos;transferAndCall(address,uint256,bytes)&apos;)) ^
   *   bytes4(keccak256(&apos;transferFromAndCall(address,address,uint256)&apos;)) ^
   *   bytes4(keccak256(&apos;transferFromAndCall(address,address,uint256,bytes)&apos;)) ^
   *   bytes4(keccak256(&apos;approveAndCall(address,uint256)&apos;)) ^
   *   bytes4(keccak256(&apos;approveAndCall(address,uint256,bytes)&apos;))
   */

  /**
   * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
   * @param to address The address which you want to transfer to
   * @param value uint256 The amount of tokens to be transferred
   * @return true unless throwing
   */
  function transferAndCall(address to, uint256 value) external returns (bool);

  /**
   * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
   * @param to address The address which you want to transfer to
   * @param value uint256 The amount of tokens to be transferred
   * @param data bytes Additional data with no specified format, sent in call to `to`
   * @return true unless throwing
   */
  function transferAndCall(address to, uint256 value, bytes memory data) external returns (bool);

  /**
   * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver
   * @param from address The address which you want to send tokens from
   * @param to address The address which you want to transfer to
   * @param value uint256 The amount of tokens to be transferred
   * @return true unless throwing
   */
  function transferFromAndCall(address from, address to, uint256 value) external returns (bool);


  /**
   * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver
   * @param from address The address which you want to send tokens from
   * @param to address The address which you want to transfer to
   * @param value uint256 The amount of tokens to be transferred
   * @param data bytes Additional data with no specified format, sent in call to `to`
   * @return true unless throwing
   */
  function transferFromAndCall(address from, address to, uint256 value, bytes memory data) external returns (bool);

  /**
   * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
   * and then call `onApprovalReceived` on spender.
   * @param spender address The address which will spend the funds
   * @param value uint256 The amount of tokens to be spent
   * @return true unless throwing
   */
  function approveAndCall(address spender, uint256 value) external returns (bool);

  /**
   * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
   * and then call `onApprovalReceived` on spender.
   * @param spender address The address which will spend the funds
   * @param value uint256 The amount of tokens to be spent
   * @param data bytes Additional data with no specified format, sent in call to `spender`
   * @return true unless throwing
   */
  function approveAndCall(address spender, uint256 value, bytes memory data) external returns (bool);
}

interface ERC20 {
  function totalSupply() external view returns (uint256);
  function balanceOf(address account) external view returns (uint256);
  function transfer(address recipient, uint256 amount) external returns (bool);
  function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
  function allowance(address owner, address spender) external view returns (uint256);
  function approve(address spender, uint256 amount) external returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);
}

interface ERC165 {
  function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
```

A contract that wants to accept token payments via `transferAndCall` or `transferFromAndCall` **MUST** implement the following interface:

```solidity
/**
 * @title ERC1363Receiver interface
 * @dev Interface for any contract that wants to support `transferAndCall` or `transferFromAndCall`
 *  from ERC1363 token contracts.
 */
interface ERC1363Receiver {
  /*
   * Note: the ERC-165 identifier for this interface is 0x88a7ca5c.
   * 0x88a7ca5c === bytes4(keccak256(&quot;onTransferReceived(address,address,uint256,bytes)&quot;))
   */

  /**
   * @notice Handle the receipt of ERC1363 tokens
   * @dev Any ERC1363 smart contract calls this function on the recipient
   * after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the
   * transfer. Return of other than the magic value MUST result in the
   * transaction being reverted.
   * Note: the token contract address is always the message sender.
   * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function
   * @param from address The address which are token transferred from
   * @param value uint256 The amount of tokens transferred
   * @param data bytes Additional data with no specified format
   * @return `bytes4(keccak256(&quot;onTransferReceived(address,address,uint256,bytes)&quot;))`
   *  unless throwing
   */
  function onTransferReceived(address operator, address from, uint256 value, bytes memory data) external returns (bytes4);
}
``` 

A contract that wants to accept token payments via `approveAndCall` **MUST** implement the following interface:

```solidity
/**
 * @title ERC1363Spender interface
 * @dev Interface for any contract that wants to support `approveAndCall`
 *  from ERC1363 token contracts.
 */
interface ERC1363Spender {
  /*
   * Note: the ERC-165 identifier for this interface is 0x7b04a2d0.
   * 0x7b04a2d0 === bytes4(keccak256(&quot;onApprovalReceived(address,uint256,bytes)&quot;))
   */

  /**
   * @notice Handle the approval of ERC1363 tokens
   * @dev Any ERC1363 smart contract calls this function on the recipient
   * after an `approve`. This function MAY throw to revert and reject the
   * approval. Return of other than the magic value MUST result in the
   * transaction being reverted.
   * Note: the token contract address is always the message sender.
   * @param owner address The address which called `approveAndCall` function
   * @param value uint256 The amount of tokens to be spent
   * @param data bytes Additional data with no specified format
   * @return `bytes4(keccak256(&quot;onApprovalReceived(address,uint256,bytes)&quot;))`
   *  unless throwing
   */
  function onApprovalReceived(address owner, uint256 value, bytes memory data) external returns (bytes4);
}
``` 

## Rationale
The choice to use `transferAndCall`, `transferFromAndCall` and `approveAndCall` derives from the [ERC-20](./eip-20.md) naming. They want to highlight that they have the same behaviours of `transfer`, `transferFrom` and `approve` with the addition of a callback on receiver or spender.

## Backwards Compatibility
This proposal has been inspired also by [ERC-223](https://github.com/ethereum/EIPs/issues/223) and [ERC-677](https://github.com/ethereum/EIPs/issues/677) but it uses the [ERC-721](./eip-721.md) approach, so it doesn&apos;t override the [ERC-20](./eip-20.md) `transfer` and `transferFrom` methods and defines the interfaces IDs to be implemented maintaining the [ERC-20](./eip-20.md) backwards compatibility.  

## Security Considerations
The `approveAndCall` and `transferFromAndCall` methods can be affected by the same issue of the standard [ERC-20](./eip-20.md) `approve` and `transferFrom` method.
  
Changing an allowance with the `approveAndCall` methods brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering.

One possible solution to mitigate this race condition is to first reduce the spender&apos;s allowance to 0 and set the desired value afterwards ([EIP-20#issuecomment-263524729](https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729)).

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 30 Aug 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1363</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1363</guid>
      </item>
    
      <item>
        <title>Attestation management contract</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1386</comments>
        
        <description>### Introduction

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.

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.

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.

### Purpose

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.

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.

### Example use cases

Let&apos;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.

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.

Alice is able to split up this attestation (see merkle tree attestations ERC [here](https://github.com/alpha-wallet/blockchain-attestation/blob/master/ethereum/lib/MerkleTreeAttestation.sol)) and provides only the leaf that states she is over the age of 21.

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.

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&apos;s licence authority, as attestations to age from a school ID are not of a high enough capacity.

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.

When the wine vendor shows up to her apartment with the wine, there is no need to prove her age again.

### Draft interface
```solidity
/* each attestation issuer should provide their own verify() for the
 * attestations they issued. There are two reasons for this. First, we
 * need to leave room for new attestation methods other than the
 * Merkle Tree format we are recommending. Second, the validity of the
 * attestation may depend on the context that only the attestor
 * knows. For example, a ticket as an attestation issued on a
 * successful redemption of an American Express credit */

contract Issuer {
  struct Attestation
    {
        bytes32[] merklePath;
        bool valid;
        uint8 v;
        bytes32 r;
        bytes32 s;
        address attestor;
        address recipient;
        bytes32 salt;
        bytes32 key;
        bytes32 val;
    }`
  /* Verify the authenticity of an attestation */
  function verify(Attestation attestation);
  function addattestorKey(address newAttestor, string capacity, uint expiry);

  /* this should call the revoke first */
  function replaceKey(address attestorToReplace, string capacity, uint expiry, address newAttestor);

  /* this revokes a single key */
  function removeKey(address attestor);

  /* if the key exists with such capacity and isn&apos;t revoked or expired */
  function validateKey(address attestor, string capacity) returns (bool);

  /* revoke an attestation by replace the bloom filter, this helps preserve privacy */
  function revokeAttestations(Bloomfilter b);

}
```

Please click [here](https://github.com/alpha-wallet/blockchain-attestation/blob/master/ethereum/example-james-squire/james-squire.sol) to see a draft implementation of this interface

### Related ERC&apos;s
#1388 #1387
</description>
        <pubDate>Sat, 08 Sep 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1386</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1386</guid>
      </item>
    
      <item>
        <title>Merkle Tree Attestations with Privacy enabled</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1387</comments>
        
        <description>### Introduction

It&apos;s often needed that an Ethereum smart contract must verify a claim (I live in Australia) attested by a valid attester.

For example, an ICO contract might require that the participant, Alice, lives in Australia before she participates. Alice&apos;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;.

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.

## Purpose
This ERC provides an interface and reference implementation for smart contracts that need users to provide an attestation and validate it.

### Draft implementation
```solidity
contract MerkleTreeAttestationInterface {
    struct Attestation
    {
        bytes32[] merklePath;
        bool valid;
        uint8 v;
        bytes32 r;
        bytes32 s;
        address attester;
        address recipient;
        bytes32 salt;
        bytes32 key;
        bytes32 val;
    }

    function validate(Attestation attestation) public returns(bool);
}

```
### Relevant implementation examples
[Here](https://github.com/alpha-wallet/blockchain-attestation/blob/master/ethereum/lib/MerkleTreeAttestation.sol) is an example implementation of the MerkleTreeAttestationInterface
[Here](https://github.com/alpha-wallet/blockchain-attestation/blob/master/ethereum/example-james-squire/james-squire.sol) is an example service which would use such a merkle tree attestation

### Related ERC&apos;s
#1388 #1386
</description>
        <pubDate>Sat, 08 Sep 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1387</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1387</guid>
      </item>
    
      <item>
        <title>Attestation Issuers Management List</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1388</comments>
        
        <description>### Introduction

In smart contracts, we will need methods to handle cryptographic attestations to a users identifier or abilities. Let&apos;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.

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&apos;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.

Anyone can publish a list of issuers. Only the most trusted and carefully maintained lists gets popular use.

### Purpose
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.

### Draft implementation
```solidity
    /* The purpose of this contract is to manage the list of attestation
     * issuer contracts and their capacity to fulfill requirements
     */
 contract ManagedListERC
    {
      /* a manager is the steward of a list. Only he/she/it can change the
       * list by removing/adding attestation issuers to the list.

       * An issuer in the list is represented by their contract
       * addresses, not by the attestation signing keys managed by such a
       * contract.
       */
      struct List
      {
	      string name;
	      string description; // short description of what the list entails
	      string capacity; // serves as a filter for the attestation signing keys
	  /* if a smart contract specifies a list, only attestation issued
	   * by issuers on that list is accepted. Furthermore, if that
	   * list has a non-empty capacity, only attestations signed by a
	   * signing key with that capacity is accepted. */

	    address[] issuerContracts; // all these addresses are contracts, no signing capacity
	    uint expiry;
      }

      // find which list the sender is managing, then add an issuer to it
      function addIssuer(address issuerContractAddress) public;

      //return false if the list identified by the sender doesn&apos;t have this issuer in the list
      function removeIssuer(address issuerContractAddress, List listToRemoveIssuerFrom) public returns(bool);

      /* called by services, e.g. Kiwi Properties or James Squire */
      /* loop through all issuer&apos;s contract and execute validateKey() on
       * every one of them in the hope of getting a hit, return the
       * contract address of the first hit. Note that there is an attack
       * method for one issuer to claim to own the key of another which
       * is mitigated by later design. */
       //loop through the issuers array, calling validate on the signingKeyOfAttestation
      function getIssuerCorrespondingToAttestationKey(bytes32 list_id, address signingKeyOfAttestation) public returns (address);

       /* for simplicity we use sender&apos;s address as the list ID,
	 * accepting these consequences: a) if one user wish to maintain
	 * several lists with different capacity, he or she must use a
	 * different sender address for each. b) if the user replaced the
	 * sender&apos;s key, either because he or she suspects the key is
	 * compromised or that it is lost and reset through special means,
	 * then the list is still identified by the first sender&apos;s
	 * address.
      */

      function createList(List list) public;

      /* replace list manager&apos;s key with the new key */
      function replaceListIndex(List list, address manager) public returns(bool);

    }
```

Click [here](https://github.com/alpha-wallet/blockchain-attestation/blob/master/ethereum/trustlist/ManagedList.sol) to see an example implementation of this ERC

### Related ERC&apos;s
#1387 #1386
</description>
        <pubDate>Sat, 08 Sep 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1388</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1388</guid>
      </item>
    
      <item>
        <title>Poll Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1417</comments>
        
        <description>## Note to Readers

1. We have created a couple of implementations of polls for varied use cases.
   Please refer to them [here](https://github.com/chaitanyapotti/Voting)

## Simple Summary

A standard interface for Polls to be used with EIP-1261 (MVT).

## Abstract

The following standard allows for the implementation of a standard API for polls to be used with MVTs (refer [EIP-1261](./eip-1261.md)). 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.

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:

- 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.
- 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&apos;t hold the appropriate ERC - 20/ 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.
- 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.
- 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.
- 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.
- 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.

The poll standard is intended to be a smart contract standard that makes poll deployment flexible, transparent and accessible.

## Motivation

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.

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.

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.

1. 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.

2. 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.

3. 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.

4. 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.

5. 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.

6. 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.

All that being said, we are very excited to share our proposal with the community and open up to suggestions in this space.

### Benefits

1. Building applications (pollscan.io) on top of a standardized voting interface enables transparency and encourage more DAO/DAICO&apos;s to act responsibly in terms of governance
2. Create Action contracts which take actions programmatically based on the result of a poll
3. Allow the compatibility with token standard such as [ERC-20](./eip-20.md) or (./eip-777.md)) and membership standard such as [EIP-1261](./eip-1261.md)
4. Flexibility allows for various voting schemes including but not limited to modern schemes such as PLCR Voting

### Use-cases:

Polls are useful in any context of collective decision making, which include but aren&apos;t limited to:

1. Governing public resources, like ponds, playgrounds, streets etc
2. Maintaining fiscal policy in a transparent consensus driven manner
3. Governing crowdfunded projects - refer DAICO, Vitalik Buterin
4. Implementation of Futarchy
5. Decision making in political parties, and municipal corporations
6. Governing expenditure of a cryptocurrency community

## Specification

The key words &quot;MUST&quot;, &quot;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.

**Every ERC-1417 compliant contract must implement the `ERC1417` and `ERC165` interfaces** (subject to &quot;caveats&quot; below):

```solidity
/// @title ERC-1417 Poll Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1417.md
///  Note: the ERC-165 identifier for this interface is 0x4fad898b.
interface IPoll {
    /// @dev This emits when a person tries to vote without permissions. Useful for auditing purposes.
    ///  E.g.: To prevent an admin to revoke permissions; calculate the result had they not been removed.
    /// @param _from User who tried to vote
    /// @param _to the index of the proposal he voted to
    /// @param voteWeight the weight of his vote
    event TriedToVote(address indexed _from, uint8 indexed _to, uint voteWeight);

    /// @dev This emits when a person votes successfully
    /// @param _from User who successfully voted
    /// @param _to the index of the proposal he voted to
    /// @param voteWeight the weight of his vote
    event CastVote(address indexed _from, uint8 indexed _to, uint voteWeight);

    /// @dev This emits when a person revokes his vote
    /// @param _from User who successfully unvoted
    /// @param _to the index of the proposal he unvoted
    /// @param voteWeight the weight of his vote
    event RevokedVote(address indexed _from, uint8 indexed _to, uint voteWeight);

    /// @notice Handles the vote logic
    /// @dev updates the appropriate data structures regarding the vote.
    ///  stores the proposalId against the user to allow for unvote
    /// @param _proposalId the index of the proposal in the proposals array
    function vote(uint8 _proposalId) external;

    /// @notice Handles the unvote logic
    /// @dev updates the appropriate data structures regarding the unvote
    function revokeVote() external;

    /// @notice gets the proposal names
    /// @dev limit the proposal count to 32 (for practical reasons), loop and generate the proposal list
    /// @return the list of names of proposals
    function getProposals() external view returns (bytes32[]);

    /// @notice returns a boolean specifying whether the user can vote
    /// @dev implement logic to enable checks to determine whether the user can vote
    ///  if using eip-1261, use protocol addresses and interface (IERC1261) to enable checking with attributes
    /// @param _to the person who can vote/not
    /// @return a boolean as to whether the user can vote
    function canVote(address _to) external view returns (bool);

    /// @notice gets the vote weight of the proposalId
    /// @dev returns the current cumulative vote weight of a proposal
    /// @param _proposalId the index of the proposal in the proposals array
    /// @return the cumulative vote weight of the specified proposal
    function getVoteTally(uint _proposalId) external view returns (uint);

    /// @notice gets the no. of voters who voted for the proposal
    /// @dev use a struct to keep a track of voteWeights and voterCount
    /// @param _proposalId the index of the proposal in the proposals array
    /// @return the voter count of the people who voted for the specified proposal
    function getVoterCount(uint _proposalId) external view returns (uint);

    /// @notice calculates the vote weight associated with the person `_to`
    /// @dev use appropriate logic to determine the vote weight of the individual
    ///  For sample implementations, refer to end of the eip
    /// @param _to the person whose vote weight is being calculated
    /// @return the vote weight of the individual
    function calculateVoteWeight(address _to) external view returns (uint);

    /// @notice gets the leading proposal at the current time
    /// @dev calculate the leading proposal at the current time
    ///  For practical reasons, limit proposal count to 32.
    /// @return the index of the proposal which is leading
    function winningProposal() external view returns (uint8);

    /// @notice gets the name of the poll e.g.: &quot;Admin Election for Autumn 2018&quot;
    /// @dev Set the name in the constructor of the poll
    /// @return the name of the poll
    function getName() external view returns (bytes32);

    /// @notice gets the type of the Poll e.g.: Token (XYZ) weighted poll
    /// @dev Set the poll type in the constructor of the poll
    /// @return the type of the poll
    function getPollType() external view returns (bytes32);

    /// @notice gets the logic to be used in a poll&apos;s `canVote` function
    ///  e.g.: &quot;XYZ Token | US &amp; China(attributes in erc-1261) | Developers(attributes in erc-1261)&quot;
    /// @dev Set the Voterbase logic in the constructor of the poll
    /// @return the voterbase logic
    function getVoterBaseLogic() external view returns (bytes32);

    /// @notice gets the start time for the poll
    /// @dev Set the start time in the constructor of the poll as Unix Standard Time
    /// @return start time as Unix Standard Time
    function getStartTime() external view returns (uint);

    /// @notice gets the end time for the poll
    /// @dev Set the end time in the constructor of the poll as Unix Time or specify duration in constructor
    /// @return end time as Unix Standard Time
    function getEndTime() external view returns (uint);

    /// @notice returns the list of entity addresses (eip-1261) used for perimissioning purposes.
    /// @dev addresses list can be used along with IERC1261 interface to define the logic inside `canVote()` function
    /// @return the list of addresses of entities
    function getProtocolAddresses() external view returns (address[]);

    /// @notice gets the vote weight against all proposals
    /// @dev limit the proposal count to 32 (for practical reasons), loop and generate the vote tally list
    /// @return the list of vote weights against all proposals
    function getVoteTallies() external view returns (uint[]);

    /// @notice gets the no. of people who voted against all proposals
    /// @dev limit the proposal count to 32 (for practical reasons), loop and generate the vote count list
    /// @return the list of voter count against all proposals
    function getVoterCounts() external view returns (uint[]);

    /// @notice For single proposal polls, returns the total voterbase count.
    ///  For multi proposal polls, returns the total vote weight against all proposals
    ///  this is used to calculate the percentages for each proposal
    /// @dev limit the proposal count to 32 (for practical reasons), loop and generate the voter base denominator
    /// @return an integer which specifies the above mentioned amount
    function getVoterBaseDenominator() external view returns (uint);
}
```

### Caveats

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:

- Solidity issue #3412: The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: `payable`, implicit nonpayable, `view`, and `pure`. Your implementation MUST meet the mutability guarantee in this interface and you MAY meet a stronger guarantee. For example, a `payable` 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.
- Solidity issue #2330: If a function is shown in this specification as `external` then a contract will be compliant if it uses `public` visibility. As a workaround for version 0.4.24, you can edit this interface to switch to `public` before inheriting from your contract.

_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._

## Rationale

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:

1. Event logging: The logic behind maintaining event logs in the cases of:

   - Cast Vote
   - Unvote
   - 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.

2. 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.

3. 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.

4. 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.

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.

**Gas and Complexity** (regarding the enumeration for proposal count)

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/while loops in your code. These indicate your contract may be unable to scale and gas costs will rise over time without bound

**Privacy**

Personal information: The standard does not put any personal information on to the blockchain, so there is no compromise of privacy in that respect.

**Community Consensus**

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.

## Test Cases

Voting Standard includes test cases written using Truffle.

## Implementations

Voting Standard -- a reference implementation

- MIT licensed, so you can freely use it for your projects
- Includes test cases
- Also available as a npm package - npm i electusvoting

## References

**Standards**

- [EIP-20: ERC-20 Token Standard (a.k.a. ERC-20)](./eip-20.md)
- [EIP-165: Standard Interface Detection](./eip-165.md)
- [EIP-721: Non-Fungible Token Standard(a.k.a. ERC-721)](./eip-721.md)
- [ERC-1261 MV Token Standard](./eip-1261.md)
- [RFC 2119 Key words for use in RFCs to Indicate Requirement Levels](https://www.ietf.org/rfc/rfc2119.txt)

**Issues**

1. The Original ERC-1417 Issue. https://github.com/ethereum/eips/issues/1417
1. Solidity Issue \#2330 -- Interface Functions are Axternal. https://github.com/ethereum/solidity/issues/2330
1. Solidity Issue \#3412 -- Implement Interface: Allow Stricter Mutability. https://github.com/ethereum/solidity/issues/3412
1. Solidity Issue \#3419 -- Interfaces Can&apos;t Inherit. https://github.com/ethereum/solidity/issues/3419

**Discussions**

1. ERC-1417 (announcement of first live discussion). https://github.com/ethereum/eips/issues/1417

**Voting Implementations and Other Projects**

- [Voting Implementations](https://github.com/chaitanyapotti/Voting)

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 16 Sep 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1417</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1417</guid>
      </item>
    
      <item>
        <title>dApp Components (avatar) &amp; Universal Wallet</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethresear.ch/t/avatar-system-and-universal-wallet-for-ethereum-address/3473</comments>
        
        <description>## Simple Summary
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.

## Abstract
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; 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.

## Motivation
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.

### Seeds for improvement of the blockchain ecosystem.
- Synergy - With other dApps and resources.
- Enhanced interface - For ERC20 tokens.
- Easy &amp; Decentralized - Everyone should be able to add to their services easily, without censorship.


#### The following avatar store, badge system, and universal wallet are kind of examples about component dApp.
![intro](../assets/eip-1438/intro.png)

## Specification
### 1. Avatar
#### 1.1. Avatar Shop
- The avatar store is created after ERC20 currency is set.
- You can customize asset category &amp; viewer script.

#### 1.2. Upload asset &amp; user data
The avatar&apos;s information &amp; assets are stored in the event log part of the block chain.
- Assets are SVG format. (compressed with gzip)
- avatar information data is json (compressed with msgpack)

![avatar](../assets/eip-1438/avatar.png)
** The avatar assets from [Avataaars](https://github.com/fangpenlin/avataaars) developed by [Fang-Pen Lin](https://twitter.com/fangpenlin), the original avatar is designed by [Pablo Stanley](https://twitter.com/pablostanley).

### 2. Universal Wallet
![wallet](../assets/eip-1438/wallet.png)
#### 2.1. ERC20 interface
``` js
contract ERC20Interface {
    function totalSupply() public constant returns (uint);
    function balanceOf(address tokenOwner) public constant returns (uint balance);
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom(address from, address to, uint tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
```

#### 2.2. Fixed ERC20 contract for receive approval and execute function in one call
``` js
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
    allowed[msg.sender][spender] = tokens;
    emit Approval(msg.sender, spender, tokens);
    ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
    return true;
}
```

#### 2.3. And ApproveAndCallFallBack contract for Fixed ERC20.
However, many ERC20 tokens are not prepared.
``` js
contract ApproveAndCallFallBack {
    function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
```
#### 2.4. Universal Wallet
We propose a Universal Wallet to solve this problem.

``` js
contract UniversalWallet is _Base {

    constructor(bytes _msgPack) _Base(_msgPack) public {}
    function () public payable {}

    //-------------------------------------------------------
    // erc20 interface
    //-------------------------------------------------------
    function balanceOf(address _erc20) public constant returns (uint balance) {
        if(_erc20==address(0))
            return address(this).balance;
        return _ERC20Interface(_erc20).balanceOf(this);
    }
    function transfer(address _erc20, address _to, uint _tokens) onlyOwner public returns (bool success) {
        require(balanceOf(_erc20)&gt;=_tokens);
        if(_erc20==address(0))
            _to.transfer(_tokens);
        else
            return _ERC20Interface(_erc20).transfer(_to,_tokens);
        return true;
    }
    function approve(address _erc20, address _spender, uint _tokens) onlyOwner public returns (bool success) {
        require(_erc20 != address(0));
        return _ERC20Interface(_erc20).approve(_spender,_tokens);
    }

    //-------------------------------------------------------
    // pay interface
    //-------------------------------------------------------
    function pay(address _store, uint _tokens, uint256[] _options) onlyOwner public {
        address erc20   = _ApproveAndCallFallBack(_store).erc20();
        address spender = _ApproveAndCallFallBack(_store).spender();
        if(erc20 == address(0)) {
            transfer(erc20,spender,_tokens);
            _ApproveAndCallFallBack(_store).receiveApproval(_options);
        } else {
            _ERC20Interface(erc20).approve(spender,_tokens);
            _ApproveAndCallFallBack(_store).receiveApproval(_options);
        }
    }
    function pay(address _store, uint _tokens, bytes _msgPack) onlyOwner public {
        address erc20   = _ApproveAndCallFallBack(_store).erc20();
        address spender = _ApproveAndCallFallBack(_store).spender();
        if(erc20 == address(0)) {
            transfer(erc20,spender,_tokens);
            _ApproveAndCallFallBack(_store).receiveApproval(_msgPack);
        } else {
            _ERC20Interface(erc20).approve(spender,_tokens);
            _ApproveAndCallFallBack(_store).receiveApproval(_msgPack);
        }
    }
}
```

## Test Cases
- https://www.nitro888.com
- https://github.com/Nitro888/nitro888.github.io
- https://github.com/Nitro888/dApp-Alliance

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 21 Sep 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1438</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1438</guid>
      </item>
    
      <item>
        <title>Localized Messaging with Signal-to-Text</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-1444-localized-messaging-with-signal-to-text/</comments>
        
        <description>## Simple Summary

A method of converting machine codes to human-readable text in any language and phrasing.

## Abstract

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.

## Motivation

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.

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.

There are several machine efficient ways of representing intent, status, state transition, and other semantic signals including booleans, enums and [ERC-1066 codes](./eip-1066.md). By providing human-readable messages for these signals, the developer experience is enhanced by returning easier to consume information with more context (ex. `revert`). End user experience is enhanced by providing text that can be propagated up to the UI.

## Specification

### Contract Architecture

Two types of contract: `LocalizationPreferences`, and `Localization`s.

The `LocalizationPreferences` contract functions as a proxy for `tx.origin`.

```diagram
                                                                   +--------------+
                                                                   |              |
                                                          +------&gt; | Localization |
                                                          |        |              |
                                                          |        +--------------+
                                                          |
                                                          |
+-----------+          +-------------------------+        |        +--------------+
|           |          |                         | &lt;------+        |              |
| Requestor | &lt;------&gt; | LocalizationPreferences | &lt;-------------&gt; | Localization |
|           |          |                         | &lt;------+        |              |
+-----------+          +-------------------------+        |        +--------------+
                                                          |
                                                          |
                                                          |        +--------------+
                                                          |        |              |
                                                          +------&gt; | Localization |
                                                                   |              |
                                                                   +--------------+
```

### `Localization`

A contract that holds a simple mapping of codes to their text representations.

```solidity
interface Localization {
  function textFor(bytes32 _code) external view returns (string _text);
}
```

#### `textFor`

Fetches the localized text representation.

```solidity
function textFor(bytes32 _code) external view returns (string _text);
```

### `LocalizationPreferences`

A proxy contract that allows users to set their preferred `Localization`. Text lookup is delegated to the user&apos;s preferred contract.

A fallback `Localization` with all keys filled MUST be available. If the user-specified `Localization` has not explicitly set a loalization (ie. `textFor` returns `&quot;&quot;`), the `LocalizationPreferences` MUST redelegate to the fallback `Localization`.

```solidity
interface LocalizationPreferences {
  function set(Localization _localization) external returns (bool);
  function textFor(bytes32 _code) external view returns (bool _wasFound, string _text);
}
```

#### `set`

Registers a user&apos;s preferred `Localization`. The registering user SHOULD be considered `tx.origin`.

```solidity
function set(Localization _localization) external;
```

#### `textFor`

Retrieve text for a code found at the user&apos;s preferred `Localization` contract.

The first return value (`bool _wasFound`) represents if the text is available from that `Localization`, or if a fallback was used. If the fallback was used in this context, the `textFor`&apos;s first return value MUST be set to `false`, and is `true` otherwise.

```solidity
function textFor(bytes32 _code) external view returns (bool _wasFound, string _text);
```

### String Format

All strings MUST be encoded as [UTF-8](https://www.ietf.org/rfc/rfc3629.txt).

```solidity
&quot;Špeĉiäl chârãçtérs are permitted&quot;
&quot;As are non-Latin characters: アルミ缶の上にあるみかん。&quot;
&quot;Emoji are legal: 🙈🙉🙊🎉&quot;
&quot;Feel free to be creative: (ﾉ◕ヮ◕)ﾉ*:･ﾟ✧&quot;
```

### Templates

Template strings are allowed, and MUST follow the [ANSI C `printf`](https://pubs.opengroup.org/onlinepubs/009696799/utilities/printf.html) conventions.

```solidity
&quot;Satoshi&apos;s true identity is %s&quot;
```

Text with 2 or more arguments SHOULD use the POSIX parameter field extension.

```solidity
&quot;Knock knock. Who&apos;s there? %1$s. %1$s who? %2$s!&quot;
```

## Rationale

### `bytes32` Keys

`bytes32` is very efficient since it is the EVM&apos;s base word size. Given the enormous number of elements (card(A) &gt; 1.1579 × 10&lt;sup&gt;77&lt;/sup&gt;), it can embed nearly any practical signal, enum, or state. In cases where an application&apos;s key is longer than `bytes32`, hashing that long key can map that value into the correct width.

Designs that use datatypes with small widths than `bytes32` (such as `bytes1` in [ERC-1066](./eip-1066.md)) can be directly embedded into the larger width. This is a trivial one-to-one mapping of the smaller set into the larger one.

### Local vs Globals and Singletons

This spec has opted to not _force_ 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 `LocalizationPreference` contracts for common use cases, share `Localization`s between different proxys, delegate translations between `Localization`s, and so on.

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 `LocalizationPreference`.

Rather the dispersing several `LocalizationPreference`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).

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.

### Off Chain Storage

A very viable alternative is to store text off chain, with a pointer to the translations on-chain, and emit or return a `bytes32` 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 `revert` messages.

### ASCII vs UTF-8 vs UTF-16

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.

Please see the [UTF-8 Everywhere Manifesto](https://utf8everywhere.org/) for more information.

### When No Text is Found

Returning a blank string to the requestor fully defeats the purpose of a localization system. The two options for handling missing text are:

1. A generic &quot;text not found&quot; message in the preferred language
2. The actual message, in a different language

#### Generic Option

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 `Localization` maintainer (if one even exists and updating is even possible).

#### Fallback Option

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 _some_ proficiency with the language, or at least be able to use an automated translation service.

Knowing that the text fell back via `textFor`s first return field boolean is _much_ 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.

### Decentralized Text Crowdsourcing

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.

### `printf`-style Format Strings

C-style `printf` 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.

#### Parameter Fields

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.

```solidity
(&quot;%1$s is an element with the atomic number %2$d!&quot;, &quot;Mercury&quot;, 80);
// =&gt; &quot;Mercury is an element with the atomic number 80!&quot;
```

#### Simplified Localizations

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.

```ruby
#!/usr/bin/env ruby

sprintf(&quot;%1$s é um elemento&quot;, &quot;Mercurio&quot;, 80)
# =&gt; &quot;Mercurio é um elemento&quot;
```

```clojure
#!/usr/bin/env clojure

(format &quot;Element #%2$s&quot; &quot;Mercury&quot; 80)
;; =&gt; Element #80
```

### Interpolation Strategy

Please note that it is highly advisable to return the template string _as is_, with arguments as multiple return values or fields in an `event`, leaving the actual interpolation to be done off chain.


```solidity
event AtomMessage {
  bytes32 templateCode;
  bytes32 atomCode;
  uint256 atomicNumber;
}
```

```javascript
#!/usr/bin/env node

var printf = require(&apos;printf&apos;);

const { returnValues: { templateCode, atomCode, atomicNumber } } = eventResponse;

const template = await AppText.textFor(templateCode);
// =&gt; &quot;%1$s ist ein Element mit der Ordnungszahl %2$d!&quot;

const atomName = await PeriodicTableText.textFor(atomCode);
// =&gt; &quot;Merkur&quot;

printf(template, atomName, 80);
// =&gt; &quot;Merkur ist ein Element mit der Ordnungszahl 80!&quot;
```

### Unspecified Behaviour

This spec does not specify:

* Public or private access to the default `Localization`
* Who may set text
  * Deployer
  * `onlyOwner`
  * Anyone
  * Whitelisted users
  * and so on
* When text is set
  * `constructor`
  * Any time
  * Write to empty slots, but not overwrite existing text
  * and so on

These are intentionally left open. There are many cases for each of these, and restricting any is fully beyond the scope of this proposal.

## Implementation

```solidity
pragma solidity ^0.4.25;

contract Localization {
  mapping(bytes32 =&gt; string) private dictionary_;

  constructor() public {}

  // Currently overwrites anything
  function set(bytes32 _code, string _message) external {
    dictionary_[_code] = _message;
  }

  function textFor(bytes32 _code) external view returns (string _message) {
    return dictionary_[_code];
  }
}

contract LocalizationPreference {
  mapping(address =&gt; Localization) private registry_;
  Localization public defaultLocalization;

  bytes32 private empty_ = keccak256(abi.encodePacked(&quot;&quot;));

  constructor(Localization _defaultLocalization) public {
    defaultLocalization = _defaultLocalization;
  }

  function set(Localization _localization) external returns (bool) {
    registry_[tx.origin] = _localization;
    return true;
  }

  function get(bytes32 _code) external view returns (bool, string) {
    return get(_code, tx.origin);
  }

  // Primarily for testing
  function get(bytes32 _code, address _who) public view returns (bool, string) {
    string memory text = getLocalizationFor(_who).textFor(_code);

    if (keccak256(abi.encodePacked(text)) != empty_) {
      return (true, text);
    } else {
      return (false, defaultLocalization.textFor(_code));
    }
  }

  function getLocalizationFor(address _who) internal view returns (Localization) {
    if (Localization(registry_[_who]) == Localization(0)) {
      return Localization(defaultLocalization);
    } else {
      return Localization(registry_[tx.origin]);
    }
  }
}
```

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 23 Sep 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1444</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1444</guid>
      </item>
    
      <item>
        <title>ERC-1450 A compatible security token for issuing and trading SEC-compliant securities</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-proposal-ldgrtoken-a-compatible-security-token-for-issuing-and-trading-sec-compliant-securities/1468</comments>
        
        <description># ERC-1450 - A compatible security token for issuing and trading SEC-compliant securities

## Simple Summary
`ERC-1450` is an `ERC-20` compatible token that enables issuing tokens representing securities that are required to comply with one or more of the following [Securities Act Regulations: Regulation Crowdfunding, Regulation D, and Regulation A](https://www.sec.gov/smallbusiness/exemptofferings).

## Abstract
`ERC-1450` facilitates the recording of ownership and transfer of securities sold in compliance with the [Securities Act Regulations CF, D and A](https://www.sec.gov/smallbusiness/exemptofferings). The issuance and trading of securities is subject to the Securities Exchange Commission (SEC) and specific U.S. state blue sky laws and regulations.

`ERC-1450` manages securities ownership during issuance and trading. The Issuer is the only role that should create a `ERC-1450` and assign the RTA. The RTA is the only role that is allowed to execute `ERC-1450`’s `mint`, `burnFrom`, and `transferFrom` functions. No role is allowed to execute `ERC-1450`’s `transfer` function.

## Motivation
With the advent of the [JOBS Act](https://www.sec.gov/spotlight/jobs-act.shtml) 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.

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 [Bank Secrecy Act/USA Patriot Act KYC and AML requirements](https://www.occ.treas.gov/topics/compliance-bsa/bsa/index-bsa.html). Other improvements (notably [EIP-1404 (Simple Restricted Token Standard)](https://github.com/ethereum/EIPs/issues/1404) 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 `transferFrom`, `mint`, and `burnFrom`.

## Specification
`ERC-1450` extends `ERC-20`.

### `ERC-1450`
`ERC-1450` requires that only the Issuer can create a token representing the security that only the RTA manages. Instantiating the `ERC-1450` requires the `Owned` and `IssuerControlled` modifiers, and only the Issuer should execute the `ERC-1450` constructor for a compliant token. `ERC-1450` extends the general `Ownable` modifier to describe a specific subset of owners that automate and decentralize compliance through the contract modifiers `Owned` and `IssuerControlled` and the function modifiers `onlyOwner` and `onlyIssuerTransferAgent`. The `Owned` contract modifier instantiates the `onlyOwner` modifier for functions. The `IssuerControlled` modifier instantiates the `onlyIssuerTransferAgent` modifier for functions.

`ERC-1450` must prevent anyone from executing the `transfer`, `allowance`, and `approve` functions and/or implement these functions to always fail. `ERC-1450` updates the `transferFrom`, `mint`, and `burnFrom` functions. `transferFrom`, `mint`, and `burnFrom` may only be executed by the RTA and are restricted with the `onlyIssuerTransferAgent` modifier. Additionally, `ERC-1450` defines the functions `transferOwnership`, `setTransferAgent`, `setPhysicalAddressOfOperation`, and `isTransferAgent`.  Only the issuer may call the `transferOwnership`, `setTransferAgent`, and `setPhysicalAddressOfOperation` functions. Anyone may call the `isTransferAgent` function.

### Issuers and RTAs
For compliance reasons, the `ERC-1450` constructor must specify the issuer (the `owner`), the RTA (`transferAgent`), the security’s `name`, and the security’s `symbol`.

#### Issuer Owned
`ERC-1450` must specify the `owner` in its constructor, apply the `Owned` modifier, and instantiate the `onlyOwner` modifier to enable specific functions to permit only the Issuer’s `owner` address to execute them. `ERC-1450` also defines the function `transferOwnership` which transfers ownership of the Issuer to the new `owner`’s address and can only be called by the `owner`. `transferOwnership` triggers the `OwnershipTransferred` event.

#### Issuer Controlled
`IssuerControlled` 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. `ERC-1450`‘s constructor must have an `IssuerControlled` modifier with the issuer specified in its `ERC-1450` constructor. `IssuerControlled` instantiates the `onlyIssuerTransferAgent` modifier for `ERC-1450` to enable specific functions (`setPhysicalAddressOfOperation` and `setTransferAgent`) to permit only the Issuer to execute these functions.

#### Register Transfer Agent Controlled
`ERC-1450` defines the `setTransferAgent` function (to change the RTA) and `setPhysicalAddressOfOperation` function (to change the Issuer’s address) and must restrict execution to the Issuer’s owner with the `onlyOwner` modifier. `setTransferAgent` must emit the `TransferAgentUpdated` event. `setPhysicalAddressOfOperation` must emit the `PhysicalAddressOfOperationUpdated` event.

`ERC-1450` must specify the `transferAgent` in its constructor and instantiate the `onlyIssuerTransferAgent` modifier to enable specific functions (`transferFrom`, `mint`, and `burnFrom`) to permit only the Issuer’s `transferAgent` address to execute them. `ERC-1450` also defines the public function `isTransferAgent` to lookup and identify the Issuer’s RTA.

#### Securities
`ERC-1450` updates the `transferFrom`, `mint`, and `burnFrom` functions by applying the `onlyIssuerTransferAgent` to enable the issuance, re-issuance, and trading of securities.

### ERC-20 Extension
`ERC-20` tokens provide the following functionality:

```solidity
contract ERC20 {
  function totalSupply() public view returns (uint256);
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  function allowance(address owner, address spender) public view returns (uint256);
  function transferFrom(address from, address to, uint256 value) public returns (bool);
  function approve(address spender, uint256 value) public returns (bool);
  event Approval(address indexed owner, address indexed spender, uint256 value);
  event Transfer(address indexed from, address indexed to, uint256 value);
}
```

`ERC-20` is extended as follows:

```solidity
/**
 * ERC-1450 is an ERC-20 compatible token that facilitates compliance with one or more of Securities Act Regulations CF, D and A. 
 *
 * Implementations of the ERC-1450 standard must define the following optional ERC-20
 *     fields:
 * 
 * name - The name of the security
 * symbol - The symbol of the security
 * 
 * Implementations of the ERC-1450 standard must specify the following constructor
 *   arguments:
 * 
 * _owner - the address of the owner
 * _transferAgent - the address of the transfer agent
 * _name - the name of the security
 * _symbol - the symbol of the security
 *  
 *  Implementations of the ERC-1450 standard must implement the following contract
 *      modifiers:
 * 
 * Owned - Only the address of the security’s issuer is permitted to execute the
 *     token’s constructor. This modifier also sets up the onlyOwner function modifier.
 * IssuerControlled - This modifier sets up the onlyIssuerTransferAgent function modifier.
 * 
 * Implementations of the ERC-1450 standard must implement the following function
 *      modifiers:
 * 
 * onlyOwner - Only the address of the security’s issuer is permitted to execute the
 *     functions transferOwnership, setTransferAgent, and setPhysicalAddressOfOperation.
 * onlyIssuerTransferAgent - Only the address of the issuer’s Registered Transfer
 *     Agent is permitted to execute the functions transferFrom, mint, and burnFrom.
 * 
 * Implementations of the ERC-1450 standard must implement the following required ERC-20
 *     event to always fail:
 * 
 * Approval - Should never be called as the functions that emit this event must be
 *     implemented to always fail. 
 * 
 * Implementations of the ERC-1450 standard must implement the following required
 *     ERC-20 functions to always fail:
 * 
 * transfer - Not a legal, regulated call for transferring securities because
 *     the token holder initiates the token transfer. The function must be implemented to
 *     always fail.
 * allowance - Not a legal, regulated call for transferring securities because
 *     the token holder may not allow third parties to initiate token transfers. The
 *     function must be implemented to always fail.
 * approve - Not a legal, regulated call for transferring securities because
 *     the token holder may not allow third parties to initiate token transfers. The
 *     function must be implemented to always fail.
 * 
 * Implementations of the ERC-1450 standard must implement the following optional
 *     ERC-20 function:
 * decimals - Must return &apos;0&apos; because securities are indivisible entities.
 * 
 * Implementations of the ERC-1450 standard must implement the following functions:
 * 
 * mint - Only the address of the issuer&apos;s Registered Transfer Agent may create new
 *     securities.
 * burnFrom - Only the address of the issuer’s Registered Transfer Agent may burn or 
 *     destroy securities.
 */

Contract ERC-1450 is Owned, IssuerControlled {

  /**
   * The constructor must implement a modifier (Owned) that creates the onlyOwner modifier
   * to allow only the address of the issuer (the owner) to execute the transferOwnership,
   * setTransferAgent, and setPhysicalAddressOfOperation functions. The construct must also
   * implement a modifier (TransferAgentControlled) that creates the onlyIssuerTransferAgent
   * modifier to allow only the address of the issuer’s Registered Transfer Agent to execute
   * the functions transferFrom, mint, and burnFrom).
   */
    constructor(address _owner, address _transferAgent, string _name, string _symbol)
          Owned(_issuer) TransferAgentControlled(_transferAgent) public;

    /**
     * Specify that only the owner (issuer) may execute a function.
     *
     * onlyOwner requires the msg.sender to be the owner’s address.
     */
    modifier onlyOwner();

    /**
     * Specify that only the issuer’s transferAgent may execute a function.
     *
     * onlyIssuerTransferAgent requires the msg.sender to be the transferAgent’s address.
     */
    modifier onlyIssuerTransferAgent();

    /**
     * Transfer ownership of a security from one issuer to another issuer.
     *
     * transferOwnership must implement the onlyOwner modifier to only allow the
     *     address of the issuer’s owner to transfer ownership.
     * transferOwnership requires the _newOwner address to be the address of the new
     *     issuer.
     */
    function transferOwnership(address _newOwner) public onlyOwner;

    /**
     * Triggered after transferOwnership is executed.
     */
    event OwnershipTransferred()

    /**
     * Sets the transfer agent for the security.
     *
     * setTransferAgent must implement the onlyOwner modifier to only allow the
     *     address of the issuer’s specify the security’s transfer agent.
     * setTransferAgent requires the _newTransferAgent address to be the address of the
     *     new transfer agent.
     */
    function setTransferAgent(address _newTransferAgent) public onlyOwner;

    /**
     * Triggered after setTransferAgent is executed.
     */
    event TransferAgentUpdated(address indexed previousTransferAgent, address indexed
        newTransferAgent);

    /**
     * Sets the issuers physical address of operation.
     *
     * setPhysicalAddressOfOperation must implement the onlyOwner modifier to only allow
     *     the address of the issuer’s owner to transfer ownership.
     * setPhysicalAddressOfOperation requires the _newPhysicalAddressOfOperation address
     *     to be the new address of the issuer.
     */
    function setPhysicalAddressOfOperation(string _newPhysicalAddressOfOperation) public
        onlyOwner;

    /**
     * Triggered after setPhysicalAddressOfOperation is executed.
     */
    event PhysicalAddressOfOperationUpdated(string previousPhysicalAddressOfOperation,
        string newPhysicalAddressOfOperation);

    /**
     * Look up the security’s transfer agent.
     *
     * isTransferAgent is a public function.
     * isTransferAgent requires the _lookup address to determine if that address
     *   is the security’s transfer agent.
     */
    function isTransferAgent(address _lookup) public view returns (bool);

    /**
     * transfer is not a legal, regulated call and must be implemented to always fail.
     */
    transfer(address to, uint tokens) public returns (bool success);

    /**
     * Approval does not have to be implemented. This event should never be triggered as
     * the functions that emit this even are not legal, regulated calls.
     */
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);

    /**
     * allowance is not a legal, regulated call and must be implemented to always fail.
     */
    allowance(address tokenOwner, address spender) public constant returns (uint remaining);

    /**
     * approve is not a legal, regulated call and must be implemented to always fail.
     */
    approve(address spender, uint tokens) public returns (bool success);

    /**
     * Transfer securities.
     *
     * transferFrom must implement the onlyIssuerTransferAgent modifier to only allow the
     *     address of the issuer’s Registered Transfer Agent to transfer `ERC-1450`s.
     * transferFrom requires the _from address to have _value tokens.
     * transferFrom requires that the _to address must not be 0 because securities must
     *     not destroyed in this manner.
     */
    function transferFrom(address _from, address _to, uint256 _value) public
        onlyIssuerTransferAgent returns (bool);

    /**
     * Create new securities.
     *
     * mint must implement the onlyIssuerTransferAgent modifier to only allow the address
     *     of the issuer’s Registered Transfer Agent to mint `ERC-1450` tokens.
     * mint requires that the _to address must not be 0 because securities must
     *     not destroyed in this manner.
     * mint must add _value tokens to the _to address and increase the totalSupply by
     *     _value.
     * mint must emit the Transfer event.
     */
    function mint(address _to, uint256 _value) public onlyIssuerTransferAgent returns
        (bool);

    /**
     * Burn or destroy securities.
     *
     * burnFrom must implement the onlyIssuerTransferAgent modifier to only allow the
     *     address of the issuer’s Registered Transfer Agent to burn `ERC-1450`s.
     * burnFrom requires the _from address to have _value tokens.
     * burnFrom must subtract _value tokens from the _from address and decrease the
     *     totalSupply by _value.
     * burnFrom must emit the Transfer event.
     */
    function burnFrom(address _who, uint256 _value) public onlyIssuerTransferAgent returns
        (bool);
}
```

### Securities Exchange Commission Requirements
The SEC has very strict requirements as to the specific roles that are allowed to perform specific actions. Specifically, only the RTA may `mint` and `transferFrom` securities.

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.

Private Investor information must never be publicly exposed on a public blockchain. 

### Managing Investor Information
Special care and attention must be taken to ensure that the personally identifiable information of Investors is never exposed or revealed to the public.

### Issuers who lost access to their address or private keys
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.

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 `mint` Investor securities accordingly under a new `ERC-1450` smart contract.

### Registered Transfer Agents who lost access to their address or private keys
If the RTA loses access, the RTA can create a new Ethereum address, and the Issuer can execute the `setTransferAgent` function to reassign the RTA.

### Handling Investors (security owners) who lost access to their addresses or private keys
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).

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 `mint` the “lost” securities to the new Investor address and `burnFrom` the old Investor address (because the RTA knows all Investors’ addresses).

## Rationale
The are currently no token standards that facilitate compliance with SEC regulations. The closest token is [ERC-884 (Delaware General Corporations Law (DGCL) compatible share token)](./eip-884.md) which states that SEC requirements are out of scope. [EIP-1404 (Simple Restricted Token Standard)](https://github.com/ethereum/EIPs/issues/1404) does not go far enough to address SEC requirements around re-issuing securities to Investors.

## Backwards Compatibility
`ERC-1450` maintains compatibility with ERC-20 tokens with the following stipulations:
* `function allowance(address tokenOwner, address spender) public constant returns (uint remaining);`
  * Must be implemented to always fail because allowance is not a legal, regulated call for a security.
* `function transfer(address to, uint tokens) public returns (bool success);`
  * As the token holder initiates the transfer, must be implemented to always fail because transfer is not a legal, regulated call for a security.
* `function approve(address spender, uint tokens) public returns (bool success);`
  * Must be implemented to always fail because approve is not a legal, regulated call for a security
* `function transferFrom(address from, address to, uint tokens) public returns (bool success);`
  * Must be implemented so that only the Issuer’s RTA can perform this action
* `event Approval(address indexed tokenOwner, address indexed spender, uint tokens);`
  * Does not have to be implemented. Approval should never be called as the functions that emit this event must be implemented to always fail

## Test Cases
Test cases are available at [https://github.com/StartEngine/ldgr_smart_contracts/tree/master/test](https://github.com/StartEngine/ldgr_smart_contracts/tree/master/test).

## Implementations
A reference implementation is available at [https://github.com/StartEngine/ldgr_smart_contracts](https://github.com/StartEngine/ldgr_smart_contracts).

## Copyright Waiver
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 25 Sep 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1450</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1450</guid>
      </item>
    
      <item>
        <title>Base Security Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-1462-base-security-token/1501</comments>
        
        <description>## Simple Summary

An extension to ERC-20 standard token that provides compliance with securities regulations and legal enforceability.

## Abstract

This EIP defines a minimal set of additions to the default token standard such as [ERC-20](./eip-20.md), 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.

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.

## Motivation

There are several security token standards that have been proposed recently. Examples include [ERC-1400](https://github.com/ethereum/EIPs/issues/1411), also [ERC-1450](https://eips.ethereum.org/EIPS/eip-1450). 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.

For instance, ERC-1411 uses dependency on [ERC-1410](https://github.com/ethereum/eips/issues/1410) but it falls out of the &quot;security tokens&quot; scope. Also its dependency on [ERC-777](./eip-777.md) 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 [ERC-1404](https://github.com/ethereum/EIPs/issues/1404) is missing a few important points, specifically it doesn&apos;t provide enough granularity to distinguish between different ERC-20 transfer functions such as `transfer` and `transferFrom`. It also doesn&apos;t provide a way to bind legal documentation to the issued tokens.

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.

## Specification

The ERC-20 token provides the following basic features:

```solidity
contract ERC20 {
    function totalSupply() public view returns (uint256);
    function balanceOf(address who) public view returns (uint256);
    function transfer(address to, uint256 value) public returns (bool);
    function allowance(address owner, address spender) public view returns (uint256);
    function transferFrom(address from, address to, uint256 value) public returns (bool);
    function approve(address spender, uint256 value) public returns (bool);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Transfer(address indexed from, address indexed to, uint256 value);
}
```

This will be extended as follows:

```solidity
interface BaseSecurityToken /* is ERC-20 */ {
    // Checking functions
    function checkTransferAllowed (address from, address to, uint256 value) public view returns (byte);
    function checkTransferFromAllowed (address from, address to, uint256 value) public view returns (byte);
    function checkMintAllowed (address to, uint256 value) public view returns (byte);
    function checkBurnAllowed (address from, uint256 value) public view returns (byte);

    // Documentation functions
    function attachDocument(bytes32 _name, string _uri, bytes32 _contentHash) external;
    function lookupDocument(bytes32 _name) external view returns (string, bytes32);
}
```

### Transfer Checking Functions

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&apos;s responsibility to add all necessary checks that will validate an operation in accordance with KYC/AML policies and legal requirements set for a specific token asset.

Each function must return a status code from the common set of Ethereum status codes (ESC), according to [ERC-1066](./eip-1066.md). Localization of these codes is out of the scope of this proposal and may be optionally solved by adopting [ERC-1444](./eip-1444.md) on the application level. If the operation is allowed by a checking function, the return status code must be `0x11` (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 `0x10` (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: `0xF0` (Off-Chain Failure).

**For [ERC-20](./eip-20.md) based tokens,**
* It is required that transfer function must be overridden with logic that checks the corresponding checkTransferAllowed return status code.
* It is required that `transferFrom` function must be overridden with logic that checks the corresponding `checkTransferFromAllowed` return status code.
* It is required that `approve` function must be overridden with logic that checks the corresponding `checkTransferFromAllowed` return status code.
* Other functions such as `mint` and `burn` must be overridden, if they exist in the token implementation, they should check `checkMintAllowed` and `checkBurnAllowed` status codes accordingly.

**For [ERC-777](./eip-777.md) based tokens,**
* It is required that `send` function must be overridden with logic that checks the corresponding return status codes:
    - `checkTransferAllowed` return status code, if transfer happens on behalf of the tokens owner;
    - `checkTransferFromAllowed` return status code, if transfer happens on behalf of an operator (i.e. delegated transfer).
* It is required that `burn` function must be overridden with logic that checks the corresponding `checkBurnAllowed` return status code.
* Other functions, such as `mint` must be overridden, if they exist in the token implementation, e.g. if the security token is mintable. `mint` function must call `checkMintAllowed` ad check it return status code.

For both cases,

* It is required for guaranteed compatibility with ERC-20 and ERC-777 wallets that each checking function returns `0x11` (Allowed) if not overridden with the issuer&apos;s custom logic.
* 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.

Inside checker functions the logic is allowed to use any feature available on-chain: perform calls to registry contracts with whitelists/blacklists, use built-in checking logic that is defined on the same contract, or even run off-chain queries through an oracle.

### Documentation Functions

We also introduce two new functions that should be used for document management purposes. Function `attachDocument` 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 `lookupDocument` gets the referenced document by its name.

* It is not required to use documentation functions, they are optional and provided as a part of a legal framework.
* It is required that if `attachDocument` 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.

## Rationale

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.

All checking functions are named with prefixes `check` 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 [ERC-1066](./eip-1066.md).

We require two different transfer validation functions: `checkTransferAllowed` and `checkTransferFromAllowed` since the corresponding `transfer` and `transferFrom` are usually called in different contexts. Some token standards such as [ERC-1450](./eip-1450.md) explicitly disallow use of `transfer`, while allowing only `transferFrom`. There might be also different complex scenarios, where `transfer` and `transferFrom` should be treated differently. ERC-777 is relying on its own `send` for transferring tokens, so it is reasonable to switch between checker functions based on its call context. We decided to omit the `checkApprove` function since it would be used in exactly the same context as `checkTransferFromAllowed`. In many cases it is required not only regulate securities transfers, but also restrict burn and `mint` operations, and additional checker functions have been added for that.

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 [Neufund&apos;s Employee Incentive Options Plan](https://medium.com/@ZoeAdamovicz/37376fd0384a) legal framework that implements full legal enforceability: the smart contract refers to printed ESOP Terms &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&apos;re almost always required, and it&apos;s a good way to attach useful documentation of various types.

## Backwards Compatibility

This EIP is fully backwards compatible as its implementation extends the functionality of ERC-20 and ERC-777 tokens.

## Implementation

* https://github.com/AtlantPlatform/BaseSecurityToken

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 01 Oct 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1462</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1462</guid>
      </item>
    
      <item>
        <title>Digital Identity Aggregator</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1495</comments>
        
        <description>## Simple Summary
A protocol for aggregating digital identity information that&apos;s broadly interoperable with existing, proposed, and hypothetical future digital identity standards.

## Abstract
This EIP proposes an identity management and aggregation framework on the Ethereum blockchain. It allows entities to claim an `Identity` via a singular `Identity Registry` 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 `Identities`: are self-sovereign, can natively support [ERC-725](./eip-725.md) and [ERC-1056](./eip-1056.md) identities, are [DID compliant](https://github.com/NoahZinsmeister/ERC-1484/blob/master/best-practices/DID-Method.md), and can be fully powered by [meta-transactions](https://github.com/NoahZinsmeister/ERC-1484/tree/master/contracts/examples/Providers/MetaTransactions).

## Motivation
Emerging identity standards and related frameworks proposed by the Ethereum community (including ERCs/EIPs [725](./eip-725.md), [735](https://github.com/ethereum/EIPs/issues/735), [780](https://github.com/ethereum/EIPs/issues/780), [1056](./eip-1056.md), 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.

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.

## Definitions
- `Identity Registry`: A single smart contract which is the hub for all `Identities`. The primary responsibility of the `Registry` is to define and enforce the rules of a global namespace for `Identities`, which are individually denominated by Ethereum Identification Numbers (EINs).

- `Identity`: A data structure containing all the core information relevant to an identity, namely: a `Recovery Address`, an `Associated Addresses` set, a `Providers` set, and a `Resolvers` set. `Identities` are denominated by EINs (incrementing `uint` identifiers starting at 1), which are unique but otherwise uninformative. Each `Identity` is a Solidity struct:

```solidity
struct Identity {
    address recoveryAddress;
    AddressSet.Set associatedAddresses;
    AddressSet.Set providers;
    AddressSet.Set resolvers;
}
```

- `Associated Address`: An Ethereum address publicly associated with an `Identity`. In order for an address to become an `Associated Address`, an `Identity` must either transact from or produce an appropriately signed message from the candidate address and an existing `Associated Address`, indicating intent to associate. An `Associated Address` can be removed from an `Identity` by transacting/producing a signature indicating intent to disassociate. A given address may only be an `Associated Address` for one `Identity` at any given time.

- `Provider`: An Ethereum address (typically but not by definition a smart contract) authorized to act on behalf of `Identities` who have authorized them to do so. This includes but is not limited to managing the `Associated Address`, `Provider`, and `Resolver` sets for an `Identity`. `Providers` exist to facilitate user adoption by making it easier to manage `Identities`.

- `Resolver`: A smart contract containing arbitrary information pertaining to `Identities`. A resolver may implement an identity standard, such as ERC-725, or may consist of a smart contract leveraging or declaring identifying information about `Identities`. These could be simple attestation structures or more sophisticated financial dApps, social media dApps, etc. Each `Resolver` added to an `Identity` makes the `Identity` more informative.

- `Recovery Address`: An Ethereum address (either an account or smart contract) that can be used to recover lost `Identities` as outlined in the [Recovery](#recovery) section.

- `Destruction`: In the event of irrecoverable loss of control of an `Identity`, `Destruction` is a contingency measure to permanently disable the `Identity`. It removes all `Associated Addresses`, `Providers`, and optionally `Resolvers` while preserving the `Identity`. Evidence of the existence of the `Identity` persists, while control over the `Identity` is nullified.

## Specification
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 `Resolvers`. This allows an atomic entity, the `Identity`, to be resolvable to abstract data structures, the `Resolvers`. `Resolvers` recognize `Identities` by any of their `Associated Addresses`, or by their `EIN`.

The protocol revolves around claiming an `Identity` and managing `Associated Addresses`, `Providers` and `Resolvers`. Identities can delegate much or all of this responsibility to one or more `Providers`, or perform it directly from an `Associated Address`. `Associated Addresses`/`Providers` may add and remove `Resolvers` and `Providers` indiscriminately. `Associated Addresses` may only be added or removed with the appropriate permission.

### Identity Registry
The `Identity Registry` contains functionality to create new `Identities` and for existing `Identities` to manage their `Associated Addresses`, `Providers`, and `Resolvers`. It is important to note that this registry fundamentally requires transactions for every aspect of building out an `Identity`. However, recognizing the importance of accessibility to dApps and identity applications, we empower `Providers` to build out `Identities` 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 [seen in the reference implementation](https://github.com/NoahZinsmeister/ERC-1484/tree/master/contracts/examples/Providers/MetaTransactions).

Due to the fact that multiple addresses can be associated with a given identity (though not the reverse), `Identities` are denominated by `EIN`. This `uint` identifier can be encoded in QR format or mapped to more user-friendly formats, such as a `string`, in registries at the `Provider` or `Resolver` level.

### Address Management
The address management function consists of trustlessly connecting multiple user-owned `Associated Addresses` to an `Identity`. It does not give special status to any particular `Associated Address`, rather leaving this (optional) specification to identity applications built on top of the protocol - for instance, `management`, `action`, `claim` and `encryption` keys denominated in the ERC-725 standard, or `identifiers` and `delegates` as denominated in ERC-1056. This allows a user to access common identity data from multiple wallets while still:

- retaining the ability to interact with contracts outside of their identity
- taking advantage of address-specific permissions established at the application layer of a user&apos;s identity.

Trustlessness in the address management function is achieved through a robust permissioning scheme. To add an `Associated Address` to an `Identity`, 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 `Associated Address` from unilaterally removing other `Associated Addresses`, it&apos;s only possible to remove an `Associated Address` by transacting or producing a signature from it.

All signatures required in ERC-1484 are designed per the [ERC-191](./eip-191.md) v0 specification. To avoid replay attacks, all signatures must include a timestamp within a rolling lagged window of the current `block.timestamp`. For more information, see this [best practices document](https://github.com/NoahZinsmeister/ERC-1484/blob/master/best-practices/VerifyingSignatures.md) in the reference implementation.

### Provider Management
While the protocol allows users to directly call identity management functions, it also aims to be more robust and future-proof by allowing `Providers`, typically smart contracts, to perform identity management functions on a user&apos;s behalf. A `Provider` set by an `Identity` can perform address management and resolver management functions by passing a user&apos;s `EIN` in function calls.

### Resolver Management
A `Resolver` is any smart contract that encodes information which resolves to an `Identity`. We remain agnostic about the specific information that can be encoded in a resolver and the functionality that this enables. The existence of `Resolvers` is primarily what makes this ERC an identity *protocol* rather than an identity *application*. `Resolvers` resolve abstract data in smart contracts to an atomic entity, the `Identity`.

### Recovery
If users lose control over an `Associated Address`, the `Recovery Address` provides a fallback mechanism. Upon `Identity` creation, a `Recovery Address` is passed as a parameter by the creator. Recovery functionality is triggered in three scenarios:

**1. Changing Recovery Address**: If a recovery key is lost, an `Associated Address`/`Provider` can [triggerRecoveryAddressChange](#triggerrecoveryaddresschange)/[triggerRecoveryAddressChangeFor](#triggerrecoveryaddresschangefor). To prevent malicious behavior from someone who has gained control of an `Associated Address` or `Provider` and is changing the `Recovery Address` to one under their control, this action triggers a 14 day challenge period during which the old `Recovery Address` may reject the change by [triggering recovery](#triggerrecovery). If the `Recovery Address` does not reject the change within 14 days, the `Recovery Address` is changed.

**2. Recovery**: Recovery occurs when a user recognizes that an `Associated Address` or the `Recovery Address` belonging to the user is lost or stolen. In this instance the `Recovery Address` must call [triggerRecovery](#triggerrecovery). This removes all `Associated Addresses` and `Providers` from the corresponding `Identity` and replaces them with an address passed in the function call. The `Identity` and associated `Resolvers` maintain integrity. The user is now responsible for adding the appropriate un-compromised addresses back to their `Identity`.

*Importantly, the `Recovery Address` 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 [DID](https://decentralized.id/).*

**3. Destruction**
The Recovery scheme offers considerable power to a `Recovery Address`; accordingly, `Destruction` is a nuclear option to combat malicious control over an `Identity` when a `Recovery Address` is compromised. If a malicious actor compromises a user&apos;s `Recovery Address` and triggers recovery, any address removed in the `Recovery` process can call [triggerDestruction](#triggerdestruction) within 14 days to permanently disable the `Identity`. The user would then need to create a new `Identity`, and would be responsible for engaging in recovery schemes for any identity applications built in the `Resolver` or `Provider` layers.

#### Alternative Recovery Considerations
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 `Associated Address`, `Provider`, and `Resolver` 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.

**High Level Concerns**
Fundamentally, a Recovery scheme needs to be resilient to a compromised address taking control of a user&apos;s `Identity`. A secondary concern is preventing a compromised address from maliciously destroying a user&apos;s identity due to off-chain utility, which is not an optimal scenario, but is strictly better than if they&apos;ve gained control.

**Alternative 1: Nuclear Option**
This approach would allow any `Associated Address` to destroy an `Identity` whenever another `Associated Address` is compromised. While this may seem severe, we strongly considered it because this ERC is an identity *protocol*, not an identity *application*. This means that though a user&apos;s compromised `Identity` is destroyed, they should still have recourse to whatever restoration mechanisms are available in each of their actual identities at the `Resolver` and/or `Provider` level. We ultimately dismissed this approach for two main reasons:

- It is not robust in cases where a user has only one `Associated Address`
- It would increase the frequency of recovery requests to identity applications due to its unforgiving nature.

**Alternative 2: Unilateral Address Removal via Providers**
This would allow `Associated Addresses`/`Providers` to remove `Associated Addresses` without a signature from said address. This implementation would allow `Providers` 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 `Associated Address` from simply setting a malicious `Provider` to remove un-compromised addresses, it would have required a waiting period between when a `Provider` is set and when they would be able to remove an `Associated Address`. We dismissed this approach because we felt it placed too high of a burden on `Providers`. If a `Provider` offered a sophisticated range of functionality to a user, but post-deployment a threat was found in the Recovery logic of the provider, `Provider`-specific infrastructure would need to be rebuilt. We also considered including a flag that would allow a user to decide whether or not a `Provider` may remove `Associated Addresses` unilaterally. Ultimately, we concluded that only allowing removal of `Associated Addresses` via the `Recovery Address` enables equally sophisticated recovery logic while separating the functionality from `Providers`, leaving less room for users to relinquish control to potentially flawed implementations.

## Rationale
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.

The main criticism of existing identity solutions is that they&apos;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 `Identity` rather than just an address.

## Implementation
**The reference implementation for ERC-1484 may be found in [NoahZinsmeister/ERC-1484](https://github.com/NoahZinsmeister/ERC-1484).**

#### identityExists

Returns a `bool` indicating whether or not an `Identity` denominated by the passed `EIN` exists.

```solidity
function identityExists(uint ein) public view returns (bool);
```

#### hasIdentity

Returns a `bool` indicating whether or not the passed `_address` is associated with an `Identity`.

```solidity
function hasIdentity(address _address) public view returns (bool);
```

#### getEIN

Returns the `EIN` associated with the passed `_address`. Throws if the address is not associated with an `EIN`.

```solidity
function getEIN(address _address) public view returns (uint ein);
```

#### isAssociatedAddressFor

Returns a `bool` indicating whether or not the passed `_address` is associated with the passed `EIN`.

```solidity
function isAssociatedAddressFor(uint ein, address _address) public view returns (bool);
```

#### isProviderFor

Returns a `bool` indicating whether or not the passed `provider` has been set by the passed `EIN`.

```solidity
function isProviderFor(uint ein, address provider) public view returns (bool);
```

#### isResolverFor

Returns a `bool` indicating whether or not the passed `resolver` has been set by the passed `EIN`.

```solidity
function isResolverFor(uint ein, address resolver) public view returns (bool);
```

#### getIdentity

Returns the `recoveryAddress`, `associatedAddresses`, `providers` and `resolvers` of the passed `EIN`.

```solidity
function getIdentity(uint ein) public view
    returns (
        address recoveryAddress,
        address[] memory associatedAddresses, address[] memory providers, address[] memory resolvers
    );
```

#### createIdentity

Creates an `Identity`, setting the `msg.sender` as the sole `Associated Address`. Returns the `EIN` of the new `Identity`.

```solidity
function createIdentity(address recoveryAddress, address[] memory providers, address[] memory resolvers)
    public returns (uint ein);
```

Triggers event: [IdentityCreated](#identitycreated)

#### createIdentityDelegated

Performs the same logic as `createIdentity`, but can be called by any address. This function requires a signature from the `associatedAddress` to ensure their consent.

```solidity
function createIdentityDelegated(
    address recoveryAddress, address associatedAddress, address[] memory providers, address[] memory resolvers,
    uint8 v, bytes32 r, bytes32 s, uint timestamp
)
    public returns (uint ein);
```

Triggers event: [IdentityCreated](#identitycreated)

#### addAssociatedAddress

Adds the `addressToAdd` to the `EIN` of the `approvingAddress`. The `msg.sender` must be either of the `approvingAddress` or the `addressToAdd`, and the signature must be from the other one.

```solidity
function addAssociatedAddress(
    address approvingAddress, address addressToAdd, uint8 v, bytes32 r, bytes32 s, uint timestamp
)
    public
```

Triggers event: [AssociatedAddressAdded](#associatedaddressadded)

#### addAssociatedAddressDelegated

Adds the `addressToAdd` to the `EIN` of the `approvingAddress`. Requires signatures from both the `approvingAddress` and the `addressToAdd`.

```solidity
function addAssociatedAddressDelegated(
    address approvingAddress, address addressToAdd,
    uint8[2] memory v, bytes32[2] memory r, bytes32[2] memory s, uint[2] memory timestamp
)
    public
```

Triggers event: [AssociatedAddressAdded](#associatedaddressadded)

#### removeAssociatedAddress

Removes the `msg.sender` as an `Associated Address` from its `EIN`.

```solidity
function removeAssociatedAddress() public;
```

Triggers event: [AssociatedAddressRemoved](#associatedaddressremoved)


#### removeAssociatedAddressDelegated

Removes the `addressToRemove` from its associated `EIN`. Requires a signature from the `addressToRemove`.

```solidity
function removeAssociatedAddressDelegated(address addressToRemove, uint8 v, bytes32 r, bytes32 s, uint timestamp)
    public;
```

Triggers event: [AssociatedAddressRemoved](#associatedaddressremoved)

#### addProviders

Adds an array of `Providers` to the `Identity` of the `msg.sender`.

```solidity
function addProviders(address[] memory providers) public;
```

Triggers event: [ProviderAdded](#provideradded)

#### addProvidersFor

Performs the same logic as `addProviders`, but must be called by a `Provider`.

```solidity
function addProvidersFor(uint ein, address[] memory providers) public;
```

Triggers event: [ProviderAdded](#provideradded)

#### removeProviders

Removes an array of `Providers` from the `Identity` of the `msg.sender`.

```solidity
function removeProviders(address[] memory providers) public;
```

Triggers event: [ProviderRemoved](#providerremoved)


#### removeProvidersFor

Performs the same logic as `removeProviders`, but is called by a `Provider`.

```solidity
function removeProvidersFor(uint ein, address[] memory providers) public;
```

Triggers event: [ProviderRemoved](#providerremoved)


#### addResolvers

Adds an array of `Resolvers` to the `EIN` of the `msg.sender`.

```solidity
function addResolvers(address[] memory resolvers) public;
```

Triggers event: [ResolverAdded](#resolveradded)

#### addResolversFor

Performs the same logic as `addResolvers`, but must be called by a `Provider`.

```solidity
function addResolversFor(uint ein, address[] memory resolvers) public;
```

Triggers event: [ResolverAdded](#resolveradded)

#### removeResolvers

Removes an array of `Resolvers` from the `EIN` of the `msg.sender`.

```solidity
function removeResolvers(address[] memory resolvers) public;
```

Triggers event: [ResolverRemoved](#resolverremoved)

#### removeResolversFor

Performs the same logic as `removeResolvers`, but must be called by a `Provider`.

```solidity
function removeResolversFor(uint ein, address[] memory resolvers) public;
```

Triggers event: [ResolverRemoved](#resolverremoved)

#### triggerRecoveryAddressChange

Initiates a change in the current `recoveryAddress` for the `EIN` of the `msg.sender`.

```solidity
function triggerRecoveryAddressChange(address newRecoveryAddress) public;
```

Triggers event: [RecoveryAddressChangeTriggered](#recoveryaddresschangetriggered)

#### triggerRecoveryAddressChangeFor

Initiates a change in the current `recoveryAddress` for a given `EIN`.

```solidity
function triggerRecoveryAddressChangeFor(uint ein, address newRecoveryAddress) public;
```

Triggers event: [RecoveryAddressChangeTriggered](#recoveryaddresschangetriggered)

#### triggerRecovery

Triggers `EIN` recovery from the current `recoveryAddress`, or the old `recoveryAddress` if changed within the last 2 weeks.

```solidity
function triggerRecovery(uint ein, address newAssociatedAddress, uint8 v, bytes32 r, bytes32 s, uint timestamp) public;
```

Triggers event: [RecoveryTriggered](#recoverytriggered)

#### triggerDestruction

Triggers destruction of an `EIN`. This renders the `Identity` permanently unusable.

```solidity
function triggerDestruction(uint ein, address[] memory firstChunk, address[] memory lastChunk, bool clearResolvers)
  public;
```

Triggers event: [IdentityDestroyed](#identitydestroyed)

### Events

#### IdentityCreated

MUST be triggered when an `Identity` is created.

```solidity
event IdentityCreated(
    address indexed initiator, uint indexed ein,
    address recoveryAddress, address associatedAddress, address[] providers, address[] resolvers, bool delegated
);
```

#### AssociatedAddressAdded

MUST be triggered when an address is added to an `Identity`.

```solidity
event AssociatedAddressAdded(
    address indexed initiator, uint indexed ein, address approvingAddress, address addedAddress, bool delegated
);
```

#### AssociatedAddressRemoved

MUST be triggered when an address is removed from an `Identity`.

```solidity
event AssociatedAddressRemoved(address indexed initiator, uint indexed ein, address removedAddress, bool delegated);
```

#### ProviderAdded

MUST be triggered when a provider is added to an `Identity`.

```solidity
event ProviderAdded(address indexed initiator, uint indexed ein, address provider, bool delegated);
```

#### ProviderRemoved

MUST be triggered when a provider is removed.

```solidity
event ProviderRemoved(address indexed initiator, uint indexed ein, address provider, bool delegated);
```

#### ResolverAdded

MUST be triggered when a resolver is added.

```solidity
event ResolverAdded(address indexed initiator, uint indexed ein, address resolvers, bool delegated);
```

#### ResolverRemoved

MUST be triggered when a resolver is removed.

```solidity
event ResolverRemoved(address indexed initiator, uint indexed ein, address resolvers, bool delegated);
```

#### RecoveryAddressChangeTriggered

MUST be triggered when a recovery address change is triggered.

```solidity
event RecoveryAddressChangeTriggered(
    address indexed initiator, uint indexed ein,
    address oldRecoveryAddress, address newRecoveryAddress, bool delegated
);
```

#### RecoveryTriggered

MUST be triggered when recovery is triggered.

```solidity
event RecoveryTriggered(
    address indexed initiator, uint indexed ein, address[] oldAssociatedAddresses, address newAssociatedAddress
);
```

#### IdentityDestroyed

MUST be triggered when an `Identity` is destroyed.

```solidity
event IdentityDestroyed(address indexed initiator, uint indexed ein, address recoveryAddress, bool resolversReset);
```

### Solidity Interface
```solidity
interface IdentityRegistryInterface {
    function isSigned(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s)
        external pure returns (bool);

    // Identity View Functions /////////////////////////////////////////////////////////////////////////////////////////
    function identityExists(uint ein) external view returns (bool);
    function hasIdentity(address _address) external view returns (bool);
    function getEIN(address _address) external view returns (uint ein);
    function isAssociatedAddressFor(uint ein, address _address) external view returns (bool);
    function isProviderFor(uint ein, address provider) external view returns (bool);
    function isResolverFor(uint ein, address resolver) external view returns (bool);
    function getIdentity(uint ein) external view returns (
        address recoveryAddress,
        address[] memory associatedAddresses, address[] memory providers, address[] memory resolvers
    );

    // Identity Management Functions ///////////////////////////////////////////////////////////////////////////////////
    function createIdentity(address recoveryAddress, address[] calldata providers, address[] calldata resolvers)
        external returns (uint ein);
    function createIdentityDelegated(
        address recoveryAddress, address associatedAddress, address[] calldata providers, address[] calldata resolvers,
        uint8 v, bytes32 r, bytes32 s, uint timestamp
    ) external returns (uint ein);
    function addAssociatedAddress(
        address approvingAddress, address addressToAdd, uint8 v, bytes32 r, bytes32 s, uint timestamp
    ) external;
    function addAssociatedAddressDelegated(
        address approvingAddress, address addressToAdd,
        uint8[2] calldata v, bytes32[2] calldata r, bytes32[2] calldata s, uint[2] calldata timestamp
    ) external;
    function removeAssociatedAddress() external;
    function removeAssociatedAddressDelegated(address addressToRemove, uint8 v, bytes32 r, bytes32 s, uint timestamp)
        external;
    function addProviders(address[] calldata providers) external;
    function addProvidersFor(uint ein, address[] calldata providers) external;
    function removeProviders(address[] calldata providers) external;
    function removeProvidersFor(uint ein, address[] calldata providers) external;
    function addResolvers(address[] calldata resolvers) external;
    function addResolversFor(uint ein, address[] calldata resolvers) external;
    function removeResolvers(address[] calldata resolvers) external;
    function removeResolversFor(uint ein, address[] calldata resolvers) external;

    // Recovery Management Functions ///////////////////////////////////////////////////////////////////////////////////
    function triggerRecoveryAddressChange(address newRecoveryAddress) external;
    function triggerRecoveryAddressChangeFor(uint ein, address newRecoveryAddress) external;
    function triggerRecovery(uint ein, address newAssociatedAddress, uint8 v, bytes32 r, bytes32 s, uint timestamp)
        external;
    function triggerDestruction(
        uint ein, address[] calldata firstChunk, address[] calldata lastChunk, bool resetResolvers
    ) external;

    // Events //////////////////////////////////////////////////////////////////////////////////////////////////////////
    event IdentityCreated(
        address indexed initiator, uint indexed ein,
        address recoveryAddress, address associatedAddress, address[] providers, address[] resolvers, bool delegated
    );
    event AssociatedAddressAdded(
        address indexed initiator, uint indexed ein, address approvingAddress, address addedAddress
    );
    event AssociatedAddressRemoved(address indexed initiator, uint indexed ein, address removedAddress);
    event ProviderAdded(address indexed initiator, uint indexed ein, address provider, bool delegated);
    event ProviderRemoved(address indexed initiator, uint indexed ein, address provider, bool delegated);
    event ResolverAdded(address indexed initiator, uint indexed ein, address resolvers);
    event ResolverRemoved(address indexed initiator, uint indexed ein, address resolvers);
    event RecoveryAddressChangeTriggered(
        address indexed initiator, uint indexed ein, address oldRecoveryAddress, address newRecoveryAddress
    );
    event RecoveryTriggered(
        address indexed initiator, uint indexed ein, address[] oldAssociatedAddresses, address newAssociatedAddress
    );
    event IdentityDestroyed(address indexed initiator, uint indexed ein, address recoveryAddress, bool resolversReset);
}
```

## Backwards Compatibility
`Identities` 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 `Resolvers` for `Identities` will need to write wrapper contracts that resolve addresses to `EIN`-denominated `Identities`.

## Additional References
- [ERC-1484 Reference Implementation](https://github.com/NoahZinsmeister/ERC-1484)
- [ERC-191 Signatures](./eip-191.md)
- [ERC-725 Identities](./eip-725.md)
- [ERC-1056 Identities](./eip-1056.md)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 12 Oct 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1484</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1484</guid>
      </item>
    
      <item>
        <title>Human Cost Accounting Standard (Like Gas but for humans)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/freeworkculture/kazini/issues/11</comments>
        
        <description>## Simple Summary
A standard interface for Human Capital Accounting tokens.

## Abstract
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.

## Motivation
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/or off-chain HTTP lookups still make for multiple deterministic transactions.

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.

The Belief-Desire-Intention model is a plan-theoretic framework for establishing means-end coherence in agent based modelling system.
The blockchain&apos;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/broker/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.

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.

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.

## Specification

#### Main Interface
```solidity
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;

/**
    @title ERC-**** Human Capital Accounting Standard
    @dev See https://github.com/freeworkculture/kazini/issues/11
    Note: the ERC-165 identifier for this interface is 0xf23a6e61.
 */

interface IERC_HUCAP {

    /**
        @notice Compute the index value of an Agents BDI in the ecosystem.
        @param _address Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function updateIndex() internal returns (bool);

    /**
        @notice Get the active/inactive and states of an Agent in the ecosystem.
        @param _address Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function iam() view public returns (bool iam_, IERC_HUCAP_TYPES.IS state_);

    /**
        @notice Fetch the bdi index value of an Agent in the ecosystem.
        @param _address Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function index() view public returns (uint8 index_);
    
    /**
        @notice Count of Public Keys in key ring of an Agent in the ecosystem.
        @param _address Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function ringLength() view public returns (uint ringlength_);

    /**
        @notice Get the PGP Public Key Id of an Agent in the ecosystem.
        @param &quot;&quot; Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */  
    function keyId() view public returns (bytes32 KEYID_);

     /**
        @notice Get the merit data of an Agent in the ecosystem.
        @param &quot;&quot; Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */   
    function merits() view public returns (
        uint experience_,
        bytes32 reputation_,
        bytes32 talent_,
        uint8 index_,
        bytes32 hash_);

    /**
        @notice Get the accreditation of an Agent in the ecosystem.
        @param &quot;&quot; Set the stance of an agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function kbase() view public returns (IERC_HUCAP_TYPES.KBase kbase_);

    /**
        @notice Get the desire of an Agent in the ecosystem.
        @param _desire    Pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function desire(bytes1 _desire) view external returns (bytes32);

    /**
        @notice Get the intention of an Agent in the ecosystem.
        @param _intention    Conduct-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function intention(bool _intention) view external returns  (bytes32);
    
    /**
        @notice Cycle the intention of an Agent in the ecosystem.
        @param _intention    Conduct-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function flipIntention() external returns  (bool);
    

    /**
        @notice Get the user data of an Agent in the ecosystem.
        @param &quot;&quot;    Conduct-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function getDoer() view external returns  (
        bytes32 fPrint,
        bool iam_,
        bytes32 email,
        bytes32 fName,
        bytes32 lName,
        uint age,
        bytes32 data_);

    /**
        @notice Get the belief data of an Agent in the ecosystem.
        @param _kbase    Source address
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function getBelief(IERC_HUCAP_TYPES.KBase _kbase) view external returns  (
        bytes32 country_,
        bytes32 cAuthority_,
        bytes32 score_);

    /**
        @notice Get the desire data of an Agent in the ecosystem.
        @param _desire    Pro-attitides
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function getDesire(bytes1 _desire) view external returns  (bytes32,bool);

    /**
        @notice Get the intention of an Agent in the ecosystem.
        @param _intention    Conduct-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function getIntention(bool _intention) view external returns  (IERC_HUCAP_TYPES.IS,bytes32,uint256);

    /**
        @notice Sign the Public Key of an Agent in the ecosystem.
        @param _address    Address of key to sign, must belong to an Agent 
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function sign(address _address) public onlyOwner returns (uint, bool signed);

    /**
        @notice Sign the Public Key of an Agent in the ecosystem.
        @param &quot;&quot;    internal helper function to add key in keyring
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function sign() external onlyDoer returns (uint, bool signed);

    /**
        @notice Revoke the Public Key of an Agent in the ecosystem.
        @param _address    Address of key to revoke, must belong to an Agent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function revoke(address _address) external onlyDoer returns (uint, bool revoked);

    /**
        @notice Revoke the Public Key of an Agent in the ecosystem.
        @param &quot;&quot;    internal helper function to remove key from keyring
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function revoke() external onlyDoer returns (uint, bool revoked);

    /**
        @notice Set the trust level for a Public Key of an Agent in the ecosystem.
        @param _level    Degree of trust
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function trust(Trust _level) returns (bool);

    /**
        @notice Increment the number of keys in the keyring of an Agent in the ecosystem.
        @param _keyd    Target key
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function incSigns(bytes32 _keyd) external ProxyKey returns (uint);

    /**
        @notice Decrement the number of keys in the keyring of an Agent in the ecosystem.
        @param _keyd    Target key
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
        
    */
    function decSigns(bytes32 _keyd) external ProxyKey returns (uint);

    /**
        @notice Set the knowledge credentials of an Agent in the ecosystem.
        @param _kbase    Level of accreditation
        @param _country      Source country
        @param _cAuthority     Accreditation authority
        @param _score  Accreditation 
        @param _year Year of Accreditation
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(
        KBase _kbase,
        bytes32 _country,
        bytes32 _cAuthority,
        bytes32 _score,
        uint _year
        ) external ProxyBDI returns (bool qualification_);

    /**
        @notice Set the SNA metrics of an Agent in the ecosystem
        @param _refMSD    Minimum shortest distance
        @param _refRank      Rank of target key
        @param _refSigned     No of keys signed I have signed
        @param _refSigs  No. of keys that have signed my key
        @param _refTrust Degree of tructThrows on any error rather than return a false flag to minimize user errors
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(
        uint _refMSD,
        uint _refRank,
        uint _refSigned,
        uint _refSigs,
        bytes32 _refTrust
        ) external ProxyBDI returns (bool reputation_);

    /**
        @notice Set the talents of an Agent in the ecosystem
        @param _talent    Agent&apos;s talent
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(bytes32 _talent) external ProxyBDI returns (bool talent_);

    /**
        @notice Set the desires of an Agent in the ecosystem
        @param _desire    Pro-attitude
        @param _goal      A goal is an instatiated pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(bytes1 _desire, Desire _goal) public onlyDoer returns (bool);

    /**
        @notice Set the intention of an Agent in the ecosystem
        @param _service    Conducting-controlling pro-attitude
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors
    */
    function setbdi(Intention _service) public onlyDoer returns (bool);
    
    /**
        @notice Set the targeted intention of an Agent in the ecosystem.
        @param _intention    Conduct-controlling pro-attitude
        @param _state      Agent stance       
        @dev For the purpose of 
        Throws on any error rather than return a false flag to minimize user errors

    */
    function intention(bool _intention, IERC_HUCAP_TYPES.IS _state) external returns  (IERC_HUCAP_TYPES.IS);

/* End of interface IERC_HUCAP */
}


```
#### User Defined Types Extension Interface

```solidity

interface IERC_HUCAP_TYPES {

/* Enums*/

    // Weights	   1,		2,		 4,		    8,		   16,	    32,		64,	    128    256
    enum KBase {PRIMARY,SECONDARY,TERTIARY,CERTIFICATION,DIPLOMA,LICENSE,BACHELOR,MASTER,DOCTORATE}
    
    
    enum IS { CLOSED, CREATOR, CURATOR, ACTIVE, INACTIVE, RESERVED, PROVER }

/* Structus */

        struct Clearance {
        bytes32 Zero;
        bytes32 Unknown;
        bytes32 Generic;
        bytes32 Poor;
        bytes32 Casual;
        bytes32 Partial;
        bytes32 Complete;
        bytes32 Ultimate;
    }
/* End of interface IERC_HUCAP_TYPES */
}

```
#### Web-of-trust Extension Interface

```solidity
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;

interface IERC_HUCAP_KEYSIGNING_EXTENSION {

    bytes32 constant public _InterfaceId_ERC165_        = &quot;CREATOR 0.0118 XOR OF ALL FUNCTIONS IN THE INTERFACE&quot;;   // Complies to ERC165

//  KEY MASKING TABLE
//  bytes32 constant public MASK 			   		    = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
//  bytes32 constant public KEYID                       = 0xffffffffffffffffffffffffffffffffff90EBAC34FC40EAC30FC9CB464A2E56; // EXAMPLE PGP PUBLIC KEY ID
//  bytes32 constant public KEY_CERTIFICATION 		    = 0x01ffffffffffffff &lt;&lt; 192; // “C”	Key Certification
//  bytes32 constant public SIGN_DATA   			    = 0x02ffffffffffffff &lt;&lt; 192; // “S”	Sign Data
//  bytes32 constant public ENCRYPT_COMMUNICATIONS 	    = 0x04ffffffffffffff &lt;&lt; 192; // “E”	Encrypt Communications
//  Clearance constant public Trust                     = 0x03ff &lt;&lt; 192; // Trust: Unknown
                                                        // BYTES32 Value with 
                                                        // Public Key Id, masking
                                                        // Key Certification masking
                                                        // Split Key masking
                                                        // Generic masking
                                                        // Ordinary masking
                                                        //  Trust.Unknown masking
                                                        //  bytes32 constant public DOER = 0x11ff10ff100f03ffff00ffffffffffffffff90EBAC34FC40EAC30FC9CB464A2E56;

    bytes32 constant public KEY_CERTIFICATION 		    = 0x01ffffffffffffff &lt;&lt; 192; // “C”	Key Certification
    bytes32 constant public SIGN_DATA   			    = 0x02ffffffffffffff &lt;&lt; 192; // “S”	Sign Data
    bytes32 constant public ENCRYPT_COMMUNICATIONS 	    = 0x04ffffffffffffff &lt;&lt; 192; // “E”	Encrypt Communications
    bytes32 constant public ENCRYPT_STORAGE  		    = 0x08ffffffffffffff &lt;&lt; 192; // “E”	Encrypt Storage
    bytes32 constant public SPLIT_KEY   			    = 0x10ffffffffffffff &lt;&lt; 192; // Split key
    bytes32 constant public AUTHENTICATION   		    = 0x20ffffffffffffff &lt;&lt; 192; // “A”	Authentication
    bytes32 constant public MULTI_SIGNATURE			    = 0x80ffffffffffffff &lt;&lt; 192; // Held by more than one person
    bytes32 constant public TRUST_AMOUNT                = 0xffffffffffff00ff &lt;&lt; 192;
    bytes32 constant public BINARY_DOCUMENT             = 0xffff00ffffffffff &lt;&lt; 192; // 0x00: Signature of a binary document.
    bytes32 constant public CANONICAL_DOCUMENT          = 0xffff01ffffffffff &lt;&lt; 192; // 0x01: Signature of a canonical text document.
    bytes32 constant public STANDALONE_SIGNATURE        = 0xffff02ffffffffff &lt;&lt; 192; // 0x02: Standalone signature.
    bytes32 constant public GENERIC                     = 0xffff10ffffffffff &lt;&lt; 192; // 0x10: Generic certification of a User ID and Public-Key packet.
    bytes32 constant public PERSONA                     = 0xffff11ffffffffff &lt;&lt; 192; // 0x11: Persona certification of a User ID and Public-Key packet.
    bytes32 constant public CASUAL                      = 0xffff12ffffffffff &lt;&lt; 192; // 0x12: Casual certification of a User ID and Public-Key packet.
    bytes32 constant public POSITIVE                    = 0xffff13ffffffffff &lt;&lt; 192; // 0x13: Positive certification of a User ID and Public-Key packet.
    bytes32 constant public SUBKEY_BINDING              = 0xffff18ffffffffff &lt;&lt; 192; // 0x18: Subkey Binding Signature
    bytes32 constant public PRIMARY_KEY_BINDING         = 0xffff19ffffffffff &lt;&lt; 192; // 0x19: Primary Key Binding Signature
    bytes32 constant public DIRECTLY_ON_KEY             = 0xffff1Fffffffffff &lt;&lt; 192; // 0x1F: Signature directly on a key
    bytes32 constant public KEY_REVOCATION              = 0xffff20ffffffffff &lt;&lt; 192; // 0x20: Key revocation signature
    bytes32 constant public SUBKEY_REVOCATION           = 0xffff28ffffffffff &lt;&lt; 192; // 0x28: Subkey revocation signature
    bytes32 constant public CERTIFICATION_REVOCATION    = 0xffff30ffffffffff &lt;&lt; 192; // 0x30: Certification revocation signature
    bytes32 constant public TIMESTAMP                   = 0xffff40ffffffffff &lt;&lt; 192; // 0x40: Timestamp signature.
    bytes32 constant public THIRD_PARTY_CONFIRMATION    = 0xffff50ffffffffff &lt;&lt; 192; // 0x50: Third-Party Confirmation signature.
    bytes32 constant public ORDINARY   				    = 0xffffffff100fffff &lt;&lt; 192;
    bytes32 constant public INTRODUCER 				    = 0xffffffff010fffff &lt;&lt; 192;
    bytes32 constant public ISSUER	   				    = 0xffffffff001fffff &lt;&lt; 192;

//  EDGES MASKING TABLE
    Clearance internal TRUST = Clearance({
        Zero:       0x01ff &lt;&lt; 192,
        Unknown:    0x03ff &lt;&lt; 192,
        Generic:    0x07ff &lt;&lt; 192,
        Poor:       0xF0ff &lt;&lt; 192,
        Casual:     0xF1ff &lt;&lt; 192,
        Partial:    0xF3ff &lt;&lt; 192,
        Complete:   0xF7ff &lt;&lt; 192,
        Ultimate:   0xFFff &lt;&lt; 192
        });

    /**
    /// @notice Cycle through state transition of an Agent in the ecosystem.
    /// @param _address toggle on/off a doer agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function flipTo(address _address) external onlyOwner returns (IS);

    /**
    /// @notice Turn Agent in the ecosystem to on/off.
    /// @param _address toggle on/off a doer agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function toggle(address _address) external onlyOwner returns (bool);

    /**
    /// @notice Set the trust level of an Agent in the ecosystem.
    /// @param _level toggle on/off a doer agent
    //  @dev `anybody` can retrieve the talent data in the contract
    */
    function trust(Trust _level) returns (bytes32 Trust);

    event LogCall(address indexed from, address indexed to, address indexed origin, bytes _data);

/* End of interface IERC_HUCAP_KEYSIGNING_EXTENSION */
}

```
#### Human Capital Accounting Extension Interface

```solidity
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;

interface IERC_HUCAP_TRACKUSERS_EXTENSION {

    /// @notice Instantiate an Agent in the ecosystem with default data.
    /// @param _address initialise a doer agent
    //  @dev `anybody` can retrieve the talent data in the contract
    function initAgent(Doers _address) external onlyControlled returns (bool);

    /// @notice Get the data by uuid of an Agent in the ecosystem.
    /// @param _uuid Get the address of a unique uid
    //  @dev `anybody` can retrieve the talent data in the contract
    function getAgent(bytes32 _uuid) view external returns (address);

    /// @notice Get the data of all Talents in the ecosystem.
    /// @param _address Query if address belongs to an agent
    //  @dev `anybody` can retrieve the talent data in the contract
    function iam(address _address) view public returns (bool);

    /// @notice Get the data of all Talents in the ecosystem.
    /// @param _address Query if address belongs to a doer
    //  @dev `anybody` can retrieve the talent data in the contract
    function isDoer(address _address) view public returns (IS);

    /// @notice Get the number of doers that can be spawned by a Creators.
    /// The query condition of the contract
    //  @dev `anybody` can retrieve the count data in the contract
    function getAgent(address _address)
    view public returns (bytes32 keyid_, IS state_, bool active_, uint myDoers_);

    /// @notice Get the data of all Talents in the ecosystem.
    /// @param _talent The talent whose frequency is being queried
    //  @dev `anybody` can retrieve the talent data in the contract
    function getTalents(bytes32 _talent)
    view external returns  (uint talentK_, uint talentI_, uint talentR_, uint talentF_);

    /// @notice Increment a kind of talent in the ecosystem.
    /// @param The talent whose frequency is being queried
    //  @dev `anybody` can retrieve the talent data in the contract
    function incTalent() payable public onlyDoer returns (bool);

    /// @notice Decrement a kind of talent in the ecosystem..
    /// @param The talent whose frequency is being queried
    //  @dev `anybody` can retrieve the talent data in the contract
    function decTalent() payable public onlyDoer returns (bool);

    /// @notice Set the Public-Key Id of an Agent in the ecosystem.
    /// @param _address Set the Public-key Id of an agent
    //  @dev `anybody` can retrieve the talent data in the contract
    function setAgent(address _address, bytes32 _keyId) external onlyControlled returns (bytes32);

    /// @notice Transition the states of an Agent in the ecosystem.
    /// @param _address Set the stance of an agent
    //  @dev `anybody` can retrieve the talent data in the contract
    function setAgent(address _address, IS _state) external onlyControlled returns (IS);

    /// @notice Set the active status of an Agent in the ecosystem.
    /// @param _address Toggle the true/false status of an agent
    //  @dev `anybody` can retrieve the talent data in the contract
    function setAgent(address _address, bool _active) external onlyControlled returns (bool);

    /// @notice Set the data of all Intentions of Agents in the ecosystem.
    /// @param _serviceId Track number of offers available
    //  @dev `anybody` can retrieve the talent data in the contract
    function setAllPromises(bytes32 _serviceId) external onlyControlled;

/* End of interface IERC_HUCAP_TRACKUSERS_EXTENSION */
}


```
## Rationale
[WIP]

## Backwards Compatibility
[WIP]

## Test Cases
[WIP]

## Implementation
[WIP]

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 12 Oct 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1491</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1491</guid>
      </item>
    
      <item>
        <title>Upgradable Smart Contract</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1503</comments>
        
        <description>## Simple Summary

A standard interface/guideline that makes a smart contract upgradable. 

## Abstract

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.

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/community interests, it also contains a voting mechanism to control the upgrading process. 

## Motivation

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.  

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. 

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.

## Specification

The upgradable contract consists of three parts:

- **Handler contract** (implements **Handler interface**) defines operations and provides services. This contract can be upgraded;
- **Data contract** keeps the resources (data) and is controlled by the Handler contract;
- **Upgrader contract (optional)** deals with the voting mechanism and upgrades the Handler contract. The voters are pre-defined by the contract owner. 

&gt; The following codes are exact copies of the [ERC-1504 Upgradable Smart Contract.](https://gist.github.com/swordghost/77c96a972106af6ec6ccea9c2d66e768)

### Handler contract and Handler interface

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.

Below is the specification of Handler interface. In the Handler interface we define the following actions:

- Initialize the Data contract;
- Register the Upgrader contract address;
- Destruct the Handler contract after upgrading is done;
- Verify the current Handler is the working one → it should always return true.

Developers have to define their business-related functions as well.


```solidity
/// Handler interface.
/// Handler defines business related functions.
/// Use the interface to ensure that your external services are always supported.
/// Because of function live(), we design IHandler as an abstract contract rather than a true interface.
contract IHandler {

    /// Initialize the data contarct.
    /// @param  _str    value of exmStr of Data contract.
    /// @param  _int    value of exmInt of Data contract.
    /// @param  _array  value of exmArray of Data contract.
    function initialize (string _str, uint256 _int, uint16 [] _array) public;

    /// Register Upgrader contract address.
    /// @param  _upgraderAddr   address of the Upgrader contract.
    function registerUpgrader (address _upgraderAddr) external;

    /// Upgrader contract calls this to check if it is registered.
    /// @return if the Upgrader contract is registered.
    function isUpgraderRegistered () external view returns(bool);

    /// Handler has been upgraded so the original one has to self-destruct.
    function done() external;

    /// Check if the Handler contract is a working Handler contract.
    /// It is used to prove the contract is a Handler contract.
    /// @return always true.
    function live() external pure returns(bool) {
        return true;
    }

    /** Functions - define functions here */

    /** Events - add events here */
}
```


The process of deploying a Handler contract:

1. Deploy Data contract;
2. Deploy a Handler contract at a given address specified in the Data contract;
3. 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;
4. Initialize Data contract if haven’t done it already.

### Data Contract

Below is the specification of Data contract. There are three parts in the Data contract:

- **Administrator Data**: owner’s address, Handler contract’s address and a boolean indicating whether the contract is initialized or not;
- **Upgrader Data**: Upgrader contract’s address, upgrade proposal’s submission timestamp and proposal’s time period;
- **Resource Data**: all other resources that the contract needs to keep and manage.


```solidity
/// Data Contract
contract DataContract {

    /** Management data */
    /// Owner and Handler contract
    address private owner;
    address private handlerAddr;

    /// Ready?
    bool private valid;

    /** Upgrader data */
    address private upgraderAddr;
    uint256 private proposalBlockNumber;
    uint256 private proposalPeriod;
    /// Upgrading status of the Handler contract
    enum UpgradingStatus {
        /// Can be upgraded
        Done,
        /// In upgrading
        InProgress,
        /// Another proposal is in progress
        Blocked,
        /// Expired
        Expired,
        /// Original Handler contract error
        Error
    }

    /** Data resources - define variables here */

    /** Modifiers */

    /// Check if msg.sender is the Handler contract. It is used for setters.
    /// If fail, throw PermissionException.
    modifier onlyHandler;

    /// Check if msg.sender is not permitted to call getters. It is used for getters (if necessary).
    /// If fail, throw GetterPermissionException.
    modifier allowedAddress;

    /// Check if the contract is working.
    /// It is used for all functions providing services after initialization.
    /// If fail, throw UninitializationException.
    modifier ready;

    /** Management functions */

    /// Initializer. Just the Handler contract can call it. 
    /// @param  _str    default value of this.exmStr.
    /// @param  _int    default value of this.exmInt.
    /// @param  _array  default value of this.exmArray.
    /// exception   PermissionException msg.sender is not the Handler contract.
    /// exception   ReInitializationException   contract has been initialized.
    /// @return if the initialization succeeds.
    function initialize (string _str, uint256 _int, uint16 [] _array) external onlyHandler returns(bool);

    /// Set Handler contract for the contract. Owner must set one to initialize the Data contract.
    /// Handler can be set by owner or Upgrader contract.
    /// @param  _handlerAddr    address of a deployed Handler contract.
    /// @param  _originalHandlerAddr    address of the original Handler contract, only used when an Upgrader contract want to set the Handler contract.
    /// exception   PermissionException msg.sender is not the owner nor a registered Upgrader contract.
    /// exception   UpgraderException   Upgrader contract does not provide a right address of the original Handler contract.
    /// @return if Handler contract is successfully set.
    function setHandler (address _handlerAddr, address _originalHandlerAddr) external returns(bool);

    /** Upgrader contract functions */

    /// Register an Upgrader contract in the contract.
    /// If a proposal has not been accepted until proposalBlockNumber + proposalPeriod, it can be replaced by a new one.
    /// @param  _upgraderAddr  address of a deployed Upgrader contract.
    /// exception   PermissionException msg.sender is not the owner.
    /// exception   UpgraderConflictException   Another Upgrader contract is working.
    /// @return if Upgrader contract is successfully registered.
    function startUpgrading (address _upgraderAddr) public returns(bool);

    /// Getter of proposalPeriod.
    /// exception   UninitializationException   uninitialized contract.
    /// exception   GetterPermissionException   msg.sender is not permitted to call the getter.
    /// @return this.proposalPeriod.
    function getProposalPeriod () public view isReady allowedAddress returns(uint256);

    /// Setter of proposalPeriod.
    /// @param  _proposalPeriod new value of this.proposalPeriod.
    /// exception   UninitializationException   uninitialized contract.
    /// exception   PermissionException msg.sender is not the owner.
    /// @return if this.proposalPeriod is successfully set.
    function setProposalPeriod (uint256 _proposalPeriod) public isReady returns(bool);

    /// Return upgrading status for Upgrader contracts.
    /// @param  _originalHandlerAddr    address of the original Handler contract.
    /// exception   UninitializationException   uninitialized contract.
    /// @return Handler contract&apos;s upgrading status.
    function canBeUpgraded (address _originalHandlerAddr) external view isReady returns(UpgradingStatus);

    /// Check if the contract has been initialized.
    /// @return if the contract has been initialized.
    function live () external view returns(bool);

    /** Getters and setters of data resources: define functions here */
}
```


### Upgrader Contract (Optional)

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/her manage voting and upgrading.

Below is the specification of Upgrader contract:

- The Upgrader contract has the ability to take votes from the registered voters.
  - The contract owner is able to add voters any time before the proposal expires;
  - Voter can check the current status of the proposal (succeed or expired).
- Developers are able to delete this Upgrader contract by calling done() any time after deployment.

The Upgrader contract works as follows:

1. Verify the Data contract, its corresponding Handler contract and the new Handler contract have all been deployed;
2. Deploy an Upgrader contract using Data contract address, previous Handler contract address and new Handler contract address;
3. Register upgrader address in the new Handler contract first, then the original handler and finally the Data contract;
4. Call startProposal() to start the voting process;
5. Call getResolution() before the expiration;
6. Upgrading succeed or proposal is expired.

Note:

- Function done() can be called at any time to let upgrader destruct itself.
- Function status() can be called at any time to show caller status of the upgrader.


```solidity
/// Handler upgrader
contract Upgrader {
    // Data contract
    DataContract public data;
    // Original Handler contract
    IHandler public originalHandler;
    // New Handler contract
    address public newHandlerAddr;

    /** Marker */
    enum UpgraderStatus {
        Preparing,
        Voting,
        Success,
        Expired,
        End
    }
    UpgraderStatus public status;

    /// Check if the proposal is expired.
    /// If so, contract would be marked as expired.
    /// exception   PreparingUpgraderException  proposal has not been started.
    /// exception   ReupgradingException    upgrading has been done.
    /// exception   ExpirationException proposal is expired.
    modifier notExpired {
        require(status != UpgraderStatus.Preparing, &quot;Invalid proposal!&quot;);
        require(status != UpgraderStatus.Success, &quot;Upgrading has been done!&quot;);
        require(status != UpgraderStatus.Expired, &quot;Proposal is expired!&quot;);
        if (data.canBeUpgraded(address(originalHandler)) != DataContract.UpgradingStatus.InProgress) {
            status = UpgraderStatus.Expired;
            require(false, &quot;Proposal is expired!&quot;);
        }
        _;
    }

    /// Start voting.
    /// Upgrader must do upgrading check, namely checking if Data contract and 2 Handler contracts are ok.
    /// exception   RestartingException proposal has been already started.
    /// exception   PermissionException msg.sender is not the owner.
    /// exception   UpgraderConflictException   another upgrader is working.
    /// exception   NoPreparationException  original or new Handler contract is not prepared.
    function startProposal () external;

    /// Anyone can try to get resolution.
    /// If voters get consensus, upgrade the Handler contract.
    /// If expired, self-destruct.
    /// Otherwise, do nothing.
    /// exception   PreparingUpgraderException  proposal has not been started.
    /// exception   ExpirationException proposal is expired.
    /// @return     status of proposal.
    function getResolution() external returns(UpgraderStatus);

    /// Destruct itself.
    /// exception   PermissionException msg.sender is not the owner.
    function done() external;

    /** Other voting mechanism related variables and functions */
}
```


### Caveats

Since the Upgrader contract in [ERC-1504](./eip-1504.md) has a simple voting mechanism, it is prone to all the limitations that the voting contract is facing:

- 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. 
- It requires voters to be constantly active, informative and attentive to make a upgrader succeed.
- 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. 

## Rationale

### Data Contract and Handler Contract

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 **resources** that abstract the data and **operations** 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:

1. Data contract keeps the resources;
2. Handler contract contains operations.

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.

### Upgrader Contract and Voting Mechanism

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.

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/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.

### Gas and Complexity (regarding the enumeration extension)

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.  

Although upgrading contract may take some efforts and gas, it is a much less painful than deprecating the insecure contract/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. 

### Community Consensus

Thank you to those who helped on review and revise the proposal:

- [@lsankar4033](https://github.com/lsankar4033) from MIT
- more

The proposal is initiated and developed by the team Renaissance and the Research Group of Blockchain System @ Center for Operating System at Peking University.

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.

## Implementations

1. [Renaissance](https://www.renaissance.app) - a protocol that connect creators and fans financially
2. [ERC-1504](./eip-1504.md) - a reference implementation


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 17 Oct 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1504</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1504</guid>
      </item>
    
      <item>
        <title>Standard for Insurance Policies as ERC-721 Non Fungible Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1523</comments>
        
        <description>## Simple Summary
A standard interface for insurance policies, based on ERC 721.

## Abstract
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.

## Motivation
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.

## Specification
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.

An ERC-1523 compliant insurance policy is a non-fungible token which **MUST adhere to the ERC-721 token standard** and **MUST implement theERC721Metadata and the ERC721Enumerable interface**:

```solidity
/// @title ERC-1523 Insurance Policy Standard
///  Note: the ERC-165 identifier for this interface is 0x5a04be32
interface ERC1523 /* is ERC721, ERC721Metadata, ERC721Enumerable */ {

}
```

The implementor MAY choose values for the ```name``` and ```symbol```.

The **policy metadata extension** is **RECOMMENDED** for ERC-1523 smart contracts. 
This allows your smart contract to be interrogated for policy metadata.

```solidity
/// @title ERC-1523 Insurance Policy Standard, optional policy metadata extension
/// @dev See ...
///  Note: the ERC-165 identifier for this interface is 0x5a04be32
interface ERC1523PolicyMetadata /* is ERC1523 */ {

    /// @notice Metadata string for a given property.
    /// Properties are identified via hash of their property path.
    /// e.g. the property &quot;name&quot; in the ERC721 Metadata JSON Schema has the path /properties/name
    /// and the property path hash is the keccak256() of this property path. 
    /// this allows for efficient addressing of arbitrary properties, as the set of properties is potentially unlimited.
    /// @dev Throws if `_propertyPathHash` is not a valid property path hash. 
    function policyMetadata(uint256 _tokenId, bytes32 _propertyPathHash) external view returns (string _property);

}
```

In analogy to the “ERC721 Metadata JSON Schema”, the tokenURI **MUST** point to a JSON file with the following properties:
```json
{
    &quot;title&quot;: &quot;Asset Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset to which this NFT represents&quot;,
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset to which this NFT represents&quot;,
        },
        \[additional parameters according to the following table\]
    }
}
```

### Additional parameters for the metadata JSON Schema

| Parameter     | Type          | Mandatory | Description                                                                        |
| ------------- | ------------- | ----------| ---------------------------------------------------------------------------------- |  
| carrier       | string        | yes       | Describes the carrier which takes the primary risk                                 |
| risk          | string        | yes       | Describes the risk                                                                 |
| status        | string        | yes       | Describes the status of the policy, e.g. applied for, underwritten, expired        |
| parameters    | string        | no        | Describes further parameters characterizing the risk                               |
| terms         | string        | no        | Describes legal terms &amp; conditions which apply for this policy                     |
| premium       | string        | no        | A string representation of the premium, **MAY** contain currency denominator       |
| sum_insured   | string        | no        | A string representation of the sum insured, **MAY** contain currency denominator   |

Parameters which are mandatory **MUST** be included in the metadata JSON. Other parameters **MAY** be included. However, the proposed optional parameters **SHOULD** be used for the intended purpose, so e.g. if the premium amount would be included in the metadata, the parameter name **SHOULD** be &quot;premium&quot;.
All parameters **MAY** be plain text or **MAY** also be URIs pointing to resources which contain the respective information, and which **MAY** be protected by an authentication mechanism. 

## Rationale
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 **MAY** be used, and for which we only standardize the naming conventions.
### Mandatory parameters
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. 

### Optional parameters
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 **MAY** chose to implement more properties.

### On-chain vs. off-chain metadata
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 ```tokenURI``` **MUST** point to a JSON with the above structure, while the implementation of the ```policyMetadata``` function is **OPTIONAL**.


## Backwards Compatibility

## Test Cases

## Implementation

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 10 Oct 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1523</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1523</guid>
      </item>
    
      <item>
        <title>Transparent Contract Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1538</comments>
        
        <description>Replaced by [EIP-2535 Diamond Standard](./eip-2535.md).

## Simple Summary
This standard provides a contract architecture that makes upgradeable contracts flexible, unlimited in size, and transparent. 

A transparent contract publicly documents the full history of all changes made to it.

All changes to a transparent contract are reported in a standard format.

## Abstract
A transparent contract is a proxy contract design pattern that provides the following:

1. A way to add, replace and remove multiple functions of a contract atomically (at the same time).
1. Standard events to show what functions are added, replaced and removed from a contract, and why the changes are made.
2. A standard way to query a contract to discover and retrieve information about all functions exposed by it.
3. 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.
4. Enables an upgradeable contract to become immutable in the future if desired.

## Motivation
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.

However, a fundamental problem with trustless contracts that cannot be changed is that they cannot be changed. 

#### Bugs

Bugs and security vulnerabilities are unwittingly written into immutable contracts that ruin them.

#### Improvements

Immutable, trustless contracts cannot be improved, resulting in increasingly inferior contracts over time.

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.

#### Upgradeable Contracts vs. Centralized Private Database
Why have an upgradeable contract instead of a centralized, private, mutable database?
Here are some reasons:
1. Because of the openness of storage data and verified code, it is possible to show a provable history of trustworthiness.
2. Because of the openness, bad behavior can be spotted and reported when it happens.
3. Independent security and domain experts can review the change history of contracts and vouch for their history of trustworthiness.
4. It is possible for an upgradeable contract to become immutable and trustless.
5. An upgradeable contract can have parts of it that are not upgradeable and so are partially immutable and trustless.

#### Immutability

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.

### Middle Ground

Transparent contracts provide a middle ground between immutable trustless contracts that can&apos;t be improved and upgradeable contracts that can&apos;t be trusted.

### Purposes

1. Create upgradeable contracts that earn trust by showing a provable history of trustworthiness. 
2. Document the development of contracts so their development and change is provably public and can be understood.
3. Create upgradeable contracts that can become immutable in the future if desired.
4. Create contracts that are not limited by a max size.

### Benefits &amp; Use Cases
This standard is for use cases that benefit from the following:
1. The ability to add, replace or remove multiple functions of a contract atomically (at the same time).
2. Each time a function is added, replaced or removed, it is documented with events.
3. Build trust over time by showing all changes made to a contract.
4. Unlimited contract size.
5. The ability to query information about functions currently supported by the contract.
6. One contract address that provides all needed functionality and never needs to be replaced by another contract address.
7. The ability for a contract to be upgradeable for a time, and then become immutable.
8. Add trustless guarantees to a contract with &quot;unchangeable functions&quot;. 

### New Software Possibilities

This standard enables a form of contract version control software to be written.

Software and user interfaces can be written to filter the `FunctionUpdate` and `CommitMessage` events of a contract address. Such software can show the full history of changes of any contract that implements this standard. 

User interfaces and software can also use this standard to assist or automate changes of contracts.

## Specification

&gt; **Note:**
The solidity `delegatecall` 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 `delegatecall` enables a contract to &quot;borrow&quot; another contract&apos;s function. Functions executed with `delegatecall` affect the storage variables of the calling contract, not the contract where the functions are defined.

### General Summary

A transparent contract delegates or forwards function calls to it to other contracts using `delegatecode`. 

A transparent contract has an `updateContract` function that enables multiple functions to be added, replaced or removed.

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.

A transparent contract is a contract that implements and complies with the design points below.

### Terms

1. In this standard a **delegate contract** is a contract that a transparent contract fallback function forwards function calls to using `delegatecall`.
2. In this standard an **unchangeable function** is a function that is defined directly in a transparent contract and so cannot be replaced or removed.

### Design Points

A contract is a transparent contract if it implements the following design points:

1. 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.
2. The constructor of a transparent contract associates the `updateContract` function with a contract that implements the ERC1538 interface. The `updateContract` 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.
3. After a transparent contract is deployed functions are added, replaced and removed by calling the `updateContract` function.
4. The `updateContract` function associates functions with contracts that implement those functions, and emits the `CommitMessage` and `FunctionUpdate` events that document function changes.
5. The `FunctionUpdate` event is emitted for each function that is added, replaced or removed. The `CommitMessage` event is emitted one time for each time the `updateContract` function is called and is emitted after any `FunctionUpdate` events are emitted.
6. The `updateContract` function can take a list of multiple function signatures in its `_functionSignatures` parameter and so add/replace/remove multiple functions at the same time.
7. 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 `delegatecall`. If there is no delegate contract for the function then execution reverts.
8. The source code of a transparent contract and all delegate contracts used by it are publicly viewable and verified.

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 `updateContracts` function.

Typically some kind of authentication is needed for adding/replacing/removing functions from a transparent contract, **however the scheme for authentication or ownership is not part of this standard**.

### Example

Here is an example of an implementation of a transparent contract. Please note that the example below is an **example only.  It is not the standard**. A contract is a transparent contract when it implements and complies with the design points listed above.

```solidity
pragma solidity ^0.5.7;

contract ExampleTransparentContract {
  // owner of the contract
  address internal contractOwner;
  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

  // maps functions to the delegate contracts that execute the functions
  // funcId =&gt; delegate contract
  mapping(bytes4 =&gt; address) internal delegates;

  // maps each function signature to its position in the funcSignatures array.
  // signature =&gt; index+1
  mapping(bytes =&gt; uint256) internal funcSignatureToIndex;
    
  event CommitMessage(string message);
  event FunctionUpdate(bytes4 indexed functionId, address indexed oldDelegate, address indexed newDelegate, string functionSignature);
  
  // this is an example of an &quot;unchangeable function&quot;.
  // return the delegate contract address for the supplied function signature
  function delegateAddress(string calldata _functionSignature) external view returns(address) {
    require(funcSignatureToIndex[bytes(_functionSignature)] != 0, &quot;Function signature not found.&quot;);
    return delegates[bytes4(keccak256(bytes(_functionSignature)))];
  }
  
  // add a function using the updateContract function
  // this is an internal helper function
  function addFunction(address _erc1538Delegate, address contractAddress, string memory _functionSignatures, string memory _commitMessage) internal {    
    // 0x03A9BCCF == bytes4(keccak256(&quot;updateContract(address,string,string)&quot;))
    bytes memory funcdata = abi.encodeWithSelector(0x03A9BCCF, contractAddress, _functionSignatures, _commitMessage);
    bool success;
    assembly {
      success := delegatecall(gas, _erc1538Delegate, add(funcdata, 0x20), mload(funcdata), funcdata, 0)
    }
    require(success, &quot;Adding a function failed&quot;);   
  }

  constructor(address _erc1538Delegate) public {
    contractOwner = msg.sender;
    emit OwnershipTransferred(address(0), msg.sender);

    // adding ERC1538 updateContract function
    bytes memory signature = &quot;updateContract(address,string,string)&quot;;
    bytes4 funcId = bytes4(keccak256(signature));
    delegates[funcId] = _erc1538Delegate;
    emit FunctionUpdate(funcId, address(0), _erc1538Delegate, string(signature));
    emit CommitMessage(&quot;Added ERC1538 updateContract function at contract creation&quot;);
	
    // associate &quot;unchangeable functions&quot; with this transparent contract address
    // prevents function selector clashes with delegate contract functions
    // uses the updateContract function
    string memory functions = &quot;delegateAddress(string)&quot;;
    addFunction(_erc1538Delegate, address(this), functions, &quot;Associating unchangeable functions&quot;);
	
    // adding ERC1538Query interface functions
    functions = &quot;functionByIndex(uint256)functionExists(string)delegateAddresses()delegateFunctionSignatures(address)functionById(bytes4)functionBySignature(string)functionSignatures()totalFunctions()&quot;;    
    // &quot;0x01234567891011121314&quot; is an example address of an ERC1538Query delegate contract
    addFunction(_erc1538Delegate, 0x01234567891011121314, functions, &quot;Adding ERC1538Query functions&quot;);
    
    // additional functions could be added at this point
  }

  // Making the fallback function payable makes it work for delegate contract functions 
  // that are payable and not payable.
  function() external payable {
    // Delegate every function call to a delegate contract
    address delegate = delegates[msg.sig];
    require(delegate != address(0), &quot;Function does not exist.&quot;);
    assembly {
      let ptr := mload(0x40)
      calldatacopy(ptr, 0, calldatasize)
      let result := delegatecall(gas, delegate, ptr, calldatasize, 0, 0)
      let size := returndatasize
      returndatacopy(ptr, 0, size)
      switch result
      case 0 {revert(ptr, size)}
      default {return (ptr, size)}
    }
  }
}
```
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).

The constructor function adds the `updateContract` function to the transparent contract, which is then used to add other functions to the transparent contract.

Each time a function is added to a transparent contract the events `CommitMessage` and `FunctionUpdate` are emitted to document exactly what functions where added or replaced and why.

The delegate contract that implements the `updateContract` function implements the following interface: 
### ERC1538 Interface

```solidity
pragma solidity ^0.5.7;

/// @title ERC1538 Transparent Contract Standard
/// @dev Required interface
///  Note: the ERC-165 identifier for this interface is 0x61455567
interface ERC1538 {
  /// @dev This emits when one or a set of functions are updated in a transparent contract.
  ///  The message string should give a short description of the change and why
  ///  the change was made.
  event CommitMessage(string message);
  
  /// @dev This emits for each function that is updated in a transparent contract.
  ///  functionId is the bytes4 of the keccak256 of the function signature.
  ///  oldDelegate is the delegate contract address of the old delegate contract if
  ///  the function is being replaced or removed.
  ///  oldDelegate is the zero value address(0) if a function is being added for the
  ///  first time.
  ///  newDelegate is the delegate contract address of the new delegate contract if 
  ///  the function is being added for the first time or if the function is being 
  ///  replaced.
  ///  newDelegate is the zero value address(0) if the function is being removed.
  event FunctionUpdate(
    bytes4 indexed functionId, 
    address indexed oldDelegate, 
    address indexed newDelegate, 
    string functionSignature
  );

  /// @notice Updates functions in a transparent contract.
  /// @dev If the value of _delegate is zero then the functions specified 
  ///  in _functionSignatures are removed.
  ///  If the value of _delegate is a delegate contract address then the functions 
  ///  specified in _functionSignatures will be delegated to that address.
  /// @param _delegate The address of a delegate contract to delegate to or zero
  ///        to remove functions.      
  /// @param _functionSignatures A list of function signatures listed one after the other
  /// @param _commitMessage A short description of the change and why it is made
  ///        This message is passed to the CommitMessage event.          
  function updateContract(address _delegate, string calldata _functionSignatures, string calldata _commitMessage) external;  
}
```
### Function Signatures String Format

The text format for the `_functionSignatures` parameter is simply a string of function signatures. For example: `&quot;myFirstFunction()mySecondFunction(string)&quot;` This format is easy to parse and is concise.

Here is an example of calling the `updateContract` function that adds the ERC721 standard functions to a transparent contract:
```javascript
functionSignatures = &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;
tx = await transparentContract.updateContract(erc721Delegate.address, functionSignatures, &quot;Adding ERC721 functions&quot;);
```

### Removing Functions

Functions are removed by passing `address(0)` as the first argument to the `updateContract` function. The list of functions that are passed in are removed.

### Source Code Verification

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;!--
A transparent contract must implement the [ERC-165 Standard Interface Detection standard](./eip-165.md) via a delegate contract by adding the `supportsInterface` function using the `updateContract` function. The interfaceID for the ERC1538 standard is `0x61455567`.
--&gt;

### Function Selector Clash
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 `updateContract` function. See the [reference implementation of ERC1538](https://github.com/mudgen/transparent-contracts-erc1538) to see an example of how function clashes can be prevented.

### ERC1538Query

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.

The following is an optional interface for querying function information from a transparent contract:

```solidity
pragma solidity ^0.5.7;

interface ERC1538Query {
    
  /// @notice Gets the total number of functions the transparent contract has.
  /// @return The number of functions the transparent contract has,
  ///  not including the fallback function.
  function totalFunctions() external view returns(uint256);
	
  /// @notice Gets information about a specific function
  /// @dev Throws if `_index` &gt;= `totalFunctions()`
  /// @param _index The index position of a function signature that is stored in an array
  /// @return The function signature, the function selector and the delegate contract address
  function functionByIndex(uint256 _index) 
    external 
    view 
    returns(
      string memory functionSignature, 
      bytes4 functionId, 
      address delegate
    );
	
  /// @notice Checks to see if a function exists
  /// @param The function signature to check
  /// @return True if the function exists, false otherwise
  function functionExists(string calldata _functionSignature) external view returns(bool);
	
  /// @notice Gets all the function signatures of functions supported by the transparent contract
  /// @return A string containing a list of function signatures
  function functionSignatures() external view returns(string memory);
	
  /// @notice Gets all the function signatures supported by a specific delegate contract
  /// @param _delegate The delegate contract address
  /// @return A string containing a list of function signatures
  function delegateFunctionSignatures(address _delegate) external view returns(string memory);
	
  /// @notice Gets the delegate contract address that supports the given function signature
  /// @param The function signature
  /// @return The delegate contract address
  function delegateAddress(string calldata _functionSignature) external view returns(address);
	
  /// @notice Gets information about a function
  /// @dev Throws if no function is found
  /// @param _functionId The id of the function to get information about
  /// @return The function signature and the contract address
  function functionById(bytes4 _functionId) 
    external 
    view 
    returns(
      string memory signature, 
      address delegate
    );
	
  /// @notice Get all the delegate contract addresses used by the transparent contract
  /// @return An array of all delegate contract addresses
  function delegateAddresses() external view returns(address[] memory);
}
```

See the [reference implementation of ERC1538](https://github.com/mudgen/transparent-contracts-erc1538) to see how this is implemented.

The text format for the list of function signatures returned from the `delegateFunctionSignatures` and `functionSignatures` functions is simply a string of function signatures. Here is an example of such a string: `&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;`

### How To Deploy A Transparent Contract
1. 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.
2. Create your transparent contract with a fallback function as given above. Your transparent contract also needs a constructor that adds the `updateContract` function.
3. Deploy your transparent contract to a blockchain. Pass in the address of the ERC1538 delegate contract to your constructor if it requires it.

See the [reference implementation](https://github.com/mudgen/transparent-contracts-erc1538) for examples of these contracts.

### Wrapper Contract for Delegate Contracts that Depend on Other Delegate Contracts
In some cases some delegate contracts may need to call external/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. [See his comment for more information.](https://github.com/ethereum/EIPs/issues/1538#issuecomment-451985155) Another way to solve this problem is to use assembly to call functions provided by other delegate contracts.

### Decentralized Authority
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 `updateContract` function. Changes only go into effect when the changes are fully approved. The `CommitMessage` and ` FunctionUpdate` events should only be emitted when changes go into effect.

## Security
&gt; This standard refers to **owner(s)** as one or more individuals that have the power to add/replace/remove functions of an upgradeable contract.

### General

The owners(s) of an upgradeable contract have the ability to alter, add or remove data from the contract&apos;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.

&gt;**Note:** The design and implementation of contract ownership is **not** part of this standard. The examples given in this standard and in the reference implementation are just **examples** of how it could be done.

### Unchangeable Functions

&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&apos;s storage could have been altered by the owner(s) of the contract. Data written to the transparent contract&apos;s storage can be undone or altered by the owner(s) of the contract.

In some cases unchangeble functions add trustless guarantees to a transparent contract.

### Transparency

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. 

Security and domain experts can review the history of change of any transparent contract to detect any history of foul play.

## Rationale

### String of Function Signatures Instead of bytes4[] Array of Function Selectors

The `updateContract` function takes a `string` list of functions signatures as an argument instead of a `bytes4[]` array of function selectors for three reasons:

1. Passing in function signatures enables the implementation of `updateContract` to prevent selector clashes. 
2. 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/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.
3. 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.

### Gas Considerations

Delegating function calls does have some gas overhead. This is mitigated in two ways: 
1. 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.
2. 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 [ERC1412 standard](https://github.com/ethereum/EIPs/issues/1412) to help reduce gas (and make batch transfers more convenient).

### Storage

The standard does not specify how data is stored or organized by a transparent contract. But here are some suggestions:

**Inherited Storage**

1. 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.

2. 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.

3. 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.

Here is a simple way inherited storage could be implemented:

1. Create a storage contract that contains the storage variables that your transparent contract and delegate contracts will use.
2. Make your delegate contracts inherit the storage contract.
3. 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.
4. Repeat steps 2 or 3 for every new delegate contract.


**Unstructured Storage**

Assembly is used to store and read data at specific storage locations. An advantage to this approach is that previously used storage locations don&apos;t have to be defined or mentioned in a delegate contract if they aren&apos;t used by it.

**Eternal Storage**

Data can be stored using a generic API based on the type of data. [See ERC930 for more information.](https://github.com/ethereum/EIPs/issues/930)

### Becoming Immutable
It is possible to make a transparent contract become immutable. This is done by calling the `updateContract` function to remove the `updateContract` function. With this gone it is no longer possible to add, replace and remove functions.

### Versions of Functions

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 `delegateAddress` 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.

### Best Practices, Tools and More Information

&gt; More information, tools, tutorials and best practices concerning transparent contracts need to be developed and published. 

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.

[ERC1538: Future Proofing Smart Contracts and Tokens](https://coinjournal.net/erc1538-future-proofing-smart-contacts-and-tokens/)

[The ERC1538 improving towards the “transparent contract” standard](https://www.crypto-economy.net/en/ethereum-eth-erc1538-transparent-contract-standard/)

### Inspiration

This standard was inspired by ZeppelinOS&apos;s implementation of [Upgradeability with vtables](https://github.com/zeppelinos/labs/tree/master/upgradeability_with_vtable). 

This standard was also inspired by the design and implementation of the [Mokens contract](https://etherscan.io/address/0xc1eab49cf9d2e23e43bcf23b36b2be14fc2f8838#code) from the [Mokens project](https://github.com/Mokens/MIPs/blob/master/MIPS/mip-2-Goals-and-Objectives.md). The Mokens contract has been [upgraded to implement this standard](https://etherscan.io/address/0x0ac5637fe62ec14fd9e237a81a9679d4adef701f#code).


## Backwards Compatibility
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.

This standard future proofs a contract.

## Implementation
A reference implementation of this standard is given in the [transparent-contracts-erc1538](https://github.com/mudgen/transparent-contracts-erc1538) repository.


## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 31 Oct 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1538</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1538</guid>
      </item>
    
      <item>
        <title>contenthash field for ENS</title>
        <category>Standards Track/ERC</category>
        
        <description>## Abstract

This EIP introduces the new `contenthash` field for ENS resolvers, allowing for a better defined system of mapping names to network and content addresses. Additionally the `content` and `multihash` fields are deprecated.

## Motivation

Multiple applications including [Metamask](https://metamask.io/) and mobile clients such as [Status](https://status.im) have begun resolving ENS names to content hosted on distributed systems such as [IPFS](https://ipfs.io/) and [Swarm](https://swarm-guide.readthedocs.io). 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.

The `contenthash` field allows for easy specification of network and content addresses in ENS.

## Specification

The field `contenthash` is introduced, which permits a wide range of protocols to be supported by ENS names. Resolvers supporting this field MUST return `true` when the `supportsInterface` function is called with argument `0xbc1c58d1`.

The fields `content` and `multihash` are deprecated.

The value returned by `contenthash` MUST be represented as a machine-readable [multicodec](https://github.com/multiformats/multicodec). The format is specified as follows:

```
&lt;protoCode uvarint&gt;&lt;value []byte&gt;
```

protoCodes and their meanings are specified in the [multiformats/multicodec](https://github.com/multiformats/multicodec) repository.

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 [CIDs](https://github.com/multiformats/cid) without a base prefix, meaning their value is formatted as follows:

```
&lt;protoCode uvarint&gt;&lt;cid-version&gt;&lt;multicodec-content-type&gt;&lt;multihash-content-address&gt;
```

When resolving a `contenthash`, applications MUST use the protocol code to determine what type of address is encoded, and resolve the address appropriately for that protocol, if supported.

### Example

#### IPFS

Input data:

```
storage system: IPFS (0xe3)
CID version: 1 (0x01)
content type: dag-pb (0x70)
hash function: sha2-256 (0x12)
hash length: 32 bytes (0x20)
hash: 29f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
```

Binary format:

```
0xe3010170122029f2d17be6139079dc48696d1f582a8530eb9805b561eda517e22a892c7e3f1f
```

Text format:

```
ipfs://QmRAQB6YaCyidP37UdDnjFY5vQuiBrcqdyoW1CuDgwxkD4
```

### Swarm

Input data:

```
storage system: Swarm (0xe4)
CID version: 1 (0x01)
content type: swarm-manifest (0xfa)
hash function: keccak256 (0x1b)
hash length: 32 bytes (0x20)
hash: d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
```

Binary format:
```
0xe40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
```

Text format:
```
bzz://d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
```

Example usage with swarm hash:
```
$ swarm hash ens contenthash d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162                                 
&gt; e40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162
```

### Fallback

In order to support names that have an IPFS or Swarm hash in their `content` field, a grace period MUST be implemented offering those name holders time to update their names. If a resolver does not support the `multihash` interface, it MUST be checked whether they support the `content` 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.

### Implementation

To support `contenthash`, a new resolver has been developed and can be found [here](https://github.com/ensdomains/resolvers/blob/master/contracts/PublicResolver.sol), you can also find this smart contract deployed on:

* Mainnet : [0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3](https://etherscan.io/address/0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3)
* Ropsten : [0xde469c7106a9fbc3fb98912bb00be983a89bddca](https://ropsten.etherscan.io/address/0xde469c7106a9fbc3fb98912bb00be983a89bddca)

There are also implementations in multiple languages to encode and decode `contenthash`:

* [JavaScript](https://github.com/pldespaigne/content-hash)
* [Python](https://github.com/filips123/ContentHashPy)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 13 Nov 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1577</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1577</guid>
      </item>
    
      <item>
        <title>Non-wallet usage of keys derived from BIP-32 trees</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/non-wallet-usage-of-keys-derived-from-bip-32-trees/1817</comments>
        
        <description>## Abstract
BIP32 defines a way to generate hierarchical trees of keys which can be derived from a common master key. BIP32 and [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) 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.

## Motivation
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.

## Specification

### Path levels
We define the following levels in BIP32 path:

```m / purpose&apos; / coin_type&apos; / subpurpose&apos; / key_type&apos; / key_index```

Apostrophe in the path indicates that BIP32 hardened derivation is used.

This structure follows the [BIP43](https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki) recommendations and its [amendments for non-Bitcoin usage](https://github.com/bitcoin/bips/pull/523/files). Each level has a special meaning, described in the chapters below.

### Purpose/Coin Type/Subpurpose
This part is constant and set to ```m / 43&apos; / 60&apos; / 1581&apos;```, meaning BIP 43 -&gt; Ethereum -&gt; This EIP.

All subtrees under this prefix are the scope of this EIP.

### Key type
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

Hardened derivation is used at this level.

### Key index
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.

As an example, let&apos;s assume we have a key with key type 4&apos; and a key_index representing a 62-bit ID represented as hexadecimal 0x2BCDEFFEDCBAABCD the complete keypath would be  ```m / 43&apos; / 60&apos; / 1581&apos; / 4&apos; / ‭1469833213‬&apos; / ‭1555737549‬ ```. 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.

## Rationale
The structure proposed above follows the BIP43 generic structure and is similar to the widely adopted BIP44 specification.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 13 Nov 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1581</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1581</guid>
      </item>
    
      <item>
        <title>Address and ERC20-compliant transfer rules</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1597</comments>
        
        <description>## Simple Summary

We propose a standard and an interface to define transfer rules, in the context of ERC20 tokens and possibly beyond.


A rule can act based on sender, destination and amount, and is triggered (and rejects the transfer) according to any required business logic.


To ease rule reusability and composition, we also propose an interface and base implementation for a rule engine.

## Abstract

This standard proposal should answer the following challenges:
- Enable integration of rules with interacting platforms such as exchanges, decentralized wallets and DApps.
- Externale code and storage, improve altogether reusability, gas costs and contracts&apos; memory footprint.
- Highlight contract behavior and its evolution, in order to ease user interaction with such contract. 


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. 
[EIP-902](./eip-902.md), 
[EIP-1066](./eip-1066.md)
and [EIP-1175](./eip-1175.md).

This document proposes specifications for a standard of **transfer rules** 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&apos; opinion.

The last section of this document illustrates the proposal with a rule template and links to rule implementations.

## Motivation

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.

## Specification

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.

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.

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.

## Rule interface

`IRule` interface should provide a way to validate if an address or a transfer is valid.

If one of these two methods is not applicable, it can simply be made to return true systematically.
If any parameter of `isTransferValid` is not needed, its name should be commented out with `/* */`.

```js
pragma solidity ^0.4.25;

interface IRule {
  function isAddressValid(address _address) external view returns (bool);
  function isTransferValid(address _from, address _to, uint256 _amount)
    external view returns (bool);
}
```

## WithRules interface

`WithRules` 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.

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.

```js
pragma solidity ^0.4.25;

import &quot;./IRule.sol&quot;;

interface IWithRules {
  function ruleLength() public view returns (uint256);
  function rule(uint256 _ruleId) public view returns (IRule);
  function validateAddress(address _address) public view returns (bool);
  function validateTransfer(address _from, address _to, uint256 _amount)
    public view returns (bool);

  function defineRules(IRule[] _rules) public;

  event RulesDefined(uint256 count);
}
```

## WithRules implementation

We also propose a simple implementation of the rule engine, available [here](https://github.com/MtPelerin/MtPelerin-protocol/blob/master/contracts/rule/WithRules.sol). 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.


On top of implementing the interface above, this engine also defines two modifiers (`whenAddressRulesAreValid`and  `whenTransferRulesAreValid`), which can be used throughout the token contract to restrict `transfer()`, `transferFrom` and any other function that needs to respect either a simple whitelist or complex transfer rules.


## Integration

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 `defineRules()` to attach all rules in the chosen order, within a single transaction.

Below is a template for a rule.

```solidity
import &quot;../interface/IRule.sol&quot;;

contract TemplateRule is IRule {
  
  // state vars for business logic

  constructor(/* arguments for init */) public {

    // initializations

  }

  function isAddressValid(address _from) public view returns (bool) {
    boolean isValid;

    // business logic 

    return isValid;
  }

  function isTransferValid(
    address _from,
    address _to,
    uint256 _amount)
    public view returns (bool)
  {
    boolean isValid;

    // business logic 

    return isValid;
  }
}
```

*** Notes ***
The MPS (Mt Pelerin&apos;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.

#### Example of rules implementations

- [YesNo rule](https://github.com/MtPelerin/MtPelerin-protocol/tree/master/contracts/rule/YesNoRule.sol): Trivial rule used to demonstrate both a rule and the rule engine.

- [Freeze rule](https://github.com/MtPelerin/MtPelerin-protocol/tree/master/contracts/rule/FreezeRule.sol): This rule allows to prevent any transfer of tokens to or from chosen addresses. A smart blacklist.

- [Lock rule](https://github.com/MtPelerin/MtPelerin-protocol/tree/master/contracts/rule/LockRule.sol): 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.

- [User Kyc Rule](https://github.com/MtPelerin/MtPelerin-protocol/tree/master/contracts/rule/UserKycRule.sol): 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&apos;s tasks.

#### Example implementations are available at
- [Mt Pelerin Bridge protocol rules implementation](https://github.com/MtPelerin/MtPelerin-protocol/tree/master/contracts/rule)
- [Mt Pelerin Token with rules](https://github.com/MtPelerin/MtPelerin-protocol/blob/master/contracts/token/component/TokenWithRules.sol)

## History

Historical links related to this standard:

- The first regulated tokenized share issued by Mt Pelerin (MPS token) is using an early version of this proposal: https://www.mtpelerin.com/blog/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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
External references outside this repository will have their own specific copyrights.
</description>
        <pubDate>Fri, 09 Nov 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1592</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1592</guid>
      </item>
    
      <item>
        <title>Gas stations network</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/yoav-tabookey/EIPs/issues/1</comments>
        
        <description>## Simple Summary
Make smart contracts (e.g. dapps) accessible to non-ether users by allowing contracts to accept &quot;[collect-calls](https://en.wikipedia.org/wiki/Collect_call)&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.

## Abstract
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 [EIP-1077](./eip-1077.md) could allow transactions from addresses that hold no ETH.

The gas stations network is an [EIP-1077](./eip-1077.md) 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;.

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&apos;s at least one honest gas station. Attempts to undermine the system can be proven on-chain and offenders can be penalized.

## Motivation

* Increase user adoption of smart contracts by:
    * 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.
    * 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.
* Ethereum nodes get a revenue source without requiring mining equipment. The entire network benefits from having more nodes.
* 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.

## Specification

The system consists of a `RelayHub` singleton contract, participating contracts inheriting the `RelayRecipient` contract, a decentralized network of `Relay` nodes, a.k.a. Gas Stations, 
and user applications (e.g. mobile or web) interacting with contracts via relays.

Roles of the `RelayHub`:

* Maintain a list of active relays. Senders select a `Relay` from this list for each transaction. The selection process is discussed below.
* Mediate all communication between relays and contracts.
* Provide contracts with trusted versions of the real msg.sender and msg.data.
* 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.
* Hold ETH prepayments made by contracts and use them to compensate relays.
* Penalize provably-offensive relays by giving their stakes to an address providing the proof, thus keeping relays honest.
* Provide a free way for relays to know whether they&apos;ll be compensated for a future transaction.

Roles of a `Relay` node:

* Maintain a hot wallet with a small amount of ETH, to pay for gas.
* Provide a public interface for user apps to send gasless transactions via channels such as https or whisper.
* Publish it&apos;s public interfaces and its price (as a multiplier of the actual transaction gas cost) in `RelayHub`.
* 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.

Implementing a `RelayRecipient` contract:

* Know the address of `RelayHub` and trust it to provide information about the transaction.
* Maintain a small balance of ETH gas prepayment deposit in `RelayHub`. Can be paid directly by the `RelayRecipient` contract, or by the dapp&apos;s owner on behalf of the `RelayRecipient` 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.
* Use `getSender()` and `getMessageData()` instead of `msg.sender` and `msg.data`, everywhere. `RelayRecipient` provides these functions and gets the information from `RelayHub`.
* Implement a `acceptRelayedCall(address relay, address from, bytes memory encodedFunction, uint gasPrice, uint transactionFee, bytes memory approval)` view function that returns **zero** if and only if it is willing to accept a transaction and pay for it. 
  `acceptRelayedCall` is called by `RelayHub` as a view function when a `Relay` inquires it, and also during the actual transaction. Transactions are reverted if **non-zero**, and `Relay` only gets compensated for transactions (whether successful or reverted) if `acceptRelayedCall` returns **zero**. Some examples of `acceptRelayedCall()` implementations:
    * Whitelist of trusted dapp members.
    * 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 `RelayRecipient` balance sheet. 
      Users can never cost the dapp more than they were credited for.
    * A dapp can provide off-chain a signed message called `approval` to a transaction sender and validate it.
    * 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&apos;s prepaid gas deposit. 
      Dapps allowing anonymous onboarding transactions might benefit from registering their own `Relay` and accepting anonymous transactions only from that `Relay`, 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/mitigations section below.   
* Implement `preRelayedCall(address relay, address from, bytes memory encodedFunction, uint transactionFee) returns (bytes32)`. This method is called before a transaction is relayed. By default, it does nothing.
  
* Implement `postRelayedCall(ddress relay, address from, bytes memory encodedFunction, bool success, uint usedGas, uint transactionFee, bytes32 preRetVal)`. This method is called after a transaction is relayed. By default, it does nothing.
  
  These two methods can be used to charge the user in dapp-specific manner. 

Glossary of terms used in the processes below:

* `RelayHub` - the RelayHub singleton contract, used by everyone.
* `Recipient` - a contract implementing `RelayRecipient`, accepting relayed transactions from the RelayHub contract and paying for the incoming transactions.
* `Sender` - an external address with a valid key pair but no ETH to pay for gas.
* `Relay` - a node holding ETH in an external address, listed in RelayHub and relaying transactions from Senders to RelayHub for a fee.

![Sequence Diagram](../assets/eip-1613/sequence.png)

The process of registering/refreshing a `Relay`:

* Relay starts listening as a web app (or on some other communication channel).
* If starting for the first time (no key yet), generate a key pair for Relay&apos;s address.
* If Relay&apos;s address doesn&apos;t hold sufficient funds for gas (e.g. because it was just generated), Relay stays inactive until its owner funds it.
* Relay&apos;s owner funds it.
* Relay&apos;s owner sends the required stake to `RelayHub` by calling `RelayHub.stake(address relay, uint unstakeDelay)`.
* `RelayHub` puts the `owner` and `unstake delay` in the relays map, indexed by `relay` address.
* Relay calls `RelayHub.registerRelay(uint transactionFee, string memory url)` with the relay&apos;s `transaction fee` (as a multiplier on transaction gas cost), and a URL for incoming transactions. 
* `RelayHub` ensures that Relay has a sufficient stake.
* `RelayHub` puts the `transaction fee` in the relays map.
* `RelayHub` emits an event, `RelayAdded(Relay, owner, transactionFee, relayStake, unstakeDelay, url)`.
* Relay starts a timer to perform a `keepalive` transaction every 6000 blocks.
* `Relay` goes to sleep and waits for signing requests.

The process of sending a relayed transaction:

* `Sender` selects a live `Relay` from RelayHub&apos;s list by looking at `RelayAdded` events from `RelayHub`, and sorting based on its own criteria. Selection may be based on a mix of:
    * Relay published transaction fees.
    * Relay stake size and lock-up time.
    * Recent relay transactions (visible through `TransactionRelayed` events from `RelayHub`).
    * Optionally, reputation/blacklist/whitelist held by the sender app itself, or its backend, on per-app basis (not part of the gas stations network).
* Sender prepares the transaction with Sender&apos;s address, the recipient address, the actual transaction data, Relay&apos;s transaction fee, gas price, gas limit, its current nonce from `RelayHub.nonces`, RelayHub&apos;s address, and Relay&apos;s address, and then signs it.
* Sender verifies that `RelayHub.balances[recipient]` holds enough ETH to pay Relay&apos;s fee.
* Sender verifies that `Relay.balance` has enough eth to send the transaction
* Sender reads the Relay&apos;s current `nonce` value and decides on the `max_nonce` parameter.
* Sender sends the signed transaction amd metadata to Relay&apos;s web interface.
* `Relay` wraps the transaction with a transaction to `RelayHub`, with zero ETH value.
* `Relay` signs the wrapper transaction with its key in order to pay for gas.
* `Relay` verifies that:
    * The transaction&apos;s recipient contract will accept this transaction when submitted, by calling `RelayHub.canRelay()`, a view function, 
      which checks the recipient&apos;s `acceptRelayedCall`, also a view function, stating whether it&apos;s willing to accept the charges).
    * The transaction nonce matches `RelayHub.nonces[sender]`.
    * The relay address in the transaction matches Relay&apos;s address.
    * The transaction&apos;s recipient has enough ETH deposited in `RelayHub` to pay the transaction fee.
    * Relay has enough ETH to pay for the gas required by the transaction.
    * Value of `max_nonce` is higher than current Relay&apos;s `nonce`
* If any of Relay&apos;s checks fail, it returns an error to sender, and doesn&apos;t proceed.
* Relay submits the signed wrapped transaction to the blockchain.
* Relay immediately returns the signed wrapped transaction to the sender.  This step is discussed below, in attacks/mitigations.
* `Sender` receives the wrapped transaction and verifies that:
    * It&apos;s a valid relay call to `RelayHub`. from Relay&apos;s address.
    * The transaction&apos;s ethereum nonce matches Relay&apos;s current nonce.
    * The transaction&apos;s ethereum nonce is lower than or equal to `max_nonce`.
    * `Relay` is sufficiently funded to pay for it.
    * The wrapped transaction is valid and signed by `sender`.
    * Recipient contract has sufficient funds in `RelayHub.balances` to pay for Relay&apos;s fee as stated in the transaction.
* If any of sender&apos;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.
* `Sender` 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&apos;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/mitigations, but may speed things up.
* `Sender` monitors the blockchain, waiting for the transaction to be mined. 
  The transaction was verified, with Relay&apos;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 `RelayHub.penalizeRepeatedNonce` through another relay, to collect his reward and burn the remainder of the offending relay&apos;s stake, and then go back to selecting a new Relay for the transaction. 
  See discussion in the attacks/mitigations section below.
* `RelayHub` receives the transaction:
    * Records `gasleft()` as `initialGas` for later payment.
    * Verifies the transaction is sent from a registered relay.
    * Verifies that the signature of the internal transaction matches its stated origin (sender&apos;s key).
    * Verifies that the relay address written in the transaction matches msg.sender.
    * Verifies that the transaction&apos;s `nonce` matches the stated origin&apos;s nonce in `RelayHub.nonces`.
    * Calls recipient&apos;s `acceptRelayedCall` function, asking whether it&apos;s going to accept the transaction. If not, the `TransactionRelayed` will be emitted with status `CanRelayFailed`, and `chargeOrCanRelayStatus` will contain the return value of `acceptRelayedCall`. In this case, Relay doesn&apos;t get paid, as it was its responsibility to check `RelayHub.canRelay` before releasing the transaction.
    * Calls recipient&apos;s `preRelayedCall` function. If this call reverts the `TransactionRelayed` will be emitted with status `PreRelayedFailed`.
    * Sends the transaction to the recipient.  If this call reverts the `TransactionRelayed` will be emitted with status `RelayedCallFailed`.
      When passing gas to `call()`, enough gas is preserved by `RelayHub`, for post-call handling. Recipient may run out of gas, but `RelayHub` never does. 
      `RelayHub` also sends sender&apos;s address at the end of `msg.data`, so `RelayRecipient.getSender()` will be able to extract the real sender, and trust it because the transaction came from the known `RelayHub` address.
* Recipient contract handles the transaction.
* `RelayHub` calls recipient&apos;s `postRelayedCall`.
* `RelayHub` checks call&apos;s return value of call, and emits `TransactionRelayed(address relay, address from, address to, bytes4 selector, uint256 status, uint256 chargeOrCanRelayStatus)`.
* `RelayHub` increases `RelayHub.nonces[sender]`.
* `RelayHub` transfers ETH balance from recipient to `Relay.owner`, 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 `canRelay` 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/mitigations below.
* `Relay` keeps track of transactions it sent, and waits for `TransactionRelayed` events to see the charge. 
  If a transaction reverts and goes unpaid, which means the recipient&apos;s `acceptRelayedCall()` function was inconsistent, `Relay` refuses service to that recipient for a while (or blacklists it indefinitely, if it happens often). 
  See attacks/mitigations below.

The process of winding a `Relay` down:

* Relay&apos;s owner (the address that initially funded it) calls `RelayHub.removeRelayByOwner(Relay)`.
* `RelayHub` ensures that the sender is indeed Relay&apos;s owner, then removes `Relay`, and emits `RelayRemoved(Relay)`.
* `RelayHub` starts the countdown towards releasing the owner&apos;s stake.
* `Relay` receives its `RelayRemoved` event.
* `Relay` sends all its remaining ETH to its owner.
* `Relay` shuts down.
* Once the owner&apos;s unstake delay is over, owner calls `RelayHub.unstake()`, and withdraws the stake.

## Rationale
The rationale for the gas stations network design is a combination of two sets of requirements: Easy adoption, and robustness.

For easy adoption, the design goals are:

* No network changes.
* Minimal changes to contracts, apps and frameworks.

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.

Specifically we&apos;ve considered the following types of attacks:

* Denial-of-service attacks against individual senders, i.e. transactions censorship.
* Denial-of-service and financial attacks against individual relays.
* Denial-of-service and financial attacks against individual contracts.
* Denial-of-service attacks against the entire network, either by attacking existing entities, or by introducing any number of malicious entities.

#### Attacks and mitigations

##### Attack: Relay attempts to censor a transaction by not signing it, or otherwise ignoring a user request.
Relay is expected to return the signed transaction to the sender, immediately. 
Sender doesn&apos;t need to wait for the transaction to be mined, and knows immediately whether it&apos;s request has been served. 
If a relay doesn&apos;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.

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.

##### Attack: Relay attempts to censor a transaction by signing it, returning it to the sender, but never putting it on the blockchain.
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.

##### Attack: Relay attempts to censor a transaction by signing it, but publishing a different transaction with the same nonce.
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 `RelayHub.TransactionRelayed` event. 
However, the attack will backfire and cost Relay its entire stake.

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 `RelayHub.penalizeRepeatedNonce(bytes transaction1, bytes transaction2)`, which verifies the attack, confiscates Relay&apos;s stake, 
and sends half of it to the sender who delivered the `penalizeRepeatedNonce` call. The other half of the stake is burned by sending it to `address(0)`. 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.

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.

##### Attack: Relay attempts to censor a transaction by signing it, but using a nonce higher than it&apos;s current nonce.
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 &apos;missing&apos; transactions.
This may delay the relaying of some transactions indefinitely. In order to mitigate that, the sender includes a `max_nonce` parameter with it&apos;s signing request.
It is suggested to be higher by 2-3 from current nonce, to allow the relay process several transactions.

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.

##### 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.
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&apos;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&apos;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.

Relays may also look at recipients&apos; 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&apos;t cause further damage.

This attack doesn&apos;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.

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&apos;t scale regardless.

##### Attack: User attempts to rob dapps by registering its own relay and sending expensive transactions to dapps.
If a malicious sender repeatedly abuses a recipient by sending meaningless/reverted transactions and causing the recipient to pay a relay for nothing, 
it is the recipient&apos;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.

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&apos;s balance, whenever a transaction is relayed for the user. 
With this method, the attacker can only burn its own resources, not the dapp&apos;s.

A variation of this method, for free dapps (that don&apos;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/Facebook account, which limits the rate of the attack to the attacker&apos;s ability to open many Google/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.

##### Attack: Attacker attempts to reduce network availability by registering many unreliable relays.
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.

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.

##### Attack: Attacker attempts to replay a relayed transaction.
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.

##### Attack: User does not execute the raw transaction received from the Relayer, therefore blocking the execution of all further transactions signed by this relayer
The user doesn&apos;t really have to execute the raw transaction. It&apos;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&apos;t need to wait for actual mining to know that the transaction has been executed.

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&apos;t have to) also execute the transaction. To understand why the attack isn&apos;t viable, consider the four possible scenarios after the signed transaction was returned to the sender:

1. Relay executes the transaction, and the user doesn&apos;t. In this scenario the transaction is executed, so no problem. This is the case described in this attack.
2. Relay doesn&apos;t execute the transaction, but the user does. Similarly to 1, the transaction is executed, so no problem.
3. Both of them execute the transaction. The transactions are identical in the pending transactions pool, so the transaction gets executed once. No problem.
4. None of them execute the transaction. In this case the transaction doesn&apos;t get executed, but the relay is stuck. It can&apos;t serve the next transaction with the next nonce, because its nonce hasn&apos;t been advanced on-chain. It also can&apos;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&apos;s nonce. So the relay is stuck unless it executes the transaction.

As this matrix shows, the relay is __always__ 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&apos;s just a way to commit the relay to do its work, without requiring the user to wait for on-chain confirmation.

## Backwards Compatibility

The gas stations network is implemented as smart contracts and external entities, and does not require any network changes.

Dapps adding gas station network support remain backwards compatible with their existing apps/users. The added methods apply on top of the existing ones, so no changes are required for existing apps.

## Implementation

A working implementation of the [**gas stations network**](https://github.com/tabookey-dev/tabookey-gasless) is being developed by **TabooKey**. It consists of `RelayHub`, `RelayRecipient`, `web3 hooks`, an implementation of a gas station inside `geth`, and sample dapps using the gas stations network.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 18 Nov 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1613</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1613</guid>
      </item>
    
      <item>
        <title>Attribute Registry Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1616</comments>
        
        <description>## Simple Summary
EIP-1616 provides a basic interface for querying a registry for attribute metadata assigned to Ethereum accounts.

## Abstract
This EIP contains the following core ideas:
1. 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;**Attribute Registry**&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.
2. 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 `uint256 -&gt; uint256` key-value pair on each account, with the important property that **each attribute type has one canonical value per address**. This property allows for composability of attribute registries and advanced attribute formation.
3. 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.

Potential advanced uses of attribute registries include:
* Encoding complex boolean expressions which combine multiple attributes into a single uint256 key, which is then parsed and evaluated by the registry logic.
* Using values associated with an attribute to query additional on-chain or off-chain metadata.
* Resolving attribute values by calling into separate attribute registries or other contracts, delegating authority without changing the interface of the registry.

## Motivation
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 **without concerning themselves with the particular details of how the information was obtained**, and to do so in as simple a manner as possible. It is also motivated by the desire to promote broad **cross-compatibility and composability** 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.

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.

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.

## Specification
The Attribute Registry interface contains four functions, outlined as follows:
```solidity
/**
 * @title EIP-1616 Attribute Registry Standard interface. EIP-165 ID: 0x5f46473f
 */
interface AttributeRegistryInterface {
  function hasAttribute(address account, uint256 attributeTypeID) external view returns (bool);
  function getAttributeValue(address account, uint256 attributeTypeID) external view returns (uint256);
  function countAttributeTypes() external view returns (uint256);
  function getAttributeTypeID(uint256 index) external view returns (uint256);
}
```

Contracts that comply with the Attribute Registry EIP MUST implement the above interface.

As an additional requirement, the ERC-165 interface MUST be included:
```solidity
/**
 * @title EIP-165 interface. EIP-165 ID: 0x01ffc9a7
 */
interface EIP-165 {
  /**
   * @notice EIP-165 support. Attribute Registry interface ID is 0x5f46473f.
   * @param _interfaceID The interface identifier, as specified in EIP-165
   * @return True for 0x01ffc9a7 &amp; 0x5f46473f, false for unsupported interfaces.
   */
  function supportsInterface(bytes4 _interfaceID) external view returns (bool);
}
```

The implementation MUST follow the specifications described below.

### View Functions
The view functions detailed below MUST be implemented.

#### `hasAttribute` function
```solidity
function hasAttribute(address account, uint256 attributeTypeID) external view returns (bool)
```

Check if an attribute has been assigned to a given account on the registry and is currently valid.

_**NOTE**_: 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 `revert` and instead return `false`.

_**NOTE**_: This function MUST return two equal values when performing two directly consecutive function calls with identical `account` and `attributeTypeID` parameters, regardless of differences in the caller&apos;s address, the transaction origin, or other out-of-band information.



#### `getAttributeValue` function
```solidity
function getAttributeValue(address account, uint256 attributeTypeID) external view returns (uint256)
```

Retrieve the `uint256` value of an attribute on a given account on the registry, assuming the attribute is currently valid.

_**NOTE**_: This function MUST revert if a directly preceding or subsequent function call to `hasAttribute` with identical `account` and `attributeTypeID` parameters would return false.

_**NOTE**_: This function MUST return two equal values when performing two directly consecutive function calls with identical `account` and `attributeTypeID` parameters, regardless of differences in the caller&apos;s address, the transaction origin, or other out-of-band information.

#### `countAttributeTypes` function
```solidity
function countAttributeTypes() external view returns (uint256)
```

Retrieve the total number of valid attribute types defined on the registry. Used alongside `getAttributeTypeID` to determine all of the attribute types that are available on the registry.

_**NOTE**_: This function MUST return a positive integer value  - i.e. calling this function MUST NOT cause the caller to revert.

_**NOTE**_: This function MUST return a value that encompasses all indexes of attribute type IDs whereby a call to `hasAttribute` on some address with an attribute type ID at the given index would return `true`.

#### `getAttributeTypeID` function
```solidity
function getAttributeTypeID(uint256 index) external view returns (uint256)
```

Retrieve an ID of an attribute type defined on the registry by index. Used alongside `countAttributeTypes` to determine all of the attribute types that are available on the registry.

_**NOTE**_: This function MUST revert if the provided `index` value falls outside of the range of the value returned from a directly preceding or subsequent function call to `countAttributeTypes`. It MUST NOT revert if the provided `index` value falls inside said range.

_**NOTE**_: This function MUST return an `attributeTypeID` value on *some* index if the same `attributeTypeID` value would cause a given call to `hasAttribute` to return `true` when passed as a parameter.

## Rationale
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 *per issuer*.

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.

## Backwards Compatibility
There are no backwards compatibility concerns.

## Test Cases
Targeted test cases with 100% code coverage can be found at [this repository](https://github.com/0age/AttributeRegistry). See [here](https://github.com/TPL-protocol/tpl-contracts) for tests on a more complex contract that implements the application registry interface.

## Implementation
The basic implementation that follows can be found at [this repository](https://github.com/0age/AttributeRegistry) (see [here](https://github.com/TPL-protocol/tpl-contracts/blob/master/contracts/BasicJurisdiction.sol#L399) for an example of a more complex implementing contract):

```solidity
pragma solidity ^0.4.25;

/**
 * @title Attribute Registry interface. EIP-165 ID: 0x5f46473f
 */
interface AttributeRegistryInterface {
  /**
   * @notice Check if an attribute of the type with ID `attributeTypeID` has
   * been assigned to the account at `account` and is currently valid.
   * @param account address The account to check for a valid attribute.
   * @param attributeTypeID uint256 The ID of the attribute type to check for.
   * @return True if the attribute is assigned and valid, false otherwise.
   * @dev This function MUST return either true or false - i.e. calling this
   * function MUST NOT cause the caller to revert.
   */
  function hasAttribute(
    address account,
    uint256 attributeTypeID
  ) external view returns (bool);

  /**
   * @notice Retrieve the value of the attribute of the type with ID
   * `attributeTypeID` on the account at `account`, assuming it is valid.
   * @param account address The account to check for the given attribute value.
   * @param attributeTypeID uint256 The ID of the attribute type to check for.
   * @return The attribute value if the attribute is valid, reverts otherwise.
   * @dev This function MUST revert if a directly preceding or subsequent
   * function call to `hasAttribute` with identical `account` and
   * `attributeTypeID` parameters would return false.
   */
  function getAttributeValue(
    address account,
    uint256 attributeTypeID
  ) external view returns (uint256);

  /**
   * @notice Count the number of attribute types defined by the registry.
   * @return The number of available attribute types.
   * @dev This function MUST return a positive integer value  - i.e. calling
   * this function MUST NOT cause the caller to revert.
   */
  function countAttributeTypes() external view returns (uint256);

  /**
   * @notice Get the ID of the attribute type at index `index`.
   * @param index uint256 The index of the attribute type in question.
   * @return The ID of the attribute type.
   * @dev This function MUST revert if the provided `index` value falls outside
   * of the range of the value returned from a directly preceding or subsequent
   * function call to `countAttributeTypes`. It MUST NOT revert if the provided
   * `index` value falls inside said range.
   */
  function getAttributeTypeID(uint256 index) external view returns (uint256);
}


/**
 * @title A simple example of an Attribute Registry implementation.
 */
contract AttributeRegistry is AttributeRegistryInterface {
  // This particular implementation just defines two attribute types.
  enum Affiliation { Whitehat, Blackhat }

  // Top-level information about attribute types held in a static array.
  uint256[2] private _attributeTypeIDs;

  // The number of attributes currently issued tracked in a static array.
  uint256[2] private _issuedAttributeCounters;

  // Issued attributes held in a nested mapping by account &amp; attribute type.
  mapping(address =&gt; mapping(uint256 =&gt; bool)) private _issuedAttributes;

  // Issued attribute values held in a nested mapping by account &amp; type.
  mapping(address =&gt; mapping(uint256 =&gt; uint256)) private _issuedAttributeValues;

  /**
  * @notice The constructor function, defines the two attribute types available
  * on this particular registry.
  */
  constructor() public {
    // Set the attribute type IDs for whitehats (8008) and blackhats (1337).
    _attributeTypeIDs = [8008, 1337];
  }

  /**
   * @notice Assign a &quot;whitehat&quot; attribute type to `msg.sender`.
   * @dev The function may not be called by accounts with a &quot;blackhat&quot; attribute
   * type already assigned. This function is arbitrary and not part of the
   * Attribute Registry specification.
   */
  function joinWhitehats() external {
    // Get the index of the blackhat attribute type on the attribute registry.
    uint256 blackhatIndex = uint256(Affiliation.Blackhat);

    // Get the attribute type ID of the blackhat attribute type.
    uint256 blackhatAttributeTypeID = _attributeTypeIDs[blackhatIndex];

    // Do not allow the whitehat attribute to be set if blackhat is already set.
    require(
      !_issuedAttributes[msg.sender][blackhatAttributeTypeID],
      &quot;no blackhats allowed!&quot;
    );

    // Get the index of the whitehat attribute type on the attribute registry.
    uint256 whitehatIndex = uint256(Affiliation.Whitehat);

    // Get the attribute type ID of the whitehat attribute type.
    uint256 whitehatAttributeTypeID = _attributeTypeIDs[whitehatIndex];

    // Mark the attribute as issued on the given address.
    _issuedAttributes[msg.sender][whitehatAttributeTypeID] = true;

    // Calculate the new number of total whitehat attributes.
    uint256 incrementCounter = _issuedAttributeCounters[whitehatIndex] + 1;

    // Set the attribute value to the new total assigned whitehat attributes.
    _issuedAttributeValues[msg.sender][whitehatAttributeTypeID] = incrementCounter;

    // Update the value of the counter for total whitehat attributes.
    _issuedAttributeCounters[whitehatIndex] = incrementCounter;
  }

  /**
   * @notice Assign a &quot;blackhat&quot; attribute type to `msg.sender`.
   * @dev The function may be called by any account, but assigned &quot;whitehat&quot;
   * attributes will be removed. This function is arbitrary and not part of the
   * Attribute Registry specification.
   */
  function joinBlackhats() external {
    // Get the index of the blackhat attribute type on the attribute registry.
    uint256 blackhatIndex = uint256(Affiliation.Blackhat);

    // Get the attribute type ID of the blackhat attribute type.
    uint256 blackhatAttributeTypeID = _attributeTypeIDs[blackhatIndex];

    // Mark the attribute as issued on the given address.    
    _issuedAttributes[msg.sender][blackhatAttributeTypeID] = true;

    // Calculate the new number of total blackhat attributes.    
    uint256 incrementCounter = _issuedAttributeCounters[blackhatIndex] + 1;

    // Set the attribute value to the new total assigned blackhat attributes.    
    _issuedAttributeValues[msg.sender][blackhatAttributeTypeID] = incrementCounter;

    // Update the value of the counter for total blackhat attributes.    
    _issuedAttributeCounters[blackhatIndex] = incrementCounter;

    // Get the index of the whitehat attribute type on the attribute registry.
    uint256 whitehatIndex = uint256(Affiliation.Whitehat);

    // Get the attribute type ID of the whitehat attribute type.
    uint256 whitehatAttributeTypeID = _attributeTypeIDs[whitehatIndex];

    // Determine if a whitehat attribute type has been assigned.
    if (_issuedAttributes[msg.sender][whitehatAttributeTypeID]) {
      // If so, delete the attribute.
      delete _issuedAttributes[msg.sender][whitehatAttributeTypeID];

      // Delete the attribute value as well.
      delete _issuedAttributeValues[msg.sender][whitehatAttributeTypeID];

      // Set the attribute value to the new total assigned whitehat attributes.      
      uint256 decrementCounter = _issuedAttributeCounters[whitehatIndex] - 1;

      // Update the value of the counter for total whitehat attributes.
      _issuedAttributeCounters[whitehatIndex] = decrementCounter;
    }
  }

  /**
   * @notice Get the total number of assigned whitehat and blackhat attributes.
   * @return Array with counts of assigned whitehat and blackhat attributes.
   * @dev This function is arbitrary and not part of the Attribute Registry
   * specification.
   */
  function totalHats() external view returns (uint256[2]) {
    // Return the array containing counter values.
    return _issuedAttributeCounters;
  }

  /**
   * @notice Check if an attribute of the type with ID `attributeTypeID` has
   * been assigned to the account at `account` and is currently valid.
   * @param account address The account to check for a valid attribute.
   * @param attributeTypeID uint256 The ID of the attribute type to check for.
   * @return True if the attribute is assigned and valid, false otherwise.
   * @dev This function MUST return either true or false - i.e. calling this
   * function MUST NOT cause the caller to revert.
   */
  function hasAttribute(
    address account,
    uint256 attributeTypeID
  ) external view returns (bool) {
    // Return assignment status of attribute by account and attribute type ID
    return _issuedAttributes[account][attributeTypeID];
  }

  /**
   * @notice Retrieve the value of the attribute of the type with ID
   * `attributeTypeID` on the account at `account`, assuming it is valid.
   * @param account address The account to check for the given attribute value.
   * @param attributeTypeID uint256 The ID of the attribute type to check for.
   * @return The attribute value if the attribute is valid, reverts otherwise.
   * @dev This function MUST revert if a directly preceding or subsequent
   * function call to `hasAttribute` with identical `account` and
   * `attributeTypeID` parameters would return false.
   */
  function getAttributeValue(
    address account,
    uint256 attributeTypeID
  ) external view returns (uint256 value) {
    // Revert if attribute with given account &amp; attribute type ID is unassigned
    require(
      _issuedAttributes[account][attributeTypeID],
      &quot;could not find a value with the provided account and attribute type ID&quot;
    );

    // Return the attribute value.
    return _issuedAttributeValues[account][attributeTypeID];
  }

  /**
   * @notice Count the number of attribute types defined by the registry.
   * @return The number of available attribute types.
   * @dev This function MUST return a positive integer value  - i.e. calling
   * this function MUST NOT cause the caller to revert.
   */
  function countAttributeTypes() external view returns (uint256) {
    // Return the length of the attribute type IDs array.
    return _attributeTypeIDs.length;
  }

  /**
   * @notice Get the ID of the attribute type at index `index`.
   * @param index uint256 The index of the attribute type in question.
   * @return The ID of the attribute type.
   * @dev This function MUST revert if the provided `index` value falls outside
   * of the range of the value returned from a directly preceding or subsequent
   * function call to `countAttributeTypes`. It MUST NOT revert if the provided
   * `index` value falls inside said range.
   */
  function getAttributeTypeID(uint256 index) external view returns (uint256) {
    // Revert if the provided index is out of range.
    require(
      index &lt; _attributeTypeIDs.length,
      &quot;provided index is outside of the range of defined attribute type IDs&quot;
    );

    // Return the attribute type ID at the given index in the array.
    return _attributeTypeIDs[index];
  }
}
```

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 23 Nov 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1616</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1616</guid>
      </item>
    
      <item>
        <title>Money Streaming</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1620</comments>
        
        <description>## Simple Summary
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.

## Abstract
The following describes a standard whereby time is measured using block numbers and streams are mappings in a master contract.

1. A provider sets up a money streaming contract.
2. A prospective payer can interact with the contract and start the stream right away by depositing the funds required for the chosen period.
3. The payee is able to withdraw money from the contract based on its ongoing solvency. That is: `payment rate * (current block height - starting block height)`
4. The stream terms (payment rate, length, metadata) can be updated at any time if both parties pledge their signatures.
5. The stream can be stopped at any point in time by any party without on-chain consensus.
6. If the stream period ended and it was not previously stopped by any party, the payee is entitled to withdraw all the deposited funds.

## Motivation
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.

### Use Cases

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.

- Salaries
- Subscriptions
- Consultancies
- CDPs
- Rent
- Parking

### Crowdsales
[RICOs](https://github.com/lukso-network/rico), 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 [thread](https://ethresear.ch/t/chronos-a-quirky-application-proposal-for-plasma/2928/14?u=paulrberg).

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.

## Specification

### Structs

The structure of a `stream` should be as follows:

- `stream`
    - `sender`: the `address` of the entity funding the stream
    - `recipient`: the `address` where the money is being delivered to
    - `tokenAddress`: the `address` of the ERC20 token used as payment asset
    - `balance`: the total funds left in the stream
    - `timeframe`: as defined below
    - `rate`: as defined below

```solidity
  struct Stream {
    address sender;
    address recipient;
    address tokenAddress;
    uint256 balance;
    Timeframe timeframe;
    Rate rate;
  }
```

- `timeframe`
    - `start`: the starting block number of the stream
    - `stop`: the stopping block number of the stream

```solidity
struct Timeframe {
    uint256 start;
    uint256 stop;
}
```

- `rate`
    - `payment`: how much money moves from `sender` to `recipient`
    - `interval`: how often `payment` moves from `sender` to `recipient`

```solidity
struct Rate {
  uint256 payment;
  uint256 interval;
}
```

---

### Methods

#### balanceOf

Returns available funds for the given stream id and address.

```solidity
function balanceOf(uint256 _streamId, address _addr)
```

#### getStream

Returns the full stream data, if the id points to a valid stream.

```solidity
function getStream(uint256 _streamId) returns (address sender, address recipient, address tokenAddress, uint256 balance, uint256 startBlock, uint256 stopBlock, uint256 payment, uint256 interval)
```

#### create

Creates a new stream between `msg.sender` and `_recipient`.

MUST allow senders to create multiple streams in parallel. SHOULD not accept Ether and only use ERC20-compatible tokens.

**Triggers Event**: [LogCreate](#logcreate)

```solidity
function create(address _recipient, address _tokenAddress, uint256 _startBlock, uint256 _stopBlock, uint256 _payment, uint256 _interval)
```

#### withdraw

Withdraws all or a fraction of the available funds.

MUST allow only the recipient to perform this action.

**Triggers Event**: [LogWithdraw](#logwithdraw)

```solidity
function withdraw(uint256 _streamId, uint256 _funds)
```

#### redeem

Redeems the stream by distributing the funds to the sender and the recipient.

SHOULD allow any party to redeem the stream.

**Triggers Event**: [LogRedeem](#logredeem)

```solidity
function redeem(uint256 _streamId)
```

#### confirmUpdate

Signals one party&apos;s willingness to update the stream

SHOULD allow any party to do this but MUST NOT be executed without consent from all involved parties.

**Triggers Event**: [LogConfirmUpdate](#logconfirmupdate)

**Triggers Event**: [LogExecuteUpdate](#logexecuteupdate) when the last involved party calls this function

```solidity
function update(uint256 _streamId, address _tokenAddress, uint256 _stopBlock, uint256 _payment, uint256 _interval)
```

#### revokeUpdate

Revokes an update proposed by one of the involved parties. 

MUST allow any party to do this.

**Triggers Event**: [LogRevokeUpdate](#logrevokeupdate)

```solidity
function confirmUpdate(uint256 _streamId, address _tokenAddress, uint256 _stopBlock, uint256 _payment, uint256 _interval)
```

---

### Events

#### LogCreate

MUST be triggered when `create` is successfully called.

```solidity
event LogCreate(uint256 indexed _streamId, address indexed _sender, address indexed _recipient, address _tokenAddress, uint256 _startBlock, uint256 _stopBlock, uint256 _payment, uint256 _interval)
```

#### LogWithdraw

MUST be triggered when `withdraw` is successfully called.

```solidity
event LogWithdraw(uint256 indexed _streamId, address indexed _recipient, uint256 _funds)
```

#### LogRedeem

MUST be triggered when `redeem` is successfully called.

```solidity
event LogRedeem(uint256 indexed _streamId, address indexed _sender, address indexed _recipient, uint256 _senderBalance, uint256 _recipientBalance)
```

#### LogConfirmUpdate

MUST be triggered when `confirmUpdate` is successfully called.

```solidity
event LogConfirmUpdate(uint256 indexed _streamId, address indexed _confirmer, address _newTokenAddress, uint256 _newStopBlock, uint256 _newPayment, uint256 _newInterval);
```

#### LogRevokeUpdate

MUST be triggered when `revokeUpdate` is successfully called.

```solidity
event LogRevokeUpdate(uint256 indexed _streamId, address indexed revoker, address _newTokenAddress, uint256 _newStopBlock, uint256 _newPayment, uint256 _newInterval)
```

#### LogExecuteUpdate

MUST be triggered when an update is approved by all involved parties.

```solidity
event LogExecuteUpdate(uint256 indexed _newStreamId, address indexed _sender, address indexed _recipient, address _newTokenAddress, uint256 _newStopBlock, uint256 _newPayment, uint256 _newInterval)
```

## Rationale

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;!--
- Block times and oracles for time calculation
    - GCD
    - Miners
- Sidechain-compatible (and preferable)
- The `update` function
- Multi-hop streams
--&gt;

Block times are a reasonable, trustless proxy for time on the blockchain. Between 2016 and 2018, the Ethereum block time average value [hovered](https://etherscan.io/chart/blocktime) 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.

### GCD
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.

### Block Times
Because there is uncertainty regarding block times, streams may not be settled on the blockchain as initially planned. Let `$d` be the total streaming duration measured in seconds, `$t` the average block time before the stream started and `$t&apos;` the actual average block time over `$d` after the stream started. We distinguish two undesirable scenarios:

1. `$t` &lt; `$t&apos;`: the payee will get their funds *later* than expected

2. `$t` &gt; `$t&apos;`: the payee will get their funds *sooner* than expected

If the combined error delta is smaller than the payment rate (fifth parameter of the `create` 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.

Limiting the problem scope only to Ethereum, we propose two remedies:

1. Consensus on calling the `update` 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.

2. Autonomously fix significant error deltas. In theory, we could achieve this using previous blocks&apos; 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.

Nonetheless, it is important to note that this is still a major improvement on the traditional model where absolute trust is required.

### Sidechains

It could be more efficient to implement this standard on independent sidechains like [POA Network](https://poa.network) or [xDai](https://medium.com/poa-network/poa-network-partners-with-makerdao-on-xdai-chain-the-first-ever-usd-stable-blockchain-65a078c41e6a) - thanks to their rather predictable nature. Admittedly, security is traded for scalability, but proper cryptoeconomic stakes could alleviate potential problems.

Furthermore, it is intriguing to explore the prospect of stream-specific sidechains.

### Oracles

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 [Block Times](#block-times).

### Multi-Hop Streams

Future or upgraded versions of this standard may describe &quot;multi-hop&quot; streams. If:

1. There is a stream between A and B
2. There is another stream between B and C

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.

## Implementation

- [ChronosProtocol WIP implementation](https://github.com/ChronosProtocol/monorepo)

## Additional References
- [Chronos Protocol Ethresear.ch Plasma Proposal](https://ethresear.ch/t/chronos-a-quirky-application-proposal-for-plasma/2928?u=paulrberg)
- [Chronos Protocol White Paper](http://chronosprotocol.org/chronos-white-paper.pdf)
- [Flipper: Streaming Salaries @ CryptoLife Hackathon](https://devpost.com/software/flipper-3gvl4b)
- [SICOs or Streamed ICOs](https://ethresear.ch/t/chronos-a-quirky-application-proposal-for-plasma/2928/14?u=paulrberg)
- [RICOs or Reversible ICOs](https://twitter.com/feindura/status/1058057076306518017)
- [Andreas Antonopoulos&apos; Keynote on Bitcoin, Lightning and Money Streaming](https://www.youtube.com/watch?v=gF_ZQ_eijPs)

## Final Notes

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 [fun](https://twitter.com/PaulRBerg/status/1056595919116910592) and easier to start small on Ethereum itself and sidechains like [xDai](https://blockscout.com/poa/dai).

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 24 Nov 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1620</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1620</guid>
      </item>
    
      <item>
        <title>Re-Fungible Token Standard (RFT)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1634</comments>
        
        <description>## Simple Summary
[ERC-20](./eip-20.md) extension for proportional ownership of an [ERC-721](./eip-721.md) token.

## Abstract
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.

## Motivation
Shared ownership occurs across many industries and for many reasons. As more assets are registered, regulated and/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.

## Specification
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.

#### Initial Contact with the Re-Fungible Token

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 `parentToken()` and `parentTokenId()`. The first getter returns a variable of type `address` and designates the contract address of the Non-Fungible Token contract. The second getter returns a variable of type `uint256` 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:

```solidity
pragma solidity ^0.4.20;

/// @dev Note: the ERC-165 identifier for this interface is 0x5755c3f2.
interface RFT /* is ERC20, ERC165 */ {

  function parentToken() external view returns(address _parentToken);
  function parentTokenId() external view returns(uint256 _parentTokenId);

}
```

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:

```solidity
pragma solidity ^0.4.20;

import &apos;./RFT.sol&apos;;
import &apos;./ERC721.sol&apos;;

contract ConfirmRFT {

  function confirmRFT(address _RFT) external view returns(bool) {
    address _NFT = RFT(_RFT).parentToken(); // returns address of NFT contract
    uint256 _tokenId = RFT(_RFT).parentTokenId(); // returns id of ID of NFT

    return
      NFT(_NFT).supportsInterface(0x80ac58cd) &amp;&amp; // confirm it is ERC-721
      NFT(_NFT).ownerOf(_tokenId) == _RFT; // confirm the owner of the NFT is the RFT contract address
  }

}
```

Below is an off-chain example using an instance of web3.js in javascript:
```javascript
async function confirmRFT(web3) {

  const ERC721ABI = [...] // abi for ERC721
  const RFTABI = [...] // abi for RFT
  const RFTAddress = &apos;0x0123456789abcdef0123456789abcdef&apos; // address for the deployed RFT

  const RFTContract = new web3.eth.Contract(RFTABI, RFTAddress) // deployed RFT contract instance
  const ERC721Address = await RFTcontract.methods.parentToken().call() // returns address of NFT contract
  const ERC721TokenId = await RFTcontract.methods.parentTokenId().call() // returns id of ID of NFT

  const ERC721Contract = new web3.eth.Contract(ERC721ABI, ERC721Address) // deployed ERC721 (as reported by RFT)
  const isERC721 = await ERC721Contract.methods.supportsInterface(&apos;0x80ac58cd&apos;).call() // confirm it is ERC-721
  const ownerOfAddress = await ERC721Contract.methods.ownerOf(ERC721TokenId).call() // get the owner of the NFT

  return ERC721Response.toLowerCase() === RFTAddress.toLowerCase() // confirm the owner of the NFT is the RFT contract
}
```

#### Initial Contact with the Non-Fungible Token

When checking the owner of a specific non-fungible token it&apos;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 `true` when passed the `bytes4` parameter `0x01ffc9a7`:
```
function supportsInterface(bytes4 interfaceID) external view returns (bool);
```
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 `supportsInterface(bytes4 interfaceID)` getter function must return `true` when passed the `bytes4` parameter `0x5755c3f2` which is the result of `bytes4(keccak256(&apos;parentToken()&apos;)) ^ bytes4(keccak256(&apos;parentTokenId()&apos;))` or `parentToken.selector ^ parentTokenId.selector`. This could be achieved with the following code:
```solidity
pragma solidity ^0.4.20;

import &quot;./ERC20.sol&quot;;

/// @dev Note: the ERC-165 identifier for this interface is 0x5755c3f2.
interface RFT is ERC20 /*, ERC165 */ {

  function supportsInterface(bytes4 interfaceID) external view returns(bool) {
    return
      interfaceID == this.supportsInterface.selector || // ERC165
      interfaceID == this.parentToken.selector || // parentToken()
      interfaceID == this.parentTokenId.selector || // parentTokenId()
      interfaceID == this.parentToken.selector ^ this.parentTokenId.selector; // RFT
  }

  function parentToken() external view returns(address _parentToken);
  function parentTokenId() external view returns(uint256 _parentTokenId);

}
```
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:
```solidity
pragma solidity ^0.4.20;

import &apos;./RFT.sol&apos;;
import &apos;./ERC721.sol&apos;;

contract ConfirmRFT {

  function confirmRFT(address _NFT, uint256 _tokenId) external view returns(bool) {
    address _RFT = ERC721(_NFT).ownerOf(_tokenId); // get the owner of the NFT

    return
      RFT(_RFT).supportsInterface(0x01ffc9a7) &amp;&amp; // confirm it supports ERC-165
      RFT(_RFT).supportsInterface(0x5755c3f2) // confirm it is RFT
  }

}
```
Below is an off-chain example using web3.js in javascript:
```javascript
async function confirmRFT(web3) {

  const ERC721ABI = [...] // abi for ERC721
  const RFTABI = [...] // abi for RFT
  const ERC721Address = &apos;0x0123456789abcdef0123456789abcdef&apos; // address for the deployed NFT
  const ERC721TokenId = &apos;7&apos; // token Id of the NFT

  const ERC721Contract = new web3.eth.Contract(ERC721ABI, ERC721Address) // deployed ERC721
  const RFTAddress = await ERC721Contract.methods.ownerOf(ERC721TokenId).call() // owner address of the NFT


  const RFTContract = new web3.eth.Contract(RFTABI, RFTAddress) // deployed RFT contract instance
  const isERC165 = await RFTContract.methods.supportsInterface(&apos;0x01ffc9a7&apos;).call() // confirm it is ERC-165
  return isERC165 &amp;&amp; await RFTContract.methods.supportsInterface(&apos;0x5755c3f2&apos;).call() // confirm it is RFT

}
```
## Rationale
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.

## Backwards Compatibility
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.

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.

## Implementation
```solidity
pragma solidity ^0.4.20;

/// @dev Note: the ERC-165 identifier for this interface is 0x5755c3f2.
interface RFT /* is ERC20, ERC165 */ {

  function parentToken() external view returns(address _parentToken);
  function parentTokenId() external view returns(uint256 _parentTokenId);

}
```

## Security Considerations
TBD

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 18 Nov 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1633</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1633</guid>
      </item>
    
      <item>
        <title>URL Format for Web3 Browsers</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/standarize-url-format-for-web3-browsers/2422</comments>
        
        <description>## Simple Summary

A standard way of representing web3 browser URLs for decentralized applications.

## Abstract

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.

## Motivation

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.

In order to make the experience more seamless, dApps should still be able to recommend a specific mobile web3 browser via [deferred deeplinking](https://en.wikipedia.org/wiki/Deferred_deep_linking) 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.

There is also a compatibility problem with the current `ethereum:` url scheme described in [EIP-831](./eip-831.md) 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 `ethereum:` link in an app that doesn not include a web3 browser and will not be able to handle the deeplink correctly.

## Specification

### Syntax

Web3 browser URLs contain &quot;dapp&quot; in their schema (protocol) part and are constructed as follows:

    request                 = &quot;dapp&quot; &quot;:&quot; [chain_id &quot;@&quot;] dapp_url
    chain_id                = 1*DIGIT
    dapp_url                = URI

### Semantics

`chain_id` is optional and it is a parameter for the browser to automatically select the corresponding chain ID as specified in [EIP-155](./eip-155.md) before opening the dApp.

`dapp_url` is a valid [RFC3986](https://www.ietf.org/rfc/rfc3986.txt) URI

This a complete example url:

`dapp:1@peepeth.com/brunobar79?utm_source=github`

which will open the web3 browser, select `mainnet` (chain_id = 1) and then navigate to:

`https://peepeth.com/brunobar79?utm_source=github`

## Rationale

The proposed format attempts to solve the problem of vendor specific protocols for web3 browsers, avoiding conflicts with the existing &apos;ethereum:&apos; URL scheme while also adding an extra feature: `chain_id` which will help dApps to be accessed with the right network preselected, optionally extracting away that complexity from end users.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 13 Jan 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1710</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1710</guid>
      </item>
    
      <item>
        <title>Smart Contract Interface for Licences</title>
        <category>Standards Track/ERC</category>
        
        <description>## Abstract

This Ethereum Improvement Proposal (EIP) proposes an Ethereum standard for the issuance of licences, permits and grants (Licences). 

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.

A Licence has the following properties:

* granted personally to the licencee (Licencee), though it may be transferrable to another person or company;
* 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;
* 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
* usually issued only after the payment of a fee or the meeting of some criteria.

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.

## Motivation

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).

This EIP seeks to define a standard that will allow for the granting and/or management of Licences via Ethereum smart contracts. The motivation is, in essence, to address the inefficiencies inherent in current licencing systems.

## Specification

### Methods

**NOTES**:
 - The following specifications use syntax from Solidity `0.4.17` (or above)
 - Callers MUST handle `false` from `returns (bool success)`.  Callers MUST NOT assume that `false` is never returned!


#### name

Returns the name of the permit - e.g. `&quot;MyPermit&quot;`.

``` js
function name() public view returns (string);
```

#### totalSupply

Returns the total permit supply.

``` js
function totalSupply() public view returns (uint256);
```

#### grantAuthority

Adds an ethereum address to a white list of addresses that have authority to modify a permit.

``` js
function grantAuthority(address who) public;
```

#### revokeAuthority

Removes an ethereum address from a white list of addresses that have authority to modify a permit.

``` js
function revokeAuthority(address who) public;
```

#### hasAuthority

Checks to see if the address has authority to grant or revoke permits.

``` js
function hasAuthority(address who) public view;
```

#### issue

Issues an ethereum address a permit between the specified date range.

``` js
function issue(address who, uint256 validFrom, uint256 validTo) public;
```

#### revoke

Revokes a permit from an ethereum address.
	
``` js
function revoke(address who) public;
```

#### hasValid

Checks to see if an ethereum address has a valid permit.
	
``` js
function hasValid(address who) external view returns (bool);
```

#### purchase

Allows a user to self procure a licence.
	
``` js
function purchase(uint256 validFrom, uint256 validTo) external payable;
```

## Rationale

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.

By creating an EIP, we hope to increase the use of Ethereum based and issued Licences, which will address these issues.

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.

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.

## Test Cases

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.

The current digital portal and application form to camp at Kakadu National Park (the Application) can be accessed at: https://www.environment.gov.au/system/files/resources/b3481ed3-164b-4e72-a9f8-91fc987d90e7/files/kakadu-camping-permit-form-19jan2015-pdf.pdf

The user must provide the following details when making an Application:

* The full name and contact details of each person to whom the permit is to be issued;

* If the applicant is a company or other incorporated body:

o the name, business address and postal address of the company or incorporated body;

o if the applicant is a company—

* the full name of each of the directors of the company;

* the full name and contact details of the person completing the application form;

* the ACN or ABN of the company or other incorporated body (if applicable);

* Details of the proposed camping purpose (e.g. private camping, school group, etc.);

* A start date and duration for the camping (up to the maximum duration allowed by law);

* Number of campers (up to the maximum allowed by law);

* All other required information not essential to the issuance of the Licence (e.g. any particular medical needs of the campers); and

* Fees payable depending on the site, duration and number of campers.

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.

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).

## Implementation

The issuance and ownership of a Licence can be digitally represented on the Ethereum blockchain.

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.

## Interface 

### Solidity Example
```solidity
interface EIP1753 {
	
	function grantAuthority(address who) external;
	function revokeAuthority(address who) external;
	function hasAuthority(address who) external view returns (bool);
	
	function issue(address who, uint256 from, uint256 to) external;
	function revoke(address who) external;
	
	function hasValid(address who) external view returns (bool);
	function purchase(uint256 validFrom, uint256 validTo) external payable;
}

pragma solidity ^0.5.3;

contract EIP is EIP1753 {

	string public name = &quot;Kakadu National Park Camping Permit&quot;;
	uint256 public totalSupply;

	address private _owner;
	mapping(address =&gt; bool) private _authorities;
	mapping(address =&gt; Permit) private _holders;
	
	struct Permit {
		address issuer;
		uint256 validFrom;
		uint256 validTo;
	}
	
	constructor() public {
		_owner = msg.sender;
	}
	
	function grantAuthority(address who) public onlyOwner() {
		_authorities[who] = true;
	}
	
	function revokeAuthority(address who) public onlyOwner() {
		delete _authorities[who];
	}
	
	function hasAuthority(address who) public view returns (bool) {
		return _authorities[who] == true;
	}
	
	function issue(address who, uint256 start, uint256 end) public onlyAuthority() {
		_holders[who] = Permit(_owner, start, end);
		totalSupply += 1;
	}
	
	function revoke(address who) public onlyAuthority() {
		delete _holders[who];
	}
	
	function hasValid(address who) external view returns (bool) {
	    return _holders[who].validFrom &gt; now &amp;&amp; _holders[who].validTo &lt; now;
	}

	function purchase(uint256 validFrom, uint256 validTo) external payable {
	    require(msg.value == 1 ether, &quot;Incorrect fee&quot;);
	    issue(msg.sender, validFrom, validTo);
	}
	
	modifier onlyOwner() {
		require(msg.sender == _owner, &quot;Only owner can perform this function&quot;);
		_;
	}
	
	modifier onlyAuthority() {
		require(hasAuthority(msg.sender), &quot;Only an authority can perform this function&quot;);
        _;
	}
}
```

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 06 Feb 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1753</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1753</guid>
      </item>
    
      <item>
        <title>Scoped Approval Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1761</comments>
        
        <description>## Simple Summary

A standard interface to permit restricted approval in token contracts by defining &quot;scopes&quot; of one or more Token IDs.

## Abstract

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.

Sample use cases for scopes:

* A company may represent its fleet of vehicles on the blockchain and it could create a scope for each regional office.
* Game developers could share an [ERC-1155](./eip-1155.md) contract where each developer manages tokens under a specified scope.
* 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.

## Motivation

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&apos;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.

# Specification

```solidity
pragma solidity ^0.5.2;

/**
    Note: The ERC-165 identifier for this interface is 0x30168307.
*/
interface ScopedApproval {
    /**
        @dev MUST emit when approval changes for scope.
    */
    event ApprovalForScope(address indexed _owner, address indexed _operator, bytes32 indexed _scope, bool _approved);

    /**
        @dev MUST emit when the token IDs are added to the scope.
        By default, IDs are in no scope.
        The range is inclusive: _idStart, _idEnd, and all IDs in between have been added to the scope.
        _idStart must be lower than or equal to _idEnd.
    */
    event IdsAddedToScope(uint256 indexed _idStart, uint256 indexed _idEnd, bytes32 indexed _scope);

    /**
        @dev MUST emit when the token IDs are removed from the scope.
        The range is inclusive: _idStart, _idEnd, and all IDs in between have been removed from the scope.
        _idStart must be lower than or equal to _idEnd.
    */
    event IdsRemovedFromScope(uint256 indexed _idStart, uint256 indexed _idEnd, bytes32 indexed _scope);

    /** @dev MUST emit when a scope URI is set or changes.
        URIs are defined in RFC 3986.
        The URI MUST point a JSON file that conforms to the &quot;Scope Metadata JSON Schema&quot;.
    */
    event ScopeURI(string _value, bytes32 indexed _scope);

    /**
        @notice     Returns the number of scopes that contain _id.
        @param _id  The token ID
        @return     The number of scopes containing the ID
    */
    function scopeCountForId(uint256 _id) public view returns (uint32);

    /**
        @notice             Returns a scope that contains _id.
        @param _id          The token ID
        @param _scopeIndex  The scope index to  query (valid values are 0 to scopeCountForId(_id)-1)
        @return             The Nth scope containing the ID
    */
    function scopeForId(uint256 _id, uint32 _scopeIndex) public view returns (bytes32);

    /**
        @notice 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 &quot;&quot; is accepted for scopes without a URI.
        @param  _scope  The queried scope
        @return         The URI describing this scope.
    */
    function scopeUri(bytes32 _scope) public view returns (string memory);

    /**
        @notice Enable or disable approval for a third party (&quot;operator&quot;) to manage the caller&apos;s tokens in the specified scope.
        @dev MUST emit the ApprovalForScope event on success.
        @param _operator    Address to add to the set of authorized operators
        @param _scope       Approval scope (can be identified by calling scopeForId)
        @param _approved    True if the operator is approved, false to revoke approval
    */
    function setApprovalForScope(address _operator, bytes32 _scope, bool _approved) external;

    /**
        @notice Queries the approval status of an operator for a given owner, within the specified scope.
        @param _owner       The owner of the Tokens
        @param _operator    Address of authorized operator
        @param _scope       Scope to test for approval (can be identified by calling scopeForId)
        @return             True if the operator is approved, false otherwise
    */
    function isApprovedForScope(address _owner, address _operator, bytes32 _scope) public view returns (bool);
}
```

## Scope Metadata JSON Schema

This schema allows for localization. `{id}` and `{locale}` should be replaced with the appropriate values by clients.

```json
{
    &quot;title&quot;: &quot;Scope Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;required&quot;: [&quot;name&quot;],
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the scope in a human-readable way.&quot;,
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the scope to allow users to make informed approval decisions.&quot;,
        },
        &quot;localization&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;required&quot;: [&quot;uri&quot;, &quot;default&quot;, &quot;locales&quot;],
            &quot;properties&quot;: {
                &quot;uri&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;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.&quot;
                },
                &quot;default&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;The locale of the default data within the base JSON&quot;
                },
                &quot;locales&quot;: {
                    &quot;type&quot;: &quot;array&quot;,
                    &quot;description&quot;: &quot;The list of locales for which data is available. These locales should conform to those defined in the Unicode Common Locale Data Repository (http://cldr.unicode.org/).&quot;
                }
            }
        }
    }
}
```

### Localization

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 `localization` attribute, its content may be used to provide localized values for fields that need it. The `localization` attribute should be a sub-object with three attributes: `uri`, `default` and `locales`. If the string `{locale}` exists in any URI, it MUST be replaced with the chosen locale by all client software.

## Rationale

The initial design was proposed as an extension to ERC-1155: [Discussion Thread - Comment 1](https://github.com/ethereum/EIPs/issues/1155#issuecomment-459505728). After some discussion: [Comment 2](https://github.com/ethereum/EIPs/issues/1155#issuecomment-460603439) and suggestions by the community to implement this approval mechanism in an external contract [Comment 3](https://github.com/ethereum/EIPs/issues/1155#issuecomment-461758755), 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.

### Metadata JSON

The Scope Metadata JSON Schema was added in order to support human-readable scope names and descriptions in more than one language.

## References

**Standards**
- [ERC-1155 Multi Token Standard](./eip-1155.md)
- [ERC-165 Standard Interface Detection](./eip-165.md)
- [JSON Schema](https://json-schema.org/)

**Implementations**
- [Enjin Coin](https://enjincoin.io) ([github](https://github.com/enjin))

**Articles &amp; Discussions**
- [GitHub - Original Discussion Thread](https://github.com/ethereum/EIPs/issues/1761)
- [GitHub - ERC-1155 Discussion Thread](https://github.com/ethereum/EIPs/issues/1155)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 18 Feb 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1761</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1761</guid>
      </item>
    
      <item>
        <title>App Keys, application specific wallet accounts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-erc-app-keys-application-specific-wallet-accounts/2742</comments>
        
        <description>## Simple Summary

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.

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 `app keys`. 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&apos;s confirmation) while keeping main accounts secure. Finally wallets can also implement a different behavior such as allowing to sign transactions without broadcasting them.

This new accounts type can allow to significantly improve UX and permit new designs for applications of the crypto permissionned web.

## Abstract
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.

We introduce here a new account type, app keys, which permits signing delegation and accounts isolation across applications for privacy and security.

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 [EIP-2255](./eip-2255.md)). 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.

## Motivation
Wallets developers have agreed on an HD derivation path for ethereum accounts using BIP32, BIP44, SLIP44, [(see the discussion here)](https://github.com/ethereum/EIPs/issues/84). Web3 wallets have implemented in a roughly similar way the rpc eth api. [EIP-1102](./eip-1102.md) introduced privacy through non automatic opt-in of a wallet account into an app increasing privacy.

However several limitations remain in order to allow for proper design and UX for crypto permissioned apps.

Most of GUI based current wallets don&apos;t allow to:
* being able to automatically and effortlessly use different keys / accounts for each apps,
* being able to sign some app&apos;s action without prompting the user with the same level of security as sending funds from their main accounts,
* being able to use throwable keys to improve anonymity,
* effortlessly signing transactions for an app without broadcasting these while still being able to perform other transaction signing as usual from their main accounts,
* All this while being fully restorable using the user&apos;s mnemonic or hardware wallet and the HD Path determined uniquely by the app&apos;s ens name.

We try to overcome these limitations by introducing a new account&apos;s type, app keys, made to be used along side the existing main accounts.

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&apos;s funds.


## Specification

### Applications

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/identity relying application, Ethereum based but not only.

Once connected to a wallet, an application can request to access an account derived exclusively for that application using the following algorithm.

### Private App Key generation algorithm

We now propose an algorithm to generate application keys that:
- are uniquely defined, with respect to the account that the user selected to generate these keys,
- and thus can be isolated when changing the user account, allowing persona management (see next section),
- are specific to each application,
- can be fully restored from the user master seed mnemonic and the applications&apos; names.

#### Using different accounts as personas

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&apos;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.

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.

#### Applications&apos; Unique Identifiers

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.

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.

We will probably require for protocol prefixes when using an ENS domain to point to an IPFS address:
`ens://ipfs.snap.eth`


#### Private App Key generation algorithm

Using the domain name of an application, we generate a private key for each application (and per main account) :

`const appKeyPrivKey = keccak256(privKey + originString)`

where `+` is concatenation, `privKey` is the private key of the user&apos;s account selected to span the application key and `originString` represents the origin url from which the permission call to access the application key is originated from.

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):

```
const appKey = await provider.send({
  method: &apos;wallet_getAppKeyForAccount&apos;,
  params: [address1]
});
```

See here for an implementation:
https://github.com/MetaMask/eth-simple-keyring/blob/master/index.js#L169

#### App keys and Hierarchical Deterministic keys

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.

## Rationale

### Sharing application keys across domains:
While this does not explicit cover cases of sharing these app keys between pages on its own, this need can be met by composition:

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.

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.

### Privacy and the funding trail

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.

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.

Mixers or anonymous ways of funding an ethereum address (ring signatures) along with this proposal would guarantee privacy.

Even if privacy is not solved fully without this anonymous funding method, we still need a way to easily create and restore different accounts/addresses for each application

## Backwards Compatibility
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.

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 `app keys` to migrate to them and leverage on the new app designs they permit.

## Implementation

Here is an early implementation of app keys for standard (non HW) MetaMask accounts.
https://github.com/MetaMask/eth-simple-keyring/blob/6d12bd9d73adcccbe0b0c7e32a99d279085e2934/index.js#L139-L152

See here for a fork of MetaMask that implements app keys along side plugins:
https://github.com/MetaMask/metamask-snaps-beta
https://github.com/MetaMask/metamask-snaps-beta/wiki/Plugin-API

## Example use cases

* signing transactions without broadcasting them
https://github.com/MetaMask/metamask-extension/issues/3475

* token contract
https://github.com/ethereum/EIPs/issues/85

* default account for dapps
https://ethereum-magicians.org/t/default-accounts-for-dapps/904

* non wallet/crypto accounts
[EIP1581: Non-wallet usage of keys derived from BIP32 trees](./eip-1581.md)

* state channel application

* privacy solution

* non custodian cross cryptocurrency exchange...

## Acknowledgements
MetaMask team, Christian Lundkvist, Counterfactual team, Liam Horne, Erik Bryn, Richard Moore, Jeff Coleman.


## References

### HD and mnemonics
#### BIPs
* [BIP32: Hierarchical Deterministic Wallets:](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)

* [BIP39: Mnemonic code for generating deterministic keys:](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)

* [SLIP44: Registered coin types for BIP44](https://github.com/satoshilabs/slips/blob/master/slip-0044.md)


#### Derivation path for eth
* [Issue 84](https://github.com/ethereum/EIPs/issues/84)

* [Issue 85](https://github.com/ethereum/EIPs/issues/85)

* [EIP600 Ethereum purpose allocation for Deterministic Wallets](./eip-600.md)


* [EIP601 Ethereum hierarchy for deterministic wallets](./eip-601.md)


### Previous proposals and discussions related to app keys
* [Meta: we should value privacy more](https://ethereum-magicians.org/t/meta-we-should-value-privacy-more/2475)

* [EIP1102: Opt-in account exposure](./eip-1102.md)

* [EIP1581: Non-wallet usage of keys derived from BIP-32 trees](./eip-1581.md)

* [EIP1581: discussion](https://ethereum-magicians.org/t/non-wallet-usage-of-keys-derived-from-bip-32-trees/1817/4)

* [SLIP13: Authentication using deterministic hierarchy](https://github.com/satoshilabs/slips/blob/master/slip-0013.md)


## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 20 Feb 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1775</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1775</guid>
      </item>
    
      <item>
        <title>Ethereum Verifiable Claims</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-1812-ethereum-verifiable-claims/2814</comments>
        
        <description># Ethereum Verifiable Claims

## Simple Summary

Reusable Verifiable Claims using [EIP 712 Signed Typed Data](./eip-712.md).

## Abstract
A new method for Off-Chain Verifiable Claims built on [EIP-712](./eip-712.md). 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.

## Motivation
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.

[ERC-735](https://github.com/ethereum/EIPs/issues/735) and [ERC-780](https://github.com/ethereum/EIPs/issues/780) 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. 

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.

The W3C [Verifiable Claims Data Model and Representations](https://www.w3.org/TR/verifiable-claims-data-model/) as well as uPorts [Verification Message Spec](https://developer.uport.me/messages/verification) are proposed off-chain solutions. 

While built on industry standards such as [JSON-LD](https://json-ld.org) and [JWT](https://jwt.io) neither of them are easy to integrate with the Ethereum ecosystem.

[EIP-712](./eip-712.md) 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.

This format  allows reusable off-chain Verifiable Claims to be cheaply issued to users, who can present them when needed.

## Prior Art
Verified Identity Claims such as those proposed by [uPort](https://developer.uport.me/messages/verification) and [W3C Verifiable Claims Working Group](https://www.w3.org/2017/vc/WG/) form an important part of building up reusable identity claims.

[ERC-735](https://github.com/ethereum/EIPs/issues/735) and [ERC-780](https://github.com/ethereum/EIPs/issues/780) provide on-chain storage and lookups of Verifiable Claims.

## Specification
### Claims
Claims can be generalized like this:

&gt; Issuer makes the claim that Subject is something or has some attribute and value.    

Claims should be deterministic, in that the same claim signed multiple times by the same signer.

### Claims data structure
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.

* `subject` the subject of the claim as an `address` (who the claim is about)
* `validFrom` the time in seconds encoded as a `uint256` 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.
* `validTo` the time in seconds encoded as a `uint256` of when the validity of  the claim expires. If you intend for the claim not to expire use `0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`.

The basic minimal claim data structure as a Solidity struct:

```solidity
struct [CLAIM TYPE] {
	address subject;
	uint256 validFrom;
	uint256 validTo;
}
```

The CLAIM TYPE is the actual name of the claim. While not required, in most cases use the taxonomy developed by [schema.org](https://schema.org/docs/full.html) which is also commonly used in other Verifiable Claims formats.

Example claim that issuer knows a subject:

```solidity
struct Know {
	address subject;
	uint256 validFrom;
	uint256 validTo;
}
```

### Presenting a Verifiable Claim
#### Verifying Contract
When defining Verifiable Claims formats a Verifying Contract should be created with a public `verify()`  view function. This makes it very easy for other smart contracts to verify a claim correctly. 

It also provides a convenient interface for web3 and state channel apps to verify claims securely.

```solidity
function verifyIssuer(Know memory claim, uint8 v, bytes32 r, bytes32 s) public returns (address) {
	bytes32 digest = keccak256(
	  abi.encodePacked(
	    &quot;\x19\x01&quot;,
	    DOMAIN_SEPARATOR,
	    hash(claim)
	  )
	);
	require(
		(claim.validFrom &gt;= block.timestamp) &amp;&amp; (block.timestamp &lt; claim.validTo)
, &quot;invalid issuance timestamps&quot;);
	return ecrecover(digest, v, r, s);
}
```

#### Calling a SmartContract function
Verifiable Claims can be presented to a solidity function call as it’s struct together with the `v`, `r` and `s` signature components.

```solidity
function vouch(Know memory claim, uint8 v, bytes32 r, bytes32 s) public returns (bool) {
	address issuer = verifier.verifyIssuer(claim, v, r, s);
	require(issuer !== &apos;0x0&apos;);
	knows[issuer][claim.subject] = block.number;
	return true;
}
```

#### Embedding a Verifiable Claim in another Signed Typed Data  structure
The Claim struct should be embedded in another struct together with the `v`, `r` and `s` signature parameters.

```solidity
struct Know {
	address subject;
	uint256 validFrom;
	uint256 validTo;
}

struct VerifiableReference {
	Know delegate;
	uint8 v;
	bytes32 r;
	bytes32 s;
}

struct Introduction {
	address recipient;
	VerifiableReference issuer;
}
```

Each Verifiable Claim should be individually verified  together with the parent Signed Typed Data structure.

Verifiable Claims issued to different EIP 712 Domains can be embedded within each other.

#### State Channels
This proposal will not show how to use Eth Verifiable Claims  as part of a specific State Channel method.

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.

### Key Delegation
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.

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.

#### ERC1056 Signing Delegation

[ERC-1056](./eip-1056.md) 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.

To support this an additional `issuer` 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 `issuer`

The following is the minimal struct for a Claim containing an issuer:

```solidity
struct [CLAIM TYPE] {
	address subject;
  address issuer;
	uint256 validFrom;
	uint256 validTo;
}
```

If the `issuer` 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 `veriKey` delegate for the address specified in the issuer.

```solidity
registry.validDelegate(issuer, &apos;veriKey&apos;, recoveredAddress)
```


#### Embedded Delegation Proof
There may be applications, in particularly where organizations want to allow delegates to issue claims about specific domains and types.

For this purpose instead of the `issuer` we allow a special claim to be embedded following this same format:

```solidity
struct Delegate {
	address issuer;
	address subject;
	uint256 validFrom;
	uint256 validTo;
}

struct VerifiableDelegate {
	Delegate delegate;
	uint8 v;
	bytes32 r;
	bytes32 s;
}


struct [CLAIM TYPE] {
	address subject;
	VerifiedDelegate issuer;
	uint256 validFrom;
	uint256 validTo;
}
```

Delegates should be created for specific EIP 712 Domains and not be reused across Domains.

Implementers of new EIP 712 Domains can add further data to the `Delegate` struct to allow finer grained application specific rules to it.

### Claim Types
#### Binary Claims
A Binary claim is something that doesn’t have a particular value. It either is issued or not.

Examples:
* subject is a Person
* subject is my owner (eg. Linking an ethereum account to an owner identity)

Example:

```solidity
struct Person {
	address issuer;
	address subject;
	uint256 validFrom;
	uint256 validTo;
}
```

This is exactly the same as the minimal claim above with the CLAIM TYPE set to [Person](https://schema.org/Person).

### Value Claims
Value claims can be used to make a claim about the subject containing a specific readable value.

**WARNING**: 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.

Examples:
* subject’s name is Alice
* subjects average account balance is 1234555

Each value should use the `value` field to indicate the value.

A Name Claim

```solidity
struct Name {
	address issuer;
	address subject;
	string name;
	uint256 validFrom;
	uint256 validTo;
}
```

Average Balance

```solidity
struct AverageBalance {
	address issuer;
	address subject;
	uint256 value;
	uint256 validFrom;
	uint256 validTo;
}
```

### Hashed Claims
Hashed claims can be used to make a claim about the subject containing the hash of a claim value. Hashes should use ethereum standard `keccak256` hashing function.

**WARNING**: 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.

Examples:
- [ ] hash of subject’s name is `keccak256(“Alice Torres”)`
- [ ] hash of subject’s email is `keccak256(“alice@example.com”)`

Each value should use the `keccak256 ` 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.

A Name Claim

```solidity
struct Name {
	address issuer;
	address subject;
	bytes32 keccak256;
	uint256 validFrom;
	uint256 validTo;
}
```

Email Claim

```solidity
struct Email {
	address issuer;
	address subject;
	bytes32 keccak256;
	uint256 validFrom;
	uint256 validTo;
}
```

### EIP 712 Domain
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:

```solidity
{
  name: &quot;EIP1???Claim&quot;,
  version: 1,
  chainId: 1, // for mainnet
  verifyingContract: 0x // TBD
  salt: ...
}
```

#### Full Combined format for EIP 712 signing:

Following the EIP 712 standard we can combine the Claim Type with the EIP 712 Domain and the claim itself (in the `message`)  attribute.

Eg:
```solidity
  {
    &quot;types&quot;: {
      &quot;EIP712Domain&quot;: [
        {
          &quot;name&quot;: &quot;name&quot;,
          &quot;type&quot;: &quot;string&quot;
        },
        {
          &quot;name&quot;: &quot;version&quot;,
          &quot;type&quot;: &quot;string&quot;
        },
        {
          &quot;name&quot;: &quot;chainId&quot;,
          &quot;type&quot;: &quot;uint256&quot;
        },
        {
          &quot;name&quot;: &quot;verifyingContract&quot;,
          &quot;type&quot;: &quot;address&quot;
        }
      ],
      &quot;Email&quot;: [
        { 
          &quot;name&quot;: &quot;subject&quot;,
          &quot;type&quot;: &quot;address&quot;
        },
        {
          &quot;name&quot;: &quot;keccak256&quot;,
          &quot;type&quot;: &quot;bytes32&quot;
        },
        {
          &quot;name&quot;: &quot;validFrom&quot;,
          &quot;type&quot;: &quot;uint256&quot;
        },
        {
          &quot;name&quot;: &quot;validTo&quot;,
          &quot;type&quot;: &quot;uint256&quot;
        }
      ]
    },
    &quot;primaryType&quot;: &quot;Email&quot;,
    &quot;domain&quot;: {
      &quot;name&quot;: &quot;EIP1??? Claim&quot;,
      &quot;version&quot;: &quot;1&quot;,
      &quot;chainId&quot;: 1,
      &quot;verifyingContract&quot;: &quot;0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC&quot;
    },
    &quot;message&quot;: {
      &quot;subject&quot;: &quot;0x5792e817336f41de1d8f54feab4bc200624a1d9d&quot;,
      &quot;value&quot;: &quot;9c8465d9ae0b0bc167dee7f62880034f59313100a638dcc86a901956ea52e280&quot;,
      &quot;validFrom&quot;: &quot;0x0000000000000000000000000000000000000000000000000001644b74c2a0&quot;,
      &quot;validTo&quot;: &quot;0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&quot;
    }
  }
```


### Revocation
Both Issuers and Subjects should be allowed to revoke Verifiable Claims. Revocations can be handled through a simple on-chain registry. 

The ultimate rules of who should be able to revoke a claim is determined by the Verifying contract.

The `digest` used for revocation is the EIP712 Signed Typed Data digest.

```solidity
contract RevocationRegistry {
  mapping (bytes32 =&gt; mapping (address =&gt; uint)) public revocations;

  function revoke(bytes32 digest) public returns (bool) {
    revocations[digest][msg.sender] = block.number;
    return true;
  }

  function revoked(address party, bytes32 digest) public view returns (bool) {
    return revocations[digest][party] &gt; 0;
  }
}
```

A verifying contract can query the Revocation Registry as such:

```solidity
bytes32 digest = keccak256(
  abi.encodePacked(
    &quot;\x19\x01&quot;,
    DOMAIN_SEPARATOR,
    hash(claim)
  )
);
require(valid(claim.validFrom, claim.validTo), &quot;invalid issuance timestamps&quot;);
address issuer = ecrecover(digest, v, r, s);
require(!revocations.revoked(issuer, digest), &quot;claim was revoked by issuer&quot;);
require(!revocations.revoked(claim.subject, digest), &quot;claim was revoked by subject&quot;);
```

### Creation of Verifiable Claims Domains

Creating specific is Verifiable Claims Domains is out of the scope of this EIP.   The Example Code has a few examples.

EIP’s or another process could be used to standardize specific important Domains that are universally useful across the Ethereum world.

## Rationale
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.

### Rationale for using not using a single EIP 712 Domain
EIP712 supports complex types and domains in itself, that we believe are perfect building blocks for building Verifiable Claims for specific purposes.

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.

EIP712 Domains also allow rapid experimentation, allowing taxonomies to be built up by the community.

## Test Cases
There is a repo with a few example verifiers and consuming smart contracts written in Solidity:

**Example Verifiers**
* [Verifier for very simple IdVerification Verifiable Claims containing minimal Personal Data](https://github.com/uport-project/eip712-claims-experiments/blob/master/contracts/IdentityClaimsVerifier.sol)
* [Verifier for OwnershipProofs signed by a users wallet](https://github.com/uport-project/eip712-claims-experiments/blob/master/contracts/OwnershipProofVerifier.sol)

**Example Smart Contracts**
* [KYCCoin.sol](https://github.com/uport-project/eip712-claims-experiments/blob/master/contracts/KYCCoin.sol) - Example Token allows reusable IdVerification claims issued by trusted verifiers and users to whitelist their own addresses using OwnershipProofs
* [ConsortiumAgreement.sol](https://github.com/uport-project/eip712-claims-experiments/blob/master/contracts/ConsortiumAgreements.sol) - Example Consortium Agreement smart contract. Consortium Members can issue Delegated Claims to employees or servers to interact on their behalf.

**Shared Registries**
* [RevocationRegistry.sol](https://github.com/uport-project/eip712-claims-experiments/blob/master/contracts/RevocationRegistry.sol)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 03 Mar 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1812</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1812</guid>
      </item>
    
      <item>
        <title>Pseudo-introspection Registry Contract</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/pull/1820</comments>
        
        <description>&gt; :information_source: **[ERC-1820] has superseded [ERC-820].** :information_source:  
&gt; [ERC-1820] fixes the incompatibility in the [ERC-165] logic which was introduced by the Solidity 0.5 update.  
&gt; Have a look at the [official announcement][erc1820-annoucement], and the comments about the [bug][erc820-bug] and the [fix][erc820-fix].  
&gt; Apart from this fix, [ERC-1820] is functionally equivalent to [ERC-820].
&gt;
&gt; :warning: [ERC-1820] MUST be used in lieu of [ERC-820]. :warning:

## Simple Summary

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.

This standard keeps backward compatibility with [ERC-165].

## Abstract

This standard defines a registry where smart contracts and regular accounts can publish which functionality they implement---either directly or through a proxy contract.

Anyone can query this registry to ask if a specific address implements a given interface and which smart contract handles its implementation.

This registry MAY be deployed on any chain and shares the same address on all chains.

Interfaces with zeroes (`0`) as the last 28 bytes are considered [ERC-165] interfaces,
and this registry SHALL forward the call to the contract to see if it implements the interface.

This contract also acts as an [ERC-165] cache to reduce gas consumption.

## Motivation

There have been different approaches to define pseudo-introspection in Ethereum.
The first is [ERC-165] which has the limitation that it cannot be used by regular accounts.
The second attempt is [ERC-672] which uses reverse [ENS]. Using reverse [ENS] has two issues. 
First, it is unnecessarily complicated, and second, [ENS] is still a centralized contract controlled by a multisig.
This multisig theoretically would be able to modify the system.

This standard is much simpler than [ERC-672], and it is *fully* decentralized.

This standard also provides a *unique* address for all chains.
Thus solving the problem of resolving the correct registry address for different chains.

## Specification

### [ERC-1820] Registry Smart Contract

&gt; This is an exact copy of the code of the [ERC1820 registry smart contract].

``` solidity
/* ERC1820 Pseudo-introspection Registry Contract
 * 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.
 *
 * Written in 2019 by Jordi Baylina and Jacques Dafflon
 *
 * To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to
 * this software to the public domain worldwide. This software is distributed without any warranty.
 *
 * You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
 * &lt;http://creativecommons.org/publicdomain/zero/1.0/&gt;.
 *
 *    ███████╗██████╗  ██████╗ ██╗ █████╗ ██████╗  ██████╗
 *    ██╔════╝██╔══██╗██╔════╝███║██╔══██╗╚════██╗██╔═████╗
 *    █████╗  ██████╔╝██║     ╚██║╚█████╔╝ █████╔╝██║██╔██║
 *    ██╔══╝  ██╔══██╗██║      ██║██╔══██╗██╔═══╝ ████╔╝██║
 *    ███████╗██║  ██║╚██████╗ ██║╚█████╔╝███████╗╚██████╔╝
 *    ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚═╝ ╚════╝ ╚══════╝ ╚═════╝
 *
 *    ██████╗ ███████╗ ██████╗ ██╗███████╗████████╗██████╗ ██╗   ██╗
 *    ██╔══██╗██╔════╝██╔════╝ ██║██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝
 *    ██████╔╝█████╗  ██║  ███╗██║███████╗   ██║   ██████╔╝ ╚████╔╝
 *    ██╔══██╗██╔══╝  ██║   ██║██║╚════██║   ██║   ██╔══██╗  ╚██╔╝
 *    ██║  ██║███████╗╚██████╔╝██║███████║   ██║   ██║  ██║   ██║
 *    ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝
 *
 */
pragma solidity 0.5.3;
// IV is value needed to have a vanity address starting with &apos;0x1820&apos;.
// IV: 53759

/// @dev The interface a contract MUST implement if it is the implementer of
/// some (other) interface for any address other than itself.
interface ERC1820ImplementerInterface {
    /// @notice Indicates whether the contract implements the interface &apos;interfaceHash&apos; for the address &apos;addr&apos; or not.
    /// @param interfaceHash keccak256 hash of the name of the interface
    /// @param addr Address for which the contract will implement the interface
    /// @return ERC1820_ACCEPT_MAGIC only if the contract implements &apos;interfaceHash&apos; for the address &apos;addr&apos;.
    function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32);
}


/// @title ERC1820 Pseudo-introspection Registry Contract
/// @author Jordi Baylina and Jacques Dafflon
/// @notice This contract is the official implementation of the ERC1820 Registry.
/// @notice For more details, see https://eips.ethereum.org/EIPS/eip-1820
contract ERC1820Registry {
    /// @notice ERC165 Invalid ID.
    bytes4 constant internal INVALID_ID = 0xffffffff;
    /// @notice Method ID for the ERC165 supportsInterface method (= `bytes4(keccak256(&apos;supportsInterface(bytes4)&apos;))`).
    bytes4 constant internal ERC165ID = 0x01ffc9a7;
    /// @notice Magic value which is returned if a contract implements an interface on behalf of some other address.
    bytes32 constant internal ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked(&quot;ERC1820_ACCEPT_MAGIC&quot;));

    /// @notice mapping from addresses and interface hashes to their implementers.
    mapping(address =&gt; mapping(bytes32 =&gt; address)) internal interfaces;
    /// @notice mapping from addresses to their manager.
    mapping(address =&gt; address) internal managers;
    /// @notice flag for each address and erc165 interface to indicate if it is cached.
    mapping(address =&gt; mapping(bytes4 =&gt; bool)) internal erc165Cached;

    /// @notice Indicates a contract is the &apos;implementer&apos; of &apos;interfaceHash&apos; for &apos;addr&apos;.
    event InterfaceImplementerSet(address indexed addr, bytes32 indexed interfaceHash, address indexed implementer);
    /// @notice Indicates &apos;newManager&apos; is the address of the new manager for &apos;addr&apos;.
    event ManagerChanged(address indexed addr, address indexed newManager);

    /// @notice Query if an address implements an interface and through which contract.
    /// @param _addr Address being queried for the implementer of an interface.
    /// (If &apos;_addr&apos; is the zero address then &apos;msg.sender&apos; is assumed.)
    /// @param _interfaceHash Keccak256 hash of the name of the interface as a string.
    /// E.g., &apos;web3.utils.keccak256(&quot;ERC777TokensRecipient&quot;)&apos; for the &apos;ERC777TokensRecipient&apos; interface.
    /// @return The address of the contract which implements the interface &apos;_interfaceHash&apos; for &apos;_addr&apos;
    /// or &apos;0&apos; if &apos;_addr&apos; did not register an implementer for this interface.
    function getInterfaceImplementer(address _addr, bytes32 _interfaceHash) external view returns (address) {
        address addr = _addr == address(0) ? msg.sender : _addr;
        if (isERC165Interface(_interfaceHash)) {
            bytes4 erc165InterfaceHash = bytes4(_interfaceHash);
            return implementsERC165Interface(addr, erc165InterfaceHash) ? addr : address(0);
        }
        return interfaces[addr][_interfaceHash];
    }

    /// @notice 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.)
    /// @param _addr Address for which to set the interface.
    /// (If &apos;_addr&apos; is the zero address then &apos;msg.sender&apos; is assumed.)
    /// @param _interfaceHash Keccak256 hash of the name of the interface as a string.
    /// E.g., &apos;web3.utils.keccak256(&quot;ERC777TokensRecipient&quot;)&apos; for the &apos;ERC777TokensRecipient&apos; interface.
    /// @param _implementer Contract address implementing &apos;_interfaceHash&apos; for &apos;_addr&apos;.
    function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) external {
        address addr = _addr == address(0) ? msg.sender : _addr;
        require(getManager(addr) == msg.sender, &quot;Not the manager&quot;);

        require(!isERC165Interface(_interfaceHash), &quot;Must not be an ERC165 hash&quot;);
        if (_implementer != address(0) &amp;&amp; _implementer != msg.sender) {
            require(
                ERC1820ImplementerInterface(_implementer)
                    .canImplementInterfaceForAddress(_interfaceHash, addr) == ERC1820_ACCEPT_MAGIC,
                &quot;Does not implement the interface&quot;
            );
        }
        interfaces[addr][_interfaceHash] = _implementer;
        emit InterfaceImplementerSet(addr, _interfaceHash, _implementer);
    }

    /// @notice Sets &apos;_newManager&apos; as manager for &apos;_addr&apos;.
    /// The new manager will be able to call &apos;setInterfaceImplementer&apos; for &apos;_addr&apos;.
    /// @param _addr Address for which to set the new manager.
    /// @param _newManager Address of the new manager for &apos;addr&apos;. (Pass &apos;0x0&apos; to reset the manager to &apos;_addr&apos;.)
    function setManager(address _addr, address _newManager) external {
        require(getManager(_addr) == msg.sender, &quot;Not the manager&quot;);
        managers[_addr] = _newManager == _addr ? address(0) : _newManager;
        emit ManagerChanged(_addr, _newManager);
    }

    /// @notice Get the manager of an address.
    /// @param _addr Address for which to return the manager.
    /// @return Address of the manager for a given address.
    function getManager(address _addr) public view returns(address) {
        // By default the manager of an address is the same address
        if (managers[_addr] == address(0)) {
            return _addr;
        } else {
            return managers[_addr];
        }
    }

    /// @notice Compute the keccak256 hash of an interface given its name.
    /// @param _interfaceName Name of the interface.
    /// @return The keccak256 hash of an interface name.
    function interfaceHash(string calldata _interfaceName) external pure returns(bytes32) {
        return keccak256(abi.encodePacked(_interfaceName));
    }

    /* --- ERC165 Related Functions --- */
    /* --- Developed in collaboration with William Entriken. --- */

    /// @notice Updates the cache with whether the contract implements an ERC165 interface or not.
    /// @param _contract Address of the contract for which to update the cache.
    /// @param _interfaceId ERC165 interface for which to update the cache.
    function updateERC165Cache(address _contract, bytes4 _interfaceId) external {
        interfaces[_contract][_interfaceId] = implementsERC165InterfaceNoCache(
            _contract, _interfaceId) ? _contract : address(0);
        erc165Cached[_contract][_interfaceId] = true;
    }

    /// @notice Checks whether a contract implements an ERC165 interface or not.
    //  If the result is not cached a direct lookup on the contract address is performed.
    //  If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling
    //  &apos;updateERC165Cache&apos; with the contract address.
    /// @param _contract Address of the contract to check.
    /// @param _interfaceId ERC165 interface to check.
    /// @return True if &apos;_contract&apos; implements &apos;_interfaceId&apos;, false otherwise.
    function implementsERC165Interface(address _contract, bytes4 _interfaceId) public view returns (bool) {
        if (!erc165Cached[_contract][_interfaceId]) {
            return implementsERC165InterfaceNoCache(_contract, _interfaceId);
        }
        return interfaces[_contract][_interfaceId] == _contract;
    }

    /// @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.
    /// @param _contract Address of the contract to check.
    /// @param _interfaceId ERC165 interface to check.
    /// @return True if &apos;_contract&apos; implements &apos;_interfaceId&apos;, false otherwise.
    function implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) public view returns (bool) {
        uint256 success;
        uint256 result;

        (success, result) = noThrowCall(_contract, ERC165ID);
        if (success == 0 || result == 0) {
            return false;
        }

        (success, result) = noThrowCall(_contract, INVALID_ID);
        if (success == 0 || result != 0) {
            return false;
        }

        (success, result) = noThrowCall(_contract, _interfaceId);
        if (success == 1 &amp;&amp; result == 1) {
            return true;
        }
        return false;
    }

    /// @notice Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.
    /// @param _interfaceHash The hash to check.
    /// @return True if &apos;_interfaceHash&apos; is an ERC165 interface (ending with 28 zeroes), false otherwise.
    function isERC165Interface(bytes32 _interfaceHash) internal pure returns (bool) {
        return _interfaceHash &amp; 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0;
    }

    /// @dev Make a call on a contract without throwing if the function does not exist.
    function noThrowCall(address _contract, bytes4 _interfaceId)
        internal view returns (uint256 success, uint256 result)
    {
        bytes4 erc165ID = ERC165ID;

        assembly {
            let x := mload(0x40)               // Find empty storage location using &quot;free memory pointer&quot;
            mstore(x, erc165ID)                // Place signature at beginning of empty storage
            mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature

            success := staticcall(
                30000,                         // 30k gas
                _contract,                     // To addr
                x,                             // Inputs are stored at location x
                0x24,                          // Inputs are 36 (4 + 32) bytes long
                x,                             // Store output over input (saves space)
                0x20                           // Outputs are 32 bytes long
            )

            result := mload(x)                 // Load the result
        }
    }
}

```

### Deployment Transaction

Below is the raw transaction which MUST be used to deploy the smart contract on any chain.

```
0xf90a388085174876e800830c35008080b909e5608060405234801561001057600080fd5b506109c5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063a41e7d5111610078578063a41e7d51146101d4578063aabbb8ca1461020a578063b705676514610236578063f712f3e814610280576100a5565b806329965a1d146100aa5780633d584063146100e25780635df8122f1461012457806365ba36c114610152575b600080fd5b6100e0600480360360608110156100c057600080fd5b50600160a060020a038135811691602081013591604090910135166102b6565b005b610108600480360360208110156100f857600080fd5b5035600160a060020a0316610570565b60408051600160a060020a039092168252519081900360200190f35b6100e06004803603604081101561013a57600080fd5b50600160a060020a03813581169160200135166105bc565b6101c26004803603602081101561016857600080fd5b81019060208101813564010000000081111561018357600080fd5b82018360208201111561019557600080fd5b803590602001918460018302840111640100000000831117156101b757600080fd5b5090925090506106b3565b60408051918252519081900360200190f35b6100e0600480360360408110156101ea57600080fd5b508035600160a060020a03169060200135600160e060020a0319166106ee565b6101086004803603604081101561022057600080fd5b50600160a060020a038135169060200135610778565b61026c6004803603604081101561024c57600080fd5b508035600160a060020a03169060200135600160e060020a0319166107ef565b604080519115158252519081900360200190f35b61026c6004803603604081101561029657600080fd5b508035600160a060020a03169060200135600160e060020a0319166108aa565b6000600160a060020a038416156102cd57836102cf565b335b9050336102db82610570565b600160a060020a031614610339576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b6103428361092a565b15610397576040805160e560020a62461bcd02815260206004820152601a60248201527f4d757374206e6f7420626520616e204552433136352068617368000000000000604482015290519081900360640190fd5b600160a060020a038216158015906103b85750600160a060020a0382163314155b156104ff5760405160200180807f455243313832305f4143434550545f4d4147494300000000000000000000000081525060140190506040516020818303038152906040528051906020012082600160a060020a031663249cb3fa85846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182600160a060020a0316600160a060020a031681526020019250505060206040518083038186803b15801561047e57600080fd5b505afa158015610492573d6000803e3d6000fd5b505050506040513d60208110156104a857600080fd5b5051146104ff576040805160e560020a62461bcd02815260206004820181905260248201527f446f6573206e6f7420696d706c656d656e742074686520696e74657266616365604482015290519081900360640190fd5b600160a060020a03818116600081815260208181526040808320888452909152808220805473ffffffffffffffffffffffffffffffffffffffff19169487169485179055518692917f93baa6efbd2244243bfee6ce4cfdd1d04fc4c0e9a786abd3a41313bd352db15391a450505050565b600160a060020a03818116600090815260016020526040812054909116151561059a5750806105b7565b50600160a060020a03808216600090815260016020526040902054165b919050565b336105c683610570565b600160a060020a031614610624576040805160e560020a62461bcd02815260206004820152600f60248201527f4e6f7420746865206d616e616765720000000000000000000000000000000000604482015290519081900360640190fd5b81600160a060020a031681600160a060020a0316146106435780610646565b60005b600160a060020a03838116600081815260016020526040808220805473ffffffffffffffffffffffffffffffffffffffff19169585169590951790945592519184169290917f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a43509190a35050565b600082826040516020018083838082843780830192505050925050506040516020818303038152906040528051906020012090505b92915050565b6106f882826107ef565b610703576000610705565b815b600160a060020a03928316600081815260208181526040808320600160e060020a031996909616808452958252808320805473ffffffffffffffffffffffffffffffffffffffff19169590971694909417909555908152600284528181209281529190925220805460ff19166001179055565b600080600160a060020a038416156107905783610792565b335b905061079d8361092a565b156107c357826107ad82826108aa565b6107b85760006107ba565b815b925050506106e8565b600160a060020a0390811660009081526020818152604080832086845290915290205416905092915050565b6000808061081d857f01ffc9a70000000000000000000000000000000000000000000000000000000061094c565b909250905081158061082d575080155b1561083d576000925050506106e8565b61084f85600160e060020a031961094c565b909250905081158061086057508015155b15610870576000925050506106e8565b61087a858561094c565b909250905060018214801561088f5750806001145b1561089f576001925050506106e8565b506000949350505050565b600160a060020a0382166000908152600260209081526040808320600160e060020a03198516845290915281205460ff1615156108f2576108eb83836107ef565b90506106e8565b50600160a060020a03808316600081815260208181526040808320600160e060020a0319871684529091529020549091161492915050565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff161590565b6040517f01ffc9a7000000000000000000000000000000000000000000000000000000008082526004820183905260009182919060208160248189617530fa90519096909550935050505056fea165627a7a72305820377f4a2d4301ede9949f163f319021a6e9c687c292a5e2b2c4734c126b524e6c00291ba01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820
```

The strings of `1820`&apos;s at the end of the transaction are the `r` and `s` 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.

### Deployment Method

This contract is going to be deployed using the keyless deployment method---also known as [Nick]&apos;s method---which relies on a single-use address.
(See [Nick&apos;s article] for more details). This method works as follows:

1. Generate a transaction which deploys the contract from a new random account.
  - This transaction MUST NOT use [EIP-155] in order to work on any chain.
  - 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.

2. Set the `v`, `r`, `s` of the transaction signature to the following values:

   ```
   v: 27,
   r: 0x1820182018201820182018201820182018201820182018201820182018201820&apos;
   s: 0x1820182018201820182018201820182018201820182018201820182018201820&apos;
   ```

   Those `r` and `s` values---made of a repeating pattern of `1820`&apos;s---are predictable &quot;random numbers&quot; generated deterministically by a human.

3. We recover the sender of this transaction, i.e., the single-use deployment account.

    &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.

4. Send exactly 0.08 ether to this single-use deployment account.

5. Broadcast the deployment transaction.

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.


### Single-use Registry Deployment Account

```
0xa990077c3205cbDf861e17Fa532eeB069cE9fF96
```

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.

&gt; To deploy the registry, 0.08 ether MUST be sent to this account *first*.

### Registry Contract Address

```
0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24
```

The contract has the address above for every chain on which it is deployed.

&lt;details&gt;
&lt;summary&gt;Raw metadata of &lt;code&gt;./contracts/ERC1820Registry.sol&lt;/code&gt;&lt;/summary&gt;

```json
{
        &quot;compiler&quot;: {
          &quot;version&quot;: &quot;0.5.3+commit.10d17f24&quot;
        },
        &quot;language&quot;: &quot;Solidity&quot;,
        &quot;output&quot;: {
          &quot;abi&quot;: [
            {
              &quot;constant&quot;: false,
              &quot;inputs&quot;: [
                {
                  &quot;name&quot;: &quot;_addr&quot;,
                  &quot;type&quot;: &quot;address&quot;
                },
                {
                  &quot;name&quot;: &quot;_interfaceHash&quot;,
                  &quot;type&quot;: &quot;bytes32&quot;
                },
                {
                  &quot;name&quot;: &quot;_implementer&quot;,
                  &quot;type&quot;: &quot;address&quot;
                }
              ],
              &quot;name&quot;: &quot;setInterfaceImplementer&quot;,
              &quot;outputs&quot;: [],
              &quot;payable&quot;: false,
              &quot;stateMutability&quot;: &quot;nonpayable&quot;,
              &quot;type&quot;: &quot;function&quot;
            },
            {
              &quot;constant&quot;: true,
              &quot;inputs&quot;: [
                {
                  &quot;name&quot;: &quot;_addr&quot;,
                  &quot;type&quot;: &quot;address&quot;
                }
              ],
              &quot;name&quot;: &quot;getManager&quot;,
              &quot;outputs&quot;: [
                {
                  &quot;name&quot;: &quot;&quot;,
                  &quot;type&quot;: &quot;address&quot;
                }
              ],
              &quot;payable&quot;: false,
              &quot;stateMutability&quot;: &quot;view&quot;,
              &quot;type&quot;: &quot;function&quot;
            },
            {
              &quot;constant&quot;: false,
              &quot;inputs&quot;: [
                {
                  &quot;name&quot;: &quot;_addr&quot;,
                  &quot;type&quot;: &quot;address&quot;
                },
                {
                  &quot;name&quot;: &quot;_newManager&quot;,
                  &quot;type&quot;: &quot;address&quot;
                }
              ],
              &quot;name&quot;: &quot;setManager&quot;,
              &quot;outputs&quot;: [],
              &quot;payable&quot;: false,
              &quot;stateMutability&quot;: &quot;nonpayable&quot;,
              &quot;type&quot;: &quot;function&quot;
            },
            {
              &quot;constant&quot;: true,
              &quot;inputs&quot;: [
                {
                  &quot;name&quot;: &quot;_interfaceName&quot;,
                  &quot;type&quot;: &quot;string&quot;
                }
              ],
              &quot;name&quot;: &quot;interfaceHash&quot;,
              &quot;outputs&quot;: [
                {
                  &quot;name&quot;: &quot;&quot;,
                  &quot;type&quot;: &quot;bytes32&quot;
                }
              ],
              &quot;payable&quot;: false,
              &quot;stateMutability&quot;: &quot;pure&quot;,
              &quot;type&quot;: &quot;function&quot;
            },
            {
              &quot;constant&quot;: false,
              &quot;inputs&quot;: [
                {
                  &quot;name&quot;: &quot;_contract&quot;,
                  &quot;type&quot;: &quot;address&quot;
                },
                {
                  &quot;name&quot;: &quot;_interfaceId&quot;,
                  &quot;type&quot;: &quot;bytes4&quot;
                }
              ],
              &quot;name&quot;: &quot;updateERC165Cache&quot;,
              &quot;outputs&quot;: [],
              &quot;payable&quot;: false,
              &quot;stateMutability&quot;: &quot;nonpayable&quot;,
              &quot;type&quot;: &quot;function&quot;
            },
            {
              &quot;constant&quot;: true,
              &quot;inputs&quot;: [
                {
                  &quot;name&quot;: &quot;_addr&quot;,
                  &quot;type&quot;: &quot;address&quot;
                },
                {
                  &quot;name&quot;: &quot;_interfaceHash&quot;,
                  &quot;type&quot;: &quot;bytes32&quot;
                }
              ],
              &quot;name&quot;: &quot;getInterfaceImplementer&quot;,
              &quot;outputs&quot;: [
                {
                  &quot;name&quot;: &quot;&quot;,
                  &quot;type&quot;: &quot;address&quot;
                }
              ],
              &quot;payable&quot;: false,
              &quot;stateMutability&quot;: &quot;view&quot;,
              &quot;type&quot;: &quot;function&quot;
            },
            {
              &quot;constant&quot;: true,
              &quot;inputs&quot;: [
                {
                  &quot;name&quot;: &quot;_contract&quot;,
                  &quot;type&quot;: &quot;address&quot;
                },
                {
                  &quot;name&quot;: &quot;_interfaceId&quot;,
                  &quot;type&quot;: &quot;bytes4&quot;
                }
              ],
              &quot;name&quot;: &quot;implementsERC165InterfaceNoCache&quot;,
              &quot;outputs&quot;: [
                {
                  &quot;name&quot;: &quot;&quot;,
                  &quot;type&quot;: &quot;bool&quot;
                }
              ],
              &quot;payable&quot;: false,
              &quot;stateMutability&quot;: &quot;view&quot;,
              &quot;type&quot;: &quot;function&quot;
            },
            {
              &quot;constant&quot;: true,
              &quot;inputs&quot;: [
                {
                  &quot;name&quot;: &quot;_contract&quot;,
                  &quot;type&quot;: &quot;address&quot;
                },
                {
                  &quot;name&quot;: &quot;_interfaceId&quot;,
                  &quot;type&quot;: &quot;bytes4&quot;
                }
              ],
              &quot;name&quot;: &quot;implementsERC165Interface&quot;,
              &quot;outputs&quot;: [
                {
                  &quot;name&quot;: &quot;&quot;,
                  &quot;type&quot;: &quot;bool&quot;
                }
              ],
              &quot;payable&quot;: false,
              &quot;stateMutability&quot;: &quot;view&quot;,
              &quot;type&quot;: &quot;function&quot;
            },
            {
              &quot;anonymous&quot;: false,
              &quot;inputs&quot;: [
                {
                  &quot;indexed&quot;: true,
                  &quot;name&quot;: &quot;addr&quot;,
                  &quot;type&quot;: &quot;address&quot;
                },
                {
                  &quot;indexed&quot;: true,
                  &quot;name&quot;: &quot;interfaceHash&quot;,
                  &quot;type&quot;: &quot;bytes32&quot;
                },
                {
                  &quot;indexed&quot;: true,
                  &quot;name&quot;: &quot;implementer&quot;,
                  &quot;type&quot;: &quot;address&quot;
                }
              ],
              &quot;name&quot;: &quot;InterfaceImplementerSet&quot;,
              &quot;type&quot;: &quot;event&quot;
            },
            {
              &quot;anonymous&quot;: false,
              &quot;inputs&quot;: [
                {
                  &quot;indexed&quot;: true,
                  &quot;name&quot;: &quot;addr&quot;,
                  &quot;type&quot;: &quot;address&quot;
                },
                {
                  &quot;indexed&quot;: true,
                  &quot;name&quot;: &quot;newManager&quot;,
                  &quot;type&quot;: &quot;address&quot;
                }
              ],
              &quot;name&quot;: &quot;ManagerChanged&quot;,
              &quot;type&quot;: &quot;event&quot;
            }
          ],
          &quot;devdoc&quot;: {
            &quot;author&quot;: &quot;Jordi Baylina and Jacques Dafflon&quot;,
            &quot;methods&quot;: {
              &quot;getInterfaceImplementer(address,bytes32)&quot;: {
                &quot;params&quot;: {
                  &quot;_addr&quot;: &quot;Address being queried for the implementer of an interface. (If &apos;_addr&apos; is the zero address then &apos;msg.sender&apos; is assumed.)&quot;,
                  &quot;_interfaceHash&quot;: &quot;Keccak256 hash of the name of the interface as a string. E.g., &apos;web3.utils.keccak256(\&quot;ERC777TokensRecipient\&quot;)&apos; for the &apos;ERC777TokensRecipient&apos; interface.&quot;
                },
                &quot;return&quot;: &quot;The address of the contract which implements the interface &apos;_interfaceHash&apos; for &apos;_addr&apos; or &apos;0&apos; if &apos;_addr&apos; did not register an implementer for this interface.&quot;
              },
              &quot;getManager(address)&quot;: {
                &quot;params&quot;: {
                  &quot;_addr&quot;: &quot;Address for which to return the manager.&quot;
                },
                &quot;return&quot;: &quot;Address of the manager for a given address.&quot;
              },
              &quot;implementsERC165Interface(address,bytes4)&quot;: {
                &quot;params&quot;: {
                  &quot;_contract&quot;: &quot;Address of the contract to check.&quot;,
                  &quot;_interfaceId&quot;: &quot;ERC165 interface to check.&quot;
                },
                &quot;return&quot;: &quot;True if &apos;_contract&apos; implements &apos;_interfaceId&apos;, false otherwise.&quot;
              },
              &quot;implementsERC165InterfaceNoCache(address,bytes4)&quot;: {
                &quot;params&quot;: {
                  &quot;_contract&quot;: &quot;Address of the contract to check.&quot;,
                  &quot;_interfaceId&quot;: &quot;ERC165 interface to check.&quot;
                },
                &quot;return&quot;: &quot;True if &apos;_contract&apos; implements &apos;_interfaceId&apos;, false otherwise.&quot;
              },
              &quot;interfaceHash(string)&quot;: {
                &quot;params&quot;: {
                  &quot;_interfaceName&quot;: &quot;Name of the interface.&quot;
                },
                &quot;return&quot;: &quot;The keccak256 hash of an interface name.&quot;
              },
              &quot;setInterfaceImplementer(address,bytes32,address)&quot;: {
                &quot;params&quot;: {
                  &quot;_addr&quot;: &quot;Address for which to set the interface. (If &apos;_addr&apos; is the zero address then &apos;msg.sender&apos; is assumed.)&quot;,
                  &quot;_implementer&quot;: &quot;Contract address implementing &apos;_interfaceHash&apos; for &apos;_addr&apos;.&quot;,
                  &quot;_interfaceHash&quot;: &quot;Keccak256 hash of the name of the interface as a string. E.g., &apos;web3.utils.keccak256(\&quot;ERC777TokensRecipient\&quot;)&apos; for the &apos;ERC777TokensRecipient&apos; interface.&quot;
                }
              },
              &quot;setManager(address,address)&quot;: {
                &quot;params&quot;: {
                  &quot;_addr&quot;: &quot;Address for which to set the new manager.&quot;,
                  &quot;_newManager&quot;: &quot;Address of the new manager for &apos;addr&apos;. (Pass &apos;0x0&apos; to reset the manager to &apos;_addr&apos;.)&quot;
                }
              },
              &quot;updateERC165Cache(address,bytes4)&quot;: {
                &quot;params&quot;: {
                  &quot;_contract&quot;: &quot;Address of the contract for which to update the cache.&quot;,
                  &quot;_interfaceId&quot;: &quot;ERC165 interface for which to update the cache.&quot;
                }
              }
            },
            &quot;title&quot;: &quot;ERC1820 Pseudo-introspection Registry Contract&quot;
          },
          &quot;userdoc&quot;: {
            &quot;methods&quot;: {
              &quot;getInterfaceImplementer(address,bytes32)&quot;: {
                &quot;notice&quot;: &quot;Query if an address implements an interface and through which contract.&quot;
              },
              &quot;getManager(address)&quot;: {
                &quot;notice&quot;: &quot;Get the manager of an address.&quot;
              },
              &quot;implementsERC165InterfaceNoCache(address,bytes4)&quot;: {
                &quot;notice&quot;: &quot;Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.&quot;
              },
              &quot;interfaceHash(string)&quot;: {
                &quot;notice&quot;: &quot;Compute the keccak256 hash of an interface given its name.&quot;
              },
              &quot;setInterfaceImplementer(address,bytes32,address)&quot;: {
                &quot;notice&quot;: &quot;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.)&quot;
              },
              &quot;setManager(address,address)&quot;: {
                &quot;notice&quot;: &quot;Sets &apos;_newManager&apos; as manager for &apos;_addr&apos;. The new manager will be able to call &apos;setInterfaceImplementer&apos; for &apos;_addr&apos;.&quot;
              },
              &quot;updateERC165Cache(address,bytes4)&quot;: {
                &quot;notice&quot;: &quot;Updates the cache with whether the contract implements an ERC165 interface or not.&quot;
              }
            },
            &quot;notice&quot;: &quot;This contract is the official implementation of the ERC1820 Registry.For more details, see https://eips.ethereum.org/EIPS/eip-1820&quot;
          }
        },
        &quot;settings&quot;: {
          &quot;compilationTarget&quot;: {
            &quot;./contracts/ERC1820Registry.sol&quot;: &quot;ERC1820Registry&quot;
          },
          &quot;evmVersion&quot;: &quot;byzantium&quot;,
          &quot;libraries&quot;: {},
          &quot;optimizer&quot;: {
            &quot;enabled&quot;: true,
            &quot;runs&quot;: 200
          },
          &quot;remappings&quot;: []
        },
        &quot;sources&quot;: {
          &quot;./contracts/ERC1820Registry.sol&quot;: {
            &quot;content&quot;: &quot;/* ERC1820 Pseudo-introspection Registry Contract\n * This standard defines a universal registry smart contract where any address (contract or regular account) can\n * register which interface it supports and which smart contract is responsible for its implementation.\n *\n * Written in 2019 by Jordi Baylina and Jacques Dafflon\n *\n * To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to\n * this software to the public domain worldwide. This software is distributed without any warranty.\n *\n * You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see\n * &lt;http://creativecommons.org/publicdomain/zero/1.0/&gt;.\n *\n *    ███████╗██████╗  ██████╗ ██╗ █████╗ ██████╗  ██████╗\n *    ██╔════╝██╔══██╗██╔════╝███║██╔══██╗╚════██╗██╔═████╗\n *    █████╗  ██████╔╝██║     ╚██║╚█████╔╝ █████╔╝██║██╔██║\n *    ██╔══╝  ██╔══██╗██║      ██║██╔══██╗██╔═══╝ ████╔╝██║\n *    ███████╗██║  ██║╚██████╗ ██║╚█████╔╝███████╗╚██████╔╝\n *    ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚═╝ ╚════╝ ╚══════╝ ╚═════╝\n *\n *    ██████╗ ███████╗ ██████╗ ██╗███████╗████████╗██████╗ ██╗   ██╗\n *    ██╔══██╗██╔════╝██╔════╝ ██║██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝\n *    ██████╔╝█████╗  ██║  ███╗██║███████╗   ██║   ██████╔╝ ╚████╔╝\n *    ██╔══██╗██╔══╝  ██║   ██║██║╚════██║   ██║   ██╔══██╗  ╚██╔╝\n *    ██║  ██║███████╗╚██████╔╝██║███████║   ██║   ██║  ██║   ██║\n *    ╚═╝  ╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝   ╚═╝\n *\n */\npragma solidity 0.5.3;\n// IV is value needed to have a vanity address starting with &apos;0x1820&apos;.\n// IV: 53759\n\n/// @dev The interface a contract MUST implement if it is the implementer of\n/// some (other) interface for any address other than itself.\ninterface ERC1820ImplementerInterface {\n    /// @notice Indicates whether the contract implements the interface &apos;interfaceHash&apos; for the address &apos;addr&apos; or not.\n    /// @param interfaceHash keccak256 hash of the name of the interface\n    /// @param addr Address for which the contract will implement the interface\n    /// @return ERC1820_ACCEPT_MAGIC only if the contract implements &apos;interfaceHash&apos; for the address &apos;addr&apos;.\n    function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32);\n}\n\n\n/// @title ERC1820 Pseudo-introspection Registry Contract\n/// @author Jordi Baylina and Jacques Dafflon\n/// @notice This contract is the official implementation of the ERC1820 Registry.\n/// @notice For more details, see https://eips.ethereum.org/EIPS/eip-1820\ncontract ERC1820Registry {\n    /// @notice ERC165 Invalid ID.\n    bytes4 constant internal INVALID_ID = 0xffffffff;\n    /// @notice Method ID for the ERC165 supportsInterface method (= `bytes4(keccak256(&apos;supportsInterface(bytes4)&apos;))`).\n    bytes4 constant internal ERC165ID = 0x01ffc9a7;\n    /// @notice Magic value which is returned if a contract implements an interface on behalf of some other address.\n    bytes32 constant internal ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked(\&quot;ERC1820_ACCEPT_MAGIC\&quot;));\n\n    /// @notice mapping from addresses and interface hashes to their implementers.\n    mapping(address =&gt; mapping(bytes32 =&gt; address)) internal interfaces;\n    /// @notice mapping from addresses to their manager.\n    mapping(address =&gt; address) internal managers;\n    /// @notice flag for each address and erc165 interface to indicate if it is cached.\n    mapping(address =&gt; mapping(bytes4 =&gt; bool)) internal erc165Cached;\n\n    /// @notice Indicates a contract is the &apos;implementer&apos; of &apos;interfaceHash&apos; for &apos;addr&apos;.\n    event InterfaceImplementerSet(address indexed addr, bytes32 indexed interfaceHash, address indexed implementer);\n    /// @notice Indicates &apos;newManager&apos; is the address of the new manager for &apos;addr&apos;.\n    event ManagerChanged(address indexed addr, address indexed newManager);\n\n    /// @notice Query if an address implements an interface and through which contract.\n    /// @param _addr Address being queried for the implementer of an interface.\n    /// (If &apos;_addr&apos; is the zero address then &apos;msg.sender&apos; is assumed.)\n    /// @param _interfaceHash Keccak256 hash of the name of the interface as a string.\n    /// E.g., &apos;web3.utils.keccak256(\&quot;ERC777TokensRecipient\&quot;)&apos; for the &apos;ERC777TokensRecipient&apos; interface.\n    /// @return The address of the contract which implements the interface &apos;_interfaceHash&apos; for &apos;_addr&apos;\n    /// or &apos;0&apos; if &apos;_addr&apos; did not register an implementer for this interface.\n    function getInterfaceImplementer(address _addr, bytes32 _interfaceHash) external view returns (address) {\n        address addr = _addr == address(0) ? msg.sender : _addr;\n        if (isERC165Interface(_interfaceHash)) {\n            bytes4 erc165InterfaceHash = bytes4(_interfaceHash);\n            return implementsERC165Interface(addr, erc165InterfaceHash) ? addr : address(0);\n        }\n        return interfaces[addr][_interfaceHash];\n    }\n\n    /// @notice Sets the contract which implements a specific interface for an address.\n    /// Only the manager defined for that address can set it.\n    /// (Each address is the manager for itself until it sets a new manager.)\n    /// @param _addr Address for which to set the interface.\n    /// (If &apos;_addr&apos; is the zero address then &apos;msg.sender&apos; is assumed.)\n    /// @param _interfaceHash Keccak256 hash of the name of the interface as a string.\n    /// E.g., &apos;web3.utils.keccak256(\&quot;ERC777TokensRecipient\&quot;)&apos; for the &apos;ERC777TokensRecipient&apos; interface.\n    /// @param _implementer Contract address implementing &apos;_interfaceHash&apos; for &apos;_addr&apos;.\n    function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) external {\n        address addr = _addr == address(0) ? msg.sender : _addr;\n        require(getManager(addr) == msg.sender, \&quot;Not the manager\&quot;);\n\n        require(!isERC165Interface(_interfaceHash), \&quot;Must not be an ERC165 hash\&quot;);\n        if (_implementer != address(0) &amp;&amp; _implementer != msg.sender) {\n            require(\n                ERC1820ImplementerInterface(_implementer)\n                    .canImplementInterfaceForAddress(_interfaceHash, addr) == ERC1820_ACCEPT_MAGIC,\n                \&quot;Does not implement the interface\&quot;\n            );\n        }\n        interfaces[addr][_interfaceHash] = _implementer;\n        emit InterfaceImplementerSet(addr, _interfaceHash, _implementer);\n    }\n\n    /// @notice Sets &apos;_newManager&apos; as manager for &apos;_addr&apos;.\n    /// The new manager will be able to call &apos;setInterfaceImplementer&apos; for &apos;_addr&apos;.\n    /// @param _addr Address for which to set the new manager.\n    /// @param _newManager Address of the new manager for &apos;addr&apos;. (Pass &apos;0x0&apos; to reset the manager to &apos;_addr&apos;.)\n    function setManager(address _addr, address _newManager) external {\n        require(getManager(_addr) == msg.sender, \&quot;Not the manager\&quot;);\n        managers[_addr] = _newManager == _addr ? address(0) : _newManager;\n        emit ManagerChanged(_addr, _newManager);\n    }\n\n    /// @notice Get the manager of an address.\n    /// @param _addr Address for which to return the manager.\n    /// @return Address of the manager for a given address.\n    function getManager(address _addr) public view returns(address) {\n        // By default the manager of an address is the same address\n        if (managers[_addr] == address(0)) {\n            return _addr;\n        } else {\n            return managers[_addr];\n        }\n    }\n\n    /// @notice Compute the keccak256 hash of an interface given its name.\n    /// @param _interfaceName Name of the interface.\n    /// @return The keccak256 hash of an interface name.\n    function interfaceHash(string calldata _interfaceName) external pure returns(bytes32) {\n        return keccak256(abi.encodePacked(_interfaceName));\n    }\n\n    /* --- ERC165 Related Functions --- */\n    /* --- Developed in collaboration with William Entriken. --- */\n\n    /// @notice Updates the cache with whether the contract implements an ERC165 interface or not.\n    /// @param _contract Address of the contract for which to update the cache.\n    /// @param _interfaceId ERC165 interface for which to update the cache.\n    function updateERC165Cache(address _contract, bytes4 _interfaceId) external {\n        interfaces[_contract][_interfaceId] = implementsERC165InterfaceNoCache(\n            _contract, _interfaceId) ? _contract : address(0);\n        erc165Cached[_contract][_interfaceId] = true;\n    }\n\n    /// @notice Checks whether a contract implements an ERC165 interface or not.\n    //  If the result is not cached a direct lookup on the contract address is performed.\n    //  If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling\n    //  &apos;updateERC165Cache&apos; with the contract address.\n    /// @param _contract Address of the contract to check.\n    /// @param _interfaceId ERC165 interface to check.\n    /// @return True if &apos;_contract&apos; implements &apos;_interfaceId&apos;, false otherwise.\n    function implementsERC165Interface(address _contract, bytes4 _interfaceId) public view returns (bool) {\n        if (!erc165Cached[_contract][_interfaceId]) {\n            return implementsERC165InterfaceNoCache(_contract, _interfaceId);\n        }\n        return interfaces[_contract][_interfaceId] == _contract;\n    }\n\n    /// @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.\n    /// @param _contract Address of the contract to check.\n    /// @param _interfaceId ERC165 interface to check.\n    /// @return True if &apos;_contract&apos; implements &apos;_interfaceId&apos;, false otherwise.\n    function implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) public view returns (bool) {\n        uint256 success;\n        uint256 result;\n\n        (success, result) = noThrowCall(_contract, ERC165ID);\n        if (success == 0 || result == 0) {\n            return false;\n        }\n\n        (success, result) = noThrowCall(_contract, INVALID_ID);\n        if (success == 0 || result != 0) {\n            return false;\n        }\n\n        (success, result) = noThrowCall(_contract, _interfaceId);\n        if (success == 1 &amp;&amp; result == 1) {\n            return true;\n        }\n        return false;\n    }\n\n    /// @notice Checks whether the hash is a ERC165 interface (ending with 28 zeroes) or not.\n    /// @param _interfaceHash The hash to check.\n    /// @return True if &apos;_interfaceHash&apos; is an ERC165 interface (ending with 28 zeroes), false otherwise.\n    function isERC165Interface(bytes32 _interfaceHash) internal pure returns (bool) {\n        return _interfaceHash &amp; 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0;\n    }\n\n    /// @dev Make a call on a contract without throwing if the function does not exist.\n    function noThrowCall(address _contract, bytes4 _interfaceId)\n        internal view returns (uint256 success, uint256 result)\n    {\n        bytes4 erc165ID = ERC165ID;\n\n        assembly {\n            let x := mload(0x40)               // Find empty storage location using \&quot;free memory pointer\&quot;\n            mstore(x, erc165ID)                // Place signature at beginning of empty storage\n            mstore(add(x, 0x04), _interfaceId) // Place first argument directly next to signature\n\n            success := staticcall(\n                30000,                         // 30k gas\n                _contract,                     // To addr\n                x,                             // Inputs are stored at location x\n                0x24,                          // Inputs are 36 (4 + 32) bytes long\n                x,                             // Store output over input (saves space)\n                0x20                           // Outputs are 32 bytes long\n            )\n\n            result := mload(x)                 // Load the result\n        }\n    }\n}\n&quot;,
            &quot;keccak256&quot;: &quot;0x64025ecebddb6e126a5075c1fd6c01de2840492668e2909cef7157040a9d1945&quot;
          }
        },
        &quot;version&quot;: 1
      }
```

&lt;/details&gt;

### Interface Name

Any interface name is hashed using `keccak256` and sent to `getInterfaceImplementer()`.

If the interface is part of a standard, it is best practice to explicitly state the interface name and link to this published [ERC-1820] such that other people don&apos;t have to come here to look up these rules.

For convenience, the registry provides a function to compute the hash on-chain:

``` solidity
function interfaceHash(string _interfaceName) public pure returns(bytes32)
```

Compute the keccak256 hash of an interface given its name.

&gt; &lt;small&gt;**identifier:** `65ba36c1`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceName`: Name of the interface.&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** The `keccak256` hash of an interface name.&lt;/small&gt;

#### **Approved ERCs**

If the interface is part of an approved ERC, it MUST be named `ERC###XXXXX` where `###` 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.

Examples:

- `keccak256(&quot;ERC20Token&quot;)`
- `keccak256(&quot;ERC777Token&quot;)`
- `keccak256(&quot;ERC777TokensSender&quot;)`
- `keccak256(&quot;ERC777TokensRecipient&quot;)`

#### **[ERC-165] Compatible Interfaces**

&gt; The compatibility with [ERC-165], including the [ERC165 Cache], has been designed and developed with [William Entriken].

Any interface where the last 28 bytes are zeroes (`0`) SHALL be considered an [ERC-165] interface.

**[ERC-165] Lookup**

Anyone can explicitly check if a contract implements an [ERC-165] interface using the registry by calling one of the two functions below:

``` solidity
function implementsERC165Interface(address _contract, bytes4 _interfaceId) public view returns (bool)
```

Checks whether a contract implements an [ERC-165] interface or not.

If the result is not cached a direct lookup on the contract address is performed.

*NOTE*: If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling `updateERC165Cache` with the contract address.
(See [ERC165 Cache] for more details.)

&gt; &lt;small&gt;**identifier:** `f712f3e8`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_contract`: Address of the contract to check.&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceId`: [ERC-165] interface to check.&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** `true` if `_contract` implements `_interfaceId`, `false` otherwise.&lt;/small&gt;

``` solidity
function implementsERC165InterfaceNoCache(address _contract, bytes4 _interfaceId) public view returns (bool)
```

Checks whether a contract implements an [ERC-165] interface or not without using nor updating the cache.

&gt; &lt;small&gt;**identifier:** `b7056765`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_contract`: Address of the contract to check.&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceId`: [ERC-165] interface to check.&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** `true` if `_contract` implements `_interfaceId`, false otherwise.&lt;/small&gt;

**[ERC-165] Cache** &lt;a id=&quot;erc165-cache&quot;&gt;&lt;/a&gt;

Whether a contract implements an [ERC-165] interface or not can be cached manually to save gas.

If a contract dynamically changes its interface and relies on the [ERC-165] cache of the [ERC-1820] 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&apos;s behalf.

The cache update MUST be done using the `updateERC165Cache` function:

``` solidity
function updateERC165Cache(address _contract, bytes4 _interfaceId) external
```

&gt; &lt;small&gt;**identifier:** `a41e7d51`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_contract`: Address of the contract for which to update the cache.&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceId`: [ERC-165] interface for which to update the cache.&lt;/small&gt;

#### **Private User-defined Interfaces**

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.

### Set An Interface For An Address

For any address to set a contract as the interface implementation, it must call the following function of the [ERC-1820] registry:

``` solidity
function setInterfaceImplementer(address _addr, bytes32 _interfaceHash, address _implementer) external
```

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, see the [manager] section for more details.)

*NOTE*: If  `_addr` and `_implementer` are two different addresses, then:

- The `_implementer` MUST implement the `ERC1820ImplementerInterface` (detailed below).
- Calling `canImplementInterfaceForAddress` on `_implementer` with the given `_addr` and  `_interfaceHash` MUST return the `ERC1820_ACCEPT_MAGIC` value.

*NOTE*: The `_interfaceHash` MUST NOT be an [ERC-165] interface---it MUST NOT end with 28 zeroes (`0`).

*NOTE*: The `_addr` MAY be `0`, then `msg.sender` 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.

&gt; &lt;small&gt;**identifier:** `29965a1d`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_addr`: Address for which to set the interface. (If `_addr` is the zero address then `msg.sender` is assumed.)&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceHash`: Keccak256 hash of the name of the interface as a string, for example `web3.utils.keccak256(&apos;ERC777TokensRecipient&apos;)` for the ERC777TokensRecipient interface.&lt;/small&gt;  
&gt; &lt;small&gt;`_implementer`: Contract implementing `_interfaceHash` for `_addr`.&lt;/small&gt;

### Get An Implementation Of An Interface For An Address

Anyone MAY query the [ERC-1820] Registry to obtain the address of a contract implementing an interface on behalf of some address using the `getInterfaceImplementer` function.

``` solidity
function getInterfaceImplementer(address _addr, bytes32 _interfaceHash) external view returns (address)
```

Query if an address implements an interface and through which contract.

*NOTE*: If the last 28 bytes of the `_interfaceHash` are zeroes (`0`), then the first 4 bytes are considered an [ERC-165] interface and the registry SHALL forward the call to the contract at `_addr` to see if it implements the [ERC-165] interface (the first 4 bytes of `_interfaceHash`). 
The registry SHALL also cache [ERC-165] queries to reduce gas consumption. Anyone MAY call the `erc165UpdateCache` function to update whether a contract implements an interface or not.

*NOTE*: The `_addr` MAY be `0`, then `msg.sender` is assumed. 
This default value is consistent with the behavior of the `setInterfaceImplementer` function and simplifies interactions via multisigs where the data of the transaction to sign is constant regardless of the address of the multisig instance.

&gt; &lt;small&gt;**identifier:** `aabbb8ca`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_addr`: Address being queried for the implementer of an interface. (If `_addr` is the zero address then `msg.sender` is assumed.)&lt;/small&gt;  
&gt; &lt;small&gt;`_interfaceHash`: keccak256 hash of the name of the interface as a string. E.g. `web3.utils.keccak256(&apos;ERC777Token&apos;)`&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** The address of the contract which implements the interface `_interfaceHash` for `_addr` or `0` if `_addr` did not register an implementer for this interface.&lt;/small&gt;


### Interface Implementation (`ERC1820ImplementerInterface`)

``` solidity
interface ERC1820ImplementerInterface {
    /// @notice Indicates whether the contract implements the interface `interfaceHash` for the address `addr` or not.
    /// @param interfaceHash keccak256 hash of the name of the interface
    /// @param addr Address for which the contract will implement the interface
    /// @return ERC1820_ACCEPT_MAGIC only if the contract implements `interfaceHash` for the address `addr`.
    function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32);
}
```

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 `ERC1820ImplementerInterface` shown above.

``` solidity
function canImplementInterfaceForAddress(bytes32 interfaceHash, address addr) external view returns(bytes32)
```

Indicates whether a contract implements an interface (`interfaceHash`) for a given address (`addr`).

If a contract implements the interface (`interfaceHash`) for a given address (`addr`), it MUST return `ERC1820_ACCEPT_MAGIC` when called with the `addr` and the `interfaceHash`. 
If it does not implement the `interfaceHash` for a given address (`addr`), it MUST NOT return `ERC1820_ACCEPT_MAGIC`.

&gt; &lt;small&gt;**identifier:** `f0083250`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`interfaceHash`: Hash of the interface which is implemented&lt;/small&gt;  
&gt; &lt;small&gt;`addr`: Address for which the interface is implemented&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** `ERC1820_ACCEPT_MAGIC` only if the contract implements `ìnterfaceHash` for the address `addr`.&lt;/small&gt;

The special value `ERC1820_ACCEPT_MAGIC` is defined as the `keccka256` hash of the string `&quot;ERC1820_ACCEPT_MAGIC&quot;`.

``` solidity
bytes32 constant internal ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked(&quot;ERC1820_ACCEPT_MAGIC&quot;));
```

&gt; The reason to return `ERC1820_ACCEPT_MAGIC` instead of a boolean is to prevent cases where a contract fails to implement the `canImplementInterfaceForAddress` but implements a fallback function which does not throw. In this case, since `canImplementInterfaceForAddress` does not exist, the fallback function is called instead, executed without throwing and returns `1`. Thus making it appear as if `canImplementInterfaceForAddress` returned `true`.

### Manager

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.

The manager can transfer its role to another address by calling `setManager` on the registry contract with the address for which to transfer the manager and the address of the new manager.

**`setManager` Function**

``` solidity
function setManager(address _addr, address _newManager) external
```

Sets `_newManager` as manager for `_addr`.

The new manager will be able to call `setInterfaceImplementer` for `_addr`.

If `_newManager` is `0x0`, the manager is reset to `_addr` itself as the manager.

&gt; &lt;small&gt;**identifier:** `5df8122f`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_addr`: Address for which to set the new manager.&lt;/small&gt;  
&gt; &lt;small&gt;`_newManager`: The address of the new manager for `_addr`. (Pass `0x0` to reset the manager to `_addr`.)&lt;/small&gt;

**`getManager` Function**

``` solidity
function getManager(address _addr) public view returns(address)
```

Get the manager of an address.

&gt; &lt;small&gt;**identifier:** `3d584063`&lt;/small&gt;  
&gt; &lt;small&gt;**parameters**&lt;/small&gt;  
&gt; &lt;small&gt;`_addr`: Address for which to return the manager.&lt;/small&gt;  
&gt; &lt;small&gt;**returns:** Address of the manager for a given address.&lt;/small&gt;

## Rationale

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.

The registry can also act as a [ERC-165] cache in order to save gas when looking up if a contract implements a specific [ERC-165] 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 `updateERC165Cache` function.

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.

## Backward Compatibility

This standard is backward compatible with [ERC-165], as both methods MAY be implemented without conflicting with each other.

## Test Cases

Please check the [0xjac/ERC1820] repository for the full test suite.

## Implementation

The implementation is available in the repo: [0xjac/ERC1820].

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

[EIP-155]: ./eip-155.md
[ERC-165]: ./eip-165.md
[ERC-672]: https://github.com/ethereum/EIPs/issues/672
[ERC-820]: ./eip-820.md
[ERC-1820]: ./eip-1820.md
[ERC1820 registry smart contract]: https://github.com/0xjac/ERC1820/blob/master/contracts/ERC1820Registry.sol
[erc1820-annoucement]: https://github.com/ethereum/EIPs/issues/820#issuecomment-464109166
[erc820-bug]: https://github.com/ethereum/EIPs/issues/820#issuecomment-452465748
[erc820-fix]: https://github.com/ethereum/EIPs/issues/820#issuecomment-454021564
[manager]: #manager
[lookup]: #get-an-implementation-of-an-interface-for-an-address
[ERC165 Cache]: #erc165-cache
[Nick&apos;s article]: https://medium.com/@weka/how-to-send-ether-to-11-440-people-187e332566b7
[0xjac/ERC1820]: https://github.com/0xjac/ERC1820
[Nick]: https://github.com/Arachnid/
[William Entriken]: https://github.com/fulldecent
[ENS]: https://ens.domains/
</description>
        <pubDate>Mon, 04 Mar 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1820</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1820</guid>
      </item>
    
      <item>
        <title>Universal Upgradeable Proxy Standard (UUPS)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-1822-universal-upgradeable-proxy-standard-uups</comments>
        
        <description>## Simple Summary

Standard upgradeable proxy contract.

## Abstract

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&apos;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.

## Motivation

- Improve upon existing proxy implementations to improve developer experience for deploying and maintaining Proxy and Logic Contracts.

- Standardize and improve the methods for verifying the bytecode used by the Proxy Contract.

## Terminology

- `delegatecall()` - Function in contract **A** which allows an external contract **B** (delegating) to modify **A**&apos;s storage (see diagram below, [Solidity docs](https://solidity.readthedocs.io/en/v0.5.3/introduction-to-smart-contracts.html#delegatecall-callcode-and-libraries))
- **Proxy Contract** - The contract **A** which stores data, but uses the logic of external contract **B** by way of `delegatecall()`.
- **Logic Contract** - The contract **B** which contains the logic used by Proxy Contract **A**
- **Proxiable Contract** - Inherited in Logic Contract **B** to provide the upgrade functionality

![](../assets/eip-1822/proxy-diagram.png)

## Specification

The Proxy Contract proposed here should be deployed _as is_, 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/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.

### Proxy Contract

#### Functions

##### `fallback`

The proposed fallback function follows the common pattern seen in other Proxy Contract implementations such as [Zeppelin][1] or [Gnosis][2].

However, rather than forcing use of a variable, the address of the Logic Contract is stored at the defined storage position `keccak256(&quot;PROXIABLE&quot;)`. This eliminates the possibility of collision between variables in the Proxy and Logic Contracts, thus providing &quot;universal&quot; compatibility with any Logic Contract.

```javascript
function() external payable {
    assembly { // solium-disable-line
        let contractLogic := sload(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7)
        calldatacopy(0x0, 0x0, calldatasize)
        let success := delegatecall(sub(gas, 10000), contractLogic, 0x0, calldatasize, 0, 0)
        let retSz := returndatasize
        returndatacopy(0, 0, retSz)
        switch success
        case 0 {
            revert(0, retSz)
        }
        default {
            return(0, retSz)
        }
    }
}
```

#### `constructor`

The proposed constructor accepts any number of arguments of any type, and thus is compatible with any Logic Contract constructor function.

In addition, the arbitrary nature of the Proxy Contract&apos;s constructor provides the ability to select from one or more constructor functions available in the Logic Contract source code (e.g., `constructor1`, `constructor2`, ... 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.

It&apos;s worth noting that the added functionality of supporting multiple constructors does not inhibit verification of the Proxy Contract&apos;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.

The contract below shows the proposed implementation of the Proxy Contract.

```javascript
contract Proxy {
    // Code position in storage is keccak256(&quot;PROXIABLE&quot;) = &quot;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&quot;
    constructor(bytes memory constructData, address contractLogic) public {
        // save the code address
        assembly { // solium-disable-line
            sstore(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7, contractLogic)
        }
        (bool success, bytes memory _ ) = contractLogic.delegatecall(constructData); // solium-disable-line
        require(success, &quot;Construction failed&quot;);
    }

    function() external payable {
        assembly { // solium-disable-line
            let contractLogic := sload(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7)
            calldatacopy(0x0, 0x0, calldatasize)
            let success := delegatecall(sub(gas, 10000), contractLogic, 0x0, calldatasize, 0, 0)
            let retSz := returndatasize
            returndatacopy(0, 0, retSz)
            switch success
            case 0 {
                revert(0, retSz)
            }
            default {
                return(0, retSz)
            }
        }
    }
}
```

### Proxiable Contract

The Proxiable Contract is included in the Logic Contract, and provides the functions needed to perform an upgrade. The compatibility check `proxiable` prevents irreparable updates during an upgrade.

&gt; :warning: Warning: `updateCodeAddress` and `proxiable` 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 [Restricting dangerous functions](#restricting-dangerous-functions)

#### Functions

##### `proxiable`

Compatibility check to ensure the new Logic Contract implements the Universal Upgradeable Proxy Standard. Note that in order to support future implementations, the `bytes32` comparison could be changed e.g., `keccak256(&quot;PROXIABLE-ERC1822-v1&quot;)`.

##### `updateCodeAddress`

Stores the Logic Contract&apos;s address at storage `keccak256(&quot;PROXIABLE&quot;)` in the Proxy Contract.

The contract below shows the proposed implementation of the Proxiable Contract.

```javascript
contract Proxiable {
    // Code position in storage is keccak256(&quot;PROXIABLE&quot;) = &quot;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&quot;

    function updateCodeAddress(address newAddress) internal {
        require(
            bytes32(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7) == Proxiable(newAddress).proxiableUUID(),
            &quot;Not compatible&quot;
        );
        assembly { // solium-disable-line
            sstore(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7, newAddress)
        }
    }
    function proxiableUUID() public pure returns (bytes32) {
        return 0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7;
    }
}
```

## Pitfalls when using a proxy

The following common best practices should be employed for all Logic Contracts when using a proxy contract.

### Separating Variables from Logic

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

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.

### Restricting dangerous functions

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.

In order to prevent damage to the Logic Contract, we recommend restricting permissions for any potentially damaging functions to `onlyOwner`, 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 `SELFDESTRUCT`, as well functions whose code may originate externally such as `CALLCODE`, and `delegatecall()`. In the [ERC-20 Token](#erc-20-token) example below, a `LibraryLock` contract is used to prevent destruction of the logic contract.

## Examples

### Owned

In this example, we show the standard ownership example, and restrict the `updateCodeAddress` to only the owner.

```javascript
contract Owned is Proxiable {
    // ensures no one can manipulate this contract once it is deployed
    address public owner = address(1);

    function constructor1() public{
        // ensures this can be called only once per *proxy* contract deployed
        require(owner == address(0));
        owner = msg.sender;
    }

    function updateCode(address newCode) onlyOwner public {
        updateCodeAddress(newCode);
    }

    modifier onlyOwner() {
        require(msg.sender == owner, &quot;Only owner is allowed to perform this action&quot;);
        _;
    }
}
```

### ERC-20 Token

#### Proxy Contract

```javascript
pragma solidity ^0.5.1;

contract Proxy {
    // Code position in storage is keccak256(&quot;PROXIABLE&quot;) = &quot;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&quot;
    constructor(bytes memory constructData, address contractLogic) public {
        // save the code address
        assembly { // solium-disable-line
            sstore(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7, contractLogic)
        }
        (bool success, bytes memory _ ) = contractLogic.delegatecall(constructData); // solium-disable-line
        require(success, &quot;Construction failed&quot;);
    }

    function() external payable {
        assembly { // solium-disable-line
            let contractLogic := sload(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7)
            calldatacopy(0x0, 0x0, calldatasize)
            let success := delegatecall(sub(gas, 10000), contractLogic, 0x0, calldatasize, 0, 0)
            let retSz := returndatasize
            returndatacopy(0, 0, retSz)
            switch success
            case 0 {
                revert(0, retSz)
            }
            default {
                return(0, retSz)
            }
        }
    }
}
```

#### Token Logic Contract

``` javascript

contract Proxiable {
    // Code position in storage is keccak256(&quot;PROXIABLE&quot;) = &quot;0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7&quot;

    function updateCodeAddress(address newAddress) internal {
        require(
            bytes32(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7) == Proxiable(newAddress).proxiableUUID(),
            &quot;Not compatible&quot;
        );
        assembly { // solium-disable-line
            sstore(0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7, newAddress)
        }
    }
    function proxiableUUID() public pure returns (bytes32) {
        return 0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7;
    }
}


contract Owned {

    address owner;

    function setOwner(address _owner) internal {
        owner = _owner;
    }
    modifier onlyOwner() {
        require(msg.sender == owner, &quot;Only owner is allowed to perform this action&quot;);
        _;
    }
}

contract LibraryLockDataLayout {
  bool public initialized = false;
}

contract LibraryLock is LibraryLockDataLayout {
    // Ensures no one can manipulate the Logic Contract once it is deployed.
    // PARITY WALLET HACK PREVENTION

    modifier delegatedOnly() {
        require(initialized == true, &quot;The library is locked. No direct &apos;call&apos; is allowed&quot;);
        _;
    }
    function initialize() internal {
        initialized = true;
    }
}

contract ERC20DataLayout is LibraryLockDataLayout {
  uint256 public totalSupply;
  mapping(address=&gt;uint256) public tokens;
}

contract ERC20 {
    //  ...
    function transfer(address to, uint256 amount) public {
        require(tokens[msg.sender] &gt;= amount, &quot;Not enough funds for transfer&quot;);
        tokens[to] += amount;
        tokens[msg.sender] -= amount;
    }
}

contract MyToken is ERC20DataLayout, ERC20, Owned, Proxiable, LibraryLock {

    function constructor1(uint256 _initialSupply) public {
        totalSupply = _initialSupply;
        tokens[msg.sender] = _initialSupply;
        initialize();
        setOwner(msg.sender);
    }
    function updateCode(address newCode) public onlyOwner delegatedOnly  {
        updateCodeAddress(newCode);
    }
    function transfer(address to, uint256 amount) public delegatedOnly {
        ERC20.transfer(to, amount);
    }
}
```

## References

- [&quot;Escape-hatch&quot; proxy Medium Post](https://medium.com/terminaldotco/escape-hatch-proxy-efb681de108d)

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

[1]: https://github.com/maraoz/solidity-proxy/blob/master/contracts/Dispatcher.sol
[2]: https://blog.gnosis.pm/solidity-delegateproxy-contracts-e09957d0f201
</description>
        <pubDate>Mon, 04 Mar 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1822</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1822</guid>
      </item>
    
      <item>
        <title>ENS Interface Discovery</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/ens-interface-discovery/2924</comments>
        
        <description>## Simple Summary
Defines a method of associating contract interfaces with ENS names and addresses, and of discovering those interfaces.

## Abstract
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.

## Motivation
EIP 165 supports interface discovery - determining if the contract at a given address supports a requested interface. However, in many cases it&apos;s useful to be able to discover functionality associated with a name or an address that is implemented by other contracts.

For example, a token contract may not itself provide any kind of &apos;atomic swap&apos; 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.

## Specification
A new profile for ENS resolvers is defined, consisting of the following method:

```solidity
function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address);
```

The EIP-165 interface ID of this interface is `0xb8f2bbb4`.

Given an ENS name hash `node` and an EIP-165 `interfaceID`, 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.

The address returned by `interfaceImplementer` MUST refer to a smart contract.

The smart contract at the returned address SHOULD implement EIP-165.

Resolvers implementing this interface MAY utilise a fallback strategy: If no matching interface was explicitly provided by the user, query the contract returned by `addr()`, 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.

This field may be used with both forward resolution and reverse resolution.

## Rationale

A naive approach to this problem would involve adding this method directly to the target contract. However, doing this has several shortcomings:

 1. Each contract must maintain its own list of interface implementations.
 2. Modifying this list requires access controls, which the contract may not have previously required.
 3. Support for this must be designed in when the contract is written, and cannot be retrofitted afterwards.
 4. Only one canonical list of interfaces can be supported.

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.

## Backwards Compatibility
There are no backwards compatibility issues.

## Test Cases
TBD

## Implementation
The PublicResolver in the [ensdomains/resolvers](https://github.com/ensdomains/resolvers/) repository implements this interface.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 15 Mar 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1844</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1844</guid>
      </item>
    
      <item>
        <title>dType - Decentralized Type System for EVM</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1882</comments>
        
        <description>## Simple Summary

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).

## Abstract

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 `dType`) and a common interface for creating types, based on `struct`s.


## Motivation

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.

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 - [ERC-2158](https://github.com/ethereum/EIPs/pull/2158). In addition, developers can create libraries of `pure` functions that know how to interact and modify the data entries - [dType Functions Extension](https://github.com/ethereum/EIPs/issues/1921). This will effectively create the base for a general functional programming system on Ethereum, where developers can use previously created building blocks.

To summarize:

* 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.
* Functional programming becomes easier. Functions like `map`, `reduce`, `filter`, are implemented by each type library.
* 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.
* 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))
* The dType database should be part of the System Registry for the Operating System of The World Computer


## Specification

The Type Registry can have a governance protocol for its CRUD operations. However, this, and other permission guards are not covered in this proposal.

### Type Definition and Metadata

The dType registry should support the registration of Solidity&apos;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.

#### Type Definition: TypeLibrary

A type definition consists of a type library containing:
- the nominal `struct` used to define the type
- additional functions:
  - `isInstanceOf`: 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 `uint16 amount`.
  - provide HOFs such as `map`, `filter`, `reduce`
  - `structureBytes` and `destructureBytes`: 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.

A simple example is:

```solidity
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;

library myBalanceLib {

    struct myBalance {
        string accountName;
        uint256 amount;
    }

    function structureBytes(bytes memory data) pure public returns(myBalance memory balance)

    function destructureBytes(myBalance memory balance) pure public returns(bytes memory data)

    function isInstanceOf(myBalance memory balance) pure public returns(bool isInstance)

    function map(
        address callbackAddr,
        bytes4 callbackSig,
        myBalance[] memory balanceArr
    )
        view
        internal
        returns (myBalance[] memory result)
}
```

Types can also use existing types in their composition. However, this will always result in a directed acyclic graph.

```solidity
library myTokenLib {
    using myBalanceLib for myBalanceLib.myBalance;

    struct myToken {
        address token;
        myBalanceLib.myBalance;
    }
}
```

#### Type Metadata: dType Registry

Type metadata will be registered on-chain, in the dType registry contract. This consists of:
- `name` - the type&apos;s name, as it would be used in Solidity; it can be stored as a `string` or encoded as `bytes`. The name can have a human-readable part and a version number.
- `typeChoice` - used for storing additional ABI data that differentiate how types are handled on and off chain. It is defined as an `enum` with the following options: `BaseType`, `PayableFunction`, `StateFunction`, `ViewFunction`, `PureFunction`, `Event`
- `contractAddress` - the Ethereum `address` of the `TypeRootContract`. For this proposal, we can consider the Type Library address as the `TypeRootContract`. Future EIPs will make it more flexible and propose additional TypeStorage contracts that will modify the scope of `contractAddress` - [ERC-2158](https://github.com/ethereum/EIPs/pull/2158).
- `source` - a `bytes32` 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.
- `types` - metadata for subtypes: the first depth level internal components. This is an array of objects (`structs`), with the following fields:
  - `name` - the subtype name, of type `string`, similar to the above `name` definition
  - `label` - the subtype label
  - `dimensions` - `string[]` used for storing array dimensions. E.g.:
    - `[]` -&gt; `TypeA`
    - `[&quot;&quot;]` -&gt; `TypeA[]`
    - `[&quot;2&quot;]` -&gt; `TypeA[2]`
    - `[&quot;&quot;,&quot;&quot;]` -&gt; `TypeA[][]`
    - `[&quot;2&quot;,&quot;3&quot;]` -&gt; `TypeA[2][3]`

Examples of metadata, for simple, value types:
```javascript
{
  &quot;contractAddress&quot;: &quot;0x0000000000000000000000000000000000000000&quot;,
  &quot;typeChoice&quot;: 0,
  &quot;source&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,
  &quot;name&quot;: &quot;uint256&quot;,
  &quot;types&quot;: []
}

{
  &quot;contractAddress&quot;: &quot;0x0000000000000000000000000000000000000000&quot;,
  &quot;typeChoice&quot;: 0,
  &quot;source&quot;: &quot;0x0000000000000000000000000000000000000000000000000000000000000000&quot;,
  &quot;name&quot;: &quot;string&quot;,
  &quot;types&quot;: []
}
```

Composed types can be defined as:
```javascript
{
  &quot;contractAddress&quot;: &quot;0x105631C6CdDBa84D12Fa916f0045B1F97eC9C268&quot;,
  &quot;typeChoice&quot;: 0,
  &quot;source&quot;: &lt;a SWARM hash for type source code files&gt;,
  &quot;name&quot;: &quot;myBalance&quot;,
  &quot;types&quot;: [
    {&quot;name&quot;: &quot;string&quot;, &quot;label&quot;: &quot;accountName&quot;, dimensions: []},
    {&quot;name&quot;: &quot;uint256&quot;, &quot;label&quot;: &quot;amount&quot;, dimensions: []}
  ]
}
```

Composed types can be further composed:
```javascript
{
  &quot;contractAddress&quot;: &quot;0x91E3737f15e9b182EdD44D45d943cF248b3a3BF9&quot;,
  &quot;typeChoice&quot;: 0,
  &quot;source&quot;: &lt;a SWARM hash for type source code files&gt;,
  &quot;name&quot;: &quot;myToken&quot;,
  &quot;types&quot;: [
    {&quot;name&quot;: &quot;address&quot;, &quot;label&quot;: &quot;token&quot;, dimensions: []},
    {&quot;name&quot;: &quot;myBalance&quot;, &quot;label&quot;: &quot;balance&quot;, dimensions: []}
  ]
}
```

`myToken` type will have the final data format: `(address,(string,uint256))` and a labeled format: `(address token, (string accountName, uint256 amount))`.

##### dType Registry Data Structures and Interface

To store this metadata, the dType registry will have the following data structures:

```solidity
enum TypeChoices {
    BaseType,
    PayableFunction,
    StateFunction,
    ViewFunction,
    PureFunction,
    Event
}

struct dTypes {
    string name;
    string label;
    string[] dimensions;
}

struct dType {
    TypeChoices typeChoice;
    address contractAddress;
    bytes32 source;
    string name;
    dTypes[] types;
}

```

For storage, we propose a pattern which isolates the type metadata from additional storage-specific data and allows CRUD operations on records.

```solidity
// key: identifier
mapping(bytes32 =&gt; Type) public typeStruct;

// array of identifiers
bytes32[] public typeIndex;

struct Type {
  dType data;
  uint256 index;
}
```

Note that we are proposing to define the type&apos;s primary identifier, `identifier`, as `keccak256(abi.encodePacked(name))`. If the system is extended to other programming languages, we can define `identifier` as `keccak256(abi.encodePacked(language, name))`.
Initially, single word English names can be disallowed, avoiding name squatting.


The dType registry interface is:

```solidity
import &apos;./dTypeLib.sol&apos;;
interface dType {
    event LogNew(bytes32 indexed identifier, uint256 indexed index);
    event LogUpdate(bytes32 indexed identifier, uint256 indexed index);
    event LogRemove(bytes32 indexed identifier, uint256 indexed index);

    function insert(dTypeLib.dType calldata data) external returns (bytes32 identifier);

    function remove(bytes32 identifier) external returns(uint256 index);

    function count() external view returns(uint256 counter);

    function getTypeIdentifier(string memory name) pure external returns (bytes32 identifier);

    function getByIdentifier(bytes32 identifier) view external returns(dTypeLib.dType memory dtype);

    function get(string memory name) view external returns(dTypeLib.dType memory dtype);

    function isRegistered(bytes32 identifier) view external returns(bool registered);
}
```

**Notes:**

To ensure backward compatibility, we suggest that updating types should not be supported.

The `remove` 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.

## Rationale

The Type Registry must store the minimum amount of information for rebuilding the type ABI definition. This allows us to:
* support on-chain interoperability
* decode blockchain side effects off-chain (useful for block explorers)
* allow off-chain tools to cache and search through the collection (e.g. editor plugin for writing typed smart contracts)

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.

The effort of having consensus on new types being added or removing unused ones is left to the governance system.

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.

The Type Library must express the behavior strictly pertinent to its defined type. Additional behavior, required by various project&apos;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.

This is an approach that will separate definitions from stored data and behavior, allowing for easier and more secure fine-grained upgrades.

## Backwards Compatibility

This proposal does not affect extant Ethereum standards or implementations. It uses the present experimental version of ABIEncoderV2.

## Test Cases

Will be added.

## Implementation

An in-work implementation can be found at https://github.com/pipeos-one/dType/tree/master/contracts/contracts.
This proposal will be updated with an appropriate implementation when consensus is reached on the specifications.

A video demo of the current implementation (a more extended version of this proposal) can be seen at https://youtu.be/pcqi4yWBDuQ.


## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 28 Mar 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1900</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1900</guid>
      </item>
    
      <item>
        <title>dType Functions Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1921</comments>
        
        <description>## Simple Summary
In the context of dType, the Decentralized Type System described in [EIP-1900](./eip-1900.md), we are proposing to add support for registering functions (with a preference for `pure` and `view`) in the dType Registry.

## Abstract

This proposal is part of a series of EIPs focused on expanding the concept of a Decentralized Type System, as explained in [EIP-1900](./eip-1900.md).
The current EIP specifies the data definitions and interfaces needed to support registering individual smart contract functions, as entries in the dType Registry.

## Motivation

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.

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.

Registering new smart contract functions can be done through the same consensus mechanism as [EIP-1900](./eip-1900.md) mentions, in order to avoid burdening the chain state with redundant or improper records.


## Specification

This specification targets `pure` and `view` functions.

For each function, we can store:
* `name` - type `string` unique function name, as defined in EIP-1900; required
* `types` - the type data and label of each input, as defined in EIP-1900; required
* `outputs` - the type data and label of each output; required
* `contractAddress` - type `address` - smart contract where the function resides, as defined in EIP-1900; optional for interfaces
* `source` - type `bytes32` - reference to an external file containing the function source code, as defined in EIP-1900; optional

Therefore, this proposal adds `outputs` to the EIP-1900 type registration definition.

An example of a function registration object for the dType registry is:

```
{
    &quot;name&quot;: &quot;setStaked&quot;,
    &quot;types&quot;: [
        {&quot;name&quot;: &quot;TypeA&quot;, &quot;label&quot;: &quot;typeA&quot;, &quot;relation&quot;:0, &quot;dimensions&quot;:[]}
    ],
    &quot;typeChoice&quot;: 4,
    &quot;contractAddress&quot;: &lt;address of the deployed smart contract where the function is defined&gt;,
    &quot;source&quot;: &lt;bytes32 hash for referencing source files&gt;,
    &quot;outputs&quot;: [
        {&quot;name&quot;: &quot;TypeB&quot;, &quot;label&quot;: &quot;typeB&quot;, &quot;relation&quot;:0, &quot;dimensions&quot;:[]}
    ]
}
```

The above object will be passed to `&lt;dType registry&gt;.insert({...})`

An additional `setOutputs` function is proposed for the dType registry:

```
function setOutputs(
    bytes32 identifier,
    dTypes[] memory outputs
)
    public
```

- `identifier` - type `bytes32`, the type&apos;s identifier, as defined in EIP-1900
- `outputs` - type `dTypes`, as defined in EIP-1900

### Implementation Suggestions


In the dType registry implementation, `outputs` can be stored in a `mapping`:

```
mapping(bytes32 =&gt; dTypes[]) public outputs;
```

## Rationale


The suggestion to treat each `pure` or `view` function as a separate entity instead of having a contract-based approach allows us to:
* have a global context of readily available functions
* scale designs through functional programming patterns rather than contract-encapsulated logic (which can be successfully used to scale development efforts independently)
* bidirectionally connect functions with the types they use, making automation easier
* cherry-pick functions from already deployed contracts if the other contract functions do not pass community consensus
* 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
* enable fine-grained auditing of individual functions, for the common good
* enable testing directly on a production chain, without state side-effects

The proposal to store the minimum ABI information on-chain, for each function, allows us to:
* enable on-chain automation (e.g. function chaining and composition)
* be backward compatible in case the function signature format changes (e.g. from `bytes4` to `bytes32`): multiple signature calculation functions can be registered with dType. Examples:

```
function getSignatureBytes4(bytes32 identifier)
    view
    public
    returns (bytes4 signature)

function getSignatureBytes32(bytes32 identifier)
    view
    public
    returns (bytes32 signature)
```

- `identifier` - the type&apos;s identifier, as defined in EIP-1900
- `signature` - the function&apos;s signature


Concerns about this design might be:
* redundancy of storing `contractAddress` for each function that is part of the same contract

We think that state/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/storage cost calculations will be added once the specification and implementation are closer to be finalized.


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/O. This can be a powerful tool for interoperability and smart contract composition.


## Backwards Compatibility

This proposal does not affect extant Ethereum standards or implementations. Registering functions for existing contract deployments should be fully supported.

## Test Cases

Will be added.


## Implementation

In-work implementation examples can be found at https://github.com/pipeos-one/dType.
This proposal will be updated with an appropriate implementation when consensus is reached on the specifications.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 06 Apr 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1921</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1921</guid>
      </item>
    
      <item>
        <title>zk-SNARK Verifier Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1922</comments>
        
        <description>## Simple Summary

A standard interface for &quot;Verifier&quot; contracts which verify zk-SNARKs.

## Abstract
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;.

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 `true` or `false` response; corresponding to whether it has been verified or not verified.

## Motivation
zk-SNARKs are a promising area of interest for the Ethereum community. Key applications of zk-SNARKs include:
- Private transactions
- Private computations
- Improved transaction scaling through proofs of &quot;bundled&quot; transactions

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.

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.

:warning: TODO: Explain the benefits to and perspective of a consumer of information. I.e. the thing that interfaces with the standard verifier.

## Specification
The key words &quot;MUST&quot;, &quot;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.

Terminology in this specification is used consistently with libsnark, as provided in that project&apos;s README.

* Adhering Contract — A Verifier contract which adheres to this specification.
* Arithmetic circuit: An abstraction of logical statements into addition and multiplication gates.
* Public Inputs: often denoted as a vector &apos;x&apos; in zk-SNARKs literature, and denoted `inputs` in this interface. An arithmetic circuit can be thought of as taking two parameters; the Public Inputs, &apos;x&apos;, and a secret &apos;witness&apos;, &apos;w&apos;. This interface standardises functions which can load the `inputs` into an Adhering Contract.
* Proof: A &apos;prover&apos; who wants to &apos;prove&apos; knowledge of some secret witness &apos;w&apos; (which satisfies an arithmetic circuit), generates a `proof` from: the circuit&apos;s Proving Key; their secret witness &apos;w&apos;; and its corresponding Public Inputs &apos;x&apos;. Together, a pair `(proof, inputs)` of satisfying `inputs` and their corresponding `proof` forms a zk-SNARK.
* Verification Key: A &apos;trusted setup&apos; calculation creates both a public &apos;Proving Key&apos; and a public &apos;Verification Key&apos; 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 (`(proof, inputs)` pairs) for at least one Verification Key. We shall call such Verification Keys &apos;in-scope&apos; Verification Keys. An Adhering Contract MUST be able to interpret unambiguously a unique `verificationKeyId` for each of its &apos;in-scope&apos; Verification Keys.

**Every ERC-XXXX compliant verifier contract must implement the `ERCXXXX` and `ERC165` interfaces** (subject to &quot;caveats&quot; below):


```solidity
pragma solidity ^0.5.6;

/// @title EIP-XXXX zk-SNARK Verifier Standard
/// @dev See https://github.com/EYBlockchain/zksnark-verifier-standard
///  Note: the ERC-165 identifier for this interface is 0xXXXXXXXX.
/// ⚠️ TODO: Calculate interface identifier
interface EIPXXXX /* is ERC165 */ {
    /// @notice Checks the arguments of Proof, through elliptic curve
    ///  pairing functions.
    /// @dev
    ///  MUST return `true` if Proof passes all checks (i.e. the Proof is
    ///  valid).
    ///  MUST return `false` if the Proof does not pass all checks (i.e. if the
    ///  Proof is invalid).
    /// @param proof A zk-SNARK.
    /// @param inputs Public inputs which accompany Proof.
    /// @param verificationKeyId A unique identifier (known to this verifier
    ///  contract) for the Verification Key to which Proof corresponds.
    /// @return result The result of the verification calculation. True
    ///  if Proof is valid; false otherwise.
    function verify(uint256[] calldata proof, uint256[] calldata inputs, bytes32 verificationKeyId) external returns (bool result);
}
```
### Interface
``` solidity
interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

## Rationale

### Taxonomy

⚠️ TODO: Add a specific reference to libsnark here, explaining the choice of variable names.

:warning: TODO: Explain how _C_ 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.

_C_ — A satisfiable arithmetic circuit abstraction of logical statements.

_lambda​_ - A random number, generated at the &apos;setup&apos; phase - commonly referred to as &apos;toxic waste&apos;, because knowledge of _lambda​_ would allow an untrustworthy party to create &apos;false&apos; proofs which would verify as &apos;true&apos;. _lambda​_ must be destroyed.

_pk​_ - The proving key for a particular circuit _C​_.

_vk_ - The verification key for a particular circuit _C_.

Both _pk​_ and _vk​_ are generated as a pair by some function _G​_:
_(pk, vk) = G(lambda, C)​_

Note: _C_ can be represented unambiguously by either of _pk_ or _vk_. In zk-SNARK constructions, _vk_ is much smaller in size than _pk_, so as to enable succinct verification on-chain. Hence, _vk_ is the representative of _C_ that is &apos;known&apos; to the contract. Therefore, we can identify each circuit uniquely through some `verificationKeyId`, where `verificationKeyId` serves as a more succinct mapping to _vk_.

_w_ - A &apos;private witness&apos; string. A private argument to the circuit _C_ known only to the prover, which, when combined with the `inputs` argument _x_, comprises an argument of knowledge which satisfies the circuit _C_.

_x_ or `inputs` - A vector of &apos;Public Inputs&apos;. A public argument to the circuit _C_ which, when combined with the private witness string _w_, comprises an argument of knowledge which satisfies the circuit _C_.

_pi_ or `proof` - an encoded vector of values which represents the &apos;prover&apos;s&apos; &apos;argument of knowledge&apos; of values _w_ and _x_ which satisfy the circuit _C_.
_pi = P(pk, x, w)_.

The ultimate purpose of a Verifier contract, as specified in this EIP, is to verify a proof (of the form _pi​_) through some verification function _V​_.

_V(vk, x, pi) = 1_, if there exists a _w_ s.t. _C(x,w)=1_.
_V(vk, x, pi) = 0_, otherwise.

The `verify()` function of this specification serves the purpose of _V​_; returning either `true` (the proof has been verified to satisfy the arithmetic circuit) or `false` (the proof has not been verified).

### Functions

#### `verify`
The `verify` function forms the crux this standard. The parameters are intended to be as generic as possible, to allow for verification of any zk-SNARK:

- `proof`
  Specified as `uint256[]`.
  `uint256` is the most appropriate type for elliptic curve operations over a finite field. Indeed, this type is used in the predominant &apos;Pairing library&apos; implementation of zk-SNARKs by Christian Reitweissner.
  A one-dimensional dynamic array has been chosen for several reasons:
  - 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.
  - Array: An array has been chosen over a &apos;struct&apos; object, because it is currently easier to pass dynamic arrays between functions in Solidity. Any proof &apos;struct&apos; can be &apos;flattened&apos; to an array and passed to the `verify` function. Interpretation of that flattened array is the responsibility of the implemented body of the function. Example implementations demonstrate that this can be achieved.
  - 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 &apos;flattened&apos; to a one-dimensional array and passed to the `verify` 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.

- `inputs`
  Specified as `uint256[]`.
  `uint256` is the most appropriate type for elliptic curve operations over a finite field. Indeed, this type is used in the predominant &apos;Pairing library&apos; implementation of zk-SNARKs by Christian Reitweissner.
  The number of inputs will vary in size, depending on the number of &apos;public inputs&apos; of the arithmetic circuit being verified against. In a similar vein to the `proof` parameter, a one-dimensional dynamic array is general enough to cope with any set of inputs to a zk-SNARK.

- `verificationKeyId`
  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 &apos;gas cost&apos; point of view) to pass a duplicate of the full verification key to the `verify` function every time a new `(proof, inputs)` pair is passed in. We do however need to tell the Adhering Verifier Contract which verification key corresponds to the `(proof, inputs)` pair being passed in. A `verificationKeyId` serves this purpose - it uniquely represents a verification key as a `bytes32` id. A method for uniquely assigning a `verificationKeyId` to a verification key is the responsibility of the implemented body of the Adhering Contract.


## Backwards Compatibility
- At the time this EIP was first proposed, there was one implementation on the Ethereum main net - deployed by [EY](https://www.ey.com). This was compiled with Solidity 0.4.24 for compatibility with [Truffle](https://github.com/trufflesuite/truffle) but otherwise compatible with this standard, which is presented at the latest current version of Solidity.
- Dr Christian Reitwiessner&apos;s excellent [example](https://gist.github.com/chriseth/f9be9d9391efc5beb9704255a8e2989d) of a Verifier contract and elliptic curve pairing library has been instrumental in the Ethereum community&apos;s experimentation and development of zk-SNARK protocols. Many of the naming conventions of this EIP have been kept consistent with his example.
- Existing zk-SNARK compilers such as [ZoKrates](https://github.com/Zokrates/ZoKrates), which produce &apos;Verifier.sol&apos; contracts, do not currently produce Verifier contracts which adhere to this EIP specification.
  - :warning: TODO: Provide a converter contract or technique which allows ZoKrates verifier.sol contracts to adhere with this EIP.


## Test Cases

Truffle tests of example implementations are included in the test case repository.

⚠️ TODO: Reference specific test cases because there are many currently in the repository.


## Implementations
Detailed example implementations and Truffle tests of these example implementations are included in this repository.

: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;.

:warning: TODO: Provide reference to an implementation which interrogates a standard verifier contract that implements this standard.


## References

:warning: TODO: Update references and confirm that each reference is cited (parenthetical documentation not necessary) in the text.

**Standards**

1. ERC-20 Token Standard. ./eip-20.md

1. ERC-165 Standard Interface Detection. ./eip-165.md
1. ERC-173 Contract Ownership Standard (DRAFT). ./eip-173.md
1. ERC-196 Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128. ./eip-196.md
1. ERC-197 Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128. ./eip-197.md
1. Ethereum Name Service (ENS). https://ens.domains
1. RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https://www.ietf.org/rfc/rfc2119.txt

##### Educational material:  zk-SNARKs
1. Zcash. What are zk-SNARKs? https://z.cash/technology/zksnarks.html
1. Vitalik Buterin. zk-SNARKs: Under the Hood. https://medium.com/@VitalikButerin/zk-snarks-under-the-hood-b33151a013f6
1. Christian Reitweissner. zk-SNARKs in a Nutshell. https://blog.ethereum.org/2016/12/05/zksnarks-in-a-nutshell/
1. Ben-Sasson, Chiesa, Tromer, et. al. Succinct Non-Interactive Zero Knowledge for a von Neumann Architecture. https://eprint.iacr.org/2013/879.pdf

##### Notable applications of zk-SNARKs
 1. EY. Implementation of a business agreement through Token Commitment transactions on the Ethereum mainnet. https://github.com/EYBlockchain/ZKPChallenge
 1. Zcash. https://z.cash
 1. Zcash. How Transactions Between Shielded Addresses Work. https://blog.z.cash/zcash-private-transactions/

##### Notable projects relating to zk-SNARKs
  1. libsnark: A C++ Library for zk-SNARKs (&quot;project README)&quot;. https://github.com/scipr-lab/libsnark
  1. ZoKrates: Scalable Privacy-Preserving Off-Chain Computations. https://www.ise.tu-berlin.de/fileadmin/fg308/publications/2018/2018_eberhardt_ZoKrates.pdf
  1. ZoKrates Project Repository. https://github.com/JacobEberhardt/ZoKrates
  1. Joseph Stockermans. zkSNARKs: Driver&apos;s Ed. https://github.com/jstoxrocky/zksnarks_example
  1. Christian Reitweissner - snarktest.solidity. https://gist.github.com/chriseth/f9be9d9391efc5beb9704255a8e2989d

##### Notable &apos;alternatives&apos; to zk-SNARKs - areas of ongoing zero-knowledge proof research
  1. Vitalik Buterin. STARKs. https://web.archive.org/web/20230425101334/https://vitalik.ca/general/2017/11/09/starks_part_1.html
  1. Bu ̈nz, Bootle, Boneh, et. al. Bulletproofs. https://eprint.iacr.org/2017/1066.pdf
  1. Range Proofs. https://www.cosic.esat.kuleuven.be/ecrypt/provpriv2012/abstracts/canard.pdf
  1. Apple. Secure Enclaves. https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/storing_keys_in_the_secure_enclave
  1. Intel Software Guard Extensions. https://software.intel.com/en-us/sgx


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 14 Sep 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1922</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1922</guid>
      </item>
    
      <item>
        <title>zk-SNARK Verifier Registry Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/1923</comments>
        
        <description>## Simple Summary


A standard interface for a &quot;Verifier Registry&quot;&apos;&quot; contract, through which all zk-SNARK verification activity can be registered.

## Abstract
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;.

TODO: Which functionality is exposed in this standard interface?

## Motivation
zk-SNARKs are a promising area of interest for the Ethereum community. Key applications of zk-SNARKs include:
- Private transactions
- Private computations
- Ethereum scaling through proofs of &apos;bundled&apos; transactions

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.

:warning: TODO: Explain the motivation for standardizing a registry, other than simply standardizing the verifier interactions.

⚠️ TODO: Explain the benefits to and perspective of a consumer of information. I.e. the thing that interfaces with the standard verifier registry.

## Specification
The key words &quot;MUST&quot;, &quot;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.


```solidity
pragma solidity ^0.5.6;

/// @title EIP-XXXX zk-SNARK Verifier Registry Standard
/// @dev See https://github.com/EYBlockchain/zksnark-verifier-standard
///  Note: the ERC-165 identifier for this interface is 0xXXXXXXXXX.
/// ⚠️ TODO: Set the interface identifier
interface EIP-XXXX /* is ERC165 */ {

  event NewProofSubmitted(bytes32 indexed _proofId, uint256[] _proof, uint64[] _inputs);

  event NewVkRegistered(bytes32 indexed _vkId);

  event NewVerifierContractRegistered(address indexed _contractAddress);

  event NewAttestation(bytes32 indexed _proofId, address indexed _verifier, bool indexed _result);


  function getVk(bytes32 _vkId) external returns (uint256[] memory);

  function registerVerifierContract(address _verifierContract) external returns (bool);

  function registerVk(uint256[] calldata _vk, address[] calldata _verifierContracts) external returns (bytes32);

  function submitProof(uint256[] calldata _proof, uint64[] calldata _inputs, bytes32 _vkId) external returns (bytes32);

  function submitProof(uint256[] calldata _proof, uint64[] calldata _inputs, bytes32 _vkId, address _verifierContract) external returns (bytes32);

  function submitProofAndVerify(uint256[] calldata _proof, uint64[] calldata _inputs, bytes32 _vkId, address _verifierContract) external returns (bytes32);

  function attestProof(bytes32 _proofId, bytes32 _vkId, bool _result) external;

  function attestProofs(bytes32[] calldata _proofIds, bytes32[] calldata _vkIds, bool[] calldata _results) external;

  function challengeAttestation(bytes32 _proofId, uint256[] calldata _proof, uint64[] calldata  _inputs, address _verifierContract) external;

  function createNewVkId(uint256[] calldata _vk) external pure returns (bytes32);

  function createNewProofId(uint256[] calldata _proof, uint64[] calldata _inputs) external pure returns (bytes32);

}
```
### Interface
``` solidity
interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

## Rationale

⚠️ TODO: Add Rationale section.

### Backwards Compatibility

⚠️ TODO: Add Backwards Compatibility section.

### Test Cases

Truffle tests of example implementations are included in this Repo.

⚠️ TODO: Reference specific test cases because there are many currently in the repository.


## Implementations
Detailed example implementations and Truffle tests of these example implementations are included in this Repo.

⚠️ 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;.

⚠️ TODO: Provide reference to an implementation which interrogates a standard verifier registry contract that implements this standard.


## References

⚠️ TODO: Update references and confirm that each reference is cited (parenthetical documentation not necessary) in the text.

**Standards**

1. ERC-20 Token Standard. ./eip-20.md

1. ERC-165 Standard Interface Detection. ./eip-165.md
2. ERC-173 Contract Ownership Standard (DRAFT). ./eip-173.md
3. ERC-196 Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128. ./eip-196.md
4. ERC-197 Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128. ./eip-197.md
5. Ethereum Name Service (ENS). https://ens.domains
6. RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https://www.ietf.org/rfc/rfc2119.txt

##### Educational material:  zk-SNARKs

1. Zcash. What are zk-SNARKs? https://z.cash/technology/zksnarks.html
2. Vitalik Buterin. zk-SNARKs: Under the Hood. https://medium.com/@VitalikButerin/zk-snarks-under-the-hood-b33151a013f6
3. Christian Reitweissner. zk-SNARKs in a Nutshell. https://blog.ethereum.org/2016/12/05/zksnarks-in-a-nutshell/
4. Ben-Sasson, Chiesa, Tromer, et. al. Succinct Non-Interactive Zero Knowledge for a von Neumann Architecture. https://eprint.iacr.org/2013/879.pdf

##### Notable applications of zk-SNARKs

1. EY. Implementation of a business agreement through Token Commitment transactions on the Ethereum mainnet. https://github.com/EYBlockchain/ZKPChallenge
2. Zcash. https://z.cash
3. Zcash. How Transactions Between Shielded Addresses Work. https://blog.z.cash/zcash-private-transactions/

##### Notable projects relating to zk-SNARKs

1. libsnark: A C++ Library for zk-SNARKs (&quot;project README)&quot;. https://github.com/scipr-lab/libsnark
2. ZoKrates: Scalable Privacy-Preserving Off-Chain Computations. https://www.ise.tu-berlin.de/fileadmin/fg308/publications/2018/2018_eberhardt_ZoKrates.pdf
3. ZoKrates Project Repository. https://github.com/JacobEberhardt/ZoKrates
4. Joseph Stockermans. zkSNARKs: Driver&apos;s Ed. https://github.com/jstoxrocky/zksnarks_example
5. Christian Reitweissner - snarktest.solidity. https://gist.github.com/chriseth/f9be9d9391efc5beb9704255a8e2989d

##### Notable &apos;alternatives&apos; to zk-SNARKs - areas of ongoing zero-knowledge proof research

1. Vitalik Buterin. STARKs. https://web.archive.org/web/20230425101334/https://vitalik.ca/general/2017/11/09/starks_part_1.html
2. Bu ̈nz, Bootle, Boneh, et. al. Bulletproofs. https://eprint.iacr.org/2017/1066.pdf
3. Range Proofs. https://www.cosic.esat.kuleuven.be/ecrypt/provpriv2012/abstracts/canard.pdf
4. Apple. Secure Enclaves. https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/storing_keys_in_the_secure_enclave
5. Intel Software Guard Extensions. https://software.intel.com/en-us/sgx


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 22 Dec 2018 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1923</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1923</guid>
      </item>
    
      <item>
        <title>Non-fungible Data Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-non-fungible-data-token/3139</comments>
        
        <description>## Simple Summary

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:
- cryptokitties that can change color
- intellectual property tokens that encode rights holders
- tokens that store data to transport them across chains

The existing metadata standard does not suffice as data can only be set at minting time and not modified later.

## Abstract

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.

## Motivation

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 [distributed breeding](https://ethresear.ch/t/a-distributed-breeding-function/5264) will be enabled.

## Specification

An extension of [ERC-721](./eip-721.md) interface with the following functions and events is suggested:

``` solidity
pragma solidity ^0.5.2;

/**
 * @dev Interface of the ERC1948 contract.
 */
interface IERC1948 {

  /**
   * @dev Emitted when `oldData` is replaced with `newData` in storage of `tokenId`.
   *
   * Note that `oldData` or `newData` may be empty bytes.
   */
  event DataUpdated(uint256 indexed tokenId, bytes32 oldData, bytes32 newData);

  /**
   * @dev Reads the data of a specified token. Returns the current data in
   * storage of `tokenId`.
   *
   * @param tokenId The token to read the data off.
   *
   * @return A bytes32 representing the current data stored in the token.
   */
  function readData(uint256 tokenId) external view returns (bytes32);

  /**
   * @dev Updates the data of a specified token. Writes `newData` into storage
   * of `tokenId`.
   *
   * @param tokenId The token to write data to.
   * @param newData The data to be written to the token.
   *
   * Emits a `DataUpdated` event.
   */
  function writeData(uint256 tokenId, bytes32 newData) external;

}
```

## Rationale

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.

The proposal for this ERC stems from the [distributed breeding proposal](https://ethresear.ch/t/a-distributed-breeding-function/5264) to allow better integration of NFTs across side-chains. [ost.com](https://ost.com/), [Skale](https://skalelabs.com/), [POA](https://poa.network/), and [LeapDAO](https://leapdao.org/) have been part of the discussion.

## Backwards Compatibility

🤷‍♂️ No related proposals are known to the author, hence no backwards compatibility to consider.

## Test Cases

Simple happy test:

``` javascript
const ERC1948 = artifacts.require(&apos;./ERC1948.sol&apos;);

contract(&apos;ERC1948&apos;, (accounts) =&gt; {
  const firstTokenId = 100;
  const empty = &apos;0x0000000000000000000000000000000000000000000000000000000000000000&apos;;
  const data = &apos;0x0101010101010101010101010101010101010101010101010101010101010101&apos;;
  let dataToken;

  beforeEach(async () =&gt; {
    dataToken = await ERC1948.new();
    await dataToken.mint(accounts[0], firstTokenId);
  });

  it(&apos;should allow to write and read&apos;, async () =&gt; {
    let rsp = await dataToken.readData(firstTokenId);
    assert.equal(rsp, empty);
    await dataToken.writeData(firstTokenId, data);
    rsp = await dataToken.readData(firstTokenId);
    assert.equal(rsp, data);
  });

});
```


## Implementation

An example implementation of the interface in solidity would look like this:

``` solidity
/**
 * @dev Implementation of ERC721 token and the `IERC1948` interface.
 *
 * ERC1948 is a non-fungible token (NFT) extended with the ability to store
 * dynamic data. The data is a bytes32 field for each tokenId. If 32 bytes
 * do not suffice to store the data, an authenticated data structure (hash or
 * merkle tree) shall be used.
 */
contract ERC1948 is IERC1948, ERC721 {

  mapping(uint256 =&gt; bytes32) data;

  /**
   * @dev See `IERC1948.readData`.
   *
   * Requirements:
   *
   * - `tokenId` needs to exist.
   */
  function readData(uint256 tokenId) external view returns (bytes32) {
    require(_exists(tokenId));
    return data[tokenId];
  }

  /**
   * @dev See `IERC1948.writeData`.
   *
   * Requirements:
   *
   * - `msg.sender` needs to be owner of `tokenId`.
   */
  function writeData(uint256 tokenId, bytes32 newData) external {
    require(msg.sender == ownerOf(tokenId));
    emit DataUpdated(tokenId, data[tokenId], newData);
    data[tokenId] = newData;
  }

}
```

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 18 Apr 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1948</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1948</guid>
      </item>
    
      <item>
        <title>Proxy Storage Slots</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-1967-standard-proxy-storage-slots/3185</comments>
        
        <description>## Abstract
Delegating **proxy contracts** are widely used for both upgradeability and gas savings. These proxies rely on a **logic contract** (also known as implementation contract or master copy) that is called using `delegatecall`. This allows proxies to keep a persistent state (storage and balance) while the code is delegated to the logic contract.

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 `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` 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.

## Motivation
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.

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.

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 `0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48` is shown on Etherscan:

![Sample proxy on Etherscan](../assets/eip-1967/Sample-proxy-on-etherscan.png)

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.

## Specification
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 `0x0` to the first non-zero value.

The proposed storage slots for proxy-specific information are the following. More slots for additional information can be added in subsequent ERCs as needed.

### Logic contract address

Storage slot `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
(obtained as `bytes32(uint256(keccak256(&apos;eip1967.proxy.implementation&apos;)) - 1)`).

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:

```solidity
event Upgraded(address indexed implementation);
```

### Beacon contract address

Storage slot `0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50` (obtained as `bytes32(uint256(keccak256(&apos;eip1967.proxy.beacon&apos;)) - 1)`).

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:

```solidity
event BeaconUpgraded(address indexed beacon);
```

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:

```
function implementation() returns (address)
```

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:

- Read the address of the beacon for the beacon logic storage slot;
- Call the `implementation()` function on the beacon contract.

The result of the `implementation()` function on the beacon contract SHOULD NOT depend on the caller (`msg.sender`).


### Admin address

Storage slot `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
(obtained as `bytes32(uint256(keccak256(&apos;eip1967.proxy.admin&apos;)) - 1)`).

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:

```solidity
event AdminChanged(address previousAdmin, address newAdmin);
```

## Rationale

This EIP standardises the **storage slot** 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.

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.

From _Malicious backdoors in Ethereum proxies_ by Nomic Labs:

&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.
&gt;
&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.

The fact that proxy public functions are potentially exploitable makes it necessary to standardise the logic contract address in a different way.

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.

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:

&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.

Vyper seems to follow the same strategy as Solidity. Note that contracts written in other languages, or directly in assembly, may incur in clashes.

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 `-1` offset is added so the preimage of the hash cannot be known, further reducing the chances of a possible attack.

## Reference Implementation

```solidity
/**
 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
 * implementation address that can be changed. This address is stored in storage in the location specified by
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn&apos;t conflict with the storage layout of the
 * implementation behind the proxy.
 */
contract ERC1967Proxy is Proxy, ERC1967Upgrade {
    /**
     * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
     *
     * If `_data` is nonempty, it&apos;s used as data in a delegate call to `_logic`. This will typically be an encoded
     * function call, and allows initializing the storage of the proxy like a Solidity constructor.
     */
    constructor(address _logic, bytes memory _data) payable {
        assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(&quot;eip1967.proxy.implementation&quot;)) - 1));
        _upgradeToAndCall(_logic, _data, false);
    }

    /**
     * @dev Returns the current implementation address.
     */
    function _implementation() internal view virtual override returns (address impl) {
        return ERC1967Upgrade._getImplementation();
    }
}

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 */
abstract contract ERC1967Upgrade {
    // This is the keccak-256 hash of &quot;eip1967.proxy.rollback&quot; subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of &quot;eip1967.proxy.implementation&quot; subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(Address.isContract(newImplementation), &quot;ERC1967: new implementation is not a contract&quot;);
        StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length &gt; 0 || forceCall) {
            Address.functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallSecure(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        address oldImplementation = _getImplementation();

        // Initial upgrade and setup call
        _setImplementation(newImplementation);
        if (data.length &gt; 0 || forceCall) {
            Address.functionDelegateCall(newImplementation, data);
        }

        // Perform rollback test if not already in progress
        StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT);
        if (!rollbackTesting.value) {
            // Trigger rollback using upgradeTo from the new implementation
            rollbackTesting.value = true;
            Address.functionDelegateCall(
                newImplementation,
                abi.encodeWithSignature(&quot;upgradeTo(address)&quot;, oldImplementation)
            );
            rollbackTesting.value = false;
            // Check rollback was effective
            require(oldImplementation == _getImplementation(), &quot;ERC1967Upgrade: upgrade breaks further upgrades&quot;);
            // Finally reset to the new implementation and log the upgrade
            _upgradeTo(newImplementation);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of &quot;eip1967.proxy.admin&quot; subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), &quot;ERC1967: new admin is the zero address&quot;);
        StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256(&apos;eip1967.proxy.beacon&apos;)) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Emitted when the beacon is upgraded.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(Address.isContract(newBeacon), &quot;ERC1967: new beacon is not a contract&quot;);
        require(
            Address.isContract(IBeacon(newBeacon).implementation()),
            &quot;ERC1967: beacon implementation is not a contract&quot;
        );
        StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length &gt; 0 || forceCall) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        }
    }
}

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal virtual {
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don&apos;t know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    /**
     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function
     * and {_fallback} should delegate.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        _beforeFallback();
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback() external payable virtual {
        _fallback();
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
     * is empty.
     */
    receive() external payable virtual {
        _fallback();
    }

    /**
     * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
     * call, or as part of the Solidity `fallback` or `receive` functions.
     *
     * If overridden should call `super._beforeFallback()`.
     */
    function _beforeFallback() internal virtual {}
}

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly {
            r.slot := slot
        }
    }
}
```

## Security Considerations

This ERC relies on the fact that the chosen storage slots are **not** 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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 24 Apr 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1967</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1967</guid>
      </item>
    
      <item>
        <title>Scalable Rewards</title>
        <category>Standards Track/ERC</category>
        
        <description>## Simple Summary

 A mintable token rewards interface that mints &apos;n&apos; tokens per block which are distributed equally among the &apos;m&apos; participants in the DAPP&apos;s ecosystem.

## Abstract

 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.
 

 ## Motivation

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. 

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. 

## Specification

### Definitions 

 `token amount per participant in the ecosytem or TPP (token per participant)`: TPP = (token amount to mint / total active participants)

 `roundMask`: the cumulative snapshot of TPP over time for the token contract. E.g. transactionOne = 10 tokens are minted with 100 available participants (TPP = 10 / 100) , transactionTwo = 12 tokens are minted with 95 participants (TPP = 12 / 95 ) 

 roundMask = (10/100) + (12/95)

 `participantMask`: is used to keep track of a `msg.sender` (participant) rewards over time. When a `msg.sender` joins or leaves the ecosystem, the player mask is updated

 participantMask = previous roundMask OR (current roundMask - TPP)

 `rewards for msg.sender`: roundMask - participantMask 

 E.g. Let&apos;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&apos;s balance is as follows:
 
 ``` 
 t1 roundMask = (20/10)
 t2 roundMask = (20/10) + (20/11) 
 t3 roundMask = (20/10) + (20/11) + (20/11)
 t4 roundMask = (20/10) + (20/11) + (20/11) + (20/11)
 t5 roundMask = (20/10) + (20/11) + (20/11) + (20/11)+ (20/10)
 t6 roundMask = (20/10) + (20/11) + (20/11) + (20/11)+ (20/10) + (20/10)
 ``` 

 Total tokens released in 6 transactions = 60 tokens 

 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 &apos;participantMask = (20/10)&apos;, when the participant leaves before t5, the cumulative deserved reward tokens are :

 rewards for msg.sender: `[t4 roundMask = (20/10) + (20/11)+ (20/11) + (20/11)] - [participantMask = (20/10)] = [rewards = (20/11)+ (20/11) + (20/11)]`

 When the same participant joins the ecosystem at a later point (t27 or t35), a new &apos;participantMask&apos; is given that is used to calculate the new deserved reward tokens when the participant exits. This process continues dynamically for each participant. 

 `tokensPerBlock`: the amount of tokens that will be released per block

 `blockFreezeInterval`: the number of blocks that need to pass until the next mint. E.g. if set to 50 and &apos;n&apos; tokens were minted at block &apos;b&apos;, the next &apos;n&apos; tokens won&apos;t be minted until &apos;b + 50&apos; blocks have passed

 `lastMintedBlockNumber`: the block number on which last &apos;n&apos; tokens were minted

 `totalParticipants` : the total number of participants in the DApp network

 `tokencontractAddress` : the contract address to which tokens will be minted, default is address(this) 

```solidity

pragma solidity ^0.5.2;

import &quot;openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol&quot;;
import &quot;openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol&quot;;

contract Rewards is ERC20Mintable, ERC20Detailed {

using SafeMath for uint256;

uint256 public roundMask;
uint256 public lastMintedBlockNumber;
uint256 public totalParticipants = 0;
uint256 public tokensPerBlock; 
uint256 public blockFreezeInterval; 
address public tokencontractAddress = address(this);
mapping(address =&gt; uint256) public participantMask; 

/**
 * @dev constructor, initializes variables.
 * @param _tokensPerBlock The amount of token that will be released per block, entered in wei format (E.g. 1000000000000000000)
 * @param _blockFreezeInterval The amount of blocks that need to pass (E.g. 1, 10, 100) before more tokens are brought into the ecosystem.
 */
 constructor(uint256 _tokensPerBlock, uint256 _blockFreezeInterval) public ERC20Detailed(&quot;Simple Token&quot;, &quot;SIM&quot;, 18){ 
lastMintedBlockNumber = block.number;
tokensPerBlock = _tokensPerBlock;
blockFreezeInterval = _blockFreezeInterval;
}

/**
 * @dev Modifier to check if msg.sender is whitelisted as a minter. 
 */
modifier isAuthorized() {
require(isMinter(msg.sender));
_;
}

/**
 * @dev Function to add participants in the network. 
 * @param _minter The address that will be able to mint tokens.
 * @return A boolean that indicates if the operation was successful.
 */
function addMinters(address _minter) external returns (bool) {
_addMinter(_minter);
totalParticipants = totalParticipants.add(1);
updateParticipantMask(_minter);
return true;
}


/**
 * @dev Function to remove participants in the network. 
 * @param _minter The address that will be unable to mint tokens.
 * @return A boolean that indicates if the operation was successful.
 */
function removeMinters(address _minter) external returns (bool) {
totalParticipants = totalParticipants.sub(1);
_removeMinter(_minter); 
return true;
}


/**
 * @dev Function to introduce new tokens in the network. 
 * @return A boolean that indicates if the operation was successful.
 */
function trigger() external isAuthorized returns (bool) {
bool res = readyToMint();
if(res == false) {
return false;
} else {
mintTokens();
return true;
}
}

/**
 * @dev Function to withdraw rewarded tokens by a participant. 
 * @return A boolean that indicates if the operation was successful.
 */
function withdraw() external isAuthorized returns (bool) {
uint256 amount = calculateRewards();
require(amount &gt;0);
ERC20(tokencontractAddress).transfer(msg.sender, amount);
}

/**
 * @dev Function to check if new tokens are ready to be minted. 
 * @return A boolean that indicates if the operation was successful.
 */
function readyToMint() public view returns (bool) {
uint256 currentBlockNumber = block.number;
uint256 lastBlockNumber = lastMintedBlockNumber;
if(currentBlockNumber &gt; lastBlockNumber + blockFreezeInterval) { 
return true;
} else {
return false;
}
}

/**
 * @dev Function to calculate current rewards for a participant. 
 * @return A uint that returns the calculated rewards amount.
 */
function calculateRewards() private returns (uint256) {
uint256 playerMask = participantMask[msg.sender];
uint256 rewards = roundMask.sub(playerMask);
updateParticipantMask(msg.sender);
return rewards;
}

/**
 * @dev Function to mint new tokens into the economy. 
 * @return A boolean that indicates if the operation was successful.
 */
function mintTokens() private returns (bool) {
uint256 currentBlockNumber = block.number;
uint256 tokenReleaseAmount = (currentBlockNumber.sub(lastMintedBlockNumber)).mul(tokensPerBlock);
lastMintedBlockNumber = currentBlockNumber;
mint(tokencontractAddress, tokenReleaseAmount);
calculateTPP(tokenReleaseAmount);
return true;
}

 /**
* @dev Function to calculate TPP (token amount per participant).
* @return A boolean that indicates if the operation was successful.
*/
function calculateTPP(uint256 tokens) private returns (bool) {
uint256 tpp = tokens.div(totalParticipants);
updateRoundMask(tpp);
return true;
}

 /**
* @dev Function to update round mask. 
* @return A boolean that indicates if the operation was successful.
*/
function updateRoundMask(uint256 tpp) private returns (bool) {
roundMask = roundMask.add(tpp);
return true;
}

 /**
* @dev Function to update participant mask (store the previous round mask)
* @return A boolean that indicates if the operation was successful.
*/
function updateParticipantMask(address participant) private returns (bool) {
uint256 previousRoundMask = roundMask;
participantMask[participant] = previousRoundMask;
return true;
}

}
``` 

## Rationale

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.

## Backwards Compatibility

Not Applicable. 

## Test Cases

WIP, will be added.

## Implementation

WIP, a proper implementation will be added later.A sample example is below: 

`etherscan rewards contract` : https://ropsten.etherscan.io/address/0x8b0abfc541ab7558857816a67e186221adf887bc#tokentxns

`Step 1` : deploy Rewards contract with the following parameters_tokensPerBlock = 1e18, _blockFreezeInterval = 1

`Step 2` : add Alice(0x123) and Bob(0x456) as minters, addMinters(address _minter) 

`Step 3` : call trigger() from Alice / Bob&apos;s account. 65 blocks are passed, hence 65 SIM tokens are minted. The RM is 32500000000000000000

`Step 4` : Alice withdraws and receives 32.5 SIM tokens (65 tokens / 2 participants) and her PM = 32500000000000000000 

`Step 5` : add Satoshi(0x321) and Vitalik(0x654) as minters, addMinters(address _minter) 

`Step 6` : call trigger() from Alice / Bob&apos;s / Satoshi / Vitalik account. 101 blocks are passed, hence 101 SIM tokens are minted. The RM is 57750000000000000000

`Step 7` : Alice withdraws and receives 25.25 SIM tokens (101 tokens / 4 participants) and her PM = 57750000000000000000

`Step 8` : Bob withdraws and receives 57.75 SIM tokens ((65 tokens / 2 participants) + (101 tokens / 4 participants)). Bob&apos;s PM = 57750000000000000000
 
## Copyright

Copyright and related rights waived via CC0.

## References

1. Scalable Reward Distribution on the Ethereum Blockchain by Bogdan Batog, Lucian Boca and Nick Johnson

2. Fomo3d DApp, https://fomo3d.hostedwiki.co/
</description>
        <pubDate>Mon, 01 Apr 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1973</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1973</guid>
      </item>
    
      <item>
        <title>Holdable Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2103</comments>
        
        <description>## Simple Summary
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.

## Actors

#### Operator
An account which has been approved by an account to create holds on its behalf.

#### Hold issuer
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.

#### Notary
The account which decides if a hold should be executed. 

## Abstract
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.

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.

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.

## Motivation

A hold has to be used in different scenarios where a immediate transfer between accounts is not possible or has to be guaranteed beforehand:

1. 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. 

1. 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&apos;s account to ensure that enough balance is available to pay for the room before handing over the keys.

1. 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&apos;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&apos;s account.

The ERC-20 `approve` function provides some of the necessary functionality for the use cases above. The main difference to holds, is that `approve` does not ensure a payment, as the approved money is not blocked and can be transferred at any moment.

## Specification

```solidity
interface IHoldable /* is ERC-20 */ {
    enum HoldStatusCode {
        Nonexistent,
        Ordered,
        Executed,
        ReleasedByNotary,
        ReleasedByPayee,
        ReleasedOnExpiration
    }

    function hold(string calldata operationId, address to, address notary, uint256 value, uint256 timeToExpiration) external returns (bool); 
    function holdFrom(string calldata operationId, address from, address to, address notary, uint256 value, uint256 timeToExpiration) external returns (bool);
    function releaseHold(string calldata operationId) external returns (bool);
    function executeHold(string calldata operationId, uint256 value) external returns (bool);
    function renewHold(string calldata operationId, uint256 timeToExpiration) external returns (bool);
    function retrieveHoldData(string calldata operationId) external view returns (address from, address to, address notary, uint256 value, uint256 expiration, HoldStatusCode status);

    function balanceOnHold(address account) external view returns (uint256);
    function netBalanceOf(address account) external view returns (uint256);
    function totalSupplyOnHold() external view returns (uint256);

    function authorizeHoldOperator(address operator) external returns (bool);
    function revokeHoldOperator(address operator) external returns (bool);
    function isHoldOperatorFor(address operator, address from) external view returns (bool);

    event HoldCreated(address indexed holdIssuer, string  operationId, address from, address to, address indexed notary, uint256 value, uint256 expiration);
    event HoldExecuted(address indexed holdIssuer, string operationId, address indexed notary, uint256 heldValue, uint256 transferredValue);
    event HoldReleased(address indexed holdIssuer, string operationId, HoldStatusCode status);
    event HoldRenewed(address indexed holdIssuer, string operationId, uint256 oldExpiration, uint256 newExpiration);
    event AuthorizedHoldOperator(address indexed operator, address indexed account);
    event RevokedHoldOperator(address indexed operator, address indexed account);
}
```

### Functions

#### hold

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.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the hold |
| to | The address of the payee, to whom the tokens are to be transferred if executed |
| notary | The address of the notary who is going to determine whether the hold is to be executed or released |
| value | The amount to be transferred. Must be less or equal than the balance of the payer. |
| timeToExpiration | The duration until the hold is expired. If it is &apos;0&apos; the hold must be perpetual.  |

#### holdFrom

Creates a hold on behalf of the payer in favor of the payee. The `from` account has to approve beforehand, that another account can issue holds on its behalf by calling `approveToHold`. The function must revert if the operation ID has been used before.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the hold |
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be transferred if executed |
| notary | The address of the notary who is going to determine whether the hold is to be executed or released |
| value | The amount to be transferred. Must be less or equal than the balance of the payer. |
| timeToExpiration | The duration until the hold is expired. If it is &apos;0&apos; the hold must be perpetual.  |

#### releaseHold

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.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the hold |

#### executeHold

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.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the hold |
| value | The amount to be transferred. This amount has to be less or equal than the hold value |

#### renewHold

Renews a hold. The new expiration time must be the block timestamp plus the given `timeToExpiration`, independently if the hold was perpetual or not before that. Furthermore a hold must be made perpetual if `timeToExpiration` is &apos;0&apos;. 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.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the hold |
| timeToExpiration | The new duration until the hold is expired. |

#### retrieveHoldData

Retrieves all the information available for a particular hold.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the hold |

#### balanceOnHold

Retrieves how much of the balance is currently held and therefore not available for transfer.

| Parameter | Description |
| ---------|-------------|
| account | The address which held balance should be returned |

#### netBalanceOf

Retrieves the net balance, which is the sum of `balanceOf` and `balanceOnHold`.

| Parameter | Description |
| ---------|-------------|
| account | The address which net balance should be returned |

#### totalSupplyOnHold

Retrieves the total sum of how many tokens are on hold.

| Parameter | Description |
| ---------|-------------|
| - | - |

#### authorizeHoldOperator

Approves an operator to issue holds on behalf of msg.sender.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be approved as operator of holds |

#### revokeHoldOperator

Revokes the approval to issue holds on behalf of msg.sender.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be revoked as operator of holds |

#### isHoldOperatorFor

Retrieves if an operator is approved to create holds on behalf of `from`.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be a operator of holds |
| from | The address on which the holds would be created |

#### balanceOf

The standard implementation of ERC-20 has to be changed in order to deduct the held balance from the ERC-20 balance.

#### transfer

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.

#### transferFrom

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.

### Events

#### HoldCreated

Emitted when a hold has been created.

| Parameter | Description |
| ---------|-------------|
| holdIssuer | The address of the hold issuer of the hold |
| operationId | The unique ID to identify the hold |
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be paid if executed |
| notary | The address of the notary who is going to determine whether the hold is to be executed or released |
| value | The amount to be transferred. Must be less or equal than the balance of the payer. |
| expiration | The unix timestamp when the hold is expired |

#### HoldExecuted

Emitted when a hold has been executed.

| Parameter | Description |
| ---------|-------------|
| holdIssuer | The address of the hold issuer of the hold |
| operationId | The unique ID to identify the hold |
| notary | The address of the notary who executed the hold |
| heldValue | The amount which was put on hold during creation |
| transferredValue | The amount which was used for the transfer |

#### HoldReleased

Emitted when a hold has been released.

| Parameter | Description |
| ---------|-------------|
| holdIssuer | The address of the hold issuer of the hold |
| operationId | The unique ID to identify the hold |
| status | Can be one of the following values: `ReleasedByNotary`, `ReleasedByPayee`, `ReleasedOnExpiration` |

#### HoldRenewed

Emitted when a hold has been renewed.

| Parameter | Description |
| ---------|-------------|
| holdIssuer | The address of the hold issuer of the hold |
| operationId | The unique ID to identify the hold |
| oldExpiration | The expiration time before the renewal |
| newExpiration | The expiration time after the renewal |

#### AuthorizedHoldOperator

Emitted when an operator has been approved to create holds on behalf of another account.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be a operator of holds |
| account | Address on which behalf holds will potentially be created |

#### RevokedHoldOperator

Emitted when an operator has been revoked from creating holds on behalf of another account.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be a operator of holds |
| account | Address on which behalf holds could potentially be created |

## Rationale

This standards provides a functionality, to guarantee future payments, which is needed for many business cases where transfers have to be guaranteed.

It goes a step further than the ERC-20 `approve` function by ensuring that the held balance will be available when the transfer is done. Something that can not be done with `approve`, as the approved amount is only a maximum spending amount, but never guaranteed to be available.

While not requiring it, the naming of the functions `authorizeHoldOperator`, `revokeHoldOperator` and `isHoldOperatorFor` follows the naming convention of [ERC-777](./eip-777.md).

The `operationId` 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.

The `operationId` is a competitive resource. It is recommended, but nor required, that the hold issuers used a unique prefix to avoid collisions. 

## Backwards Compatibility
This EIP is fully backwards compatible as its implementation extends the functionality of ERC-20.

## Implementation
The GitHub repository [IoBuilders/holdable-token](https://github.com/IoBuilders/holdable-token) contains the reference implementation.

## Contributors
This proposal has been collaboratively implemented by [adhara.io](https://adhara.io/) and [io.builders](https://io.builders/).

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 10 Apr 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-1996</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-1996</guid>
      </item>
    
      <item>
        <title>Compliance Service</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2022</comments>
        
        <description>## Simple Summary

This EIP proposes a service for decentralized compliance checks for regulated tokens. 

## Actors

#### Operator
An account which has been approved by a token to update the tokens accumulated.

#### Token
An account, normally a smart contract, which uses the `Compliance Service` to check if the an action can be executed or not.

#### Token holder
An account which is in possession of tokens and on for which the checks are made.

## Abstract

A regulated token needs to comply with several legal requirements, especially [KYC][KYC-Wikipedia] and [AML][AML-Wikipedia]. 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.

## Motivation

Currently there is no proposal on how to accomplish decentralized compliance checks. [ERC-1462][ERC-1462] proposes a basic set of functions to check if `transfer`, `mint` and `burn` 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.  

The proposed `Compliance Service` 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.

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.

## Specification

```solidity
interface CompliantService {
    function checkTransferAllowed(bytes32 tokenId, address from, address to, uint256 value) external view returns (byte);
    function checkTransferFromAllowed(bytes32 tokenId, address sender, address from, address to, uint256 value) external view returns (byte);
    function checkMintAllowed(bytes32 tokenId, address to, uint256 value) external view returns (byte);
    function checkBurnAllowed(bytes32 tokenId, address from, uint256 value) external view returns (byte);
    
    function updateTransferAccumulated(bytes32 tokenId, address from, address to, uint256 value) external;
    function updateMintAccumulated(bytes32 tokenId, address to, uint256 value) external;
    function updateBurnAccumulated(bytes32 tokenId, address from, uint256 value) external;
    
    function addToken(bytes32 tokenId, address token) external;
    function replaceToken(bytes32 tokenId, address token) external;
    function removeToken(bytes32 tokenId) external;
    function isToken(address token) external view returns (bool);
    function getTokenId(address token) external view returns (bytes32);
    
    function authorizeAccumulatedOperator(address operator) external returns (bool);
    function revokeAccumulatedOperator(address operator) external returns (bool);
    function isAccumulatedOperatorFor(address operator, bytes32 tokenId) external view returns (bool);
    
    event TokenAdded(bytes32 indexed tokenId, address indexed token);
    event TokenReplaced(bytes32 indexed tokenId, address indexed previousAddress, address indexed newAddress);
    event TokenRemoved(bytes32 indexed tokenId);
    event AuthorizedAccumulatedOperator(address indexed operator, bytes32 indexed tokenId);
    event RevokedAccumulatedOperator(address indexed operator, bytes32 indexed tokenId);
}
```

### Mandatory checks

The checks must be verified in their corresponding actions. The action must only be successful if the check return an `Allowed` status code. In any other case the functions must revert.

### Status codes

If an action is allowed `0x11` (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 `0x10` (Disallowed) or an issuer-specific code with equivalent but more precise meaning. 

### Functions

#### checkTransferAllowed

Checks if the `transfer` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be transferred if executed |
| value | The amount to be transferred |

#### checkTransferFromAllowed

Checks if the `transferFrom` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| sender | The address of the sender, who initiated the transaction |
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be transferred if executed |
| value | The amount to be transferred |

#### checkMintAllowed

Checks if the `mint` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| to | The address of the payee, to whom the tokens are to be given if executed |
| value | The amount to be minted |

#### checkBurnAllowed

Checks if the `burn` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| from | The address of the payer, from whom the tokens are to be taken if executed |
| value | The amount to be burned |

#### updateTransferAccumulated

Must be called in the same transaction as `transfer` or `transferFrom`. 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.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be transferred if executed |
| value | The amount to be transferred |

#### updateMintAccumulated

Must be called in the same transaction as `mint`. 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.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| to | The address of the payee, to whom the tokens are to be given if executed |
| value | The amount to be minted |

#### updateBurnAccumulated

Must be called in the same transaction as `burn`. 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.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| from | The address of the payer, from whom the tokens are to be taken if executed |
| value | The amount to be minted |

#### addToken

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.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| token | The address from which the update functions will be called |

#### replaceToken

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.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| token | The address from which the update functions will be called |

#### removeToken

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.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |

#### isToken

Returns `true` if the address has been added to the service, `false` if not.

| Parameter | Description |
| ---------|-------------|
| token | The address which should be checked |

#### getTokenId

Returns the token id of a token. If the token has not been added to the service, &apos;0&apos; must be returned.

| Parameter | Description |
| ---------|-------------|
| token | The address which token id should be returned |

#### authorizeAccumulatedOperator

Approves an operator to update accumulated on behalf of the token id of msg.sender.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be approved as operator of accumulated updates |

#### revokeAccumulatedOperator

Revokes the approval to update accumulated on behalf the token id the token id ofof msg.sender.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be revoked as operator of accumulated updates |

#### isAccumulatedOperatorFor

Retrieves if an operator is approved to create holds on behalf of `tokenId`.

| Parameter | Description |
| ---------|-------------|
| operator | The address which is operator of updating the accumulated |
| tokenId | The unique ID which identifies a token |

### Events

#### TokenAdded

Must be emitted after a token has been added.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| token | The address from which the update functions will be called |

#### TokenReplaced

Must be emitted after the address of a token has been replaced.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |
| previousAddress | The previous address which was used before |
| newAddress | The address which will be used from now on |

#### TokenRemoved

Must be emitted after the a token has been removed.

| Parameter | Description |
| ---------|-------------|
| tokenId | The unique ID which identifies a token |

#### AuthorizedAccumulatedOperator

Emitted when an operator has been approved to update the accumulated on behalf of a token.

| Parameter | Description |
| ---------|-------------|
| operator | The address which is operator of updating the accumulated |
| tokenId | Token id on which behalf updates of the accumulated will potentially be made |

#### RevokedHoldOperator

Emitted when an operator has been revoked from updating the accumulated on behalf of a token.

| Parameter | Description |
| ---------|-------------|
| operator | The address which was operator of updating the accumulated |
| tokenId | Token id on which behalf updates of the accumulated could be made |

## Rationale

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.

No event is emitted after updating the accumulated as those are always associated with a `transfer`, `mint` or `burn` of a token which already emits an event of itself.

While not requiring it, the naming of the functions `checkTransferAllowed`, `checkTransferFromAllowed`, `checkMintAllowed` and `checkBurnAllowed` was adopted from [ERC-1462][ERC-1462].

While not requiring it, the naming of the functions `authorizeAccumulatedOperator`, `revokeAccumulatedOperator` and `isAccumulatedOperatorFor` follows the naming convention of [ERC-777][ERC-777].

Localization is not part of this EIP, but [ERC-1066][ERC-1066] and [ERC-1444][ERC-1444] can be used together to achieve it.

## Backwards Compatibility

As the EIP is not using any existing EIP there are no backwards compatibilities to take into consideration.

## Implementation

The GitHub repository [IoBuilders/compliance-service](https://github.com/IoBuilders/compliance-service) contains the work in progress implementation.

## Contributors
This proposal has been collaboratively implemented by [adhara.io](https://adhara.io/) and [io.builders](https://io.builders/).

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

[KYC-Wikipedia]: https://en.wikipedia.org/wiki/Know_your_customer
[AML-Wikipedia]: https://en.wikipedia.org/wiki/Money_laundering#Anti-money_laundering
[ERC-777]: ./eip-777.md
[ERC-1066]: ./eip-1066.md
[ERC-1444]: ./eip-1444.md
[ERC-1462]: ./eip-1462.md
</description>
        <pubDate>Thu, 09 May 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2009</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2009</guid>
      </item>
    
      <item>
        <title>Clearable Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2104</comments>
        
        <description>## Simple Summary

&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; [[1]][Clearing-Wikipedia] 

## Actors

#### Clearing Agent

An account which processes, executes or rejects a clearable transfer.

#### Operator
An account which has been approved by an account to order clearable transfers on its behalf.

#### Orderer
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.

## Abstract

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.

## Motivation

A regulated token needs to comply with all the legal requirements, especially [KYC][KYC-Wikipedia] and [AML][AML-Wikipedia]. 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.

## Specification

```solidity
interface ClearableToken /* is ERC-1996 */ {
    enum ClearableTransferStatusCode { Nonexistent, Ordered, InProcess, Executed, Rejected, Cancelled }

    function orderTransfer(string calldata operationId, address to, uint256 value) external returns (bool);
    function orderTransferFrom(string calldata operationId, address from, address to, uint256 value) external returns (bool);
    function cancelTransfer(string calldata operationId) external returns (bool);
    function processClearableTransfer(string calldata operationId) external returns (bool);
    function executeClearableTransfer(string calldata operationId) external returns (bool);
    function rejectClearableTransfer(string calldata operationId, string calldata reason) external returns (bool);
    function retrieveClearableTransferData(string calldata operationId) external view returns (address from, address to, uint256 value, ClearableTransferStatusCode status);

    function authorizeClearableTransferOperator(address operator) external returns (bool);
    function revokeClearableTransferOperator(address operator) external returns (bool);
    function isClearableTransferOperatorFor(address operator, address from) external view returns (bool);

    event ClearableTransferOrdered(address indexed orderer, string operationId, address indexed from, address indexed to, uint256 value);
    event ClearableTransferInProcess(address indexed orderer, string operationId);
    event ClearableTransferExecuted(address indexed orderer, string operationId);
    event ClearableTransferRejected(address indexed orderer, string operationId, string reason);
    event ClearableTransferCancelled(address indexed orderer, string operationId);
    event AuthorizedClearableTransferOperator(address indexed operator, address indexed account);
    event RevokedClearableTransferOperator(address indexed operator, address indexed account);
}
```

### Functions

#### orderTransfer

Orders a clearable transfer on behalf of the msg.sender in favor of `to`. A clearing agent is responsible to either execute or reject the transfer. The function must revert if the operation ID has been used before.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the clearable transfer |
| to | The address of the payee, to whom the tokens are to be paid if executed |
| value | The amount to be transferred. Must be less or equal than the balance of the payer. |

#### orderTransferFrom

Orders a clearable transfer on behalf of the payer in favor of the `to`. A clearing agent is responsible to either execute or reject the transfer. The function must revert if the operation ID has been used before.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the clearable transfer |
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be paid if executed |
| value | The amount to be transferred. Must be less or equal than the balance of the payer. |

#### cancelTransfer

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 `InProcess`.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the clearable transfer |

#### processClearableTransfer

Sets a clearable transfer to status `InProcess`. 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.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the clearable transfer |

#### executeClearableTransfer

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.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the clearable transfer |

#### rejectClearableTransfer

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.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the clearable transfer |
| reason | A reason given by the clearing agent why the transfer has been rejected |

#### retrieveClearableTransferData

Retrieves all the information available for a particular clearable transfer.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the clearable transfer |

#### authorizeClearableTransferOperator

Approves an operator to order transfers on behalf of msg.sender.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be approved as operator of clearable transfers |

#### revokeClearableTransferOperator

Revokes the approval to order transfers on behalf of msg.sender.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be revoked as operator of clearable transfers |

#### isClearableTransferOperatorFor

Returns if an operator is approved to order transfers on behalf of `from`.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be an operator of clearable transfers |
| from | The address on which the holds would be created |

#### transfer

It is up to the implementer of the EIP if the `transfer` function of ERC-20 should always revert or is allowed under certain circumstances.

#### transferFrom

It is up to the implementer of the EIP if the `transferFrom` function of ERC-20 should always revert or is allowed under certain circumstances.


### Events

#### ClearableTransferOrdered

Must be emitted when a clearable transfer is ordered.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer of the transfer |
| operationId | The unique ID to identify the clearable transfer |
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be paid if executed |
| value | The amount to be transferred if executed |

#### ClearableTransferInProcess

Must be emitted when a clearable transfer is put in status `ÌnProcess`.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer of the transfer |
| operationId | The unique ID to identify the clearable transfer |

#### ClearableTransferExecuted

Must be emitted when a clearable transfer is executed.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer of the transfer |
| operationId | The unique ID to identify the clearable transfer |

#### ClearableTransferRejected

Must be emitted when a clearable transfer is rejected.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer of the transfer |
| operationId | The unique ID to identify the clearable transfer |
| reason | A reason given by the clearing agent why the transfer has been rejected |

#### ClearableTransferCancelled

Must be emitted when a clearable transfer is cancelled by its orderer.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer of the transfer |
| operationId | The unique ID to identify the clearable transfer |

#### AuthorizedClearableTransferOperator

Emitted when an operator has been approved to order transfers on behalf of another account.

| Parameter | Description |
| ---------|-------------|
| operator | The address which has been approved as operator of clearable transfers |
| account | Address on which behalf transfers will potentially be ordered |

#### RevokedClearableTransferOperator

Emitted when an operator has been revoked from ordering transfers on behalf of another account.

| Parameter | Description |
| ---------|-------------|
| operator | The address which has been revoked as operator of clearable transfers |
| account | Address on which behalf transfers could potentially be ordered |

## Rationale

This EIP uses [EIP-1996][EIP-1996] 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.

The `operationId` 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.

The `operationId` is a competitive resource. It is recommended, but not required, that the hold issuers used a unique prefix to avoid collisions.

While not requiring it, the naming of the functions `authorizeClearableTransferOperator`, `revokeClearableTransferOperator` and `isClearableTransferOperatorFor` follows the naming convention of [ERC-777](./eip-777.md).

## Backwards Compatibility

This EIP is fully backwards compatible as its implementation extends the functionality of [EIP-1996][EIP-1996].

## Implementation

The GitHub repository [IoBuilders/clearable-token](https://github.com/IoBuilders/clearable-token) contains the reference implementation.

## Contributors
This proposal has been collaboratively implemented by [adhara.io](https://adhara.io/) and [io.builders](https://io.builders/).

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

[1] https://en.wikipedia.org/wiki/Clearing_(finance)

[Clearing-Wikipedia]: https://en.wikipedia.org/wiki/Clearing_(finance)
[KYC-Wikipedia]: https://en.wikipedia.org/wiki/Know_your_customer
[AML-Wikipedia]: https://en.wikipedia.org/wiki/Money_laundering#Anti-money_laundering
[EIP-1996]: ./eip-1996.md
</description>
        <pubDate>Tue, 30 Apr 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2018</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2018</guid>
      </item>
    
      <item>
        <title>Fundable Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2105</comments>
        
        <description>## Simple Summary
An extension to the [ERC-20] 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.

## Actors

#### Token Wallet Owners
The person or company who owns the wallet, and will order a token fund request into the wallet.

#### Token contract owner / agent 
The entity, company responsible/owner of the token contract, and token issuing/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.

#### Orderer
An actor who is enabled to initiate funding orders on behalf of a token wallet owner.

## Abstract
Token wallet owners (or approved addresses) can order tokenization requests through  blockchain. This is done by calling the ```orderFund``` or ```orderFundFrom``` 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).

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.

## Motivation
Nowadays most of the token issuing/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&apos;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:

* Funding and payment traceability is enhanced bringing the initiation into the ledger. All payment stat
s can be stored on chain.
* Almost all money/token lifecycle is covered via a decentralized approach, complemented with private communications which is common use in the ecosystem.

## Specification

```solidity
interface IFundable /* is ERC-20 */ {
    enum FundStatusCode {
        Nonexistent,
        Ordered,
        InProcess,
        Executed,
        Rejected,
        Cancelled
    }
    function authorizeFundOperator(address orderer) external returns (bool);
    function revokeFundOperator(address orderer) external returns (bool) ;
    function orderFund(string calldata operationId, uint256 value, string calldata instructions) external returns (bool);
    function orderFundFrom(string calldata operationId, address walletToFund, uint256 value, string calldata instructions) external returns (bool);
    function cancelFund(string calldata operationId) external returns (bool);
    function processFund(string calldata operationId) external returns (bool);
    function executeFund(string calldata operationId) external returns (bool);
    function rejectFund(string calldata operationId, string calldata reason) external returns (bool);

    function isFundOperatorFor(address walletToFund, address orderer) external view returns (bool);
    function retrieveFundData(address orderer, string calldata operationId) external view returns (address walletToFund,       uint256 value, string memory instructions, FundStatusCode status);

    event FundOrdered(address indexed orderer, string indexed operationId, address indexed , uint256 value,         string instructions);
    event FundInProcess(address indexed orderer, string indexed operationId);
    event FundExecuted(address indexed orderer, string indexed operationId);
    event FundRejected(address indexed orderer, string indexed operationId, string reason);
    event FundCancelled(address indexed orderer, string indexed operationId);
    event FundOperatorAuthorized(address indexed walletToFund, address indexed orderer);
    event FundOperatorRevoked(address indexed walletToFund, address indexed orderer);
}
```

### Functions

#### authorizeFundOperator

Wallet owner, authorizes a given address to be fund orderer.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer.

#### revokeFundOperator

Wallet owner, revokes a given address to be fund orderer.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer.

#### orderFund

Creates a fund request, that will be processed by the token operator. The function must revert if the operation ID has been used before.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the request |
| value | The amount to be funded. |
| instruction | A string including the payment instruction. |

#### orderFundFrom

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.

| Parameter | Description |
| ---------|-------------|
| operationId |The unique ID to identify the request |
| walletToFund | The wallet to be funded on behalf.
| value | The amount to be funded. |
| instruction | A string including the payment instruction. |

#### cancelFund

Cancels a funding request.

| Parameter | Description |
| ---------|-------------|
| operationId | 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. |

#### processFund

Marks a funding request as on process. After the status is on process, order cannot be cancelled.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the request is in process.

#### executeFund

Issues the amount of tokens and marks a funding request as executed.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the request that has been executed.

#### rejectFund

Rejects a given operation with a reason.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the request that has been executed.
| reason | The specific reason that explains why the fund request was rejected. EIP 1066 codes can be used |

#### isFundOperatorFor

Checks that given player is allowed to order fund requests, for a given wallet.

| Parameter | Description |
| ---------|-------------|
| walletToFund | The wallet to be funded, and checked for approval permission.
| orderer | The address of the orderer, to be checked for approval permission.

#### retrieveFundData

Retrieves all the fund request data. Only operator, tokenHolder, and orderer can get the given operation data.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the fund order.

### Events

#### FundOrdered

Emitted when an token wallet owner orders a funding request.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the request |
| walletToFund | The wallet that the player is allowed to start funding requests |
| value | The amount to be funded. |
| instruction | A string including the payment instruction. |

#### FundInProcess

Emitted when an operator starts a funding request after validating the instruction, and the operation is marked as in process.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the fund request orderer. |
| operationId | The unique ID to identify the fund. |

#### FundExecuted

Emitted when an operator has executed a funding request.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the fund request orderer. |
| operationId | The unique ID to identify the fund. |

#### FundRejected

Emitted when an operator has rejected a funding request.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the fund request orderer. |
| operationId | The unique ID to identify the fund. |
| reason | The specific reason that explains why the fund request was rejected. EIP 1066 codes can be used |

#### FundCancelled

Emitted when a token holder, orderer,  has cancelled a funding request. This can only be done if the operator hasn&apos;t put the funding order in process.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the fund request orderer. |
| operationId | The unique ID to identify the fund. |

#### FundOperatorAuthorized

Emitted when a given player, operator, company or a given persona, has been approved to start fund request for a given token holder.

| Parameter | Description |
| ---------|-------------|
| walletToFund | The wallet that the player is allowed to start funding requests |
| orderer | The address that allows the player to start requests. |

#### FundOperatorRevoked

Emitted when a given player has been revoked initiate funding requests.

| Parameter | Description |
| ---------|-------------|
| walletToFund | The wallet that the player is allowed to start funding requests |
| orderer | The address that allows the player to start requests. |

## Rationale
This standards provides a functionality to allow token holders to start funding requests in a decentralized way.

It&apos;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.

Funding instruction format is open. ISO payment standard like is a good start point,

The `operationId` 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.

The `operationId` is a competitive resource. It is recommended, but not required, that the hold issuers used a unique prefix to avoid collisions.

## Backwards Compatibility
This EIP is fully backwards compatible as its implementation extends the functionality of [ERC-20].

## Implementation
The GitHub repository [IoBuilders/fundable-token](https://github.com/IoBuilders/fundable-token) contains the work in progress implementation.

## Contributors
This proposal has been collaboratively implemented by [adhara.io](https://adhara.io/) and [io.builders](https://io.builders/).

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

[ERC-20]: ./eip-20.md
</description>
        <pubDate>Fri, 10 May 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2019</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2019</guid>
      </item>
    
      <item>
        <title>E-Money Standard Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2407</comments>
        
        <description>## Simple Summary

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. 

## Actors

#### Operator
An account, which has been approved by an account to perform an action on the behalf of another account.

## Abstract

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.

## Motivation

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:
* **Electronic money entities**: 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.
* **Banking licenses**: 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.
* **Central banks**: 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.

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:
* **Know Your Customer (KYC)**: 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)
* **Anti Money Laundering (AML)**: 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

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.

The E-Money Standard Token builds on Ethereum standards currently in use such as [ERC-20], but it extends them to provide few key additional pieces of functionality, needed in the regulated financial world:
* **Compliance**: 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 `require` that these methods return a positive answer before executing the transaction.
* **Clearing**: In addition to the standard [ERC-20] `transfer` 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:
    1. transfers are ordered
    1. after clearing them, transfers are executed or rejected by the operator of the token contract
* **Holds**: 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.
* **Funding requests**: 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.
* **Payouts**: 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.

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.

## Specification

```solidity
interface EMoneyToken /* is ERC-1996, ERC-2018, ERC-2019, ERC-2021 */ {
    function currency() external view returns (string memory);
    function version() external pure returns (string memory);
    
    function availableFunds(address account) external view returns (uint256);
    
    function checkTransferAllowed(address from, address to, uint256 value) external view returns (byte status);
    function checkApproveAllowed(address from, address spender, uint256 value) external view returns (byte status);
    
    function checkHoldAllowed(address from, address to, address notary, uint256 value) external view returns (byte status);
    function checkAuthorizeHoldOperatorAllowed(address operator, address from) external view returns (byte status);    

    function checkOrderTransferAllowed(address from, address to, uint256 value) external view returns (byte status);
    function checkAuthorizeClearableTransferOperatorAllowed(address operator, address from) external view returns (byte status);
    
    function checkOrderFundAllowed(address to, address operator, uint256 value) external view returns (byte status);
    function checkAuthorizeFundOperatorAllowed(address operator, address to) external view returns (byte status);
    
    function checkOrderPayoutAllowed(address from, address operator, uint256 value) external view returns (byte status);
    function checkAuthorizePayoutOperatorAllowed(address operator, address from) external view returns (byte status);
}
```

### Mandatory checks

The checks must be verified in their corresponding actions. The action must only be successful if the check return an `Allowed` status code. In any other case the functions must revert.

### Status codes

If an action is allowed `0x11` (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 `0x10` (Disallowed), or an issuer-specific code with equivalent but more precise meaning.

### Functions

#### currency

Returns the currency that backs the token. The value must be a code defined in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

| Parameter | Description |
| ---------|-------------|
| - | - |

#### version

Returns the current version of the smart contract. The format of the version is up to the implementer of the EIP.

| Parameter | Description |
| ---------|-------------|
| - | - |

#### availableFunds

Returns the total net funds of an account. Taking into consideration the outright balance and the held balances.

| Parameter | Description |
| ---------|-------------|
| account | The account which available funds should be returned |

#### checkTransferAllowed

Checks if the `transfer` or `transferFrom` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be transferred if executed |
| value | The amount to be transferred |

#### checkApproveAllowed

Checks if the `approve` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| from | The address of the payer, from whom the tokens are to be taken if executed |
| spender | The address of the spender, which potentially can initiate transfers on behalf of `from` |
| value | The maximum amount to be transferred |

#### checkHoldAllowed

Checks if the `hold` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be transferred if executed |
| notary | The address of the notary who is going to determine whether the hold is to be executed or released |
| value | The amount to be transferred. Must be less or equal than the balance of the payer |

#### checkAuthorizeHoldOperatorAllowed

Checks if the `checkAuthorizeHoldOperatorAllowed` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be approved as operator of clearable transfers |
| from | The address on which behalf holds could potentially be issued |

#### checkOrderTransferAllowed

Checks if the `orderTransfer` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| from | The address of the payer, from whom the tokens are to be taken if executed |
| to | The address of the payee, to whom the tokens are to be paid if executed |
| value | The amount to be transferred. Must be less or equal than the balance of the payer |

#### checkAuthorizeClearableTransferOperatorAllowed

Checks if the `authorizeClearableTransferOperator` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be approved as operator of clearable transfers |
| from | The address on which behalf clearable transfers could potentially be ordered |

#### checkOrderFundAllowed

Checks if the `orderFund` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| to | The address to which the tokens are to be given if executed |
| operator | The address of the requester, which initiates the funding order | 
| value | The amount to be funded |

#### checkAuthorizeFundOperatorAllowed

Checks if the `authorizeFundOperator` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be approved as operator of ordering funding |
| to | The address which the tokens are to be given if executed |

#### checkOrderPayoutAllowed

Checks if the `orderPayout` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| from | The address from whom the tokens are to be taken if executed |
| operator | The address of the requester, which initiates the payout request | 
| value | The amount to be paid out |

#### checkAuthorizePayoutOperatorAllowed

Checks if the `authorizePayoutOperator` function is allowed to be executed with the given parameters.

| Parameter | Description |
| ---------|-------------|
| operator | The address to be approved as operator of ordering payouts |
| from | The address from which the tokens are to be taken if executed |

## Rationale

This EIP unifies [ERC-1996][ERC-1996], [ERC-2018][ERC-2018], [ERC-2019][ERC-2019] and [ERC-2021][ERC-2021] 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.

While not requiring it, the naming of the check functions was adopted from [ERC-1462][ERC-1462].

## Backwards Compatibility

This EIP is fully backwards compatible as its implementation extends the functionality of [ERC-1996][ERC-1996], [ERC-2018][ERC-2018], [ERC-2019][ERC-2019], [ERC-2021][ERC-2021] and [ERC-1066][ERC-1066].

## Implementation

The GitHub repository [IoBuilders/em-token](https://github.com/IoBuilders/em-token) contains the work in progress implementation.

## Contributors
This proposal has been collaboratively implemented by [adhara.io](https://adhara.io/) and [io.builders](https://io.builders/).

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

[ERC-20]: ./eip-20.md
[ERC-1066]: ./eip-1066.md
[ERC-1462]: ./eip-1462.md
[ERC-1996]: ./eip-1996.md
[ERC-2018]: ./eip-2018.md
[ERC-2019]: ./eip-2019.md
[ERC-2021]: ./eip-2021.md
</description>
        <pubDate>Fri, 10 May 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2020</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2020</guid>
      </item>
    
      <item>
        <title>Payoutable Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2106</comments>
        
        <description>## Simple Summary
An extension to the [ERC-20] standard token that allows Token wallet owners to request payout from their wallet, by calling the smart contract and attaching a payout instruction string.

## Actors

#### Token Wallet Owners
The person or company who owns the wallet, and will order payout.

#### Token contract owner / agent
The entity, company responsible/owner of the token contract, and token issuing/minting. This actor is in charge of trying to fulfill all payout request(s), reading the payout instruction(s), and correlate the payout details.

#### Orderer
An actor who is enabled to initiate payout orders on behalf of a token wallet owner.

## Abstract
Token wallet owners (or approved addresses) can order payout requests through  blockchain. This is done by calling the ```orderPayoutFrom``` or ```orderPayoutFrom``` 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.

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.

## Motivation
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:

* Payout, burning  traceability is enhanced bringing the initiation into the ledger. All payment, payout statuses can be stored on chain.
* Almost all money/token lifecycle is covered via a decentralized approach, complemented with private communications which is common use in the ecosystem.

In this case, the following movement of tokens are done as the process progresses:

* 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 ```Ordered``` state
* The operator then can put the payout request ```InProcess```, which prevents the _orderer_ of the payout from being able to cancel the payout request
* 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 ```FundsInSuspense``` state
* 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 ```Executed``` state
* Either before or after placing the request ```InProcess```, 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 ```Rejected```
* When the payout is ```Ordered``` and before the operator places it into the ```InProcess``` state, the orderer of the payout can also cancel it, which frees up the hold and puts the payout into the final ```Cancelled``` state

## Specification

```solidity
interface IPayoutable /* is ERC-20 */ {
    enum PayoutStatusCode {
        Nonexistent,
        Ordered,
        InProcess,
        FundsInSuspense,
        Executed,
        Rejected,
        Cancelled
    }
    function authorizePayoutOperator(address orderer) external returns (bool);
    function revokePayoutOperator(address orderer) external returns (bool);
    function orderPayout(string calldata operationId, uint256 value, string calldata instructions) external returns (bool);
    function orderPayoutFrom(string calldata operationId, address walletToBePaidOut, uint256 value, string calldata instructions) external returns (bool);
    function cancelPayout(string calldata operationId) external returns (bool);
    function processPayout(string calldata operationId) external returns (bool);
    function putFundsInSuspenseInPayout(string calldata operationId) external returns (bool);
    function executePayout(string calldata operationId) external returns (bool);
    function rejectPayout(string calldata operationId, string calldata reason) external returns (bool);

    function isPayoutOperatorFor(address walletToDebit, address orderer) external view returns (bool);
    function retrievePayoutData(string calldata operationId) external view returns (address walletToDebit, uint256 value, string memory instructions, PayoutStatusCode status);

    event PayoutOrdered(address indexed orderer, string indexed operationId, address indexed walletToDebit, uint256 value, string instructions);
    event PayoutInProcess(address indexed orderer, string indexed operationId);
    event PayoutFundsInSuspense(address indexed orderer, string indexed operationId);
    event PayoutExecuted(address indexed orderer, string indexed operationId);
    event PayoutRejected(address indexed orderer, string indexed operationId, string reason);
    event PayoutCancelled(address indexed orderer, string indexed operationId);
    event PayoutOperatorAuthorized(address indexed walletToBePaidOut, address indexed orderer);
    event PayoutOperatorRevoked(address indexed walletToBePaidOut, address indexed orderer);
}
```

### Functions

#### authorizePayoutOperator

Wallet owner, allows a given address to be payout orderer.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer. |

#### revokePayoutOperator

Wallet owner, Revokes a given address to be payout orderer.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer. |

#### orderPayout

Creates a payout request, that will be processed by the token operator. The function must revert if the operation ID has been used before.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the request |
| value | The amount to be paid out. |
| instruction | A string including the payment instruction. |

#### orderPayoutFrom

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.

| Parameter | Description |
| ---------|-------------|
| operationId |The unique ID to identify the request |
| walletToBePaidOut | The wallet to be paid out on behalf. |
| value | The amount to be paid out. |
| instruction | A string including the payment instruction. |

#### cancelPayout

Cancels a payout request.

| Parameter | Description |
| ---------|-------------|
| operationId | 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/orderer. |
| reason | The specific reason that explains why the payout request was rejected. [EIP-1066] codes can be used. |


#### processPayout

Marks a payout request as on process. After the status is on process, order cannot be cancelled.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify that the request is in process. |

#### putFundsInSuspenseInPayout

Put a given payout in suspense. Can only be done if it is in process.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify that the request is in process. |

#### executePayout

Burn the amount of tokens and marks a payout request as executed.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the request that has been executed. |

#### rejectPayout

Rejects a given operation with a reason.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the request that has been executed. |
| reason | The specific reason that explains why the payout request was rejected. [EIP-1066] codes can be used |

#### isApprovedToOrderPayout

Checks that given player is allowed to order payout  requests, for a given wallet.

| Parameter | Description |
| ---------|-------------|
| walletToBePaidOut | The wallet to be paid out, and checked for approval permission. |
| orderer | The address of the orderer, to be checked for approval permission. |

#### retrievePayoutData

Retrieves all the payout request data. Only operator, tokenHolder, and orderer can get the given operation data.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the orderer, to correlate the right data. |
| operationId | The unique ID to identify the payout order. |

### Events

#### Payout Ordered

Emitted when an token wallet owner orders a payout request.

| Parameter | Description |
| ---------|-------------|
| operationId | The unique ID to identify the request |
| walletToBePaidOut | The wallet that is requested to be paid out |
| value | The amount to be funded. |
| instruction | A string including the payment instruction. |

#### PayoutFundsInSuspense

Emitted when an operator puts fund in suspense.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the payout request orderer. |
| operationId | The unique ID to identify the payout. |

#### PayoutInProcess

Emitted when an operator accepts a payout request, and the operation is in process.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the payout request orderer. |
| operationId | The unique ID to identify the payout. |

#### PayoutExecuted

Emitted when an operator has executed a payout request.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the payout request orderer. |
| operationId | The unique ID to identify the payout. |

#### PayoutRejected

Emitted when an operator has rejected a payout request.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the payout request orderer. |
| operationId | The unique ID to identify the payout. |
| reason | The specific reason that explains why the payout request was rejected. [EIP-1066] codes can be used |

#### PayoutCancelled

Emitted when a token holder, orderer,  has cancelled a payout request. This can only be done if the operator hasn&apos;t put the payout order in process.

| Parameter | Description |
| ---------|-------------|
| orderer | The address of the payout request orderer. |
| operationId | The unique ID per payout issuer to identify the payout. |

#### PayoutOperatorAuthorized

Emitted when a given player, operator, company or a given persona, has been approved to start payout request for a given token holder.

| Parameter | Description |
| ---------|-------------|
| walletToBePaidOut | The wallet that the player is allowed to start payout requests |
| orderer |The address that allows the player to start requests. |

#### PayoutOperatorRevoked

Emitted when a given player has been revoked initiate payout requests.

| Parameter | Description |
| ---------|-------------|
| walletToBePaidOut | The wallet that the player is allowed to start payout requests |
| orderer |The address that allows the player to start requests. |

## Rationale
This standards provides a functionality to allow token holders to start payout requests in a decentralized way.

It&apos;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.

Payout instruction format is open. ISO payment standard like is a good start point.

This EIP uses [EIP-1996] 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.

The `operationId` 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.

The `operationId` is a competitive resource. It is recommended, but not required, that the hold issuers used a unique prefix to avoid collisions.

## Backwards Compatibility
This EIP is fully backwards compatible as its implementation extends the functionality of [ERC-20] and [ERC-1996].

## Implementation
The GitHub repository [IoBuilders/payoutable-token](https://github.com/IoBuilders/payoutable-token) contains the reference implementation.

## Contributors
This proposal has been collaboratively implemented by [adhara.io](https://adhara.io/) and [io.builders](https://io.builders/).

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

[ERC-20]: ./eip-20.md
[EIP-1066]: ./eip-1066.md
[EIP-1996]: ./eip-1996.md
</description>
        <pubDate>Fri, 10 May 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2021</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2021</guid>
      </item>
    
      <item>
        <title>Compact Signature Representation</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2440</comments>
        
        <description>## Abstract

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.

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.

## Motivation

The motivations for a compact representation are to simplify handling
transactions in client code, reduce gas costs and reduce transaction sizes.


## Specification

A secp256k1 signature is made up of 3 parameters, `r`, `s` and `yParity`.
The `r` represents the `x` component on the curve (from which the `y` can be
computed), and the `s` represents the challenge solution for signing by a
private key. Due to the symmetric nature of an elliptic curve, a `yParity`
is required, which indicates which of the 2 possible solutions was intended,
by indicating its parity (odd-ness).

Two key observations are required to create a compact representation.

First, the `yParity` parameter is always either 0 or 1 (canonically the values
used have historically been 27 and 28, as these values didn&apos;t collide with other
binary prefixes used in Bitcoin).

Second, the top bit of the `s` parameters is **always** 0, due to the use of
canonical signatures which flip the solution parity to prevent negative values,
which was introduced as [a constraint in Homestead](./eip-2.md).

So, we can hijack the top bit in the `s` parameter to store the value of
`yParity`, resulting in:

```
[256-bit r value][1-bit yParity value][255-bit s value]
```


### Example Implementation In Python

```python
# Assume yParity is 0 or 1, normalized from the canonical 27 or 28
def to_compact(r, s, yParity):
    return {
        &quot;r&quot;: r,
        &quot;yParityAndS&quot;: (yParity &lt;&lt; 255) | s
    }

def to_canonical(r, yParityAndS):
    return {
        &quot;r&quot;: r,
        &quot;s&quot;: yParityAndS &amp; ((1 &lt;&lt; 255) - 1),
        &quot;yParity&quot;: (yParityAndS &gt;&gt; 255)
    }
```


## Rationale

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.


## Backwards Compatibility

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.


## Test Cases

```
Private Key: 0x1234567890123456789012345678901234567890123456789012345678901234
Message: &quot;Hello World&quot;
Signature:
  r:  0x68a020a209d3d56c46f38cc50a33f704f4a9a10a59377f8dd762ac66910e9b90
  s:  0x7e865ad05c4035ab5792787d4a0297a43617ae897930a6fe4d822b8faea52064
  v:  27
Compact Signature:
  r:           0x68a020a209d3d56c46f38cc50a33f704f4a9a10a59377f8dd762ac66910e9b90
  yParityAndS: 0x7e865ad05c4035ab5792787d4a0297a43617ae897930a6fe4d822b8faea52064
```

```
Private Key: 0x1234567890123456789012345678901234567890123456789012345678901234
Message: &quot;It&apos;s a small(er) world&quot;
Signature:
  r:  0x9328da16089fcba9bececa81663203989f2df5fe1faa6291a45381c81bd17f76
  s:  0x139c6d6b623b42da56557e5e734a43dc83345ddfadec52cbe24d0cc64f550793
  v:  28
Compact Signature:
  r:           0x9328da16089fcba9bececa81663203989f2df5fe1faa6291a45381c81bd17f76
  yParityAndS: 0x939c6d6b623b42da56557e5e734a43dc83345ddfadec52cbe24d0cc64f550793  
```


## Reference Implementation

The ethers.js library [supports this in v5](https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/bytes/src.ts/index.ts#L323)
as an unofficial property of split signatures (i.e. `sig._vs`), but should be
considered an internal property that may change at discretion of the community
and any changes to this EIP.


## Security Considerations 

There are no additional security concerns introduced by this EIP.


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 14 Mar 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2098</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2098</guid>
      </item>
    
      <item>
        <title>Consumable Interface (Tickets, etc)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-2135-erc-consumable-interface/3439</comments>
        
        <description>## Abstract

This EIP defines an interface to mark a digital asset as &quot;consumable&quot; and to react to its &quot;consumption.&quot;

## Motivation

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.

Having a standard interface enables interoperability for services, clients, UI, and inter-contract functionalities on top of this use-case.

## Specification

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.

1. Any compliant contract **MUST** implement the following interface:

```solidity
pragma solidity &gt;=0.7.0 &lt;0.9.0;

/// The ERC-165 identifier of this interface is 0xdd691946
interface IERC2135 {
    /// @notice The consume function consumes a token every time it succeeds.
    /// @param _consumer the address of consumer of this token. It doesn&apos;t have
    ///                  to be the EOA or contract Account that initiates the TX.
    /// @param _assetId  the NFT asset being consumed
    /// @param _data     extra data passed in for consume for extra message
    ///                  or future extension.
    function consume(
        address _consumer,
        uint256 _assetId,
        uint256 _amount,
        bytes calldata _data
    ) external returns (bool _success);

    /// @notice The interface to check whether an asset is consumable.
    /// @param _consumer the address of consumer of this token. It doesn&apos;t have
    ///                  to be the EOA or contract Account that initiates the TX.
    /// @param _assetId  the NFT asset being consumed.
    /// @param _amount   the amount of the asset being consumed.
    function isConsumableBy(
        address _consumer,
        uint256 _assetId,
        uint256 _amount
    ) external view returns (bool _consumable);

    /// @notice The event emitted when there is a successful consumption.
    /// @param consumer the address of consumer of this token. It doesn&apos;t have
    ///                  to be the EOA or contract Account that initiates the TX.
    /// @param assetId  the NFT asset being consumed
    /// @param amount   the amount of the asset being consumed.
    /// @param data     extra data passed in for consume for extra message
    ///                  or future extension.
    event OnConsumption(
        address indexed consumer,
        uint256 indexed assetId,
        uint256 amount,
        bytes data
    );
}
```

2. If the compliant contract is an [ERC-721](./eip-721.md) or [ERC-1155](./eip-1155.md) token, in addition to `OnConsumption`, it **MUST** also emit the `Transfer` / `TransferSingle` event (as applicable) as if a token has been transferred from the current holder to the zero address if the call to `consume` method succeeds.

3. `supportsInterface(0xdd691946)` **MUST** return `true` for any compliant contract, as per [ERC-165](./eip-165.md).

## Rationale

1. The function `consume` performs the consume action. This EIP does not assume:

- who has the power to perform consumption
- under what condition consumption can occur

It does, however, assume the asset can be identified in a `uint256` asset id as in the parameter. A design convention and compatibility consideration is put in place to follow the ERC-721 pattern.

2. The event notifies subscribers whoever are interested to learn an asset is being consumed.

3. To keep it simple, this standard *intentionally* 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.

4. Metadata associated to the consumables is not included the standard. If necessary, related metadata can be created with a separate metadata extension interface like `ERC721Metadata` from [ERC-721](./eip-721.md)

5. We choose to include an `address consumer` for `consume` function and `isConsumableBy` so that an NFT MAY be consumed for someone other than the transaction initiator.

6. We choose to include an extra `_data` field for future extension, such as
adding crypto endorsements.

7. 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&apos;t want to rule out
the potential future case someone use a different token standard or use it in different use cases.

8. The boolean view function of `isConsumableBy` can be used to check whether an asset is
consumable by the `_consumer`.

## Backwards Compatibility

This interface is designed to be compatible with ERC-721 and NFT of ERC-1155. It can be tweaked to used for [ERC-20](./eip-20.md), [ERC-777](./eip-777.md) and Fungible Token of ERC-1155.

## Test Cases

```ts

  describe(&quot;Consumption&quot;, function () {
    it(&quot;Should consume when minted&quot;, async function () {
      const fakeTokenId = &quot;0x1234&quot;;
      const { contract, addr1 } = await loadFixture(deployFixture);
      await contract.safeMint(addr1.address, fakeTokenId);
      expect(await contract.balanceOf(addr1.address)).to.equal(1);
      expect(await contract.ownerOf(fakeTokenId)).to.equal(addr1.address);
      expect(await contract.isConsumableBy(addr1.address, fakeTokenId, 1)).to.be.true;
      const tx = await contract.consume(addr1.address, fakeTokenId, 1, []);
      const receipt = await tx.wait();
      const events = receipt.events.filter((x: any) =&gt; { return x.event == &quot;OnConsumption&quot; });
      expect(events.length).to.equal(1);
      expect(events[0].args.consumer).to.equal(addr1.address);
      expect(events[0].args.assetId).to.equal(fakeTokenId);
      expect(events[0].args.amount).to.equal(1);
      expect(await contract.balanceOf(addr1.address)).to.equal(0);
      await expect(contract.ownerOf(fakeTokenId))
        .to.be.rejectedWith(&apos;ERC721: invalid token ID&apos;);
      await expect(contract.isConsumableBy(addr1.address, fakeTokenId, 1))
        .to.be.rejectedWith(&apos;ERC721: invalid token ID&apos;);
    });
  });

  describe(&quot;EIP-165 Identifier&quot;, function () {
    it(&quot;Should match&quot;, async function () {
      const { contract } = await loadFixture(deployFixture);
      expect(await contract.get165()).to.equal(&quot;0xdd691946&quot;);
      expect(await contract.supportsInterface(&quot;0xdd691946&quot;)).to.be.true;
    });
  });
```

## Reference Implementation

A deployment of version 0x1002 has been deployed onto `goerli` testnet at address `0x3682bcD67b8A5c0257Ab163a226fBe07BF46379B`.

Find the reference contract verified source code on Etherscan&apos;s
`goerli` site for the address above.

## Security Considerations

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.

Compliant contracts should also carefully define access control, particularly whether any EOA or contract account may or may not initiate a `consume` method in their own use case.

Security audits and tests should be used to verify that the access control to the `consume`
function behaves as expected.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 23 Jun 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2135</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2135</guid>
      </item>
    
      <item>
        <title>dType Storage Extension - Decentralized Type System for EVM</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2157</comments>
        
        <description>## Simple Summary

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.

## Abstract

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.

## Motivation

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.

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.

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.

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.

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.

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.

Another use case is data bridges between Ethereum shards or between Ethereum and other chains. Data syncing between shards/chains can be done programmatically, across data types (from various projects). Imagine a user having a public profile/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.

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.

## Specification

### TypeRootContract

ERC-1900 defines a `contractAddress` 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 `contractAddress` will contain the Etherereum address of a `TypeRootContract`.

```solidity
contract TypeRootContract {
  address public libraryAddress;
  address public storageAddress;

  constructor(address _library, address _storage) public {
    libraryAddress = _library;
    storageAddress = _storage;
  }
}
```

- `libraryAddress` - Ethereum address of the type definition library, from ERC-1900
- `storageAddress` - Ethereum address of the type data storage contract


### TypeStorageContract

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&apos;s `getIdentifier` function, based on the type instance values.

We propose a Solidity CRUD pattern, as described in https://medium.com/robhitchens/solidity-crud-part-1-824ffa69509a, where records can also be retrieved using their index - a monotonically increasing counter.

An stub implementation for the TypeStorageContract would look like:

```solidity
import &apos;./TypeALib.sol&apos;;

contract TypeAStorage {
    using TypeALib for TypeALib.TypeA;

    bytes32[] public typeIndex;
    mapping(bytes32 =&gt; Type) public typeStruct;

    struct Type {
        TypeALib.TypeA data;
        uint256 index;
    }

    event LogNew(bytes32 indexed identifier, uint256 indexed index);
    event LogUpdate(bytes32 indexed identifier, uint256 indexed index);
    event LogRemove(bytes32 indexed identifier, uint256 indexed index);

    function insert(TypeALib.TypeA memory data) public returns (bytes32 identifier);

    function insertBytes(bytes memory data) public returns (bytes32 identifier);

    function remove(bytes32 identifier) public returns(uint256 index);

    function update(bytes32 identifier, TypeALib.TypeA memory data) public returns(bytes32 identifier)

    function isStored(bytes32 identifier) public view returns(bool stored);

    function getByHash(bytes32 identifier) public view returns(TypeALib.TypeA memory data);

    function getByIndex(uint256 index) public view returns(TypeALib.TypeA memory data);

    function count() public view returns(uint256 counter);
}
```

## Rationale

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.

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.

We have chosen to define a `TypeRootContract` 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.

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.

The `TypeStorageContract` pattern should ensure:
- type instance addressability by the primary identifier
- a way to retrieve all records from the contract
- counting the number of records


## Backwards Compatibility

This proposal does not affect existent Ethereum standards or implementations. It uses the present experimental version of ABIEncoderV2.

## Test Cases

Will be added.

## Implementation

An in-work implementation can be found at https://github.com/pipeos-one/dType/tree/master/contracts/contracts.
This proposal will be updated with an appropriate implementation when consensus is reached on the specifications.


## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 28 Jun 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2157</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2157</guid>
      </item>
    
      <item>
        <title>dType Alias Extension - Decentralized Type System</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2192</comments>
        
        <description>## Simple Summary

We are proposing Alias - a semantic standard for identifying on-chain resources by human-readable qualifiers, supporting any type of data.

## Abstract

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, [EIP-1900](./eip-1900.md)) and the data content (identifier provided by a dType Storage Contract, [EIP-2157](./eip-2157.md)). It is a universal way of addressing content, supporting any type of data.

## Motivation

There are standards that currently address the need for attaching human-readable identifiers to Ethereum accounts, such as [EIP-137](./eip-137.md). These standards are an attempt to bring domain names to Ethereum, following the same format as DNS: `subdomain.domain.tld`. This leaf -&gt; root format is unintuitive and contradicts the semantic meaning that `.` has in programming languages, which is a root -&gt; leaf connection (e.g. in OOP, when accessing an object&apos;s property). A more intuitive and widely used approach is a root-&gt;leaf format, used in file browsers, hierarchical menus, and even in other decentralized systems, which give unique identifiers to resources (e.g. `0x56.Currency.TCoin` in [Libra](https://medium.com/r/?url=https%3A%2F%2Fdevelopers.libra.org).

Moreover, [EIP-137](./eip-137.md) is not flexible enough to address smart contract content,  which can contain heterogeneous data that belongs to various accounts. For example, a `PaymentChannel` smart contract can have an domain name. However, the `Alice-Bob` 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.

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 `struct` instances inside smart contracts.

Imagine the following dType types: `SocialNetwork` and `Profile`, with related storage data about user profiles. One could access such a profile using an alias for the data content: `alice@socialnetwork.profile`. For a `PaymentChannel` type, Alice can refer to her channel with Bob with `alice-bob.paymentchannel`.
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&apos;s metadata.

## Specification

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.

We define an `Alias` 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 `Alias` 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 [EIP-2157](./eip-2157.md). An owner can update or delete an alias at any time.

```solidity
interface Alias {

    event AliasSet(bytes32 dtypeIdentifier, bytes1 separator, string name, bytes32 indexed identifier);

    function setAlias(bytes32 dtypeIdentifier, bytes1 separator, string memory name, bytes32 identifier, bytes memory signature) external;

    function getAliased(bytes1 separator, string memory name) view external returns (bytes32 identifier);
}
```

- `dtypeIdentifier`: Type identifier from the dType registry, needed to ensure uniqueness of `name` for a dType type. `dtypeIdentifier` is checked to see if it exists in the dType registry. The dType registry also links the type&apos;s data storage contract, where the existence and ownership of the `identifier` is checked.
- `name`: user-defined human-readable name for the resource referenced by `identifier`
- `separator`: Character acting as a separator between the name and the rest of the alias. Allowed values:
  - `.`: general domain separation, using root-&gt;leaf semantics. E.g. `domain.subdomain.leafsubdomain.resource`
  - `@`: identifying actor-related data, such as user profiles, using leaf-&gt;root semantics. E.g. `alice@socialnetwork.profile` or `alice@dao@eth`
  - `#`: identifying concepts, using root-&gt;leaf semantics. E.g. `topicX#postY`
  - `/`: general resource path definition, using root-&gt;leaf semantics. E.g. `resourceRoot/resource`
- `identifier`: Resource identifier from a smart contract linked with dType
- `signature`: Alias owner signature on `dtypeIdentifier`, `identifier`, `name`, `separator`, `nonce`, `aliasAddress`, `chainId`.
  - `nonce`: monotonically increasing counter, used to prevent replay attacks
  - `aliasAddress`: Ethereum address of `Alias` contract
  - `chainId`: chain on which the `Alias` contract is deployed, as detailed in [EIP-155](./eip-155.md), used to prevent replay attacks when updating the `identifier` for an alias.

Content addressability can be done:
- using the `bytes32` identifiers directly, e.g. `0x0b5e76559822448f6243a6f76ac7864eba89c810084471bdee2a63429c92d2e7@0x9dbb9abe0c47484c5707699b3ceea23b1c2cca2ac72681256ab42ae01bd347da`
- using the human identifiers, e.g. `alice@socialnetwork`

Both of the above examples will resolve to the same content.


## Rationale

Current attempts to solve content addressability, such as [EIP-137](./eip-137.md), only target Ethereum accounts. These are based on inherited concepts from HTTP and DNS, which are not machine friendly.

With [EIP-1900](./eip-1900.md) and [EIP-2157](./eip-2157.md), 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 [intuitive order rule](https://github.com/loredanacirstea/articles/blob/master/articles/Flexible_Alias_or_Why_ENS_is_Obsolete.md).

Multiple aliases can be assigned to a single resource. Either by using a different `name` or by using a different `separator`. Each `separator` can have a specific standard for displaying and processing data, based on its semantic meaning.

## Backwards Compatibility

Will be added.

## Test Cases

Will be added.

## Implementation

An in-work implementation can be found at https://github.com/pipeos-one/dType/blob/master/contracts/contracts/Alias.sol.
This proposal will be updated with an appropriate implementation when consensus is reached on the specifications.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 16 Jul 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2193</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2193</guid>
      </item>
    
      <item>
        <title>Atomic Swap-based American Call Option Contract Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2266</comments>
        
        <description>## Simple Summary

A standard for token contracts providing Atomic Swap-based American Call Option functionalities.

## Abstract

This standard provides functionality to make Atomic Swap-based American Call Option payment. The Atomic Swap protocol based on Hashed Time-Locked Contract (HTLC) [^1] has optionality [^2], 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.


## Motivation

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[^2] 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[^3] 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&apos;s money maliciously. This EIP aims at providing the standard of implementing this protocol in existing token standards.

## Specification

The Atomic Swap-based American Call Option smart contract should follow the syntax and semantics of Ethereum smart contracts.

### Definitions

+ `initiator`: the party who publishes the advertisement of the swap.
+ `participant`: the party who agrees on the advertisement and participates in the swap with `initiator`.
+ `asset`: the amount of token(s) to be exchanged.
+ `premium`: the amount of token(s) that `initiator` pays to `participant` as the premium.
+ `redeem`: the action to claim the token from the other party.
+ `refund`: the action to claim the token from the party herself/himself, because of timelock expiration.
+ `secrect`: a random string chosen by `initiator` as the preimage of a hash.
+ `secrectHash`: a string equals to the hash of `secrect`, used for constructing HTLCs.
+ `timelock`: a timestamp representing the timelimit, before when the asset can be redeemed, and otherwise can only be refunded.

### Storage Variables

#### swap

This mapping stores the metadata of the swap contracts, including the parties and tokens involved. Each contract uses different `secretHash`, and is distinguished by `secretHash`.

```solidity
mapping(bytes32 =&gt; Swap) public swap;
```

#### initiatorAsset

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 `secretHash`.

```solidity
mapping(bytes32 =&gt; InitiatorAsset) public initiatorAsset;
```

#### participantAsset

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 `secretHash`.

```solidity
mapping(bytes32 =&gt; ParticipantAsset) public participantAsset;
```

#### premiumAsset

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 `secretHash`.

```solidity
mapping(bytes32 =&gt; Premium) public premium;
```


### Methods

#### setup

This function sets up the swap contract, including the both parties involved, the tokens to exchanged, and so on.

```solidity
function setup(bytes32 secretHash, address payable initiator, address tokenA, address tokenB, uint256 initiatorAssetAmount, address payable participant, uint256 participantAssetAmount, uint256 premiumAmount) public payable
```

#### initiate

The initiator invokes this function to fill and lock the token she/he wants to sell and join the contract.

```solidity
function initiate(bytes32 secretHash, uint256 assetRefundTime) public payable
```

#### fillPremium

The initiator invokes this function to fill and lock the premium.

```solidity
function fillPremium(bytes32 secretHash, uint256 premiumRefundTime) public payable
```

#### participate

The participant invokes this function to fill and lock the token she/he wants to sell and join the contract.

```solidity
function participate(bytes32 secretHash, uint256 assetRefundTime) public payable
```

#### redeemAsset

One of the parties invokes this function to get the token from the other party, by providing the preimage of the hash lock `secret`.

```solidity
function redeemAsset(bytes32 secret, bytes32 secretHash) public
```

#### refundAsset

One of the parties invokes this function to get the token back after the timelock expires.

```solidity
function refundAsset(bytes32 secretHash) public
```

#### redeemPremium

The participant invokes this function to get the premium. This can be invoked only if the participant has already invoked `participate` and the participant&apos;s token is redeemed or refunded.

```solidity
function redeemPremium(bytes32 secretHash) public
```

#### refundPremium

The initiator invokes this function to get the premium back after the timelock expires.

```solidity
function refundPremium(bytes32 secretHash) public
```


### Events

#### SetUp

This event indicates that one party has set up the contract using the function `setup()`.

```solidity
event SetUp(bytes32 secretHash, address initiator, address participant, address tokenA, address tokenB, uint256 initiatorAssetAmount, uint256 participantAssetAmount, uint256 premiumAmount);
```

#### Initiated

This event indicates that `initiator` has filled and locked the token to be exchanged using the function `initiate()`.

```solidity
event Initiated(uint256 initiateTimestamp, bytes32 secretHash, address initiator, address participant, address initiatorAssetToken, uint256 initiatorAssetAmount, uint256 initiatorAssetRefundTimestamp);
```

#### Participated

This event indicates that `participant` has filled and locked the token to be exchanged using the function `participate()`.

```solidity
event Participated(uint256 participateTimestamp, bytes32 secretHash, address initiator, address participant, address participantAssetToken, uint256 participantAssetAmount, uint256 participantAssetRefundTimestamp);
```

#### PremiumFilled

This event indicates that `initiator` has filled and locked `premium` using the function `fillPremium()`.

```solidity
event PremiumFilled(uint256 fillPremiumTimestamp, bytes32 secretHash, address initiator, address participant, address premiumToken, uint256 premiumAmount, uint256 premiumRefundTimestamp);
```

#### InitiatorAssetRedeemed/ParticipantAssetRedeemed

These two events indicate that `asset` has been redeemed by the other party before the timelock by providing `secret`.

```solidity
event InitiatorAssetRedeemed(uint256 redeemTimestamp, bytes32 secretHash, bytes32 secret, address redeemer, address assetToken, uint256 amount);
```

```solidity
event ParticipantAssetRedeemed(uint256 redeemTimestamp, bytes32 secretHash, bytes32 secret, address redeemer, address assetToken, uint256 amount);
```

#### InitiatorAssetRefunded/ParticipantAssetRefunded

These two events indicate that `asset` has been refunded by the original owner after the timelock expires.

```solidity
event InitiatorAssetRefunded(uint256 refundTimestamp, bytes32 secretHash, address refunder, address assetToken, uint256 amount);
```

```solidity
event ParticipantAssetRefunded(uint256 refundTimestamp, bytes32 secretHash, address refunder, address assetToken, uint256 amount);
```

#### PremiumRedeemed

This event indicates that `premium` has been redeemed by `participant`. This implies that `asset` is either redeemed by `initiator` if it can provide the preimage of `secrectHash` before  `asset` timelock expires; or refunded by `participant` if `asset` timelock expires.

```solidity
event PremiumRedeemed(uint256 redeemTimestamp,bytes32 secretHash,address redeemer,address token,uint256 amount);
```

#### PremiumRefunded

This event indicates that `premium` has been refunded back to `initiator`, because of `participant` doesn&apos;t participate at all, by the time of `premium` timelock expires.

```solidity
event PremiumRefunded(uint256 refundTimestamp, bytes32 secretHash, address refunder, address token, uint256 amount);
```

## Rationale

+ To achieve the atomicity, HTLC is used.
+ The participant should decide whether to participate after the initiator locks the token and sets up the timelock.
+ 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.
+ Premium is redeemable for the participant only if the participant participates in the swap and redeems the initiator&apos;s token before premium&apos;s timelock expires.
+ Premium is refundable for the initiator only if the initiator initiates but the participant does not participate in the swap at all.


## Security Considerations

+ The `initiateTimestamp` should cover the whole swap process.
+ The participant should never participate before the premium has been deposited.


## Backwards Compatibility

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.


## Implementation

Please visit [here](../assets/eip-2266/Example.sol) to find our example implementation.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

## References

[^1]: [Hash Time Locked Contracts](https://en.bitcoin.it/wiki/Hash_Time_Locked_Contracts)

[^2]: [An Argument For Single-Asset Lightning Network](https://lists.linuxfoundation.org/pipermail/lightning-dev/2019-January/001798.html)

[^3]: [On the optionality and fairness of Atomic Swaps](https://eprint.iacr.org/2019/896)
</description>
        <pubDate>Sat, 17 Aug 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2266</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2266</guid>
      </item>
    
      <item>
        <title>Multichain address resolution for ENS</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://discuss.ens.domains/t/new-standard-proposal-ens-multicoin-support/1148</comments>
        
        <description>## Abstract

This EIP introduces new overloads for the `addr` field for ENS resolvers, which permit resolution of addresses for other blockchains via ENS.

## Motivation

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.

## Specification

A new accessor function for resolvers is specified:

```solidity
function addr(bytes32 node, uint coinType) external view returns(bytes memory);
```

The EIP165 interface ID for this function is 0xf1cb7e06.

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.

`coinType` is the cryptocurrency coin type index from [SLIP44](https://github.com/satoshilabs/slips/blob/master/slip-0044.md).

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.

A new event for resolvers is defined:

```solidity
event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);
```

Resolvers MUST emit this event on each change to the address for a name and coin type.

### Recommended accessor functions

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.

```solidity
function setAddr(bytes32 node, uint coinType, bytes calldata addr);
```

`setAddr` adds or replaces the address for the given node and coin type.  The parameters for this function are as per those described in `addr()` above.

This function emits an `AddressChanged` event with the new address; see also the backwards compatibility section below for resolvers that also support `addr(bytes32)`.

### Address Encoding

In general, the native binary representation of the address should be used, without any checksum commonly used in the text representation.

A table of encodings for common blockchains is provided, followed by a more detailed description of each format. In the table, &apos;encodings&apos; lists the address encodings supported by that chain, along with any relevant parameters. Details of those address encodings are described in the following sections.

| Cryptocurrency | Coin Type | Encoding |
| --- | --- | --- |
| Bitcoin | 0 | P2PKH(0x00), P2SH(0x05), SegWit(&apos;bc&apos;) |
| Litecoin | 2 | P2PKH(0x30), P2SH(0x32), P2SH(0x05), SegWit(&apos;ltc&apos;) |
| Dogecoin | 3 | P2PKH(0x1e), P2SH(0x16) |
| Monacoin | 22 | P2PKH(0x32), P2SH(0x05) |
| Ethereum | 60 | ChecksummedHex |
| Ethereum Classic | 61 | ChecksummedHex |
| Rootstock | 137 | ChecksummedHex(30) |
| Ripple | 144 | Ripple |
| Bitcoin Cash | 145 | P2PKH(0x00), P2SH(0x05), CashAddr |
| Binance | 714 | Bech32(&apos;bnb&apos;) |

#### P2PKH(version)

Pay to Public Key Hash addresses are [base58check](https://en.bitcoin.it/wiki/Base58Check_encoding) encoded. After decoding, the first byte is a version byte. For example, the Bitcoin address `1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa` base58check decodes to the 21 bytes `0062e907b15cbf27d5425399ebf6f0fb50ebb88f18`.

P2PKH addresses have a version byte, followed by a 20 byte pubkey hash. Their canonical encoding is their scriptPubkey encoding (specified [here](https://en.bitcoin.it/wiki/Transaction#Types_of_Transaction)) is `OP_DUP OP_HASH160 &lt;pubKeyHash&gt; OP_EQUALVERIFY OP_CHECKSIG`.

The above example address is thus encoded as the 25 bytes `76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac`.

##### P2SH(version)

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 [here](https://en.bitcoin.it/wiki/Transaction#Pay-to-Script-Hash)) is `OP_HASH160 &lt;scriptHash&gt; OP_EQUAL`. A Bitcoin address of `3Ai1JZ8pdJb2ksieUV8FsxSNVJCpoPi8W6` decodes to the 21 bytes `0562e907b15cbf27d5425399ebf6f0fb50ebb88f18` and is encoded as the 23 bytes `a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1887`.

##### SegWit(hrp)

SegWit addresses are encoded with [bech32](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki). Bech32 addresses consist of a human-readable part - &apos;bc&apos; for Bitcoin mainnet - and a machine readable part. For SegWit addresses, this decodes to a &apos;witness version&apos;, between 0 and 15, and a &apos;witness program&apos;, as defined in [BIP141](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki).

The scriptPubkey encoding for a bech32 address, as defined in BIP141, is `OP_n`, where `n` is the witness version, followed by a push of the witness program. Note this warning from BIP173:

&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.

For example, the Bitcoin SegWit address `BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4` decodes to a version of `0` and a witness script of `751e76e8199196d454941c45d1b3a323f1433bd6`, and then encodes to a scriptPubkey of `0014751e76e8199196d454941c45d1b3a323f1433bd6`.

#### ChecksummedHex(chainId?)

To translate a text format checksummed hex address into binary format, simply remove the &apos;0x&apos; prefix and hex decode it. `0x314159265dD8dbb310642f98f50C066173C1259b` is hex-decoded and stored as the 20 bytes `314159265dd8dbb310642f98f50c066173c1259b`.

A checksum format is specified by [EIP-55](./eip-55.md), and extended by [RSKIP60](https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP60.md), 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.

When encoding an address from binary to text, an EIP55/RSKIP60 checksum MUST be used - so the correct encoding of the above address for Ethereum is `0x314159265dD8dbb310642f98f50C066173C1259b`.

#### Ripple

Ripple addresses are encoded using a version of base58check with an alternative alphabet, described [here](https://xrpl.org/base58-encodings.html). Two types of ripple addresses are supported, &apos;r-addresses&apos;, and &apos;X-addresss&apos;. 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 [here](https://github.com/xrp-community/standards-drafts/issues/6).

Both address types should be stored in ENS by performing ripple&apos;s version of base58check decoding and storing them directly (including version byte). For example, the ripple address `rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn` decodes to and is stored as `004b4e9c06f24296074f7bc48f92a97916c6dc5ea9`, while the address `X7qvLs7gSnNoKvZzNWUT2e8st17QPY64PPe7zriLNuJszeg` decodes to and is stored as `05444b4e9c06f24296074f7bc48f92a97916c6dc5ea9000000000000000000`.

#### CashAddr

Bitcoin Cash defines a new address format called &apos;CashAddr&apos;, specified [here](https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md). This uses a variant of bech32 encoding to encode and decode (non-segwit) Bitcoin Cash addresses, using a prefix of &apos;bitcoincash:&apos;. 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.

#### Bech32

[Bech32](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki) addresses consist of a human-readable part - for example, &apos;bnb&apos; for Binance - and a machine readable part. The encoded data is simply the address, which can be converted to binary and stored directly.

For example, the BNB address `bnb1grpf0955h0ykzq3ar5nmum7y6gdfl6lxfn46h2` decodes to the binary representation `40c2979694bbc961023d1d27be6fc4d21a9febe6`, which is stored directly in ENS.

### Example

An example implementation of a resolver that supports this EIP is provided here:

```solidity
pragma solidity ^0.5.8;

contract AddrResolver is ResolverBase {
    bytes4 constant private ADDR_INTERFACE_ID = 0x3b3b57de;
    bytes4 constant private ADDRESS_INTERFACE_ID = 0xf1cb7e06;
    uint constant private COIN_TYPE_ETH = 60;

    event AddrChanged(bytes32 indexed node, address a);
    event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);

    mapping(bytes32=&gt;mapping(uint=&gt;bytes)) _addresses;

    /**
     * Sets the address associated with an ENS node.
     * May only be called by the owner of that node in the ENS registry.
     * @param node The node to update.
     * @param a The address to set.
     */
    function setAddr(bytes32 node, address a) external authorised(node) {
        setAddr(node, COIN_TYPE_ETH, addressToBytes(a));
    }

    /**
     * Returns the address associated with an ENS node.
     * @param node The ENS node to query.
     * @return The associated address.
     */
    function addr(bytes32 node) public view returns (address) {
        bytes memory a = addr(node, COIN_TYPE_ETH);
        if(a.length == 0) {
            return address(0);
        }
        return bytesToAddress(a);
    }

    function setAddr(bytes32 node, uint coinType, bytes memory a) public authorised(node) {
        emit AddressChanged(node, coinType, a);
        if(coinType == COIN_TYPE_ETH) {
            emit AddrChanged(node, bytesToAddress(a));
        }
        _addresses[node][coinType] = a;
    }

    function addr(bytes32 node, uint coinType) public view returns(bytes memory) {
        return _addresses[node][coinType];
    }

    function supportsInterface(bytes4 interfaceID) public pure returns(bool) {
        return interfaceID == ADDR_INTERFACE_ID || interfaceID == ADDRESS_INTERFACE_ID || super.supportsInterface(interfaceID);
    }
}
```

### Implementation

An implementation of this interface is provided in the [ensdomains/resolvers](https://github.com/ensdomains/resolvers/) repository.

## Backwards Compatibility

If the resolver supports the `addr(bytes32)` interface defined in EIP137, the resolver MUST treat this as a special case of this new specification in the following ways:

 1. The value returned by `addr(node)` from EIP137 should always match the value returned by `addr(node, 60)` (60 is the coin type ID for Ethereum).
 2. Anything that causes the `AddrChanged` event from EIP137 to be emitted must also emit an `AddressChanged` event from this EIP, with the `coinType` specified as 60, and vice-versa.

## Tests

The table below specifies test vectors for valid address encodings for each cryptocurrency described above.

| Cryptocurrency | Coin Type | Text | Onchain (hex) |
| --- | --- | --- | --- |
| Bitcoin | 0 | `1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa` | `76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac` |
| |  | `3Ai1JZ8pdJb2ksieUV8FsxSNVJCpoPi8W6` | `a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1887` |
| | | `BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4` | `0014751e76e8199196d454941c45d1b3a323f1433bd6` |
| Litecoin | 2 | `LaMT348PWRnrqeeWArpwQPbuanpXDZGEUz` | `76a914a5f4d12ce3685781b227c1f39548ddef429e978388ac` |
| | | `MQMcJhpWHYVeQArcZR3sBgyPZxxRtnH441` | `a914b48297bff5dadecc5f36145cec6a5f20d57c8f9b87` |
| | | `ltc1qdp7p2rpx4a2f80h7a4crvppczgg4egmv5c78w8` | `0014687c150c26af5493befeed7036043812115ca36c` |
| Dogecoin | 3 | `DBXu2kgc3xtvCUWFcxFE3r9hEYgmuaaCyD` | `76a9144620b70031f0e9437e374a2100934fba4911046088ac` |
| | | `AF8ekvSf6eiSBRspJjnfzK6d1EM6pnPq3G` | `a914f8f5d99a9fc21aa676e74d15e7b8134557615bda87` |
| Monacoin | 22 | `MHxgS2XMXjeJ4if2PRRbWYcdwZPWfdwaDT` | `76a9146e5bb7226a337fe8307b4192ae5c3fab9fa9edf588ac` |
| Ethereum | 60 | `0x314159265dD8dbb310642f98f50C066173C1259b` | `314159265dd8dbb310642f98f50c066173c1259b` |
| Ethereum Classic | 61 | `0x314159265dD8dbb310642f98f50C066173C1259b` | `314159265dd8dbb310642f98f50c066173c1259b` |
| Rootstock | 137 | `0x5aaEB6053f3e94c9b9a09f33669435E7ef1bEAeD` | `5aaeb6053f3e94c9b9a09f33669435e7ef1beaed` |
| Ripple | 144 | `rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn` | `004b4e9c06f24296074f7bc48f92a97916c6dc5ea9` |
| | | `X7qvLs7gSnNoKvZzNWUT2e8st17QPY64PPe7zriLNuJszeg` | `05444b4e9c06f24296074f7bc48f92a97916c6dc5ea9000000000000000000` |
| Bitcoin Cash | 145 | `1BpEi6DfDAUFd7GtittLSdBeYJvcoaVggu` | `76a91476a04053bda0a88bda5177b86a15c3b29f55987388ac` |
| | | `bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a` | `76a91476a04053bda0a88bda5177b86a15c3b29f55987388ac` |
| | | `3CWFddi6m4ndiGyKqzYvsFYagqDLPVMTzC` | `a91476a04053bda0a88bda5177b86a15c3b29f55987387` |
| | | `bitcoincash:ppm2qsznhks23z7629mms6s4cwef74vcwvn0h829pq` | `a91476a04053bda0a88bda5177b86a15c3b29f55987387` |
| Binance | 714 | `bnb1grpf0955h0ykzq3ar5nmum7y6gdfl6lxfn46h2` | `40c2979694bbc961023d1d27be6fc4d21a9febe6` |

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 09 Sep 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2304</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2304</guid>
      </item>
    
      <item>
        <title>ERC-721 Consecutive Transfer Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2309</comments>
        
        <description>## Simple Summary

A standardized event emitted when creating/transferring one, or many non-fungible tokens using consecutive token identifiers.

## Abstract

The optional ERC-721 Consecutive Transfer Extension provides a standardized event which could be emitted during the creation/transfer of one, or many non-fungible tokens. This standard does not set the expectation of how you might create/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.

## Motivation

This extension provides even more scalibility of the [ERC-721 specification](./eip-721.md). 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 `Transfer` events in one transaction. The `Transfer` event is part of the original specification which states:

&gt; This emits when ownership of any NFT changes by any mechanism.
&gt; This event emits when NFTs are created (`from` == 0) and destroyed
&gt; (`to` == 0). Exception: during contract creation, any number of NFTs
&gt; may be created and assigned without emitting Transfer. At the time of
&gt; any transfer, the approved address for that NFT (if any) is reset to none.

This allows for the original `Transfer` 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 `Transfer` 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.

Many decentralized marketplaces and block explorers utilize the `Transfer` 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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

**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**

The address executing the transaction **MUST** own all the tokens within the range of `fromTokenId` and `toTokenId`, or **MUST** be an approved operator to act on the owners behalf.

The `fromTokenId` and `toTokenId` **MUST** be a consecutive range of tokens IDs.

The `fromTokenId`, `fromAddress`, and `toAddress` **MUST** be indexed parameters

The `toTokenId` **MUST NOT** be an indexed parameter

When minting/creating tokens, the `fromAddress` argument **MUST** be set to `0x0` (i.e. zero address).

When burning/destroying tokens, the `toAddress` argument **MUST** be set to `0x0` (i.e. zero address).

When emitting the ConsecutiveTransfer event the Transfer event **MUST NOT** be emitted

Contracts that implement the `ConsecutiveTransfer` event **MAY** still use the original `Transfer` event, however when emitting the `ConsecutiveTransfer` event the `Transfer` event **MUST NOT** be emitted. 

```solidity
  event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed fromAddress, address indexed toAddress);
```

### Examples

The `ConsecutiveTransfer` event can be used for a single token as well as many tokens:

**Single token creation**

`emit ConsecutiveTransfer(1, 1, address(0), toAddress);`

**Batch token creation**

`emit ConsecutiveTransfer(1, 100000, address(0), toAddress);`

**Batch token transfer**

`emit ConsecutiveTransfer(1, 100000, fromAddress, toAddress);`

**Burn**

`emit ConsecutiveTransfer(1, 100000, from, address(0));`


## Rationale

Standardizing the `ConsecutiveTransfer` 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.

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.

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.

**Rationale to have a single event that covers minting, burning, and transferring**

The `ConsecutiveTransfer` event can be used to cover minting, burning, and transferring events. While there may have been confusion in the beginning adhering to transfer to/from &quot;0&quot; pattern this is mitigated by checking for the `ConsecutiveTransfer` topic and verifying the emitting contract supports the ERC-721 interface by using the ERC-165 standard. 

**Indexed event parameters**

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 `fromAddress`, `toAddress`, and `fromTokenId` as the indexed parameters. The `toTokenId` 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 `fromTokenId` 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 `toTokenId`.

**Rationale to not emit `Transfer` when `ConsecutiveTransfer` is also emitted**

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 `Transfer` event, but the `ConsecutiveTransfer` event should not be emitted during the same transaction and vice-versa.

**Comparing 2309 and 1155**

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.

[ERC-1155](./eip-1155.md) 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.


## Backwards Compatibility

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 `Transfer` 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 `ConsecutiveTransfer` event. For platforms that wish to support the `ConsecutiveTransfer` event it would be best to support both the original `Transfer` event and the `ConsecutiveTransfer` event to track token ownership. 

## Security Considerations
There are no security considerations related directly to the implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 08 Oct 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2309</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2309</guid>
      </item>
    
      <item>
        <title>BLS12-381 Key Generation</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/bls-keys-related-erc-discussion-erc-2333-2334-2335/19774</comments>
        
        <description>## Abstract

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&apos;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.

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.

## Motivation

### Deficiencies of the existing mechanism

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 [BIP32](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0032.mediawiki) (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;/sup&gt;.)

### Establishing a multi-chain standard early on

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.

### A post-quantum backup

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.

## Specification

### Version

Due to the evolving BLS signatures CFRG draft (currently v4), the `KeyGen` function was updated, meaning that `hkdf_mod_r` 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, **if you are implementing this EIP, please make sure your version is up to date.**

### Specification

Keys are defined in terms of a tree structure where a key is determined by the tree&apos;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.

### The Tree Structure

The key tree is defined purely through the relationship between a child-node and its ancestors. Starting with the root of the tree, the *master key*, a child node can be derived by knowing the parent&apos;s private key and the index of the child. The tree is broken up into depths which are indicated by `/` and the master node is described as `m`. The first child of the master node is therefore described as `m / 0` and `m / 0`&apos;s siblings are `m / i` for all `0 &lt;= i &lt; 2**32`.

```text
      [m / 0] - [m / 0 / 0]
     /        \
    /           [m / 0 / 1]
[m] - [m / 1]
    \
     ...
      [m / i]
```

### Key derivation

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&apos;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&apos;s private key group.

#### `IKM_to_lamport_SK`

##### Inputs

* `IKM`, a secret octet string
* `salt`, an octet string

##### Outputs

* `lamport_SK`, an array of 255 32-octet strings

##### Definitions

* `HKDF-Extract` is as defined in [RFC5869](https://www.rfc-editor.org/rfc/rfc5869), instantiated with SHA256
* `HKDF-Expand` is as defined in [RFC5869](https://www.rfc-editor.org/rfc/rfc5869), instantiated with SHA256
* `K = 32` is the digest size (in octets) of the hash function (SHA256)
* `L = K * 255` is the HKDF output size (in octets)
* `&quot;&quot;` is the empty string
* `bytes_split` is a function takes in an octet string and splits it into `K`-byte chunks which are returned as an array

##### Procedure

``` text
0. PRK = HKDF-Extract(salt, IKM)
1. OKM = HKDF-Expand(PRK, &quot;&quot; , L)
2. lamport_SK = bytes_split(OKM, K)
3. return lamport_SK
```

#### `parent_SK_to_lamport_PK`

##### Inputs

* `parent_SK`, the BLS Secret Key of the parent node
* `index`, the index of the desired child node, an integer `0 &lt;= index &lt; 2^32`

##### Outputs

* `lamport_PK`, the compressed lamport PK, a 32 octet string

##### Definitions

* `I2OSP` is as defined in [RFC3447](https://www.rfc-editor.org/rfc/rfc3447) (Big endian decoding)
* `flip_bits` is a function that returns the bitwise negation of its input
* `&quot;&quot;` is the empty string
* `a | b` is the concatenation of `a` with `b`

##### Procedure

```text
0. salt = I2OSP(index, 4)
1. IKM = I2OSP(parent_SK, 32)
2. lamport_0 = IKM_to_lamport_SK(IKM, salt)
3. not_IKM = flip_bits(IKM)
4. lamport_1 = IKM_to_lamport_SK(not_IKM, salt)
5. lamport_PK = &quot;&quot;
6. for i  in 1, .., 255
       lamport_PK = lamport_PK | SHA256(lamport_0[i])
7. for i  in 1, .., 255
       lamport_PK = lamport_PK | SHA256(lamport_1[i])
8. compressed_lamport_PK = SHA256(lamport_PK)
9. return compressed_lamport_PK
```

**Note:** The indexing, `i`, 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.

#### `HKDF_mod_r`

`hkdf_mod_r()` is used to hash 32 random bytes into the subgroup of the BLS12-381 private keys.

##### Inputs

* `IKM`, a secret octet string &gt;= 256 bits in length
* `key_info`, an optional octet string (default=`&quot;&quot;`, the empty string)

##### Outputs

* `SK`, the corresponding secret key, an integer 0 &lt;= SK &lt; r.

##### Definitions

* `HKDF-Extract` is as defined in RFC5869, instantiated with hash H.
* `HKDF-Expand` is as defined in RFC5869, instantiated with hash H.
* `L` is the integer given by `ceil((3 * ceil(log2(r))) / 16)`.(`L=48`)
* `&quot;BLS-SIG-KEYGEN-SALT-&quot;` is an ASCII string comprising 20 octets.
* `OS2IP` is as defined in [RFC3447](https://www.rfc-editor.org/rfc/rfc3447) (Big endian encoding)
* `I2OSP` is as defined in [RFC3447](https://www.rfc-editor.org/rfc/rfc3447) (Big endian decoding)
* `r` is the order of the BLS 12-381 curve defined in the draft IETF BLS signature scheme standard.`r=52435875175126190479447740508185965837690552500527637822603658699938581184513`

##### Procedure

```text
1. salt = &quot;BLS-SIG-KEYGEN-SALT-&quot;
2. SK = 0
3. while SK == 0:
4.     salt = H(salt)
5.     PRK = HKDF-Extract(salt, IKM || I2OSP(0, 1))
6.     OKM = HKDF-Expand(PRK, key_info || I2OSP(L, 2), L)
7.     SK = OS2IP(OKM) mod r
8. return SK
```

### `derive_child_SK`

The child key derivation function takes in the parent&apos;s private key and the index of the child and returns the child private key.

##### Inputs

* `parent_SK`, the secret key of the parent node, a big endian encoded integer
* `index`, the index of the desired child node, an integer `0 &lt;= index &lt; 2^32`

##### Outputs

* `child_SK`, the secret key of the child node, a big endian encoded integer

##### Procedure

```text
0. compressed_lamport_PK = parent_SK_to_lamport_PK(parent_SK, index)
1. SK = HKDF_mod_r(compressed_lamport_PK)
2. return SK
```

### `derive_master_SK`

The child key derivation function takes in the parent&apos;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 [BIP-39 mnemonic_to_seed method](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0039.mediawiki) be used.

##### Inputs

* `seed`, the source entropy for the entire tree, a octet string &gt;= 256 bits in length

##### Outputs

* `SK`, the secret key of master node within the tree, a big endian encoded integer

##### Procedure

```text
0. SK = HKDF_mod_r(seed)
1. return SK
```

## Rationale

### Lamport signatures

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.

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&apos;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.

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&apos;s entropy, has a length-limit of `255 * hash_function_digest_size`. The 1-bit reduction in security is deemed preferable over increasing the complexity of the entropy stretching mechanism.

### SHA256

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.

### `hkdf_mod_r()`

The function `hkdf_mod_r()` in this standard is the same as the `KeyGen` function described in the draft IETF signature standard and therefore the private key obtained from `KeyGen` is equal to that obtained from `hkdf_mod_r` 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.

While `hkdf_mod_r()` 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;/sup&gt; time larger than the curve order). This bias is deemed acceptable in light of the simplicity of the constant time scheme.

### Only using hardened keys

Widely accepted standards that existed before this one ([BIP32](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0032.mediawiki) and [BIP44](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0044.mediawiki)) 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&apos;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.

## Backwards Compatibility

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/ BIP44 style paths as paths specified by these systems make use of non-hardened keys, something that does not exist within this standard.

## Test Cases

### Test Case 0

```text
seed = 0xc55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04
master_SK = 6083874454709270928345386274498605044986640685124978867557563392430687146096
child_index = 0
child_SK = 20397789859736650942317412262472558107875392172444076792671091975210932703118
```

This test case can be extended to test the entire mnemonic-to-`child_SK` stack, assuming [BIP39](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0039.mediawiki) is used as the mnemonic generation mechanism. Using the following parameters, the above seed can be calculated:

```test
mnemonic = &quot;abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about&quot;
passphrase = &quot;TREZOR&quot;
```

This test case can be extended to test the entire `mnemonic-to -child_SK` stack, assuming [BIP39](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0039.mediawiki) is used as the mnemonic generation mechanism. Using the following parameters, the above seed can be calculated:

```text
mnemonic = &quot;abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about&quot;
passphrase = &quot;TREZOR&quot;
```

### Test Case 1

```text
seed = 0x3141592653589793238462643383279502884197169399375105820974944592
master_SK = 29757020647961307431480504535336562678282505419141012933316116377660817309383
child_index = 3141592653
child_SK = 25457201688850691947727629385191704516744796114925897962676248250929345014287
```

### Test Case 2

```text
seed = 0x0099FF991111002299DD7744EE3355BBDD8844115566CC55663355668888CC00
master_SK = 27580842291869792442942448775674722299803720648445448686099262467207037398656
child_index = 4294967295
child_SK = 29358610794459428860402234341874281240803786294062035874021252734817515685787
```

### Test Case 3

```text
seed = 0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3
master_SK = 19022158461524446591288038168518313374041767046816487870552872741050760015818
child_index = 42
child_SK = 31372231650479070279774297061823572166496564838472787488249775572789064611981
```

### Test Vector with Intermediate values

```text
seed = 0xc55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04
master_SK = 6083874454709270928345386274498605044986640685124978867557563392430687146096
child_index = 0
lamport_0 = [0xe345d0ad7be270737de05cf036f688f385d5f99c7fddb054837658bdd2ebd519,
0x65050bd4db9c77c051f67dcc801bf1cdf33d81131e608505bb3e4523868eb76c,
0xc4f8e8d251fbdaed41bdd9c135b9ed5f83a614f49c38fffad67775a16575645a,
0x638ad0feace7567255120a4165a687829ca97e0205108b8b73a204fba6a66faa,
0xb29f95f64d0fcd0f45f265f15ff7209106ab5f5ce6a566eaa5b4a6f733139936,
0xbcfbdd744c391229f340f02c4f2d092b28fe9f1201d4253b9045838dd341a6bf,
0x8b9cf3531bfcf0e4acbfd4d7b4ed614fa2be7f81e9f4eaef53bedb509d0b186f,
0xb32fcc5c4e2a95fb674fa629f3e2e7d85335f6a4eafe7f0e6bb83246a7eced5f,
0xb4fe80f7ac23065e30c3398623b2761ac443902616e67ce55649aaa685d769ce,
0xb99354f04cfe5f393193c699b8a93e5e11e6be40ec16f04c739d9b58c1f55bf3,
0x93963f58802099ededb7843219efc66a097fab997c1501f8c7491991c780f169,
0x430f3b027dbe9bd6136c0f0524a0848dad67b253a11a0e4301b44074ebf82894,
0xd635c39b4a40ad8a54d9d49fc8111bd9d11fb65c3b30d8d3eaef7d7556aac805,
0x1f7253a6474cf0b2c05b02a7e91269137acddedcb548144821f9a90b10eccbab,
0x6e3bdb270b00e7b6eb8b044dbfae07b51ea7806e0d24218c59a807a7fd099c18,
0x895488ad2169d8eaae332ce5b0fe1e60ffab70e62e1cb15a2a1487544af0a6e8,
0x32d45a99d458c90e173a3087ea3661ab62d429b285089e92806a9663ba825342,
0xc15c52106c3177f5848a173076a20d46600ca65958a1e3c7d45a593aaa9670ed,
0xd8180c550fbe4cd6d5b676ff75e0728729d8e28a3b521d56152594ac6959d563,
0x58fe153fac8f4213aaf175e458435e06304548024bcb845844212c774bdffb2a,
0x10fff610a50f4bee5c978f512efa6ab4fafacb65929606951ba5b93eeb617b5a,
0x78ac9819799b52eba329f13dd52cf0f6148a80bf04f93341814c4b47bb4aa5ec,
0xa5c3339caa433fc11e74d1765bec577a13b054381a44b23c2482e750696876a9,
0x9f716640ab5cdc2a5eb016235cddca2dc41fa4ec5acd7e58af628dade99ec376,
0x2544364320e67577c4fed8c7c7c839deed93c24076d5343c5b8faca4cc6dc2d8,
0x62553e782541f822c589796be5d5c83bfc814819100b2be0710b246f5aa7149c,
0x229fb761c46c04b22ba5479f2696be0f936fded68d54dd74bcd736b8ba512afb,
0x0af23996a65b98a0ebaf19f3ec0b3ef20177d1bfd6eb958b3bd36e0bdbe04c8c,
0x6f0954f9deab52fd4c8d2daba69f73a80dea143dd49d9705c98db3d653adf98c,
0xfa9221dd8823919a95b35196c1faeb59713735827f3e84298c25c83ac700c480,
0x70c428e3ff9e5e3cda92d6bb85018fb89475c19f526461cca7cda64ebb2ff544,
0xdcaac3413e22314f0f402f8058a719b62966b3a7429f890d947be952f2e314ba,
0xb6b383cb5ec25afa701234824491916bfe6b09d28cf88185637e2367f0cf6edc,
0x7b0d91488fc916aba3e9cb61a5a5645b9def3b02e4884603542f679f602afb8d,
0xe9c20abca284acfde70c59584b9852b85c52fa7c263bb981389ff8d638429cd7,
0x838524f798daee6507652877feb9597f5c47e9bb5f9aa52a35fb6fff796813b9,
0xbe1ca18faf9bf322474fad1b3d9b4f1bc76ae9076e38e6dd2b16e2faf487742b,
0xbf02d70f1a8519343a16d24bade7f7222912fd57fe4f739f367dfd99d0337e8e,
0xc979eb67c107ff7ab257d1c0f4871adf327a4f2a69e01c42828ea27407caf058,
0xf769123d3a3f19eb7b5c3fd4f467a042944a7c5ff8834cebe427f47dbd71460c,
0xaefc8edc23257e1168a35999fe3832bcbc25053888cc89c38667482d6748095b,
0x8ff399f364d3a2428b1c92213e4fdc5341e7998007da46a5a2f671929b42aaab,
0xcf2a3d9e6963b24c5001fbba1e5ae7f45dd6cf520fd24861f745552db86bab48,
0xb380e272d7f3091e5c887fa2e7c690c67d59f4d95f8376d150e555da8c738559,
0xc006a749b091d91204dbb64f59059d284899de5986a7f84f8877afd5e0e4c253,
0x818d8bb9b7da2dafa2ef059f91975e7b6257f5e199d217320de0a576f020de5c,
0x7aabf4a1297d2e550a2ee20acb44c1033569e51b6ec09d95b22a8d131e30fd32,
0xdd01c80964a5d682418a616fb10810647c9425d150df643c8ddbbe1bfb2768b7,
0x1e2354e1d97d1b06eb6cfe9b3e611e8d75b5c57a444523e28a8f72a767eff115,
0x989c9a649dca0580256113e49ea0dd232bbfd312f68c272fe7c878acc5da7a2c,
0x14ee1efe512826fff9c028f8c7c86708b841f9dbf47ce4598298b01134ebdc1a,
0x6f861dba4503f85762d9741fa8b652ce441373f0ef2b7ebbd5a794e48cdab51b,
0xda110c9492ffdb87efe790214b7c9f707655a5ec08e5af19fb2ab2acc428e7dc,
0x5576aa898f6448d16e40473fcb24c46c609a3fc46a404559faa2d0d34d7d49ce,
0x9bd9a35675f2857792bc45893655bfdf905ffeaee942d93ad39fbcadd4ca9e11,
0xfa95e4c37db9303d5213890fd984034089cbc9c6d754741625da0aa59cc45ccf,
0xfef7d2079713f17b47239b76c8681bf7f800b1bfeac7a53265147579572ddf29,
0x39aa7c0fecf9a1ed037c685144745fda16da36f6d2004844cf0e2d608ef6ed0e,
0x5530654d502d6ba30f2b16f49cc5818279697308778fd8d40db8e84938144fb6,
0xb1beaa36397ba1521d7bf7df16536969d8a716e63510b1b82a715940180eb29f,
0x21abe342789f7c15a137afa373f686330c0db8c861572935a3cd8dcf9e4e1d45,
0x27b5a1acda55b4e0658887bd884d3203696fcae0e94f19e31bfe931342b1c257,
0x58401a02502d7708a812c0c72725f768f5a556480517258069f2d72543cda888,
0x4b38f291548f51bee7e4cf8cc5c8aa8f4ad3ec2461dba4ccbab70f1c1bfd7feb,
0x9b39a53fdafaaf1d23378e0aa8ae65d38480de69821de2910873eefc9f508568,
0x932200566a3563ee9141913d12fd1812cb008cb735724e8610890e101ec10112,
0x6a72f70b4ec5491f04780b17c4776a335fcc5bff5073d775150e08521dc74c91,
0x86d5c60e627a4b7d5d075b0ba33e779c45f3f46d22ed51f31360afd140851b67,
0x5ca2a736bb642abc4104faa781c9aff13d692a400d91dc961aec073889836946,
0xa14bca5a262ac46ceac21388a763561fc85fb9db343148d786826930f3e510cd,
0x87be03a87a9211504aa70ec149634ee1b97f7732c96377a3c04e98643dcba915,
0x8fe283bc19a377823377e9c326374ebb3f29527c12ea77bfb809c18eef8943b0,
0x8f519078b39a3969f7e4caeca9839d4e0eccc883b89e4a86d0e1731bfc5e33fc,
0x33d7c28c3d26fdfc015a8c2131920e1392ef0aea55505637b54ea63069c7858e,
0xe57de7c189fcc9170320c7acedb38798562a48dbc9943b2a8cd3441d58431128,
0x513dac46017050f82751a07b6c890f14ec43cadf687f7d202d2369e35b1836b4,
0xfd967d9f805bb7e78f7b7caa7692fdd3d6b5109c41ad239a08ad0a38eeb0ac4c,
0xf2013e4da9abcc0f03ca505ed94ec097556dbfd659088cd24ec223e02ac43329,
0xe0dcfac50633f7417f36231df2c81fa1203d358d5f57e896e1ab4b512196556b,
0xf022848130e73fe556490754ef0ecfcdaaf3b9ff16ae1eda7d38c95c4f159ded,
0x2147163a3339591ec7831d2412fb2d0588c38da3cd074fa2a4d3e5d21f9f1d2d,
0x11ee2404731962bf3238dca0d9759e06d1a5851308b4e6321090886ec5190b69,
0xf7679ecd07143f8ac166b66790fa09aed39352c09c0b4766bbe500b1ebace5a5,
0xc7a0e95f09076472e101813a95e6ea463c35bd5ee9cfda3e5d5dbccb35888ef0,
0xde625d3b547eb71bea5325a0191a592fa92a72e4b718a499fdba32e245ddf37e,
0x7e5bdccd95df216e8c59665073249072cb3c9d0aef6b341afc0ca90456942639,
0xc27f65fd9f797ede374e06b4ddb6e8aa59c7d6f36301f18b42c48b1889552fe3,
0x8175730a52ea571677b035f8e2482239dda1cfbff6bc5cde00603963511a81af,
0x09e440f2612dad1259012983dc6a1e24a73581feb1bd69d8a356eea16ba5fd0e,
0x59dcc81d594cbe735a495e38953e8133f8b3825fd84767af9e4ea06c49dbabfa,
0x6c8480b59a1a958c434b9680edea73b1207077fb9a8a19ea5f9fbbf6f47c4124,
0x81f5c89601893b7a5a231a7d37d6ab9aa4c57f174fcfc6b40002fa808714c3a1,
0x41ba4d6b4da141fcc1ee0f4b47a209cfd143d34e74fc7016e9956cedeb2db329,
0x5e0b5b404c60e9892040feacfb4a84a09c2bc4a8a5f54f3dad5dca4acdc899dc,
0xe922eebf1f5f15000d8967d16862ed274390cde808c75137d2fb9c2c0a80e391,
0xbf49d31a59a20484f0c08990b2345dfa954509aa1f8901566ab9da052b826745,
0xb84e07da828ae668c95d6aa31d4087504c372dbf4b5f8a8e4ded1bcf279fd52b,
0x89288bf52d8c4a9561421ad199204d794038c5d19ae9fee765ee2b5470e68e7e,
0xf6f618be99b85ec9a80b728454a417c647842215e2160c6fe547dd5a69bd9302,
0xdd9adc002f98c9a47c7b704fc0ce0a5c7861a5e2795b6014749cde8bcb8a034b,
0xd119a4b2c0db41fe01119115bcc35c4b7dbfdb42ad3cf2cc3f01c83732acb561,
0x9c66bc84d416b9193bad9349d8c665a9a06b835f82dc93ae0cccc218f808aad0,
0xd4b50eefcd2b5df075f14716cf6f2d26dfc8ae02e3993d711f4a287313038fde,
0xaf72bfb346c2f336b8bc100bff4ba35d006a3dad1c5952a0adb40789447f2704,
0xc43ca166f01dc955e7b4330227635feb1b0e0076a9c5633ca5c614a620244e5b,
0x5efca76970629521cfa053fbbbda8d3679cadc018e2e891043b0f52989cc2603,
0x35c57de1c788947f187051ce032ad1e899d9887d865266ec6fcfda49a8578b2b,
0x56d4be8a65b257216eab7e756ee547db5a882b4edcd12a84ed114fbd4f5be1f1,
0x257e858f8a4c07a41e6987aabaa425747af8b56546f2a3406f60d610bcc1f269,
0x40bd9ee36d52717ab22f1f6b0ee4fb38b594f58399e0bf680574570f1b4b8c90,
0xcb6ac01c21fc288c12973427c5df6eb8f6aefe64b92a6420c6388acdf36bc096,
0xa5716441312151a5f0deb52993a293884c6c8f445054ce1e395c96adeee66c6d,
0xe15696477f90113a10e04ba8225c28ad338c3b6bdd7bdeb95c0722921115ec85,
0x8faeaa52ca2f1d791cd6843330d16c75eaf6257e4ba236e3dda2bc1a644aee00,
0xc847fe595713bf136637ce8b43f9de238762953fed16798878344da909cc76ae,
0xb5740dc579594dd110078ce430b9696e6a308078022dde2d7cfe0ef7647b904e,
0x551a06d0771fcd3c53aea15aa8bf700047138ef1aa22265bee7fb965a84c9615,
0x9a65397a5907d604030508d41477de621ce4a0d79b772e81112d634455e7a4da,
0x6462d4cc2262d7faf8856812248dc608ae3d197bf2ef410f00c3ae43f2040995,
0x6782b1bd319568e30d54b324ab9ed8fdeac6515e36b609e428a60785e15fb301,
0x8bcdcf82c7eb2a07e14db20d80d9d2efea8d40320e121923784c92bf38250a8e,
0x46ed84fa17d226d5895e44685747ab82a97246e97d6237014611aaaba65ed268,
0x147e87981673326c5a2bdb06f5e90eaaa9583857129451eed6dde0c117fb061f,
0x4141d6fe070104c29879523ba6669552f3d457c0929bb878d2751f4ff059b895,
0xd866ce4ef226d74841f950fc28cdf2235db21e0e3f07a0c8f807704464db2210,
0xa804f9118bf92558f684f90c2bda832a4f51ef771ffb2765cde3ec6f48124f32,
0xc436d4a65910124e00cded9a637178914a8fbc090400f3f031c03eac4d0295a5,
0x643fdb9243656512316528de04dcc7344ca33783580ad0c3debf8c4a6e7c8bc4,
0x7f4a345b41706b281b2de998e91ff62d908eb29fc333ee336221757753c96e23,
0x6bdc086a5b11de950cabea33b72d98db886b291c4c2f02d3e997edc36785d249,
0xfb10b5b47d374078c0a52bff7174bf1cd14d872c7d20b4a009e2afd3017a9a17,
0x1e07e605312db5380afad8f3d7bd602998102fdd39565b618ac177b13a6527e6,
0xc3161b5a7b93aabf05652088b0e5b4803a18be693f590744c42c24c7aaaeef48,
0xa47e4f25112a7d276313f153d359bc11268b397933a5d5375d30151766bc689a,
0xb24260e2eff88716b5bf5cb75ea171ac030f5641a37ea89b3ac45acb30aae519,
0x2bcacbebc0a7f34406db2c088390b92ee34ae0f2922dedc51f9227b9afb46636,
0xc78c304f6dbe882c99c5e1354ce6077824cd42ed876db6706654551c7472a564,
0x6e2ee19d3ee440c78491f4e354a84fa593202e152d623ed899e700728744ac85,
0x2a3f438c5dc012aa0997b66f661b8c10f4a0cd7aa5b6e5922b1d73020561b27f,
0xd804f755d93173408988b95e9ea0e9feae10d404a090f73d9ff84df96f081cf7,
0xe06fda941b6936b8b33f00ffa02c8b05fd78fbec953da61da2043f5644b30a50,
0x45ee279b465d53148850a16cc7f6bd33e7627aef554a9418ed012ca8f9717f80,
0x9c79348c1bcd6aa2135452491d73564413a247ea8cc38fa7dcc6c43f8a2d61d5,
0x7c91e056f89f2a77d3e3642e595bcf4973c3bca68dd2b10f51ca0d8945e4255e,
0x669f976ebe38cbd22c5b1f785e14b76809d673d2cb1458983dbda41f5adf966b,
0x8bc71e99ffcc119fd8bd604af54c0663b0325a3203a214810fa2c588089ed5a7,
0x36b3f1ffeae5d9855e0965eef33f4c5133d99685802ac5ce5e1bb288d308f889,
0x0aad33df38b3f31598e04a42ec22f20bf2e2e9472d02371eb1f8a06434621180,
0x38c5632b81f90efbc51a729dcae03626a3063aa1f0a102fd0e4326e86a08a732,
0x6ea721753348ed799c98ffa330d801e6760c882f720125250889f107915e270a,
0xe700dd57ce8a653ce4269e6b1593a673d04d3de8b79b813354ac7c59d1b99adc,
0xe9294a24b560d62649ca898088dea35a644d0796906d41673e29e4ea8cd16021,
0xf20bb60d13a498a0ec01166bf630246c2f3b7481919b92019e2cfccb331f2791,
0xf639a667209acdd66301c8e8c2385e1189b755f00348d614dc92da14e6866b38,
0x49041904ee65c412ce2cd66d35570464882f60ac4e3dea40a97dd52ffc7b37a2,
0xdb36b16d3a1010ad172fc55976d45df7c03b05eab5432a77be41c2f739b361f8,
0x71400cdd2ea78ac1bf568c25a908e989f6d7e2a3690bc869c7c14e09c255d911,
0xf0d920b2d8a00b88f78e7894873a189c580747405beef5998912fc9266220d98,
0x1a2baefbbd41aa9f1cc5b10e0a7325c9798ba87de6a1302cf668a5de17bc926a,
0x449538a20e52fd61777c45d35ff6c2bcb9d9165c7eb02244d521317f07af6691,
0x97006755b9050b24c1855a58c4f4d52f01db4633baff4b4ef3d9c44013c5c665,
0xe441363a27b26d1fff3288222fa8ed540f8ca5d949ddcc5ff8afc634eec05336,
0xed587aa8752a42657fea1e68bc9616c40c68dcbbd5cb8d781e8574043e29ef28,
0x47d896133ba81299b8949fbadef1c00313d466827d6b13598685bcbb8776c1d2,
0x7786bc2cb2d619d07585e2ea4875f15efa22110e166af87b29d22af37b6c047d,
0x956b76194075fe3daf3ca508a6fad161deb05d0026a652929e37c2317239cbc6,
0xec9577cb7b85554b2383cc4239d043d14c08d005f0549af0eca6994e203cb4e7,
0x0722d0c68d38b23b83330b972254bbf9bfcf32104cc6416c2dad67224ac52887,
0x532b19d54fb6d77d96452d3e562b79bfd65175526cd793f26054c5f6f965df39,
0x4d62e065e57cbf60f975134a360da29cabdcea7fcfc664cf2014d23c733ab3b4,
0x09be0ea6b363fd746b303e482cb4e15ef25f8ae57b7143e64cbd5c4a1d069ebe,
0x69dcddc3e05147860d8d0e90d602ac454b609a82ae7bb960ee2ecd1627d77777,
0xa5e2ae69d902971000b1855b8066a4227a5be7234ac9513b3c769af79d997df4,
0xc287d4bc953dcff359d707caf2ccba8cc8312156eca8aafa261fb72412a0ea28,
0xb27584fd151fb30ed338f9cba28cf570f7ca39ebb03eb2e23140423af940bd96,
0x7e02928194441a5047af89a6b6555fea218f1df78bcdb5f274911b48d847f5f8,
0x9ba611add61ea6ba0d6d494c0c4edd03df9e6c03cafe10738cee8b7f45ce9476,
0x62647ec3109ac3db3f3d9ea78516859f0677cdde3ba2f27f00d7fda3a447dd01,
0xfa93ff6c25bfd9e17d520addf5ed2a60f1930278ff23866216584853f1287ac1,
0x3b391c2aa79c2a42888102cd99f1d2760b74f772c207a39a8515b6d18e66888a,
0xcc9ae3c14cbfb40bf01a09bcde913a3ed208e13e4b4edf54549eba2c0c948517,
0xc2b8bce78dd4e876da04c54a7053ca8b2bedc8c639cee82ee257c754c0bea2b2,
0xdb186f42871f438dba4d43755c59b81a6788cb3b544c0e1a3e463f6c2b6f7548,
0xb7f8ba137c7783137c0729de14855e20c2ac4416c33f5cac3b235d05acbab634,
0x282987e1f47e254e86d62bf681b0803df61340fdc9a8cf625ef2274f67fc6b5a,
0x04aa195b1aa736bf8875777e0aebf88147346d347613b5ab77bef8d1b502c08c,
0x3f732c559aee2b1e1117cf1dec4216a070259e4fa573a7dcadfa6aab74aec704,
0x72699d1351a59aa73fcede3856838953ee90c6aa5ef5f1f7e21c703fc0089083,
0x6d9ce1b8587e16a02218d5d5bed8e8d7da4ac40e1a8b46eeb412df35755c372c,
0x4f9c19b411c9a74b8616db1357dc0a7eaf213cb8cd2455a39eb7ae4515e7ff34,
0x9163dafa55b2b673fa7770b419a8ede4c7122e07919381225c240d1e90d90470,
0x268ff4507b42e623e423494d3bb0bc5c0917ee24996fb6d0ebedec9ce8cd9d5c,
0xff6e6169d233171ddc834e572024586eeb5b1bda9cb81e5ad1866dbc53dc75fe,
0xb379a9c8279205e8753b6a5c865fbbf70eb998f9005cd7cbde1511f81aed5256,
0x3a6b145e35a592e037c0992c9d259ef3212e17dca81045e446db2f3686380558,
0x60fb781d7b3137481c601871c1c3631992f4e01d415841b7f5414743dcb4cfd7,
0x90541b20b0c2ea49bca847e2db9b7bba5ce15b74e1d29194a12780e73686f3dd,
0xe2b0507c13ab66b4b769ad1a1a86834e385b315da2f716f7a7a8ff35a9e8f98c,
0xeefe54bc9fa94b921b20e7590979c28a97d8191d1074c7c68a656953e2836a72,
0x8676e7f59d6f2ebb0edda746fc1589ef55e07feab00d7008a0f2f6f129b7bb3a,
0x78a3d93181b40152bd5a8d84d0df7f2adde5db7529325c13bc24a5b388aed3c4,
0xcc0e2d0cba7aaa19c874dbf0393d847086a980628f7459e9204fda39fad375c0,
0x6e46a52cd7745f84048998df1a966736d2ac09a95a1c553016fef6b9ec156575,
0x204ac2831d2376d4f9c1f5c106760851da968dbfc488dc8a715d1c764c238263,
0xbdb8cc7b7e5042a947fca6c000c10b9b584e965c3590f92f6af3fe4fb23e1358,
0x4a55e4b8a138e8508e7b11726f617dcf4155714d4600e7d593fd965657fcbd89,
0xdfe064bb37f28d97b16d58b575844964205e7606dce914a661f2afa89157c45b,
0x560e374fc0edda5848eef7ff06471545fcbdd8aefb2ecddd35dfbb4cb03b7ddf,
0x10a66c82e146da5ec6f48b614080741bc51322a60d208a87090ad7c7bf6b71c6,
0x62534c7dc682cbf356e6081fc397c0a17221b88508eaeff798d5977f85630d4f,
0x0138bba8de2331861275356f6302b0e7424bbc74d88d8c534479e17a3494a15b,
0x580c7768bf151175714b4a6f2685dc5bcfeb088706ee7ed5236604888b84d3e4,
0xd290adb1a5dfc69da431c1c0c13da3be788363238d7b46bc20185edb45ab9139,
0x1689879db6c78eb4d3038ed81be1bc106f8cfa70a7c6245bd4be642bfa02ebd7,
0x6064c384002c8b1594e738954ed4088a0430316738def62822d08b2285514918,
0x01fd23493f4f1cc3c5ff4e96a9ee386b2a144b50a428a6b5db654072bddadfe7,
0xd5d05bb7f23ab0fa2b82fb1fb14ac29c2477d81a85423d0a45a4b7d5bfd81619,
0xd72b9a73ae7b24db03b84e01106cea734d4b9d9850b0b7e9d65d6001d859c772,
0x156317cb64578db93fee2123749aff58c81eae82b189b0d6f466f91de02b59df,
0x5fba299f3b2c099edbac18d785be61852225890fc004bf6be0787d62926a79b3,
0x004154f28f685bdbf0f0d6571e7a962a4c29b6c3ebedaaaf66097dfe8ae5f756,
0x4b45816f9834c3b289affce7a3dc80056c2b7ffd3e3c250d6dff7f923e7af695,
0x6ca53bc37816fff82346946d83bef87860626bbee7fd6ee9a4aeb904d893a11f,
0xf48b2f43184358d66d5b5f7dd2b14a741c7441cc7a33ba3ebcc94a7b0192d496,
0x3cb98f4baa429250311f93b46e745174f65f901fab4eb8075d380908aaaef650,
0x343dfc26b4473b3a20e706a8e87e5202a4e6b96b53ed448afb9180c3f766e5f8,
0x1ace0e8a735073bcbaea001af75b681298ef3b84f1dbab46ea52cee95ab0e7f9,
0xd239b110dd71460cdbc41ddc99494a7531186c09da2a697d6351c116e667733b,
0x22d6955236bd275969b8a6a30c23932670a6067f68e236d2869b6a8b4b493b83,
0x53c1c01f8d061ac89187e5815ef924751412e6a6aa4dc8e3abafb1807506b4e0,
0x2f56dd20c44d7370b713e7d7a1bfb1a800cac33f8a6157f278e17a943806a1f7,
0xc99773d8a5b3e60115896a65ac1d6c15863317d403ef58b90cb89846f4715a7f,
0x9f4b6b77c254094621cd336da06fbc6cbb7b8b1d2afa8e537ceca1053c561ef5,
0x87944d0b210ae0a6c201cba04e293f606c42ebaed8b4a5d1c33f56863ae7e1b5,
0xa7d116d962d03ca31a455f9cda90f33638fb36d3e3506605aa19ead554487a37,
0x4042e32e224889efd724899c9edb57a703e63a404129ec99858048fbc12f2ce0,
0x36759f7a0faeea1cd4cb91e404e4bf09908de6e53739603d5f0db52b664158a3,
0xa4d50d005fb7b9fea8f86f1c92439cc9b8446efef7333ca03a8f6a35b2d49c38,
0x80cb7c3e20f619006542edbe71837cdadc12161890a69eea8f41be2ee14c08a3,
0xbb3c44e1df45f2bb93fb80e7f82cee886c153ab484c0095b1c18df03523629b4,
0x04cb749e70fac3ac60dea779fceb0730b2ec5b915b0f8cf28a6246cf6da5db29,
0x4f5189b8f650687e65a962ef3372645432b0c1727563777433ade7fa26f8a728,
0x322eddddf0898513697599b68987be5f88c0258841affec48eb17cf3f61248e8,
0x6416be41cda27711d9ec22b3c0ed4364ff6975a24a774179c52ef7e6de9718d6,
0x0622d31b8c4ac7f2e30448bdadfebd5baddc865e0759057a6bf7d2a2c8b527e2,
0x40f096513588cc19c08a69e4a48ab6a43739df4450b86d3ec2fb3c6a743b5485,
0x09fcf7d49290785c9ea2d54c3d63f84f6ea0a2e9acfcdbb0cc3a281ce438250e,
0x2000a519bf3da827f580982d449b5c70fcc0d4fa232addabe47bb8b1c471e62e,
0xf4f80008518e200c40b043f34fb87a6f61b82f8c737bd784292911af3740245e,
0x939eaab59f3d2ad49e50a0220080882319db7633274a978ced03489870945a65,
0xadcad043d8c753fb10689280b7670f313253f5d719039e250a673d94441ee17c,
0x58b7b75f090166b8954c61057074707d7e38d55ce39d9b2251bbc3d72be458f8,
0xf61031890c94c5f87229ec608f2a9aa0a3f455ba8094b78395ae312cbfa04087,
0x356a55def50139f94945e4ea432e7a9defa5db7975462ebb6ca99601c614ea1d,
0x65963bb743d5db080005c4db59e29c4a4e86f92ab1dd7a59f69ea7eaf8e9aa79]
lamport_1 = [0x9c0bfb14de8d2779f88fc8d5b016f8668be9e231e745640096d35dd5f53b0ae2,
0x756586b0f3227ab0df6f4b7362786916bd89f353d0739fffa534368d8d793816,
0x710108dddc39e579dcf0819f9ad107b3c56d1713530dd94325db1d853a675a37,
0x8862b5f428ce5da50c89afb50aa779bb2c4dfe60e6f6a070b3a0208a4a970fe5,
0x54a9cd342fa3a4bf685c01d1ce84f3068b0d5b6a58ee22dda8fbac4908bb9560,
0x0fa3800efeaddd28247e114a1cf0f86b9014ccae9c3ee5f8488168b1103c1b44,
0xbb393428b7ebfe2eda218730f93925d2e80c020d41a29f4746dcbb9138f7233a,
0x7b42710942ef38ef2ff8fe44848335f26189c88c22a49fda84a51512ac68cd5d,
0x90e99786a3e8b04db95ccd44d01e75558d75f3ddd12a1e9a2c2ce76258bf4813,
0x3f6f71e40251728aa760763d25deeae54dc3a9b53807c737deee219120a2230a,
0xe56081a7933c6eaf4ef2c5a04e21ab8a3897785dd83a34719d1b62d82cfd00c2,
0x76cc54fa15f53e326575a9a2ac0b8ed2869403b6b6488ce4f3934f17db0f6bee,
0x1cd9cd1d882ea3830e95162b5de4beb5ddff34fdbf7aec64e83b82a6d11b417c,
0xb8ca8ae36d717c448aa27405037e44d9ee28bb8c6cc538a5d22e4535c8befd84,
0x5c4492108c25f873a23d5fd7957b3229edc22858e8894febe7428c0831601982,
0x907bcd75e7465e9791dc34e684742a2c0dc7007736313a95070a7e6b961c9c46,
0xe7134b1511559e6b2440672073fa303ec3915398e75086149eb004f55e893214,
0x2ddc2415e4753bfc383d48733e8b2a3f082883595edc5515514ebb872119af09,
0xf2ad0f76b08ffa1eee62228ba76f4982fab4fbede5d4752c282c3541900bcd5b,
0x0a84a6b15abd1cbc2da7092bf7bac418b8002b7000236dfba7c8335f27e0f1d4,
0x97404e02b9ff5478c928e1e211850c08cc553ebac5d4754d13efd92588b1f20d,
0xfa6ca3bcff1f45b557cdec34cb465ab06ade397e9d9470a658901e1f0f124659,
0x5bd972d55f5472e5b08988ee4bccc7240a8019a5ba338405528cc8a38b29bc21,
0x52952e4f96c803bb76749800891e3bfe55f7372facd5b5a587a39ac10b161bcc,
0xf96731ae09abcad016fd81dc4218bbb5b2cb5fe2e177a715113f381814007314,
0xe7d79e07cf9f2b52623491519a21a0a3d045401a5e7e10dd8873a85076616326,
0xe4892f3777a4614ee6770b22098eaa0a3f32c5c44b54ecedacd69789d676dffe,
0x20c932574779e2cc57780933d1dc6ce51a5ef920ce5bf681f7647ac751106367,
0x057252c573908e227cc07797117701623a4835f4b047dcaa9678105299e48e70,
0x20bad780930fa2a036fe1dea4ccbf46ac5b3c489818cdb0f97ae49d6e2f11fbf,
0xc0d7dd26ffecdb098585a1694e45a54029bb1e31c7c5209289058efebb4cc91b,
0x9a8744beb1935c0abe4b11812fc02748ef7c8cb650db3024dde3c5463e9d8714,
0x8ce6eea4585bbeb657b326daa4f01f6aef34954338b3ca42074aedd1110ba495,
0x1c85b43f5488b370721290d2faea19d9918d094c99963d6863acdfeeca564363,
0xe88a244347e448349e32d0525b40b18533ea227a9d3e9b78a9ff14ce0a586061,
0x352ca61efc5b8ff9ee78e738e749142dd1606154801a1449bbb278fa6bcc3dbe,
0xa066926f9209220b24ea586fb20eb8199a05a247c82d7af60b380f6237429be7,
0x3052337ccc990bfbae26d2f9fe5d7a4eb8edfb83a03203dca406fba9f4509b6e,
0x343ce573a93c272688a068d758df53c0161aa7f9b55dec8beced363a38b33069,
0x0f16b5593f133b58d706fe1793113a10750e8111eadee65301df7a1e84f782d3,
0x808ae8539357e85b648020f1e9d255bc4114bee731a6220d7c5bcb5b85224e03,
0x3b2bd97e31909251752ac57eda6015bb05b85f2838d475095cfd146677430625,
0xe4f857c93b2d8b250050c7381a6c7c660bd29066195806c8ef11a2e6a6640236,
0x23d91589b5070f443ddcefa0838c596518d54928119251ecf3ec0946a8128f52,
0xb72736dfad52503c7f5f0c59827fb6ef4ef75909ff9526268abc0f296ee37296,
0x80a8c66436d86b8afe87dde7e53a53ef87e057a5d4995963e76d159286de61b6,
0xbec92c09ee5e0c84d5a8ba6ca329683ff550ace34631ea607a3a21f99cd36d67,
0x83c97c9807b9ba6d9d914ae49dabdb4c55e12e35013f9b179e6bc92d5d62222b,
0x8d9c79f6af3920672dc4cf97a297c186e75083d099aeb5c1051207bad0c98964,
0x2aaa5944a2bd852b0b1be3166e88f357db097b001c1a71ba92040b473b30a607,
0x46693d27ec4b764fbb516017c037c441f4558aebfe972cdcd03da67c98404e19,
0x903b25d9e12208438f203c9ae2615b87f41633d5ffda9cf3f124c1c3922ba08f,
0x3ec23dc8bc1b49f5c7160d78008f3f235252086a0a0fa3a7a5a3a53ad29ec410,
0xa1fe74ceaf3cccd992001583a0783d7d7b7a245ea374f369133585b576b9c6d8,
0xb2d6b0fe4932a2e06b99531232398f39a45b0f64c3d4ebeaaebc8f8e50a80607,
0xe19893353f9214eebf08e5d83c6d44c24bffe0eceee4dc2e840d42eab0642536,
0x5b798e4bc099fa2e2b4b5b90335c51befc9bbab31b4dd02451b0abd09c06ee79,
0xbab2cdec1553a408cac8e61d9e6e19fb8ccfb48efe6d02bd49467a26eeeca920,
0x1c1a544c28c38e5c423fe701506693511b3bc5f2af9771b9b2243cd8d41bebfc,
0x704d6549d99be8cdefeec9a58957f75a2be4af7bc3dc4655fa606e7f3e03b030,
0x051330f43fe39b08ed7d82d68c49b36a8bfa31357b546bfb32068712df89d190,
0xe69174c7b03896461cab2dfaab33d549e3aac15e6b0f6f6f466fb31dae709b9b,
0xe5f668603e0ddbbcde585ac41c54c3c4a681fffb7a5deb205344de294758e6ac,
0xca70d5e4c3a81c1f21f246a3f52c41eaef9a683f38eb7c512eac8b385f46cbcd,
0x3173a6b882b21cd147f0fc60ef8f24bbc42104caed4f9b154f2d2eafc3a56907,
0xc71469c192bf5cc36242f6365727f57a19f924618b8a908ef885d8f459833cc3,
0x59c596fc388afd8508bd0f5a1e767f3dda9ed30f6646d15bc59f0b07c4de646f,
0xb200faf29368581f551bd351d357b6fa8cbf90bdc73b37335e51cad36b4cba83,
0x275cede69b67a9ee0fff1a762345261cb20fa8191470159cc65c7885cfb8313c,
0x0ce4ef84916efbe1ba9a0589bed098793b1ea529758ea089fd79151cc9dc7494,
0x0f08483bb720e766d60a3cbd902ce7c9d835d3f7fdf6dbe1f37bcf2f0d4764a2,
0xb30a73e5db2464e6da47d10667c82926fa91fceb337d89a52db5169008bc6726,
0x6b9c50fed1cc404bf2dd6fffbfd18e30a4caa1500bfeb080aa93f78d10331aaf,
0xf17c84286df03ce175966f560600dd562e0f59f18f1d1276b4d8aca545d57856,
0x11455f2ef96a6b2be69854431ee219806008eb80ea38c81e45b2e58b3f975a20,
0x9a61e03e2157a5c403dfcde690f7b7d704dd56ea1716cf14cf7111075a8d6491,
0x30312c910ce6b39e00dbaa669f0fb7823a51f20e83eaeb5afa63fb57668cc2f4,
0x17c18d261d94fba82886853a4f262b9c8b915ed3263b0052ece5826fd7e7d906,
0x2d8f6ea0f5b9d0e4bc1478161f5ed2ad3d8495938b414dcaec9548adbe572671,
0x19954625f13d9bab758074bf6dee47484260d29ee118347c1701aaa74abd9848,
0x842ef2ad456e6f53d75e91e8744b96398df80350cf7af90b145fea51fbbcf067,
0x34a8b0a76ac20308aa5175710fb3e75c275b1ff25dba17c04e3a3e3c48ca222c,
0x58efcbe75f32577afe5e9ff827624368b1559c32fcca0cf4fd704af8ce019c63,
0x411b4d242ef8f14d92bd8b0b01cb4fa3ca6f29c6f9073cfdd3ce614fa717463b,
0xf76dbda66ede5e789314a88cff87ecb4bd9ca418c75417d4d920e0d21a523257,
0xd801821a0f87b4520c1b003fe4936b6852c410ee00b46fb0f81621c9ac6bf6b4,
0x97ad11d6a29c8cf3c548c094c92f077014de3629d1e9053a25dbfaf7eb55f72d,
0xa87012090cd19886d49521d564ab2ad0f18fd489599050c42213bb960c9ee8ff,
0x8868d8a26e758d50913f2bf228da0444a206e52853bb42dd8f90f09abe9c859a,
0xc257fb0cc9970e02830571bf062a14540556abad2a1a158f17a18f14b8bcbe95,
0xfe611ce27238541b14dc174b652dd06719dfbcda846a027f9d1a9e8e9df2c065,
0xc9b25ea410f420cc2d4fc6057801d180c6cab959bce56bf6120f555966e6de6d,
0x95437f0524ec3c04d4132c83be7f1a603e6f4743a85ede25aa97a1a4e3f3f8fc,
0x82a12910104065f35e983699c4b9187aed0ab0ec6146f91728901efecc7e2e20,
0x6622dd11e09252004fb5aaa39e283333c0686065f228c48a5b55ee2060dbd139,
0x89a2879f25733dab254e4fa6fddb4f04b8ddf018bf9ad5c162aea5c858e6faaa,
0x8a71b62075a6011fd9b65d956108fa79cc9ebb8f194d64d3105a164e01cf43a6,
0x103f4fe9ce211b6452181371f0dc4a30a557064b684645a4495136f4ebd0936a,
0x97914adc5d7ce80147c2f44a6b29d0b495d38dedd8cc299064abcc62ed1ddabc,
0x825c481da6c836a8696d7fda4b0563d204a9e7d9e4c47b46ded26db3e2d7d734,
0xf8c0637ba4c0a383229f1d730db733bc11d6a4e33214216c23f69ec965dcaaad,
0xaed3bdaf0cb12d37764d243ee0e8acdefc399be2cabbf1e51dc43454efd79cbd,
0xe8427f56cc5cec8554e2f5f586b57adccbea97d5fc3ef7b8bbe97c2097cf848c,
0xba4ad0abd5c14d526357fd0b6f8676ef6126aeb4a6d80cabe1f1281b9d28246c,
0x4cff20b72e2ab5af3fafbf9222146949527c25f485ec032f22d94567ff91b22f,
0x0d32925d89dd8fed989912afcbe830a4b5f8f7ae1a3e08ff1d3a575a77071d99,
0xe51a1cbeae0be5d2fdbc7941aea904d3eade273f7477f60d5dd6a12807246030,
0xfb8615046c969ef0fa5e6dc9628c8a9880e86a5dc2f6fc87aff216ea83fcf161,
0x64dd705e105c88861470d112c64ca3d038f67660a02d3050ea36c34a9ebf47f9,
0xb6ad148095c97528180f60fa7e8609bf5ce92bd562682092d79228c2e6f0750c,
0x5bae0cd81f3bd0384ca3143a72068e6010b946462a73299e746ca639c026781c,
0xc39a0fc7764fcfc0402b12fb0bbe78fe3633cbfb33c7f849279585a878a26d7c,
0x2b752fda1c0c53d685cc91144f78d371db6b766725872b62cc99e1234cca8c1a,
0x40ee6b9635d87c95a528757729212a261843ecb06d975de91352d43ca3c7f196,
0x75e2005d3726cf8a4bb97ea5287849a361e3f8fdfadc3c1372feed1208c89f6b,
0x0976f8ab556153964b58158678a5297da4d6ad92e284da46052a791ee667aee4,
0xdbeef07841e41e0672771fb550a5b9233ae8e9256e23fa0d34d5ae5efe067ec8,
0xa890f412ab6061c0c5ee661e80d4edc5c36b22fb79ac172ddd5ff26a7dbe9751,
0xb666ae07f9276f6d0a33f9efeb3c5cfcba314fbc06e947563db92a40d7a341e8,
0x83a082cf97ee78fbd7f31a01ae72e40c2e980a6dab756161544c27da86043528,
0xfa726a919c6f8840c456dc77b0fec5adbed729e0efbb9317b75f77ed479c0f44,
0xa8606800c54faeab2cbc9d85ff556c49dd7e1a0476027e0f7ce2c1dc2ba7ccbf,
0x2796277836ab4c17a584c9f6c7778d10912cb19e541fb75453796841e1f6cd1c,
0xf648b8b3c7be06f1f8d9cda13fd6d60f913e5048a8e0b283b110ca427eeb715f,
0xa21d00b8fdcd77295d4064e00fbc30bed579d8255e9cf3a9016911d832390717,
0xe741afcd98cbb3bb140737ed77bb968ac60d5c00022d722f9f04f56e97235dc9,
0xbeecc9638fac39708ec16910e5b02c91f83f6321f6eb658cf8a96353cfb49806,
0x912eee6cabeb0fed8d6e6ca0ba61977fd8e09ea0780ff8fbec995e2a85e08b52,
0xc665bc0bb121a1229bc56ecc07a7e234fd24c523ea14700aa09e569b5f53ad33,
0x39501621c2bdff2f62ab8d8e3fe47fe1701a98c665697c5b750ee1892f11846e,
0x03d32e16c3a6c913daefb139f131e1e95a742b7be8e20ee39b785b4772a50e44,
0x4f504eb46a82d440f1c952a06f143994bc66eb9e3ed865080cd9dfc6d652b69c,
0xad753dc8710a46a70e19189d8fc7f4c773e4d9ccc7a70c354b574fe377328741,
0xf7f5464a2d723b81502adb9133a0a4f0589b4134ca595a82e660987c6b011610,
0x216b60b1c3e3bb4213ab5d43e04619d13e1ecedbdd65a1752bda326223e3ca3e,
0x763664aa96d27b6e2ac7974e3ca9c9d2a702911bc5d550d246631965cf2bd4a2,
0x292b5c8c8431b040c04d631f313d4e6b67b5fd3d4b8ac9f2edb09d13ec61f088,
0x80db43c2b9e56eb540592f15f5900222faf3f75ce62e78189b5aa98c54568a5e,
0x1b5fdf8969bcd4d65e86a2cefb3a673e18d587843f4f50db4e3ee77a0ba2ef1c,
0x11e237953fff3e95e6572da50a92768467ffdfd0640d3384aa1c486357e7c24a,
0x1fabd4faa8dba44808cc87d0bc389654a98496745578f3d17d134adc7f7b10f3,
0x5eca4aa96f20a56197772ae6b600762154ca9d2702cab12664ea47cbff1a440c,
0x0b4234f5bb02abcf3b5ce6c44ea85f55ec7db98fa5a7b90abef6dd0df034743c,
0x316761e295bf350313c4c92efea591b522f1df4211ce94b22e601f30aefa51ef,
0xe93a55ddb4d7dfe02598e8f909ff34b3de40a1c0ac8c7fba48cb604ea60631fb,
0xe6e6c877b996857637f8a71d0cd9a6d47fdeb03752c8965766f010073332b087,
0xa4f95c8874e611eddd2c4502e4e1196f0f1be90bfc37db35f8588e7d81d34aeb,
0x9351710a5633714bb8b2d226e15ba4caa6f50f56c5508e5fa1239d5cc6a7e1aa,
0x8d0aef52ec7266f37adb572913a6213b8448caaf0384008373dec525ae6cdff1,
0x718e24c3970c85bcb14d2763201812c43abac0a7f16fc5787a7a7b2f37288586,
0x3600ce44cebc3ee46b39734532128eaf715c0f3596b554f8478b961b0d6e389a,
0x50dd1db7b0a5f6bd2d16252f43254d0f5d009e59f61ebc817c4bbf388519a46b,
0x67861ed00f5fef446e1f4e671950ac2ddae1f3b564f1a6fe945e91678724ef03,
0x0e332c26e169648bc20b4f430fbf8c26c6edf1a235f978d09d4a74c7b8754aad,
0x6c9901015adf56e564dfb51d41a82bde43fb67273b6911c9ef7fa817555c9557,
0x53c83391e5e0a024f68d5ade39b7a769f10664e12e4942c236398dd5dbce47a1,
0x78619564f0b2399a9fcb229d938bf1e298d62b03b7a37fe6486034185d7f7d27,
0x4625f15381a8723452ec80f3dd0293c213ae35de737c508f42427e1735398c3a,
0x69542425ddb39d3d3981e76b41173eb1a09500f11164658a3536bf3e292f8b6a,
0x82ac4f5bb40aece7d6706f1bdf4dfba5c835c09afba6446ef408d8ec6c09300f,
0x740f9180671091b4c5b3ca59b9515bd0fc751f48e488a9f7f4b6848602490e21,
0x9a04b08b4115986d8848e80960ad67490923154617cb82b3d88656ec1176c24c,
0xf9ffe528eccffad519819d9eef70cef317af33899bcaee16f1e720caf9a98744,
0x46da5e1a14b582b237f75556a0fd108c4ea0d55c0edd8f5d06c59a42e57410df,
0x098f3429c8ccda60c3b5b9755e5632dd6a3f5297ee819bec8de2d8d37893968a,
0x1a5b91af6025c11911ac072a98b8a44ed81f1f3c76ae752bd28004915db6f554,
0x8bed50c7cae549ed4f8e05e02aa09b2a614c0af8eec719e4c6f7aee975ec3ec7,
0xd86130f624b5dcc116f2dfbb5219b1afde4b7780780decd0b42694e15c1f8d8b,
0x4167aa9bc0075f624d25d40eb29139dd2c452ebf17739fab859e14ac6765337a,
0xa258ce5db20e91fb2ea30d607ac2f588bdc1924b21bbe39dc881e19889a7f5c6,
0xe5ef8b5ab3cc8894452d16dc875b69a55fd925808ac7cafef1cd19485d0bb50a,
0x120df2b3975d85b6dfca56bb98a82025ade5ac1d33e4319d2e0105b8de9ebf58,
0xc964291dd2e0807a468396ebba3d59cfe385d949f6d6215976fc9a0a11de209a,
0xf23f14cb709074b79abe166f159bc52b50de687464df6a5ebf112aa953c95ad5,
0x622c092c9bd7e30f880043762e26d8e9c73ab7c0d0806f3c5e472a4152b35a93,
0x8a5f090662731e7422bf651187fb89812419ab6808f2c62da213d6944fccfe9f,
0xfbea3c0d92e061fd2399606f42647d65cc54191fa46d57b325103a75f5c22ba6,
0x2babfbcc08d69b52c3747ddc8dcad4ea5511edabf24496f3ff96a1194d6f680e,
0x4d3d019c28c779496b616d85aee201a3d79d9eecf35f728d00bcb12245ace703,
0xe76fcee1f08325110436f8d4a95476251326b4827399f9b2ef7e12b7fb9c4ba1,
0x4884d9c0bb4a9454ea37926591fc3eed2a28356e0506106a18f093035638da93,
0x74c3f303d93d4cc4f0c1eb1b4378d34139220eb836628b82b649d1deb519b1d3,
0xacb806670b278d3f0c84ba9c7a68c7df3b89e3451731a55d7351468c7c864c1c,
0x8660fb8cd97e585ea7a41bccb22dd46e07eee8bbf34d90f0f0ca854b93b1ebee,
0x2fc9c89cdca71a1c0224d469d0c364c96bbd99c1067a7ebe8ef412c645357a76,
0x8ec6d5ab6ad7135d66091b8bf269be44c20af1d828694cd8650b5479156fd700,
0x50ab4776e8cabe3d864fb7a1637de83f8fbb45d6e49645555ffe9526b27ebd66,
0xbf39f5e17082983da4f409f91c7d9059acd02ccbefa69694aca475bb8d40b224,
0x3135b3b981c850cc3fe9754ec6af117459d355ad6b0915beb61e84ea735c31bf,
0xa7971dab52ce4bf45813223b0695f8e87f64b614c9c5499faac6f842e5c41be9,
0x9e480f5617323ab104b4087ac4ef849a5da03427712fb302ac085507c77d8f37,
0x57a6d474654d5e8d408159be39ad0e7026e6a4c6a6543e23a63d30610dc8dfc1,
0x09eb3e01a5915a4e26d90b4c58bf0cf1e560fdc8ba53faed9d946ad3e9bc78fa,
0x29c6d25da80a772310226b1b89d845c7916e4a4bc94d75aa330ec3eaa14b1e28,
0x1a1ccfee11edeb989ca02e3cb89f062612a22a69ec816a625835d79370173987,
0x1cb63dc541cf7f71c1c4e8cabd2619c3503c0ea1362dec75eccdf1e9efdbfcfc,
0xac9dff32a69e75b396a2c250e206b36c34c63b955c9e5732e65eaf7ccca03c62,
0x3e1b4f0c3ebd3d38cec389720147746774fc01ff6bdd065f0baf2906b16766a8,
0x5cc8bed25574463026205e90aad828521f8e3d440970d7e810d1b46849681db5,
0x255185d264509bd3a768bb0d50b568e66eb1fec96d573e33aaacc716d7c8fb93,
0xe81b86ba631973918a859ff5995d7840b12511184c2865401f2693a71b9fa07e,
0x61e67e42616598da8d36e865b282127c761380d3a56d26b8d35fbbc7641433c5,
0x60c62ffef83fe603a34ca20b549522394e650dad5510ae68b6e074f0cd209a56,
0x78577f2caf4a54f6065593535d76216f5f4075af7e7a98b79571d33b1822920c,
0xfd4cb354f2869c8650200de0fe06f3d39e4dbebf19b0c1c2677da916ea84f44d,
0x453769cef6ff9ba2d5c917982a1ad3e2f7e947d9ea228857556af0005665e0b0,
0xe567f93f8f88bf1a6b33214f17f5d60c5dbbb531b4ab21b8c0b799b6416891e0,
0x7e65a39a17f902a30ceb2469fe21cba8d4e0da9740fcefd5c647c81ff1ae95fa,
0x03e4a7eea0cd6fc02b987138ef88e8795b5f839636ca07f6665bbae9e5878931,
0xc3558e2b437cf0347cabc63c95fa2710d3f43c65d380feb998511903f9f4dcf0,
0xe3a615f80882fb5dfbd08c1d7a8b0a4d3b651d5e8221f99b879cb01d97037a9c,
0xb56db4a5fea85cbffaee41f05304689ea321c40d4c108b1146fa69118431d9b2,
0xab28e1f077f18117945910c235bc9c6f9b6d2b45e9ef03009053006c637e3e26,
0xefcabc1d5659fd6e48430dbfcc9fb4e08e8a9b895f7bf9b3d6c7661bfc44ada2,
0xc7547496f212873e7c3631dafaca62a6e95ac39272acf25a7394bac6ea1ae357,
0xc482013cb01bd69e0ea9f447b611b06623352e321469f4adc739e3ee189298eb,
0x5942f42e91e391bb44bb2c4d40da1906164dbb6d1c184f00fa62899baa0dba2c,
0xb4bcb46c80ad4cd603aff2c1baf8f2c896a628a46cc5786f0e58dae846694677,
0xd0a7305b995fa8c317c330118fee4bfef9f65f70b54558c0988945b08e90ff08,
0x687f801b7f32fdfa7d50274cc7b126efedbdae8de154d36395d33967216f3086,
0xeb19ec10ac6c15ffa619fa46792971ee22a9328fa53bd69a10ed6e9617dd1bbf,
0xa2bb3f0367f62abdb3a9fa6da34b20697cf214a4ff14fd42826da140ee025213,
0x070a76511f32c882374400af59b22d88974a06fbc10d786dd07ca7527ebd8b90,
0x8f195689537b446e946b376ec1e9eb5af5b4542ab47be550a5700fa5d81440d5,
0x10cc09778699fc8ac109e7e6773f83391eeba2a6db5226fbe953dd8d99126ca5,
0x8cc839cb7dc84fd3b8c0c7ca637e86a2f72a8715cc16c7afb597d12da717530b,
0xa32504e6cc6fd0ee441440f213f082fcf76f72d36b5e2a0f3b6bdd50cdd825a2,
0x8f45151db8878e51eec12c450b69fa92176af21a4543bb78c0d4c27286e74469,
0x23f5c465bd35bcd4353216dc9505df68324a27990df9825a242e1288e40a13bb,
0x35f409ce748af33c20a6ae693b8a48ba4623de9686f9834e22be4410e637d24f,
0xb962e5845c1db624532562597a99e2acc5e434b97d8db0725bdeddd71a98e737,
0x0f8364f99f43dd52b4cfa9e426c48f7b6ab18dc40a896e96a09eceebb3363afe,
0xa842746868da7644fccdbb07ae5e08c71a6287ab307c4f9717eadb414c9c99f4,
0xa59064c6b7fe7d2407792d99ed1218d2dc2f240185fbd8f767997438241b92e9,
0xb6ea0d58e8d48e05b9ff4d75b2ebe0bd9752c0e2691882f754be66cdec7628d3,
0xf16b78c9d14c52b2b5156690b6ce37a5e09661f49674ad22604c7d3755e564d1,
0xbfa8ef74e8a37cd64b8b4a4260c4fc162140603f9c2494b9cf4c1e13de522ed9,
0xf4b89f1776ebf30640dc5ec99e43de22136b6ef936a85193ef940931108e408a,
0xefb9a4555d495a584dbcc2a50938f6b9827eb014ffae2d2d0aae356a57894de8,
0x0627a466d42a26aca72cf531d4722e0e5fc5d491f4527786be4e1b641e693ac2,
0x7d10d21542de3d8f074dbfd1a6e11b3df32c36272891aae54053029d39ebae10,
0x0f21118ee9763f46cc175a21de876da233b2b3b62c6f06fa2df73f6deccf37f3,
0x143213b96f8519c15164742e2350cc66e814c9570634e871a8c1ddae4d31b6b5,
0x8d2877120abae3854e00ae8cf5c8c95b3ede10590ab79ce2be7127239507e18d,
0xaccd0005d59472ac04192c059ed9c10aea42c4dabec9e581f6cb10b261746573,
0x67bc8dd5422f39e741b9995e6e60686e75d6620aa0d745b84191f5dba9b5bb18,
0x11b8e95f6a654d4373cefbbac29a90fdd8ae098043d1969b9fa7885318376b34,
0x431a0b8a6f08760c942eeff5791e7088fd210f877825ce4dcabe365e03e4a65c,
0x704007f11bae513f428c9b0d23593fd2809d0dbc4c331009856135dafec23ce4,
0xc06dee39a33a05e30c522061c1d9272381bde3f9e42fa9bd7d5a5c8ef11ec6ec,
0x66b4157baaae85db0948ad72882287a80b286df2c40080b8da4d5d3db0a61bd2,
0xef1983b1906239b490baaaa8e4527f78a57a0a767d731f062dd09efb59ae8e3d,
0xf26d0d5c520cce6688ca5d51dee285af26f150794f2ea9f1d73f6df213d78338,
0x8b28838382e6892f59c42a7709d6d38396495d3af5a8d5b0a60f172a6a8940bd,
0x261a605fa5f2a9bdc7cffac530edcf976e7ea7af4e443b625fe01ed39dad44b6]
compressed_lamport_PK = 0xdd635d27d1d52b9a49df9e5c0c622360a4dd17cba7db4e89bce3cb048fb721a5
child_SK = 20397789859736650942317412262472558107875392172444076792671091975210932703118
```

## Security Considerations

None.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 30 Sep 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2333</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2333</guid>
      </item>
    
      <item>
        <title>BLS12-381 Deterministic Account Hierarchy</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/bls-keys-related-erc-discussion-erc-2333-2334-2335/19774</comments>
        
        <description>## Abstract

A standard for allocating keys generated by [ERC-2333](./eip-2333.md) to a specific purpose. It defines a `path` which is a string that parses into the indices to be used when traversing the tree of keys that [ERC-2333](./eip-2333.md) generates.

## Motivation

The Beacon chain uses BLS signatures over BLS12-381. This new scheme requires a new key derivation mechanism, which is established within [ERC-2333](./eip-2333.md). This new scheme is incompatible with [BIP44](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0044.mediawiki) due to the exclusive use of hardened keys, the increased number of keys per level, not using [BIP32](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0032.mediawiki) for key derivation. It is therefore necessary to establish a new *path* for traversing the [ERC-2333](./eip-2333.md) key-tree.

The path structure specified in this ERC aims to be more general than [BIP44](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0044.mediawiki) 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) [ERC-600](./eip-600.md) &amp; [ERC-601](./eip-601.md)

## Specification

### Path

The path traversed through the tree of keys is defined by integers (which indicate the sibling index) separated by `/` 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.

```text
m / purpose / coin_type /  account / use
```

#### Notation

The notation used within the path is specified within the [ERC-2333](./eip-2333.md), but is summarized again below for convenience.

* `m` Denotes the master node (or root) of the tree
* `/` Separates the tree into depths, thus `i / j` signifies that `j` is a child of `i`

### Purpose

The `purpose` is set to `12381` which is the name of the new curve (BLS12-381). In order to be in compliance with this standard, the [ERC-2333](./eip-2333.md) MUST be implemented as the KDF and therefore, the purpose `12381` MAY NOT be used unless this is the case.

### Coin Type

The `coin_type` here reflects the coin number for an individual coin thereby acting as a means of separating the keys used for different chains.

### Account

`account` 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.

### Use

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 `0`.

### Beacon Chain Specific Parameters

#### Coin type

The coin type used for the BLS12-381 keys in Ethereum is `3600`.

#### Validator keys

Each Beacon chain validator has two keys, one for withdrawals and transfers (called the *withdrawal key*), and the other for performing their duties as a validator (henceforth referred to as the *signing key*).

The path for withdrawal keys is `m/12381/3600/i/0` where `i` indicates the `i`th set of validator keys.

The path for the signing key is `m/12381/3600/i/0/0` where again, `i` indicates the `i`th set of validator keys. Another way of phrasing this is that the signing key is the `0`th child of the associated withdrawal key for that validator.

**Note:** 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.)

## Rationale

`purpose`, `coin_type`, and `account` are widely-adopted terms as per [BIP43](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0043.mediawiki) and [BIP44](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0044.mediawiki) and therefore reusing these terms and their associated meanings makes sense.

The purpose needs to be distinct from these standards as the KDF and path are not inter-compatible and `12381` is an obvious choice.

`account` separates user activity into distinct categories thereby allowing users to separate their concerns however they desire.

`use` will commonly be determined at the application level providing distinct keys for non-intersecting use cases.

### Beacon Chain Specific Parameters

A new coin type is chosen for Beacon Chain BLS keys to help ensure a clean separation between BLS12-381 and secp256k1 keys.  `3600` is chosen specifically because it is the square of the Ethereum&apos;s secp256k1 `coin_type` (`3600==60^2`).

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.

## Backwards Compatibility

[BIP43](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0043.mediawiki) and [BIP44](https://github.com/bitcoin/bips/blob/43ce3a461dfb48e62ffa0cfc70f5f54d1eb5c577/bip-0044.mediawiki). Due to the use of a new KDF within [ERC-2333](./eip-2333.md), a new path standard is required. This ERC implements this, with minor changes.

`purpose` `12381` paths do not support hardened keys and therefore the `&apos;` character is invalid.

## Security Considerations

None.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 30 Sep 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2334</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2334</guid>
      </item>
    
      <item>
        <title>BLS12-381 Keystore</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/bls-keys-related-erc-discussion-erc-2333-2334-2335/19774</comments>
        
        <description>## Abstract

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.

## Motivation

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.

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:

* __The use of Keccak256.__ Web3 Secret Stores use Keccak for their checksum. BLS signatures, [keys (ERC-2333)](./eip-2333.md), 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.

* __A lack of abstraction.__ 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.

## Specification

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.

### Password requirements

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.

#### Control codes removal

The C0, C1, and `Delete` control codes are not valid characters in the password and should therefore be stripped from the password. C0 are the control codes between `0x00` - `0x1F` (inclusive) and C1 codes lie between `0x80` and `0x9F` (inclusive). `Delete`, commonly known as &quot;backspace&quot;, is the UTF-8 character `7F` which must also be stripped. Note that space (`Sp` UTF-8 `0x20`) is a valid character in passwords despite it being a pseudo-control character.

### Modules

This standard makes use of the notion of a _module_ 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.

A module is comprised of a `function`, which defines which cryptographic construct is being used, `params`, the parameters required by the function, and `message` the primary input to the function.

### Decryption key

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 `function`, and the `params` specified by the`kdf` module as per the keystore file.

| KDF            | `&quot;function&quot;` | `&quot;params&quot;`                                                                               | `&quot;message&quot;` | Definition                                         |
|----------------|--------------|------------------------------------------------------------------------------------------|-------------|----------------------------------------------------|
| PBKDF2-SHA-256 | `&quot;pbkdf2&quot;`   | &lt;ul&gt;&lt;li&gt;`&quot;c&quot;`&lt;/li&gt;&lt;li&gt;`&quot;dklen&quot;`&lt;/li&gt;&lt;li&gt;`&quot;prf: &quot;hmac-sha256&quot;`&lt;/li&gt;&lt;li&gt;`&quot;salt&quot;`&lt;/li&gt;&lt;/ul&gt; |             | [RFC 2898](https://www.rfc-editor.org/rfc/rfc2898) |
| scrypt         | `&quot;scrypt&quot;`   | &lt;ul&gt;&lt;li&gt;`&quot;dklen&quot;`&lt;/li&gt;&lt;li&gt;`&quot;n&quot;`&lt;/li&gt;&lt;li&gt;`&quot;p&quot;`&lt;/li&gt;&lt;li&gt;`&quot;r&quot;`&lt;/li&gt;&lt;li&gt;`&quot;salt&quot;`&lt;/li&gt;&lt;/ul&gt;   |             | [RFC 7914](https://www.rfc-editor.org/rfc/rfc7914) |

### Password verification

The password verification step verifies that the password is correct with respect to the `checksum.message`, `cipher.message`, and `kdf`. This is done by appending the `cipher.message` to the 2nd 16 bytes of the decryption key, obtaining its SHA256 hash and verifying whether it matches the `checksum.message`.

#### Inputs

* `decryption_key`, the octet string obtained from decryption key process
* `cipher_message`, the octet string obtained from keystore file from `crypto.cipher.message`
* `checksum_message`, the octet string obtained from keystore file from `crypto.checksum.message`

#### Outputs

* `valid_password`, a boolean value indicating whether the password is valid

#### Definitions

* `a[0:3]` returns a slice of `a` including octets 0, 1, 2
* `a | b` is the concatenation of `a` with `b`

#### Procedure

```text
0. DK_slice = decryption_key[16:32]
1. pre_image = DK_slice | cipher_message
2. checksum = SHA256(pre_image)
3. valid_password = checksum == checksum_message
4. return valid_password
```

| Hash       | `&quot;function&quot;`    | `&quot;params&quot;` | `&quot;message&quot;` | Definition                                      |
|------------|-----------------|------------|-------------|-------------------------------------------------|
| SHA-256    | `&quot;sha256&quot;`      |            |             | [RFC 6234](https://www.rfc-editor.org/rfc/rfc6234) |

### Secret decryption

The `cipher.function` encrypts the secret using the decryption key, thus to decrypt it, the decryption key along with the `cipher.function` and `cipher.params` must be used. If the `decryption_key` 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 `decryption_key` are used as the AES key.

| Cipher               | `&quot;function&quot;`    | `&quot;params&quot;`               | `&quot;message&quot;` | Definition                                      |
|----------------------|-----------------|--------------------------|-------------|-------------------------------------------------|
| AES-128 Counter Mode | `&quot;aes-128-ctr&quot;` | &lt;ul&gt;&lt;li&gt;`&quot;iv&quot;`&lt;/li&gt;&lt;/ul&gt; |             | [RFC 3686](https://www.rfc-editor.org/rfc/rfc3686) |

### Description

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 `description` **is not necessarily unique**.

### PubKey

The `pubkey` 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 `pubkey` is specified in the in the appropriate signature standard (eg. [ERC-2333](./eip-2333.md)), but can be seen as a byte-string in the abstract and should be directly compatible with the appropriate signature library.

### Path

The `path` indicates where in the key-tree a key originates from. It is a string defined by [ERC-2334](./eip-2334.md), if no path is known or the path is not relevant, the empty string, `&quot;&quot;` indicates this. The `path` 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.

### UUID

The `uuid` provided in the keystore is a randomly generated UUID as specified by [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122). It is used as a 128-bit proxy for referring to a particular set of keys or account.

### Version

The `version` is set to `4`.

### JSON schema

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: `function`, `params`, and `message` which corresponds with which construction is to be used, what the configuration for the construction is, and what the input is.

```json
{
    &quot;$ref&quot;: &quot;#/definitions/Keystore&quot;,
    &quot;definitions&quot;: {
        &quot;Keystore&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;properties&quot;: {
                &quot;crypto&quot;: {
                    &quot;type&quot;: &quot;object&quot;,
                    &quot;properties&quot;: {
                        &quot;kdf&quot;: {
                            &quot;$ref&quot;: &quot;#/definitions/Module&quot;
                        },
                        &quot;checksum&quot;: {
                            &quot;$ref&quot;: &quot;#/definitions/Module&quot;
                        },
                        &quot;cipher&quot;: {
                            &quot;$ref&quot;: &quot;#/definitions/Module&quot;
                        }
                    }
                },
                &quot;description&quot;: {
                    &quot;type&quot;: &quot;string&quot;
                },
                &quot;pubkey&quot;: {
                    &quot;type&quot;: &quot;string&quot;
                },
                &quot;path&quot;: {
                    &quot;type&quot;: &quot;string&quot;
                },
                &quot;uuid&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;format&quot;: &quot;uuid&quot;
                },
                &quot;version&quot;: {
                    &quot;type&quot;: &quot;integer&quot;
                }
            },
            &quot;required&quot;: [
                &quot;crypto&quot;,
                &quot;path&quot;,
                &quot;uuid&quot;,
                &quot;version&quot;
            ],
            &quot;title&quot;: &quot;Keystore&quot;
        },
        &quot;Module&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;properties&quot;: {
                &quot;function&quot;: {
                    &quot;type&quot;: &quot;string&quot;
                },
                &quot;params&quot;: {
                    &quot;type&quot;: &quot;object&quot;
                },
                &quot;message&quot;: {
                    &quot;type&quot;: &quot;string&quot;
                }
            },
            &quot;required&quot;: [
                &quot;function&quot;,
                &quot;message&quot;,
                &quot;params&quot;
            ]
        }
    }
}
```

## Security Considerations

None.

## Rationale

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 [motivation above](#motivation)) and the notion of modules.

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.

The `version` is set to 4 to prevent collisions with the existing Ethereum keystore standard.

## Backwards Compatibility

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.

## Test Cases

### Scrypt Test Vector

Password `&quot;𝔱𝔢𝔰𝔱𝔭𝔞𝔰𝔰𝔴𝔬𝔯𝔡🔑&quot;`
Encoded Password: `0x7465737470617373776f7264f09f9491`
Secret `0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f`

```json
{
    &quot;crypto&quot;: {
        &quot;kdf&quot;: {
            &quot;function&quot;: &quot;scrypt&quot;,
            &quot;params&quot;: {
                &quot;dklen&quot;: 32,
                &quot;n&quot;: 262144,
                &quot;p&quot;: 1,
                &quot;r&quot;: 8,
                &quot;salt&quot;: &quot;d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&quot;
            },
            &quot;message&quot;: &quot;&quot;
        },
        &quot;checksum&quot;: {
            &quot;function&quot;: &quot;sha256&quot;,
            &quot;params&quot;: {},
            &quot;message&quot;: &quot;d2217fe5f3e9a1e34581ef8a78f7c9928e436d36dacc5e846690a5581e8ea484&quot;
        },
        &quot;cipher&quot;: {
            &quot;function&quot;: &quot;aes-128-ctr&quot;,
            &quot;params&quot;: {
                &quot;iv&quot;: &quot;264daa3f303d7259501c93d997d84fe6&quot;
            },
            &quot;message&quot;: &quot;06ae90d55fe0a6e9c5c3bc5b170827b2e5cce3929ed3f116c2811e6366dfe20f&quot;
        }
    },
    &quot;description&quot;: &quot;This is a test keystore that uses scrypt to secure the secret.&quot;,
    &quot;pubkey&quot;: &quot;9612d7a727c9d0a22e185a1c768478dfe919cada9266988cb32359c11f2b7b27f4ae4040902382ae2910c15e2b420d07&quot;,
    &quot;path&quot;: &quot;m/12381/60/3141592653/589793238&quot;,
    &quot;uuid&quot;: &quot;1d85ae20-35c5-4611-98e8-aa14a633906f&quot;,
    &quot;version&quot;: 4
}
```

### PBKDF2 Test Vector

Password `&quot;𝔱𝔢𝔰𝔱𝔭𝔞𝔰𝔰𝔴𝔬𝔯𝔡🔑&quot;`
Encoded Password: `0x7465737470617373776f7264f09f9491`
Secret `0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f`

```json
{
    &quot;crypto&quot;: {
        &quot;kdf&quot;: {
            &quot;function&quot;: &quot;pbkdf2&quot;,
            &quot;params&quot;: {
                &quot;dklen&quot;: 32,
                &quot;c&quot;: 262144,
                &quot;prf&quot;: &quot;hmac-sha256&quot;,
                &quot;salt&quot;: &quot;d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3&quot;
            },
            &quot;message&quot;: &quot;&quot;
        },
        &quot;checksum&quot;: {
            &quot;function&quot;: &quot;sha256&quot;,
            &quot;params&quot;: {},
            &quot;message&quot;: &quot;8a9f5d9912ed7e75ea794bc5a89bca5f193721d30868ade6f73043c6ea6febf1&quot;
        },
        &quot;cipher&quot;: {
            &quot;function&quot;: &quot;aes-128-ctr&quot;,
            &quot;params&quot;: {
                &quot;iv&quot;: &quot;264daa3f303d7259501c93d997d84fe6&quot;
            },
            &quot;message&quot;: &quot;cee03fde2af33149775b7223e7845e4fb2c8ae1792e5f99fe9ecf474cc8c16ad&quot;
        }
    },
    &quot;description&quot;: &quot;This is a test keystore that uses PBKDF2 to secure the secret.&quot;,
    &quot;pubkey&quot;: &quot;9612d7a727c9d0a22e185a1c768478dfe919cada9266988cb32359c11f2b7b27f4ae4040902382ae2910c15e2b420d07&quot;,
    &quot;path&quot;: &quot;m/12381/60/0/0&quot;,
    &quot;uuid&quot;: &quot;64625def-3331-4eea-ab6f-782f3ed16a83&quot;,
    &quot;version&quot;: 4
}
```

## Security Considerations

None.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 30 Sep 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2335</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2335</guid>
      </item>
    
      <item>
        <title>Ethereum 2 Hierarchical Deterministic Walletstore</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-2386-walletstore/3792</comments>
        
        <description>## Simple Summary

A JSON format for the storage and retrieval of Ethereum 2 hierarchical deterministic (HD) wallet definitions.

## Abstract

Ethereum has the concept of keystores: pieces of data that define a key (see [EIP-2335](https://eips.ethereum.org/EIPS/eip-2335) for details).  This adds the concept of walletstores: stores that define wallets and how keys in said wallets are created.

## Motivation

Hierarchical deterministic wallets create keys from a _seed_ and a _path_.  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.

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.

## Specification

The elements of a hierarchical deterministic walletstore are as follows:

### UUID

The `uuid` provided in the walletstore is a randomly-generated type 4 UUID as specified by [RFC 4122](https://tools.ietf.org/html/rfc4122). It is intended to be used as a 128-bit proxy for referring to a particular wallet, used to uniquely identify wallets.

This element MUST be present.  It MUST be a string following the syntactic structure as laid out in [section 3 of RFC 4122](https://tools.ietf.org/html/rfc4122#section-3).

### Name

The `name` 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 (`_`) character.

This element MUST be present.  It MUST be a string.

### Version

The `version` provided is the version of the walletstore.

This element MUST be present.  It MUST be the integer `1`.

### Type

The `type` provided is the type of wallet.  This informs mechanisms such as key generation.

This element MUST be present.  It MUST be the string `hierarchical deterministic`.

### Crypto

The `crypto` 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.

This element MUST be present.  It MUST be an object that follows the definition described in [EIP-2335](https://eips.ethereum.org/EIPS/eip-2335).

### Next Account

The `nextaccount` provided is the index to be supplied to the path `m/12381/60/&lt;index&gt;/0` when creating a new private key from the seed.  The path follows [EIP-2334](https://eips.ethereum.org/EIPS/eip-2334).

This element MUST be present if the wallet type requires it.  It MUST be a non-negative integer.

### JSON schema

The walletstore follows a similar format to that of the keystore described in [EIP-2335](https://eips.ethereum.org/EIPS/eip-2335).

```json
{
    &quot;$ref&quot;: &quot;#/definitions/Walletstore&quot;,
    &quot;definitions&quot;: {
        &quot;Walletstore&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;properties&quot;: {
                &quot;crypto&quot;: {
                    &quot;type&quot;: &quot;object&quot;,
                    &quot;properties&quot;: {
                        &quot;kdf&quot;: {
                            &quot;$ref&quot;: &quot;#/definitions/Module&quot;
                        },
                        &quot;checksum&quot;: {
                            &quot;$ref&quot;: &quot;#/definitions/Module&quot;
                        },
                        &quot;cipher&quot;: {
                            &quot;$ref&quot;: &quot;#/definitions/Module&quot;
                        }
                    }
                },
                &quot;name&quot;: {
                    &quot;type&quot;: &quot;string&quot;
                },
                &quot;nextaccount&quot;: {
                    &quot;type&quot;: &quot;integer&quot;
                },
                &quot;type&quot;: {
                    &quot;type&quot;: &quot;string&quot;
                },
                &quot;uuid&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;format&quot;: &quot;uuid&quot;
                },
                &quot;version&quot;: {
                    &quot;type&quot;: &quot;integer&quot;
                }
            },
            &quot;required&quot;: [
                &quot;name&quot;,
                &quot;type&quot;,
                &quot;uuid&quot;,
                &quot;version&quot;
                &quot;crypto&quot;
                &quot;nextaccount&quot;
            ],
            &quot;title&quot;: &quot;Walletstore&quot;
        },
        &quot;Module&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;properties&quot;: {
                &quot;function&quot;: {
                    &quot;type&quot;: &quot;string&quot;
                },
                &quot;params&quot;: {
                    &quot;type&quot;: &quot;object&quot;
                },
                &quot;message&quot;: {
                    &quot;type&quot;: &quot;string&quot;
                }
            },
            &quot;required&quot;: [
                &quot;function&quot;,
                &quot;message&quot;,
                &quot;params&quot;
            ]
        }
    }
}
```

## Rationale

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.

## Test Cases

### Test Vector

Password `&apos;testpassword&apos;`
Seed `0x147addc7ec981eb2715a22603813271cce540e0b7f577126011eb06249d9227c`

```json
{
  &quot;crypto&quot;: {
    &quot;checksum&quot;: {
      &quot;function&quot;: &quot;sha256&quot;,
      &quot;message&quot;: &quot;8bdadea203eeaf8f23c96137af176ded4b098773410634727bd81c4e8f7f1021&quot;,
      &quot;params&quot;: {}
    },
    &quot;cipher&quot;: {
      &quot;function&quot;: &quot;aes-128-ctr&quot;,
      &quot;message&quot;: &quot;7f8211b88dfb8694bac7de3fa32f5f84d0a30f15563358133cda3b287e0f3f4a&quot;,
      &quot;params&quot;: {
        &quot;iv&quot;: &quot;9476702ab99beff3e8012eff49ffb60d&quot;
      }
    },
    &quot;kdf&quot;: {
      &quot;function&quot;: &quot;pbkdf2&quot;,
      &quot;message&quot;: &quot;&quot;,
      &quot;params&quot;: {
        &quot;c&quot;: 16,
        &quot;dklen&quot;: 32,
        &quot;prf&quot;: &quot;hmac-sha256&quot;,
        &quot;salt&quot;: &quot;dd35b0c08ebb672fe18832120a55cb8098f428306bf5820f5486b514f61eb712&quot;
      }
    }
  },
  &quot;name&quot;: &quot;Test wallet 2&quot;,
  &quot;nextaccount&quot;: 0,
  &quot;type&quot;: &quot;hierarchical deterministic&quot;,
  &quot;uuid&quot;: &quot;b74559b8-ed56-4841-b25c-dba1b7c9d9d5&quot;,
  &quot;version&quot;: 1
}
```

## Implementation

A Go implementation of the hierarchical deterministic wallet can be found at [https://github.com/wealdtech/go-eth2-wallet-hd](https://github.com/wealdtech/go-eth2-wallet-hd).

## Security Considerations

The seed stored in the `crypto` 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.

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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 21 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2386</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2386</guid>
      </item>
    
      <item>
        <title>Geo-ENS</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2959</comments>
        
        <description>## Simple Summary
GeoENS brings geographic split horizon capabilities to ENS. It&apos;s GeoDNS for ENS!

## Abstract
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&apos;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 [EIP-1185](./eip-1185.md), although the technique could be
used on other interfaces like IPFS content hash storage [EIP-1062](./eip-1062.md).

## Motivation
There are many use cases for traditional GeoDNS systems, like Amazon&apos;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 [EIP-1185](./eip-1185.md))
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.

GeoENS can do more than DNS-based solutions.
In addition to geographic split horizon DNS, GeoENS can be used for the following:
 - Locating digital resources (like smart contracts) that represent physical objects in the real world.
 - Smart contract managing access to a physical object associated with a specific location.
 - ENS + IPFS web hosting (as described in [EIP-1062](./eip-1062.md)) with content translated to the native language of the query source.
 - Tokenizing objects with a physical location.

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 [GeoIP2](https://www.maxmind.com/en/geoip2-services-and-databases)
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.

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&apos;s provenance.
GeoENS does not correlate a query&apos;s provinance with a location, allowing the
entire globe to be queried from a single location.

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.

Lastly, publicly facing GeoDNS services do not give fine granularity control
over geographic regions for GeoDNS queries.
Cloud based DNS services like [Amazon&apos;s Route 53](https://aws.amazon.com/route53/)
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.

## Specification
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.

### What is a geohash?
A [Geohash](https://en.m.wikipedia.org/wiki/Geohash#Algorithm_and_example)
is an interleaving of latitude and longitude bits, whose
length determines it&apos;s precision.
Geohashes are typically encoded in base 32 characters.

### function setGeoAddr(bytes32 node, string calldata geohash, address addr) external authorised(node)
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, `address(0)`, to remove a resource from the resolver.

### function geoAddr(bytes32 node, string calldata geohash) external view returns (address[] memory ret)
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.

Any type of geohash can be used including [Z-order](https://en.wikipedia.org/wiki/Z-order_curve)
[Hilbert](https://en.wikipedia.org/wiki/Hilbert_curve) or the more accurate
[S2 Geometry](https://s2geometry.io/devguide/s2cell_hierarchy.html) library
from Google.
There are also ways to search the geographic data using geohashes without
always ending up with a rectangular query region.
[Searching circular shaped regions](https://github.com/ashwin711/proximityhash) is
slightly more complex as it requires multiple queries.

## Rationale
The proposed implementation uses a sparse [Quadtree](https://dl.acm.org/doi/10.1007/BF00288933) 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&apos;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.

## Backwards Compatibility
This EIP does not introduce issues with backwards compatibility.

## Test Cases
See https://github.com/james-choncholas/resolvers/blob/master/test/TestPublicResolver.js

## Implementation
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 `geomap` mapping.
For comparison purposes, see https://github.com/james-choncholas/geoens/tree/master/contracts/StringOwnedGeoENSResolver.sol for the inefficient string implementation.


```solidity
pragma solidity ^0.5.0;

import &quot;../ResolverBase.sol&quot;;

contract GeoENSResolver is ResolverBase {
    bytes4 constant ERC2390 = 0x8fbcc5ce;
    uint constant MAX_ADDR_RETURNS = 64;
    uint constant TREE_VISITATION_QUEUESZ = 64;
    uint8 constant ASCII_0 = 48;
    uint8 constant ASCII_9 = 57;
    uint8 constant ASCII_a = 97;
    uint8 constant ASCII_b = 98;
    uint8 constant ASCII_i = 105;
    uint8 constant ASCII_l = 108;
    uint8 constant ASCII_o = 111;
    uint8 constant ASCII_z = 122;

    struct Node {
        address data; // 0 if not leaf
        uint256 parent;
        uint256[] children; // always length 32
    }

    // A geohash is 8, base-32 characters.
    // A geomap is stored as tree of fan-out 32 (because
    // geohash is base 32) and height 8 (because geohash
    // length is 8 characters)
    mapping(bytes32=&gt;Node[]) private geomap;

    event GeoENSRecordChanged(bytes32 indexed node, bytes8 geohash, address addr);

    // only 5 bits of ret value are used
    function chartobase32(byte c) pure internal returns (uint8 b) {
        uint8 ascii = uint8(c);
        require( (ascii &gt;= ASCII_0 &amp;&amp; ascii &lt;= ASCII_9) ||
                (ascii &gt; ASCII_a &amp;&amp; ascii &lt;= ASCII_z));
        require(ascii != ASCII_a);
        require(ascii != ASCII_i);
        require(ascii != ASCII_l);
        require(ascii != ASCII_o);

        if (ascii &lt;= (ASCII_0 + 9)) {
            b = ascii - ASCII_0;

        } else {
            // base32 b = 10
            // ascii &apos;b&apos; = 0x60
            // note base32 skips the letter &apos;a&apos;
            b = ascii - ASCII_b + 10;

            // base32 also skips the following letters
            if (ascii &gt; ASCII_i)
                b --;
            if (ascii &gt; ASCII_l)
                b --;
            if (ascii &gt; ASCII_o)
                b --;
        }
        require(b &lt; 32); // base 32 can&apos;t be larger than 32
        return b;
    }

    function geoAddr(bytes32 node, bytes8 geohash, uint8 precision) external view returns (address[] memory ret) {
        bytes32(node); // single node georesolver ignores node
        assert(precision &lt;= geohash.length);

        ret = new address[](MAX_ADDR_RETURNS);
        if (geomap[node].length == 0) { return ret; }
        uint ret_i = 0;

        // walk into the geomap data structure
        uint pointer = 0; // not actual pointer but index into geomap
        for(uint8 i=0; i &lt; precision; i++) {

            uint8 c = chartobase32(geohash[i]);
            uint next = geomap[node][pointer].children[c];
            if (next == 0) {
                // nothing found for this geohash.
                // return early.
                return ret;
            } else {
                pointer = next;
            }
        }

        // pointer is now node representing the resolution of the query geohash.
        // DFS until all addresses found or ret[] is full.
        // Do not use recursion because blockchain...
        uint[] memory indexes_to_visit = new uint[](TREE_VISITATION_QUEUESZ);
        indexes_to_visit[0] = pointer;
        uint front_i = 0;
        uint back_i = 1;

        while(front_i != back_i) {
            Node memory cur_node = geomap[node][indexes_to_visit[front_i]];
            front_i ++;

            // if not a leaf node...
            if (cur_node.data == address(0)) {
                // visit all the chilins
                for(uint i=0; i&lt;cur_node.children.length; i++) {
                    // only visit valid children
                    if (cur_node.children[i] != 0) {
                        assert(back_i &lt; TREE_VISITATION_QUEUESZ);
                        indexes_to_visit[back_i] = cur_node.children[i];
                        back_i ++;

                    }
                }
            } else {
                ret[ret_i] = cur_node.data;
                ret_i ++;
                if (ret_i &gt; MAX_ADDR_RETURNS) break;
            }
        }

        return ret;
    }

    // when setting, geohash must be precise to 8 digits.
    function setGeoAddr(bytes32 node, bytes8 geohash, address addr) external authorised(node) {
        bytes32(node); // single node georesolver ignores node

        // create root node if not yet created
        if (geomap[node].length == 0) {
            geomap[node].push( Node({
                data: address(0),
                parent: 0,
                children: new uint256[](32)
            }));
        }

        // walk into the geomap data structure
        uint pointer = 0; // not actual pointer but index into geomap
        for(uint i=0; i &lt; geohash.length; i++) {

            uint8 c = chartobase32(geohash[i]);

            if (geomap[node][pointer].children[c] == 0) {
                // nothing found for this geohash.
                // we need to create a path to the leaf
                geomap[node].push( Node({
                    data: address(0),
                    parent: pointer,
                    children: new uint256[](32)
                }));
                geomap[node][pointer].children[c] = geomap[node].length - 1;
            }
            pointer = geomap[node][pointer].children[c];
        }

        Node storage cur_node = geomap[node][pointer]; // storage = get reference
        cur_node.data = addr;

        emit GeoENSRecordChanged(node, geohash, addr);
    }

    function supportsInterface(bytes4 interfaceID) public pure returns (bool) {
        return interfaceID == ERC2390 || super.supportsInterface(interfaceID);
    }
}
```

## Security Considerations
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.

Given the way most location services work, the query region is likely to contain
the user&apos;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.



## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 15 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2390</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2390</guid>
      </item>
    
      <item>
        <title>Transaction Receipt URI</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-2400-transaction-receipt-uri/</comments>
        
        <description>## Abstract

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. 

This standard includes all needed information for displaying a transaction and its details, such as `chainId`, `method` signature called, and `events` signatures emitted.

## Motivation

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.

### Use-cases 

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:

- In web3 (dapps, mining pools, exchanges), links would automatically open user&apos;s preferred transaction explorer; 
- In wallets, for users sharing transaction receipts easier; 
- In chat applications, as a reply to an [EIP-681] transaction request;
- In crypto vending machines, a QRCode can be displayed when transactions are submitted;
- Anywhere transaction receipts are presented to users.

## Specification

### Syntax

Transaction receipt URLs contain &quot;ethereum&quot; in their schema (protocol) part and are constructed as follows:

    receipt                 = schema_part transaction_hash [ &quot;@&quot; chain_id ] [ &quot;?&quot; parameters ]
    schema_part             = &quot;ethereum:tx-&quot; 
    transaction_hash        = &quot;0x&quot; 64*HEXDIG 
    chain_id                = 1*DIGIT
    parameters              = parameter *( &quot;&amp;&quot; parameter )
    parameter               = key &quot;=&quot; value
    key                     = &quot;method&quot; / &quot;events&quot;
    value                   = function_signature / event_list
    function_signature      = function_name &quot;(&quot; TYPE *( &quot;,&quot; TYPE) &quot;)&quot;
    function_name           = STRING
    event_list              = event_signature *( &quot;;&quot; event_signature )
    event_signature         = event_name &quot;(&quot; event_type *( &quot;,&quot; event_type) &quot;)&quot;
    event_name              = STRING
    event_type              = [&quot;!&quot;] TYPE


Where `TYPE` is a standard ABI type name, as defined in Ethereum Contract ABI specification. `STRING` is a URL-encoded unicode string of arbitrary length.

The exclamation symbol (`!`), in `event_type`, is used to identify indexed event parameters. 

### Semantics

`transaction_hash` is mandatory. The hash must be looked up in the corresponding `chain_id` 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).


`chain_id` is specified by [EIP-155] optional and contains the decimal chain ID, such that transactions on various test and private networks can be represented as well. If no `chain_id` is present, the $ETH/mainnet (`1`) is considered.

If `method` 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 `method`, if invalid, an equivalent error as &quot;method validation error&quot; must be shown instead of the transaction.

If `events` 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&apos;t validate events, however, when transaction is successful (or changes from pending to success) and events are present in URI, each event in the `event_list` 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. 

#### Examples

##### Simple ETH transfer: 
`ethereum:tx-0x1143b5e38fe3cf585fb026fb9b5ce35c85a691786397dc8a23a07a62796d8172@1`  

##### Standard Token transfer:

`ethereum:tx-0x5375e805b0c6afa20daab8d37352bf09a533efb03129ba56dee869e2ce4f2f92@1?method=&quot;transfer(address,uint256)&quot;&amp;events=&quot;Transfer(!address,!address,uint256)&quot;` 

##### Complex contract transaction: 

`ethereum:tx-0x4465e7cce3c784f264301bfe26fc17609855305213ec74c716c7561154b76fec@1?method=&quot;issueAndActivateBounty(address,uint256,string,uint256,address,bool,address,uint256)&quot;&amp;events=&quot;Transfer(!address,!address,uint256);BountyIssued(uint256);ContributionAdded(uint256,!address,uint256);BountyActivated(uint256,address)&quot;`  

## Rationale

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. 

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/fork). 

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&apos;s events. 

## Backwards Compatibility

Future upgrades that are partially or fully incompatible with this proposal must use a prefix other than `tx-` that is separated by a dash (-) character from whatever follows it.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

[EIP-155]: ./eip-155.md
[EIP-681]: ./eip-681.md
</description>
        <pubDate>Tue, 05 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2400</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2400</guid>
      </item>
    
      <item>
        <title>Singleton Factory</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-2470-singleton-factory/3933</comments>
        
        <description>## Simple Summary

Some DApps needs one, and only one, instance of an contract, which have the same address on any chain.

A permissionless factory for deploy of keyless deterministic contracts addresses based on its bytecode. 

## Abstract

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 [EIP-1820] and [EIP-2429]. These contracts are usually deployed using a method known as [Nick]&apos;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.    

## Motivation

Code reuse, using the factory becomes easier to deploy singletons.

## Specification

### [ERC-2470] Singleton Factory

&gt; This is an exact copy of the code of the [ERC2470 factory smart contract].

```solidity
pragma solidity 0.6.2;


/**
 * @title Singleton Factory (EIP-2470)
 * @notice Exposes CREATE2 (EIP-1014) to deploy bytecode on deterministic addresses based on initialization code and salt.
 * @author Ricardo Guilherme Schmidt (Status Research &amp; Development GmbH)
 */
contract SingletonFactory {
    /**
     * @notice Deploys `_initCode` using `_salt` for defining the deterministic address.
     * @param _initCode Initialization code.
     * @param _salt Arbitrary value to modify resulting address.
     * @return createdContract Created contract address.
     */
    function deploy(bytes memory _initCode, bytes32 _salt)
        public
        returns (address payable createdContract)
    {
        assembly {
            createdContract := create2(0, add(_initCode, 0x20), mload(_initCode), _salt)
        }
    }
}
// IV is a value changed to generate the vanity address.
// IV: 6583047
```

### Deployment Transaction

Below is the raw transaction which MUST be used to deploy the smart contract on any chain.

```
0xf9016c8085174876e8008303c4d88080b90154608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212206b44f8a82cb6b156bfcc3dc6aadd6df4eefd204bc928a4397fd15dacf6d5320564736f6c634300060200331b83247000822470
```

The strings of `2470`&apos;s at the end of the transaction are the `r` and `s` 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.

### Deployment Method

This contract is going to be deployed using the keyless deployment method---also known as [Nick]&apos;s method---which relies on a single-use address.
(See [Nick&apos;s article] for more details). This method works as follows:

1. Generate a transaction which deploys the contract from a new random account.
  - This transaction MUST NOT use [EIP-155] in order to work on any chain.
  - 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.

2. Forge a transaction with the following parameters:
    ```js
    {
        nonce: 0,
        gasPrice: 100000000000,
        value: 0,
        data: &apos;0x608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212206b44f8a82cb6b156bfcc3dc6aadd6df4eefd204bc928a4397fd15dacf6d5320564736f6c63430006020033&apos;,
        gasLimit: 247000,
        v: 27,
        r: &apos;0x247000&apos;,
        s: &apos;0x2470&apos;
    }
    ```
    &gt; The `r` and `s` values, made of starting `2470`, are obviously a human determined value, instead of a real signature.

3. We recover the sender of this transaction, i.e., the single-use deployment account.

    &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.

4. Send exactly 0.0247 ether to this single-use deployment account.

5. Broadcast the deployment transaction.

    &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. 

The resulting transaction hash is `0x803351deb6d745e91545a6a3e1c0ea3e9a6a02a1a4193b70edfcd2f40f71a01c`.

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.


### Single-use Factory Deployment Account

![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAB0UlEQVR4nO3asW1CQRBAQdpyCa6CIpxTjgujDGTJNEC2QqvjTbDx33c3P7vL79f1fzLf98dobn8/o5nuP53p/tPzm+5/AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4CMBnH6B0/23L2AbEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ8JYPsCtw+w3g9AvB+AeD8A8X4A4v0AxPsBiPcDEO8HIN4PQLwfgHg/APF+AOL9AMT7AYj3AxDvP/5ByOkApt/PvwgCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgJYDtA9w+gO0fYHsAAGB/CQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAdALYfNExnun+9H4B4PwDxfgDi/QDE+wGI9wMQ7wcg3g9AvB+AeD8A8X4A4v0AxPsBiPcDEO8HIN4/fhCy/aDidADb5wcAAGcHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO8CsH2ApwPY/j4Ah+8PAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPB6nlegoDNgrfyiAAAAAElFTkSuQmCC)

`0xBb6e024b9cFFACB947A71991E386681B1Cd1477D`

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.

&gt; To deploy the registry, 0.0247 ether MUST be sent to this account *first*.

### Factory Contract Address
![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAABn0lEQVR4nO3coRECMRRF0S2GutCUQzd4WqAMLB4qQGWYP+EecXXeZo/OcTrf35Ndbq+l7F/rmB6w+wXuvh+A+H4A4vsBiO8HIL4fgPh+AOL7AYjvByC+H4D4fgDi+wGI7wcgvh+A+H4A4vuXAUxfwPX5GG33+wMAgL0/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPgGYHrA9A+cbhoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wlgesD0+bvvXz0fgM33AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8ATB9gZoNgHgAxAMgHgDxAIgHQDwA4gEQD4B4AMQDIB4A8QCIB0A8AOId0w8caK3V/wfA5gEQD4B4AMQDIB4A8QCIB0A8AOIBEA+AeADEAyAeAPEAiAdAPADiARAPgHgAxAMgHgDxAIgHQDwA4gEQD4B4AMQDIB4A8QCItwxg+oECDT8QMT1AAAgAASAABIAAEAACQAAIAAEgAASAANAv+gDxVDRR1CVqRAAAAABJRU5ErkJggg==)

`0xce0042B868300000d44A59004Da54A005ffdcf9f`

The contract has the address above for every chain on which it is deployed.
### ABI for SingletonFactory:
```json
[
    {
        &quot;constant&quot;: false,
        &quot;inputs&quot;: [
            {
                &quot;internalType&quot;: &quot;bytes&quot;,
                &quot;name&quot;: &quot;_initCode&quot;,
                &quot;type&quot;: &quot;bytes&quot;
            },
            {
                &quot;internalType&quot;: &quot;bytes32&quot;,
                &quot;name&quot;: &quot;_salt&quot;,
                &quot;type&quot;: &quot;bytes32&quot;
            }
        ],
        &quot;name&quot;: &quot;deploy&quot;,
        &quot;outputs&quot;: [
            {
                &quot;internalType&quot;: &quot;address payable&quot;,
                &quot;name&quot;: &quot;createdContract&quot;,
                &quot;type&quot;: &quot;address&quot;
            }
        ],
        &quot;payable&quot;: false,
        &quot;stateMutability&quot;: &quot;nonpayable&quot;,
        &quot;type&quot;: &quot;function&quot;
    }
]
```

## Rationale

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 `bytes(0)` should be used.
Contracts that are constructed by the SingletonFactory MUST not use `msg.sender` 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: `address(keccak256(bytes1(0xff), 0xce0042B868300000d44A59004Da54A005ffdcf9f, _salt, keccak256(_code)) &lt;&lt; 96)` or in javascript using https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/README.md#const-generateaddress2.

## Backwards Compatibility

Does not apply as there are no past versions of Singleton Factory being used.

## Test Cases

TBD

## Implementation

https://github.com/3esmit/ERC2470

## Security Considerations

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 [EIP-1344] in constructor.
Account contracts are singletons in the point of view of each user, when wallets want to signal what chain id is intended, [EIP-1191] should be used. 
Contracts deployed on factory must not use `msg.sender` in constructor, instead use constructor parameters, otherwise the factory would end up being the controller/only owner of those. 

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

[EIP-155]: ./eip-155.md
[EIP-1191]: ./eip-1191.md
[EIP-1344]: ./eip-1344.md
[EIP-1820]: ./eip-1820.md
[EIP-2429]: https://gitlab.com/status-im/docs/EIPs/blob/secret-multisig-recovery/EIPS/eip-2429.md
[Nick&apos;s article]: https://medium.com/@weka/how-to-send-ether-to-11-440-people-187e332566b7
[Nick]: https://github.com/Arachnid/

</description>
        <pubDate>Wed, 15 Jan 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2470</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2470</guid>
      </item>
    
      <item>
        <title>Token Metadata Integrity</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2483</comments>
        
        <description>## Simple Summary

This specification defines a mechanism by which clients may verify that a fetched token metadata document has been delivered without unexpected manipulation.

This is the Web3 counterpart of the W3C Subresource Integrity (SRI) specification.

## Abstract

An interface `ERC2477` with two functions `tokenURIIntegrity` and `tokenURISchemaIntegrity` are specified for smart contracts and a narrative is provided to explain how this improves the integrity of the token metadata documents.

## Motivation

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.

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:

* ERC-721 metadata extension (`ERC721Metadata`)
* ERC-1155 metadata extension (`ERC1155Metadata_URI`)
* ERC-1046 (DRAFT) ERC-20 Metadata Extension

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&apos;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.

## Design

**Approach A:** A token contract may reference metadata by using its URL. This provides no integrity protection because  the referenced metadata and/or schema could change at any time if the hosted content is mutable. This is the world before EIP-2477: 

```
┌───────────────────────┐       ┌────────┐      ┌────────┐
│        TokenID        │──────▶│Metadata│─────▶│ Schema │
└───────────────────────┘       └────────┘      └────────┘
```

Note: according to the JSON Schema project, a metadata document referencing a schema using a URI in the `$schema` key is a known approach, but it is not standardized.

**Approach B:** 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 `tokenURIIntegrity`:

```
┌───────────────────────┐       ┌────────┐      ┌ ─ ─ ─ ─ 
│        TokenID        │──────▶│Metadata│─ ─ ─▶  Schema │
└───────────────────────┘       └────────┘      └ ─ ─ ─ ─ 
┌───────────────────────┐            ▲                    
│   tokenURIIntegrity   │════════════╝                    
└───────────────────────┘                                 
```

**Approach C:** 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 `tokenURIIntegrity` and the metadata document, additionally changing the schema requires updating the on-chain `tokenURISchemaIntegrity`:

```
┌───────────────────────┐       ┌────────┐      ┌────────┐
│        TokenID        │──────▶│Metadata│═════▶│ Schema │
└───────────────────────┘       └────────┘      └────────┘
┌───────────────────────┐            ▲                    
│   tokenURIIntegrity   │════════════╝                    
└───────────────────────┘                                 
```

**Approach D:** 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 `tokenURIIntegrity` and updating the schema document will require updating the `tokenURISchemaIntegrity`:

```
┌───────────────────────┐       ┌────────┐      ┌────────┐
│        TokenID        │──────▶│Metadata│─────▶│ Schema │
└───────────────────────┘       └────────┘      └────────┘
┌───────────────────────┐            ▲               ▲    
│   tokenURIIntegrity   │════════════╝               ║    
└───────────────────────┘                            ║    
┌───────────────────────┐                            ║    
│tokenURISchemaIntegrity│════════════════════════════╝    
└───────────────────────┘
```

**Approach E:** 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 `tokenURIIntegrity` and the metadata document, additionally changing the schema requires updating the on-chain `tokenURISchemaIntegrity`:

```
┌───────────────────────┐       ┌────────┐      ┌────────┐
│        TokenID        │──────▶│Metadata│═════▶│ Schema │
└───────────────────────┘       └────────┘      └────────┘
┌───────────────────────┐            ▲               ▲    
│   tokenURIIntegrity   │════════════╝               ║    
└───────────────────────┘                            ║    
┌───────────────────────┐                            ║    
│tokenURISchemaIntegrity│════════════════════════════╝    
└───────────────────────┘                                 
```

## Specification

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.

### Smart contracts

**Smart contracts implementing the ERC-2477 standard MUST implement the `ERC2477` interface.**

```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.7;

/// @title ERC-2477 Token Metadata Integrity
/// @dev See https://eips.ethereum.org/EIPS/eip-2477
/// @dev The ERC-165 identifier for this interface is 0x832a7e0e
interface ERC2477 /* is ERC165 */ {
    /// @notice Get the cryptographic hash of the specified tokenID&apos;s metadata
    /// @param  tokenId       Identifier for a specific token
    /// @return digest        Bytes returned from the hash algorithm, or &quot;&quot; if not available
    /// @return hashAlgorithm The name of the cryptographic hash algorithm, or &quot;&quot; if not available
    function tokenURIIntegrity(uint256 tokenId) external view returns(bytes memory digest, string memory hashAlgorithm);

    /// @notice Get the cryptographic hash for the specified tokenID&apos;s metadata schema
    /// @param  tokenId       Identifier for a specific token
    /// @return digest        Bytes returned from the hash algorithm, or &quot;&quot; if not available
    /// @return hashAlgorithm The name of the cryptographic hash algorithm, or &quot;&quot; if not available
    function tokenURISchemaIntegrity(uint256 tokenId) external view returns(bytes memory digest, string memory hashAlgorithm);
}
```

The returned cryptographic hashes correspond to the token&apos;s metadata document and that metadata document&apos;s schema, respectively.

For example, with ERC-721 `tokenURIIntegrity(21)` would correspond to `tokenURI(21)`. With ERC-1155, `tokenURIIntegrity(16)` would correspond to `uri(16)`. In both cases, `tokenURISchemaIntegrity(32)` would correspond to the schema of the document matched by `tokenURIIntegrity(32)`.

**Smart contracts implementing the ERC-2477 standard MUST implement the ERC-165 standard, including the interface identifiers above.**

Smart contracts implementing the ERC-2477 standard MAY use any hashing or content integrity scheme.

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).

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.  `&quot;@schema&quot;:...`).

### Metadata

A metadata document MAY conform to this schema to provide referential integrity to its schema document.

```json
{
  &quot;title&quot;: &quot;EIP-2477 JSON Object With Refererential Integrity to Schema&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;$schema&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;format&quot;: &quot;uri&quot;
    },
    &quot;$schemaIntegrity&quot;: {
      &quot;type&quot;: &quot;object&quot;,
      &quot;properties&quot;: {
        &quot;digest&quot;: {
          &quot;type&quot;: &quot;string&quot;
        },
        &quot;hashAlgorithm&quot;: {
          &quot;type&quot;: &quot;string&quot;
        }
      },
      &quot;required&quot;: [&quot;digest&quot;, &quot;hashAlgorithm&quot;]
    }
  },
  &quot;required&quot;: [&quot;$schema&quot;, &quot;$schemaIntegrity&quot;]
}
```

### Clients

A client implementing the ERC-2477 standard MUST support at least the `sha256` hash algorithm and MAY support other algorithms.

### Caveats

* 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 `tokenURI(uint id)` or similar function. 

## Rationale

**Function and parameter naming**

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.

**Function return tuple**

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.

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.

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.

**Function return types**

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.

The hash function name is a string. Currently there is no universal taxonomy of hash function names. SRI recognizes the names `sha256`, `sha384` and `sha512` 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&apos;s approach is easier to follow and we have adopted this here.

**Function return type — hash length**

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.

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.

The most popular hash function size above 256 bits in current use is SHA-384 as specified by NIST.

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.)

We suspect that SHA-256 and the 0xcert Asset Certification will be popular choices to secure token metadata for the foreseeable future.

**In-band signaling**

One possible way to achieve strong content integrity with the existing token standards would be to include, for example, a `?integrity=XXXXX` 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.

Other supplementary reasons are:

* For on-chain consumers of data, it is easier to parse a direct hash field than to perform string operations.

* Maybe there are some URIs which are not amenable to being modified in that way, therefore limiting the generalizability of that approach.

This design justification also applies to `tokenURISchemaIntegrity`. 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 `tokenURISchemaIntegrity` property to just provide the integrity.

## Backwards Compatibility

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.

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).

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 `tokenId` parameter.

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.

## Test Cases

Following is a token metadata document which is simultaneously compatible with ERC-721, ERC-1155 and ERC-2477 standards.

```json
{
  &quot;$schema&quot;: &quot;https://URL_TO_SCHEMA_DOCUMENT&quot;,
  &quot;name&quot;: &quot;Asset Name&quot;,
  &quot;description&quot;: &quot;Lorem ipsum...&quot;,
  &quot;image&quot;: &quot;https://s3.amazonaws.com/your-bucket/images/{id}.png&quot;
}
```

This above example shows how JSON-LD is employed to reference the schema document (`$schema`).

Following is a corresponding schema document which is accessible using the URI `&quot;https://URL_TO_SCHEMA_DOCUMENT&quot;` above.

```json
{
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Identifies the asset to which this NFT represents&quot;
    },
    &quot;description&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Describes the asset to which this NFT represents&quot;
    },
    &quot;image&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
    }
  }
}
```

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:

* `function tokenURIIntegrity(1234)`
  * `bytes digest `: `3fc58b72faff20684f1925fd379907e22e96b660`
  * `string hashAlgorithm`: `sha256`
* `function tokenURISchemaIntegrity(1234)`
  * `bytes digest `: `ddb61583d82e87502d5ee94e3f2237f864eeff72`
  * `string hashAlgorithm`: `sha256`

To avoid doubt: the previous paragraph specifies &quot;MAY&quot; have that output because other hash functions are also acceptable.

## Implementation

0xcert Framework supports ERC-2477.

## Reference

Normative standard references

1. RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https://www.ietf.org/rfc/rfc2119.txt
2. ERC-165 Standard Interface Detection. ./eip-165.md
3. ERC-721 Non-Fungible Token Standard. ./eip-721.md
4. ERC-1155 Multi Token Standard. ./eip-1155.md
5. JSON-LD. https://www.w3.org/TR/json-ld/
6. Secure Hash Standard (SHS). https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf

Other standards

1. ERC-1046 ERC-20 Metadata Extension (DRAFT). ./eip-1046.md
2. ERC-918 Mineable Token Standard (DRAFT). ./eip-918.md
3. ERC-1523 Standard for Insurance Policies as ERC-721 Non Fungible Tokens (DRAFT). ./eip-1523.md
4. W3C Subresource Integrity (SRI). https://www.w3.org/TR/SRI/
5. The &quot;data&quot; URL scheme. https://tools.ietf.org/html/rfc2397
6. Uniform Resource Identifier (URI): Generic Syntax. https://tools.ietf.org/html/rfc3986
7. CID [Specification] (DRAFT). https://github.com/multiformats/cid

Discussion

1. JSON-LD discussion of referential integrity. https://lists.w3.org/Archives/Public/public-json-ld-wg/2020Feb/0003.html
2. JSON Schema use of `$schema` key for documents. https://github.com/json-schema-org/json-schema-spec/issues/647#issuecomment-417362877

Other

1. [0xcert Framework supports ERC-2477]. https://github.com/0xcert/framework/pull/717
2. [Shattered] The first collision for full SHA-1. https://shattered.io/static/shattered.pdf
3. [320 byte file] The second SHA Collision. https://privacylog.blogspot.com/2019/12/the-second-sha-collision.html
4. [Chosen prefix] https://sha-mbles.github.io
5. Transitions: Recommendation for Transitioning the Use of Cryptographic Algorithms and Key Lengths. (Rev. 1. Superseded.) https://csrc.nist.gov/publications/detail/sp/800-131a/rev-1/archive/2015-11-06
6. Commercial National Security Algorithm (CNSA) Suite Factsheet. https://apps.nsa.gov/iaarchive/library/ia-guidance/ia-solutions-for-classified/algorithm-guidance/commercial-national-security-algorithm-suite-factsheet.cfm
7. ETSI Assigned ASN.1 Object Identifiers. https://portal.etsi.org/pnns/oidlist
8. Computer Security Objects Register. https://csrc.nist.gov/projects/computer-security-objects-register/algorithm-registration
9. The Sandbox implementation. https://github.com/pixowl/sandbox-smart-contracts/blob/7022ce38f81363b8b75a64e6457f6923d91960d6/src/Asset/ERC1155ERC721.sol

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Thu, 02 Jan 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2477</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2477</guid>
      </item>
    
      <item>
        <title>Baby Jubjub Elliptic Curve</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-2494-baby-jubjub-elliptic-curve/3968</comments>
        
        <description>## Simple Summary

This proposal defines Baby Jubjub, an elliptic curve designed to work inside zk-SNARK circuits in Ethereum.

## Abstract

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). 

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 `r`. With this curve, it is possible to generate and validate proofs of any `F_r`-arithmetic circuit. This EIP describes *Baby Jubjub*, an elliptic curve defined over the finite field `F_r` 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). 

## Motivation

A [zero knowledge proof](https://en.wikipedia.org/wiki/Zero-knowledge_proof) (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. [Non-Interactive ZKPs](https://people.csail.mit.edu/silvio/Selected%20Scientific%20Papers/Zero%20Knowledge/Noninteractive_Zero-Knowkedge.pdf) (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 [zk-SNARK](https://eprint.iacr.org/2013/279.pdf) (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 [zk-Rollup](https://github.com/barryWhiteHat/roll_up) project). 

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 `F_r`-arithmetic circuit, a circuit consisting of set of wires that carry values from the field `F_r` and connect them to addition and multiplication gates `mod r`. This type of circuits are often called zk-SNARK circuits. 

The implementation of most zk-SNARK protocols (e.g. [[Pinnochio]](https://eprint.iacr.org/2013/279.pdf) and [[Groth16]](https://eprint.iacr.org/2016/260.pdf)) 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 `r`. While it is possible to generate and validate proofs of `F_r`-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 [Pedersen Hash](https://github.com/zcash/zips/blob/master/protocol/protocol.pdf) or the [Edwards Digital Signature Algorithm](https://tools.ietf.org/html/rfc8032) (EdDSA) -- a new curve with coordinates in `F_r` is needed. To this end, we propose in this EIP *Baby Jubjub*, an elliptic curve defined over `F_r` that can be used inside any `F_r`-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.

``` 
    inputs                zk-SNARK (alt_bn128)             output
            +--------------------------------------------+
            |   +--------------------+                   |
        ---&gt;|   | EdDSA (Baby Jubjub)|                   |
            |   +--------------------+                   | 
        ---&gt;|                                            |---&gt;
            |          +-----------------------------+   |
        ---&gt;|          | Pedersen Hash (Baby Jubjub) |   |
            |          +-----------------------------+   |
            +--------------------------------------------+
```

## Specification

### Definitions
Let `F_r` be the prime finite field with `r` elements, where
```
r = 21888242871839275222246405745257275088548364400416034343698204186575808495617
``` 

Let `E` be the twisted Edwards elliptic curve defined over `F_r` described by equation
```
ax^2 + y^2 = 1 + dx^2y^2
``` 
with parameters
```
a = 168700
d = 168696
```
We call **Baby Jubjub** the curve `E(F_r)`, that is, the subgroup of `F_r`-rational points of `E`.

### Order

Baby Jubjub has order 

```
n = 21888242871839275222246405745257275088614511777268538073601725287587578984328
```

which factors in 
```
n = h x l
```
where
```
h = 8
l = 2736030358979909402780800718157159386076813972158567259200215660948447373041
```
The parameter `h` is called *cofactor* and `l` is a prime number of 251 bits.

### Generator Point

The point `G = (x,y)` with coordinates 
```
x = 995203441582195749578291179787384436505546430278305826713579947235728471134
y = 5472060717959818805561601436314318772137091100104008585924551046643952123905
```
generates all `n` points of the curve.

### Base Point

The point `B = (x,y)` with coordinates

```
x = 5299619240641551281634865583518297030282874472190772894086521144482721001553
y = 16950150798460657717958625567821834550301663161624707787222815936182638968203
```
generates the subgroup of points `P` of Baby Jubjub satisfying `l * P = O`. That is, it generates the set of points of order `l` and origin `O`.

### Arithmetic

Let `P1 = (x1, y1)` and `P2 = (x2, y2)` be two arbitrary points of Baby Jubjub. Then `P1 + P2 = (x3, y3)` is calculated in the following way:
```
x3 = (x1*y2 + y1*x2)/(1 + d*x1*x2*y1*y2)
y3 = (y1*y2 - a*x1*x2)/(1 - d*x1*x2*y1*y2)
```
Note that both addition and doubling of points can be computed using a single formula. 

## Rationale

The search for Baby Jubjub was motivated by the need for an elliptic curve that allows the implementation of elliptic-curve cryptography in `F_r`-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. 

**Form of the Curve**

Baby Jubjub is a **twisted Edwards** curve birationally equivalent to a **Montgomery** curve. The choice of this form of curve was based on the following facts: 
1. The Edwards-curve Digital Signature Scheme is based on twisted Edwards curves.
2. Twisted Edwards curves have a single complete formula for addition of points, which makes the implementation of the group law inside circuits very efficient [[Crypto08/013, Section 6]](https://eprint.iacr.org/2008/013.pdf).
3. As a twisted Edwards curve is generally birationally equivalent to a Montgomery curve [[Crypto08/13,Theorem 3.2]](https://eprint.iacr.org/2008/013.pdf), 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 [here](http://hyperelliptic.org/EFD/g1p/index.html)) for more details).

**Generation of the Curve**

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 **transparent** and **deterministic** -- 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.

The algorithm chosen for generating Baby Jubjub is based in the criteria defined in [[RFC7748, Appendix A.1]](https://tools.ietf.org/html/rfc7748) and can be found in [this github repository](https://github.com/barryWhiteHat/baby_jubjub). Essentially, the algorithm takes a prime number `p = 1 mod 4` and returns the lowest `A&gt;0` such that `A-2` is a multiple of 4 and such that the set of solutions in `F_p` of `y^2 = x^3 + Ax^2 + x` defines a Montgomery curve with cofactor 8. 

Baby Jubjub was generated by running the algorithm with the prime

`r =  21888242871839275222246405745257275088548364400416034343698204186575808495617`, 

which is the order of alt_bn128, the curve used to verify zk-SNARK proofs in Ethereum. The output of the algorithm was `A=168698`. Afterwards, the corresponding Montgomery curve was transformed into twisted Edwards form. Using SAGE libraries for curves, the order `n` of the curve and its factorization `n = 8*l` was calculated.

- **Choice of generator** : the generator point `G` is the point of order `n` with smallest positive `x`-coordinate in `F_r`. 
- **Choice of base point**: the base point `B` is chosen to be `B = 8*G`, which has order `l`. 

**Security Criteria**

It is crucial that Baby Jubjub be safe against well-known attacks. To that end, we decided that the curve should pass [SafeCurves](https://safecurves.cr.yp.to/) 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 [here](https://github.com/barryWhiteHat/baby_jubjub).


## Backwards Compatibility

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.

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 **`(x,y)`.**

### Forms of the Curve

All generators and base points are written in the form (x,y).

**Twisted Edwards Form** (standard)

- Equation: ``ax^2 + y^2 = 1 + dx^2y^2``
- Parameters: ``a = 168700, d = 168696``
- Generator point:
    ```
    (995203441582195749578291179787384436505546430278305826713579947235728471134, 5472060717959818805561601436314318772137091100104008585924551046643952123905)
    ```
- Base point:
    ```
    (5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203)
    ```

**Montgomery Form**

- Equation: ``By^2 = x^3 + A x^2 + x``
- Parameters: ``A = 168698, B = 1``
- Generator point:
    ```
    (7, 4258727773875940690362607550498304598101071202821725296872974770776423442226)
    ```
- Base point:
    ```
    (7117928050407583618111176421555214756675765419608405867398403713213306743542, 14577268218881899420966779687690205425227431577728659819975198491127179315626)
    ```

**Reduced Twisted Edwards Form**

- Equation: ``a&apos; x^2 + y^2 = 1 + d&apos; x^2y^2``
- Parameters: 
    ```
    a&apos; = -1 
    d&apos; = 12181644023421730124874158521699555681764249180949974110617291017600649128846
    ```
- Generator point: 
    ```
    (4986949742063700372957640167352107234059678269330781000560194578601267663727, 5472060717959818805561601436314318772137091100104008585924551046643952123905)
    ```
- Base point:
    ```
    (9671717474070082183213120605117400219616337014328744928644933853176787189663, 16950150798460657717958625567821834550301663161624707787222815936182638968203)
    ```

### Conversion of Points

Following formulas allow to convert points from one form of the curve to another. We will denote the coordinates

* ``(u, v)`` for points in the Montomgery form, 
* ``(x, y)`` for points in the Twisted Edwards form and 
* ``(x&apos;, y&apos;)`` for points in reduced Twisted Edwards form.

Note that in the last conversion -- from Twisted Edwards to Reduced Twisted Edwards and back -- we also use the scaling factor `f`, where:
```
f = 6360561867910373094066688120553762416144456282423235903351243436111059670888
```
In the expressions one can also use directly `-f`, where:
```
-f = 15527681003928902128179717624703512672403908117992798440346960750464748824729
```

**Montgomery --&gt; Twisted Edwards**
```
(u, v) --&gt; (x, y)

x = u/v
y = (u-1)/(u+1)
```

**Twisted Edwards --&gt; Montgomery**
```
(x, y) --&gt; (u, v)

u = (1+y)/(1-y) 
v = (1+y)/((1-y)x)
```

**Montgomery --&gt; Reduced Twisted Edwards** 
```
(u, v) --&gt; (x&apos;, y&apos;)

x&apos; = u*(-f)/v 
y&apos; = (u-1)/(u+1) 
```

**Reduced Twisted Edwards --&gt; Montgomery**
```
(x&apos;, y&apos;) --&gt; (u, v)

u = (1+y&apos;)/(1-y&apos;)
v = (-f)*(1+y&apos;)/((1-y&apos;)*x&apos;)
```

**Twisted Edwards --&gt; Reduced Twisted Edwards** 
```
(x, y) --&gt; (x&apos;, y&apos;)

x&apos; = x*(-f)
y&apos; = y
```

**Reduced Twisted Edwards --&gt; Twisted Edwards** 
```
(x&apos;, y&apos;) --&gt; (x, y)

x = x&apos;/(-f)
y = y&apos;
```
## Security Considerations

This section specifies the safety checks done on Baby Jubjub. The choices of security parameters are based on [SafeCurves criteria](https://safecurves.cr.yp.to), and supporting evidence that Baby Jubjub satisfies the following requisites can be found [here](https://github.com/barryWhiteHat/baby_jubjub).

**Curve Parameters**

Check that all parameters in the specification of the curve describe a well-defined elliptic curve over a prime finite field.

- The number `r` is prime.
- Parameters `a` and `d` define an equation that corresponds to an elliptic curve.
- The product of `h` and `l` results into the order of the curve and the `G` point is a generator.
- The number `l` is prime and the `B` point has order `l`.

**Elliptic Curve Discrete Logarithm Problem**

Check that the discrete logarithm problem remains difficult in the given curve. We checked Baby Jubjub is resistant to the following known attacks.

- *Rho method* [[Blake-Seroussi-Smart, Section V.1]](https://www.cambridge.org/core/books/elliptic-curves-in-cryptography/16A2B60636EFA7EBCC3D5A5D01F28546): we require the cost for the rho method, which takes on average around `0.886*sqrt(l)` additions, to be above `2^100`.
- *Additive and multiplicative transfers* [[Blake-Seroussi-Smart, Section V.2]](https://www.cambridge.org/core/books/elliptic-curves-in-cryptography/16A2B60636EFA7EBCC3D5A5D01F28546): we require the embedding degree to be at least `(l − 1)/100`.
- *High discriminant* [[Blake-Seroussi-Smart, Section IX.3]](https://www.cambridge.org/core/books/elliptic-curves-in-cryptography/16A2B60636EFA7EBCC3D5A5D01F28546): we require the complex-multiplication field discriminant `D` to be larger than `2^100`.

**Elliptic Curve Cryptography**

- *Ladders* [[Montgomery]](https://wstein.org/edu/Fall2001/124/misc/montgomery.pdf): check the curve supports the Montgomery ladder.
- *Twists* [[SafeCurves, twist]](https://safecurves.cr.yp.to/twist.html): check it is secure against the small-subgroup attack, invalid-curve attacks and twisted-attacks.
- *Completeness* [[SafeCurves, complete]](https://safecurves.cr.yp.to/complete.html): check if the curve has complete single-scalar and multiple-scalar formulas.
- *Indistinguishability* [[IACR2013/325]](https://eprint.iacr.org/2013/325): check availability of maps that turn elliptic-curve points indistinguishable from uniform random strings.

## Test Cases

**Test 1 (Addition)**

Consider the points ``P1 = (x1, y1)`` and ``P2 = (x2, y2)`` with the following coordinates:
```
x1 = 17777552123799933955779906779655732241715742912184938656739573121738514868268
y1 = 2626589144620713026669568689430873010625803728049924121243784502389097019475

x2 = 16540640123574156134436876038791482806971768689494387082833631921987005038935
y2 = 20819045374670962167435360035096875258406992893633759881276124905556507972311
```
Then their sum `` P1+P2 = (x3, y3)`` is equal to:
```
x3 = 7916061937171219682591368294088513039687205273691143098332585753343424131937
y3 = 14035240266687799601661095864649209771790948434046947201833777492504781204499
```

**Test 2 (Doubling)**

Consider the points ``P1 = (x1, y1)`` and ``P2 = (x2, y2)`` with the following coordinates:
```
x1 = 17777552123799933955779906779655732241715742912184938656739573121738514868268,
y1 = 2626589144620713026669568689430873010625803728049924121243784502389097019475

x2 = 17777552123799933955779906779655732241715742912184938656739573121738514868268
y2 = 2626589144620713026669568689430873010625803728049924121243784502389097019475
```
Then their sum `` P1+P2 = (x3, y3)`` is equal to:
```
x3 = 6890855772600357754907169075114257697580319025794532037257385534741338397365
y3 = 4338620300185947561074059802482547481416142213883829469920100239455078257889
```

**Test 3 (Doubling the identity)**

Consider the points ``P1 = (x1, y1)`` and ``P2 = (x2, y2)`` with the following coordinates:
```
x1 = 0
y1 = 1

x2 = 0
y2 = 1
```
Then their sum `` P1+P2 = (x3, y3)`` results in the same point:
```
x3 = 0
y3 = 1
```

**Test 4 (Curve membership)**

Point ``(0,1)`` is a point on Baby Jubjub. 

Point ``(1,0)`` is not a point on Baby Jubjub.

**Test 5 (Base point choice)**

Check that the base point `` B = (Bx, By)`` with coordinates

```
Bx = 5299619240641551281634865583518297030282874472190772894086521144482721001553
By = 16950150798460657717958625567821834550301663161624707787222815936182638968203
```
is 8 times the generator point ``G = (Gx, Gy)``, where 
``` 
Gx = 995203441582195749578291179787384436505546430278305826713579947235728471134
Gy = 5472060717959818805561601436314318772137091100104008585924551046643952123905
```
That is, check that ``B = 8 x G``.

**Test 6 (Base point order)**

Check that the base point `` B = (Bx, By)`` with coordinates

```
Bx = 5299619240641551281634865583518297030282874472190772894086521144482721001553
By = 16950150798460657717958625567821834550301663161624707787222815936182638968203
```
multiplied by `l`, where
```
l = 2736030358979909402780800718157159386076813972158567259200215660948447373041
```
results in the origin point `O = (0, 1)`. This test checks that the base point `B` has order `l`. 

## Implementation

Arithmetic of Baby Jubjub and some cryptographic primitives using the curve have already been implemented in different languages. Here are a few such implementations:

- Python: https://github.com/barryWhiteHat/baby_jubjub_ecc
- JavaScript: https://github.com/iden3/circomlib/blob/master/src/babyjub.js
- Circuit (circom): https://github.com/iden3/circomlib/blob/master/circuits/babyjub.circom
- Rust: https://github.com/arnaucube/babyjubjub-rs
- Solidity: https://github.com/yondonfu/sol-baby-jubjub
- Go: https://github.com/iden3/go-iden3-crypto/tree/master/babyjub

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 29 Jan 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2494</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2494</guid>
      </item>
    
      <item>
        <title>Multiple contenthash records for ENS</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2393</comments>
        
        <description>## Simple Summary
ENS support for multiple `contenthash` records on a single ENS name.

## Motivation
Many applications are resolving ENS names to content hosted on distributed systems. To do this, they use `contenthash` record from ENS domain to know how to resolve names and which distributed system should be used.

However, the domain can store only one `contenthash` 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 `contenthash` records to allow applications to resolve to multiple hosting systems.

## Specification
Setting and getting functions **MUST** have the same public interface as specified in EIP 1577. Additionally, they **MUST** also have new public interfaces introduced by this EIP:

* For setting a `contenthash` record, the `setContenthash` **MUST** provide additional `proto` parameter and use it to save the `contenthash`. When `proto` is not provided, it **MUST** save the record as default record.

  ```solidity
  function setContenthash(bytes32 node, bytes calldata proto, bytes calldata hash) external authorised(node);
  ```

* For getting a `contenthash` record, the `contenthash` **MUST** provide additional `proto` parameter and use it to get the `contenthash` for requested type. When `proto` is not provided, it **MUST** return the default record.

  ```solidity
  function contenthash(bytes32 node, bytes calldata proto) external view returns (bytes memory);
  ```

* Resolver that supports multiple `contenthash` records **MUST** return `true` for `supportsInterface` with interface ID `0x6de03e07`.

Applications that are using ENS `contenthash` records **SHOULD** handle them in the following way:

* If the application only supports one hosting system (like directly handling ENS from IPFS/Swarm gateways), it **SHOULD** request `contenthash` with a specific type. The contract **MUST** then return it and application **SHOULD** correctly handle it.

* If the application supports multiple hosting systems (like MetaMask), it **SHOULD** request `contenthash` without a specific type (like in EIP 1577). The contract **MUST** then return the default `contenthash` record.

## Rationale
The proposed implementation was chosen because it is simple to implement and supports all important requested features. However, it doesn&apos;t support multiple records for the same type and priority order, as they don&apos;t give much advantage and are harder to implement properly.

## Backwards Compatibility
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 `contenthash` record.

## Implementation
```solidity
contract ContentHashResolver {
    bytes4 constant private MULTI_CONTENT_HASH_INTERFACE_ID = 0x6de03e07;
    mapping(bytes32=&gt;mapping(bytes=&gt;bytes)) hashes;

    function setContenthash(bytes32 node, bytes calldata proto, bytes calldata hash) external {
        hashes[node][proto] = hash;
        emit ContenthashChanged(node, hash);
    }

    function contenthash(bytes32 node, bytes calldata proto) external view returns (bytes memory) {
        return hashes[node][proto];
    }

    function supportsInterface(bytes4 interfaceID) public pure returns(bool) {
        return interfaceID == MULTI_CONTENT_HASH_INTERFACE_ID;
    }
}
```

## Security Considerations
TBD

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 18 Feb 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2520</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2520</guid>
      </item>
    
      <item>
        <title>ENSLogin</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/discussion-ens-login/3569</comments>
        
        <description>## 1. Abstract

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 [EIP-1193](./eip-1193.md) provider that can sign transaction and messages on his behalf. This method is inspired by [Alex Van de Sande&apos;s work](https://www.youtube.com/watch?v=1LVwWknE-NQ) and [Web3Connect](https://web3connect.com). In the future, the approach described here-after should be extended to work with any blockchain.

## 2. Motivation

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.

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.

That way, ENSLogin would allow any user to connect to any Dapp with any wallet, using a simple domain as a login.

## 3. Description

### 3.1. Overview

The ENSLogin works as follow:

* Request an ENS domain from the user
* Resolve the ENS domain to retrieve (see [EIP-137](./eip-137.md))
	* An address (see [EIP-137](./eip-137.md))
	* A text entry (see [EIP-634](./eip-634.md))
* Interpret the text entry and download the file it points to
* Evaluate the content of the downloaded file
* Return the corresponding object to the Dapp

At this point, the app should process like with any web3 provider. Calling the `enable()` functions should ask the users for wallet specific credentials is needed.

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.

### 3.2. Details

* **Text entry resolution:** A pointer to the code needed to instantiate the wallet-provider is recorded using the ENS support for text entries (see [EIP-634](./eip-634.md)). The corresponding key is `enslogin` (**subject to change**). If no value is associated with the key `enslogin` at the targeted domain, we fallback to metadata store on the parent&apos;s node with the key `enslogin-default` (**subject to change**).
**Example:** for the ens domain `username.domain.eth`, the resolution would look for (in order):
	* `resolver.at(ens.owner(nodehash(&quot;username.domain.eth&quot;))).text(nodehash(&quot;username.domain.eth&quot;), &apos;enslogin&apos;)`
	* `resolver.at(ens.owner(nodehash(&quot;domain.eth&quot;))).text(nodehash(&quot;domain.eth&quot;), &apos;enslogin-default&apos;)`

* **Provider link:** Code for instantiating the wallet-provider must be pointed to in a standardized manner. **This is yet not specified.** The current approach uses a human-readable format `scheme://path` such as:

	* `ipfs://Qm12345678901234567890123456789012345678901234`
	* `https://server.com/enslogin-module-someprovider`

	And adds a suffix depending on the targeted blockchain type (see [SLIP 44](https://github.com/satoshilabs/slips/blob/master/slip-0044.md)) and language. Canonical case is a webapp using ethereum so the target would be:

	* `ipfs://Qm12345678901234567890123456789012345678901234/60/js`
	* `https://server.com/enslogin-module-someprovider/60/js`

	Note that this suffix mechanism is compatible with http/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.

* **Provider instantiation:**
	* [JAVASCRIPT/ETHEREUM] The file containing the wallet-provider&apos;s code should inject a function `global.provider: (config) =&gt; Promise&lt;web3provider&gt;` that returns a promise to a standardized provider object. For EVM blockchains, the object should follow [EIP-1193](./eip-1193.md).
	* Other blockchain types/langages should be detailed in the future.


* **Configuration object:** 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:
	* A body (common to all provider) that specify details about the targeted chain (network name / 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, ...).
	* Wallet provider-specific fields (**optional**, starting with one underscore `_`) can be added to pass additional, wallet-provider specific, parameters / debugging flags.
	* SDK specific fields (**optional**, starting with two underscores `__`) can be used to pass additional arguments.

	Minimal configuration:
	```
	{
		provider: {
			network: &apos;goerli&apos;
		}
	}
	```
	Example of advanced configuration object:
	```
	{
		provider: {
			network: &apos;goerli&apos;,
			ens:     &apos;0x112234455c3a32fd11230c42e7bccd4a84e02010&apos;
		},
		ipfs: {
			host: &apos;ipfs.infura.io&apos;,
			port: 5001,
			protocol: &apos;https&apos;
		},
		_authereum: {...},
		_portis: {...},
		_unilogin: {...},
		_torus: {...},
		__callbacks: {
			resolved: (username, addr, descr) =&gt; {
				console.log(`[CALLBACKS] resolved: ${username} ${addr} ${descr}`);
			},
			loading: (protocol, path) =&gt; {
				console.log(`[CALLBACKS] loading: ${protocol} ${path}`);
			},
			loaded: (protocol, path) =&gt; {
				console.log(`[CALLBACKS] loaded: ${protocol} ${path}`);
			}
		}
	}
	```

**TODO** *(maybe move that part to section 6.1)*:
Add [SLIP 44](https://github.com/satoshilabs/slips/blob/master/slip-0044.md) compliant blockchain description to the config for better multichain support. This will require a additional field `ENS network` to know which ethereum network to use for resolution when the targeted blockchain/network is not ethereum (could also be used for cross chain resolution on ethereum, for example xDAI login with metadata stored on mainnet)

### 3.3. Decentralization

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 / ipfs / ...) 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.

### 3.4. Incentives

We believe ENSLogin&apos;s biggest strength is the fact that it aligns the incentives of Dapp developers and wallet-providers to follow this standard.

* 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
* A Dapp that uses ENSLogin protocol, either by including the ENSLogin&apos;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.
* 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.

### 3.5. Drawbacks

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&apos;s

## 4. Prototype

**TODO**

## 5. Support by the community

### 5.1. Adoption

| Name           | Live | Module | Assigns ENS names | support by default |
| -------------- | ---- | ------ | ----------------- | ------------------ |
| Argent         | yes  | no     | yes               | no                 |
| Authereum      | yes  | yes    | yes               | no                 |
| Fortmatic      | yes  | no     | no                | no                 |
| Gnosis Safe    | yes  | yes\*  | no                | no                 |
| Ledger         | yes  | beta   | no                | no                 |
| KeepKey        | yes  | no     | no                | no                 |
| Metamask       | yes  | yes    | no                | no                 |
| Opera          | yes  | yes\*  | no                | no                 |
| Portis         | yes  | yes    | no                | no                 |
| SquareLink     | yes  | no     | no                | no                 |
| Shipl          | no   | no     | no                | no                 |
| Torus          | yes  | yes    | no                | no                 |
| Trezor         | yes  | no     | no                | no                 |
| UniLogin       | beta | beta   | yes               | no                 |

\*use the metamask module

## 6. Possible evolutions

### 6.1. Multichain support

**TODO**

## 7. FAQ

### 7.1. Can anyone connect with my login? Where are my private keys stored?

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&apos;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.

### 7.2. How do I get an ENS Login?

**TODO** (this might need a separate ERC)
</description>
        <pubDate>Wed, 19 Feb 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2525</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2525</guid>
      </item>
    
      <item>
        <title>Diamonds, Multi-Facet Proxy</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/discussion-for-eip2535-diamonds/10459/</comments>
        
        <description>## Abstract

&lt;img align=&quot;right&quot; src=&quot;../assets/eip-2535/diamond.svg&quot; width=&quot;230&quot; height=&quot;230&quot; alt=&quot;Diamonds contract structure&quot;&gt;

This proposal standardizes diamonds, which are modular smart contract systems that can be upgraded/extended after deployment, and have virtually no size limit. More technically, a **diamond** is a contract with external functions that are supplied by contracts called **facets**. Facets are separate, independent contracts that can share internal functions, libraries, and state variables.

## Motivation

There are a number of different reasons to use diamonds. Here are some of them:

1. **A single address for unlimited contract functionality.** Using a single address for contract functionality makes deployment, testing and integration with other smart contracts, software and user interfaces easier.
1. **Your contract exceeds the 24KB maximum contract size.** 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.
1. **A diamond provides a way to organize contract code and data.** 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. 
1. **A diamond provides a way to upgrade functionality.** Upgradeable diamonds can be upgraded to add/replace/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/replaced/removed while leaving other parts alone.
1. **A diamond can be immutable.** It is possible to deploy an immutable diamond or make an upgradeable diamond immutable at a later time.
1. **A diamond can reuse deployed contracts.** 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.

This standard is an improvement of [EIP-1538](./eip-1538.md). The same motivations of that standard apply to this standard.

A deployed facet can be used by any number of diamonds.

The diagram below shows two diamonds using the same two facets.

- `FacetA` is used by `Diamond1`
- `FacetA` is used by `Diamond2`
- `FacetB` is used by `Diamond1`
- `FacetB` is used by `Diamond2`

&lt;img src=&quot;../assets/eip-2535/facetreuse.png&quot; alt=&quot;Facet reuse&quot;&gt;

### Upgradeable Diamond vs. Centralized Private Database

Why have an upgradeable diamond instead of a centralized, private, mutable database?

1. Decentralized Autonomous Organizations (DAOs) and other governance systems can be used to upgrade diamonds.
1. Wide interaction and integration with the Ethereum ecosystem.
1. With open storage data and verified source code it is possible to show a provable history of trustworthiness.
1. With openness bad behavior can be spotted and reported when it happens.
1. Independent security and domain experts can review the change history of contracts and vouch for their history of trustworthiness.
1. It is possible for an upgradeable diamond to become immutable and trustless.

### Some Diamond Benefits

1. A stable contract address that provides needed functionality.
1. 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.
1. Emitting events from a single address can simplify event handling.
1. A way to add, replace and remove multiple external functions atomically (in the same transaction).
1. Fine-grained upgrades, so you can change just the parts of a diamond that need to be changed.
1. Have greater control over when and what functions exist.
1. Decentralized Autonomous Organizations (DAOs), multisig contracts and other governance systems can be used to upgrade diamonds.
1. An event that shows what functions are added, replaced and removed.
1. The ability to show all changes made to a diamond.
1. Increase trust over time by showing all changes made to a diamond.
1. A way to look at a diamond to see its current facets and functions.
1. Have an immutable, trustless diamond.
1. Solves the 24KB maximum contract size limitation. Diamonds can be any size.
1. Separate functionality can be implemented in separate facets and used together in a diamond.
1. Diamonds can be created from already deployed, existing onchain contracts.
1. 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.
1. Enables zero, partial or full diamond immutability as desired, and when desired.
1. The ability to develop and improve an application over time with an upgradeable diamond and then make it immutable and trustless if desired.
1. Develop incrementally and let your diamond grow with your application.
1. Upgrade diamonds to fix bugs, add functionality and implement new standards.
1. Organize your code with a diamond and facets.
1. Diamonds can be large (have many functions) but still be modular because they are compartmented with facets.
1. 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.
1. Save gas by converting external functions to internal functions. This done by sharing internal functions between facets.
1. Save gas by creating external functions for gas-optimized specific use cases, such as bulk transfers.
1. Diamonds are designed for tooling and user-interface software.


## Specification

### Terms

1. A **diamond** is a facade smart contract that `delegatecall`s into its facets to execute function calls. A diamond is stateful. Data is stored in the contract storage of a diamond.
1. A **facet** 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.
1. A **loupe facet** is a facet that provides introspection functions. In the diamond industry, a loupe is a magnifying glass that is used to look at diamonds.
1. An **immutable function** is an external function that cannot be replaced or removed (because it is defined directly in the diamond, or because the diamond&apos;s logic does not allow it to be modified).
1. A **mapping** for the purposes of this EIP is an association between two things and does not refer to a specific implementation.

The term **contract** is used loosely to mean a smart contract or deployed Solidity library.

When this EIP uses **function** without specifying internal or external, it means external function.

In this EIP the information that applies to external functions also applies to public functions.

### Overview

A diamond calls functions from its facets using `delegatecall`.

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.

### A Note on Implementing Interfaces

Because of the nature of diamonds, a diamond can implement an interface in one of two ways: directly (`contract Contract is Interface`), 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.

### Fallback Function

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 `delegatecall`.

A diamond&apos;s fallback function and `delegatecall` enable a diamond to execute a facet&apos;s function as if it was implemented by the diamond itself. The `msg.sender` and `msg.value` values do not change and only the diamond&apos;s storage is read and written to.

Here is an illustrative example of how a diamond&apos;s fallback function might be implemented:

```solidity
// Find facet for function that is called and execute the
// function if a facet is found and return any value.
fallback() external payable {
  // get facet from function selector
  address facet = selectorTofacet[msg.sig];
  require(facet != address(0));
  // Execute external function from facet using delegatecall and return any value.
  assembly {
    // copy function selector and any arguments
    calldatacopy(0, 0, calldatasize())
    // execute function call using the facet
    let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
    // get any return value
    returndatacopy(0, 0, returndatasize())
    // return any return value or error back to the caller
    switch result
      case 0 {revert(0, returndatasize())}
      default {return (0, returndatasize())}
  }
}
```

This diagram shows the structure of a diamond:

&lt;img src=&quot;../assets/eip-2535/DiamondDiagram.png&quot; alt=&quot;Mapping facets and storage&quot;&gt;

### Storage

A state variable or storage layout organizational pattern is needed because Solidity&apos;s builtin storage layout system doesn&apos;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 [Diamond Storage](../assets/eip-2535/storage-examples/DiamondStorage.sol) and [AppStorage](../assets/eip-2535/storage-examples/AppStorage.sol).

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.

The diagram below shows facets with their own data and data shared between them.

Notice that all data is stored in the diamond&apos;s storage, but different facets have different access to data.

In this diagram

- Only `FacetA` can access `DataA`
- Only `FacetB` can access `DataB`
- Only the diamond&apos;s own code can access `DataD`.
- `FacetA` and `FacetB` share access to `DataAB`.
- The diamond&apos;s own code, `FacetA` and `FacetB` share access to `DataABD`.

&lt;img src=&quot;../assets/eip-2535/diamondstorage1.png&quot; alt=&quot;Mapping code, data, and facets&quot;&gt;

### Solidity Libraries as Facets

Smart contracts or deployed Solidity libraries can be facets of diamonds.

Only Solidity libraries that have one or more external functions can be deployed to a blockchain and be a facet. 

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. 

Solidity library facets have a few properties that match their use as facets:
* They cannot be deleted.
* They are stateless. They do not have contract storage.
* Their syntax prevents declaring state variables outside Diamond Storage.

### Adding/Replacing/Removing Functions

#### `IDiamond` Interface

All diamonds must implement the `IDiamond` interface.

During the deployment of a diamond any immutable functions and any external functions added to the diamond must be emitted in the `DiamondCut` event.

**A `DiamondCut` event must be emitted any time external functions are added, replaced, or removed.** This applies to all upgrades, all functions changes, at any time, whether through `diamondCut` or not. 

```solidity
interface IDiamond {
    enum FacetCutAction {Add, Replace, Remove}
    // Add=0, Replace=1, Remove=2

    struct FacetCut {
        address facetAddress;
        FacetCutAction action;
        bytes4[] functionSelectors;
    }

    event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata);
}
```

The `DiamondCut` event records all function changes to a diamond.

#### `IDiamondCut` Interface

A diamond contains within it a mapping of function selectors to facet addresses. Functions are added/replaced/removed by modifying this mapping.

Diamonds should implement the `IDiamondCut` interface if after their deployment they allow modifications to their function selector mapping.

The `diamondCut` 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.

`diamondCut` is specified for the purpose of interoperability. Diamond tools, software and user-interfaces should expect and use the standard `diamondCut` function.

```solidity
interface IDiamondCut is IDiamond {
    /// @notice Add/replace/remove any number of functions and optionally execute
    ///         a function with delegatecall
    /// @param _diamondCut Contains the facet addresses and function selectors
    /// @param _init The address of the contract or facet to execute _calldata
    /// @param _calldata A function call, including function selector and arguments
    ///                  _calldata is executed with delegatecall on _init
    function diamondCut(
        FacetCut[] calldata _diamondCut,
        address _init,
        bytes calldata _calldata
    ) external;
}
```

The `_diamondCut` argument is an array of `FacetCut` structs.

Each `FacetCut` struct contains a facet address and array of function selectors that are updated in a diamond.

For each `FacetCut` struct:

 * If the `action` is `Add`, update the function selector mapping for each `functionSelectors` item to the `facetAddress`. If any of the `functionSelectors` had a mapped facet, revert instead.
 * If the `action` is `Replace`, update the function selector mapping for each `functionSelectors` item to the `facetAddress`. If any of the `functionSelectors` had a value equal to `facetAddress` or the selector was unset, revert instead.
 * If the `action` is `Remove`, remove the function selector mapping for each `functionSelectors` item. If any of the `functionSelectors` were previously unset, revert instead.

Any attempt to replace or remove an immutable function must revert.

Being intentional and explicit about adding/replacing/removing functions helps catch and prevent upgrade mistakes.

##### Executing `_calldata`

After adding/replacing/removing functions the `_calldata` argument is executed with `delegatecall` on `_init`. This execution is done to initialize data or setup or remove anything needed or no longer needed after adding, replacing and/or removing functions.

If the `_init` value is `address(0)` then `_calldata` execution is skipped. In this case `_calldata` can contain 0 bytes or custom information.

### Inspecting Facets &amp; Functions

&gt; A loupe is a small magnifying glass used to look at diamonds.

Diamonds must support inspecting facets and functions by implementing the `IDiamondLoupe` interface.

#### `IDiamondLoupe` Interface

```solidity
// A loupe is a small magnifying glass used to look at diamonds.
// These functions look at diamonds
interface IDiamondLoupe {
    struct Facet {
        address facetAddress;
        bytes4[] functionSelectors;
    }

    /// @notice Gets all facet addresses and their four byte function selectors.
    /// @return facets_ Facet
    function facets() external view returns (Facet[] memory facets_);

    /// @notice Gets all the function selectors supported by a specific facet.
    /// @param _facet The facet address.
    /// @return facetFunctionSelectors_
    function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);

    /// @notice Get all the facet addresses used by a diamond.
    /// @return facetAddresses_
    function facetAddresses() external view returns (address[] memory facetAddresses_);

    /// @notice Gets the facet that supports the given selector.
    /// @dev If facet is not found return address(0).
    /// @param _functionSelector The function selector.
    /// @return facetAddress_ The facet address.
    function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);
}
```

See a [reference implementation](#reference-implementation) to see how this can be implemented.

The loupe functions can be used in user-interface software. A user interface calls these functions to provide information about and visualize diamonds.

The loupe functions can be used in deployment functionality, upgrade functionality, testing and other software.

### Implementation Points

A diamond must implement the following:

1. A diamond contains a fallback function and zero or more immutable functions that are defined within it.
1. A diamond associates function selectors with facets.
1. 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&apos;s fallback function is executed. The fallback function finds the facet associated with the function and executes the function using `delegatecall`. 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.
1. Each time functions are added, replaced or removed a `DiamondCut` event is emitted to record it.
1. A diamond implements the DiamondLoupe interface.
1. All immutable functions must be emitted in the `DiamondCut` 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&apos;s address. Any attempt to delete or replace an immutable function must revert.

A diamond may implement the following:

1. [EIP-165](./eip-165.md)&apos;s `supportsInterface`. If a diamond has the `diamondCut` function then the interface ID used for it is `IDiamondCut.diamondCut.selector`. The interface ID used for the diamond loupe interface is `IDiamondLoupe.facets.selector ^ IDiamondLoupe.facetFunctionSelectors.selector ^ IDiamondLoupe.facetAddresses.selector ^ IDiamondLoupe.facetAddress.selector`.

The diamond address is the address that users interact with. The diamond address does not change. Only facet addresses can change by using the `diamondCut` function, or other function.

## Rationale

### Using Function Selectors

User interface software can be used to retrieve function selectors and facet addresses from a diamond in order show what functions a diamond has.

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.

### Gas Considerations

Delegating function calls does have some gas overhead. This is mitigated in several ways:

1. 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 [EIP-721](./eip-721.md) standard and implement batch transfer functions to reduce gas (and make batch transfers more convenient).
1. 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.
1. 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.
1. 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.

### Versions of Functions

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 `facetAddress` function from the `IDiamondLoupe` interface. This function takes a function selector as an argument and returns the facet address where it is implemented.

### Default Function

Solidity provides the `fallback` 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.

A default function can be implemented a number of ways and this standard does not specify how it must be implemented.

### Loupe Functions &amp; `DiamondCut` Event

To find out what functions a regular contract has it is only necessary to look at its verified source code.

The verified source code of a diamond does not include what functions it has so a different mechanism is needed.

A diamond has four standard functions called the loupe functions that are used to show what functions a diamond has.

The loupe functions can be used for many things including:
1. To show all functions used by a diamond.
1. To query services like Etherscan or files to retrieve and show all source code used by a diamond.
1. To query services like Etherscan or files to retrieve ABI information for a diamond.
1. To test or verify that a transaction that adds/replaces/removes functions on a diamond succeeded.
1. To find out what functions a diamond has before calling functions on it.
1. To be used by tools and programming libraries to deploy and upgrade diamonds.
1. To be used by user interfaces to show information about diamonds.
1. To be used by user interfaces to enable users to call functions on diamonds.

Diamonds support another form of transparency which is a historical record of all upgrades on a diamond. This is done with the `DiamondCut` event which is used to record all functions that are added, replaced or removed on a diamond. 

### Sharing Functions Between Facets

In some cases it might be necessary to call a function defined in a different facet. Here are ways to do this:

1. Copy internal function code in one facet to the other facet.
1. Put common internal functions in a contract that is inherited by multiple facets.
1. Put common internal functions in a Solidity library and use the library in facets.
1. A type safe way to call an external function defined in another facet is to do this: `MyOtherFacet(address(this)).myFunction(arg1, arg2)`
1. 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:
```solidity
DiamondStorage storage ds = diamondStorage();
bytes4 functionSelector = bytes4(keccak256(&quot;myFunction(uint256)&quot;));
// get facet address of function
address facet = ds.selectorToFacet[functionSelector];
bytes memory myFunctionCall = abi.encodeWithSelector(functionSelector, 4);
(bool success, bytes memory result) = address(facet).delegatecall(myFunctionCall);
```
6. 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.

### Facets can be Reusable and Composable

A deployed facet can be used by any number of diamonds.

Different combinations of facets can be used with different diamonds.

It is possible to create and deploy a set of facets that are reused by different diamonds over time.

The ability to use the same deployed facets for many diamonds reduces deployment costs.

It is possible to implement facets in a way that makes them usable/composable/compatible with other facets. It is also possible to implement facets in a way that makes them not usable/composable/compatible with other facets.

A function signature is the name of a function and its parameter types. Example function signature: `myfunction(uint256)`. 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.

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.

## Backwards Compatibility

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.

## Reference Implementation

All the Solidity code for a complete reference implementation has been put in a single file here: [Diamond.sol](../assets/eip-2535/reference/Diamond.sol)

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: [`EIP2535-Diamonds-Reference-Implementation.zip`](../assets/eip-2535/reference/EIP2535-Diamonds-Reference-Implementation.zip)

## Security Considerations

### Ownership and Authentication

&gt; **Note:** The design and implementation of diamond ownership/authentication is **not** part of this standard. The examples given in this standard and in the reference implementation are just **examples** of how it could be done.

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/authentication could be as simple as a single account address having the authority to add/replace/remove functions. Or a decentralized autonomous organization could have the authority to only add/replace/remove certain functions.

Consensus functionality could be implemented such as an approval function that multiple different people call to approve changes before they are executed with the `diamondCut` function. These are just examples.

The development of standards and implementations of ownership, control and authentication of diamonds is encouraged.

### Arbitrary Execution with `diamondCut`

The `diamondCut` function allows arbitrary execution with access to the diamond&apos;s storage (through `delegatecall`). Access to this function must be restricted carefully.

### Do Not Self Destruct
Use of `selfdestruct` in a facet is heavily discouraged. Misuse of it can delete a diamond or a facet.

### Function Selector Clash

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 `diamondCut` function because it prevents adding function selectors that already exist.

### Transparency

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.

Security and domain experts can review the history of change of a diamond to detect any history of foul play.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 22 Feb 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2535</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2535</guid>
      </item>
    
      <item>
        <title>ENS Wildcard Resolution</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-2544-ens-wildcard-resolution</comments>
        
        <description>## Abstract

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.

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.

Further, this specification defines a new way for resolvers to resolve names, using a unified `resolve()` method that permits more flexible handling of name resolution.

## Motivation

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.

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.

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. `CREATE2` 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.

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.

## Specification

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.

Let:
 - `namehash` be the algorithm defined in EIP 137.
 - `dnsencode` 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 &apos;.&apos;, as a single 0-octet.
 - `parent` be a function that removes the first label from a name (eg, `parent(&apos;foo.eth&apos;) = &apos;eth&apos;`). `parent(&apos;tld&apos;)` is defined as the empty string &apos;&apos;.
 - `ens` is the ENS registry contract for the current network.

EIP-2544-compliant ENS resolvers MAY implement the following function interface:

```
interface ExtendedResolver {
    function resolve(bytes calldata name, bytes calldata data) external view returns(bytes);
}
```

If a resolver implements this function, it MUST return true when `supportsInterface()` is called on it with the interface&apos;s ID, 0xTBD.

ENS clients will call `resolve` 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.

EIP-2544-compliant ENS clients MUST perform the following procedure when determining the resolver for a given name:

1. Set `currentname = name`
2. Set `resolver = ens.resolver(namehash(currentname))`
3. If `resolver` is not the zero address, halt and return `resolver`.
4. If `name` is the empty name (&apos;&apos; or &apos;.&apos;), halt and return null.
5. Otherwise, set `currentname = parent(currentname)` and go to 2.

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:

1. Set `calldata` to the ABI-encoded call data for the resolution function required - for example, the ABI encoding of `addr(namehash(name))` when resolving the `addr` record.
2. Set `supports2544 = resolver.supportsInterface(0xTBD)`.
3. If `supports2544` is true, set `result = resolver.resolve(dnsencode(name), calldata)`
4. Otherwise, set `result` to the result of calling `resolver` with `calldata`.
5. Return `result` after decoding it using the return data ABI of the corresponding resolution function (eg, for `addr()`, ABI-decode the result of `resolver.resolve()` as an `address`).

Note that in all cases the resolution function (`addr()` etc) and the `resolve` function are supplied the original `name`, *not* the `currentname` found in the first stage of resolution.

### Pseudocode
```
function getResolver(name) {
    for(let currentname = name; currentname !== &apos;&apos;; currentname = parent(currentname)) {
        const node = namehash(currentname);
        const resolver = ens.resolver(node);
        if(resolver != &apos;0x0000000000000000000000000000000000000000&apos;) {
            return resolver;
        }
    }
    return null;
}

function resolve(name, func, ...args) {
    const resolver = getResolver(name);
    if(resolver === null) {
        return null;
    }
    const supports2544 = resolver.supportsInterface(&apos;0xTBD&apos;);
    let result;
    if(supports2544) {
        const calldata = resolver[func].encodeFunctionCall(namehash(name), ...args);
        result = resolver.resolve(dnsencode(name), calldata);
        return resolver[func].decodeReturnData(result);
    } else {
        return resolver[func](...args);
    }
}
```

## Rationale

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.

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.

While introducing an optional `resolve` 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 `id.nifty.eth` to the owner of the NFT with id `id` 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 `resolve` function entirely.

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.

## Backwards Compatibility

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 `resolve` 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.

## Security Considerations

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.

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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 28 Feb 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2544</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2544</guid>
      </item>
    
      <item>
        <title>Saving and Displaying Image Onchain for Universal Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-2569-saving-and-displaying-image-onchain-for-universal-tokens/4167</comments>
        
        <description>## Abstract
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. 

The interface set has two interfaces: one to save an SVG file in Ethereum and the other to retrieve an SVG file from Ethereum. 

Typical applications include but not limited to:
* A solution for storage of a fungible token&apos;s icon.
* A solution for storage of a non-fungible token&apos;s icon.
* A solution for storage of the icon/logo of a DAO&apos;s reputation token.

## Motivation
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 [cryptokitty](https://www.cryptokitties.co/). 

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&apos;s code is saved in Ethereum permanently, the image attached to the token is not. 

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&apos;s information from Ethereum and search the centralized server for the token&apos;s associated image by using the token&apos;s information.

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.

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. 

## Specification

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. 

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.  

By calling the methods users should access an SVG image. 

* 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&apos;s ID number. For an ERC-20 token or a token implemented by a contract which doesn&apos;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.

It has the following parameter:

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&apos;s file content to a string variable of the token&apos;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&apos;s file content to a string variable of the token&apos;s contract.

* 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&apos;s ID number. For an ERC-20 token or a token implemented by a contract which doesn&apos;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&apos;s contract.

It has the following two parameters:

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&apos;s file content to a string variable of the token&apos;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&apos;s file content to a string variable of the token&apos;s contract.

imageSvg: we use a string variable to save an SVG image file&apos;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).

The procedure to save an image for a token in Ethereum is as follows:

**Step1:** define a string variable or an array of strings to hold an image or an array of images.

**Step 2:** define a function to set an (SVG) image&apos;s file content or an array of image file&apos;s contents to the string variable or the array of strings.

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&apos;s ID; 
for a token which doesn&apos;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;. 

## Rationale
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.

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&apos;s gas limit. 

However this changed a lot after the SVG(Scalable Vector Graphics) specification was developed by W3C since 1999. 

The SVG specification offers several advantages (for more details about the advantages please refer to a reference link:https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) over raster images. One of these advantages is its compact file-size.

&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;.

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.

In most ERC-721 related DAPPs they display an image for a non-fungible token. In most ERC-20 related DAPPs they don&apos;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&apos;t display an image for a token will eventually need such a function. 

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&apos;s image to an SVG image and saving it in Ethereum provides a better solution for DAPPs to access an image for a token.

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. 

## Backwards Compatibility
There are no backward compatibility issues.

## Reference Implementation
`tokenId`: a token index in an ERC-721 token or a token type/index in an ERC-1155 token. It is a uint256 variable.  

`imageSvg`: an SVG image&apos;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;.

`setTokenImageSvg`: interface to set an SVG image to a token with or without an ID number.

`getTokenImageSvg`: interface to get an SVG image for a token with or without an ID number.

We propose to add three sol files in the existing ERC-721 implementation.
Here are the details for the proposed sol files.

```solidity
// ----- IERC721GetImageSvg.sol -------------------------

pragma solidity ^0.5.0;

import &quot;@openzeppelin/contracts/token/ERC721/IERC721.sol&quot;;

/**
 * @title ERC-721 Non-Fungible Token Standard, optional retrieving SVG image extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
contract IERC721GetImageSvg is IERC721 {
    function getTokenImageSvg(uint256 tokenId) external view returns (string memory);
}


// ----- ERC721GetImageSvg.sol -------------------------

pragma solidity ^0.5.0;

import &quot;@openzeppelin/contracts/GSN/Context.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/./ERC721.sol&quot;;
import &quot;@openzeppelin/contracts/introspection/ERC165.sol&quot;;
import &quot;./IERC721GetImageSvg.sol&quot;;

contract ERC721GetImageSvg is Context, ERC165, ERC721, IERC721GetImageSvg {
    // Mapping for token Images
    mapping(uint256 =&gt; string) private _tokenImageSvgs;

    /*
     *     bytes4(keccak256(&apos;getTokenImageSvg(uint256)&apos;)) == 0x87d2f48c
     *
     *     =&gt; 0x87d2f48c == 0x87d2f48c
     */
    bytes4 private constant _INTERFACE_ID_ERC721_GET_TOKEN_IMAGE_SVG = 0x87d2f48c;

    /**
     * @dev Constructor function
     */
    constructor () public {
        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721_GET_TOKEN_IMAGE_SVG);
    }

    /**
     * @dev Returns an SVG Image for a given token ID.
     * Throws if the token ID does not exist. May return an empty string.
     * @param tokenId uint256 ID of the token to query
     */
    function getTokenImageSvg(uint256 tokenId) external view returns (string memory) {
        require(_exists(tokenId), &quot;ERC721GetImageSvg: SVG Image query for nonexistent token&quot;);
        return _tokenImageSvgs[tokenId];
    }

    /**
     * @dev Internal function to set the token SVG image for a given token.
     * Reverts if the token ID does not exist.
     * @param tokenId uint256 ID of the token to set its SVG image
     * @param imagesvg string SVG  to assign
     */
    function setTokenImageSvg(uint256 tokenId, string memory imagesvg) internal {
        require(_exists(tokenId), &quot;ERC721GetImageSvg: SVG image set of nonexistent token&quot;);
        _tokenImageSvgs[tokenId] = imagesvg;
    }

}


// ----- ERC721ImageSvgMintable.sol -------------------------

pragma solidity ^0.5.0;

import &quot;@openzeppelin/contracts/token/ERC721/ERC721Metadata.sol&quot;;
import &quot;@openzeppelin/contracts/access/roles/MinterRole.sol&quot;;
import &quot;./ERC721GetImageSvg.sol&quot;;

/**
 * @title ERC721ImageSvgMintable
 * @dev ERC721 minting logic with imagesvg.
 */
contract ERC721ImageSvgMintable is ERC721, ERC721Metadata, ERC721GetImageSvg, MinterRole {
    /**
     * @dev Function to mint tokens.
     * @param to The address that will receive the minted tokens.
     * @param tokenId The token id to mint.
     * @param tokenImageSvg The token SVG image of the minted token.
     * @return A boolean that indicates if the operation was successful.
     */
    function mintWithTokenImageSvg(address to, uint256 tokenId, string memory tokenImageSvg) public onlyMinter returns (bool) {
        _mint(to, tokenId);
        setTokenImageSvg(tokenId, tokenImageSvg);
        return true;
    }
}


We propose to add three sol files in the existing ERC-1155 implementation.
Here are the details for the proposed sol files.

// ----- IERC1155GetImageSvg.sol -------------------------

pragma solidity ^0.5.0;

import &quot;./IERC1155.sol&quot;;

/**
 * @title ERC-1155 Multi Token Standard, retrieving SVG image for a token
 * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md
 */
contract IERC1155GetImageSvg is IERC1155 {
    function getTokenImageSvg(uint256 tokenId) external view returns (string memory);
}


// ----- ERC1155GetImageSvg.sol -------------------------

pragma solidity ^0.5.0;

import &quot;./ERC1155.sol&quot;;
import &quot;./IERC1155GetImageSvg.sol&quot;;

contract ERC1155GetImageSvg is ERC165, ERC1155, IERC1155GetImageSvg {
    // Mapping for token Images
    mapping(uint256 =&gt; string) private _tokenImageSvgs;

    /*
     *     bytes4(keccak256(&apos;getTokenImageSvg(uint256)&apos;)) == 0x87d2f48c
     *
     *     =&gt; 0x87d2f48c == 0x87d2f48c
     */
    bytes4 private constant _INTERFACE_ID_ERC1155_GET_TOKEN_IMAGE_SVG = 0x87d2f48c;

    /**
     * @dev Constructor function
     */
    constructor () public {
        // register the supported interfaces to conform to ERC1155 via ERC165
        _registerInterface(_INTERFACE_ID_ERC1155_GET_TOKEN_IMAGE_SVG);
    }


    /**
     * @dev Returns an SVG Image for a given token ID.
     * Throws if the token ID does not exist. May return an empty string.
     * @param tokenId uint256 ID of the token to query
     */
    function getTokenImageSvg(uint256 tokenId) external view returns (string memory) {
        require(_exists(tokenId), &quot;ERC1155GetImageSvg: SVG Image query for nonexistent token&quot;);
        return _tokenImageSvgs[tokenId];
    }

    /**
     * @dev Internal function to set the token SVG image for a given token.
     * Reverts if the token ID does not exist.
     * @param tokenId uint256 ID of the token to set its SVG image
     * @param imagesvg string SVG  to assign
     */
    function setTokenImageSvg(uint256 tokenId, string memory imagesvg) internal {
        require(_exists(tokenId), &quot;ERC1155GetImageSvg: SVG image set of nonexistent token&quot;);
        _tokenImageSvgs[tokenId] = imagesvg;
    }

}



// ----- ERC1155MixedFungibleWithSvgMintable.sol -------------------------

pragma solidity ^0.5.0;

import &quot;./ERC1155MixedFungibleMintable.sol&quot;;
import &quot;./ERC1155GetImageSvg.sol&quot;;

/**
    @dev Mintable form of ERC1155 with SVG images
    Shows how easy it is to mint new items with SVG images
*/

contract ERC1155MixedFungibleWithSvgMintable is ERC1155, ERC1155MixedFungibleMintable, ERC1155GetImageSvg {
    /**
     * @dev Function to mint non-fungible tokens.
     * @param _to The address that will receive the minted tokens.
     * @param _type The token type to mint.
     * @param tokenImageSvg The token SVG image of the minted token.
     */
    function mintNonFungibleWithImageSvg(uint256 _type, address[] calldata _to, string memory tokenImageSvg) external creatorOnly(_type) {
        mintNonFungible(_type, _to);
        setTokenImageSvg(_type, tokenImageSvg);
    }


    /**
     * @dev Function to mint fungible tokens.
     * @param _to The address that will receive the minted tokens.
     * @param _id The token type to mint.
     * @param _quantities The number of tokens for a type to mint.
     * @param tokenImageSvg The token SVG image of the minted token.
     */
    function mintFungibleWithImageSvg(uint256 _id, address[] calldata _to, uint256[] calldata _quantities, string memory tokenImageSvg) external creatorOnly(_id) {
        mintFungible(_id, _to, _quantities, tokenImageSvg)  {
        setTokenImageSvg(_id, tokenImageSvg);
    }
}



We propose to add three sol files in the existing ERC-20 implementation.
Here are the details for the proposed sol files.


// ----- IERC20GetImageSvg.sol -------------------------

pragma solidity ^0.5.0;
import &quot;@openzeppelin/contracts/token/ERC20/IERC20.sol&quot;;

/**
 * @title ERC-20 Fungible Token Standard, retrieving SVG image for a token
 * @dev See https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
 */
contract IERC20GetImageSvg is IERC20 {
    function getTokenImageSvg() external view returns (string memory);
}


// ----- ERC20GetImageSvg.sol -------------------------

pragma solidity ^0.5.0;
import &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;
import &quot;./IERC20GetImageSvg.sol&quot;;

contract ERC20GetImageSvg is ERC20, IERC20GetImageSvg {
    string private _tokenImageSvg;
//将图片实现写在构造器中
    constructor(string calldata svgCode) public {
_tokenImageSvg = svgCode
}

    /**
     * @dev Returns an SVG Image.
     */
    function getTokenImageSvg() external view returns (string memory) {
        return _tokenImageSvg;
    }

}


```

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Sat, 28 Mar 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2569</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2569</guid>
      </item>
    
      <item>
        <title>Permit Extension for EIP-20 Signed Approvals</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2613</comments>
        
        <description>## Abstract

Arguably one of the main reasons for the success of [EIP-20](./eip-20.md) tokens lies in the interplay between `approve` and `transferFrom`, 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 `msg.sender` as the defining mechanism for token access control.

However, a limiting factor in this design stems from the fact that the EIP-20 `approve` function itself is defined in terms of `msg.sender`. This means that user&apos;s _initial action_ involving EIP-20 tokens must be performed by an EOA (_but see Note below_). If the user needs to interact with a smart contract, then they need to make 2 transactions (`approve` and the smart contract call which will internally call `transferFrom`). Even in the simple use case of paying another person, they need to hold ETH to pay for transaction gas costs.

This ERC extends the EIP-20 standard with a new function `permit`, which allows users to modify the `allowance` mapping using a signed message, instead of through `msg.sender`.

For an improved user experience, the signed data is structured following [EIP-712](./eip-712.md), which already has wide spread adoption in major RPC providers.

**_Note:_** 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 `owner` of the contract wallet from the contract wallet itself (which is meant to carry out actions on the `owner`s behalf and holds all of their funds), user interfaces need to be specifically designed to support them. The `permit` pattern reaps many of the same benefits while requiring little to no change in user interfaces.

## Motivation

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.

So far, many of these proposals have seen very little adoption, and the ones that have been adopted (such as [EIP-777](./eip-777.md)), introduce a lot of additional functionality, causing unexpected behavior in mainstream contracts.

This ERC proposes an alternative solution which is designed to be as minimal as possible and to only address _one problem_: the lack of abstraction in the EIP-20 `approve` method.

While it may be tempting to introduce `*_by_signature` counterparts for every EIP-20 function, they are intentionally left out of this EIP-20 for two reasons:

- the desired specifics of such functions, such as decision regarding fees for `transfer_by_signature`, possible batching algorithms, varies depending on the use case, and,
- they can be implemented using a combination of `permit` and additional helper contracts without loss of generality.

## Specification

Compliant contracts must implement 3 new functions in addition to EIP-20:

```sol
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external
function nonces(address owner) external view returns (uint)
function DOMAIN_SEPARATOR() external view returns (bytes32)
```

The semantics of which are as follows:

For all addresses `owner`, `spender`, uint256s `value`, `deadline` and `nonce`, uint8 `v`, bytes32 `r` and `s`,
a call to `permit(owner, spender, value, deadline, v, r, s)` will set
`allowance[owner][spender]` to `value`,
increment `nonces[owner]` by 1,
and emit a corresponding `Approval` event,
if and only if the following conditions are met:

- The current blocktime is less than or equal to `deadline`.
- `owner` is not the zero address.
- `nonces[owner]` (before the state update) is equal to `nonce`.
- `r`, `s` and `v` is a valid `secp256k1` signature from `owner` of the message:

If any of these conditions are not met, the `permit` call must revert.

```sol
keccak256(abi.encodePacked(
   hex&quot;1901&quot;,
   DOMAIN_SEPARATOR,
   keccak256(abi.encode(
            keccak256(&quot;Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)&quot;),
            owner,
            spender,
            value,
            nonce,
            deadline))
))
```

where `DOMAIN_SEPARATOR` is defined according to EIP-712. The `DOMAIN_SEPARATOR` 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 `DOMAIN_SEPARATOR` is:

```solidity
DOMAIN_SEPARATOR = keccak256(
    abi.encode(
        keccak256(&apos;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&apos;),
        keccak256(bytes(name)),
        keccak256(bytes(version)),
        chainid,
        address(this)
));
```

In other words, the message is the EIP-712 typed structure:

```js
{
  &quot;types&quot;: {
    &quot;EIP712Domain&quot;: [
      {
        &quot;name&quot;: &quot;name&quot;,
        &quot;type&quot;: &quot;string&quot;
      },
      {
        &quot;name&quot;: &quot;version&quot;,
        &quot;type&quot;: &quot;string&quot;
      },
      {
        &quot;name&quot;: &quot;chainId&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      },
      {
        &quot;name&quot;: &quot;verifyingContract&quot;,
        &quot;type&quot;: &quot;address&quot;
      }
    ],
    &quot;Permit&quot;: [
      {
        &quot;name&quot;: &quot;owner&quot;,
        &quot;type&quot;: &quot;address&quot;
      },
      {
        &quot;name&quot;: &quot;spender&quot;,
        &quot;type&quot;: &quot;address&quot;
      },
      {
        &quot;name&quot;: &quot;value&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      },
      {
        &quot;name&quot;: &quot;nonce&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      },
      {
        &quot;name&quot;: &quot;deadline&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      }
    ],
  },
  &quot;primaryType&quot;: &quot;Permit&quot;,
  &quot;domain&quot;: {
    &quot;name&quot;: erc20name,
    &quot;version&quot;: version,
    &quot;chainId&quot;: chainid,
    &quot;verifyingContract&quot;: tokenAddress
  },
  &quot;message&quot;: {
    &quot;owner&quot;: owner,
    &quot;spender&quot;: spender,
    &quot;value&quot;: value,
    &quot;nonce&quot;: nonce,
    &quot;deadline&quot;: deadline
  }
}
```

Note that nowhere in this definition we refer to `msg.sender`. The caller of the `permit` function can be any address.

## Rationale

The `permit` function is sufficient for enabling any operation involving EIP-20 tokens to be paid for using the token itself, rather than using ETH.

The `nonces` mapping is given for replay protection.

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 `Permit`s that effectively never expire.

EIP-712 typed messages are included because of its wide spread adoption in many wallet providers.

## Backwards Compatibility

There are already a couple of `permit` functions in token contracts implemented in contracts in the wild, most notably the one introduced in the `dai.sol`.

Its implementation differs slightly from the presentation here in that:

- instead of taking a `value` argument, it takes a bool `allowed`, setting approval to 0 or `uint(-1)`.
- the `deadline` argument is instead called `expiry`. This is not just a syntactic change, as it effects the contents of the signed message.

There is also an implementation in the token `Stake` (Ethereum address `0x0Ae055097C6d159879521C384F1D2123D1f195e6`) with the same ABI as `dai` but with different semantics: it lets users issue &quot;expiring approvals&quot;, that only allow `transferFrom` to occur while `expiry &gt;= block.timestamp`.

The specification presented here is in line with the implementation in Uniswap V2.

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.

## Security Considerations

Though the signer of a `Permit` may have a certain party in mind to submit their transaction, another party can always front run this transaction and call `permit` before the intended party. The end result is the same for the `Permit` signer, however.

Since the ecrecover precompile fails silently and just returns the zero address as `signer` when given malformed messages, it is important to ensure `owner != address(0)` to avoid `permit` from creating an approval to spend &quot;zombie funds&quot; belong to the zero address.

Signed `Permit` messages are censorable. The relaying party can always choose to not submit the `Permit` after having received it, withholding the option to submit it. The `deadline` parameter is one mitigation to this. If the signing party holds ETH they can also just submit the `Permit` themselves, which can render previously signed `Permit`s invalid.

The standard EIP-20 race condition for approvals (SWC-114) applies to `permit` as well.

If the `DOMAIN_SEPARATOR` contains the `chainId` 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 13 Apr 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2612</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2612</guid>
      </item>
    
      <item>
        <title>Non-Fungible Token with mortgage and rental functions</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2616</comments>
        
        <description>## Simple Summary

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.

## Abstract

This standard is an extension of ERC721. It proposes additional roles, the right of tenants to enable rentals, and the right of lien.

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:

- Virtual items (in-game assets, virtual artwork, etc.)
- Physical items (houses, automobiles, etc.)
- Intellectual property rights
- DAO membership tokens

NFT developers are also able to easily integrate ERC2615 since it is fully backwards-compatible with the ERC721 standard.

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.

## Motivation

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).

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.

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.

## Specification

This standard proposes three user roles: the **Lien Holder**, the **Owner**, and the **User**. Their rights are as follows:

- A **Lien Holder** has the right to:

  1. Transfer the **Owner** role
  2. Transfer the **User** role

- An **Owner** has the right to:

  1. Transfer the **Owner** role
  2. Transfer the **User** role

- A **User** has the right to:
  1. Transfer the **User** role

### ERC-2615 Interface

```solidity
event TransferUser(address indexed from, address indexed to, uint256 indexed itemId, address operator);
event ApprovalForUser(address indexed user, address indexed approved, uint256 itemId);
event TransferOwner(address indexed from, address indexed to, uint256 indexed itemId, address operator);
event ApprovalForOwner(address indexed owner, address indexed approved, uint256 itemId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
event LienApproval(address indexed to, uint256 indexed itemId);
event TenantRightApproval(address indexed to, uint256 indexed itemId);
event LienSet(address indexed to, uint256 indexed itemId, bool status);
event TenantRightSet(address indexed to, uint256 indexed itemId,bool status);

function balanceOfOwner(address owner) public view returns (uint256);
function balanceOfUser(address user) public view returns (uint256);
function userOf(uint256 itemId) public view returns (address);
function ownerOf(uint256 itemId) public view returns (address);

function safeTransferOwner(address from, address to, uint256 itemId) public;
function safeTransferOwner(address from, address to, uint256 itemId, bytes memory data) public;
function safeTransferUser(address from, address to, uint256 itemId) public;
function safeTransferUser(address from, address to, uint256 itemId, bytes memory data) public;

function approveForOwner(address to, uint256 itemId) public;
function getApprovedForOwner(uint256 itemId) public view returns (address);
function approveForUser(address to, uint256 itemId) public;
function getApprovedForUser(uint256 itemId) public view returns (address);
function setApprovalForAll(address operator, bool approved) public;
function isApprovedForAll(address requester, address operator) public view returns (bool);

function approveLien(address to, uint256 itemId) public;
function getApprovedLien(uint256 itemId) public view returns (address);
function setLien(uint256 itemId) public;
function getCurrentLien(uint256 itemId) public view returns (address);
function revokeLien(uint256 itemId) public;

function approveTenantRight(address to, uint256 itemId) public;
function getApprovedTenantRight(uint256 itemId) public view returns (address);
function setTenantRight(uint256 itemId) public;
function getCurrentTenantRight(uint256 itemId) public view returns (address);
function revokeTenantRight(uint256 itemId) public;
```

### ERC-2615 Receiver

```solidity
function onERCXReceived(address operator, address from, uint256 itemId, uint256 layer, bytes memory data) public returns(bytes4);
```

### ERC-2615 Extensions

Extensions here are provided to help developers build with this standard.

#### 1. ERC721 Compatible functions

This extension makes this standard compatible with ERC721. By adding the following functions, developers can take advantage of the existing tools for ERC721.

Transfer functions in this extension will transfer both the **Owner** and **User** roles when the tenant right has not been set. Conversely, when the tenant right has been set, only the **Owner** role will be transferred.

```solidity
function balanceOf(address owner) public view returns (uint256)
function ownerOf(uint256 itemId) public view returns (address)
function approve(address to, uint256 itemId) public
function getApproved(uint256 itemId) public view returns (address)
function transferFrom(address from, address to, uint256 itemId) public
function safeTransferFrom(address from, address to, uint256 itemId) public
function safeTransferFrom(address from, address to, uint256 itemId, bytes memory data) pubic
```

#### 2. Enumerable

This extension is analogous to the enumerable extension of the ERC721 standard.

```solidity
function totalNumberOfItems() public view returns (uint256);
function itemOfOwnerByIndex(address owner, uint256 index, uint256 layer)public view returns (uint256 itemId);
function itemByIndex(uint256 index) public view returns (uint256);
```

#### 3. Metadata

This extension is analogous to the metadata extension of the ERC721 standard.

```solidity
function itemURI(uint256 itemId) public view returns (string memory);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
```

## How rentals and mortgages work

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.

### Mortgage functions

The following diagram demonstrates the mortgaging functionality.

![concept image](../assets/eip-2615/mortgage-sequential.jpg &quot;mortgage&quot;)

Suppose Alice owns an NFT and wants to take out a mortgage, and Bob wants to earn interest by lending tokens to Alice.

1. Alice approves the setting of a lien for the NFT Alice owns.
2. Alice sends a loan request to the mortgage contract.
3. Bob fills the loan request and transfers tokens to the mortgage contract. The lien is then set on the NFT by the mortgage contract.
4. Alice can now withdraw the borrowed tokens from the mortgage contract.
5. Alice registers repayment (anyone can pay the repayment).
6. Bob can finish the agreement if the agreement period ends and the agreement is kept (i.e. repayment is paid without delay).
7. 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.

### Rental functions

The following diagram demonstrates the rental functionality.

![concept image](../assets/eip-2615/rental-sequential.jpg &quot;rental&quot;)

Suppose Alice owns NFTs and wants to rent out a NFT, and Bob wants to lease a NFT.

1. Alice approves the setting of a tenant-right for the NFT Alice owns.
2. Alice sends a rental listing to the rental contract.
3. 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.
4. Bob registers rent (anyone can pay the rent).
5. Alice can withdraw the rent from the rental contract.
6. Alice can finish the agreement if the agreement period has ended and the agreement is kept (i.e. rent is paid without delay).
7. 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.

## Rationale

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.

### No security lockup for rentals

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.

With this standard, security deposits are no longer needed since the standard natively supports rental and tenantship functions.

### No ownership escrow when taking out a mortgage

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.

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.

With ERC2615, it is possible to collateralize NFTs and use them at the same time.

### Easy integration

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.

### No money/token transactions within tokens

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.

## Backward compatibility

As mentioned in the specifications section, this standard can be fully ERC721 compatible by adding an extension function set.

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.

## Test Cases

When running the tests, you need to create a test network with Ganache-CLI:

```
ganache-cli -a 15  --gasLimit=0x1fffffffffffff -e 1000000000
```

And then run the tests using Truffle: 

```
truffle test -e development
```

Powered by Truffle and Openzeppelin test helper.

## Implementation

[Github Repository](https://github.com/kohshiba/ERC-X).

## Security Considerations

Since the external contract will control lien or tenant rights, flaws within the external contract directly lead to the standard&apos;s unexpected behavior.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Sat, 25 Apr 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2615</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2615</guid>
      </item>
    
      <item>
        <title>Hierarchical Deterministic Wallet for Layer-2</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/hierarchical-deterministic-wallet-for-computation-integrity-proof-cip-layer-2/4286</comments>
        
        <description>## Simple Summary
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 ([BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki), [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) and [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)) to define an efficient way to securely produce CIP L2s private keys, as well as creating domain separation between Layer-2 applications.

## Abstract
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
```
m / purpose&apos; / layer&apos; / application&apos; / eth_address_1&apos; / eth_address_2&apos; / index
```

## Motivation
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 [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki), [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) and [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki). 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.

## Specification
Starkware keys are derived with the following [BIP43](https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki)-compatible derivation path, with direct inspiration from [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki):
```
m / purpose&apos; / layer&apos; / application&apos; / eth_address_1&apos; / eth_address_2&apos; / index
```
where:
* `m` - the seed.
* `purpose` - `2645` (the number of this EIP).
* `layer` - the 31 lowest bits of sha256 on the layer name. Serve as a domain separator between different technologies. In the context of `starkex`, the value would be `579218131`.
* `application` - 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 `1393043894`.
* `eth_address_1 / eth_address_2` - the first and second 31 lowest bits of the corresponding eth_address.
* `index` - to allow multiple keys per eth_address.

As example, the expected path for address 0x0000....0000 assuming seed `m` and index 0 in the context of DeversiFi in June 2020: `m/2645&apos;/579218131&apos;/1393043894&apos;/0&apos;/0&apos;/0`

The key derivation should follow the following algorithm
```
N = 2**256
n = Layer2 curve order
path = stark derivation path
BIP32() = Official BIP-0032 derivation function on secp256k1
hash = SHA256
i = 0
root_key = BIP32(path)
while True:
	key = hash(root_key|i)
	if (key &lt; (N - (N % n))):
		return key % n
	i++
```
This algorithm has been defined to maintain efficiency on existing restricted devices.

Nota Bene: At each round, the probability for a key to be greater than (N - (N % n)) is &lt; 2^(-5).

## Rationale
This EIP specifies two aspects of keys derivation in the context of Hierarchical Wallets:
- Derivation Path
- 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.

## Backwards Compatibility
This standard complies with BIP43.

## Security Considerations
This EIP has been defined to maintain separation of keys while providing foolproof logic on key derivation.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 13 May 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2645</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2645</guid>
      </item>
    
      <item>
        <title>Revised Ethereum Smart Contract Packaging Standard (EthPM v3)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/ethpm-v3-specification-working-group/4086</comments>
        
        <description>## Simple Summary

A data format describing a smart contract software package.


## Abstract

This EIP defines a data format for *package manifest* documents,
representing a package of one or more smart contracts, optionally
including source code and any/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
[EIP-1319](./eip-1319.md), from where they can be freely accessed.

This document presents a natural language description of a formal
specification for version **3** of this format.


## Motivation

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.

-   Updates the schema for a *package manifest* to be compatible with
	the [metadata](https://solidity.readthedocs.io/en/latest/metadata.html) output for compilers.
-   Updates the `&quot;sources&quot;` object definition to support a wider range of source file types and serve as [JSON input](https://solidity.readthedocs.io/en/latest/using-the-compiler.html#compiler-input-and-output-json-description) for a compiler.
-   Moves compiler definitions to a top-level `&quot;compilers&quot;` array in order to:
	-   Simplify the links between a compiler version, sources, and the
		compiled assets.
	-   Simplify packages that use multiple compiler versions.
-   Updates key formatting from `snake_case` to `camelCase` to be
	more consistent with [JSON convention](https://google.github.io/styleguide/jsoncstyleguide.xml?showone=Property_Name_Format#Property_Name_Format).

### Guiding Principles

This specification makes the following assumptions about the document
lifecycle.

1.  Package manifests are intended to be generated programmatically by
    package management software as part of the release process.

2.  Package manifests will be consumed by package managers during tasks
    like installing package dependencies or building and deploying new
    releases.

3.  Package manifests will typically **not** be stored alongside the
    source, but rather by package registries *or* referenced by package
    registries and stored in something akin to IPFS.

4.  Package manifests can be used to verify public deployments of source 
	contracts.

### Use Cases

The following use cases were considered during the creation of this
specification.

* **owned**: 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.
* **transferable**: A package which has a single dependency.
* **standard-token**: A package which contains a reusable contract.
* **safe-math-lib**: A package which contains deployed instance of one of the package contracts.
* **piper-coin**: A package which contains a deployed instance of a reusable contract from a dependency.
* **escrow**: A package which contains a deployed instance of a local contract which is linked against a deployed instance of a local library.
* **wallet**: A package with a deployed instance of a local contract which is linked against a deployed instance of a library from a dependency.
* **wallet-with-send**: A package with a deployed instance which links against a deep dependency.
* **simple-auction**: Compiler `&quot;metadata&quot;` field output.

## Package Specification

### Conventions

#### RFC2119

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;https://www.ietf.org/rfc/rfc2119.txt&gt;


#### Prefixed vs Unprefixed

A [prefixed](#prefixed) hexadecimal value begins with `0x`.
[Unprefixed](#unprefixed) values have no prefix. Unless otherwise
specified, all hexadecimal values **should** be represented with the
`0x` prefix.

* **Prefixed**: `0xdeadbeef`
* **Unprefixed**: `deadbeef`

### Document Format

The canonical format is a single JSON object. Packages **must** conform
to the following serialization rules.

-   The document **must** be tightly packed, meaning no linebreaks or
    extra whitespace.

-   The keys in all objects **must** be sorted alphabetically.

-   Duplicate keys in the same object are invalid.

-   The document **must** use
    [UTF-8](https://en.wikipedia.org/wiki/UTF-8)
    encoding.

-   The document **must** not have a trailing newline.

-   To ensure backwards compatibility, `manifest_version` is a forbidden
    top-level key.


### Document Specification

The following fields are defined for the package. Custom fields **may**
be included. Custom fields **should** be prefixed with `x-` to prevent
name collisions with future versions of the specification.

* **See Also**: Formalized ([JSON-Schema](https://json-schema.org)) version of this specification: [package.spec.json](../assets/eip-2678/package.spec.json)
* **Jump To**: [Definitions](#object-definitions)

### EthPM Manifest Version

The `manifest` field defines the specification version that this
document conforms to.

-   Packages **must** include this field.

* **Required**: Yes
* **Key**: `manifest`
* **Type**: String
* **Allowed Values**: `ethpm/3`

### Package Name

The `name` field defines a human readable name for this package.

-   Packages **should** include this field to be released on an EthPM
    registry.

-   Package names **must** begin with a lowercase letter and be
    comprised of only the lowercase letters `a-z`, numeric characters `0-9`, and the
    dash character `-`.

-   Package names **must** not exceed 255 characters in length.

* **Required**: If `version` is included.
* **Key**: `name`
* **Type**: String
* **Format**: **must** match the regular expression `^[a-z][-a-z0-9]{0,255}$`

### Package Version

The `version` field declares the version number of this release.

-   Packages **should** include this field to be released on an EthPM
    registry.

-   This value **should** conform to the
    [semver](http://semver.org/) version numbering
    specification.

* **Required**: If `name` is included.
* **Key**: `version`
* **Type**: String

### Package Metadata

The `meta` 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 **should** be included in all Packages.

* **Required**: No
* **Key**: `meta`
* **Type**: [Package Meta Object](#the-package-meta-object)

### Sources

The `sources` field defines a source tree that **should** comprise the
full source tree necessary to recompile the contracts contained in this
release.

* **Required**: No
* **Key**: `sources`
* **Type**: Object (String: [Sources Object](#the-source-object))

### Contract Types

The `contractTypes` field hosts the [Contract
Types](#contract-type) which have been included in this release.

-   Packages **should** only include contract types that can be found in
    the source files for this package.

-   Packages **should not** include contract types from dependencies.

-   Packages **should not** include abstract contracts in the contract
    types section of a release.

* **Required**: No
* **Key**: `contractTypes`
* **Type**: Object (String: [Contract Type Object](#the-contract-type-object))
* **Format**: Keys **must** be valid [Contract Aliases](#contract-alias). &lt;br&gt; Values **must** conform to the [Contract Type Object](#the-contract-type-object) definition.

### Compilers

The `compilers` field holds the information about the compilers and
their settings that have been used to generate the various
`contractTypes` included in this release.

* **Required**: No
* **Key**: `compilers`
* **Type**: Array ([Compiler Information Object](#the-compiler-information-object))

### Deployments

The `deployments` field holds the information for the chains on which
this release has [Contract Instances](#contract-instance) as well
as the [Contract Types](#contract-type) and other deployment
details for those deployed contract instances. The set of chains defined
by the [BIP122 URI](#bip122-uri) keys for this object **must** be
unique. There cannot be two different URI keys in a deployments field
representing the same blockchain.

* **Required**: No
* **Key**: `deployments`
* **Type**: Object (String: Object(String: [Contract Instance Object](#the-contract-instance-object)))
* **Format**: Keys **must** be a valid BIP122 URI chain definition. &lt;br&gt;Values **must** be objects which conform to the following format:&lt;br&gt;- Keys **must** be valid [Contract Instance Names](#contract-instance-name)&lt;br&gt;- Values **must** be a valid [Contract Instance Object](#the-contract-instance-object)

### Build Dependencies

The `buildDependencies` field defines a key/value mapping of EthPM
packages that this project depends on.

* **Required**: No
* **Key**: `buildDependencies`
* **Type**: Object (String: String)
* **Format**: Keys **must** be valid [package names](#package-name).&lt;br&gt;Values **must** be a [Content Addressable URI](#content-addressable-uri) which resolves to a valid package that conforms the same EthPM manifest version as its parent.

### Object Definitions

Definitions for different objects used within the Package. All objects
allow custom fields to be included. Custom fields **should** be prefixed
with `x-` to prevent name collisions with future versions of the
specification.


### The *Link Reference* Object

A [Link Reference](#link-reference) object has the following
key/value pairs. All link references are assumed to be associated with
some corresponding [Bytecode](#bytecode).

#### Offsets: `offsets`

The `offsets` 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.

* **Required**: Yes
* **Type**: Array

#### Length: `length`

The `length` 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.

* **Required**: Yes
* **Type**: Integer

#### Name: `name`

The `name` field is a string which **must** be a valid
[Identifier](#identifier). Any link references which **should** be
linked with the same link value **should** be given the same name.

* **Required**: No
* **Type**: String
* **Format**: **must** conform to the [Identifier](#identifier) format.

### The *Link Value* Object

Describes a single [Link Value](#link-value).

A **Link Value object** is defined to have the following key/value
pairs.


#### Offsets: `offsets`

The `offsets` field defines the locations within the corresponding
bytecode where the `value` for this link value was written. These
locations are 0-indexed from the beginning of the bytes representation
of the corresponding bytecode.

* **Required**: Yes
* **Type**: Integer
* **Format**: See below.

Format

Array of integers, where each integer **must** conform to all of the
following.

-   greater than or equal to zero

-   strictly less than the length of the unprefixed hexadecimal
    representation of the corresponding bytecode.

#### Type: `type`

The `type` field defines the `value` type for determining what is
encoded when [linking](#linking) the corresponding bytecode.

* **Required**: Yes
* **Type**: String
* **Allowed Values**: `&quot;literal&quot;` for bytecode literals.&lt;br&gt;`&quot;reference&quot;` for named references to a particular [Contract Instance](#contract-instance)

#### Value: `value`

The `value` field defines the value which should be written when [linking](#linking) the corresponding bytecode.

* **Required**: Yes
* **Type**: String
* **Format**: Determined based on `type`, see below.

Format

For static value *literals* (e.g. address), value **must** be a 0x-prefixed
hexadecimal string representing bytes.


To reference the address of a [Contract
Instance](#contract-instance) from the current package the value
should be the name of that contract instance.

-   This value **must** be a valid [Contract Instance
    Name](#contract-instance-name).

-   The chain definition under which the contract instance that this
    link value belongs to must contain this value within its keys.

-   This value **may not** reference the same contract instance that
    this link value belongs to.

To reference a contract instance from a [Package](#package) from
somewhere within the dependency tree the value is constructed as
follows.

-   Let `[p1, p2, .. pn]` define a path down the dependency tree.

-   Each of `p1, p2, pn` **must** be valid package names.

-   `p1` **must** be present in keys of the `buildDependencies` for the
    current package.

-   For every `pn` where `n &gt; 1`, `pn` **must** be present in the keys
    of the `buildDependencies` of the package for `pn-1`.

-   The value is represented by the string
    `&lt;p1&gt;:&lt;p2&gt;:&lt;...&gt;:&lt;pn&gt;:&lt;contract-instance&gt;` where all of `&lt;p1&gt;`,
    `&lt;p2&gt;`, `&lt;pn&gt;` are valid package names and `&lt;contract-instance&gt;` is
    a valid [Contract Name](#contract-name).

-   The `&lt;contract-instance&gt;` value **must** be a valid [Contract
    Instance Name](#contract-instance-name).

-   Within the package of the dependency defined by `&lt;pn&gt;`, all of the
    following must be satisfiable:

    -   There **must** be *exactly* one chain defined under the
        `deployments` key which matches the chain definition that this
        link value is nested under.

    -   The `&lt;contract-instance&gt;` value **must** be present in the keys
        of the matching chain.
  
### The *Bytecode* Object

A bytecode object has the following key/value pairs.

#### Bytecode: `bytecode`

The `bytecode` field is a string containing the `0x` prefixed
hexadecimal representation of the bytecode.

* **Required**: Yes
* **Type**:  String
* **Format**: `0x` prefixed hexadecimal.

#### Link References: `linkReferences`

The `linkReferences` field defines the locations in the corresponding
bytecode which require [linking](#linking).

* **Required**: No
* **Type**:  Array
* **Format**: All values **must** be valid [Link Reference objects](#the-link-reference-object). See also below.

Format

This field is considered invalid if *any* of the [Link
References](#link-reference) are invalid when applied to the
corresponding `bytecode` field, *or* if any of the link references
intersect.

Intersection is defined as two link references which overlap.

#### Link Dependencies: `linkDependencies`

The `linkDependencies` defines the [Link Values](#link-value) that
have been used to link the corresponding bytecode.

* **Required**: No
* **Type**:  Array
* **Format**: All values **must** be valid [Link Value objects](#the-link-value-object). See also below.

Format

Validation of this field includes the following:

-   Two link value objects **must not** contain any of the same values
    for `offsets`.

-   Each [link value object](#the-link-value-object) **must** have a
    corresponding [link reference object](#the-link-reference-object) under
    the `linkReferences` field.

-   The length of the resolved `value` **must** be equal to the `length`
    of the corresponding [Link Reference](#link-reference).


### The *Package Meta* Object

The *Package Meta* object is defined to have the following key/value
pairs.

#### Authors

The `authors` field defines a list of human readable names for the
authors of this package. Packages **may** include this field.

* **Required**: No
* **Key**: `authors`
* **Type**:  Array(String)

#### License

The `license` field declares the license associated with this package.
This value **should** conform to the
[SPDX](https://spdx.org/licenses/)
format. Packages **should** include this field. If a file [Source
Object](#the-source-object) defines its own license, that license takes
precedence for that particular file over this package-scoped `meta`
license.

* **Required**: No
* **Key**: `license`
* **Type**:  String

#### Description

The `description` field provides additional detail that may be relevant
for the package. Packages **may** include this field.

* **Required**: No
* **Key**: `description`
* **Type**:  String

#### Keywords

The `keywords` field provides relevant keywords related to this package.

* **Required**: No
* **Key**: `keywords`
* **Type**:  Array(String)

#### Links

The `links` field provides URIs to relevant resources associated with
this package. When possible, authors **should** use the following keys
for the following common resources.

-   `website`: Primary website for the package.

-   `documentation`: Package Documentation

-   `repository`: Location of the project source code.

* **Required**: No
* **Key**: `links`
* **Type**:  Object (String: String)

### The *Sources* Object

A *Sources* object is defined to have the following fields.

* **Key**: A unique identifier for the source file. (String)
* **Value**: [Source Object](#the-source-object)

### The *Source* Object

#### Checksum: `checksum`

Hash of the source file.

* **Required**: Only **if** the `content` field is missing and none of the provided URLs contain a content hash.
* **Key**: `checksum`
* **Value**: [Checksum Object](#the-checksum-object)

#### URLS: `urls`

Array of urls that resolve to the same source file.  
-   Urls **should** be stored on a content-addressable filesystem.
    **If** they are not, then either `content` or `checksum` **must** be
    included.

-   Urls **must** be prefixed with a scheme.

-   If the resulting document is a directory the key **should** be
    interpreted as a directory path.

-   If the resulting document is a file the key **should** be
    interpreted as a file path.

* **Required**: If `content` is not included.
* **Key**: `urls`
* **Value**: Array(String)

#### Content: `content`

Inlined contract source. If both `urls` and `content` are provided, the `content` value
**must** match the content of the files identified in `urls`.

* **Required**: If `urls` is not included.
* **Key**: `content`
* **Value**: String

#### Install Path: `installPath`

Filesystem path of source file.  
-   **Must** be a relative filesystem path that begins with a `./`.

-   **Must** resolve to a path that is within the current virtual
    working directory.

-   **Must** be unique across all included sources.

-   **Must not** contain `../` to avoid accessing files outside of 
	the source folder in improper implementations.

* **Required**: This field **must** be included for the package to be writable to disk.
* **Key**: `installPath`
* **Value**: String

#### Type: `type`

The `type` field declares the type of the source file. The field
**should** be one of the following values: `solidity`, `vyper`,
`abi-json`, `solidity-ast-json`.

* **Required**: No
* **Key**: `type`
* **Value**: String

#### License: `license`

The `license` field declares the type of license associated with
this source file. When defined, this license overrides the
package-scoped [meta license](#license).

* **Required**: No
* **Key**: `license`
* **Value**: String

### The *Checksum* Object

A *Checksum* object is defined to have the following key/value pairs.

#### Algorithm: `algorithm`

The `algorithm` used to generate the corresponding hash. Possible 
algorithms include, but are not limited to `sha3`, `sha256`, `md5`,
`keccak256`.

* **Required**: Yes
* **Type**:  String

#### Hash: `hash`

The `hash` of a source files contents generated with the corresponding
algorithm.

* **Required**: Yes
* **Type**:  String

### The *Contract Type* Object

A *Contract Type* object is defined to have the following key/value
pairs.

#### Contract Name: `contractName`

The `contractName` field defines the [Contract
Name](#contract-name) for this [Contract
Type](#contract-type).

* **Required**: If the [Contract Name](#contract-name) and [Contract Alias](#contract-alias) are not the same.
* **Type**:  String
* **Format**: **Must** be a valid [Contract Name](#contract-name)

#### Source ID: `sourceId`

The global source identifier for the source file from which this
contract type was generated.

* **Required**: No
* **Type**:  String
* **Format**: **Must** match a unique source ID included in the [Sources Object](#the-sources-object) for this package.

#### Deployment Bytecode: `deploymentBytecode`

The `deploymentBytecode` field defines the bytecode for this [Contract
Type](#contract-type).

* **Required**: No
* **Type**:  Object
* **Format**: **Must** conform to the [Bytecode object](#the-bytecode-object) format.

#### Runtime Bytecode: `runtimeBytecode`

The `runtimeBytecode` field defines the unlinked `0x`-prefixed runtime
portion of [Bytecode](#bytecode) for this [Contract
Type](#contract-type).

* **Required**: No
* **Type**:  Object
* **Format**: **Must** conform to the [Bytecode object](#the-bytecode-object) format.

#### ABI: `abi`

* **Required**: No
* **Type**:  Array
* **Format**: **Must** conform to the [Ethereum Contract ABI JSON](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#json) format.

#### UserDoc: `userdoc`

* **Required**: No
* **Type**:  Object
* **Format**: **Must** conform to the [UserDoc](https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format#user-documentation) format.

#### DevDoc: `devdoc`

* **Required**: No
* **Type**:  Object
* **Format**: **Must** conform to the [DevDoc](https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format#developer-documentation) format.

### The *Contract Instance* Object

A **Contract Instance Object** represents a single deployed [Contract
Instance](#contract-instance) and is defined to have the following
key/value pairs.

#### Contract Type: `contractType`

The `contractType` field defines the [Contract
Type](#contract-type) for this [Contract
Instance](#contract-instance). This can reference any of the
contract types included in this [Package](#package) *or* any of the
contract types found in any of the package dependencies from the
`buildDependencies` section of the [Package
Manifest](#package-manifest).

* **Required**: Yes
* **Type**:  String
* **Format**: See below.

Format

Values for this field **must** conform to *one of* the two formats
herein.

To reference a contract type from this Package, use the format
`&lt;contract-alias&gt;`.

-   The `&lt;contract-alias&gt;` value **must** be a valid [Contract
    Alias](#contract-alias).

-   The value **must** be present in the keys of the `contractTypes`
    section of this Package.

To reference a contract type from a dependency, use the format
`&lt;package-name&gt;:&lt;contract-alias&gt;`.

-   The `&lt;package-name&gt;` value **must** be present in the keys of the
    `buildDependencies` of this Package.

-   The `&lt;contract-alias&gt;` value **must** be be a valid [Contract
    Alias](#contract-alias).

-   The resolved package for `&lt;package-name&gt;` must contain the
    `&lt;contract-alias&gt;` value in the keys of the `contractTypes` section.

#### Address: `address`

The `address` field defines the [Address](#address) of the
[Contract Instance](#contract-instance).

* **Required**: Yes
* **Type**:  String
* **Format**: Hex encoded `0x` prefixed Ethereum address matching the regular expression `^0x[0-9a-fA-F]{40}$`.

#### Transaction: `transaction`

The `transaction` field defines the transaction hash in which this
[Contract Instance](#contract-instance) was created.

* **Required**: No
* **Type**:  String
* **Format**: `0x` prefixed hex encoded transaction hash.

#### Block: `block`

The `block` field defines the block hash in which this the transaction
which created this *contract instance* was mined.

* **Required**: No
* **Type**:  String
* **Format**: `0x` prefixed hex encoded block hash.

#### Runtime Bytecode: `runtimeBytecode`

The `runtimeBytecode` field defines the runtime portion of bytecode for
this [Contract Instance](#contract-instance). When present, the
value from this field supersedes the `runtimeBytecode` from the
[Contract Type](#contract-type) for this [Contract
Instance](#contract-instance).

* **Required**: No
* **Type**:  Object
* **Format**: **Must** conform to the [Bytecode Object](#the-bytecode-object) format.

Every entry in the `linkReferences` for this bytecode **must** have a
corresponding entry in the `linkDependencies` section.

### The *Compiler Information* Object

The `compilers` field defines the various compilers and settings used
during compilation of any [Contract Types](#contract-type) or
[Contract Instance](#contract-instance) included in this package.

A *Compiler Information* object is defined to have the following
key/value pairs.

#### Name: `name`

The `name` field defines which compiler was used in compilation.

* **Required**: Yes
* **Key**: `name`
* **Type**:  String

#### Version: `version`

The `version` field defines the version of the compiler. The field
**should** be OS agnostic (OS not included in the string) and take the
form of either the stable version in
[semver](http://semver.org/) format or if built on a
nightly should be denoted in the form of `&lt;semver&gt;-&lt;commit-hash&gt;` ex:
`0.4.8-commit.60cc1668`.

* **Required**: Yes
* **Key**: `version`
* **Type**:  String

#### Settings: `settings`

The `settings` field defines any settings or configuration that was used
in compilation. For the `&quot;solc&quot;` compiler, this **should** conform to
the [Compiler Input and Output
Description](http://solidity.readthedocs.io/en/latest/using-the-compiler.html#compiler-input-and-output-json-description).

* **Required**: No
* **Key**: `settings`
* **Type**:  Object

#### Contract Types: `contractTypes`

A list of the [Contract Alias](#contract-alias) or [Contract Types](#contract-type) in this package
that used this compiler to generate its outputs.

-   All `contractTypes` that locally declare `runtimeBytecode`
    **should** be attributed for by a compiler object.

-   A single `contractTypes` **must** not be attributed to more than one
    compiler.

* **Required**: No
* **Key**: `contractTypes`
* **Type**:  Array([Contract Alias](#contract-alias))


### BIP122 URI

BIP122 URIs are used to define a blockchain via a subset of the
[BIP-122](https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki)
spec.

    blockchain://&lt;genesis_hash&gt;/block/&lt;latest confirmed block hash&gt;

The `&lt;genesis hash&gt;` represents the blockhash of the first block on the
chain, and `&lt;latest confirmed block hash&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).

### Glossary

The terms in this glossary have been updated to reflect the changes made
in V3.

#### ABI  
The JSON representation of the application binary interface. See the
official
[specification](https://solidity.readthedocs.io/en/develop/abi-spec.html)
for more information.

#### Address  
A public identifier for an account on a particular chain

#### Bytecode  
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 [prefixed](#prefixed) with `0x`.

Bytecode can either be linked or unlinked. (see
[Linking](#linking))

* **Unlinked Bytecode**: The hexadecimal representation of a contract’s EVM instructions that contains sections of code that requires [linking](#linking) for the contract to be functional.&lt;br&gt;The sections of code which are unlinked **must** be filled in with zero bytes.&lt;br&gt;**Example**: `0x606060405260e06000730000000000000000000000000000000000000000634d536f`
* **Linked Bytecode**: The hexadecimal representation of a contract’s EVM instructions which has had all [Link References](#link-reference) replaced with the desired [Link Values](#link-value). **Example**: `0x606060405260e06000736fe36000604051602001526040518160e060020a634d536f`

#### Chain Definition  
This definition originates from [BIP122
URI](https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki).

A URI in the format `blockchain://&lt;chain_id&gt;/block/&lt;block_hash&gt;`

-   `chain_id` is the unprefixed hexadecimal representation of the
    genesis hash for the chain.

-   `block_hash` is the unprefixed hexadecimal representation of the
    hash of a block on the chain.

A chain is considered to match a chain definition if the genesis
block hash matches the `chain_id` and the block defined by `block_hash`
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

#### Content Addressable URI  
Any URI which contains a cryptographic hash which can be used to verify
the integrity of the content found at the URI.

The URI format is defined in RFC3986

It is **recommended** that tools support IPFS and Swarm.

#### Contract Alias  
This is a name used to reference a specific [Contract
Type](#contract-type). Contract aliases **must** be unique within a
single [Package](#package).

The contract alias **must** use *one of* the following naming schemes:

-   `&lt;contract-name&gt;`

-   `&lt;contract-name&gt;&lt;identifier&gt;`

The `&lt;contract-name&gt;` portion **must** be the same as the [Contract
Name](#contract-name) for this contract type.

The `&lt;identifier&gt;` portion **must** match the regular expression
`^[-a-zA-Z0-9]{1,256}$`.

#### Contract Instance  
A contract instance a specific deployed version of a [Contract
Type](#contract-type).

All contract instances have an [Address](#address) on some specific
chain.

#### Contract Instance Name  
A name which refers to a specific [Contract
Instance](#contract-instance) on a specific chain from the
deployments of a single [Package](#package). This name **must** be
unique across all other contract instances for the given chain. The name
must conform to the regular expression
`^[a-zA-Z_$][a-zA-Z0-9_$]{0,255}$`

In cases where there is a single deployed instance of a given [Contract
Type](#contract-type), package managers **should** use the
[Contract Alias](#contract-alias) for that contract type for this
name.

In cases where there are multiple deployed instances of a given contract
type, package managers **should** use a name which provides some added
semantic information as to help differentiate the two deployed instances
in a meaningful way.

#### Contract Name  
The name found in the source code that defines a specific [Contract
Type](#contract-type). These names **must** conform to the regular
expression `^[a-zA-Z_$][a-zA-Z0-9_$]{0,255}$`.

There can be multiple contracts with the same contract name in a
projects source files.

#### Contract Type  
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.

Example:

    contract Wallet {
        ...
    }

A deployed instance of the `Wallet` contract would be of of type
`Wallet`.

#### Identifier  
Refers generally to a named entity in the [Package](#package).

A string matching the regular expression
`^[a-zA-Z][-_a-zA-Z0-9]{0,255}$`

#### Link Reference  
A location within a contract’s bytecode which needs to be linked. A link
reference has the following properties.

* **`offset`**: Defines the location within the bytecode where the link reference begins.
* **`length`**: Defines the length of the reference.
* **`name`**: (optional) A string to identify the reference.

#### Link Value  
A link value is the value which can be inserted in place of a [Link
Reference](#link-reference)

#### Linking  
The act of replacing [Link References](#link-reference) with [Link
Values](#link-value) within some [Bytecode](#bytecode).

#### Package  
Distribution of an application’s source or compiled bytecode along with
metadata related to authorship, license, versioning, et al.

For brevity, the term **Package** is often used metonymously to mean
[Package Manifest](#package-manifest).

#### Package Manifest  
A machine-readable description of a package.

#### Prefixed  
[Bytecode](#bytecode) string with leading `0x`.

* **Example**: `0xdeadbeef`

#### Unprefixed  
Not [Prefixed](#prefixed).

* **Example**: `deadbeef`

## Rationale

### Minification

EthPM packages are distributed as alphabetically-ordered &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.

### Package Names

Package names are restricted to lower-case characters, numbers, and `-` 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. `O` and `0`).

### BIP122

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.

### Compilers

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 `contractTypes` share the same compiler type.

## Backwards Compatibility

To improve understanding and readability of the EthPM spec, the
`manifest_version` field was updated to `manifest` in v3. To ensure 
backwards compatibility, v3 packages **must** define a top-level
`&quot;manifest&quot;` with a value of `&quot;ethpm/3&quot;`. Additionally,
`&quot;manifest_version&quot;` is a forbidden top-level key in v3 packages.


## Security Considerations

Using EthPM packages implicitly requires importing &amp;/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.


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 26 May 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2678</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2678</guid>
      </item>
    
      <item>
        <title>Ethereum 2 wallet layout</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-2680-ethereum-2-wallet-layout/4323</comments>
        
        <description>## Simple Summary

A standard layout and naming format for walletstore and keystore for both hierarchical (e.g. filesystem, Amazon S3) and non-hierarchical (key/value) storage systems.

## Abstract

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.

## Motivation

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.

## Specification

There are four elements for a wallet that need to be addressed.  These are defined below.

### Base location
The base location is required to be well-known, either pre-defined or defined by the storage system&apos;s connection parameters.

For filesystems the pre-defined base location for different operating systems is as follows:

  - Windows: `%APPDATA%\ethereum2\wallets`
  - MacOSX: `${HOME}/Library/Application Support/ethereum2/wallets`
  - Linux: `${HOME}/.config/ethereum2/wallets`

For other hierarchical stores, for example Amazon S3, the base location MUST be the lower-case hex string representing the [SHA-256](../assets/eip-2680/sha256-384-512.pdf) 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&apos;s Amazon S3 account is &quot;AbC0438EB&quot; then:

  - string would be `Ethereum 2 wallet:AbC0438EB`
  - SHA-256 hash of string would be the byte array `0x991ec14a8d13836b10d8c3039c9e30876491cb8aa9c9c16967578afc815c9229`
  - base location would be the string `991ec14a8d13836b10d8c3039c9e30876491cb8aa9c9c16967578afc815c9229`

For non-hierarchical stores there is no base location.

### Wallet container
The wallet container holds the walletstore and related keystores.

The wallet container is identified by the wallet&apos;s UUID.  It MUST be a string following the syntactic structure as laid out in [section 3 of RFC 4122](https://tools.ietf.org/html/rfc4122#section-3).

### Walletstore
The walletstore element contains the walletstore and is held within the wallet container.  It is identified by the wallet&apos;s UUID.  It MUST be a string following the syntactic structure as laid out in [section 3 of RFC 4122](https://tools.ietf.org/html/rfc4122#section-3).

### Keystore
The keystore element contains the keystore for a given key and is held within the wallet container.  It is identified by the key&apos;s UUID.  It MUST be a string following the syntactic structure as laid out in [section 3 of RFC 4122](https://tools.ietf.org/html/rfc4122#section-3).

## Hierarchical store example
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.

Putting these elements together for a sample wallet with wallet UUID `1f031fff-c51d-44fc-8baf-d6b304cb70a7` and key UUIDs `1302106c-8441-4e2e-b687-6c77f49fc624` and `4a320100-83fd-4db7-8126-6d6d205ba834` gives the following layout:

```
- 1f031fff-c51d-44fc-8baf-d6b304cb70a7
+- 1302106c-8441-4e2e-b687-6c77f49fc624
+- 1f031fff-c51d-44fc-8baf-d6b304cb70a7
+- 4a320100-83fd-4db7-8126-6d6d205ba834
```

### Non-hierarchical store example
Non-hierarchical stores use a simplified approach where the wallet UUID and key UUIDs are concatenated using the &apos;:&apos; character.  Using the same example wallet and key UUIDs as above would result in objects with the following keys:

```
1f031fff-c51d-44fc-8baf-d6b304cb70a7:1302106c-8441-4e2e-b687-6c77f49fc624
1f031fff-c51d-44fc-8baf-d6b304cb70a7:1f031fff-c51d-44fc-8baf-d6b304cb70a7
1f031fff-c51d-44fc-8baf-d6b304cb70a7:4a320100-83fd-4db7-8126-6d6d205ba834
```

### Protecting against concurrent write access
TBD

### Iterating over wallets
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.

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.

### Iterating over accounts
In the case of hierarchical stores iteration over accounts is a matter of iterating over the files in the wallet container.

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.

### Index format
The index format is the same for both wallets and accounts, following a standard JSON schema.

```json
{
    &quot;type&quot;: &quot;array&quot;,
    &quot;items&quot;: {
        &quot;type&quot;: &quot;object&quot;,
        &quot;properties&quot;: {
            &quot;uuid&quot;: {
                &quot;type&quot;: &quot;string&quot;
            },
            &quot;name&quot;: {
                &quot;type&quot;: &quot;string&quot;
            }
        },
        &quot;required&quot;: [
            &quot;uuid&quot;,
            &quot;name&quot;
        ]
    }
}
```

The index MUST use the identifier &apos;index&apos;.

Public keys must NOT be stored in the index.

## Rationale

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.

## Implementation

A Go implementation of the filesystem layout can be found at [https://github.com/wealdtech/go-eth2-wallet-filesystem](https://github.com/wealdtech/go-eth2-wallet-filesystem).

A Go implementation of the Amazon S3 layout can be found at [https://github.com/wealdtech/go-eth2-wallet-s3](https://github.com/wealdtech/go-eth2-wallet-s3).

## Security Considerations

Locations for wallet stores are defined to be within each user&apos;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.

The names for both wallet and key stores are UUIDs, ensuring that no data is leaked from the metadata.
  
## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 29 May 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2680</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2680</guid>
      </item>
    
      <item>
        <title>Rules Engine Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-2746-rules-engine-interface/4435</comments>
        
        <description>## Simple Summary
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. 

## Abstract
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.

## Motivation
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/or altering it.

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.

## Specification
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 &apos;TokenAmt&apos; 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.

```solidity
pragma solidity ^0.6.0;

/**
    @title ERC-2746 Rules Engine Standard
    @dev See https://eips.ethereum.org/EIPS/eip-2746
 */
 interface ERCRulesEngine {

    /**
        @dev Should emit when a RuleTree is invoked.
        The `ruler` is the ID and owner of the RuleTree being invoked.  It is also likely msg.sender.
    */
    event CallRuleTree(
        address indexed ruler
    );

    /**
        @dev Should emit when a RuleSet is invoked.
        The `ruler` is the ID and owner of the RuleTree in which the RuleSet is stored.  It is also likely msg.sender.
        The &apos;ruleSetId&apos; is the ID of the RuleSet being invoked.
    */
    event CallRuleSet(
        address indexed ruler,
        bytes32 indexed tmpRuleSetId
    );

    /**
        @dev Should emit when a Rule is invoked.
        The `ruler` is the ID and owner of the RuleTree in which the RuleSet is stored.  It is also likely msg.sender.
        The &apos;ruleSetId&apos; is the ID of the RuleSet being invoked.
        The &apos;ruleId&apos; is the ID of the Rule being invoked.
        The &apos;ruleType&apos; is the type of the rule being invoked.        
    */
    event CallRule(
        address indexed ruler,
        bytes32 indexed ruleSetId,
        bytes32 indexed ruleId,
        uint ruleType
    );

    /**
        @dev Should emit when a RuleSet fails.
        The `ruler` is the ID and owner of the RuleTree in which the RuleSet is stored.  It is also likely msg.sender.
        The &apos;ruleSetId&apos; is the ID of the RuleSet being invoked.
        The &apos;severeFailure&apos; is the indicator of whether or not the RuleSet is a leaf with a &apos;severe&apos; error flag.
    */
    event RuleSetError (
        address indexed ruler,
        bytes32 indexed ruleSetId,
        bool severeFailure
    );	

    /**
        @notice Adds a new Attribute to the data domain.
        @dev Caller should be the deployer/owner of the rules engine contract.  An Attribute value can be an optional alternative if it&apos;s not a string or numeric.
        @param _attrName    Name/ID of the Attribute
        @param _maxLen      Maximum length of the Attribute (if it is a string)
        @param _maxNumVal   Maximum numeric value of the Attribute (if it is numeric)
        @param _defaultVal  The default value for the Attribute (if one is not found from the source)
        @param _isString    Indicator of whether or not the Attribute is a string
        @param _isNumeric   Indicator of whether or not the Attribute is numeric
    */    
    function addAttribute(bytes32 _attrName, uint _maxLen, uint _maxNumVal, string calldata _defaultVal, bool _isString, bool _isNumeric) external;

    /**
        @notice Adds a new RuleTree.
        @param _owner          Owner/ID of the RuleTree
        @param _ruleTreeName   Name of the RuleTree
        @param _desc           Verbose description of the RuleTree&apos;s purpose
    */
    function addRuleTree(address _owner, bytes32 _ruleTreeName, string calldata _desc) external;

    /**
        @notice Adds a new RuleSet onto the hierarchy of a RuleTree.
        @dev RuleSets can have child RuleSets, but they will only be called if the parent&apos;s Rules execute to create boolean &apos;true&apos;.
        @param _owner           Owner/ID of the RuleTree
        @param _ruleSetName     ID/Name of the RuleSet
        @param _desc            Verbose description of the RuleSet
        @param _parentRSName    ID/Name of the parent RuleSet, to which this will be added as a child
        @param _severalFailFlag Indicator of whether or not the RuleSet&apos;s execution (as failure) will result in a failure of the RuleTree.  (This flag only applies to leaves in the RuleTree.)
        @param _useAndOp        Indicator of whether or not the rules in the RuleSet will execute with &apos;AND&apos; between them.  (Otherwise, it will be &apos;OR&apos;.)
        @param _failQuickFlag   Indicator of whether or not the RuleSet&apos;s execution (as failure) should immediately stop the RuleTree.
    */    
    function addRuleSet(address _owner, bytes32 _ruleSetName, string calldata _desc, bytes32 _parentRSName, bool _severalFailFlag, bool _useAndOp, bool _failQuickFlag) external;

    /**
        @notice Adds a new Rule into a RuleSet.
        @dev Rule types can be implemented as any type of action (greater than, less than, etc.)
        @param _owner           Owner/ID of the RuleTree
        @param _ruleSetName     ID/Name of the RuleSet to which the Rule will be added
        @param _ruleName        ID/Name of the Rule being added
        @param _attrName        ID/Name of the Attribute upon which the Rule is invoked
        @param _ruleType        ID of the type of Rule
        @param _rightHandValue  The registered value to be used by the Rule when performing its action upon the Attribute
        @param _notFlag         Indicator of whether or not the NOT operator should be performed on this Rule.
    */    
    function addRule(address _owner, bytes32 _ruleSetName, bytes32 _ruleName, bytes32 _attrName, uint _ruleType, string calldata _rightHandValue, bool _notFlag) external;

    /**
        @notice Executes a RuleTree.
        @param _owner           Owner/ID of the RuleTree
    */
    function executeRuleTree(address _owner) external returns (bool);
    
    /**
        @notice Retrieves the properties of a Rule.
        @param _owner           Owner/ID of the RuleTree
        @param _ruleSetName     ID/Name of the RuleSet where the Rule resides
        @param _ruleIdx         Index of the rule in the RuleSet&apos;s listing 
        @return bytes32         ID/Name of Rule
        @return uint            Type of Rule
        @return bytes32         Target Attribute of Rule
        @return string          Value mentioned in Rule
        @return bool            Flag for NOT operator in Rule
        @return bytes32[]       Values that should be provided in delegated call (if Rule is custom operator)
    */
    function getRuleProps(address _owner, bytes32 _ruleSetName, uint _ruleIdx) external returns (bytes32, uint, bytes32, string memory, bool, bytes32[] memory);

    /**
        @notice Retrieves the properties of a RuleSet
        @param _owner        Owner/ID of the RuleTree
        @param _ruleSetName  ID/Name of the RuleSet
        @return string       Verbose description of the RuleSet
        @return bool         Flag that indicates whether this RuleSet&apos;s failure (if a leaf) will cause the RuleTree to fail
        @return bool         Flag that indicates whether this RuleSet uses the AND operator when executing rules collectively
        @return uint         Indicates the number of rules hosted by this RuleSet
        @return bytes32[]    The list of RuleSets that are children of this RuleSet
    */
    function getRuleSetProps(address _owner, bytes32 _ruleSetName) external returns (string memory, bool, bool, uint, uint, bytes32[] memory);

    /**
        @notice Retrieves the properties of a RuleSet
        @param _owner        Owner/ID of the RuleTree
        @return bytes32      Name of the RuleTree
        @return string       Verbose description of the RuleTree
        @return bytes32      ID/Name of the RuleSet that serves as the root node for the RuleTree
    */
    function getRuleTreeProps(address _owner) external returns (bytes32, string memory, bytes32);
    
    /**
        @notice Removes a RuleTree.
        @param _owner           Owner/ID of the RuleTree
    */
    function removeRuleTree(address _owner) external returns (bool);    
}
```

### Considerations

An argument could be made for interface functions that allow a RuleTree&apos;s owner to include others users as executors of the RuleTree.

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&apos;s value comes from a data structure (internal to the rules engine contract) or from calling a contract method (like an implementation of the [Diamond Standard](https://github.com/ethereum/EIPs/issues/2535)).

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&apos; methods to be added as a rule operation.

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/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).

### Example

A company wishes to deploy a contract with data points and functionality that are predefined and/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, [these rules](https://ipfs.infura.io/ipfs/QmPrZ9959c7SzzqdLkVgX28xM7ZrqLeT3ydvRAHCaL1Hsn) 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&apos;s user(s) or off-chain programs.

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.

## Rationale

### Attributes

The data points are abstracted in order to let the implementation provide the mechanism for retrieving/populating the data.  Data can be held by an internal data structure, another contract&apos;s method, or any number of other options.

### Events

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.

### Right-Hand Value

In the function addRule(), the data type for the right-hand value is &apos;string&apos; since the rule&apos;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.

## Implementation
- [Wonka](https://github.com/Nethereum/Wonka/tree/master/Solidity/WonkaEngine)
- [Wonka Rules Editor](https://github.com/jaerith/WonkaRulesBlazorEditor)

The Wonka implementation supports this proposed interface and also implements all of the additional considerations mentioned above. 

## Security Considerations

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&apos;s owner/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.

## References

**Standards**
- [EIP-2535 Diamond Standard](./eip-2535.md)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 20 Jun 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2746</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2746</guid>
      </item>
    
      <item>
        <title>Contract Ownership Governance</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2766</comments>
        
        <description>## Simple Summary

A standard for Governance contracts that holds the administrative ownership of other smart contracts with voting power distributed as `ERC-20` tokens.

## Abstract

The following standard defines the implementation of a standard API for a Governance smart contract based on `ERC-20`. Existing `ERC-173` 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.

## Motivation

Traditionally, many contracts that require that they be owned or controlled in some way use `ERC-173` which standardized the use of ownership in the smart contracts. For example to withdraw funds or perform administrative actions.

```solidity
contract dApp {
  function doSomethingAdministrative() external onlyOwner {
    // admin logic that can be performed by a single wallet
  }
}
```

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&apos;s private key.

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 [Compound Governance](https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/GovernorAlpha.sol#L27), [Uniswap Governance](https://github.com/Uniswap/governance/blob/master/contracts/GovernorAlpha.sol#L27) and [Sushiswap Governance](https://github.com/sushiswap/sushiswap/blob/master/contracts/GovernorAlpha.sol#L45). It&apos;s just like if the ERC-20 standard wasn&apos;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 `ERC-20` token as a governance token, existing tools built to work with `ERC-20` can already display voters. This can result in a wide adoption for contract governance over private key based ownership.

## Specification

A Governance contract that is compliant with `ERC-2767` shall implement the following interfaces:

```solidity
/// @title ERC-2767 Governance
/// @dev ERC-165 InterfaceID: 0xd8b04e0e
interface ERC2767 is ERC165 {
    /// @notice Gets number votes required for achieving consensus
    /// @dev Should cost less than 30000 gas
    /// @return Required number of votes for achieving consensus
    function quorumVotes() external view returns (uint256);

    /// @notice The address of the Governance ERC20 token
    function token() external view returns (address);
}
```

### `ERC-20` Governance Token

An `ERC-2767` Governance Contract should reference an address through `token()` that implements `ERC-20` interface. `token()` is allowed to return self address (`address(this)`), if `ERC-20` functionalities are implemented in the same contract (one can consider checking out Diamond Standard [`ERC-2535`](https://eips.ethereum.org/EIPS/eip-2535) to optimise contract size).

Implementations are allowed to have varying `ERC-20`&apos;s `totalSupply()` (through any standard of minting or burning). But having a fixed `quorumVotes()` return value in this case would cause required votes consensus in `%` with respect to `totalSupply()` to change. To automatically account for this, any custom logic under `quorumVotes()` is allowed to return for e.g. `51%` of `totalSupply()`.

### `ERC-165` Interface Identification

An `ERC-2767` Governance Contract should also implement `ERC-165`. This helps general tools to identify whether a contract is a `ERC-2767` Governance contract.

```solidity
interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

## Rationale

The goals of this EIP have been the following:

- Standardize API of Governance contracts to make it easy for analysis tools to be built.
- Encourage use of `ERC-20` based weighted governance over existing multi-sig (_generally limited to 50 max owners_) for big projects.
- Encourage existing `ERC-173` ownership smart contracts / projects to move to Governance based ownership by removing the effort needed to host custom UI for their project.
- Encourage availability of publicly audited governance contracts, just like `ERC-20` which anyone can use.
- Make it possible to utilize existing `ERC-20` tools for owners of governance token analysis.
- Make future protocols possible that need to interact with governances of multiple projects.
- Keep this EIP minimal and allow another EIPs to standardize any specific functionalities.

## Backwards Compatibility

Smart contracts that are `ERC-173` compliant can transfer their ownership to a Governance contract. This enables such contracts to become compatible with `ERC-2767` Governance.

However, there are some existing projects with governance implementations and most of them have custom APIs ([Compound Governance](https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/GovernorAlpha.sol#L27), [Uniswap Governance](https://github.com/Uniswap/governance/blob/master/contracts/GovernorAlpha.sol#L27) and [Sushiswap Governance](https://github.com/sushiswap/sushiswap/blob/master/contracts/GovernorAlpha.sol#L45)), since a standard did not exist. Not having an `ERC-2767` 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.

For existing governance contracts to get compatible with `ERC-2767`:

1. Projects can deploy a new governance contract and transfer ownership to it to be `ERC-2767` compatible. This is suitable for those who use Multi-sig wallets for Governance.
2. It is understood that redeploying governance contracts would be a troublesome task, and contracts who already have functionality similar to `ERC-20` based (weighted votes) have a bit advanced way to avoid it. Basically, they can create a forwarder contract implements `ERC-2767` and forwards all calls to the actual non-standard methods. Projects can list the forwarder contract to display the information project&apos;s governance info without requiring any custom code in analysys tool, but this might have certain limitations depending on the project&apos;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;!-- ## Test Cases --&gt;

## Implementation

The reference implementations are available in this [repository](https://github.com/zemse/contract-ownership-governance). Publicly audited implementations will be included in future.

## Security Considerations

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.

#### On-chain

In such implementations, community can create transaction proposals and vote on it by sending on-chain transactions.

- OpenZeppelin Snapshots can be used to prevent double voting.

#### Off-chain

- The signatures in off-chain governance implementation can follow recommendations of `ERC-191` or `ERC-712`.
- To prevent replaying signatures, it&apos;d be best if executer is required to sort the signatures based on increasing addresses.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 04 Jul 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2767</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2767</guid>
      </item>
    
      <item>
        <title>Meta-Transactions Forwarder Contract</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-2770-meta-transactions-forwarder-contract/5391</comments>
        
        <description>## Simple Summary
Standardized contract interface for extensible meta-transaction forwarding.

## Abstract

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.

## Motivation

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.

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.

`msg.sender` 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
`msg.sender` is insufficient, and signer address must be recovered as well.

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.

## Specification
The Forwarder contract operates by accepting a signed typed data together with it&apos;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.

### Forwarder data type registration
Request struct MUST contain the following fields in this exact order:
```
struct ForwardRequest {
   address from;
   address to;
   uint256 value;
   uint256 gas;
   uint256 nonce;
   bytes data;
   uint256 validUntil;
}
```
`from` - an externally-owned account making the request \
`to` - a destination address, normally a smart-contract\
`value` - an amount of Ether to transfer to the destination\
`gas` - an amount of gas limit to set for the execution\
`nonce` - an on-chain tracked nonce of a transaction\
`data` - the data to be sent to the destination\
`validUntil` - the highest block number the request can be forwarded in, or 0 if request validity is not time-limited

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.

Registration MUST be performed in advance by a call to the following method:
```
function registerRequestType(string typeName, string typeSuffix)
```
`typeName` - a name of a type being registered\
`typeSuffix` - an ERC-712 compatible description of a type

For example, after calling 
```
registerRequestType(&quot;ExtendedRequest&quot;, &quot;uint256 x,bytes z,ExtraData extraData)ExtraData(uint256 a,uint256 b,uint256 c)&quot;)
```
the following ERC-712 type will be registered with forwarder:
```
/* primary type */
struct ExtendedRequest {
   address from;
   address to;
   uint256 value;
   uint256 gas;
   uint256 nonce;
   bytes data;
   uint256 validUntil;
   uint256 x;
   bytes z;
   ExtraData extraData;
}

/* subtype */
struct ExtraData {
   uint256 a;
   uint256 b;
   uint256 c;
}
```

### Signature verification

The following method performs an ERC-712 signature check on a request:
```
function verify(
   ForwardRequest forwardRequest,
   bytes32 domainSeparator,
   bytes32 requestTypeHash,
   bytes suffixData,
   bytes signature
) view;
```
`forwardRequest` - an instance of the `ForwardRequest` struct  
`domainSeparator` - caller-provided domain separator to prevent signature reuse across dapps (refer to ERC-712)
`requestTypeHash` - hash of the registered relay request type
`suffixData` - RLP-encoding of the remainder of the request struct
`signature` - an ERC-712 signature on the concatenation of `forwardRequest` and `suffixData`

### Command execution

In order for the Forwarder to perform an operation, the following method is to be called: 
```
function execute(
   ForwardRequest forwardRequest,
   bytes32 domainSeparator,
   bytes32 requestTypeHash,
   bytes suffixData,
   bytes signature
)
public
payable
returns (
   bool success,
   bytes memory ret
)
```
 
Performs the ‘verify’ internally and if it succeeds performs the following call:
```
bytes memory data = abi.encodePacked(forwardRequest.data, forwardRequest.from);
...
(success, ret) = forwardRequest.to.call{gas: forwardRequest.gas, value: forwardRequest.value}(data);
```
Regardless of whether the inner call succeeds or reverts, the nonce is incremented, invalidating the signature and preventing a replay of the request.

Note that `gas` 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 `forwardRequest` specifies non-zero value, extra `40000 gas` is
reserved in case inner call reverts or there is a remaining Ether so there is a need to transfer value from the `Forwarder`:
```solidity
uint gasForTransfer = 0;
if ( req.value != 0 ) {
   gasForTransfer = 40000; // buffer in case we need to move Ether after the transaction.
}
...
require(gasleft()*63/64 &gt;= req.gas + gasForTransfer, &quot;FWD: insufficient gas&quot;);
```
In case there is not enough `value` in the Forwarder the execution of the inner call fails.\
Be aware that if the inner call ends up transferring Ether to the `Forwarder` in a call that did not originally have `value`, this
Ether will remain inside `Forwarder` after the transaction is complete.
 
### ERC-712 and &apos;suffixData&apos; parameter
`suffixData` field must provide a valid &apos;tail&apos; of an ERC-712 typed data.
For instance, in order to sign on the `ExtendedRequest` struct, the data will be a concatenation of the following chunks:
* `forwardRequest` fields will be RLP-encoded as-is, and variable-length `data` field will be hashed
* `uint256 x` will be appended entirely as-is
* `bytes z` will be hashed first
* `ExtraData extraData` will be hashed as a typed data

So a valid `suffixData` is calculated as following:
```
function calculateSuffixData(ExtendedRequest request) internal pure returns (bytes) {
    return abi.encode(request.x, keccak256(request.z), hashExtraData(request.extraData));
}

function hashExtraData(ExtraData extraData) internal pure returns (bytes32) {
    return keccak256(abi.encode(
            keccak256(&quot;ExtraData(uint256 a,uint256 b,uint256 c)&quot;),
            extraData.a,
            extraData.b,
            extraData.c
        ));
}
```

### Accepting Forwarded calls
In order to support calls performed via the Forwarder, the Recipient contract must read the signer address from the
last 20 bytes of `msg.data`, as described in ERC-2771.

## Rationale
Further relying on `msg.sender` to authenticate end users by their externally-owned accounts is taking the Ethereum dapp ecosystem to a dead end.

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.

`validUntil` field uses a block number instead of timestamp in order to allow for better precision and integration
with other common block-based timers.

## Security Considerations
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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 01 Jul 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2770</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2770</guid>
      </item>
    
      <item>
        <title>Secure Protocol for Native Meta Transactions</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-2771-secure-protocol-for-native-meta-transactions/4488</comments>
        
        <description>## Abstract

This EIP defines a contract-level protocol for `Recipient` contracts to accept meta-transactions through trusted `Forwarder` contracts. No protocol changes are made. `Recipient` contracts are sent the effective `msg.sender` (referred to as `_msgSender()`) and `msg.data` (referred to as `_msgData()`) by appending additional calldata. 

## Motivation

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 **Transaction Signer** and relayed by an untrusted third party that pays for the gas (the **Gas Relay**). 

## Specification

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.

### Definitions

**Transaction Signer**: Signs &amp; sends transactions to a Gas Relay

**Gas Relay**: Receives signed requests off-chain from Transaction Signers and pays gas to turn it into a valid transaction that goes through a Trusted Forwarder

**Trusted Forwarder**: A contract trusted by the `Recipient` to correctly verify signatures and nonces before forwarding the request from Transaction Signers

**Recipient**: A contract that accepts meta-transactions through a Trusted Forwarder

### Example Flow

![Example flow](../assets/eip-2771/example-flow.png)

### Extracting The Transaction Signer address

The **Trusted Forwarder** is responsible for calling the **Recipient** contract and MUST append the address of the **Transaction Signer** (20 bytes of data) to the end of the call data.

For example :

```solidity
(bool success, bytes memory returnData) = to.call.value(value)(abi.encodePacked(data, from));
```

The **Recipient** contract can then extract the **Transaction Signer** address by performing 3 operations:

1. Check that the **Forwarder** is trusted. How this is implemented is out of the scope of this proposal.
2. Extract the **Transaction Signer** address from the last 20 bytes of the call data and use that as the original `sender` of the transaction (instead of `msg.sender`)
3. If the `msg.sender` is not a trusted forwarder (or if the `msg.data` is shorter than 20 bytes), then return the original `msg.sender` as it is.

The **Recipient** 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.

### Protocol Support Discovery Mechanism

Unless a **Recipient** 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 **Recipient** can let the world know that it supports meta transactions. 

This is especially important for meta transactions to be supported at the Web3 wallet level. Such wallets may not necessarily know anything about the **Recipient** contract users may wish to interact with.

As a **Recipient** 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.

To provide this discovery mechanism a **Recipient** contract MUST implement this function:

```solidity
function isTrustedForwarder(address forwarder) external view returns(bool);
```

`isTrustedForwarder` MUST return `true` if the forwarder is trusted by the Recipient, otherwise it MUST return `false`. `isTrustedForwarder` MUST NOT revert.

Internally, the **Recipient** MUST then accept a request from forwarder.

`isTrustedForwarder` 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

## Rationale

* Make it easy for contract developers to add support for meta
  transactions by standardizing the simplest viable contract interface.
* Without support for meta transactions in the recipient contract, an externally owned 
  account can not use meta transactions to interact with the recipient contract.
* Without a standard contract interface, there is no standard way for a client
  to discover whether a recipient supports meta transactions.
* Without a standard contract interface, there is no standard way to send a
  meta transaction to a recipient.
* Without the ability to leverage a trusted forwarder every recipient contract
  has to internally implement the logic required to accept meta transactions securely.
* Without a discovery protocol, there is no mechanism for a client to discover
  whether a recipient supports a specific forwarder.
* 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.
* `msg.sender` 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 `msg.sender` is insufficient.
  * The problem is that for a contract that is not natively aware of meta transactions, the `msg.sender` of the transaction will make it appear to be coming from the **Gas Relay** and not the **Transaction Signer**. A secure protocol for a contract to accept meta transactions needs to prevent the **Gas Relay** from forging, modifying or duplicating requests by the **Transaction Signer**.

## Reference Implementation

### Recipient Example 

```solidity
contract RecipientExample {

    function purchaseItem(uint256 itemId) external {
        address sender = _msgSender();
        // ... perform the purchase for sender
    }

    address immutable _trustedForwarder;
    constructor(address trustedForwarder) internal {
        _trustedForwarder = trustedForwarder;
    }

    function isTrustedForwarder(address forwarder) public returns(bool) {
        return forwarder == _trustedForwarder;
    }

    function _msgSender() internal view returns (address payable signer) {
        signer = msg.sender;
        if (msg.data.length&gt;=20 &amp;&amp; isTrustedForwarder(signer)) {
            assembly {
                signer := shr(96,calldataload(sub(calldatasize(),20)))
            }
        }    
    }

}
```

## Security Considerations

A malicious forwarder may forge the value of `_msgSender()` and effectively send transactions from any address. Therefore, `Recipient` contracts must be very careful in trusting forwarders. If a forwarder is upgradeable, then one must also trust that the contract won&apos;t perform a malicious upgrade.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 01 Jul 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2771</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2771</guid>
      </item>
    
      <item>
        <title>My Own Messages (MOM)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/InternetOfPeers/EIPs/issues/1</comments>
        
        <description>## Simple Summary

My Own Messages (MOM) is a standard to create your very own public, always updated, unstoppable, verifiable, message board.

## Abstract

My Own Messages (MOM) use Ethereum as a certification layer for commands and multihash of your messages. It don&apos;t use smart contracts but simple self-send transactions with specific payload attached.

To ge more insights, you can test a [live client](http://internetofpeers.org/mom-client/), watch a [full video overview and demo](https://www.youtube.com/watch?v=z1SnoQkQYkU) and read a [brief presentation](../assets/eip-2848/presentation.pdf).

## Motivation

As a _developer_ or _pool&apos;s owner_, I&apos;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&apos;d like to read messages from my userbase, in the same secure and verifiable manner.

As a _user_, 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&apos;s done. Also, I want to write to some smart contract&apos;s owner or to the sender of some transaction.

As an _explorer service_, 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)

And in _any role_, I want a method that does not allow scams - transactions without values, no smart contract&apos;s address to remember or to fake - and it does not allow spam - it&apos;s cheap but not free, and even if you can link/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.

Main advantages:

- 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.
- 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/opinion on dozens of sites like Reddit, Twitter, Facebook, Medium, Disqus, and so on...)
- 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.
- Finally, you can ask and get tips for your words directly into your wallet.

I know, My Own Messages (MOM) sounds like _mom_. And yes, pun intended :)

## Specification

The key words &quot;MUST&quot;, &quot;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](https://www.ietf.org/rfc/rfc2119.txt) when, and only when, they appear in all capitals as shown here.

Clients following MOM standard **MUST** allow users to send and to read MOM transaction, creating an _updated message list_ for each address the users are interested in.

Reading MOM transactions, MOM clients **MUST** be able to show the current and updated message list, and they **SHOULD** be able to show also all the message history if users ask for it.

Apart from message list, MOM clients **SHOULD** be able to download the content of the messages and to show them to the user.

Clients **SHOULD** allow users to choose and set the source to download content from, and they **SHOULD** be able to use common Content Addressable Networks - i.e. IPFS or Swarm - or HTTP servers. If content is downloaded from HTTP servers, clients **MUST** check the content against the declared multihash.

As the default setting, clients **MUST** consider `text/markdown` ([RFC 7763](https://www.ietf.org/rfc/rfc7763.txt)) as the media type of the content represented by a multihash, and in particular [Markdown](https://en.wikipedia.org/wiki/Markdown) text in [UTF-8](https://en.wikipedia.org/wiki/UTF-8) without [BOM](https://en.wikipedia.org/wiki/Byte_order_mark).

Clients **MAY** let users choose to parse messages considering other content types. In this case they **SHOULD** cast a warning to users stating that a content type other than `text/markdown` is used while processing messages.

It&apos;s **RECOMMENDED** that clients inform users about the actual setting of the default content type.

### MOM transactions

Clients **MUST** assume that **invalid MOM transactions don&apos;t exist**. If a transaction does not strictly follow the MOM standard, clients **MUST** ignore it and they **MUST NOT** consider it a MOM transaction at all.

Because there can be security implications parsing data sent by users, clients **SHOULD NOT** try to keep track or interpret transactions as _invalid_ MOM transactions.

#### Valid MOM transaction&apos;s data structure

| ATTRIBUTE | VALUE |
|:--------|:------------|
| `to` | **MUST** be the same account signing the transaction. |
| `value` |  **MUST** be `0` wei. |
| `data` | **MUST** be at least `2` bytes. The first byte **MUST** be operational code and following bytes **MUST** be based on the operational codes listed below. |

#### List of supported operations and messages

Each operational code has one or more parameters, and all parameters **MUST** be considered mandatory.

Optional parameters don&apos;t exist: if parameters for the specific operational code are not all present or they don&apos;t follow the rules, clients **MUST** ignore the transaction completely.

Messages **MUST** be always referenced with the multihash of their content.

Operations are divided into two sets: **CORE** and **EXTENDED** operations. 

- Clients **MUST** support all core operations and they **SHOULD** support as much extended operations as possible.
- Clients **SHOULD** support and implement as much extended operations as possible, but they **MAY** choose to implement only some specific extended operations they are interested in.

#### Core operations

| OPERATION | CODE | PARAMETERS | MEANING | EFFECT |
|-----------|:--------:|------------|---------|--------|
| ADD | `0x00` | multihash | Add a message. The parameter **MUST** be the multihash of the message. | Clients **MUST** add the message to the message list of the sender. |
| UPDATE | `0x01` | multihash, multihash | Update a message. The first parameter **MUST** be the multihash of the message to be updated. The second parameter **MUST** be the multihash of the updated message. | Clients **MUST** update the message list to show the updated message. |
| REPLY | `0x02` | multihash, multihash | Reply to a message. The first parameter **MUST** be the multihash of the message to reply to. The second parameter **MUST** the multihash of the message. | Clients **MUST** insert a new message in the message list and they **MUST** preserve the relationship with the referenced message. |
| DELETE | `0x03` | multihash | Delete a message. The parameter **MUST** be the multihash of the message to delete. | Clients **MUST** remove the message from the message list. |
| CLOSE ACCOUNT | `0xFD` | multihash | Close an account. The parameter **MUST** be the multihash of the message with the motivations for closing the account. | Clients **MUST** add the message with motivations to the message list and they **MUST NOT** consider MOM messages sent by that address to be valid anymore, ever. In other words, MOM clients **MUST** 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. |
| RAW | `0xFF` | any | The parameter **MUST** be at least `1` byte. Content type is not disclosed and it **MUST NOT** be considered as `text/markdown`. | Clients **MUST** add the message to the message list but they **MUST NOT** try to decode the content. Clients **SHOULD** allow users to see this message only if explicitly asked for. This operation can be used for _blind_ notarization that general client can ignore. |

#### Note about `DELETE` operational code

Please note that sending a `DELETE` command users are not asking to actually delete anything from the blockchain, they are just asking clients to hide that specific message because it&apos;s not valid anymore for some reasons. You can think of it like if users say: _I changed my mind so please ÐApps don&apos;t show this anymore_. As already stated in the specifications above, clients **MUST** follow this request by the author, unless expressly asked otherwise by the user. 

Please also note that, because it&apos;s usually up to the author of a message to be sure the content is available to everyone, if a `DELETE` message was sent it&apos;s very likely the content referenced by the multihash isn&apos;t available anymore, simply because probably it&apos;s not shared by anyone.

#### Extended operations

| OPERATION | CODE | PARAMETERS | MEANING | EFFECT |
|-----------|:--------:|------------|---------|--------|
| ADD &amp; REFER | `0x04` | multihash, address | Add a message and refer an account. The first parameter **MUST** be the multihash of the message. The second parameter **MUST** be an address referenced by the message. | Clients **MUST** add the message to the message list and they **MUST** track the reference to the specified account. This can be useful _to invite_ the owner of the referenced account to read this specific message. |
| UPDATE &amp; REFER | `0x05` | multihash, multihash, address | Update a message. The first parameter **MUST** be the multihash of the message to be updated. The second parameter **MUST** be the multihash of the updated message. The third parameter **MUST** be an address referenced by the message.| Clients **MUST** update the message list to show the updated message and they **MUST** track the reference to the specified account. This can be useful _to invite_ the owner of the referenced account to read this specific message. |
| ENDORSE | `0x06` | multihash | Endorse a message identified by the specified multihash. The parameter **MUST** be the multihash of the message to be endorsed. | Clients **MUST** record and track the endorsement for that specific message. Think it as a _like_, a _retwitt_, etc. |
| REMOVE ENDORSEMENT | `0x07` | multihash | Remove endorsement to the message identified by the specified multihash. The parameter **MUST** be the multihash of the message. | Clients **MUST** remove the endorsement for that specific message. |
| DISAPPROVE | `0x08` | multihash | Disapprove a message identified by the specified multihash. The parameter **MUST** be the multihash of the message to disapprove. | Clients **MUST** record and track the disapproval for that specific message. Think it as a _I don&apos;t like it_. |
| REMOVE DISAPPROVAL | `0x09` | multihash | Remove disapproval of a message identified by the specified multihash. The parameter **MUST** be the multihash of the message. | Clients **MUST** remove the disapproval for that specific message. |
| ENDORSE &amp; REPLY | `0x0A` | multihash, multihash | Endorse a message and reply to it. The first parameter **MUST** be the multihash of the message to reply to. The second parameter **MUST** be the multihash of the message. | Clients **MUST** insert a new message in the message list and they **MUST** preserve the relationship with the referenced message. Clients **MUST** also record and track the endorsement for that specific message. |
| DISAPPROVE &amp; REPLY | `0x0B` | multihash, multihash | Disapprove a message and reply to it. The first parameter **MUST** be the multihash of the message to reply to. The second parameter **MUST** be the multihash of the message. | Clients **MUST** insert a new message in the message list and they **MUST** preserve the relationship with the referenced message. Clients **MUST** also record and track the disapproval for that specific message. |

## Rationale

Ethereum is _account based_, so it&apos;s good to be identified as a single source of information.

It is also able of doing notarization very well and to impose some restrictions on transaction&apos;s structure, so it&apos;s good for commands.

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&apos;s a good solution to achieve the objectives of this message standard.

The objective is also to avoid in the first place any kind of scam and malicious behaviors, so MOM don&apos;t allow to send transactions to other accounts and the value of a MOM transaction is always 0.

### Why not using a smart contract?

MOM wants to be useful, easy to implement and read, error proof, fast and cheap, but:

- using a smart contract for messages can leads more easily to errors and misunderstandings:
  - address of the contract can be wrong
  - smart contract must be deployed on that specific network to send messages
- executing a smart contract costs much more than sending transactions
- executing a smart contract just to store static data is the best example of an anti-pattern (expensive and almost useless)

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.

Finally, if you can achieve exactly the same result without a smart contract, you didn&apos;t need a smart contract at the first place.

### Why not storing messages directly on-chain?

There&apos;s no benefit to store _static_ messages on-chain, if they are not related to some smart contract&apos;s state or if they don&apos;t represent exchange of value. The cost of storing data on-chain is also very high.

### Why not storing op codes inside the message?

While cost effectiveness is a very important feature in a blockchain related standard, there&apos;s also a compromise to reach with usability and usefulness.

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.

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.

Creating a structure for the content of the messages leads to many issues and considerations in parsing the content, if it&apos;s correct, misspelled, and so on.

Finally, the **content must remain clean**. 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.

### Why multihash?

[Multihash](https://github.com/multiformats/multihash) 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.

## Backwards Compatibility

You can already find few transactions over the Ethereum network that use a pattern similar to this EIP. Sometimes it&apos;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.

## Test Cases

A MOM-compliant client can be found and tested on [GitHub](https://github.com/InternetOfPeers/mom-client).

You can use the latest version of MOM client directly via [GitHub Pages](https://internetofpeers.github.io/mom-client) or via IPFS (see the [client repo](https://github.com/InternetOfPeers/mom-client) for the latest updated address).

## Implementation

You can use an already working MOM JavaScript package on [GitHub Packages](https://github.com/InternetOfPeers/mom-js/packages/323930) or [npmjs](https://www.npmjs.com/package/@internetofpeers/mom-js). The package is already used by the MOM client above, and you can use it in your ÐApps too with:

```bash
npm install @internetofpeers/mom-js
```

Transaction [`0x8e49485c56897757a6f2707b92cd5dad06126afed92261b9fe1a19b110bc34e6`](https://etherscan.io/tx/0x8e49485c56897757a6f2707b92cd5dad06126afed92261b9fe1a19b110bc34e6) is an example of a valid MOM transaction already mined on the Main net; it&apos;s an `ADD` message.

## Security Considerations

MOM is very simple and it has no real security concerns by itself. The standard already considers valid only transactions with `0` value and where `from` and `to` addresses are equals.

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.

### Parsing commands

MOM standard involves parsing payloads generated by potentially malicious clients, so attention must be made to avoid unwanted code execution.

- Strictly follow only the standard codes
- Don&apos;t execute any commands outside of the standard ones, unless expressly acknowledged by the user
- Ignore malformed transactions (transactions that don&apos;t strictly follow the rules)

### Messages

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.

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).

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 02 Aug 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2848</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2848</guid>
      </item>
    
      <item>
        <title>Deposit contract and address standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/junderw/deposit-contract-poc/issues/1</comments>
        
        <description>## Simple Summary
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&apos;s main deposit function.

## Abstract
An ERC-2876 compatible **deposit system** can accept ETH payments from multiple depositors without the need for managing multiple keys or requiring use of a hot wallet.

An ERC-2876 compatible **wallet application** can send ETH to ERC-2876 compatible **deposit systems** in a way that the **deposit system** can differentiate their payment using the 8 byte id specified in this standard.

Adoption of ERC-2876 by all exchanges (as a deposit system and as a wallet for their withdrawal systems), merchants, and all wallet applications/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.

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.

## Motivation
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 / 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.

Therefore, merchant and centralized exchange apps are forced between taking on one of the following:

- Large security risk (deposit accounts are hot wallets)
- Large manual labor cost (cold account manager spends time sweeping thousands of cold accounts)
- Large service cost (deploying a contract-per-deposit-address model).

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.

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.

## Specification

### Definitions
- The key words &quot;MUST&quot;, &quot;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.
- `The contract interface` is the contract component of this ERC.
- `The deposit address format` is the newly made format described in &quot;Deposit Address Format&quot; for encoding the 20 byte account address and the 8 byte id.
- `The contract` refers to the contract that implements `the contract interface` of this ERC.
- `The 8 byte &quot;id&quot;` is an 8 byte id used as the input parameter for the contract interface.
- `The 5 byte &quot;nonce&quot;` is the first 5 most significant bytes of the `&quot;id&quot;`.
- `The 3 byte &quot;checksum&quot;` is the last 3 least significant bytes of the `&quot;id&quot;`
- `deposit(bytes8)` refers to the function of that signature, which is defined in `the contract interface`.
- `The parent application` refers to the application that will use the information gained within the `deposit(bytes8)` function. (ie. an exchange backend or a non-custodial merchant application)
- `The depositor` refers to the person that will send value to `the contract` via the `deposit(bytes8)` call.
- `The wallet` refers to any application or library that sends value transactions upon the request of `the depositor`. (ie. MyEtherWallet, Ledger, blockchain.com, various libraries)

### Deposit Address Format

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.

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).

The Deposit Address format can be generated with the following JavaScript code:

```js
/**
 * Converts a 20 byte account address and a 5 byte nonce to a deposit address.
 * The format of the return value is 28 bytes as follows. The + operator is byte
 * concatenation.
 * (baseAddress + nonce + keccak256(baseAddress + nonce)[:3])
 *
 * @param {String} baseAddress the given HEX address (20 byte hex string with 0x prepended)
 * @param {String} nonce the given HEX nonce (5 byte hex string with 0x prepended)
 * @return {String}
 */
function generateAddress (baseAddress, nonce) {
  if (
    !baseAddress.match(/^0x[0-9a-fA-F]{40}$/) ||
    !nonce.match(/^0x[0-9a-fA-F]{10}$/)
  ) {
    throw new Error(&apos;Base Address and nonce must be 0x hex strings&apos;);
  }
  const ret =
    baseAddress.toLowerCase() + nonce.toLowerCase().replace(/^0x/, &apos;&apos;);
  const myHash = web3.utils.keccak256(ret);
  return ret + myHash.slice(2, 8); // first 3 bytes from the 0x hex string
};
```

The checksum can be verified within the deposit contract itself using the following:

```solidity
function checksumMatch(bytes8 id) internal view returns (bool) {
    bytes32 chkhash = keccak256(
        abi.encodePacked(address(this), bytes5(id))
    );
    bytes3 chkh = bytes3(chkhash);
    bytes3 chki = bytes3(bytes8(uint64(id) &lt;&lt; 40));
    return chkh == chki;
}
```

### The Contract Interface

A contract that follows this ERC:

- `The contract` MUST revert if sent a transaction where `msg.data` is null (A pure value transaction).
- `The contract` MUST have a deposit function as follows:

```solidity
interface DepositEIP {
  function deposit(bytes8 id) external payable returns (bool);
}
```

- `deposit(bytes8)` MUST return `false` 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.)
- `deposit(bytes8)` MUST revert if the deposit somehow failed and the contract does not need to keep the value sent.
- `deposit(bytes8)` MUST return `true` if the value will be kept and the payment is logically considered complete by the parent application (exchange/merchant).
- `deposit(bytes8)` SHOULD check the checksum contained within the 8 byte id. (See &quot;Deposit Address Format&quot; for an example)
- `The parent application` 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 `msg.sender` 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&apos;s ability.

### Depositing Value to the Contract from a Wallet

- `The wallet` MUST accept `the deposit address format` anywhere the 20-byte address format is accepted for transaction destination.
- `The wallet` MUST verify the 3 byte checksum and fail if the checksum doesn&apos;t match.
- `The wallet` MUST fail if the destination address is `the deposit address format` and the `data` field is set to anything besides null.
- `The wallet` MUST set the `to` field of the underlying transaction to the first 20 bytes of the deposit address format, and set the `data` field to `0x3ef8e69aNNNNNNNNNNNNNNNN000000000000000000000000000000000000000000000000` where `NNNNNNNNNNNNNNNN` is the last 8 bytes of the deposit address format. (ie. if the deposit address format is set to `0x433e064c42e87325fb6ffa9575a34862e0052f26913fd924f056cd15` then the `to` field is `0x433e064c42e87325fb6ffa9575a34862e0052f26` and the `data` field is `0x3ef8e69a913fd924f056cd15000000000000000000000000000000000000000000000000`)

## Rationale
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/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).

The 8 byte size of the id and the checksum 3 : nonce 5 ratio were decided with the following considerations:

- 24 bit checksum is better than the average 15 bit checksum of an EIP-55 address.
- 40 bit nonce allows for over 1 trillion nonces.
- 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.)

## Backwards Compatibility
An address generated with the deposit address format will not be considered a valid address for applications that don&apos;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.

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.

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.

## Test Cases
```
[
  {
    &quot;address&quot;: &quot;0x083d6b05729c58289eb2d6d7c1bb1228d1e3f795&quot;,
    &quot;nonce&quot;: &quot;0xbdd769c69b&quot;,
    &quot;depositAddress&quot;: &quot;0x083d6b05729c58289eb2d6d7c1bb1228d1e3f795bdd769c69b3b97b9&quot;
  },
  {
    &quot;address&quot;: &quot;0x433e064c42e87325fb6ffa9575a34862e0052f26&quot;,
    &quot;nonce&quot;: &quot;0x913fd924f0&quot;,
    &quot;depositAddress&quot;: &quot;0x433e064c42e87325fb6ffa9575a34862e0052f26913fd924f056cd15&quot;
  },
  {
    &quot;address&quot;: &quot;0xbbc6597a834ef72570bfe5bb07030877c130e4be&quot;,
    &quot;nonce&quot;: &quot;0x2c8f5b3348&quot;,
    &quot;depositAddress&quot;: &quot;0xbbc6597a834ef72570bfe5bb07030877c130e4be2c8f5b3348023045&quot;
  },
  {
    &quot;address&quot;: &quot;0x17627b07889cd22e9fae4c6abebb9a9ad0a904ee&quot;,
    &quot;nonce&quot;: &quot;0xe619dbb618&quot;,
    &quot;depositAddress&quot;: &quot;0x17627b07889cd22e9fae4c6abebb9a9ad0a904eee619dbb618732ef0&quot;
  },
  {
    &quot;address&quot;: &quot;0x492cdf7701d3ebeaab63b4c7c0e66947c3d20247&quot;,
    &quot;nonce&quot;: &quot;0x6808043984&quot;,
    &quot;depositAddress&quot;: &quot;0x492cdf7701d3ebeaab63b4c7c0e66947c3d202476808043984183dbe&quot;
  }
]
```

## Implementation
A sample implementation with an example contract and address generation (in the tests) is located here:

https://github.com/junderw/deposit-contract-poc

## Security Considerations
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 `immutable` keyword in solidity versions `&gt;=0.6.5`.

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 `selfdestruct(address)` (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)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 13 Aug 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2876</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2876</guid>
      </item>
    
      <item>
        <title>Staking Reward Calculation</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2925</comments>
        
        <description>## Simple Summary
ERC2917 is a new standardization for on-chain calculation of staking reward.

## Abstract
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:

![concept image](../assets/eip-2917/erc-reward-formula.png &quot;erc-reward-formula&quot;)

where ∆p&lt;sub&gt;i&lt;/sub&gt; denotes individual productivity of the user U between the consecutive block numbers t&lt;sub&gt;i-1&lt;/sub&gt;  and t&lt;sub&gt;i&lt;/sub&gt;, ∆P&lt;sub&gt;i&lt;/sub&gt; denotes global productivity between the consecutive block numbers t&lt;sub&gt;i-1&lt;/sub&gt;  and t&lt;sub&gt;i&lt;/sub&gt;, and ∆G&lt;sub&gt;i&lt;/sub&gt; denotes gross product between the consecutive block numbers t&lt;sub&gt;i-1&lt;/sub&gt;  and t&lt;sub&gt;i&lt;/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: 	
- whenever the productivity of a user changes (increase/decrease), 
- whenever a user withdraws.

## Motivation

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.
1.	Distribution of rewards is only given when all users exit the contract
2.	The project collects on-chain data, conducts calculation off-chain, and sends the results
to the chain before starting rewards distribution accordingly

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.

Since there is more DeFi projects coming out everyday, users could not find a proper way  to get to know:
1) amount of interests he/she would get
2) how the interest calculated
3) what is his/her contribution compare to the overall

By standardizing ERC2917, it abstracts the interface for interests generation process. Making wallet applications easier to collect each DeFi&apos;s metrics, user friendlier.

## Specification

Every ERC-2917 compliant contract must implement the ERC2917 and ERC20 interfaces (if necessary):

```solidity
interface IERC2917 is IERC20 {

    /// @dev 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.
    event InterestRatePerBlockChanged (uint oldValue, uint newValue);

    /// @dev This emit when a users&apos; productivity has changed
    /// It emits with the user&apos;s address and the value after the change.
    event ProductivityIncreased (address indexed user, uint value);

    /// @dev This emit when a users&apos; productivity has changed
    /// It emits with the user&apos;s address and the value after the change.
    event ProductivityDecreased (address indexed user, uint value);

    
    /// @dev Return the current contract&apos;s interests rate per block.
    /// @return The amount of interests currently producing per each block.
    function interestsPerBlock() external view returns (uint);

    /// @notice Change the current contract&apos;s interests rate.
    /// @dev Note the best practice will be restrict the gross product provider&apos;s contract address to call this.
    /// @return The true/false to notice that the value has successfully changed or not, when it succeed, it will emite the InterestRatePerBlockChanged event.
    function changeInterestRatePerBlock(uint value) external returns (bool);

    /// @notice It will get the productivity of given user.
    /// @dev it will return 0 if user has no productivity proved in the contract.
    /// @return user&apos;s productivity and overall productivity.
    function getProductivity(address user) external view returns (uint, uint);

    /// @notice increase a user&apos;s productivity.
    /// @dev Note the best practice will be restrict the callee to prove of productivity&apos;s contract address.
    /// @return true to confirm that the productivity added success.
    function increaseProductivity(address user, uint value) external returns (bool);

    /// @notice decrease a user&apos;s productivity.
    /// @dev Note the best practice will be restrict the callee to prove of productivity&apos;s contract address.
    /// @return true to confirm that the productivity removed success.
    function decreaseProductivity(address user, uint value) external returns (bool);

    /// @notice take() will return the interests that callee will get at current block height.
    /// @dev it will always calculated by block.number, so it will change when block height changes.
    /// @return amount of the interests that user are able to mint() at current block height.
    function take() external view returns (uint);

    /// @notice similar to take(), but with the block height joined to calculate return.
    /// @dev for instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests.
    /// @return amount of interests and the block height.
    function takeWithBlock() external view returns (uint, uint);

    /// @notice mint the available interests to callee.
    /// @dev once it mint, the amount of interests will transfer to callee&apos;s address.
    /// @return the amount of interests minted.
    function mint() external returns (uint);
}
```

### InterestRatePerBlockChanged

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.
 

### ProductivityIncreased

It emits with the user&apos;s address and the value after the change.
 

### ProductivityDecreased

It emits with the user&apos;s address and the value after the change. 

### interestsPerBlock

It returns the amount of interests currently producing per each block.
 
### changeInterestRatePerBlock

Note the best practice will be restrict the gross product provider&apos;s contract address to call this.

The true/false to notice that the value has successfully changed or not, when it succeed, it will emite the InterestRatePerBlockChanged event.
 
### getProductivity

It returns user&apos;s productivity and overall productivity. It returns 0 if user has no productivity proved in the contract. 

### increaseProductivity

It increases a user&apos;s productivity.

### decreaseProductivity

It decreases a user&apos;s productivity.

### take

It returns the interests that callee will get at current block height.

###  takeWithBlock

Similar to take(), but with the block height joined to calculate return.

For instance, it returns (_amount, _block), which means at block height _block, the callee has accumulated _amount of interests.

It returns amount of interests and the block height.

### mint
it mints the amount of interests will transfer to callee&apos;s address. It returns the amount of interests minted.

## Rationale
TBD

## Implementation
The implementation code is on the github:

- [ERC2917 Demo](https://github.com/gnufoo/ERC3000-Proposal)

## Security Considerations
TBD

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 28 Aug 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2917</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2917</guid>
      </item>
    
      <item>
        <title>EthPM URI Specification</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/ethpm-v3-specification-working-group/4086/7</comments>
        
        <description>## Simple Summary
A custom URI scheme to identify an EthPM registry, package, release, or specific contract asset within a release.

## Abstract
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.

## Specification
`scheme://registry_address[:chain_id][/package_name[@package_version[/json_pointer]]]`

#### `scheme`
- Required
- Must be one of `ethpm` or `erc1319`. If future versions of the EthPM registry standard are designed and published via the ERC process, those ERCs will also be valid schemes.

#### `registry_address`
- Required
- This **SHOULD** 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.

#### `chain_id`
- Optional
- Integer representing the chain id on which the registry is located
- If omitted, defaults to `1` (mainnet).

#### `package_name`
- Optional
- String of the target package name

#### `package_version`
- Optional
- String of the target package version
- If the package version contains any [url unsafe characters](https://en.wikipedia.org/wiki/Percent-encoding), they **MUST** be safely escaped
- Since semver is not strictly enforced by the ethpm spec, if the `package_version` is omitted from a uri, tooling **SHOULD** avoid guessing in the face of any ambiguity and present the user with a choice from the available versions.

#### `json_pointer`
- Optional
- A path that identifies a specific asset within a versioned package release.
- This path **MUST** conform to the [JSON pointer](https://tools.ietf.org/html/rfc6901) spec and resolve to an available asset within the package.

## Rationale
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.

## Test Cases
A JSON file for testing various URIs can be found in the [`ethpm-spec`](https://github.com/ethpm/ethpm-spec/) repository fixtures.

## Implementation
The EthPM URI scheme has been implemented in the following libraries:
- [Brownie](https://eth-brownie.readthedocs.io/en/stable/)
- [Truffle](https://www.trufflesuite.com/docs/truffle/overview)
- [EthPM CLI](https://ethpm-cli.readthedocs.io/en/latest/)

## Security Considerations
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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 04 Sep 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2942</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2942</guid>
      </item>
    
      <item>
        <title>Swiss Compliant Asset Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2983</comments>
        
        <description>## Abstract

This new standard is an [ERC-20](./eip-20.md) compatible token with restrictions that comply with the following Swiss laws: the [Stock Exchange Act](../assets/eip-2980/Swiss-Confederation-SESTA.pdf), the [Banking Act](../assets/eip-2980/Swiss-Confederation-BA.pdf), the [Financial Market Infrastructure Act](../assets/eip-2980/Swiss-Confederation-FMIA.pdf), the [Act on Collective Investment Schemes](../assets/eip-2980/Swiss-Confederation-CISA.pdf) and the [Anti-Money Laundering Act](../assets/eip-2980/Swiss-Confederation-AMLA.pdf). The [Financial Services Act](../assets/eip-2980/Swiss-Confederation-FINSA.pdf) and the [Financial Institutions Act](../assets/eip-2980/Swiss-Confederation-FINIA.pdf) must also be considered. The solution achieved meet also the European jurisdiction.

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.

## Motivation

In its ICO guidance dated February 16, 2018, FINMA (Swiss Financial Market Supervisory Authority) defines asset tokens as tokens representing assets and/or relative rights ([FINMA ICO Guidelines](../assets/eip-2980/Finma-ICO-Guidelines.pdf)). 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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

The words &quot;asset tokens&quot; and &quot;security tokens&quot; can be considered synonymous.

Every ERC-2980 compliant contract MUST implement the ERC-2980 interface.

### ERC-2980 (Token Contract)

``` solidity
interface ERC2980 extends ERC20 {
  
  /// @dev This emits when funds are reassigned
  event FundsReassigned(address from, address to, uint256 amount);

  /// @dev This emits when funds are revoked
  event FundsRevoked(address from, uint256 amount);

  /// @dev This emits when an address is frozen
  event FundsFrozen(address target);

  /**
  * @dev getter to determine if address is in frozenlist
  */
  function frozenlist(address _operator) external view returns (bool);

  /**
  * @dev getter to determine if address is in whitelist
  */
  function whitelist(address _operator) external view returns (bool);

}
```

The ERC-2980 extends [ERC-20](./eip-20.md). Due to the indivisible nature of asset tokens, the decimals number MUST be zero.

### Whitelist and Frozenlist

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.

Below is an example interface for the implementation of a whitelist-compatible and a frozenlist-compratible contract.

``` solidity
Interface Whitelistable {

  /**
   * @dev add an address to the whitelist
   * Throws unless `msg.sender` is an Issuer operator
   * @param _operator address to add
   * @return true if the address was added to the whitelist, false if the address was already in the whitelist
   */
  function addAddressToWhitelist(address _operator) external returns (bool);

  /**
   * @dev remove an address from the whitelist
   * Throws unless `msg.sender` is an Issuer operator
   * @param _operator address to remove
   * @return true if the address was removed from the whitelist, false if the address wasn&apos;t in the whitelist in the first place
   */
  function removeAddressFromWhitelist(address _operator) external returns (bool);

}

Interface Freezable {

  /**
   * @dev add an address to the frozenlist
   * Throws unless `msg.sender` is an Issuer operator
   * @param _operator address to add
   * @return true if the address was added to the frozenlist, false if the address was already in the frozenlist
   */
  function addAddressToFrozenlist(address _operator) external returns (bool);

  /**
   * @dev remove an address from the frozenlist
   * Throws unless `msg.sender` is an Issuer operator
   * @param _operator address to remove
   * @return true if the address was removed from the frozenlist, false if the address wasn&apos;t in the frozenlist in the first place
   */
  function removeAddressFromFrozenlist(address _operator) external returns (bool);

}
```

### Issuers

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.

Below is an example interface for the implementation of the Issuer functionalities.

``` solidity
Interface Issuable {

  /**
   * @dev getter to determine if address has issuer role
   */
  function isIssuer(address _addr) external view returns (bool);

  /**
   * @dev add a new issuer address
   * Throws unless `msg.sender` is the contract owner
   * @param _operator address
   * @return true if the address was not an issuer, false if the address was already an issuer
   */
  function addIssuer(address _operator) external returns (bool);

  /**
   * @dev remove an address from issuers
   * Throws unless `msg.sender` is the contract owner
   * @param _operator address
   * @return true if the address has been removed from issuers, false if the address wasn&apos;t in the issuer list in the first place
   */
  function removeIssuer(address _operator) external returns (bool);

  /**
   * @dev Allows the current issuer to transfer its role to a newIssuer
   * Throws unless `msg.sender` is an Issuer operator
   * @param _newIssuer The address to transfer the issuer role to
   */
  function transferIssuer(address _newIssuer) external;

}
```

### Revoke and Reassign

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.

Below is an example interface for the implementation of the Revoke and Reassign functionalities.

``` solidity
Interface RevokableAndReassignable {

  /**
   * @dev Allows the current Issuer to transfer token from an address to itself
   * Throws unless `msg.sender` is an Issuer operator
   * @param _from The address from which the tokens are withdrawn
   */
  function revoke(address _from) external;

  /**
   * @dev Allows the current Issuer to transfer token from an address to another
   * Throws unless `msg.sender` is an Issuer operator
   * @param _from The address from which the tokens are withdrawn
   * @param _to The address who receives the tokens
   */
  function reassign(address _from, address _to) external;

}
```

## Rationale

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/KYC checks.

## Backwards Compatibility

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.

## Security Considerations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 08 Sep 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2980</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2980</guid>
      </item>
    
      <item>
        <title>NFT Royalty Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/2907</comments>
        
        <description>## Simple Summary

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.

## Abstract

This standard allows contracts, such as NFTs that support [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md) 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 `transferFrom()` 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 `royaltyInfo()`, 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.

## Motivation
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.

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.

This standard allows NFTs that support [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md) 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.

Royalty amounts are always a percentage of the sale price. If a marketplace chooses *not* 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/creators. NFT buyers will assess the royalty payment as a factor when making NFT purchasing decisions.

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.

Enabling all NFT marketplaces to unify on a single royalty payment standard will benefit the entire NFT ecosystem.

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.

At a glance, here&apos;s an example conversation summarizing NFT royalty payments today:

&gt;**Artist**: &quot;Do you support royalty payments on your platform?&quot;          
&gt;**Marketplace**: &quot;Yes we have royalty payments, but if your NFT is sold on another marketplace then we cannot enforce this payment.&quot;              
&gt;**Artist**: &quot;What about other marketplaces that support royalties, don&apos;t you share my royalty information to make this work?&quot;              
&gt;**Marketplace**: &quot;No, we do not share royalty information.&quot;

## Specification

The key words &quot;MUST&quot;, &quot;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.

**ERC-721 and ERC-1155 compliant contracts MAY implement this ERC for royalties to provide a standard method of specifying royalty payment information.**

Marketplaces that support this standard **SHOULD** 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.

Marketplaces **MUST** pay the royalty in the same unit of exchange as that of the `_salePrice` passed to `royaltyInfo()`. This is equivalent to saying that the `_salePrice` parameter and the `royaltyAmount` return value **MUST** 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.

Implementers of this standard **MUST** calculate a percentage of the `_salePrice` when calculating the royalty amount. Subsequent invocations of `royaltyInfo()` **MAY** return a different `royaltyAmount`. Though there are some important considerations for implementers if they choose to perform different percentage calculations between `royaltyInfo()` invocations.

The `royaltyInfo()` function is not aware of the unit of exchange for the sale and royalty payment. With that in mind, implementers **MUST NOT** return a fixed/constant `royaltyAmount`, wherein they&apos;re ignoring the `_salePrice`. For the same reason, implementers **MUST NOT** determine the `royaltyAmount` based on comparing the `_salePrice` with constant numbers. In both cases, the `royaltyInfo()` function makes assumptions on the unit of exchange, which **MUST** be avoided.

The percentage value used must be independent of the sale price for reasons previously mentioned (i.e. if the percentage value 10%, then 10% **MUST** apply whether `_salePrice` is 10, 10000 or 1234567890). If the royalty fee calculation results in a remainder, implementers **MAY** round up or round down to the nearest integer. For example, if the royalty fee is 10% and `_salePrice` is 999, the implementer can return either 99 or 100 for `royaltyAmount`, both are valid.

The implementer **MAY** 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 **SHOULD NOT** be based on variables that are unpredictable like `block.timestamp`, but instead on other more predictable state changes. One more reasonable approach **MAY** use the number of transfers of an NFT to decide which percentage value is used to calculate the `royaltyAmount`. 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 `_tokenId`.

Marketplaces that support this standard **SHOULD NOT** send a zero-value transaction if the `royaltyAmount` returned is `0`. This would waste gas and serves no useful purpose in this EIP.

Marketplaces that support this standard **MUST** 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.

Implementers of this standard **MUST** have all of the following functions:

```solidity
pragma solidity ^0.6.0;
import &quot;./IERC165.sol&quot;;

///
/// @dev Interface for the NFT Royalty Standard
///
interface IERC2981 is IERC165 {
    /// ERC165 bytes to add to interface array - set in parent contract
    /// implementing this standard
    ///
    /// bytes4(keccak256(&quot;royaltyInfo(uint256,uint256)&quot;)) == 0x2a55205a
    /// bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
    /// _registerInterface(_INTERFACE_ID_ERC2981);

    /// @notice Called with the sale price to determine how much royalty
    //          is owed and to whom.
    /// @param _tokenId - the NFT asset queried for royalty information
    /// @param _salePrice - the sale price of the NFT asset specified by _tokenId
    /// @return receiver - address of who should be sent the royalty payment
    /// @return royaltyAmount - the royalty payment amount for _salePrice
    function royaltyInfo(
        uint256 _tokenId,
        uint256 _salePrice
    ) external view returns (
        address receiver,
        uint256 royaltyAmount
    );
}

interface IERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

### Examples

This standard being used on an ERC-721 during deployment:

#### Deploying an ERC-721 and signaling support for ERC-2981

```solidity
constructor (string memory name, string memory symbol, string memory baseURI) {
        _name = name;
        _symbol = symbol;
        _setBaseURI(baseURI);
        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
        // Royalties interface
        _registerInterface(_INTERFACE_ID_ERC2981);
    }
```

#### Checking if the NFT being sold on your marketplace implemented royalties

```solidity  
bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;

function checkRoyalties(address _contract) internal returns (bool) {
    (bool success) = IERC165(_contract).supportsInterface(_INTERFACE_ID_ERC2981);
    return success;
 }
```

## Rationale

### Optional royalty payments

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 `transferFrom()` 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/creators. NFT buyers will assess the royalty payment as a factor when making NFT purchasing decisions.

### Simple royalty payments to a single address

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.

### Royalty payment percentage calculation

This EIP mandates a percentage-based royalty fee model. It is likely that the most common case of percentage calculation will be where the `royaltyAmount` is always calculated from the `_salePrice` using a fixed percent i.e. if the royalty fee is 10%, then a 10% royalty fee must apply whether `_salePrice` is 10, 10000 or 1234567890.

As previously mentioned, implementers can get creative with this percentage-based calculation but there are some important caveats to consider. Mainly, ensuring that the `royaltyInfo()` 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 `block.timestamp` example, there is some nuance which can be highlighted if the following events ensued:

1. Marketplace sells NFT.
2. Marketplace delays `X` days before invoking `royaltyInfo()` and sending payment.
3. Marketplace receives `Y` for `royaltyAmount` which was significantly different from the `royaltyAmount` amount that would&apos;ve been calculated `X` days prior if no delay had occurred.
4. Royalty recipient is dissatisfied with the delay from the marketplace and for this reason, they raise a dispute.

Rather than returning a percentage and letting the marketplace calculate the royalty amount based on the sale price, a `royaltyAmount` 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 `royaltyAmount` that `royaltyInfo()` stipulates.

### Unit-less royalty payment across all marketplaces, both on-chain and off-chain

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.

### Universal Royalty Payments

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.

## Backwards Compatibility

This standard is compatible with current ERC-721 and ERC-1155 standards.

## Security Considerations

There are no security considerations related directly to the implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 15 Sep 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-2981</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-2981</guid>
      </item>
    
      <item>
        <title>Optimistic enactment governance standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/3042</comments>
        
        <description>## Simple Summary

Interface for scheduling, executing and challenging contract executions based on off-chain approval

## Abstract

ERC-3000 presents a basic on-chain spec for contracts to optimistically enact governance decisions made off-chain.

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/response games characteristic of optimistic contracts.

While the authors currently believe resolving challenges [using a subjective oracle](https://aragon.org/blog/snapshot) is the right tradeoff, the standard has been designed such that changing to another mechanism is possible (a deterministic resolver like [Optimism&apos;s OVM](https://optimism.io) uses), even allowing to hot-swap it in the same live instance.

## Specification

### Data structures

Some data structures are defined which are later used in the standard interfaces:

```solidity
library ERC3000Data {
    struct Container {
        Payload payload;
        Config config;
    }

    struct Payload {
        uint256 nonce;
        uint256 executionTime;
        address submitter;
        IERC3000Executor executor;
        Action[] actions;
        bytes proof;
    }

    struct Action {
        address to;
        uint256 value;
        bytes data;
    }

    struct Config {
        uint256 executionDelay;
        Collateral scheduleDeposit;
        Collateral challengeDeposit;
        Collateral vetoDeposit;
        address resolver;
        bytes rules;
    }

    struct Collateral {
        address token;
        uint256 amount;
    }
}
```

### Interface and events

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.

All standard functions are expected to revert (whether to include error messages/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.

```solidity
abstract contract IERC3000 {
    /**
     * @notice Schedules an action for execution, allowing for challenges and vetos on a defined time window
     * @param container A Container struct holding both the paylaod being scheduled for execution and
       the current configuration of the system
     */
    function schedule(ERC3000Data.Container memory container) virtual public returns (bytes32 containerHash);
    event Scheduled(bytes32 indexed containerHash, ERC3000Data.Payload payload, ERC3000Data.Collateral collateral);

    /**
     * @notice Executes an action after its execution delayed has passed and its state hasn&apos;t been altered by a challenge or veto
     * @param container A ERC3000Data.Container struct holding both the paylaod being scheduled for execution and
       the current configuration of the system
     * should be a MUST payload.executor.exec(payload.actions)
     */
    function execute(ERC3000Data.Container memory container) virtual public returns (bytes[] memory execResults);
    event Executed(bytes32 indexed containerHash, address indexed actor, bytes[] execResults);

    /**
     * @notice Challenge a container in case its scheduling is illegal as per Config.rules. Pulls collateral and dispute fees from sender into contract
     * @param container A ERC3000Data.Container struct holding both the paylaod being scheduled for execution and
       the current configuration of the system
     * @param reason Hint for case reviewers as to why the scheduled container is illegal
     */
    function challenge(ERC3000Data.Container memory container, bytes memory reason) virtual public returns (uint256 resolverId);
    event Challenged(bytes32 indexed containerHash, address indexed actor, bytes reason, uint256 resolverId, ERC3000Data.Collateral collateral);

    /**
     * @notice Apply arbitrator&apos;s ruling over a challenge once it has come to a final ruling
     * @param container A ERC3000Data.Container struct holding both the paylaod being scheduled for execution and
       the current configuration of the system
     * @param resolverId disputeId in the arbitrator in which the dispute over the container was created
     */
    function resolve(ERC3000Data.Container memory container, uint256 resolverId) virtual public returns (bytes[] memory execResults);
    event Resolved(bytes32 indexed containerHash, address indexed actor, bool approved);

    /**
     * @dev OPTIONAL
     * @notice Apply arbitrator&apos;s ruling over a challenge once it has come to a final ruling
     * @param payloadHash Hash of the payload being vetoed
     * @param config A ERC3000Data.Config struct holding the config attached to the payload being vetoed
     */
    function veto(bytes32 payloadHash, ERC3000Data.Config memory config, bytes memory reason) virtual public;
    event Vetoed(bytes32 indexed containerHash, address indexed actor, bytes reason, ERC3000Data.Collateral collateral);

    /**
     * @dev OPTIONAL: implementer might choose not to implement (initial Configured event MUST be emitted)
     * @notice Apply a new configuration for all *new* containers to be scheduled
     * @param config A ERC3000Data.Config struct holding all the new params that will control the queue
     */
    function configure(ERC3000Data.Config memory config) virtual public returns (bytes32 configHash);
    event Configured(bytes32 indexed containerHash, address indexed actor, ERC3000Data.Config config);
}
```

## Rationale

The authors believe that it is very important that this standard leaves the other open to any resolver mechanism to be implemented and adopted.

That&apos;s why a lot of the function and variable names were left intentionally bogus to be compatible with future resolvers without changing the standard.

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.

## Security Considerations

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.

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 [the following doc](https://github.com/aragon/aragon-court/tree/master/docs/3-cryptoeconomic-considerations).

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.

## Implementations

### 1. Aragon Govern

- [ERC-3000 interface (MIT license)](https://github.com/aragon/govern/blob/master/packages/erc3k)
- [Implementation (GPL-3.0 license)](https://github.com/aragon/govern/blob/master/packages/govern-core)

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 24 Sep 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3000</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3000</guid>
      </item>
    
      <item>
        <title>Batched meta transactions</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-3005-the-economic-viability-of-batched-meta-transactions/4673</comments>
        
        <description>## Simple Summary

Defines an extension function for ERC-20 (and other fungible token standards), which allows receiving and processing a batch of meta transactions.

## Abstract

This EIP defines a new function called `processMetaBatch()` that extends any fungible token standard, and enables batched meta transactions coming from many senders in one on-chain transaction. 

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.

The function enables senders to make gasless transactions, while reducing the relayer&apos;s gas cost due to batching.

## Motivation

Meta transactions have proven useful as a solution for Ethereum accounts that don&apos;t have any ether, but hold ERC-20 tokens and would like to transfer them (gasless transactions).

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 **multiple** senders.

The motivation behind this EIP is to find a way to allow relaying batched meta transactions from **many senders** in **one on-chain transaction**, which also **reduces the total gas cost** that a relayer needs to cover.

![](../assets/eip-3005/meta-txs-directly-to-token-smart-contract.png)

## Specification

The key words &quot;MUST&quot;, &quot;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.

The key words &quot;MUST (BUT WE KNOW YOU WON&apos;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.  

### Meta transaction data

In order to successfully validate and transfer tokens, the `processMetaBatch()` function MUST process the following data about a meta transaction:

- sender address
- receiver address
- token amount
- relayer fee
- a (meta tx) nonce
- an expiration date (this COULD be a block number, or it COULD be a block timestamp)
- a token address
- a relayer address
- a signature

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).

### `processMetaBatch()` function input data

The `processMetaBatch()` function MUST receive the following data:

- sender address
- receiver address
- token amount
- relayer fee
- an expiration date (this COULD be a block number, or it COULD be a block timestamp)
- a signature

The following data is OPTIONAL to be sent to the function, because it can be extracted or derived from other sources:

- a (meta tx) nonce
- a token address
- a relayer address

### Meta transaction data hash

The pseudocode for creating a hash of meta transaction data is the following:

```
keccak256(address(sender)
	   ++ address(recipient)
	   ++ uint256(amount)
	   ++ uint256(relayerFee)
	   ++ uint256(nonce)
	   ++ uint256(expirationDate)
	   ++ address(tokenContract)
	   ++ address(relayer)
)
```

The created hash MUST then be signed with the sender&apos;s private key.

### Validation rules

- 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.
- Sending to and from a 0x0 address MUST be prohibited.
- A meta transaction MUST be processed before the expiration date.
- Each sender&apos;s token balance MUST be equal or greater than the sum of their respective meta transaction token amount and relayer fee.
- 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.

### `processMetaBatch()` function interface

The `processMetaBatch()` function MUST have the following interface:

```solidity
function processMetaBatch(address[] memory senders,
                          address[] memory recipients,
                          uint256[] memory amounts,
                          uint256[] memory relayerFees,
                          uint256[] memory blocks,
                          uint8[] memory sigV,
                          bytes32[] memory sigR,
                          bytes32[] memory sigS) public returns (bool);
```

The overview of parameters that are passed:

- `senders`: an array of meta transaction sender addresses (token senders)
- `recipients `: an array of token recipients addresses
- `amounts`: an array of token amounts that are sent from each sender to each recipient, respectively
- `relayerFees`: an array of the relayer fees paid in tokens by senders. The fee receiver is a relayer (`msg.address`)
- `blocks`: 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)
- `sigV`, `sigR`, `sigS`: three arrays that represent parts of meta transaction signatures

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.

### Meta transaction nonce

The token smart contract must keep track of a meta transaction nonce for each token holder.

```solidity
mapping (address =&gt; uint256) private _metaNonces;
```

The interface for the `nonceOf()` function is the following:

```solidity
function nonceOf(address account) public view returns (uint256);
```

### Token transfers

After a meta transaction is successfully validated, the meta nonce of the meta transaction sender MUST be increased by 1. 

Then two token transfers MUST occur:

- The specified token amount MUST go to the recipient.
- The relayer fee MUST go to the relayer (`msg.sender`).

## Implementation

The **reference implementation** adds a couple of functions to the existing ERC-20 token standard:

- `processMetaBatch()`
- `nonceOf()`

You can see the implementation of both functions in this file: [ERC20MetaBatch.sol](https://github.com/defifuture/erc20-batched-meta-transactions/blob/master/contracts/ERC20MetaBatch.sol). This is an extended ERC-20 contract with added meta transaction batch transfer capabilities.

### `processMetaBatch()`

The `processMetaBatch()` function is responsible for receiving and processing a batch of meta transactions that change token balances.

```solidity
function processMetaBatch(address[] memory senders,
                          address[] memory recipients,
                          uint256[] memory amounts,
                          uint256[] memory relayerFees,
                          uint256[] memory blocks,
                          uint8[] memory sigV,
                          bytes32[] memory sigR,
                          bytes32[] memory sigS) public returns (bool) {
    
    address sender;
    uint256 newNonce;
    uint256 relayerFeesSum = 0;
    bytes32 msgHash;
    uint256 i;

    // loop through all meta txs
    for (i = 0; i &lt; senders.length; i++) {
        sender = senders[i];
        newNonce = _metaNonces[sender] + 1;

        if(sender == address(0) || recipients[i] == address(0)) {
            continue; // sender or recipient is 0x0 address, skip this meta tx
        }

        // the meta tx should be processed until (including) the specified block number, otherwise it is invalid
        if(block.number &gt; blocks[i]) {
            continue; // if current block number is bigger than the requested number, skip this meta tx
        }

        // check if meta tx sender&apos;s balance is big enough
        if(_balances[sender] &lt; (amounts[i] + relayerFees[i])) {
            continue; // if sender&apos;s balance is less than the amount and the relayer fee, skip this meta tx
        }

        // check if the signature is valid
        msgHash = keccak256(abi.encode(sender, recipients[i], amounts[i], relayerFees[i], newNonce, blocks[i], address(this), msg.sender));
        if(sender != ecrecover(keccak256(abi.encodePacked(&quot;\x19Ethereum Signed Message:\n32&quot;, msgHash)), sigV[i], sigR[i], sigS[i])) {
            continue; // if sig is not valid, skip to the next meta tx
        }

        // set a new nonce for the sender
        _metaNonces[sender] = newNonce;

        // transfer tokens
        _balances[sender] -= (amounts[i] + relayerFees[i]);
        _balances[recipients[i]] += amounts[i];
        relayerFeesSum += relayerFees[i];
    }

	// give the relayer the sum of all relayer fees
    _balances[msg.sender] += relayerFeesSum;

    return true;
}
```

### `nonceOf()`

Nonces are needed due to the replay protection (see *Replay attacks* under *Security Considerations*).

```solidity
mapping (address =&gt; uint256) private _metaNonces;

// ...

function nonceOf(address account) public view returns (uint256) {
    return _metaNonces[account];
}
```

The link to the complete implementation (along with gas usage results) is here: [https://github.com/defifuture/erc20-batched-meta-transactions](https://github.com/defifuture/erc20-batched-meta-transactions).

&gt; Note that the OpenZeppelin ERC-20 implementation was used here. Some other implementation may have named the `_balances` mapping differently, which would require minor changes in the `processMetaBatch()` function.

## Rationale

### All-in-one

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.

The `processMetaBatch()` function thus does the job of receiving a batch of meta transactions, validating them, and then transferring tokens from one address to another.

### Function parameters

As you can see, the `processMetaBatch()` function in the reference implementation takes the following parameters:

- an array of **sender addresses** (meta txs senders, not relayers)
- an array of **receiver addresses**
- an array of **amounts**
- an array of **relayer fees** (relayer is `msg.sender`)
- an array of **block numbers** (a due &quot;date&quot; for meta tx to be processed)
- Three arrays that represent parts of a **signature** (v, r, s)

**Each item** in these arrays represents **data of one meta transaction**. That&apos;s why the **correct order** in the arrays is very important.

If a relayer gets the order wrong, the `processMetaBatch()` 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 **skipped**.

### The alternative way of passing meta transaction data into the function

The reference implementation takes parameters as arrays. There&apos;s a separate array for each meta transaction data category (the ones that cannot be deduced or extracted from other sources).

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.

### Why is nonce not one of the parameters in the reference implementation?

Meta nonce is used for constructing a signed hash (see the `msgHash` line where a `keccak256` hash is constructed - you&apos;ll find a nonce there). 

Since a new nonce has to always be bigger than the previous one by exactly 1, there&apos;s no need to include it as a parameter array in the `processMetaBatch()` function, because its value can be deduced.

This also helps avoid the &quot;Stack too deep&quot; error.

### Can EIP-2612 nonces mapping be re-used?

The EIP-2612 (`permit()` function) also requires a nonce mapping. At this point, I&apos;m not sure yet if this mapping should be **re-used** in case a smart contract implements both EIP-3005 and EIP-2612. 

At the first glance, it seems the `nonces` mapping from EIP-2612 could be re-used, but this should be thought through (and tested) for possible security implications.

### Token transfers

Token transfers in the reference implementation could alternatively be done by calling the `_transfer()` 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).

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&apos;000 gas).

## Backwards Compatibility

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).

## Test Cases

Link to tests: [https://github.com/defifuture/erc20-batched-meta-transactions/tree/master/test](https://github.com/defifuture/erc20-batched-meta-transactions/tree/master/test).

## Security Considerations

Here is a list of potential security issues and how are they addressed in this implementation.

### Forging a meta transaction

The solution against a relayer forging a meta transaction is for a user to sign the meta transaction with their private key.

The `processMetaBatch()` function then verifies the signature using `ecrecover()`.

### Replay attacks

The `processMetaBatch()` function is secure against two types of a replay attack:

**Using the same meta transaction twice in the same token smart contract**

A nonce prevents a replay attack where a relayer would send the same meta transaction more than once.

**Using the same meta transaction twice in different token smart contracts**

A token smart contract address must be added into the signed hash (of a meta transaction). 

This address does not need to be sent as a parameter into the `processMetaBatch()` function. Instead, the function uses `address(this)` 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).

### Signature validation

Signing a meta transaction and validating the signature is crucial for this whole scheme to work.

The `processMetaBatch()` function validates a meta transaction signature, and if it&apos;s **invalid**, the meta transaction is **skipped** (but the whole on-chain transaction is **not reverted**).

```solidity
msgHash = keccak256(abi.encode(sender, recipients[i], amounts[i], relayerFees[i], newNonce, blocks[i], address(this), msg.sender));

if(sender != ecrecover(keccak256(abi.encodePacked(&quot;\x19Ethereum Signed Message:\n32&quot;, msgHash)), sigV[i], sigR[i], sigS[i])) {
    continue; // if sig is not valid, skip to the next meta tx
}
```

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.

That said, it is expected of relayers to validate meta transactions in advance before relaying them. That&apos;s why relayers are not entitled to a relayer fee for an invalid meta transaction.

### Malicious relayer forcing a user into over-spending

A malicious relayer could delay sending some user&apos;s meta transaction until the user would decide to make the token transaction on-chain.

After that, the relayer would relay the delayed meta transaction which would mean that the user would have made two token transactions (over-spending).

**Solution:** 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.

```solidity
function processMetaBatch(...
                          uint256[] memory blocks,
                          ...) public returns (bool) {
    
    //...

	// loop through all meta txs
    for (i = 0; i &lt; senders.length; i++) {

        // the meta tx should be processed until (including) the specified block number, otherwise it is invalid
        if(block.number &gt; blocks[i]) {
            continue; // if current block number is bigger than the requested number, skip this meta tx
        }

        //...
```

### Front-running attack

A malicious relayer could scout the Ethereum mempool to steal meta transactions and front-run the original relayer.

**Solution:** The protection that `processMetaBatch()` function uses is that it requires the meta transaction sender to add the relayer&apos;s Ethereum address as one of the values in the hash (which is then signed).

When the `processMetaBatch()` function generates a hash it includes the `msg.sender` address in it:

```solidity
msgHash = keccak256(abi.encode(sender, recipients[i], amounts[i], relayerFees[i], newNonce, blocks[i], address(this), msg.sender));

if(sender != ecrecover(keccak256(abi.encodePacked(&quot;\x19Ethereum Signed Message:\n32&quot;, msgHash)), sigV[i], sigR[i], sigS[i])) {
    continue; // if sig is not valid, skip to the next meta tx
}
```

If the meta transaction was &quot;stolen&quot;, the signature check would fail because the `msg.sender` address would not be the same as the intended relayer&apos;s address.

### A malicious (or too impatient) user sending a meta transaction with the same nonce through multiple relayers at once

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.

**Solution:** Relayers could **share a list of their pending meta transactions** between each other (sort of an info mempool).

The relayers don&apos;t have to fear that someone would steal their respective pending transactions, due to the front-running protection (see above).

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).

At a minimum, relayers need to share this meta transaction data (in order to detect meta transaction collision):

- sender address
- token address
- nonce

### Too big due block number

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.

**One way** 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&apos;000 blocks from the current one (this is around 17 days in the future if we assume 15 seconds block time).

```solidity
// the meta tx should be processed until (including) the specified block number, otherwise it is invalid
if(block.number &gt; blocks[i] || blocks[i] &gt; (block.number + 100000)) {
    // If current block number is bigger than the requested due block number, skip this meta tx.
    // Also skip if the due block number is too big (bigger than 100&apos;000 blocks in the future).
    continue;
}
```

This addition could open new security implications, that&apos;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.

**The other way** is to keep the `processMetaBatch()` function as it is and rather check for the too big due block number **on the relayer level**. 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).

## Copyright

Copyright and related rights are waived via [CC0](/LICENSE).</description>
        <pubDate>Fri, 25 Sep 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3005</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3005</guid>
      </item>
    
      <item>
        <title>Transfer With Authorization</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-3009-transfer-with-authorization/25698</comments>
        
        <description>## Abstract

A set of functions to enable meta-transactions and atomic interactions with [ERC-20](./eip-20.md) token contracts via signatures conforming to the [EIP-712](./eip-712.md) typed message signing specification.

This enables the user to:

- delegate the gas payment to someone else,
- pay gas in the token itself rather than in ETH,
- perform one or more token transfers and other operations in a single atomic transaction,
- transfer ERC-20 tokens to another address, and have the recipient submit the transaction,
- batch multiple transactions with minimal overhead, and
- create and perform multiple transactions without having to worry about them failing due to accidental nonce-reuse or improper ordering by the miner.

Please note that this ERC does not apply to smart contract accounts, as the `transfer` and `approve`/`transferFrom` functions from the ERC-20 standards can directly be used.

&lt;!-- TODO (Editor&apos;s note): we don&apos;t permit links outside of the EIP/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://www.x402.org/) standard.

--&gt;

## Motivation

There is an existing spec, [ERC-2612](./eip-2612.md), 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:

- ERC-2612 uses sequential nonces, but this uses random 32-byte nonces, and that
- ERC-2612 relies on the ERC-20 `approve`/`transferFrom` (&quot;ERC-20 allowance&quot;) pattern.

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:

- DApps may unintentionally reuse nonces that have not yet been processed in the blockchain.
- Miners may process the transactions in the incorrect order.

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.

The ERC-20 allowance mechanism is susceptible to the &lt;!-- TODO (Editor&apos;s note): same note as above.
[multiple withdrawal attack](https://blockchain-projects.readthedocs.io/multiple_withdrawal.html) --&gt;/&lt;!-- TODO (Editor&apos;s note): you can copy the SWC into your assets directory because it&apos;s MIT licensed. [SWC-114](https://swcregistry.io/docs/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.

The deficiencies of the ERC-20 allowance pattern brought about the development of alternative token standards such as the [ERC-777](./eip-777.md) and &lt;!-- TODO (Editor&apos;s note): if you&apos;d like to link to ERC-677, you&apos;ll need to pull request it into the repository (i.e. upgrade it) [ERC-677](https://github.com/ethereum/EIPs/issues/677) --&gt;. However, they haven&apos;t been able to gain much adoption due to compatibility and potential security issues.

## Specification

### Event

```solidity
event AuthorizationUsed(
    address indexed authorizer,
    bytes32 indexed nonce
);

// keccak256(&quot;TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&quot;)
bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;

// keccak256(&quot;ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&quot;)
bytes32 public constant RECEIVE_WITH_AUTHORIZATION_TYPEHASH = 0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8;

/**
 * @notice Returns the state of an authorization
 * @dev Nonces are randomly generated 32-byte data unique to the authorizer&apos;s
 * address
 * @param authorizer    Authorizer&apos;s address
 * @param nonce         Nonce of the authorization
 * @return True if the nonce is used
 */
function authorizationState(
    address authorizer,
    bytes32 nonce
) external view returns (bool);

/**
 * @notice Execute a transfer with a signed authorization
 * @param from          Payer&apos;s address (Authorizer)
 * @param to            Payee&apos;s address
 * @param value         Amount to be transferred
 * @param validAfter    The time after which this is valid (unix time)
 * @param validBefore   The time before which this is valid (unix time)
 * @param nonce         Unique nonce
 * @param v             v of the signature
 * @param r             r of the signature
 * @param s             s of the signature
 */
function transferWithAuthorization(
    address from,
    address to,
    uint256 value,
    uint256 validAfter,
    uint256 validBefore,
    bytes32 nonce,
    uint8 v,
    bytes32 r,
    bytes32 s
) external;

/**
 * @notice Receive a transfer with a signed authorization from the payer
 * @dev This has an additional check to ensure that the payee&apos;s address matches
 * the caller of this function to prevent front-running attacks. (See security
 * considerations)
 * @param from          Payer&apos;s address (Authorizer)
 * @param to            Payee&apos;s address
 * @param value         Amount to be transferred
 * @param validAfter    The time after which this is valid (unix time)
 * @param validBefore   The time before which this is valid (unix time)
 * @param nonce         Unique nonce
 * @param v             v of the signature
 * @param r             r of the signature
 * @param s             s of the signature
 */
function receiveWithAuthorization(
    address from,
    address to,
    uint256 value,
    uint256 validAfter,
    uint256 validBefore,
    bytes32 nonce,
    uint8 v,
    bytes32 r,
    bytes32 s
) external;
```

**Optional:**

```
event AuthorizationCanceled(
    address indexed authorizer,
    bytes32 indexed nonce
);

// keccak256(&quot;CancelAuthorization(address authorizer,bytes32 nonce)&quot;)
bytes32 public constant CANCEL_AUTHORIZATION_TYPEHASH = 0x158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a1597429;

/**
 * @notice Attempt to cancel an authorization
 * @param authorizer    Authorizer&apos;s address
 * @param nonce         Nonce of the authorization
 * @param v             v of the signature
 * @param r             r of the signature
 * @param s             s of the signature
 */
function cancelAuthorization(
    address authorizer,
    bytes32 nonce,
    uint8 v,
    bytes32 r,
    bytes32 s
) external;
```


The arguments `v`, `r`, and `s` must be obtained using the [EIP-712](./eip-712.md) typed message signing spec.

**Example:**

```
DomainSeparator := Keccak256(ABIEncode(
  Keccak256(
    &quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&quot;
  ),
  Keccak256(&quot;USD Coin&quot;),                      // name
  Keccak256(&quot;2&quot;),                             // version
  1,                                          // chainId
  0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48  // verifyingContract
))
```

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&apos;s private key.

**Example:**

```
// Transfer With Authorization
TypeHash := Keccak256(
  &quot;TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&quot;
)
Params := { From, To, Value, ValidAfter, ValidBefore, Nonce }

// ReceiveWithAuthorization
TypeHash := Keccak256(
  &quot;ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&quot;
)
Params := { From, To, Value, ValidAfter, ValidBefore, Nonce }

// CancelAuthorization
TypeHash := Keccak256(
  &quot;CancelAuthorization(address authorizer,bytes32 nonce)&quot;
)
Params := { Authorizer, Nonce }
```

```
// &quot;‖&quot; denotes concatenation.
Digest := Keccak256(
  0x1901 ‖ DomainSeparator ‖ Keccak256(ABIEncode(TypeHash, Params...))
)

{ v, r, s } := Sign(Digest, PrivateKey)
```

Smart contract functions that wrap `receiveWithAuthorization` call may choose to reduce the number of arguments by accepting the full ABI-encoded set of arguments for the `receiveWithAuthorization` call as a single argument of the type `bytes`.

**Example:**

```solidity
// keccak256(&quot;receiveWithAuthorization(address,address,uint256,uint256,uint256,bytes32,uint8,bytes32,bytes32)&quot;)[0:4]
bytes4 private constant _RECEIVE_WITH_AUTHORIZATION_SELECTOR = 0xef55bec6;

function deposit(address token, bytes calldata receiveAuthorization)
    external
    nonReentrant
{
    (address from, address to, uint256 amount) = abi.decode(
        receiveAuthorization[0:96],
        (address, address, uint256)
    );
    require(to == address(this), &quot;Recipient is not this contract&quot;);

    (bool success, ) = token.call(
        abi.encodePacked(
            _RECEIVE_WITH_AUTHORIZATION_SELECTOR,
            receiveAuthorization
        )
    );
    require(success, &quot;Failed to transfer tokens&quot;);

    ...
}
```

### Use with web3 providers

The signature for an authorization can be obtained using a web3 provider with the `eth_signTypedData{_v4}` method.

**Example:**

```javascript
const data = {
  types: {
    EIP712Domain: [
      { name: &quot;name&quot;, type: &quot;string&quot; },
      { name: &quot;version&quot;, type: &quot;string&quot; },
      { name: &quot;chainId&quot;, type: &quot;uint256&quot; },
      { name: &quot;verifyingContract&quot;, type: &quot;address&quot; },
    ],
    TransferWithAuthorization: [
      { name: &quot;from&quot;, type: &quot;address&quot; },
      { name: &quot;to&quot;, type: &quot;address&quot; },
      { name: &quot;value&quot;, type: &quot;uint256&quot; },
      { name: &quot;validAfter&quot;, type: &quot;uint256&quot; },
      { name: &quot;validBefore&quot;, type: &quot;uint256&quot; },
      { name: &quot;nonce&quot;, type: &quot;bytes32&quot; },
    ],
  },
  domain: {
    name: tokenName,
    version: tokenVersion,
    chainId: selectedChainId,
    verifyingContract: tokenAddress,
  },
  primaryType: &quot;TransferWithAuthorization&quot;,
  message: {
    from: userAddress,
    to: recipientAddress,
    value: amountBN.toString(10),
    validAfter: 0,
    validBefore: Math.floor(Date.now() / 1000) + 3600, // Valid for an hour
    nonce: Web3.utils.randomHex(32),
  },
};

const signature = await ethereum.request({
  method: &quot;eth_signTypedData_v4&quot;,
  params: [userAddress, JSON.stringify(data)],
});

const v = &quot;0x&quot; + signature.slice(130, 132);
const r = signature.slice(0, 66);
const s = &quot;0x&quot; + signature.slice(66, 130);
```

## Rationale

### Unique Random Nonce, Instead of Sequential Nonce

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:

- 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.
- 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.
- 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)
- 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&apos;t been submitted and confirmed by the network.
- 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.
- 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.

### Valid After and Valid Before

- Relying on relayers to submit transactions for you means you may not have exact control over the timing of transaction submission.
- 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.

### EIP-712

- 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.
- 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 `verifyingContract` and `chainId` are included.

## Backwards Compatibility

New contracts benefit from being able to directly utilize [ERC-3009](./eip-3009.md) in order to create atomic transactions, but existing contracts may still rely on the conventional ERC-20 allowance pattern (`approve`/`transferFrom`).

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:

1. Extract the user and deposit amount from the authorization
2. Call `receiveWithAuthorization` to transfer specified funds from the user to the forwarder
3. Approve the parent contract to spend funds from the forwarder
4. Call the method on the parent contract that spends the allowance set from the forwarder
5. Transfer the ownership of any resulting tokens back to the user

**Example:**

```solidity
interface IDeFiToken {
    function deposit(uint256 amount) external returns (uint256);

    function transfer(address account, uint256 amount)
        external
        returns (bool);
}

contract DepositForwarder {
    bytes4 private constant _RECEIVE_WITH_AUTHORIZATION_SELECTOR = 0xef55bec6;

    IDeFiToken private _parent;
    IERC20 private _token;

    constructor(IDeFiToken parent, IERC20 token) public {
        _parent = parent;
        _token = token;
    }

    function deposit(bytes calldata receiveAuthorization)
        external
        nonReentrant
        returns (uint256)
    {
        (address from, address to, uint256 amount) = abi.decode(
            receiveAuthorization[0:96],
            (address, address, uint256)
        );
        require(to == address(this), &quot;Recipient is not this contract&quot;);

        (bool success, ) = address(_token).call(
            abi.encodePacked(
                _RECEIVE_WITH_AUTHORIZATION_SELECTOR,
                receiveAuthorization
            )
        );
        require(success, &quot;Failed to transfer to the forwarder&quot;);

        require(
            _token.approve(address(_parent), amount),
            &quot;Failed to set the allowance&quot;
        );

        uint256 tokensMinted = _parent.deposit(amount);
        require(
            _parent.transfer(from, tokensMinted),
            &quot;Failed to transfer the minted tokens&quot;
        );

        uint256 remainder = _token.balanceOf(address(this));
        if (remainder &gt; 0) {
            require(
                _token.transfer(from, remainder),
                &quot;Failed to refund the remainder&quot;
            );
        }

        return tokensMinted;
    }
}
```

&lt;!-- TODO (Editor&apos;s note): please move your test cases into your assets directory (assuming they&apos;re under a permissive license)
## Test Cases

See [EIP3009.test.ts](https://github.com/CoinbaseStablecoin/eip-3009/blob/master/test/EIP3009.test.ts).
--&gt;

## Reference Implementation

### `EIP3009.sol`

```solidity
abstract contract EIP3009 is IERC20Transfer, EIP712Domain {
    // keccak256(&quot;TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&quot;)
    bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;

    // keccak256(&quot;ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)&quot;)
    bytes32 public constant RECEIVE_WITH_AUTHORIZATION_TYPEHASH = 0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8;

    mapping(address =&gt; mapping(bytes32 =&gt; bool)) internal _authorizationStates;

    event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);

    string internal constant _INVALID_SIGNATURE_ERROR = &quot;EIP3009: invalid signature&quot;;

    function authorizationState(address authorizer, bytes32 nonce)
        external
        view
        returns (bool)
    {
        return _authorizationStates[authorizer][nonce];
    }

    function transferWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        require(now &gt; validAfter, &quot;EIP3009: authorization is not yet valid&quot;);
        require(now &lt; validBefore, &quot;EIP3009: authorization is expired&quot;);
        require(
            !_authorizationStates[from][nonce],
            &quot;EIP3009: authorization is used&quot;
        );

        bytes memory data = abi.encode(
            TRANSFER_WITH_AUTHORIZATION_TYPEHASH,
            from,
            to,
            value,
            validAfter,
            validBefore,
            nonce
        );
        require(
            EIP712.recover(DOMAIN_SEPARATOR, v, r, s, data) == from,
            &quot;EIP3009: invalid signature&quot;
        );

        _authorizationStates[from][nonce] = true;
        emit AuthorizationUsed(from, nonce);

        _transfer(from, to, value);
    }
}
```

### `IERC20Transfer.sol`

```solidity
abstract contract IERC20Transfer {
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual;
}
```

### `EIP712Domain.sol`

```solidity
abstract contract EIP712Domain {
    bytes32 public DOMAIN_SEPARATOR;
}
```

### `EIP712.sol`

```solidity
library EIP712 {
    // keccak256(&quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&quot;)
    bytes32 public constant EIP712_DOMAIN_TYPEHASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;

    function makeDomainSeparator(string memory name, string memory version)
        internal
        view
        returns (bytes32)
    {
        uint256 chainId;
        assembly {
            chainId := chainid()
        }

        return
            keccak256(
                abi.encode(
                    EIP712_DOMAIN_TYPEHASH,
                    keccak256(bytes(name)),
                    keccak256(bytes(version)),
                    chainId,
                    address(this)
                )
            );
    }

    function recover(
        bytes32 domainSeparator,
        uint8 v,
        bytes32 r,
        bytes32 s,
        bytes memory typeHashAndData
    ) internal pure returns (address) {
        bytes32 digest = keccak256(
            abi.encodePacked(
                &quot;\x19\x01&quot;,
                domainSeparator,
                keccak256(typeHashAndData)
            )
        );
        address recovered = ecrecover(digest, v, r, s);
        require(recovered != address(0), &quot;EIP712: invalid signature&quot;);
        return recovered;
    }
}
```

A fully working implementation of ERC-3009 can be found in [this repository](../assets/eip-3009/ERC3009.sol). The repository also includes [an implementation of ERC-2612](../assets/eip-3009/ERC2612.sol) that uses the EIP-712 library code presented above.

## Security Considerations

Use `receiveWithAuthorization` instead of `transferWithAuthorization` 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 `transferWithAuthorization` call to execute the transfer without invoking the wrapper function. This could potentially result in unprocessed, locked up deposits. `receiveWithAuthorization` 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.

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.

The zero address must be rejected when `ecrecover` is used to prevent unauthorized transfers and approvals of funds from the zero address. The built-in `ecrecover` returns the zero address when a malformed signature is provided.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 28 Sep 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3009</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3009</guid>
      </item>
    
      <item>
        <title>Exclusive Claimable Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/3132</comments>
        
        <description>## Simple Summary

This standard defines a token which can be claimed only by token issuer with payer&apos;s signature.

## Abstract

This EIP defines a set of additions to the default token standard such as ERC-20, that allows online/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.

## Motivation

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.

Many small businesses want to build payment system based on blockchain but find it difficult. There are basically two ways: 

1. Directly pay with token. There are many wallet can receive and transfer token but transactions on Ethereum cost gas and take time to confirm.
2. 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/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.

This EIP helps to standardize the interactions of micropayment system, and make it possible for wallet build a universal UI in the future.

## Specification

```solidity

/// @return Image url of this token or descriptive resources
function iconUrl() external view returns (string memory);

/// @return Issuer of this token. Only issuer can execute claim function
function issuer() external view returns (address);

/**
 *  @notice   Remove consumption from payer&apos;s deposite
 *  @dev      Check if msg.sender == issuer
 *  @param    from          Payer&apos;s address
 *  @param    consumption   How many token is consumed in this epoch, specified
 *  @param    epoch         Epoch increased by 1 after claim or withdraw, at the beginning of each epoch, consumption goes back to 0
 *  @param    signature     Signature of payment message signed by payer
*/
function claim(address from, uint256 consumption, uint256 epoch, bytes calldata signature) external;

function transferIssuer(address newIssuer) external;

/// @notice   Move amount from payer&apos;s token balance to deposite balance to ensure payment is sufficient
function deposit(uint256 amount) external;

/**
 *  @notice   Give remaining deposite balance back to &quot;to&quot; account, act as &quot;refund&quot; function
 *  @dev      In prepayment module, withdraw is executed from issuer account
 *            In lock-release module, withdraw is executed from user account
 *  @param    to            the account receiving remaining deposite
 *  @param    amount        how many token is returned
*/
function withdraw(address to, uint256 amount) external;

function depositBalanceOf(address user) external view returns(uint256 depositBalance, uint256 epoch);

event Deposit(
    address indexed from,
    uint256 amount
);

event Withdraw(
    address indexed to,
    uint256 amount
);
    
event TransferIssuer(
    address indexed oldIssuer,
    address indexed newIssuer
);

event Claim(
    address indexed from,
    address indexed to,
    uint256 epoch,
    uint256 consumption
);

```

### signature

the pseudo code generating an ECDSA signature:
```
sign(keccak256(abi_encode(
    &quot;\x19Ethereum Signed Message:\n32&quot;, 
        keccak256(abi_encode(
            token_address,
            payer_address,
            token_issuer,
            token_consumption,        //calculated by user client
            epoch
        ))
    ))
,private_key)

```

### verification process

the verification contains check about both signature and token_consumption

the pseudo code run by verification server is as follows:

```

serving_loop:

    for {
        /**
         * unpaied_consumption is calculated by provider
         * signed_consumption is claimable amount
         * tolerance allows payer &quot;owes&quot; provider to a certain degree
        */
        //getSignedConsumption returns amount that are already claimable 
        if(unpaied_consumption &lt;  signed_consumption + tolerance){
            informUser(&quot;user need charge&quot;, unpaied_consumption)
            interruptService() 
        }else{
            isServing() || recoverService()
        }
    }

verification_loop:

    for {
        message = incomingMessage()
        if(recover_signer(message, signature) != payer_address){
            informUser(&quot;check signature failed&quot;, hash(message))
            continue
        }

        /**
        * optional: when using echo server to sync messages between verification servers
        * more info about this in Security Considerations section
        */
        if(query(message) != message){
            informUser(&quot;message outdate&quot;, hash(message))
            continue   
        }

        if(epoch != message.epoch || message.consumption &gt; getDepositBalance()){
            informUser(&quot;invalid message&quot;, epoch, unpaied_consumption)
            continue
        }
       
        signed_consumption = message.consumption
        save(message)
    }
    
claim_process:

    if(claim()){
        unpaied_consumption -= signed_consumption
        signed_consumption = 0
        epoch+=1
    }

```
### About withdraw

The withdraw function is slightly different based on business models

1. prepayment model

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.

2. lock-release model

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&apos;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&apos;t change in a month.

## Rationale

This EIP targets on ERC-20 tokens due to its widespread adoption. However, this extension is designed to be compatible with other token standard.

The reason we chose to implement those functions in token contract rather than a separate record contract is as follows:
- Token can transfer is more convenient and more general than interact with DApp
- Token is more standardized and has better UI support
- Token is equal to service, make token economy more prosperous
- Remove the approve process

## Backwards Compatibility

This EIP is fully backwards compatible as its implementation extends the functionality of [ERC-20](./eip-20.md).

## Implementation

```solidity

mapping (address =&gt; StampBalance) private _depositBalance;
    
struct StampBalance{
    uint256 balance;
    uint256 epoch;
}
    
function deposit(uint256 value) override external{
    require(value &lt;= _balances[msg.sender]);
    _balances[msg.sender] = _balances[msg.sender].sub(value);
    _depositBalance[msg.sender].balance = _depositBalance[msg.sender].balance.add(value);
    emit Deposit(msg.sender, value);
}

function withdraw(address to, uint256 value) override onlyIssuer external{
    require(value &lt;= _depositBalance[to].balance);
    _depositBalance[to].balance = _depositBalance[to].balance.sub(value);
    _depositBalance[to].epoch += 1;
    _balances[to] = _balances[to].add(value);
    emit Withdraw(to, value);
}
    
function depositBalanceOf(address user) override public view returns(uint256 depositBalance, uint256 epoch){
    return (_depositBalance[user].balance, _depositBalance[user].epoch);
}

// prepayment model
function claim(address from, uint credit, uint epoch, bytes memory signature) override onlyIssuer external{
    require(credit &gt; 0);
    require(_depositBalance[from].epoch + 1 == epoch);
    require(_depositBalance[from].balance &gt;= credit);
    bytes32 message = keccak256(abi.encode(this, from, _issuer, credit, epoch));
    bytes32 msgHash = prefixed(message);
    require(recoverSigner(msgHash, signature) == from);
    _depositBalance[from].balance = _depositBalance[from].balance.sub(credit);
    _balances[_issuer] = _balances[_issuer].add(credit);
    _depositBalance[from].epoch += 1;
    emit Claim(from, msg.sender, credit, epoch);
}

function prefixed(bytes32 hash) internal pure returns (bytes32) {
    return keccak256(abi.encode(&quot;\x19Ethereum Signed Message:\n32&quot;, hash));
}

function recoverSigner(bytes32 message, bytes memory sig) internal pure  returns (address) {
    (uint8 v, bytes32 r, bytes32 s) = splitSignature(sig);
    return ecrecover(message, v, r, s);
}

function splitSignature(bytes memory sig) internal pure returns (uint8 v, bytes32 r, bytes32 s) {
    require(sig.length == 65);
    assembly {
        r := mload(add(sig, 32))
        s := mload(add(sig, 64))
        v := byte(0, mload(add(sig, 96)))
    }
    return (v, r, s);
}

```

## Security Considerations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).</description>
        <pubDate>Mon, 10 Aug 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3135</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3135</guid>
      </item>
    
      <item>
        <title>Flash Loans</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-3156-flash-loans-review-discussion/5077</comments>
        
        <description>## Simple Summary

This ERC provides standard interfaces and processes for single-asset flash loans.

## Abstract

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.

## Motivation

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.

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.

Some of the high level differences in the approaches across the protocols include:
- 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.
- 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.
- Some lenders offer a single entry point into the protocol regardless of whether you&apos;re buying, selling, depositing or chaining them together as a flash loan, whereas other protocols offer discrete entry points.
- 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.

## Specification

A flash lending feature integrates two smart contracts using a callback pattern. These are called the LENDER and the RECEIVER in this EIP.

### Lender Specification

A `lender` MUST implement the IERC3156FlashLender interface.
```
pragma solidity ^0.7.0 || ^0.8.0;
import &quot;./IERC3156FlashBorrower.sol&quot;;


interface IERC3156FlashLender {

    /**
     * @dev The amount of currency available to be lent.
     * @param token The loan currency.
     * @return The amount of `token` that can be borrowed.
     */
    function maxFlashLoan(
        address token
    ) external view returns (uint256);

    /**
     * @dev The fee to be charged for a given loan.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @return The amount of `token` to be charged for the loan, on top of the returned principal.
     */
    function flashFee(
        address token,
        uint256 amount
    ) external view returns (uint256);

    /**
     * @dev Initiate a flash loan.
     * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @param data Arbitrary data structure, intended to contain user-defined parameters.
     */
    function flashLoan(
        IERC3156FlashBorrower receiver,
        address token,
        uint256 amount,
        bytes calldata data
    ) external returns (bool);
}
```

The `maxFlashLoan` function MUST return the maximum loan possible for `token`. If a `token` is not currently supported `maxFlashLoan` MUST return 0, instead of reverting.

The `flashFee` function MUST return the fee charged for a loan of `amount` `token`. If the token is not supported `flashFee` MUST revert.

The `flashLoan` function MUST include a callback to the `onFlashLoan` function in a `IERC3156FlashBorrower` contract.

```
function flashLoan(
    IERC3156FlashBorrower receiver,
    address token,
    uint256 amount,
    bytes calldata data
) external returns (bool) {
  ...
  require(
      receiver.onFlashLoan(msg.sender, token, amount, fee, data) == keccak256(&quot;ERC3156FlashBorrower.onFlashLoan&quot;),
      &quot;IERC3156: Callback failed&quot;
  );
  ...
}
```

The `flashLoan` function MUST transfer `amount` of `token` to `receiver` before the callback to the receiver.

The `flashLoan` function MUST include `msg.sender` as the `initiator` to `onFlashLoan`.

The `flashLoan` function MUST NOT modify the `token`, `amount` and `data` parameter received, and MUST pass them on to `onFlashLoan`.

The `flashLoan` function MUST include a `fee` argument to `onFlashLoan` with the fee to pay for the loan on top of the principal, ensuring that `fee == flashFee(token, amount)`.

The `lender` MUST verify that the `onFlashLoan` callback returns the keccak256 hash of &quot;ERC3156FlashBorrower.onFlashLoan&quot;.

After the callback, the `flashLoan` function MUST take the `amount + fee` `token` from the `receiver`, or revert if this is not successful.

If successful, `flashLoan` MUST return `true`.

### Receiver Specification

A `receiver` of flash loans MUST implement the IERC3156FlashBorrower interface:

```
pragma solidity ^0.7.0 || ^0.8.0;


interface IERC3156FlashBorrower {

    /**
     * @dev Receive a flash loan.
     * @param initiator The initiator of the loan.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @param fee The additional amount of tokens to repay.
     * @param data Arbitrary data structure, intended to contain user-defined parameters.
     * @return The keccak256 hash of &quot;ERC3156FlashBorrower.onFlashLoan&quot;
     */
    function onFlashLoan(
        address initiator,
        address token,
        uint256 amount,
        uint256 fee,
        bytes calldata data
    ) external returns (bytes32);
}
```

For the transaction to not revert, `receiver` MUST approve `amount + fee` of `token` to be taken by `msg.sender` before the end of `onFlashLoan`.

If successful, `onFlashLoan` MUST return the keccak256 hash of &quot;ERC3156FlashBorrower.onFlashLoan&quot;.

## Rationale

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.

`flashFee` reverts on unsupported tokens, because returning a numerical value would be incorrect.

`flashLoan` 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.

`receiver` is taken as a parameter to allow flexibility on the implementation of separate loan initiators and receivers.

Existing flash lenders all provide flash loans of several token types from the same contract. Providing a `token` parameter in both the `flashLoan` and `onFlashLoan` functions matches closely the observed functionality.

A `bytes calldata data` parameter is included for the caller to pass arbitrary information to the `receiver`, without impacting the utility of the `flashLoan` standard.

`onFlashLoan` has been chosen as a function name as descriptive enough, unlikely to clash with other functions in the `receiver`, and following the `onAction` naming pattern used as well in EIP-667.

A `initiator` will often be required in the `onFlashLoan` function, which the lender knows as `msg.sender`. An alternative implementation which would embed the `initiator` in the `data` parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.

The `amount` will be required in the `onFlashLoan` function, which the lender took as a parameter. An alternative implementation which would embed the `amount` in the `data` parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.

A `fee` will often be calculated in the `flashLoan` function, which the `receiver` must be aware of for repayment. Passing the `fee` as a parameter instead of appended to `data` is simple and effective.

The `amount + fee` are pulled from the `receiver` to allow the `lender` to implement other features that depend on using `transferFrom`, without having to lock them for the duration of a flash loan. An alternative implementation where the repayment is transferred to the `lender` is also possible, but would need all other features in the lender to be also based in using `transfer` instead of `transferFrom`. Given the lower complexity and prevalence of a &quot;pull&quot; architecture over a &quot;push&quot; architecture, &quot;pull&quot; was chosen.

## Backwards Compatibility

No backwards compatibility issues identified.

## Implementation

### Flash Borrower Reference Implementation

```
pragma solidity ^0.8.0;

import &quot;./interfaces/IERC20.sol&quot;;
import &quot;./interfaces/IERC3156FlashBorrower.sol&quot;;
import &quot;./interfaces/IERC3156FlashLender.sol&quot;;


contract FlashBorrower is IERC3156FlashBorrower {
    enum Action {NORMAL, OTHER}

    IERC3156FlashLender lender;

    constructor (
        IERC3156FlashLender lender_
    ) {
        lender = lender_;
    }

    /// @dev ERC-3156 Flash loan callback
    function onFlashLoan(
        address initiator,
        address token,
        uint256 amount,
        uint256 fee,
        bytes calldata data
    ) external override returns(bytes32) {
        require(
            msg.sender == address(lender),
            &quot;FlashBorrower: Untrusted lender&quot;
        );
        require(
            initiator == address(this),
            &quot;FlashBorrower: Untrusted loan initiator&quot;
        );
        (Action action) = abi.decode(data, (Action));
        if (action == Action.NORMAL) {
            // do one thing
        } else if (action == Action.OTHER) {
            // do another
        }
        return keccak256(&quot;ERC3156FlashBorrower.onFlashLoan&quot;);
    }

    /// @dev Initiate a flash loan
    function flashBorrow(
        address token,
        uint256 amount
    ) public {
        bytes memory data = abi.encode(Action.NORMAL);
        uint256 _allowance = IERC20(token).allowance(address(this), address(lender));
        uint256 _fee = lender.flashFee(token, amount);
        uint256 _repayment = amount + _fee;
        IERC20(token).approve(address(lender), _allowance + _repayment);
        lender.flashLoan(this, token, amount, data);
    }
}
```

### Flash Mint Reference Implementation

```
pragma solidity ^0.8.0;

import &quot;../ERC20.sol&quot;;
import &quot;../interfaces/IERC20.sol&quot;;
import &quot;../interfaces/IERC3156FlashBorrower.sol&quot;;
import &quot;../interfaces/IERC3156FlashLender.sol&quot;;


/**
 * @author Alberto Cuesta Cañada
 * @dev Extension of {ERC20} that allows flash minting.
 */
contract FlashMinter is ERC20, IERC3156FlashLender {

    bytes32 public constant CALLBACK_SUCCESS = keccak256(&quot;ERC3156FlashBorrower.onFlashLoan&quot;);
    uint256 public fee; //  1 == 0.01 %.

    /**
     * @param fee_ The percentage of the loan `amount` that needs to be repaid, in addition to `amount`.
     */
    constructor (
        string memory name,
        string memory symbol,
        uint256 fee_
    ) ERC20(name, symbol) {
        fee = fee_;
    }

    /**
     * @dev The amount of currency available to be lent.
     * @param token The loan currency.
     * @return The amount of `token` that can be borrowed.
     */
    function maxFlashLoan(
        address token
    ) external view override returns (uint256) {
        return type(uint256).max - totalSupply();
    }

    /**
     * @dev The fee to be charged for a given loan.
     * @param token The loan currency. Must match the address of this contract.
     * @param amount The amount of tokens lent.
     * @return The amount of `token` to be charged for the loan, on top of the returned principal.
     */
    function flashFee(
        address token,
        uint256 amount
    ) external view override returns (uint256) {
        require(
            token == address(this),
            &quot;FlashMinter: Unsupported currency&quot;
        );
        return _flashFee(token, amount);
    }

    /**
     * @dev Loan `amount` tokens to `receiver`, and takes it back plus a `flashFee` after the ERC3156 callback.
     * @param receiver The contract receiving the tokens, needs to implement the `onFlashLoan(address user, uint256 amount, uint256 fee, bytes calldata)` interface.
     * @param token The loan currency. Must match the address of this contract.
     * @param amount The amount of tokens lent.
     * @param data A data parameter to be passed on to the `receiver` for any custom use.
     */
    function flashLoan(
        IERC3156FlashBorrower receiver,
        address token,
        uint256 amount,
        bytes calldata data
    ) external override returns (bool){
        require(
            token == address(this),
            &quot;FlashMinter: Unsupported currency&quot;
        );
        uint256 fee = _flashFee(token, amount);
        _mint(address(receiver), amount);
        require(
            receiver.onFlashLoan(msg.sender, token, amount, fee, data) == CALLBACK_SUCCESS,
            &quot;FlashMinter: Callback failed&quot;
        );
        uint256 _allowance = allowance(address(receiver), address(this));
        require(
            _allowance &gt;= (amount + fee),
            &quot;FlashMinter: Repay not approved&quot;
        );
        _approve(address(receiver), address(this), _allowance - (amount + fee));
        _burn(address(receiver), amount + fee);
        return true;
    }

    /**
     * @dev The fee to be charged for a given loan. Internal function with no checks.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @return The amount of `token` to be charged for the loan, on top of the returned principal.
     */
    function _flashFee(
        address token,
        uint256 amount
    ) internal view returns (uint256) {
        return amount * fee / 10000;
    }
}
```

### Flash Loan Reference Implementation

```
pragma solidity ^0.8.0;

import &quot;../interfaces/IERC20.sol&quot;;
import &quot;../interfaces/IERC3156FlashBorrower.sol&quot;;
import &quot;../interfaces/IERC3156FlashLender.sol&quot;;


/**
 * @author Alberto Cuesta Cañada
 * @dev Extension of {ERC20} that allows flash lending.
 */
contract FlashLender is IERC3156FlashLender {

    bytes32 public constant CALLBACK_SUCCESS = keccak256(&quot;ERC3156FlashBorrower.onFlashLoan&quot;);
    mapping(address =&gt; bool) public supportedTokens;
    uint256 public fee; //  1 == 0.01 %.


    /**
     * @param supportedTokens_ Token contracts supported for flash lending.
     * @param fee_ The percentage of the loan `amount` that needs to be repaid, in addition to `amount`.
     */
    constructor(
        address[] memory supportedTokens_,
        uint256 fee_
    ) {
        for (uint256 i = 0; i &lt; supportedTokens_.length; i++) {
            supportedTokens[supportedTokens_[i]] = true;
        }
        fee = fee_;
    }

    /**
     * @dev Loan `amount` tokens to `receiver`, and takes it back plus a `flashFee` after the callback.
     * @param receiver The contract receiving the tokens, needs to implement the `onFlashLoan(address user, uint256 amount, uint256 fee, bytes calldata)` interface.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @param data A data parameter to be passed on to the `receiver` for any custom use.
     */
    function flashLoan(
        IERC3156FlashBorrower receiver,
        address token,
        uint256 amount,
        bytes calldata data
    ) external override returns(bool) {
        require(
            supportedTokens[token],
            &quot;FlashLender: Unsupported currency&quot;
        );
        uint256 fee = _flashFee(token, amount);
        require(
            IERC20(token).transfer(address(receiver), amount),
            &quot;FlashLender: Transfer failed&quot;
        );
        require(
            receiver.onFlashLoan(msg.sender, token, amount, fee, data) == CALLBACK_SUCCESS,
            &quot;FlashLender: Callback failed&quot;
        );
        require(
            IERC20(token).transferFrom(address(receiver), address(this), amount + fee),
            &quot;FlashLender: Repay failed&quot;
        );
        return true;
    }

    /**
     * @dev The fee to be charged for a given loan.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @return The amount of `token` to be charged for the loan, on top of the returned principal.
     */
    function flashFee(
        address token,
        uint256 amount
    ) external view override returns (uint256) {
        require(
            supportedTokens[token],
            &quot;FlashLender: Unsupported currency&quot;
        );
        return _flashFee(token, amount);
    }

    /**
     * @dev The fee to be charged for a given loan. Internal function with no checks.
     * @param token The loan currency.
     * @param amount The amount of tokens lent.
     * @return The amount of `token` to be charged for the loan, on top of the returned principal.
     */
    function _flashFee(
        address token,
        uint256 amount
    ) internal view returns (uint256) {
        return amount * fee / 10000;
    }

    /**
     * @dev The amount of currency available to be lent.
     * @param token The loan currency.
     * @return The amount of `token` that can be borrowed.
     */
    function maxFlashLoan(
        address token
    ) external view override returns (uint256) {
        return supportedTokens[token] ? IERC20(token).balanceOf(address(this)) : 0;
    }
}

```

## Security Considerations


### Verification of callback arguments

The arguments of `onFlashLoan` 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.

0. No arguments can be assumed to be genuine without some kind of verification. `initiator`, `token` and `amount` refer to a past transaction that might not have happened if the caller of `onFlashLoan` decides to lie. `fee` might be false or calculated incorrectly. `data` might have been manipulated by the caller.
1. To trust that the value of `initiator`, `token`, `amount` and `fee` are genuine a reasonable pattern is to verify that the `onFlashLoan` caller is in a whitelist of verified flash lenders. Since often the caller of `flashLoan` will also be receiving the `onFlashLoan` callback this will be trivial. In all other cases flash lenders will need to be approved if the arguments in `onFlashLoan` are to be trusted.
2. To trust that the value of `data` is genuine, in addition to the check in point 1, it is recommended to verify that the `initiator` belongs to a group of trusted addresses. Trusting the `lender` and the `initiator` is enough to trust that the contents of `data` are genuine.

### Flash lending security considerations

#### Automatic approvals
The safest approach is to implement an approval for `amount+fee` before the `flashLoan` is executed.    

Any `receiver` that keeps an approval for a given `lender` needs to include in `onFlashLoan` a mechanism to verify that the initiator is trusted.

Any `receiver` that includes in `onFlashLoan` the approval for the `lender` to take the `amount + fee` needs to be combined with a mechanism to verify that the initiator is trusted.

If an unsuspecting contract with a non-reverting fallback function, or an EOA, would approve a `lender` implementing ERC3156, and not immediately use the approval, and if the `lender` would not verify the return value of `onFlashLoan`, then the unsuspecting contract or EOA could be drained of funds up to their allowance or balance limit. This would be executed by an `initiator` calling `flashLoan` on the victim. The flash loan would be executed and repaid, plus any fees, which would be accumulated by the `lender`. For this reason, it is important that the `lender` implements the specification in full and reverts if `onFlashLoan` doesn&apos;t return the keccak256 hash for &quot;ERC3156FlashBorrower.onFlashLoan&quot;.

### Flash minting external security considerations

The typical quantum of tokens involved in flash mint transactions will give rise to new innovative attack vectors.

#### Example 1 - interest rate attack
If there exists a lending protocol that offers stable interests rates, but it does not have floor/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:

FreeLoanAttack.sol
1. Flash mint 1 quintillion STAB
2. Deposit the 1 quintillion STAB + $1.5 million worth of ETH collateral
3. The quantum of your total deposit now pushes the stable interest rate down to 0.00001% stable interest rate
4. Borrow 1 million STAB on 0.00001% stable interest rate based on the 1.5M ETH collateral
5. Withdraw and burn the 1 quint STAB to close the original flash mint
6. You now have a 1 million STAB loan that is practically interest free for perpetuity ($0.10 / year in interest)

The key takeaway being the obvious need to implement a flat floor/ceiling rate limit and to rebalance the rate based on short term liquidity changes.

#### Example 2 - arithmetic overflow and underflow
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. 

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.

### Flash minting internal security considerations
    
The coupling of flash minting with business specific features in the same platform can easily lead to unintended consequences.

#### Example - Treasury draining
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:
1. Flash mint from `lender` a very large amount of FOO.
2. Redeem FOO for BAR, causing `lender` to borrow from `underwriter` all the way to its borrowing limit.
3. Trigger a debt rate increase in `underwriter`, making `lender` undercollateralized.
4. Liquidate the `lender` for profit.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 15 Nov 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3156</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3156</guid>
      </item>
    
      <item>
        <title>Described Data</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/3225</comments>
        
        <description>## Abstract

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.


## Motivation

When using an Ethereum Wallet (e.g. MetaMask, Clef, Hardware
Wallets) users must accept and authorize signing messages or
sending transactions.

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.

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.

It does not address malicious contracts which wish to lie, it
only addresses honest contracts that want to make their user&apos;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.


## Specification

The **description string** and **described data** are generated
simultaneously by evaluating the contract
(i.e. the **describer**), passing the **describer inputs** to the 
method:

```solidity
function eipXXXDescribe(bytes describer_inputs) view returns (string description_string, bytes described_data);
```

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.

During evaluation, the `ADDRESS` (i.e. `to`), `CALLER`
(i.e. `from`), `VALUE`, and `GASPRICE` 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
**described messages**, `VALUE` should always be 0.

When executing the bytecode, best efforts should be made to
ensure `BLOCKHASH`, `NUMBER`, `TIMESTAMP` and `DIFFICULTY`
match the `&quot;latest&quot;` block. The `COINBASE` should be the zero
address.

The method may revert, in which case the signing must be aborted.


### New JSON-RPC Methods

Clients which manage private keys should expose additional
methods for interacting with the related accounts.

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.

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.


### Signing Described Messages

```solidity
eth_signDescribedMessage(address, describer, describerInput)
// Result: {
//   description: &quot;text/plain;Hello World&quot;,
//   data: &quot;0x...&quot;, // described data
//   signature: &quot;0x...&quot;
// }
```

Compute the **description string** and **described data** by
evaluating the call to **describer**, with the
**describerInput** passed to the ABI encoded call to
`eipXXXDescription(bytes)`. The `VALUE` during execution must
be 0.

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.

If accepted, the computed **described data** is signed
according to [EIP-191](./eip-191.md), with the *version
byte* of `0x00` and the *version specific data* of describer
address.

That is:

```
0x19   0x00   DESCRIBER_ADDRESS   0xDESCRIBED_DATA
```

The returned result includes the **described data**, allowing
dapps that use parameters computed in the contract to be
available.

### Sending Described Transactions

```solidity
eth_sendDescribedTransaction(address, {
  to: &quot;0x...&quot;,
  value: 1234,
  nonce: 42,
  gas: 42000,
  gasPrice: 9000000000,
  describerInput: &quot;0x1234...&quot;,
})
// Result: {
//   description: &quot;text/plain;Hello World&quot;,
//   transaction: &quot;0x...&quot;, // serialized signed transaction
// }
```

Compute the **description string** and **described data** by
evaluating the call to the **describer** `to`, with the
**describerInput** passed  to the ABI encoded call to
`eipXXXDescription(bytes)`.

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.

If accepted, the transaction data is set to the computed
**described data**, the derived transaction is signed and sent,
and the **description string** and serialized signed
transaction is returned.


### Signing Described Transaction

```solidity
eth_signDescribedTransaction(address, {
  to: &quot;0x...&quot;,
  value: 1234,
  nonce: 42,
  gas: 42000,
  gasPrice: 9000000000,
  describerInput: &quot;0x1234...&quot;,
})
// Result: {
//   description: &quot;text/plain;Hello World&quot;,
//   transaction: &quot;0x...&quot;, // serialized signed transaction
// }
```

Compute the **description string** and **described data** by
evaluating the call to the **describer** `to`, with the
**describerInput** passed  to the ABI encoded call to
`eipXXXDescription(bytes)`.

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.

If accepted, the transaction data is set to the computed
**described data**, the derived transaction is signed (and not
sent) and the **description string** and serialized signed
transaction is returned.

### Description Strings

A **description string** must begin with a mime-type followed
by a semi-colon (`;`). This EIP specifies only the `text/plain`
mime-type, but future EIPs may specify additional types to
enable more rich processing, such as `text/markdown` so that
addresses can be linkable within clients or to enable
multi-locale options, similar to multipart/form-data.


## Rationale

### Meta Description

There have been many attempts to solve this problem, many of
which attempt to examine the encoded transaction data or
message data directly.

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.

Instead this EIP uses an indirect description of the data.

For example, the `commit(bytes32)` method of ENS places a
commitement **hash** on-chain. The hash contains the
**blinded** 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.

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. `commit(hash(name, owner, secret))`).

### Entangling the Contract Address

To prevent data being signed from one contract being used
against another, the contract address is entanlged into
both the transaction (implicitly via the `to` field) and
in messages by the EIP-191 versions specific data.

The use of the zero address is reserved.

### Alternatives

- 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

- 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. 

- 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.

- The signTypedData [EIP-712](./eip-712.md) has many parallels to what this EIP aims to solve

- @TODO: More


## Backwards Compatibility

All signatures for messages are generated using [EIP-191](./eip-191.md)
which had a previously compatible version byte of `0x00`, so
there should be no concerns with backwards compatibility.


## Test Cases

All test cases operate against the published and verified contracts:

- Formatter: Ropsten @ 0x7a89c0521604008c93c97aa76950198bca73d933
- TestFormatter: Ropsten @ 0xab3045aa85cbcabb06ed3f3fe968fa5457727270

The private key used for signing messages and transactions is:

```
privateKey = &quot;0x6283185307179586476925286766559005768394338798750211641949889184&quot;
```


### Messages

**Example: login with signed message**

- sends selector login()
- received data with selector doLogin(bytes32 timestamp)

```
Input:
  Address:         0xab3045AA85cBCaBb06eD3F3FE968fA5457727270
  Describer Input: 0xb34e97e800000000000000000000000000000000000000000000000000000000
  i.e.             encode(
                       [ &quot;bytes4&quot; ],
                       [ SEL(&quot;login()&quot;) ]
                   )

Output:
  Description:     text/plain;Log into ethereum.org?
  Data:            0x14629d78000000000000000000000000000000000000000000000000000000006010d607
  i.e.             encodeWithSelector(&quot;doLogin(bytes32)&quot;, &quot;0x000000000000000000000000000000000000000000000000000000006010d607&quot; ]

Signing:
  Preimage:  0x1900ab3045aa85cbcabb06ed3f3fe968fa545772727014629d78000000000000000000000000000000000000000000000000000000006010d607
  Signature: 0x8b9def29343c85797a580c5cd3607c06e78a53351219f9ba706b9985c1a3c91e702bf678e07f5daf5ef48b3e3cc581202de233904b72cf2c4f7d714ce92075b21c
```

### Transactions

All transaction test cases use the ropsten network (chainId: 3)
and for all unspecified properties use 0.

**Example: ERC-20 transfer**

```
Input:
  Address:            0xab3045AA85cBCaBb06eD3F3FE968fA5457727270
  Describer Input:    0xa9059cbb000000000000000000000000000000000000000000000000000000000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba720000000000000000000000000000000000000000000000002b992b75cbeb6000
  i.e.                encode(
                          [ &quot;bytes4&quot;, &quot;address&quot;, &quot;uint&quot;],
                          [ SEL(&quot;transfer(address,uint256)&quot;), &quot;0x8ba1f109551bD432803012645Ac136ddd64DBA72&quot;, 3.14159e18 ]
                      )
Output:
  Description:        text/plain;Send 3.14159 TOKN to &quot;ricmoose.eth&quot; (0x8ba1f109551bD432803012645Ac136ddd64DBA72)?
  Described Data:     0xa9059cbb0000000000000000000000000000000000000000000000002b992b75cbeb60000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72
  i.e.                encodeWithSelector(&quot;transfer(address,uint256)&quot;, &quot;0x8ba1f109551bD432803012645Ac136ddd64DBA72&quot;, 3.14159e18)

Signing:
  Signed Transaction: 0xf8a280808094ab3045aa85cbcabb06ed3f3fe968fa545772727080b844a9059cbb0000000000000000000000000000000000000000000000002b992b75cbeb60000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba7229a0f33ea492d326ac32d9b7ae203c61bf7cf0ac576fb0cf8be8e4c63dc89c90de12a06c8efb28aaf3b70c032b3bd1edfc664578c49f040cf749bb19b000da56507fb2
```

**Example: ERC-20 approve**

```
Input:
  Address:            0xab3045AA85cBCaBb06eD3F3FE968fA5457727270
  Describer Input:    0x095ea7b3000000000000000000000000000000000000000000000000000000000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba720000000000000000000000000000000000000000000000002b992b75cbeb6000
  i.e.                encode(
                          [ &quot;bytes4&quot;, &quot;address&quot;, &quot;uint&quot;],
                          [ SEL(&quot;approve(address,uint256)&quot;), &quot;0x8ba1f109551bD432803012645Ac136ddd64DBA72&quot;, 3.14159e18 ]
                      )

Output:
  Description:        text/plain;Approve &quot;ricmoose.eth&quot; (0x8ba1f109551bD432803012645Ac136ddd64DBA72) to manage 3.14159 TOKN tokens?
  Described Data:     0xa9059cbb0000000000000000000000000000000000000000000000002b992b75cbeb60000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72
  i.e.                encodeWithSelector(&quot;approve(address,uint256)&quot;, &quot;0x8ba1f109551bD432803012645Ac136ddd64DBA72&quot;, 3.14159e18)

Signing:
  Signed Transaction: 0xf8a280808094ab3045aa85cbcabb06ed3f3fe968fa545772727080b844a9059cbb0000000000000000000000000000000000000000000000002b992b75cbeb60000000000000000000000000008ba1f109551bd432803012645ac136ddd64dba7229a0f33ea492d326ac32d9b7ae203c61bf7cf0ac576fb0cf8be8e4c63dc89c90de12a06c8efb28aaf3b70c032b3bd1edfc664578c49f040cf749bb19b000da56507fb2
```

**Example: ENS commit**

```
Input:
  Address:            0xab3045AA85cBCaBb06eD3F3FE968fA5457727270
  Describer Input:    0x0f0e373f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000e31f43c1d823afaa67a8c5fbb8348176d225a79e65462b0520ef7d3df61b9992ed3bea0c56ead753be7c8b3614e0ce01e4cac41b00000000000000000000000000000000000000000000000000000000000000087269636d6f6f7365000000000000000000000000000000000000000000000000
  i.e.                encode(
                          [ &quot;bytes4&quot;, &quot;string&quot;, &quot;address&quot;, &quot;bytes32&quot;],
                          [ SEL(&quot;commit(string,address,bytes32)&quot;), &quot;ricmoose&quot;, &quot;0xE31f43C1d823AfAA67A8C5fbB8348176d225A79e&quot;, &quot;0x65462b0520ef7d3df61b9992ed3bea0c56ead753be7c8b3614e0ce01e4cac41b&quot; ]
                      )
  
Output:
  Description:        text/plain;Commit to the ENS name &quot;ricmoose.eth&quot; for 0xE31f43C1d823AfAA67A8C5fbB8348176d225A79e?
  Described Data:     0xf14fcbc8e4a4f2bb818545497be34c7ab30e6e87e0001df4ba82e7c8b3f224fbaf255b91
  i.e.                encodeWithSelector(&quot;commit(bytes32)&quot;, makeCommitment(&quot;ricmoose&quot;, &quot;0xE31f43C1d823AfAA67A8C5fbB8348176d225A79e&quot;, &quot;0x65462b0520ef7d3df61b9992ed3bea0c56ead753be7c8b3614e0ce01e4cac41b&quot;))

Signing:
  Signed Transaction: 0xf88180808094ab3045aa85cbcabb06ed3f3fe968fa545772727080a4f14fcbc8e4a4f2bb818545497be34c7ab30e6e87e0001df4ba82e7c8b3f224fbaf255b912aa0a62b41d1ebda584fe84cf8a05f61b429fe4ec361e13c17f30a23281106b38a8da00bcdd896fe758d8f0cfac46445a48f76f5e9fe27790d67c51412cb98a12a0844
```

**Example: WETH mint()**

```
Input:
  Address:            0xab3045AA85cBCaBb06eD3F3FE968fA5457727270
  Describer Input:    0x1249c58b00000000000000000000000000000000000000000000000000000000
  i.e.                encode(
                          [ &quot;bytes4&quot; ],
                          [ SEL(&quot;mint()&quot;) ]
                      )
  Value:              1.23 ether

Output:
  Description:        text/plain;Mint 1.23 WETH (spending 1.23 ether)?
  Described Data:     0x1249c58b
  i.e.                encodeWithSelector(&quot;mint()&quot;)

Signing:
  Signed Transaction: 0xf86980808094ab3045aa85cbcabb06ed3f3fe968fa5457727270881111d67bb1bb0000841249c58b29a012df802e1394a97caab23c15c3a8c931668df4b2d6d604ca23f3f6b836d0aafca0071a2aebef6a9848616b4d618912f2003fb4babde3dba451b5246f866281a654
```

## Reference Implementation

@TODO (consider adding it as one or more files in `../assets/eip-####/`)

I will add examples in Solidity and JavaScript.


## Security Considerations

### Escaping Text

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:

- 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)
- In general, extreme care must be used when rendering HTML; consider the ENS names `&lt;span style=&quot;display:none&quot;&gt;not-&lt;/span&gt;ricmoo.eth` or `&amp;thinsp;ricmoo.eth`, which if rendered without care would appear as `ricmoo.eth`, which it is not
- Other marks which require escaping could be included, such as quotes (`&quot;`), formatting (`\n` (new line), `\f` (form feed), `\t` (tab), any of many non-standard whitespaces), back-slassh (`\`)
- 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 *something*) for code-points outside common planes or common sub-sets within planes
- Homoglyphs attacks
- Right-to-left marks may affect rendering
- Many other things, deplnding on your environment

### Distinguished Signed Data

Applications implementing this EIP to sign message data should
ensure there are no collisions within the data which could
result in ambiguously signed data.

@TODO: Expand on this; compare packed data to ABI encoded data?

### Enumeration

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 &lt; 10ms response could be interpreted as an error.

### Replayablility

Transactions contain an explicit nonce, but signed messages do
not.

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.

In general, when signing messages a nonce often makes sense to
include to prevent the same signed data from being used in the
future.


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 23 Jan 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3224</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3224</guid>
      </item>
    
      <item>
        <title>Batch Flash Loans</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-3234-batch-flash-loans/5271</comments>
        
        <description>## Simple Summary

This ERC provides standard interfaces and processes for multiple-asset flash loans.

## Motivation

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.


## Specification

A batch flash lending feature integrates two smart contracts using a callback pattern. These are called the LENDER and the RECEIVER in this EIP.

### Lender Specification

A `lender` MUST implement the IERC3234BatchFlashLender interface.
```
pragma solidity ^0.7.0 || ^0.8.0;
import &quot;./IERC3234BatchFlashBorrower.sol&quot;;


interface IERC3234BatchFlashLender {

    /**
     * @dev The amount of currency available to be lended.
     * @param tokens The currency for each loan in the batch.
     * @return The maximum amount that can be borrowed for each loan in the batch.
     */
    function maxFlashLoan(
        address[] calldata tokens
    ) external view returns (uint256[]);

    /**
     * @dev The fees to be charged for a given batch loan.
     * @param tokens The loan currencies.
     * @param amounts The amounts of tokens lent.
     * @return The amount of each `token` to be charged for each loan, on top of the returned principal.
     */
    function flashFee(
        address[] calldata tokens,
        uint256[] calldata amounts
    ) external view returns (uint256[]);

    /**
     * @dev Initiate a batch flash loan.
     * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.
     * @param tokens The loan currencies.
     * @param amounts The amount of tokens lent.
     * @param data Arbitrary data structure, intended to contain user-defined parameters.
     */
    function batchFlashLoan(
        IERC3234BatchFlashBorrower receiver,
        address[] calldata tokens,
        uint256[] calldata amounts,
        bytes[] calldata data
    ) external returns (bool);
}
```

The `maxFlashLoan` function MUST return the maximum loan possible for each `token`. If a `token` is not currently supported `maxFlashLoan` MUST return 0, instead of reverting.

The `flashFee` function MUST return the fees charged for each loan of `amount` `token`. If a token is not supported `flashFee` MUST revert.

The `batchFlashLoan` function MUST include a callback to the `onBatchFlashLoan` function in a `IERC3234BatchFlashBorrower` contract.

```
function batchFlashLoan(
    IERC3234BatchFlashBorrower receiver,
    address[] calldata tokens,
    uint256[] calldata amounts,
    bytes calldata data
) external returns (bool) {
  ...
    require(
        receiver.onBatchFlashLoan(
            msg.sender,
            tokens,
            amounts,
            fees,
            data
        ) == keccak256(&quot;ERC3234BatchFlashBorrower.onBatchFlashLoan&quot;),
        &quot;IERC3234: Callback failed&quot;
    );
  ...
}
```

The `batchFlashLoan` function MUST transfer `amounts[i]` of each `tokens[i]` to `receiver` before the callback to the borrower.

The `batchFlashLoan` function MUST include `msg.sender` as the `initiator` to `onBatchFlashLoan`.

The `batchFlashLoan` function MUST NOT modify the `tokens`, `amounts` and `data` parameters received, and MUST pass them on to `onBatchFlashLoan`.

The `lender` MUST verify that the `onBatchFlashLoan` callback returns the keccak256 hash of &quot;ERC3234BatchFlashBorrower.onBatchFlashLoan&quot;.

The `batchFlashLoan` function MUST include a `fees` argument to `onBatchFlashLoan` with the fee to pay for each individual `token` and `amount` lent, ensuring that `fees[i] == flashFee(tokens[i], amounts[i])`.

After the callback, for each `token` in `tokens`, the `batchFlashLoan` function MUST take the `amounts[i] + fees[i]` of `tokens[i]` from the `receiver`, or revert if this is not successful.

If successful, `batchFlashLoan` MUST return `true`.

### Receiver Specification

A `receiver` of flash loans MUST implement the IERC3234BatchFlashBorrower interface:

```
pragma solidity ^0.7.0 || ^0.8.0;


interface IERC3234BatchFlashBorrower {

    /**
     * @dev Receive a flash loan.
     * @param initiator The initiator of the loan.
     * @param tokens The loan currency.
     * @param amounts The amount of tokens lent.
     * @param fees The additional amount of tokens to repay.
     * @param data Arbitrary data structure, intended to contain user-defined parameters.
     * @return The keccak256 hash of &quot;ERC3234BatchFlashBorrower.onBatchFlashLoan&quot;
     */
    function onBatchFlashLoan(
        address initiator,
        address[] calldata tokens,
        uint256[] calldata amounts,
        uint256[] calldata fees,
        bytes calldata data
    ) external returns (bytes32);
}
```

For the transaction to not revert, for each `token` in `tokens`, `receiver` MUST approve `amounts[i] + fees[i]` of `tokens[i]` to be taken by `msg.sender` before the end of `onBatchFlashLoan`.

If successful, `onBatchFlashLoan` MUST return the keccak256 hash of &quot;ERC3156BatchFlashBorrower.onBatchFlashLoan&quot;.

## Rationale

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.

`flashFee` reverts on unsupported tokens, because returning a numerical value would be incorrect.

`batchFlashLoan` 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.

`receiver` is taken as a parameter to allow flexibility on the implementation of separate loan initiators and receivers.

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 `token` parameter in both the `batchFlashLoan` and `onBatchFlashLoan` functions matches closely the observed functionality.

A `bytes calldata data` parameter is included for the caller to pass arbitrary information to the `receiver`, without impacting the utility of the `batchFlashLoan` standard.

`onBatchFlashLoan` has been chosen as a function name as descriptive enough, unlikely to clash with other functions in the `receiver`, and following the `onAction` naming pattern used as well in EIP-667.

An `initiator` will often be required in the `onBatchFlashLoan` function, which the lender knows as `msg.sender`. An alternative implementation which would embed the `initiator` in the `data` parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.

The `amounts` will be required in the `onBatchFlashLoan` function, which the lender took as a parameter. An alternative implementation which would embed the `amounts` in the `data` parameter by the caller would require an additional mechanism for the receiver to verify its accuracy, and is not advisable.

The `fees` will often be calculated in the `batchFlashLoan` function, which the `receiver` must be aware of for repayment. Passing the `fees` as a parameter instead of appended to `data` is simple and effective.

The `amount + fee` are pulled from the `receiver` to allow the `lender` to implement other features that depend on using `transferFrom`, without having to lock them for the duration of a flash loan. An alternative implementation where the repayment is transferred to the `lender` is also possible, but would need all other features in the lender to be also based in using `transfer` instead of `transferFrom`. Given the lower complexity and prevalence of a &quot;pull&quot; architecture over a &quot;push&quot; architecture, &quot;pull&quot; was chosen.

## Security Considerations

### Verification of callback arguments

The arguments of `onBatchFlashLoan` 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.

0. No arguments can be assumed to be genuine without some kind of verification. `initiator`, `tokens` and `amounts` refer to a past transaction that might not have happened if the caller of `onBatchFlashLoan` decides to lie. `fees` might be false or calculated incorrectly. `data` might have been manipulated by the caller.
1. To trust that the value of `initiator`, `tokens`, `amounts` and `fees` are genuine a reasonable pattern is to verify that the `onBatchFlashLoan` caller is in a whitelist of verified flash lenders. Since often the caller of `batchFlashLoan` will also be receiving the `onBatchFlashLoan` callback this will be trivial. In all other cases flash lenders will need to be approved if the arguments in `onBatchFlashLoan` are to be trusted.
2. To trust that the value of `data` is genuine, in addition to the check in point 1, it is recommended that the `receiver` verifies that the `initiator` is in some list of trusted addresses. Trusting the `lender` and the `initiator` is enough to trust that the contents of `data` are genuine.

### Flash lending security considerations

#### Automatic approvals for untrusted borrowers
The safest approach is to implement an approval for `amount+fee` before the `batchFlashLoan` is executed.    

Including in `onBatchFlashLoan` the approval for the `lender` to take the `amount + fee` needs to be combined with a mechanism to verify that the borrower is trusted, such as those described above.

If an unsuspecting contract with a non-reverting fallback function, or an EOA, would approve a `lender` implementing ERC3156, and not immediately use the approval, and if the `lender` would not verify the return value of `onBatchFlashLoan`, then the unsuspecting contract or EOA could be drained of funds up to their allowance or balance limit. This would be executed by a `borrower` calling `batchFlashLoan` on the victim. The flash loan would be executed and repaid, plus any fees, which would be accumulated by the `lender`. For this reason, it is important that the `lender` implements the specification in full and reverts if `onBatchFlashLoan` doesn&apos;t return the keccak256 hash for &quot;ERC3156FlashBorrower.onBatchFlashLoan&quot;.

### Flash minting external security considerations

The typical quantum of tokens involved in flash mint transactions will give rise to new innovative attack vectors.

#### Example 1 - interest rate attack
If there exists a lending protocol that offers stable interests rates, but it does not have floor/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:

FreeLoanAttack.sol
1. Flash mint 1 quintillion DAI
2. Deposit the 1 quintillion DAI + $1.5 million worth of ETH collateral
3. The quantum of your total deposit now pushes the stable interest rate down to 0.00001% stable interest rate
4. Borrow 1 million DAI on 0.00001% stable interest rate based on the 1.5M ETH collateral
5. Withdraw and burn the 1 quint DAI to close the original flash mint
6. You now have a 1 million DAI loan that is practically interest free for perpetuity ($0.10 / year in interest)

The key takeaway being the obvious need to implement a flat floor/ceiling rate limit and to rebalance the rate based on short term liquidity changes.

#### Example 2 - arithmetic overflow and underflow
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. 

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&apos;s SafeMath libraries as a catch-all safety net, however consideration should be given to when it is or isn&apos;t used given the gas tradeoffs.

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.
    

### Flash minting internal security considerations
    
The coupling of flash minting with business specific features in the same platform can easily lead to unintended consequences.

#### Example - Treasury draining
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:
1. Flash mint a very large amount of fyDai.
2. Redeem for Dai as much fyDai as the Yield Protocol collateral would allow.
3. Trigger a stability rate increase with a call to `jug.drip` which would make the Yield Protocol uncollateralized.
4. Liquidate the Yield Protocol CDP vault in MakerDAO.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 31 Jan 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3234</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3234</guid>
      </item>
    
      <item>
        <title>ERC-721 and ERC-1155 to ERC-20 Wrapper</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/3384</comments>
        
        <description>## Simple Summary
A standard interface for contracts that create generic ERC-20 tokens which derive from a pool of unique ERC-721/ERC-1155 tokens.

## Abstract

This standard outlines a smart contract interface to wrap identifiable tokens with fungible tokens. This allows for derivative [ERC-20](./eip-20.md) tokens to be minted by locking the base [ERC-721](./eip-721.md) non-fungible tokens and [ERC-1155](./eip-1155.md) 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.

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.

## Motivation

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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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](https://www.ietf.org/rfc/rfc2119.txt).

**Every IWrapper compliant contract must implement the `IWrapper` and `ERC165` interfaces** :


```solidity
pragma solidity ^0.8.0;

/**
    @title IWrapper Identifiable Token Wrapper Standard
    @dev {Wrapper} refers to any contract implementing this interface.
    @dev {Base} refers to any ERC-721 or ERC-1155 contract. It MAY be the {Wrapper}.
    @dev {Pool} refers to the contract which holds the {Base} tokens. It MAY be the {Wrapper}.
    @dev {Derivative} refers to the ERC-20 contract which is minted/burned by the {Wrapper}. It MAY be the {Wrapper}.
    @dev All uses of &quot;single&quot;, &quot;batch&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.
    @dev 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`.
*/
interface IWrapper /* is ERC165 */ {
    /**
     * @dev MUST emit when a mint occurs where a single {Base} token is received by the {Pool}.
     * The `_from` argument MUST be the address of the account that sent the {Base} token.
     * The `_to` argument MUST be the address of the account that received the {Derivative} token(s).
     * The `_id` argument MUST be the id of the {Base} token transferred.
     * The `_amount` argument MUST be the number of {Base} tokens transferred.
     * The `_value` argument MUST be the number of {Derivative} tokens minted.
     */
    event MintSingle (address indexed _from, address indexed _to, uint256 _id, uint256 _amount, uint256 _value);

    /**
     * @dev MUST emit when a mint occurs where multiple {Base} tokens are received by the {Wrapper}.
     * The `_from` argument MUST be the address of the account that sent the {Base} tokens.
     * The `_to` argument MUST be the address of the account that received the {Derivative} token(s).
     * The `_ids` argument MUST be the list ids of the {Base} tokens transferred.
     * The `_amounts` argument MUST be the list of the numbers of {Base} tokens transferred.
     * The `_value` argument MUST be the number of {Derivative} tokens minted.
     */
    event MintBatch (address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts, uint256 _value);

    /**
     * @dev MUST emit when a burn occurs where a single {Base} token is sent by the {Wrapper}.
     * The `_from` argument MUST be the address of the account that sent the {Derivative} token(s).
     * The `_to` argument MUST be the address of the account that received the {Base} token.
     * The `_id` argument MUST be the id of the {Base} token transferred.
     * The `_amount` argument MUST be the number of {Base} tokens transferred.
     * The `_value` argument MUST be the number of {Derivative} tokens burned.
     */
    event BurnSingle (address indexed _from, address indexed _to, uint256 _id, uint256 _amount, uint256 _value);

    /**
     * @dev MUST emit when a mint occurs where multiple {Base} tokens are sent by the {Wrapper}.
     * The `_from` argument MUST be the address of the account that sent the {Derivative} token(s).
     * The `_to` argument MUST be the address of the account that received the {Base} tokens.
     * The `_ids` argument MUST be the list of ids of the {Base} tokens transferred.
     * The `_amounts` argument MUST be the list of the numbers of {Base} tokens transferred.
     * The `_value` argument MUST be the number of {Derivative} tokens burned.
     */
    event BurnBatch (address indexed _from, address indexed _to, uint256[] _ids, uint256[] _amounts, uint256 _value);

    /**
     * @notice Transfers the {Base} token with `_id` from `msg.sender` to the {Pool} and mints {Derivative} token(s) to `_to`.
     * @param _to       Target address.
     * @param _id       Id of the {Base} token.
     * @param _amount   Amount of the {Base} token.
     *
     * Emits a {MintSingle} event.
     */
    function mint(
        address _to,
        uint256 _id,
        uint256 _amount
    ) external;

    /**
     * @notice Transfers `_amounts[i]` of the {Base} tokens with `_ids[i]` from `msg.sender` to the {Pool} and mints {Derivative} token(s) to `_to`.
     * @param _to       Target address.
     * @param _ids      Ids of the {Base} tokens.
     * @param _amounts  Amounts of the {Base} tokens.
     *
     * Emits a {MintBatch} event.
     */
    function batchMint(
        address _to,
        uint256[] calldata _ids,
        uint256[] calldata _amounts
    ) external;

    /**
     * @notice 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.
     * @param _from     Source address.
     * @param _to       Target address.
     * @param _amount   Amount of the {Base} tokens.
     *
     * Emits either a {BurnSingle} or {BurnBatch} event.
     */
    function burn(
        address _from,
        address _to,
        uint256 _amount
    ) external;

    /**
     * @notice 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.
     * @param _from     Source address.
     * @param _to       Target address.
     * @param _amounts  Amounts of the {Base} tokens.
     *
     * Emits either a {BurnSingle} or {BurnBatch} event.
     */
    function batchBurn(
        address _from,
        address _to,
        uint256[] calldata _amounts
    ) external;

    /**
     * @notice Burns {Derivative} token(s) from `_from` and transfers `_amounts[i]` of the {Base} tokens with `_ids[i]` from the {Pool} to `_to`.
     * @param _from     Source address.
     * @param _to       Target address.
     * @param _id       Id of the {Base} token.
     * @param _amount   Amount of the {Base} token.
     *
     * Emits either a {BurnSingle} or {BurnBatch} event.
     */
    function idBurn(
        address _from,
        address _to,
        uint256 _id,
        uint256 _amount
    ) external;

    /**
     * @notice Burns {Derivative} tokens from `_from` and transfers `_amounts[i]` of the {Base} tokens with `_ids[i]` from the {Pool} to `_to`.
     * @param _from     Source address.
     * @param _to       Target address.
     * @param _ids      Ids of the {Base} tokens.
     * @param _amounts   Amounts of the {Base} tokens.
     *
     * Emits either a {BurnSingle} or {BurnBatch} event.
     */
    function batchIdBurn(
        address _from,
        address _to,
        uint256[] calldata _ids,
        uint256[] calldata _amounts
    ) external;
}
```

## Rationale

### Naming

The ERC-721/ERC-1155 tokens which are pooled are called {Base} tokens. Alternative names include:
- Underlying.
- NFT. However, ERC-1155 tokens may be considered &quot;semi-fungible&quot;.

The ERC-20 tokens which are minted/burned are called {Derivative} tokens. Alternative names include:
- Wrapped.
- Generic.

The function names `mint` and `burn` are borrowed from the minting and burning extensions to ERC-20. Alternative names include:
- `mint`/`redeem` ([NFTX](https://nftx.org))
- `deposit`/`withdraw` ([WrappedKitties](https://wrappedkitties.com/))
- `wrap`/`unwrap` ([MoonCatsWrapped](https://etherscan.io/address/0x7c40c393dc0f283f318791d746d894ddd3693572))

The function names `*idBurn` are chosen to reduce confusion on what is being burned. That is, the {Derivative} tokens are burned in order to redeem the id(s).

The wrapper/pool itself can be called an &quot;Index fund&quot; according to NFTX, or a &quot;DEX&quot; according to [NFT20](https://nft20.io). However, the {NFT20Pair} contract allows for direct NFT-NFT swaps which are out of the scope of this standard.

### Minting
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.

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.

### Burning
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. 
- For burning without specifying the `id`: `burn`, `batchBurn`.
- For burning with specifying the `id`(s): `idBurn`, `batchIdBurn`.

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.

### Pricing
Prices should not be necessarily fixed. therefore, Mint/Burn events MUST include the ERC-20 `_value` minted/burned.

Existing pricing implementations are as follows (measured in base:derivative):
- Equal: Every {Base} costs 1 {Derivative}
    - NFTX
    - Wrapped Kitties
- Proportional
    - NFT20 sets a fixed rate of 100 {Base} tokens per {Derivative} token.
- Variable
    - NFT20 also allows for Dutch auctions when minting.
    - NFTX proposes an additional fee to be paid when targeting the id of the {Base} token.

Due to the variety of pricing implementations, the Mint\* and Burn\* events MUST include the number {Derivative} tokens minted/burned.

### Inheritance
#### ERC-20
The {Wrapper} MAY inherit from {ERC20}, in order to directly call `super.mint` and `super.burn`.
If the {Wrapper} does not inherit from {ERC20}, the {Derivative} contract MUST be limited such that the {Wrapper} has the sole power to `mint`, `burn`, and otherwise change the supply of tokens.

#### ERC721Receiver, ERC1155Receiver
If not inheriting from {ERC721Receiver} and/or {ERC1155Receiver}, the pool MUST be limited such that the base tokens can only be transferred via the Wrapper&apos;s `mint`, `burn`.

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/function may involve multiple tokens, according to the `value` field.

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:
- All parameters named `_amount`, MUST be `1`.
- All parameters named `_amounts` MUST be either an empty list or a list of `1` with the same length as `_ids`.

This keeps a consistent enumeration of tokens along with ERC-1155. Alternative implementations include:
- A common interface with specialized functions. EX: `mintFromERC721`.
- Separate interfaces for each type. EX: `ERC721Wrapper`, `ERC1155Wrapper`.

#### ERC721, ERC1155
The {Wrapper} MAY inherit from {ERC721} and/or {ERC1155} in order to call `super.mint`, 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.

If the {Wrapper} does not inherit from {ERC721} or {ERC1155}, it MUST include calls to {IERC721} and {IERC1155} in order to transfer {Base} tokens.

### Approval
All of the underlying transfer methods are not tied to the {Wrapper}, but rather call the ERC-20/721/1155 transfer methods. Implementations of this standard MUST:
- Either implement {Derivative} transfer approval for burning, and {Base} transfer approval for minting.
- Or check for Approval outside of the {Wrapper} through {IERC721} / {IERC1155} before attempting to execute.

## Backwards Compatibility
Most existing implementations inherit from ERC-20, using functions `mint` and `burn`.
Events:
- Mint
    - WK: DepositKittyAndMintToken
    - NFTX: Mint

- Burn
    - WK: BurnTokenAndWithdrawKity
    - NFTX: Redeem

## Reference Implementation
[ERC-3386 Reference Implementation](https://github.com/ashrowz/erc-3386)

## Security Considerations
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.

With the functions `idBurn`, `idBurns`, 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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 12 Mar 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3386</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3386</guid>
      </item>
    
      <item>
        <title>ERC-721 Editions Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-3340-nft-editions-standard-extension/6044</comments>
        
        <description>## Simple Summary

This standard addresses an extension to the [ERC-721 specification](./eip-721.md) 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. 

## Abstract

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 [original 721 extension](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721Enumerable.sol) 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.

## Motivation
Currently the link between a NFT and the digital work of art is only enforced in the token metadata stored in the shared `tokenURI` 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.

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.

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.

## Specification
The key words &quot;MUST&quot;, &quot;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.

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.

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 / minted.

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. 

Signature messages MUST use the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) standard.

A contract that is compliant with ERC-3440 shall implement the following abstract contract (referred to as ERC3440.sol):

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol&quot;;
import &quot;@openzeppelin/contracts/utils/cryptography/ECDSA.sol&quot;;

/**
 * @dev ERC721 token with editions extension.
 */
abstract contract ERC3440 is ERC721URIStorage {

    // eip-712
    struct EIP712Domain {
        string  name;
        string  version;
        uint256 chainId;
        address verifyingContract;
    }
    
    // Contents of message to be signed
    struct Signature {
        address verificationAddress; // ensure the artists signs only address(this) for each piece
        string artist;
        address wallet;
        string contents;
    }

    // type hashes
    bytes32 constant EIP712DOMAIN_TYPEHASH = keccak256(
        &quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&quot;
    );

    bytes32 constant SIGNATURE_TYPEHASH = keccak256(
        &quot;Signature(address verifyAddress,string artist,address wallet, string contents)&quot;
    );

    bytes32 public DOMAIN_SEPARATOR;
    
    // Optional mapping for signatures
    mapping (uint256 =&gt; bytes) private _signatures;
    
    // A view to display the artist&apos;s address
    address public artist;

    // A view to display the total number of prints created
    uint public editionSupply = 0;
    
    // A view to display which ID is the original copy
    uint public originalId = 0;
    
    // A signed token event
    event Signed(address indexed from, uint256 indexed tokenId);

    /**
     * @dev Sets `artist` as the original artist.
     * @param `address _artist` the wallet of the signing artist (TODO consider multiple
     * signers and contract signers (non-EOA)
     */
    function _designateArtist(address _artist) internal virtual {
        require(artist == address(0), &quot;ERC721Extensions: the artist has already been set&quot;);

        // If there is no special designation for the artist, set it.
        artist = _artist;
    }
    
    /**
     * @dev Sets `tokenId as the original print` as the tokenURI of `tokenId`.
     * @param `uint256 tokenId` the nft id of the original print
     */
    function _designateOriginal(uint256 _tokenId) internal virtual {
        require(msg.sender == artist, &quot;ERC721Extensions: only the artist may designate originals&quot;);
        require(_exists(_tokenId), &quot;ERC721Extensions: Original query for nonexistent token&quot;);
        require(originalId == 0, &quot;ERC721Extensions: Original print has already been designated as a different Id&quot;);

        // If there is no special designation for the original, set it.
        originalId = _tokenId;
    }
    

    /**
     * @dev Sets total number printed editions of the original as the tokenURI of `tokenId`.
     * @param `uint256 _maxEditionSupply` max supply
     */
    function _setLimitedEditions(uint256 _maxEditionSupply) internal virtual {
        require(msg.sender == artist, &quot;ERC721Extensions: only the artist may designate max supply&quot;);
        require(editionSupply == 0, &quot;ERC721Extensions: Max number of prints has already been created&quot;);

        // If there is no max supply of prints, set it. Leaving supply at 0 indicates there are no prints of the original
        editionSupply = _maxEditionSupply;
    }

    /**
     * @dev Creates `tokenIds` representing the printed editions.
     * @param `string memory _tokenURI` the metadata attached to each nft
     */
    function _createEditions(string memory _tokenURI) internal virtual {
        require(msg.sender == artist, &quot;ERC721Extensions: only the artist may create prints&quot;);
        require(editionSupply &gt; 0, &quot;ERC721Extensions: the edition supply is not set to more than 0&quot;);
        for(uint i=0; i &lt; editionSupply; i++) {
            _mint(msg.sender, i);
            _setTokenURI(i, _tokenURI);
        }
    }

    /**
     * @dev internal hashing utility 
     * @param `Signature memory _message` the signature message struct to be signed
     * the address of this contract is enforced in the hashing
     */
    function _hash(Signature memory _message) internal view returns (bytes32) {
        return keccak256(abi.encodePacked(
            &quot;\x19\x01&quot;,
            DOMAIN_SEPARATOR,
            keccak256(abi.encode(
                SIGNATURE_TYPEHASH,
                address(this),
                _message.artist,
                _message.wallet,
                _message.contents
            ))
        ));
    }

    /**
     * @dev Signs a `tokenId` representing a print.
     * @param `uint256 _tokenId` id of the NFT being signed
     * @param `Signature memory _message` the signed message
     * @param `bytes memory _signature` signature bytes created off-chain
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Signed} event.
     */
    function _signEdition(uint256 _tokenId, Signature memory _message, bytes memory _signature) internal virtual {
        require(msg.sender == artist, &quot;ERC721Extensions: only the artist may sign their work&quot;);
        require(_signatures[_tokenId].length == 0, &quot;ERC721Extensions: this token is already signed&quot;);
        bytes32 digest = hash(_message);
        address recovered = ECDSA.recover(digest, _signature);
        require(recovered == artist, &quot;ERC721Extensions: artist signature mismatch&quot;);
        _signatures[_tokenId] = _signature;
        emit Signed(artist, _tokenId);
    }

    
    /**
     * @dev displays a signature from the artist.
     * @param `uint256 _tokenId` NFT id to verify isSigned
     * @returns `bytes` gets the signature stored on the token
     */
    function getSignature(uint256 _tokenId) external view virtual returns (bytes memory) {
        require(_signatures[_tokenId].length != 0, &quot;ERC721Extensions: no signature exists for this Id&quot;);
        return _signatures[_tokenId];
    }
    
    /**
     * @dev returns `true` if the message is signed by the artist.
     * @param `Signature memory _message` the message signed by an artist and published elsewhere
     * @param `bytes memory _signature` the signature on the message
     * @param `uint _tokenId` id of the token to be verified as being signed
     * @returns `bool` true if signed by artist
     * The artist may broadcast signature out of band that will verify on the nft
     */
    function isSigned(Signature memory _message, bytes memory _signature, uint _tokenId) external view virtual returns (bool) {
        bytes32 messageHash = hash(_message);
        address _artist = ECDSA.recover(messageHash, _signature);
        return (_artist == artist &amp;&amp; _equals(_signatures[_tokenId], _signature));
    }

    /**
    * @dev Utility function that checks if two `bytes memory` variables are equal. This is done using hashing,
    * which is much more gas efficient then comparing each byte individually.
    * Equality means that:
    *  - &apos;self.length == other.length&apos;
    *  - For &apos;n&apos; in &apos;[0, self.length)&apos;, &apos;self[n] == other[n]&apos;
    */
    function _equals(bytes memory _self, bytes memory _other) internal pure returns (bool equal) {
        if (_self.length != _other.length) {
            return false;
        }
        uint addr;
        uint addr2;
        uint len = _self.length;
        assembly {
            addr := add(_self, /*BYTES_HEADER_SIZE*/32)
            addr2 := add(_other, /*BYTES_HEADER_SIZE*/32)
        }
        assembly {
            equal := eq(keccak256(addr, len), keccak256(addr2, len))
        }
    }
}
```

## Rationale

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.

## Backwards Compatibility

This proposal combines already available 721 extensions and is backwards compatible with the ERC-721 standard.

## Test Cases
An example implementation including tests can be found [here](https://github.com/nginnever/NFT-editions).

## Reference Implementation
```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;./ERC3440.sol&quot;;

/**
 * @dev ERC721 token with editions extension.
 */
contract ArtToken is ERC3440 {

    /**
     * @dev Sets `address artist` as the original artist to the account deploying the NFT.
     */
     constructor (
        string memory _name, 
        string memory _symbol,
        uint _numberOfEditions,
        string memory tokenURI,
        uint _originalId
    ) ERC721(_name, _symbol) {
        _designateArtist(msg.sender);
        _setLimitedEditions(_numberOfEditions);
        _createEditions(tokenURI);
        _designateOriginal(_originalId);

        DOMAIN_SEPARATOR = keccak256(abi.encode(
            EIP712DOMAIN_TYPEHASH,
            keccak256(bytes(&quot;Artist&apos;s Editions&quot;)),
            keccak256(bytes(&quot;1&quot;)),
            1,
            address(this)
        ));
    }
    
    /**
     * @dev Signs a `tokenId` representing a print.
     */
    function sign(uint256 _tokenId, Signature memory _message, bytes memory _signature) public {
        _signEdition(_tokenId, _message, _signature);
    }
}

```

## Security Considerations
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 `tokenURI` 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/s.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 20 Apr 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3440</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3440</guid>
      </item>
    
      <item>
        <title>MetaProxy Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-3448-metaproxy-factory/5834</comments>
        
        <description>## Abstract
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/view the attached metadata.

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 `DELEGATECALL` 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.

## Motivation
This standard supports use-cases wherein it is desirable to clone exact contract functionality with different parameters at another address.

## Specification
The exact bytecode of the MetaProxy contract is:
```
                                              20 bytes target contract address
                                          ----------------------------------------
363d3d373d3d3d3d60368038038091363936013d7300000000000000000000000000000000000000005af43d3d93803e603457fd5bf3
```
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;54 bytes metaproxy&gt; &lt;arbitrary data&gt; &lt;length in bytes of arbitrary data (uint256)&gt;
```

## Rationale
The goals of this effort have been the following:
- a cheap way of storing immutable metadata for each child instead of using storage slots
- inexpensive deployment of clones
- handles error return bubbling for revert messages

## Backwards Compatibility
There are no backwards compatibility issues.

## Test Cases
Tested with:
- invocation with no arguments
- invocation with arguments
- invocation with return values
- invocation with revert (confirming reverted payload is transferred)

A solidity contract with the above test cases can be found [in the EIP asset directory](../assets/eip-3448/MetaProxyTest.sol).

## Reference Implementation
A reference implementation can be found [in the EIP asset directory](../assets/eip-3448/MetaProxyFactory.sol).

### Deployment bytecode
A annotated version of the deploy bytecode:
```
// PUSH1 11;
// CODESIZE;
// SUB;
// DUP1;
// PUSH1 11;
// RETURNDATASIZE;
// CODECOPY;
// RETURNDATASIZE;
// RETURN;
```

### MetaProxy
A annotated version of the MetaProxy bytecode:
```
// copy args
// CALLDATASIZE;   calldatasize
// RETURNDATASIZE; 0, calldatasize
// RETURNDATASIZE; 0, 0, calldatasize
// CALLDATACOPY;

// RETURNDATASIZE; 0
// RETURNDATASIZE; 0, 0
// RETURNDATASIZE; 0, 0, 0
// RETURNDATASIZE; 0, 0, 0, 0

// PUSH1 54;       54, 0, 0, 0, 0
// DUP1;           54, 54, 0, 0, 0, 0
// CODESIZE;       codesize, 54, 54, 0, 0, 0, 0
// SUB;            codesize-54, 54, 0, 0, 0, 0
// DUP1;           codesize-54, codesize-54, 54, 0, 0, 0, 0
// SWAP2;          54, codesize-54, codesize-54, 0, 0, 0, 0
// CALLDATASIZE;   calldatasize, 54, codesize-54, codesize-54, 0, 0, 0, 0
// CODECOPY;       codesize-54, 0, 0, 0, 0

// CALLDATASIZE;   calldatasize, codesize-54, 0, 0, 0, 0
// ADD;            calldatasize+codesize-54, 0, 0, 0, 0
// RETURNDATASIZE; 0, calldatasize+codesize-54, 0, 0, 0, 0
// PUSH20 0;       addr, 0, calldatasize+codesize-54, 0, 0, 0, 0 - zero is replaced with shl(96, address())
// GAS;            gas, addr, 0, calldatasize+codesize-54, 0, 0, 0, 0
// DELEGATECALL;   (gas, addr, 0, calldatasize() + metadata, 0, 0) delegatecall to the target contract;
//
// RETURNDATASIZE; returndatasize, retcode, 0, 0
// RETURNDATASIZE; returndatasize, returndatasize, retcode, 0, 0
// SWAP4;          0, returndatasize, retcode, 0, returndatasize
// DUP1;           0, 0, returndatasize, retcode, 0, returndatasize
// RETURNDATACOPY; (0, 0, returndatasize) - Copy everything into memory that the call returned

// stack = retcode, 0, returndatasize # this is for either revert(0, returndatasize()) or return (0, returndatasize())

// PUSH1 _SUCCESS_; push jumpdest of _SUCCESS_
// JUMPI;          jump if delegatecall returned `1`
// REVERT;         (0, returndatasize()) if delegatecall returned `0`
// JUMPDEST _SUCCESS_;
// RETURN;         (0, returndatasize()) if delegatecall returned non-zero (1)
```

### Examples
The following code snippets serve only as suggestions and are not a discrete part of this standard.

#### Proxy construction with bytes from abi.encode
```solidity
/// @notice MetaProxy construction via abi encoded bytes.
function createFromBytes (
  address a,
  uint256 b,
  uint256[] calldata c
) external payable returns (address proxy) {
  // creates a new proxy where the metadata is the result of abi.encode()
  proxy = MetaProxyFactory._metaProxyFromBytes(address(this), abi.encode(a, b, c));
  require(proxy != address(0));
  // optional one-time setup, a constructor() substitute
  MyContract(proxy).init{ value: msg.value }();
}
```

#### Proxy construction with bytes from calldata
```solidity
/// @notice MetaProxy construction via calldata.
function createFromCalldata (
  address a,
  uint256 b,
  uint256[] calldata c
) external payable returns (address proxy) {
  // creates a new proxy where the metadata is everything after the 4th byte from calldata.
  proxy = MetaProxyFactory._metaProxyFromCalldata(address(this));
  require(proxy != address(0));
  // optional one-time setup, a constructor() substitute
  MyContract(proxy).init{ value: msg.value }();
}
```

#### Retrieving the metadata from calldata and abi.decode
```solidity
/// @notice Returns the metadata of this (MetaProxy) contract.
/// Only relevant with contracts created via the MetaProxy standard.
/// @dev This function is aimed to be invoked with- &amp; without a call.
function getMetadataWithoutCall () public pure returns (
  address a,
  uint256 b,
  uint256[] memory c
) {
  bytes memory data;
  assembly {
    let posOfMetadataSize := sub(calldatasize(), 32)
    let size := calldataload(posOfMetadataSize)
    let dataPtr := sub(posOfMetadataSize, size)
    data := mload(64)
    // increment free memory pointer by metadata size + 32 bytes (length)
    mstore(64, add(data, add(size, 32)))
    mstore(data, size)
    let memPtr := add(data, 32)
    calldatacopy(memPtr, dataPtr, size)
  }
  return abi.decode(data, (address, uint256, uint256[]));
}
```

#### Retrieving the metadata via a call to self
```solidity
/// @notice Returns the metadata of this (MetaProxy) contract.
/// Only relevant with contracts created via the MetaProxy standard.
/// @dev This function is aimed to be invoked via a call.
function getMetadataViaCall () public pure returns (
  address a,
  uint256 b,
  uint256[] memory c
) {
  assembly {
    let posOfMetadataSize := sub(calldatasize(), 32)
    let size := calldataload(posOfMetadataSize)
    let dataPtr := sub(posOfMetadataSize, size)
    calldatacopy(0, dataPtr, size)
    return(0, size)
  }
}
```

Apart from the examples above, it is also possible to use Solidity Structures or any custom data encoding.

## Security Considerations
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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 29 Mar 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3448</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3448</guid>
      </item>
    
      <item>
        <title>Standardized Shamir Secret Sharing Scheme for BIP-39 Mnemonics</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-3450-standard-for-applying-shamirs-to-bip-39-mnemonics/5844</comments>
        
        <description>## Simple Summary

A standardized algorithm for applying Shamir&apos;s Secret Sharing Scheme to BIP-39 mnemonics.

## Abstract

A standardized approach to splitting a BIP-39 mnemonic into _N_ BIP-39 mnemonics, called shares, so that _T_ shares are required to recover the original mnemonic and no information about the original mnemonic, other than its size, is leaked with less than _T_ shares.

## Motivation

We&apos;d like to make it easier for less-technical users to store keys securely.

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.

Shamir&apos;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.

One concern with Shamir&apos;s Secret Sharing Scheme is there is no canonical, standard implementation. This puts recovery at risk, as tooling may change over time.

Here, we propose a standardized implementation of Shamir&apos;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.

## Specification

### Shamir&apos;s Secret Sharing Scheme

Shamir&apos;s Secret Sharing Scheme is a cryptographic method to split a secret into _N_ unique parts, where any _T_ of them are required to reconstruct the secret.

First, a polynomial _f_ of degree _T_ − 1 is constructed. Then, each share is a point on the polynomial&apos;s curve: an integer _x_, and its corresponding _y_ point _f_(_x_).

With any set of _T_ shares (or points), the initial polynomial can be recovered using polynomial interpolation.

When constructing the initial polynomial, the secret is stored as the coefficient of x&lt;sup&gt;0&lt;/sup&gt; and the rest of the coefficients are randomly generated.

### BIP-39 Mnemonics

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.

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.

#### Generating the Mnemonic

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.

First, an initial entropy of ENT bits is generated. A checksum is generated by taking the first `ENT / 32` 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.

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.

```
CS = ENT / 32
MS = (ENT + CS) / 11

|  ENT  | CS | ENT+CS |  MS  |
+-------+----+--------+------+
|  128  |  4 |   132  |  12  |
|  160  |  5 |   165  |  15  |
|  192  |  6 |   198  |  18  |
|  224  |  7 |   231  |  21  |
|  256  |  8 |   264  |  24  |
```

#### Recovering the Entropy

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.

#### Word List

This specification only supports the BIP-39 English word list, but this may be expanded in the future.

See [word list](../assets/eip-3450/wordlist.txt).

### Applying Shamir&apos;s Scheme to BIP-39 Mnemonics

To ensure that the shares are valid BIP-39 mnemonics, we:

1. Convert the target BIP-39 mnemonic to its underlying entropy
2. Apply Shamir&apos;s Scheme to the entropy
3. Convert each resulting share&apos;s _y_ value to a BIP-39 mnemonic

By converting to entropy before applying Shamir&apos;s Scheme, we omit the checksum from the initial secret, allowing us to calculate a new checksum for each share when converting the share _y_ values to mnemonics, ensuring that they are valid according to BIP-39.

When applying Shamir&apos;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 _x_&lt;sup&gt;8&lt;/sup&gt; + _x_&lt;sup&gt;4&lt;/sup&gt; + _x_&lt;sup&gt;3&lt;/sup&gt; + _x_ + 1, following AES.

### Share Format

A share represents a point on the curve described by the underlying polynomial used to split the secret. It includes two pieces of data:

- An ID: the _x_ value of the share
- A BIP-39 mnemonic: the _y_ value of the share represented by a mnemonic

### Creating Shares

Inputs: BIP-39 mnemonic, number of shares (_N_), threshold (_T_)

Output: N Shares, each share including an ID, { _x_ | 0 &amp;lt; _x_ &amp;lt; 256 }, and a BIP-39 mnemonic of the same length as the input one

1. Check the following conditions:
   - 1 &lt; T &lt;= N &lt; 256
   - The mnemonic is valid according to [BIP-39](#generating-the-mnemonic)
2. [Recover the underlying entropy of the mnemonic](#recovering-the-entropy) as a vector of bytes
3. Define values:
   - Let _E_ be the byte-vector representation of the mnemonic&apos;s entropy
   - Let _n_ be the length of _E_
   - Let _coeff&lt;sub&gt;1&lt;/sub&gt;_, ... , _coeff&lt;sub&gt;T - 1&lt;/sub&gt;_ be byte-vectors belonging to GF(256)_&lt;sup&gt;n&lt;/sup&gt;_ generated randomly, independently with uniform distribution from a source suitable for generating cryptographic keys
4. Evaluate the polynomial for each share
   - For each _x_ from 1 to _N_, evaluate the polynomial _f(x)_ = _E_ + _coeff&lt;sub&gt;1&lt;/sub&gt;x&lt;sup&gt;1&lt;/sup&gt;_ + ... + _coeff&lt;sub&gt;T - 1&lt;/sub&gt;x&lt;sup&gt;T - 1&lt;/sup&gt;_, where _x_ is the share ID and _f(x)_ is the share value (as a vector of bytes)
5. Using _f(x)_ as the underlying entropy, [generate a mnemonic](#generating-the-mnemonic) for each share
6. Return the ID and mnemonic for each share

### Recovering the Mnemonic

To recover the original mnemonic, we interpolate a polynomial _f_ from the given set of shares (or points on the polynomial) and evaluate _f(0)_.

#### Polynomial Interpolation

Given a set of _m_ points (_x&lt;sub&gt;i&lt;/sub&gt;_, _y&lt;sub&gt;i&lt;/sub&gt;_), 1 &amp;le; _i_ &amp;le; _m_, such that no two _x&lt;sub&gt;i&lt;/sub&gt;_ values equal, there exists a polynomial that assumes the value _y&lt;sub&gt;i&lt;/sub&gt;_ at each point _x&lt;sub&gt;i&lt;/sub&gt;_. The polynomial of lowest degree that satisfies these conditions is uniquely determined and can be obtained using the Lagrange interpolation formula given below.

Since Shamir&apos;s Secret Sharing Scheme is applied separately to each of the _n_ bytes of the shared mnemonic&apos;s entropy, we work with _y&lt;sub&gt;i&lt;/sub&gt;_ as a vector of _n_ values, where _y&lt;sub&gt;i&lt;/sub&gt;_[_k_] = _f&lt;sub&gt;k&lt;/sub&gt;_(_x&lt;sub&gt;i&lt;/sub&gt;_), 1 &amp;le; _k_ &amp;le; _n_, and _f&lt;sub&gt;k&lt;/sub&gt;_ is the polynomial in the _k_-th instance of the scheme.

#### Interpolate(_x_, {(_x&lt;sub&gt;i&lt;/sub&gt;_, _y&lt;sub&gt;i&lt;/sub&gt;_), 1 &amp;le; _i_ &amp;le; _m_})

Input: the desired index _x_, a set of index/value-vector pairs {(_x&lt;sub&gt;i&lt;/sub&gt;_, _y_&lt;sub&gt;_i_&lt;/sub&gt;), 1 &amp;le; _i_ &amp;le; _m_} &amp;subseteq; GF(256) &amp;times; GF(256)&lt;sup&gt;_n_&lt;/sup&gt;

Output: the value-vector (_f_&lt;sub&gt;1&lt;/sub&gt;(_x_), ... , _f&lt;sub&gt;n&lt;/sub&gt;_(_x_))

![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}](../assets/eip-3450/lagrange.gif)

#### Recover the Mnemonic

Input: A set of _m_ Shares

Output: The original mnemonic

1. [Recover the underlying entropy of each share&apos;s mnemonic](#recovering-the-entropy) as a vector of bytes
2. Calculate _E_ = Interpolate(0, [(_x&lt;sub&gt;1&lt;/sub&gt;_, _y&lt;sub&gt;1&lt;/sub&gt;_),...,(_x&lt;sub&gt;m&lt;/sub&gt;_, _y&lt;sub&gt;m&lt;/sub&gt;_)]), where _x_ is the share ID and _y_ is the byte-vector of the share&apos;s mnemonic&apos;s entropy
3. Using _E_ as the underlying entropy, [generate a mnemonic](#generating-the-mnemonic) and return it

## Rationale

### Choice of Field

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.

GF(2048) was also considered. Using GF(2048), we could have applied Shamir&apos;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.

Another option was GF(2&lt;sup&gt;_n_&lt;/sup&gt;) where _n_ is the size of the entropy in bits. We&apos;d still convert the mnemonic to entropy, but then apply Shamir&apos;s Scheme over the entire entropy rather than on a vector of values. The downside of this approach is we&apos;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.

### Valid Share Mnemonics and Share IDs

The shares produced by the specification include an ID, in addition to the BIP-39 mnemonic.

Other options could have encoded the share ID into the mnemonic, simplifying storage - only the mnemonic would need to be stored.

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 _valid_ 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.

### Validation on Recovery

We decided _not_ to include a validation mechanism on recovering the original mnemonic. This leaks less information to a potential attacker. There is no indication they&apos;ve gotten the requisite number of shares until they&apos;ve obtained _T_ + 1 shares.

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.

## Test Cases

Coming soon.

All implementations must be able to:

- Split and recover each `mnemonic` with the given `numShares` and `threshold`.
- Recover the `mnemonic` from the given `knownShares`.

## Security Considerations

The shares produced by the specification include an ID in addition to the BIP-39 mnemonic. This raises two security concerns:

Users **must** 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)

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 29 Mar 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3450</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3450</guid>
      </item>
    
      <item>
        <title>Abstract Storage Bonds</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-3475-multiple-callable-bonds-standard/8691</comments>
        
        <description>## Abstract

- 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.

- 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.

- Bonds created by this EIP can also be batched for issuance/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.

## Motivation

Current LP (Liquidity Provider) tokens are simple [EIP-20](./eip-20.md) 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:

- Supports multiple token IDs
- Can store on-chain metadata
- Doesn&apos;t require a fixed storage pattern
- Is gas-efficient.

Also Some benefits:

- This EIP allows the creation of any obligation with the same interface.
- It will enable any 3rd party wallet applications or exchanges to read these tokens&apos; balance and redemption conditions. 
- These bonds can also be batched as tradeable instruments. Those instruments can then be divided and exchanged in secondary markets.

## Specification

**Definition**

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.

**Functions**

```solidity
pragma solidity ^0.8.0;

/**
* transferFrom
* @param _from argument is the address of the bond holder whose balance is about to decrease.
* @param _to argument is the address of the bond recipient whose balance is about to increase.
* @param _transactions is the `Transaction[] calldata` (of type [&apos;classId&apos;, &apos;nonceId&apos;, &apos;_amountBonds&apos;]) structure defined in the rationale section below.
* @dev 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).
e.g:
* function transferFrom(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B, [IERC3475.Transaction(1,14,500)]);
* transfer from `_from` address, to `_to` address, `500000000` bonds of type class`1` and nonce `42`.
*/

function transferFrom(address _from, address _to, Transaction[] calldata _transactions) external;

/**
* transferAllowanceFrom
* @dev allows the transfer of only those bond types and nonces being allotted to the _to address using allowance().
* @param _from is the address of the holder whose balance is about to decrease.
* @param _to is the address of the recipient whose balance is about to increase.
* @param _transactions is the `Transaction[] calldata` structure defined in the section `rationale` below.
* @dev transferAllowanceFrom MUST have the `allowance(_from, msg.sender, _transactions[i].classId, _transactions[i].nonceId)` (where `i` looping for [ 0 ...Transaction.length - 1] ) 
e.g:
* function transferAllowanceFrom(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B, [IERC3475.Transaction(1,14,500)]);
* transfer from `_from` address, to `_to` address, `500000000` bonds of type class`1` and nonce `42`.
*/

function transferAllowanceFrom(address _from,address _to, Transaction[] calldata _transactions) public ;

/**
* issue 
* @dev allows issuing any number of bond types (defined by values in Transaction tuple as param) to an address.
* @dev 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).
* @param `_to` argument is the address to which the bond will be issued.
* @param `_transactions` is the `Transaction[] calldata` (ie array of issued bond class, bond nonce and amount of bonds to be issued).
* @dev transferAllowanceFrom MUST have the `allowance(_from, msg.sender, _transactions[i].classId, _transactions[i].nonceId)` (where `i` looping for [ 0 ...Transaction.length - 1] ) 
e.g:
example: issue(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,[IERC3475.Transaction(1,14,500)]);
issues `1000` bonds with a class of `0` to address `0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef` with a nonce of `5`.
*/
function issue(address _to, Transaction[] calldata _transaction) external; 

/**
* redeem
* @dev permits redemption of bond from an address.
* @dev the calling of this function needs to be restricted to the bond issuer contract.
* @param `_from` is the address from which the bond will be redeemed.
* @param `_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.
* @dev 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. 
* @dev furthermore, it SHOULD ONLY be called by the bank or secondary market maker contract.
e.g:
* redeem(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, [IERC3475.Transaction(1,14,500)]);
means “redeem from wallet address(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef), 500000000 of bond class1 and nonce 42.
*/

function redeem(address _from, Transaction[] calldata _transactions) external; 

/**
* burn
* @dev permits nullifying of the bonds (or transferring given bonds to address(0)).
* @dev burn function for given class and nonce MUST BE called by only the controller contract.
* @param _from is the address of the holder whose bonds are about to burn.
* @param `_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.
* @dev 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). 
* @dev furthermore, it SHOULD ONLY be called by the bank or secondary market maker contract.
* e.g:  
* burn(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,[IERC3475.Transaction(1,14,500)]);
* means burning 500000000 bonds of class 1 nonce 42 owned by address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B.
*/
function burn(address _from, Transaction[] calldata _transactions) external; 

/**
* approve
* @dev Allows `_spender` to withdraw from the msg.sender the bonds of `_amount` and type (classId and nonceId).
* @dev If this function is called again, it overwrites the current allowance with the amount.
* @dev `approve()` should only be callable by the bank, or the owner of the account.
* @param `_spender` argument is the address of the user who is approved to transfer the bonds.
* @param `_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.
* e.g: 
* approve(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,[IERC3475.Transaction(1,14,500)]);
* means owner of address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B is approved to manage 500 bonds from class 1 and Nonce 14.
*/

function approve(address _spender, Transaction[] calldata _transactions) external;

/**
* SetApprovalFor
* @dev enable or disable approval for a third party (“operator”) to manage all the Bonds in the given class of the caller’s bonds.
* @dev If this function is called again, it overwrites the current allowance with the amount.
* @dev `approve()` should only be callable by the bank or the owner of the account.
* @param `_operator` is the address to add to the set of authorized operators.
* @param `classId` is the class id of the bond.
* @param `_approved` is true if the operator is approved (based on the conditions provided), false meaning approval is revoked.
* @dev contract MUST define internal function regarding the conditions for setting approval and should be callable only by bank or owner.
* e.g: setApprovalFor(0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B,0,true);
* means that address 0x82a55a613429Aeb3D01fbE6841bE1AcA4fFD5b2B is authorized to transfer bonds from class 0 (across all nonces).
*/

function setApprovalFor(address _operator, bool _approved) external returns(bool approved);

/**
* totalSupply
* @dev Here, total supply includes burned and redeemed supply.
* @param classId is the corresponding class Id of the bond.
* @param nonceId is the nonce Id of the given bond class.
* @return the supply of the bonds
* e.g:
* totalSupply(0, 1);
* it finds the total supply of the bonds of classid 0 and bond nonce 1.
*/
function totalSupply(uint256 classId, uint256 nonceId) external view returns (uint256);

/**
* redeemedSupply
* @dev Returns the redeemed supply of the bond identified by (classId,nonceId).
* @param classId is the corresponding class id of the bond.
* @param nonceId is the nonce id of the given bond class.
* @return the supply of bonds redeemed.
*/
function redeemedSupply(uint256 classId, uint256 nonceId) external view returns (uint256);

/**
* activeSupply
* @dev Returns the active supply of the bond defined by (classId,NonceId).
* @param classId is the corresponding classId of the bond.
* @param nonceId is the nonce id of the given bond class.
* @return the non-redeemed, active supply. 
*/
function activeSupply(uint256 classId, uint256 nonceId) external view returns (uint256);

/**
* burnedSupply
* @dev Returns the burned supply of the bond in defined by (classId,NonceId).
* @param classId is the corresponding classId of the bond.
* @param nonceId is the nonce id of the given bond class.
* @return gets the supply of bonds for given classId and nonceId that are already burned.
*/
function burnedSupply(uint256 classId, uint256 nonceId) external view returns (uint256);

/**
* balanceOf
* @dev Returns the balance of the bonds (nonReferenced) of given classId and bond nonce held by the address `_account`.
* @param classId is the corresponding classId of the bond.
* @param nonceId is the nonce id of the given bond class.
* @param _account address of the owner whose balance is to be determined.
* @dev this also consists of bonds that are redeemed.
*/
function balanceOf(address _account, uint256 classId, uint256 nonceId) external view returns (uint256);

/**
* classMetadata
* @dev Returns the JSON metadata of the classes.
* @dev The metadata SHOULD follow a set of structures explained later in the metadata.md
* @param metadataId is the index-id given bond class information.
* @return the JSON metadata of the nonces. — e.g. `[title, type, description]`.
*/
function classMetadata(uint256 metadataId) external view returns (Metadata memory);

/**
* nonceMetadata 
* @dev Returns the JSON metadata of the nonces.
* @dev The metadata SHOULD follow a set of structures explained later in metadata.md
* @param classId is the corresponding classId of the bond.
* @param nonceId is the nonce id of the given bond class.
* @param metadataId is the index of the JSON storage for given metadata information. more is defined in metadata.md.
* @returns the JSON metadata of the nonces. — e.g. `[title, type, description]`.
*/
function nonceMetadata(uint256 classId, uint256 metadataId) external view returns (Metadata memory);

/**
* classValues
* @dev allows anyone to read the values (stored in struct Values for different class) for given bond class `classId`.
* @dev the values SHOULD follow a set of structures as explained in metadata along with correct mapping corresponding to the given metadata structure
* @param classId is the corresponding classId of the bond.
* @param metadataId is the index of the JSON storage for given metadata information of all values of given metadata. more is defined in metadata.md.
* @returns the Values of the class metadata. — e.g. `[string, uint, address]`.
*/
function classValues(uint256 classId, uint256 metadataId) external view returns (Values memory);

/**
* nonceValues
* @dev allows anyone to read the values (stored in struct Values for different class) for given bond (`nonceId`,`classId`).
* @dev the values SHOULD follow a set of structures explained in metadata along with correct mapping corresponding to the given metadata structure
* @param classId is the corresponding classId of the bond.
* @param metadataId is the index of the JSON storage for given metadata information of all values of given metadata. More is defined in metadata.md.
* @returns the Values of the class metadata. — e.g. `[string, uint, address]`.
*/
function nonceValues(uint256 classId, uint256 nonceId, uint256 metadataId) external view returns (Values memory);

/**
* getProgress
* @dev Returns the parameters to determine the current status of bonds maturity.
* @dev the conditions of redemption SHOULD be defined with one or several internal functions. 
* @param classId is the corresponding classId of the bond.
* @param nonceId is the nonceId of the given bond class . 
* @returns progressAchieved defines the metric (either related to % liquidity, time, etc.) that defines the current status of the bond.
* @returns progressRemaining defines the metric that defines the remaining time/ remaining progress. 
*/
function getProgress(uint256 classId, uint256 nonceId) external view returns (uint256 progressAchieved, uint256 progressRemaining);

/** 
* allowance
* @dev Authorizes to set the allowance for given `_spender` by `_owner` for all bonds identified by (classId, nonceId).
* @param _owner address of the owner of bond(and also msg.sender).
* @param _spender is the address authorized to spend the bonds held by _owner of info (classId, nonceId).
* @param classId is the corresponding classId of the bond.
* @param nonceId is the nonceId of the given bond class. 
* @notice Returns the _amount which spender is still allowed to withdraw from _owner.
*/
function allowance(address _owner, address _spender, uint256 classId, uint256 nonceId) external returns(uint256);

/** 
* isApprovedFor
* @dev returns true if address _operator is approved for managing the account’s bonds class.
* @notice Queries the approval status of an operator for a given owner.
* @dev _owner is the owner of bonds. 
* @dev _operator is the EOA /contract, whose status for approval on bond class for this approval is checked.
* @returns “true” if the operator is approved, “false” if not.
*/
function isApprovedFor(address _owner, address _operator) external view returns (bool);
```

### Events

```solidity
/** 
* Issue
* @notice Issue MUST trigger when Bonds are issued. This SHOULD not include zero value Issuing.
* @dev This SHOULD not include zero value issuing.
* @dev Issue MUST be triggered when the operator (i.e Bank address) contract issues bonds to the given entity.
* eg: emit Issue(_operator, 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,[IERC3475.Transaction(1,14,500)]); 
* issue by address(operator) 500 Bonds(nonce14,class 1) to address 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef.
*/

event Issue(address indexed _operator, address indexed _to, Transaction[] _transactions); 

/** 
* Redeem
* @notice Redeem MUST trigger when Bonds are redeemed. This SHOULD not include zero value redemption.
*e.g: emit Redeem(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]);
* emit event when 5000 bonds of class 1, nonce 14 owned by address 0x492Af743654549b12b1B807a9E0e8F397E44236E are being redeemed by 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef.
*/

event Redeem(address indexed _operator, address indexed _from, Transaction[] _transactions);


/** 
* Burn.
* @dev `Burn` MUST trigger when the bonds are being redeemed via staking (or being invalidated) by the bank contract.
* @dev `Burn` MUST trigger when Bonds are burned. This SHOULD not include zero value burning.
* e.g : emit Burn(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef,0x492Af743654549b12b1B807a9E0e8F397E44236E,[IERC3475.Transaction(1,14,500)]);
* emits event when 500 bonds of owner 0x492Af743654549b12b1B807a9E0e8F397E44236E of type (class 1, nonce 14) are burned by operator  0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef.
*/

event burn(address _operator, address _owner, Transaction[] _transactions);

/** 
* Transfer
* @dev 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. 
* @dev Transfer MUST trigger when Bonds are transferred. This SHOULD not include zero value transfers.
* @dev Transfer event with the _from `0x0` MUST not create this event(use `event Issued` instead). 
* e.g  emit Transfer(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E, _to, [IERC3475.Transaction(1,14,500)]);
* transfer by address(_operator) amount 500 bonds with (Class 1 and Nonce 14) from 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, to address(_to).
*/

event Transfer(address indexed _operator, address indexed _from, address indexed _to, Transaction[] _transactions);

/**
* ApprovalFor
* @dev its emitted when address(_owner) approves the address(_operator) to transfer his bonds.
* @notice Approval MUST trigger when bond holders are approving an _operator. This SHOULD not include zero value approval. 
* eg: emit ApprovalFor(0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef, 0x492Af743654549b12b1B807a9E0e8F397E44236E, true);
* this means 0x2d03B6C79B75eE7aB35298878D05fe36DC1fE8Ef gives 0x492Af743654549b12b1B807a9E0e8F397E44236E access permission for transfer of its bonds.
*/

event ApprovalFor(address indexed _owner, address indexed _operator, bool _approved);
```

**Metadata**:
The metadata of a bond class or nonce is stored as an array of JSON objects, represented by the following types. 

**NOTE: all of the metadata schemas are referenced from [here](../assets/eip-3475/Metadata.md)**

### 1. Description:

This defines the additional information about the nature of data being stored in the nonce/class metadata structures. They are defined using the structured explained [here](../assets/eip-3475/Metadata.md#1-description-metadata). 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. 

### 2. Nonce:

The key value for indexing the information is the &apos;class&apos; field. Following are the rules:

- The title can be any alphanumeric type that is differentiated by the description of metadata (although it can be dependent on certain jurisdictions).
- The title SHOULD not be EMPTY.

Some specific examples of metadata can be the localization of bonds, jurisdiction details etc., and they can be found in the [metadata.md](../assets/eip-3475/Metadata.md) example description.

### 3. Class metadata:

This structure defines the details of the class information (symbol, risk information, etc.). the example is explained [here](../assets/eip-3475/Metadata.md) in the class metadata section.

### 4. Decoding data

First, the functions for analyzing the metadata (i.e `ClassMetadata` and `NonceMetadata`) are to be used by the corresponding frontend to decode the information of the bond.

This is done via overriding the function interface for functions `classValues` and `nonceValues` by defining the key (which SHOULD be an index) to read the corresponding information stored as a JSON object.

```JSON
{
&quot;title&quot;: &quot;symbol&quot;,
&quot;_type&quot;: &quot;string&quot;,
&quot;description&quot;: &quot;defines the unique identifier name in following format: (symbol, bondType, maturity in months)&quot;,
&quot;values&quot;: [&quot;Class Name 1&quot;,&quot;Class Name 2&quot;,&quot;DBIT Fix 6M&quot;],
}
```

e.g. In the above example, to get the `symbol` of the given class id, we can use the class id as a key to get the `symbol` value in the values, which then can be used for fetching the detail for instance.

## Rationale

### Metadata structure

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.

```solidity
 struct Values{
 string stringValue;
 uint uintValue;
 address addressValue;
 bool boolValue;
 bytes bytesValue;
 }
```

```solidity
 struct Metadata {
 string title;
 string _type;
 string description;
 }
```

### Batch function

 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.

```solidity
 struct Transaction {
 uint256 classId;
 uint256 nonceId;
 uint256 _amount;
 }
```

Where:
The `classId` is the class id of the bond.

The `nonceId` is the nonce id of the given bond class. This param is for distinctions of the issuing conditions of the bond.

The `_amount` is the amount of the bond for which the spender is approved.

### AMM optimization

 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 [EIP-20](./eip-20.md) 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 [EIP-20](./eip-20.md) 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.

- The reason behind the standard&apos;s name (abstract storage bond) is its ability to store all the specifications (metadata/values and transaction as defined in the following sections) without needing external storage on-chain/off-chain.

## Backwards Compatibility

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 `issue()` and `redeem()` commands.

However, any existing [EIP-20](./eip-20.md) 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.

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.

**Note that the this standard interface is also compatible with [EIP-20](./eip-20.md) and [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md)interface.**

However, creating a separate bank contract is recommended for reading the bonds and future upgrade needs.

Acceptable collateral can be in the form of fungible (like [EIP-20](./eip-20.md)), non-fungible ([EIP-721](./eip-721.md), [EIP-1155](./eip-1155.md)) , or other bonds represented by this standard.

## Test Cases

Test-case for the minimal reference implementation is [here](../assets/eip-3475/ERC3475.test.ts). Use the Truffle box to compile and test the contracts.

## Reference Implementation

- [Interface](../assets/eip-3475/interfaces/IERC3475.sol).

- [Basic Example](../assets/eip-3475/ERC3475.sol).
  - This demonstration shows only minimalist implementation.

## Security Considerations

- The `function setApprovalFor(address _operatorAddress)` gives the operator role to `_operatorAddress`. It has all the permissions to transfer, burn and redeem bonds by default.

- If the owner wants to give a one-time allocation to an address for specific bonds(classId,bondsId), he should call the `function approve()` giving the `Transaction[]` allocated rather than approving all the classes using `setApprovalFor`.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 05 Apr 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3475</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3475</guid>
      </item>
    
      <item>
        <title>Semi-Fungible Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-3525-the-semi-fungible-token</comments>
        
        <description>## Abstract

This is a standard for semi-fungible tokens. The set of smart contract interfaces described in this document defines an [ERC-721](./eip-721.md) compatible token standard. This standard introduces an `&lt;ID, SLOT, VALUE&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.

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.

Token also contains a `value` property, representing the quantitative nature of the token. The meaning of the &apos;value&apos; property is quite like that of the &apos;balance&apos; property of an [ERC-20](./eip-20.md) token. Each token has a &apos;slot&apos; 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.

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.

## Motivation

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. 

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. 

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.

## Specification

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.

**Every [ERC-3525](./eip-3525.md) compliant contract must implement the ERC-3525, ERC-721 and [ERC-165](./eip-165.md) interfaces**

```solidity
pragma solidity ^0.8.0;

/**
 * @title ERC-3525 Semi-Fungible Token Standard
 * Note: the ERC-165 identifier for this interface is 0xd5358140.
 */
interface IERC3525 /* is IERC165, IERC721 */ {
    /**
     * @dev MUST emit when value of a token is transferred to another token with the same slot,
     *  including zero value transfers (_value == 0) as well as transfers when tokens are created
     *  (`_fromTokenId` == 0) or destroyed (`_toTokenId` == 0).
     * @param _fromTokenId The token id to transfer value from
     * @param _toTokenId The token id to transfer value to
     * @param _value The transferred value
     */
    event TransferValue(uint256 indexed _fromTokenId, uint256 indexed _toTokenId, uint256 _value);

    /**
     * @dev MUST emit when the approval value of a token is set or changed.
     * @param _tokenId The token to approve
     * @param _operator The operator to approve for
     * @param _value The maximum value that `_operator` is allowed to manage
     */
    event ApprovalValue(uint256 indexed _tokenId, address indexed _operator, uint256 _value);
    
    /**
     * @dev MUST emit when the slot of a token is set or changed.
     * @param _tokenId The token of which slot is set or changed
     * @param _oldSlot The previous slot of the token
     * @param _newSlot The updated slot of the token
     */ 
    event SlotChanged(uint256 indexed _tokenId, uint256 indexed _oldSlot, uint256 indexed _newSlot);

    /**
     * @notice Get the number of decimals the token uses for value - e.g. 6, means the user
     *  representation of the value of a token can be calculated by dividing it by 1,000,000.
     *  Considering the compatibility with third-party wallets, this function is defined as
     *  `valueDecimals()` instead of `decimals()` to avoid conflict with ERC-20 tokens.
     * @return The number of decimals for value
     */
    function valueDecimals() external view returns (uint8);

    /**
     * @notice Get the value of a token.
     * @param _tokenId The token for which to query the balance
     * @return The value of `_tokenId`
     */
    function balanceOf(uint256 _tokenId) external view returns (uint256);

    /**
     * @notice Get the slot of a token.
     * @param _tokenId The identifier for a token
     * @return The slot of the token
     */
    function slotOf(uint256 _tokenId) external view returns (uint256);

    /**
     * @notice Allow an operator to manage the value of a token, up to the `_value`.
     * @dev MUST revert unless caller is the current owner, an authorized operator, or the approved
     *  address for `_tokenId`.
     *  MUST emit the ApprovalValue event.
     * @param _tokenId The token to approve
     * @param _operator The operator to be approved
     * @param _value The maximum value of `_toTokenId` that `_operator` is allowed to manage
     */
    function approve(
        uint256 _tokenId,
        address _operator,
        uint256 _value
    ) external payable;

    /**
     * @notice Get the maximum value of a token that an operator is allowed to manage.
     * @param _tokenId The token for which to query the allowance
     * @param _operator The address of an operator
     * @return The current approval value of `_tokenId` that `_operator` is allowed to manage
     */
    function allowance(uint256 _tokenId, address _operator) external view returns (uint256);

    /**
     * @notice Transfer value from a specified token to another specified token with the same slot.
     * @dev Caller MUST be the current owner, an authorized operator or an operator who has been
     *  approved the whole `_fromTokenId` or part of it.
     *  MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.
     *  MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.
     *  MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the
     *  operator.
     *  MUST emit `TransferValue` event.
     * @param _fromTokenId The token to transfer value from
     * @param _toTokenId The token to transfer value to
     * @param _value The transferred value
     */
    function transferFrom(
        uint256 _fromTokenId,
        uint256 _toTokenId,
        uint256 _value
    ) external payable;


    /**
     * @notice Transfer value from a specified token to an address. The caller should confirm that
     *  `_to` is capable of receiving ERC-3525 tokens.
     * @dev This function MUST create a new ERC-3525 token with the same slot for `_to`, 
     *  or find an existing token with the same slot owned by `_to`, to receive the transferred value.
     *  MUST revert if `_fromTokenId` is zero token id or does not exist.
     *  MUST revert if `_to` is zero address.
     *  MUST revert if `_value` exceeds the balance of `_fromTokenId` or its allowance to the
     *  operator.
     *  MUST emit `Transfer` and `TransferValue` events.
     * @param _fromTokenId The token to transfer value from
     * @param _to The address to transfer value to
     * @param _value The transferred value
     * @return ID of the token which receives the transferred value
     */
    function transferFrom(
        uint256 _fromTokenId,
        address _to,
        uint256 _value
    ) external payable returns (uint256);
}
```

The slot&apos;s enumeration extension is OPTIONAL. This allows your contract to publish its full list of `SLOT`s and make them discoverable.

```solidity
pragma solidity ^0.8.0;

/**
 * @title ERC-3525 Semi-Fungible Token Standard, optional extension for slot enumeration
 * @dev Interfaces for any contract that wants to support enumeration of slots as well as tokens 
 *  with the same slot.
 * Note: the ERC-165 identifier for this interface is 0x3b741b9e.
 */
interface IERC3525SlotEnumerable is IERC3525 /* , IERC721Enumerable */ {

    /**
     * @notice Get the total amount of slots stored by the contract.
     * @return The total amount of slots
     */
    function slotCount() external view returns (uint256);

    /**
     * @notice Get the slot at the specified index of all slots stored by the contract.
     * @param _index The index in the slot list
     * @return The slot at `index` of all slots.
     */
    function slotByIndex(uint256 _index) external view returns (uint256);

    /**
     * @notice Get the total amount of tokens with the same slot.
     * @param _slot The slot to query token supply for
     * @return The total amount of tokens with the specified `_slot`
     */
    function tokenSupplyInSlot(uint256 _slot) external view returns (uint256);

    /**
     * @notice Get the token at the specified index of all tokens with the same slot.
     * @param _slot The slot to query tokens with
     * @param _index The index in the token list of the slot
     * @return The token ID at `_index` of all tokens with `_slot`
     */
    function tokenInSlotByIndex(uint256 _slot, uint256 _index) external view returns (uint256);
}
```

The slot level approval is OPTIONAL. This allows any contract that wants to support approval for slots, which allows an operator to manage one&apos;s tokens with the same slot.

```solidity
pragma solidity ^0.8.0;

/**
 * @title ERC-3525 Semi-Fungible Token Standard, optional extension for approval of slot level
 * @dev Interfaces for any contract that wants to support approval of slot level, which allows an
 *  operator to manage one&apos;s tokens with the same slot.
 *  See https://eips.ethereum.org/EIPS/eip-3525
 * Note: the ERC-165 identifier for this interface is 0xb688be58.
 */
interface IERC3525SlotApprovable is IERC3525 {
    /**
     * @dev MUST emit when an operator is approved or disapproved to manage all of `_owner`&apos;s
     *  tokens with the same slot.
     * @param _owner The address whose tokens are approved
     * @param _slot The slot to approve, all of `_owner`&apos;s tokens with this slot are approved
     * @param _operator The operator being approved or disapproved
     * @param _approved Identify if `_operator` is approved or disapproved
     */
    event ApprovalForSlot(address indexed _owner, uint256 indexed _slot, address indexed _operator, bool _approved);

    /**
     * @notice Approve or disapprove an operator to manage all of `_owner`&apos;s tokens with the
     *  specified slot.
     * @dev Caller SHOULD be `_owner` or an operator who has been authorized through
     *  `setApprovalForAll`.
     *  MUST emit ApprovalSlot event.
     * @param _owner The address that owns the ERC-3525 tokens
     * @param _slot The slot of tokens being queried approval of
     * @param _operator The address for whom to query approval
     * @param _approved Identify if `_operator` would be approved or disapproved
     */
    function setApprovalForSlot(
        address _owner,
        uint256 _slot,
        address _operator,
        bool _approved
    ) external payable;

    /**
     * @notice Query if `_operator` is authorized to manage all of `_owner`&apos;s tokens with the
     *  specified slot.
     * @param _owner The address that owns the ERC-3525 tokens
     * @param _slot The slot of tokens being queried approval of
     * @param _operator The address for whom to query approval
     * @return True if `_operator` is authorized to manage all of `_owner`&apos;s tokens with `_slot`,
     *  false otherwise.
     */
    function isApprovedForSlot(
        address _owner,
        uint256 _slot,
        address _operator
    ) external view returns (bool);
}
```


### ERC-3525 Token Receiver

If a smart contract wants to be informed when they receive values from other addresses, it should implement all of the functions in the `IERC3525Receiver` interface, in the implementation it can decide whether to accept or reject the transfer. See &quot;Transfer Rules&quot; for further detail.

```solidity
 pragma solidity ^0.8.0;

/**
 * @title ERC-3525 token receiver interface
 * @dev Interface for a smart contract that wants to be informed by ERC-3525 contracts when receiving values from ANY addresses or ERC-3525 tokens.
 * Note: the ERC-165 identifier for this interface is 0x009ce20b.
 */
interface IERC3525Receiver {
    /**
     * @notice Handle the receipt of an ERC-3525 token value.
     * @dev An ERC-3525 smart contract MUST check whether this function is implemented by the recipient contract, if the
     *  recipient contract implements this function, the ERC-3525 contract MUST call this function after a 
     *  value transfer (i.e. `transferFrom(uint256,uint256,uint256,bytes)`).
     *  MUST return 0x009ce20b (i.e. `bytes4(keccak256(&apos;onERC3525Received(address,uint256,uint256,
     *  uint256,bytes)&apos;))`) if the transfer is accepted.
     *  MUST revert or return any value other than 0x009ce20b if the transfer is rejected.
     * @param _operator The address which triggered the transfer
     * @param _fromTokenId The token id to transfer value from
     * @param _toTokenId The token id to transfer value to
     * @param _value The transferred value
     * @param _data Additional data with no specified format
     * @return `bytes4(keccak256(&apos;onERC3525Received(address,uint256,uint256,uint256,bytes)&apos;))` 
     *  unless the transfer is rejected.
     */
    function onERC3525Received(address _operator, uint256 _fromTokenId, uint256 _toTokenId, uint256 _value, bytes calldata _data) external returns (bytes4);

}
```

### Token Manipulation

#### Scenarios

**_Transfer:_**

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.

```solidity
function transferFrom(uint256 _fromTokenId, uint256 _toTokenId, uint256 _value) external payable;
	
function transferFrom(uint256 _fromTokenId, address _to, uint256 _value) external payable returns (uint256 toTokenId_);
```

The first one allows value transfers from one token (specified by `_fromTokenId`) to another token (specified by `_toTokenId`) within the same slot, resulting in the `_value` being subtracted from the value of the source token and added to the value of the destination token; 

The second one allows value transfers from one token (specified by `_fromTokenId`) to an address (specified by `_to`), 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 &apos;design decision&apos; section for this method.

#### Rules

**_approving rules:_**

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.

- `setApprovalForAll`, 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.
- `setApprovalForSlot` (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.
- The token ID level `approve` 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.
- The value level `approve` function, SHOULD indicate that the authorized operator is capable of managing the specified maximum value of the specified token owned by the owner.
- For any approving function, the caller MUST be the owner or has been approved with a higher level of authority.

**_transferFrom rules:_**

- The `transferFrom(uint256 _fromTokenId, uint256 _toTokenId, uint256 _value)` function, SHOULD indicate value transfers from one token to another token, in accordance with the rules below:

  - MUST revert unless `msg.sender` is the owner of `_fromTokenId`, an authorized operator or an operator who has been approved the whole token or at least `_value` of it.
  - MUST revert if `_fromTokenId` or `_toTokenId` is zero token id or does not exist.
  - MUST revert if slots of `_fromTokenId` and `_toTokenId` do not match.
  - MUST revert if `_value` exceeds the value of `_fromTokenId` or its allowance to the operator.
  - MUST check for the `onERC3525Received` 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;
  - MUST emit `TransferValue` event.

- The `transferFrom(uint256 _fromTokenId, address _to, uint256 _value)` function, which transfers value from one token ID to an address, SHOULD follow the rule below:

  - MUST either find a ERC-3525 token owned by the address `_to` or create a new ERC-3525 token, with the same slot of `_fromTokenId`, to receive the transferred value.
  - MUST revert unless `msg.sender` is the owner of `_fromTokenId`, an authorized operator or an operator who has been approved the whole token or at least `_value` of it.
  - MUST revert if `_fromTokenId` is zero token id or does not exist.
  - MUST revert if `_to` is zero address.
  - MUST revert if `_value` exceeds the value of `_fromTokenId` or its allowance to the operator.
  - MUST check for the `onERC3525Received` 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;
  - MUST emit `Transfer` and `TransferValue` events.


### Metadata

#### Metadata Extensions

ERC-3525 metadata extensions are compatible ERC-721 metadata extensions.

This optional interface can be identified with the ERC-165 Standard Interface Detection.

```solidity
pragma solidity ^0.8.0;

/**
 * @title ERC-3525 Semi-Fungible Token Standard, optional extension for metadata
 * @dev Interfaces for any contract that wants to support query of the Uniform Resource Identifier
 *  (URI) for the ERC-3525 contract as well as a specified slot. 
 *  Because of the higher reliability of data stored in smart contracts compared to data stored in 
 *  centralized systems, it is recommended that metadata, including `contractURI`, `slotURI` and 
 *  `tokenURI`, be directly returned in JSON format, instead of being returned with a url pointing 
 *  to any resource stored in a centralized system. 
 *  See https://eips.ethereum.org/EIPS/eip-3525
 * Note: the ERC-165 identifier for this interface is 0xe1600902.
 */
interface IERC3525Metadata is
    IERC3525 /* , IERC721Metadata */
{
    /**
     * @notice Returns the Uniform Resource Identifier (URI) for the current ERC-3525 contract.
     * @dev This function SHOULD return the URI for this contract in JSON format, starting with
     *  header `data:application/json;`.
     *  See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for contract URI.
     * @return The JSON formatted URI of the current ERC-3525 contract
     */
    function contractURI() external view returns (string memory);

    /**
     * @notice Returns the Uniform Resource Identifier (URI) for the specified slot.
     * @dev This function SHOULD return the URI for `_slot` in JSON format, starting with header
     *  `data:application/json;`.
     *  See https://eips.ethereum.org/EIPS/eip-3525 for the JSON schema for slot URI.
     * @return The JSON formatted URI of `_slot`
     */
    function slotURI(uint256 _slot) external view returns (string memory);
}
```

#### ERC-3525 Metadata URI JSON Schema

This is the &quot;ERC-3525 Metadata JSON Schema for `contractURI()`&quot; referenced above.

```json
{
  &quot;title&quot;: &quot;Contract Metadata&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Contract Name&quot;
    },
    &quot;description&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Describes the contract&quot;
    },
    &quot;image&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Optional. Either a base64 encoded imgae data or a URI pointing to a resource with mime type image/* representing what this contract represents.&quot;
    },
    &quot;external_link&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Optional. A URI pointing to an external resource.&quot;
    },
    &quot;valueDecimals&quot;: {
      &quot;type&quot;: &quot;integer&quot;,
      &quot;description&quot;: &quot;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.&quot;
    }
  }
}
```

This is the &quot;ERC-3525 Metadata JSON Schema for `slotURI(uint)`&quot; referenced above.

```json
{
  &quot;title&quot;: &quot;Slot Metadata&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Identifies the asset category to which this slot represents&quot;
    },
    &quot;description&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Describes the asset category to which this slot represents&quot;
    },
    &quot;image&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Optional. Either a base64 encoded imgae data or a URI pointing to a resource with mime type image/* representing the asset category to which this slot represents.&quot;
    },
    &quot;properties&quot;: {
      &quot;type&quot;: &quot;array&quot;,
      &quot;description&quot;: &quot;Each item of `properties` SHOULD be organized in object format, including name, description, value, order (optional), display_type (optional), etc.&quot;
      &quot;items&quot;: {
        &quot;type&quot;: &quot;object&quot;,
        &quot;properties&quot;: {
          &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;The name of this property.&quot;
          },
          &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes this property.&quot;
          }
          &quot;value&quot;: {
            &quot;description&quot;: &quot;The value of this property, which may be a string or a number.&quot;
          },
          &quot;is_intrinsic&quot;: {
            &quot;type&quot;: &quot;boolean&quot;,
            &quot;description&quot;: &quot;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.&quot;
          },
          &quot;order&quot;: {
            &quot;type&quot;: &quot;integer&quot;,
            &quot;description&quot;: &quot;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.&quot;
          },
          &quot;display_type&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Optional. Specifies in what form this property should be displayed.&quot;
          }
        }
      }
    }
  }
}
```


This is the &quot;ERC-3525 Metadata JSON Schema for `tokenURI(uint)`&quot; referenced above.

```json
{
  &quot;title&quot;: &quot;Token Metadata&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Identifies the asset to which this token represents&quot;
    },
    &quot;description&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Describes the asset to which this token represents&quot;
    },
    &quot;image&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Either a base64 encoded imgae data or a URI pointing to a resource with mime type image/* representing the asset to which this token represents.&quot;
    },
    &quot;balance&quot;: {
      &quot;type&quot;: &quot;integer&quot;,
      &quot;description&quot;: &quot;THe value held by this token.&quot;
    },
    &quot;slot&quot;: {
      &quot;type&quot;: &quot;integer&quot;,
      &quot;description&quot;: &quot;The id of the slot that this token belongs to.&quot;
    },
    &quot;properties&quot;: {
      &quot;type&quot;: &quot;object&quot;,
      &quot;description&quot;: &quot;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.&quot;
    }
  }
}
```


## Rationale

### Metadata generation

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.

### Design decision: Value transfer from token to address

The &apos;value&apos; 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.

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&apos;s address, (2) transfer the value to the new token from the &apos;source token&apos;. 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.

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. 

Both implementations described above should be treated as compliant with this standard.

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.

### Design decision: Notification/acceptance mechanism instead of &apos;Safe Transfer&apos;

ERC-721 and some later token standards introduced &apos;Safe Transfer&apos; model, for better control of the &apos;safety&apos; when transferring tokens, this mechanism leaves the choice of different transfer modes (safe/unsafe) to the sender, and may cause some potential problems: 

1. In most situations the sender does not know how to choose between two kinds of transfer methods (safe/unsafe);
2. If the sender calls the `safeTransferFrom` 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.

This EIP defines a simple &apos;Check, Notify and Response&apos; model for better flexibility as well as simplicity:

1. No extra `safeTransferFrom` methods are needed, all callers only need to call one kind of transfer;
2. All ERC-3525 contracts MUST check for the existence of `onERC3525Received` on the recipient contract and call the function when it exists;
3. Any smart contract can implement `onERC3525Received` function for the purpose of being notified after receiving values; this function MUST return 0x009ce20b (i.e. `bytes4(keccak256(&apos;onERC3525Received(address,uint256,uint256,uint256,bytes)&apos;))`) if the transfer is accepted, or any other value if the transfer is rejected.

There is a special case for this notification/acceptance mechanism: since ERC-3525 allows value transfer from an address to itself, when a smart contract which implements `onERC3525Received` transfers value to itself, `onERC3525Received` 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.

### Design decision: Relationship between different approval models

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:

1. 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.
2. `setApprovalForAll` 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.

## Backwards Compatibility

As mentioned in the beginning, this EIP is backward compatible with ERC-721.

## Reference Implementation

- [ERC-3525 implementation](../assets/eip-3525/contracts/ERC3525.sol)

## Security Considerations

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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 01 Dec 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3525</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3525</guid>
      </item>
    
      <item>
        <title>Trust Minimized Upgradeability Proxy</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/trust-minimized-proxy/5742</comments>
        
        <description>## Abstract

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.

## Motivation

Anonymous developers who utilize upgradeability proxies typically struggle to earn the trust of the community.

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.

## Specification

The specification is an addition to the standard [EIP-1967](./eip-1967.md) 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 `onlyAdmin()` modifier.

### Next Logic Contract Address

Storage slot `0x19e3fabe07b65998b604369d85524946766191ac9434b39e27c424c976493685` (obtained as `bytes32(uint256(keccak256(&apos;eip3561.proxy.next.logic&apos;)) - 1)`).
Desirable implementation logic address must be first defined as next logic, before it can function as actual logic implementation stored in EIP-1967 `IMPLEMENTATION_SLOT`.
Admin interactions with next logic contract address correspond with these methods and events:

```solidity
// Sets next logic contract address. Emits NextLogicDefined
// If current implementation is address(0), then upgrades to IMPLEMENTATION_SLOT
// immedeatelly, therefore takes data as an argument
function proposeTo(address implementation, bytes calldata data) external IfAdmin
// As soon UPGRADE_BLOCK_SLOT allows, sets the address stored as next implementation
// as current IMPLEMENTATION_SLOT and initializes it.
function upgrade(bytes calldata data) external IfAdmin
// cancelling is possible for as long as upgrade() for given next logic was not called
// emits NextLogicCanceled
function cancelUpgrade() external onlyAdmin;

event NextLogicDefined(address indexed nextLogic, uint earliestArrivalBlock); // important to have
event NextLogicCanceled(address indexed oldLogic);
```

### Upgrade Block

Storage slot `0xe3228ec3416340815a9ca41bfee1103c47feb764b4f0f4412f5d92df539fe0ee` (obtained as `bytes32(uint256(keccak256(&apos;eip3561.proxy.next.logic.block&apos;)) - 1)`).
On/after this block next logic contract address can be set to EIP-1967 `IMPLEMENTATION_SLOT` or, in other words, `upgrade()` can be called. Updated automatically according to Zero Trust Period, shown as `earliestArrivalBlock` in the event `NextLogicDefined`.

### Propose Block

Storage slot `0x4b50776e56454fad8a52805daac1d9fd77ef59e4f1a053c342aaae5568af1388` (obtained as `bytes32(uint256(keccak256(&apos;eip3561.proxy.propose.block&apos;)) - 1)`).
Defines after/on which block *proposing* 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:

```solidity
function prolongLock(uint b) external onlyAdmin;
event ProposingUpgradesRestrictedUntil(uint block, uint nextProposedLogicEarliestArrival);
```

### Zero Trust Period

Storage slot `0x7913203adedf5aca5386654362047f05edbd30729ae4b0351441c46289146720` (obtained as `bytes32(uint256(keccak256(&apos;eip3561.proxy.zero.trust.period&apos;)) - 1)`).
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:

```solidity
function setZeroTrustPeriod(uint blocks) external onlyAdmin;
event ZeroTrustPeriodSet(uint blocks);
```

### Implementation Example

```solidity
pragma solidity &gt;=0.8.0; //important

// EIP-3561 trust minimized proxy implementation https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3561.md
// Based on EIP-1967 upgradeability proxy: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1967.md

contract TrustMinimizedProxy {
    event Upgraded(address indexed toLogic);
    event AdminChanged(address indexed previousAdmin, address indexed newAdmin);
    event NextLogicDefined(address indexed nextLogic, uint earliestArrivalBlock);
    event ProposingUpgradesRestrictedUntil(uint block, uint nextProposedLogicEarliestArrival);
    event NextLogicCanceled();
    event ZeroTrustPeriodSet(uint blocks);

    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
    bytes32 internal constant LOGIC_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
    bytes32 internal constant NEXT_LOGIC_SLOT = 0x19e3fabe07b65998b604369d85524946766191ac9434b39e27c424c976493685;
    bytes32 internal constant NEXT_LOGIC_BLOCK_SLOT = 0xe3228ec3416340815a9ca41bfee1103c47feb764b4f0f4412f5d92df539fe0ee;
    bytes32 internal constant PROPOSE_BLOCK_SLOT = 0x4b50776e56454fad8a52805daac1d9fd77ef59e4f1a053c342aaae5568af1388;
    bytes32 internal constant ZERO_TRUST_PERIOD_SLOT = 0x7913203adedf5aca5386654362047f05edbd30729ae4b0351441c46289146720;

    constructor() payable {
        require(
            ADMIN_SLOT == bytes32(uint256(keccak256(&apos;eip1967.proxy.admin&apos;)) - 1) &amp;&amp;
                LOGIC_SLOT == bytes32(uint256(keccak256(&apos;eip1967.proxy.implementation&apos;)) - 1) &amp;&amp;
                NEXT_LOGIC_SLOT == bytes32(uint256(keccak256(&apos;eip3561.proxy.next.logic&apos;)) - 1) &amp;&amp;
                NEXT_LOGIC_BLOCK_SLOT == bytes32(uint256(keccak256(&apos;eip3561.proxy.next.logic.block&apos;)) - 1) &amp;&amp;
                PROPOSE_BLOCK_SLOT == bytes32(uint256(keccak256(&apos;eip3561.proxy.propose.block&apos;)) - 1) &amp;&amp;
                ZERO_TRUST_PERIOD_SLOT == bytes32(uint256(keccak256(&apos;eip3561.proxy.zero.trust.period&apos;)) - 1)
        );
        _setAdmin(msg.sender);
    }

    modifier IfAdmin() {
        if (msg.sender == _admin()) {
            _;
        } else {
            _fallback();
        }
    }

    function _logic() internal view returns (address logic) {
        assembly {
            logic := sload(LOGIC_SLOT)
        }
    }

    function _nextLogic() internal view returns (address nextLogic) {
        assembly {
            nextLogic := sload(NEXT_LOGIC_SLOT)
        }
    }

    function _proposeBlock() internal view returns (uint b) {
        assembly {
            b := sload(PROPOSE_BLOCK_SLOT)
        }
    }

    function _nextLogicBlock() internal view returns (uint b) {
        assembly {
            b := sload(NEXT_LOGIC_BLOCK_SLOT)
        }
    }

    function _zeroTrustPeriod() internal view returns (uint ztp) {
        assembly {
            ztp := sload(ZERO_TRUST_PERIOD_SLOT)
        }
    }

    function _admin() internal view returns (address adm) {
        assembly {
            adm := sload(ADMIN_SLOT)
        }
    }

    function _setAdmin(address newAdm) internal {
        assembly {
            sstore(ADMIN_SLOT, newAdm)
        }
    }

    function changeAdmin(address newAdm) external IfAdmin {
        emit AdminChanged(_admin(), newAdm);
        _setAdmin(newAdm);
    }

    function upgrade(bytes calldata data) external IfAdmin {
        require(block.number &gt;= _nextLogicBlock(), &apos;too soon&apos;);
        address logic;
        assembly {
            logic := sload(NEXT_LOGIC_SLOT)
            sstore(LOGIC_SLOT, logic)
        }
        (bool success, ) = logic.delegatecall(data);
        require(success, &apos;failed to call&apos;);
        emit Upgraded(logic);
    }

    fallback() external payable {
        _fallback();
    }

    receive() external payable {
        _fallback();
    }

    function _fallback() internal {
        require(msg.sender != _admin());
        _delegate(_logic());
    }

    function cancelUpgrade() external IfAdmin {
        address logic;
        assembly {
            logic := sload(LOGIC_SLOT)
            sstore(NEXT_LOGIC_SLOT, logic)
        }
        emit NextLogicCanceled();
    }

    function prolongLock(uint b) external IfAdmin {
        require(b &gt; _proposeBlock(), &apos;can be only set higher&apos;);
        assembly {
            sstore(PROPOSE_BLOCK_SLOT, b)
        }
        emit ProposingUpgradesRestrictedUntil(b, b + _zeroTrustPeriod());
    }

    function setZeroTrustPeriod(uint blocks) external IfAdmin {
        // before this set at least once acts like a normal eip 1967 transparent proxy
        uint ztp;
        assembly {
            ztp := sload(ZERO_TRUST_PERIOD_SLOT)
        }
        require(blocks &gt; ztp, &apos;can be only set higher&apos;);
        assembly {
            sstore(ZERO_TRUST_PERIOD_SLOT, blocks)
        }
        _updateNextBlockSlot();
        emit ZeroTrustPeriodSet(blocks);
    }

    function _updateNextBlockSlot() internal {
        uint nlb = block.number + _zeroTrustPeriod();
        assembly {
            sstore(NEXT_LOGIC_BLOCK_SLOT, nlb)
        }
    }

    function _setNextLogic(address nl) internal {
        require(block.number &gt;= _proposeBlock(), &apos;too soon&apos;);
        _updateNextBlockSlot();
        assembly {
            sstore(NEXT_LOGIC_SLOT, nl)
        }
        emit NextLogicDefined(nl, block.number + _zeroTrustPeriod());
    }

    function proposeTo(address newLogic, bytes calldata data) external payable IfAdmin {
        if (_zeroTrustPeriod() == 0 || _logic() == address(0)) {
            _updateNextBlockSlot();
            assembly {
                sstore(LOGIC_SLOT, newLogic)
            }
            (bool success, ) = newLogic.delegatecall(data);
            require(success, &apos;failed to call&apos;);
            emit Upgraded(newLogic);
        } else {
            _setNextLogic(newLogic);
        }
    }

    function _delegate(address logic_) internal {
        assembly {
            calldatacopy(0, 0, calldatasize())
            let result := delegatecall(gas(), logic_, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            switch result
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }
}
```

## Rationale

An argument &quot;just don&apos;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.

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&apos;s a critically important option to have in smart contract development today.

## Security Considerations

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).

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 09 May 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3561</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3561</guid>
      </item>
    
      <item>
        <title>Sealed NFT Metadata Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-3569-sealed-nft-metadata-standard/7130</comments>
        
        <description>## Simple Summary

The Sealed NFT Metadata Extension provides a mechanism to immortalize NFT metadata in a cost-effective manner.

## Abstract

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 `seal` 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 `seal` function can be called after NFT creation, or during the NFT creation process.

## Motivation

In the original ERC-721 standard, the metadata extension specifies a `tokenURI` 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&apos;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.

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&apos;s CROSSROAD NFT). If there comes a time when the NFT metadata should be immortalized, then the creator can call the `seal` method. Owners, potential owners, or platforms can verify that the NFT was sealed and can check the returned URI. If the `sealedURI` return value is not hosted on a decentralized storage platform, or the `isSealed` method does not return `true` 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.

## Specification

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.

```
interface SealedMetadata {
  /**
    @notice This function is used to set a sealed URI for the given range of tokens.
    @dev
      - If the sealed URI is being set for one token then the fromTokenId and toTokenId
      values MUST be the same.

      - If any token within the range of tokens specified has already
      been sealed then this function MUST throw.

      - This function MAY be called at the time of NFT creation, or after the NFTs have been created.

      - It is RECOMMENDED that this function only be executable by either the creator of the smart contract,
        or the creator of the NFTs, but this is OPTIONAL and should be implemented based on use case.

      - This function MUST emit the Sealed event

      - The URI argument SHOULD point to a JSON file hosted within a decentralized file system like IPFS

    @param fromTokenId The first token in a consecutive range of tokens
    @param toTokenId The ending token in a consecutive range of tokens
    @param uri A URI which points to a JSON file hosted on a decentralized file system.
  */
  function seal(uint256 fromTokenId, uint256 toTokenId, string memory uri) external;

  /**
    @notice This function returns the URI which the sealed metadata can be found for the given token ID
    @dev
      - This function MUST throw if the token ID does not exist, or is not sealed

    @param tokenId Token ID to retrieve the sealed URI for

    @return The sealed URI in which the metadata for the given token ID can be found
  */
  function sealedURI(uint256 tokenId) external view returns (string);

  /**
    @notice This function returns a boolean stating if the token ID is sealed or not
    @dev This function should throw if the token ID does not exist

    @param tokenId The token ID that will be checked if sealed or not

    @return Boolean stating if token ID is sealed
  */
  function isSealed(uint256 tokenId) external view returns (bool)

  /// @dev This emits when a range of tokens is sealed
  event Sealed(uint256 indexed fromTokenId, uint256 indexed toTokenId, string memory uri);

}
```

### Sealed Metadata JSON Format

The sealed metadata JSON file MAY contain metadata for many different tokens. The top level keys of the JSON object MUST be token IDs.

```

type ERC721Metadata = {
  name?: string;
  image?: string;
  description?: string;
}

type SealedMetaDataJson = {
  [tokenId: string]: string | ERC721Metadata;
}

const sealedMetadata: SealedMetaDataJson = {
    &apos;1&apos;: {
        name: &apos;Metadata for token with ID 1&apos;
    },
    &apos;2&apos;: {
        name: &apos;Metadata for token with ID 2&apos;
    },
    // Example pointing to another file
    &apos;3&apos;: &apos;ipfs://SOME_HASH_ON_IPFS&apos;
};
```

## Rationale

**Rationale for rule not explicitly requiring that sealed URI be hosted on decentralized filestorage**

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.

**Rationale to include many NFT metadata objects, or URIs in one JSON file**

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.

**Rationale for emitting `Sealed` event**

Platforms and explorers can use the `Sealed` event to automatically cache metadata, or update information regarding specified NFTs.

**Rationale for allowing URIs as values in the JSON file**

If a token&apos;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.

## Backwards Compatibility

There is no backwards compatibility with existing standards. This is an extension which could be added to existing NFT standards.

## Security Considerations

There are no security considerations related directly to the implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 07 May 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3569</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3569</guid>
      </item>
    
      <item>
        <title>Assemble assets into NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/3590</comments>
        
        <description>## Simple Summary
This standard defines a ERC-721 token called assembly token which can represent a combination of assets.

## Abstract
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&apos;s signature. As assets get assembled into one, batch transfer or swap can be implemented very easily.

## Motivation
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&apos;s collections to B and B&apos;s to A. This is very risky.

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.

## Specification
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.

ERC-721 compliant contracts MAY implement this ERC to provide a standard method to assemble assets.

`mint` and `safeMint` assemble assets into one ERC-721 token. `mint` SHOULD be implemented for normal ERC-20 tokens whose `_transfer` is lossless. `safeMint` MUST takes care for lossy token such as PIG token whose `_transfer` function is taxed.

`_salt` of `hash` function MAY be implemented other way, even provided as user input. But the token id MUST be generated by `hash` function.

Implementations of the standard MAY supports different set of assets.

Implementers of this standard MUST have all of the following functions:

```
pragma solidity ^0.8.0;

interface AssemblyNFTInterface {

  event AssemblyAsset(address indexed firstHolder,
                    uint256 indexed tokenId,
                    uint256 salt,
                    address[] addresses,
                    uint256[] numbers);

  /**
  * @dev hash function assigns the combination of assets with salt to bytes32 signature that is also the token id.
  * @param `_salt` prevents hash collision, can be chosen by user input or increasing nonce from contract.
  * @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]
  * @param `_numbers` describes how many eth, ERC-20 token addresses length, ERC-721 token addresses length, ERC-1155 token addresses length,
  * ERC-20 token amounts, ERC-721 token ids, ERC-1155 token ids and amounts.
  */
  function hash(uint256 _salt, address[] memory _addresses, uint256[] memory _numbers) external pure returns (uint256 tokenId);

  /// @dev to assemble lossless assets
  /// @param `_to` the receiver of the assembly token
  function mint(address _to, address[] memory _addresses, uint256[] memory _numbers) payable external returns(uint256 tokenId);

  /// @dev mint with additional logic that calculates the actual received value for tokens.
  function safeMint(address _to, address[] memory _addresses, uint256[] memory _numbers) payable external returns(uint256 tokenId);

  /// @dev burn this token and releases assembled assets
  /// @param `_to` to which address the assets is released
  function burn(address _to, uint256 _tokenId, uint256 _salt, address[] calldata _addresses, uint256[] calldata _numbers) external;

}

```

## Rationale
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.

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.

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.

## Backwards Compatibility
This proposal combines already available 721 extensions and is backwards compatible with the ERC-721 standard.

## Implementation
```
pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC20/IERC20.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC1155/ERC1155.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol&quot;;
import &quot;./AssemblyNFTInterface.sol&quot;;

abstract contract AssemblyNFT is ERC721, ERC721Holder, ERC1155Holder, AssemblyNFTInterface{
  using SafeERC20 for IERC20;

  function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC1155Receiver) returns (bool) {
        return ERC721.supportsInterface(interfaceId) || ERC1155Receiver.supportsInterface(interfaceId);
  }

  uint256 nonce;

  /**
  * layout of _addresses:
  *     erc20 addresses | erc721 addresses | erc1155 addresses
  * layout of _numbers:
  *     eth | erc20.length | erc721.length | erc1155.length | erc20 amounts | erc721 ids | erc1155 ids | erc1155 amounts
   */

  function hash(uint256 _salt, address[] memory _addresses, uint256[] memory _numbers) public pure override returns (uint256 tokenId){
      bytes32 signature = keccak256(abi.encodePacked(_salt));
      for(uint256 i=0; i&lt; _addresses.length; i++){
        signature = keccak256(abi.encodePacked(signature, _addresses[i]));
      }
      for(uint256 j=0; j&lt;_numbers.length; j++){
        signature = keccak256(abi.encodePacked(signature, _numbers[j]));
      }
      assembly {
        tokenId := signature
      }
  }

  function mint(address _to, address[] memory _addresses, uint256[] memory _numbers) payable external override returns(uint256 tokenId){
      require(_to != address(0), &quot;can&apos;t mint to address(0)&quot;);
      require(msg.value == _numbers[0], &quot;value not match&quot;);
      require(_addresses.length == _numbers[1] + _numbers[2] + _numbers[3], &quot;2 array length not match&quot;);
      require(_addresses.length == _numbers.length -4 - _numbers[3], &quot;numbers length not match&quot;);
      uint256 pointerA; //points to first erc20 address, if there is any
      uint256 pointerB =4; //points to first erc20 amount, if there is any
      for(uint256 i = 0; i&lt; _numbers[1]; i++){
        require(_numbers[pointerB] &gt; 0, &quot;transfer erc20 0 amount&quot;);
        IERC20(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB++]);
      }
      for(uint256 j = 0; j&lt; _numbers[2]; j++){
        IERC721(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB++]);
      }
      for(uint256 k =0; k&lt; _numbers[3]; k++){
        IERC1155(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB], _numbers[_numbers[3] + pointerB++], &quot;&quot;);
      }
      tokenId = hash(nonce, _addresses, _numbers);
      super._mint(_to, tokenId);
      emit AssemblyAsset(_to, tokenId, nonce, _addresses, _numbers);
      nonce ++;
  }

  function safeMint(address _to, address[] memory _addresses, uint256[] memory _numbers) payable external override returns(uint256 tokenId){
      require(_to != address(0), &quot;can&apos;t mint to address(0)&quot;);
      require(msg.value == _numbers[0], &quot;value not match&quot;);
      require(_addresses.length == _numbers[1] + _numbers[2] + _numbers[3], &quot;2 array length not match&quot;);
      require(_addresses.length == _numbers.length -4 - _numbers[3], &quot;numbers length not match&quot;);
      uint256 pointerA; //points to first erc20 address, if there is any
      uint256 pointerB =4; //points to first erc20 amount, if there is any
      for(uint256 i = 0; i&lt; _numbers[1]; i++){
        require(_numbers[pointerB] &gt; 0, &quot;transfer erc20 0 amount&quot;);
        IERC20 token = IERC20(_addresses[pointerA++]);
        uint256 orgBalance = token.balanceOf(address(this));
        token.safeTransferFrom(_msgSender(), address(this), _numbers[pointerB]);
        _numbers[pointerB++] = token.balanceOf(address(this)) - orgBalance;
      }
      for(uint256 j = 0; j&lt; _numbers[2]; j++){
        IERC721(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB++]);
      }
      for(uint256 k =0; k&lt; _numbers[3]; k++){
        IERC1155(_addresses[pointerA++]).safeTransferFrom(_msgSender(), address(this), _numbers[pointerB], _numbers[_numbers[3] + pointerB++], &quot;&quot;);
      }
      tokenId = hash(nonce, _addresses, _numbers);
      super._mint(_to, tokenId);
      emit AssemblyAsset(_to, tokenId, nonce, _addresses, _numbers);
      nonce ++;
  }

  function burn(address _to, uint256 _tokenId, uint256 _salt, address[] calldata _addresses, uint256[] calldata _numbers) override external {
      require(_msgSender() == ownerOf(_tokenId), &quot;not owned&quot;);
      require(_tokenId == hash(_salt, _addresses, _numbers));
      super._burn(_tokenId);
      payable(_to).transfer(_numbers[0]);
      uint256 pointerA; //points to first erc20 address, if there is any
      uint256 pointerB =4; //points to first erc20 amount, if there is any
      for(uint256 i = 0; i&lt; _numbers[1]; i++){
        require(_numbers[pointerB] &gt; 0, &quot;transfer erc20 0 amount&quot;);
        IERC20(_addresses[pointerA++]).safeTransfer(_to, _numbers[pointerB++]);
      }
      for(uint256 j = 0; j&lt; _numbers[2]; j++){
        IERC721(_addresses[pointerA++]).safeTransferFrom(address(this), _to, _numbers[pointerB++]);
      }
      for(uint256 k =0; k&lt; _numbers[3]; k++){
        IERC1155(_addresses[pointerA++]).safeTransferFrom(address(this), _to, _numbers[pointerB], _numbers[_numbers[3] + pointerB++], &quot;&quot;);
      }
  }

}
```

## Security Considerations
Before using `mint` or `safeMint` 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 `burn` function may not be executed successfully. Platforms using this standard should make support lists or block lists to avoid this situation.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 24 May 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3589</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3589</guid>
      </item>
    
      <item>
        <title>T-REX - Token for Regulated EXchanges</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-3643-proposition-of-the-t-rex-token-standard-for-securities/6844</comments>
        
        <description>## Abstract

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.

The standard defines several interfaces that are described hereunder:

- Token 
- Identity Registry
- Identity Registry Storage
- Compliance 
- Trusted Issuers Registry 
- Claim Topics Registry

## Motivation

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.

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.

The proposed [ERC-3643](./eip-3643.md) 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.

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.

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.

## Specification

The proposed standard has the following requirements:

- **MUST** be [ERC-20](./eip-20.md) compatible.
- **MUST** be used in combination with an onchain Identity system
- **MUST** 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)
- **MUST** have a standard interface to pre-check if a transfer is going to pass or fail before sending it to the blockchain
- **MUST** have a recovery system in case an investor loses access to his private key
- **MUST** be able to freeze tokens on the wallet of investors if needed, partially or totally
- **MUST** have the possibility to pause the token
- **MUST** be able to mint and burn tokens
- **MUST** define an Agent role and an Owner (token issuer) role
- **MUST** be able to force transfers from an Agent wallet
- **MUST** be able to issue transactions in batch (to save gas and to have all the transactions performed in the same block)

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.

### Agent Role Interface

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:

```solidity
interface IAgentRole {

  // events
  event AgentAdded(address indexed _agent);
  event AgentRemoved(address indexed _agent);
  
  // functions
  // setters
  function addAgent(address _agent) external;
  function removeAgent(address _agent) external;

  // getters
  function isAgent(address _agent) external view returns (bool);
}
 ```

The `IAgentRole` 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 [ERC-173](./eip-173.md), 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 `IAgentRole` interface.

### Main functions

#### Transfer

To be able to perform a transfer on T-REX you need to fulfill several conditions :

- The sender **MUST** hold enough free balance (total balance - frozen tokens, if any)
- The receiver **MUST** be whitelisted on the Identity Registry and verified (hold the necessary claims on his onchain Identity)
- The sender&apos;s wallet **MUST NOT** be frozen
- The receiver&apos;s wallet **MUST NOT** be frozen
- The token **MUST NOT** be paused
- The transfer **MUST** respect all the rules of compliance defined in the Compliance smart contract (canTransfer needs to return TRUE)

Here is an example of `transfer` function implementation :

```solidity
function transfer(address _to, uint256 _amount) public override whenNotPaused returns (bool) {
        require(!_frozen[_to] &amp;&amp; !_frozen[msg.sender], &quot;ERC-3643: Frozen wallet&quot;);
        require(_amount &lt;= balanceOf(msg.sender) - (_frozenTokens[msg.sender]), &quot;ERC-3643: Insufficient Balance&quot;);
        require( _tokenIdentityRegistry.isVerified(to), &quot;ERC-3643: Invalid identity&quot; ); 
        require( _tokenCompliance.canTransfer(from, to, amount), &quot;ERC-3643: Compliance failure&quot; );
        _transfer(msg.sender, _to, _amount);
        _tokenCompliance.transferred(msg.sender, _to, _amount);
        return true;
    }
 ```

The `transferFrom` function works the same way while the `mint` function and the `forcedTransfer` function only require the receiver to be whitelisted and verified on the Identity Registry (they bypass the compliance rules). The `burn` function bypasses all checks on eligibility.

#### isVerified

The `isVerified` function is called from within the transfer functions `transfer`, `transferFrom`, `mint` and 
`forcedTransfer` to instruct the `Identity Registry` to check if the receiver is a valid investor, i.e. if his 
wallet address is in the `Identity Registry` of the token, and if the `Identity`contract linked to his wallet 
contains the claims (see [Claim Holder](../assets/eip-3643/ONCHAINID/IERC735.sol)) required in the `Claim Topics Registry` and 
if these claims are signed by an authorized Claim Issuer as required in the `Trusted Issuers Registry`.
If all the requirements are fulfilled, the `isVerified` function returns `TRUE`, otherwise it returns `FALSE`. An 
implementation of this function can be found on the T-REX repository of Tokeny.

#### canTransfer

The `canTransfer` 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 `isVerified` that only checks the eligibility of an investor to hold and receive tokens, the `canTransfer` 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 `canTransfer` function will return `TRUE` otherwise it will return 
`FALSE` and the transfer will not be allowed to happen. An implementation of this function can be found on the T-REX 
repository of Tokeny.

#### Other functions

Description of other functions of the ERC-3643 can be found in the `interfaces` folder. An implementation of the 
ERC-3643 suite of smart contracts can be found on the T-REX repository of Tokeny.

### Token interface

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 `transfer` and `transferFrom` 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/Identity contracts of ineligible/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.

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 `IAgentRole` interface.

A detailed description of the functions can be found in the [interfaces folder](../assets/eip-3643/interfaces/IERC3643.sol).

```solidity
interface IERC3643 is IERC20 {

   // events
    event UpdatedTokenInformation(string _newName, string _newSymbol, uint8 _newDecimals, string _newVersion, address _newOnchainID);
    event IdentityRegistryAdded(address indexed _identityRegistry);
    event ComplianceAdded(address indexed _compliance);
    event RecoverySuccess(address _lostWallet, address _newWallet, address _investorOnchainID);
    event AddressFrozen(address indexed _userAddress, bool indexed _isFrozen, address indexed _owner);
    event TokensFrozen(address indexed _userAddress, uint256 _amount);
    event TokensUnfrozen(address indexed _userAddress, uint256 _amount);
    event Paused(address _userAddress);
    event Unpaused(address _userAddress);


    // functions
    // getters
    function onchainID() external view returns (address);
    function version() external view returns (string memory);
    function identityRegistry() external view returns (IIdentityRegistry);
    function compliance() external view returns (ICompliance);
    function paused() external view returns (bool);
    function isFrozen(address _userAddress) external view returns (bool);
    function getFrozenTokens(address _userAddress) external view returns (uint256);

    // setters
    function setName(string calldata _name) external;
    function setSymbol(string calldata _symbol) external;
    function setOnchainID(address _onchainID) external;
    function pause() external;
    function unpause() external;
    function setAddressFrozen(address _userAddress, bool _freeze) external;
    function freezePartialTokens(address _userAddress, uint256 _amount) external;
    function unfreezePartialTokens(address _userAddress, uint256 _amount) external;
    function setIdentityRegistry(address _identityRegistry) external;
    function setCompliance(address _compliance) external;

    // transfer actions
    function forcedTransfer(address _from, address _to, uint256 _amount) external returns (bool);
    function mint(address _to, uint256 _amount) external;
    function burn(address _userAddress, uint256 _amount) external;
    function recoveryAddress(address _lostWallet, address _newWallet, address _investorOnchainID) external returns (bool);

    // batch functions
    function batchTransfer(address[] calldata _toList, uint256[] calldata _amounts) external;
    function batchForcedTransfer(address[] calldata _fromList, address[] calldata _toList, uint256[] calldata _amounts) external;
    function batchMint(address[] calldata _toList, uint256[] calldata _amounts) external;
    function batchBurn(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
    function batchSetAddressFrozen(address[] calldata _userAddresses, bool[] calldata _freeze) external;
    function batchFreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
    function batchUnfreezePartialTokens(address[] calldata _userAddresses, uint256[] calldata _amounts) external;
}

```

### Identity Registry Interface

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&apos;s country of residence. This country code is set in accordance with the ISO-3166 standard. The Identity Registry also includes a function called `isVerified()`, which returns a status based on the validity of claims (as per the security token requirements) in the user’s Identity contract.

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 `IAgentRole` 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.

A detailed description of the functions can be found in the [interfaces folder](../assets/eip-3643/interfaces/IIdentityRegistry.sol).

Note that [`IClaimIssuer`](../assets/eip-3643/ONCHAINID/IClaimIssuer.sol) and [`IIdentity`](../assets/eip-3643/ONCHAINID/IIdentity.sol) are needed in this interface as they are required for the Identity eligibility checks.

```solidity
interface IIdentityRegistry {


    // events
    event ClaimTopicsRegistrySet(address indexed claimTopicsRegistry);
    event IdentityStorageSet(address indexed identityStorage);
    event TrustedIssuersRegistrySet(address indexed trustedIssuersRegistry);
    event IdentityRegistered(address indexed investorAddress, IIdentity indexed identity);
    event IdentityRemoved(address indexed investorAddress, IIdentity indexed identity);
    event IdentityUpdated(IIdentity indexed oldIdentity, IIdentity indexed newIdentity);
    event CountryUpdated(address indexed investorAddress, uint16 indexed country);


    // functions
    // identity registry getters
    function identityStorage() external view returns (IIdentityRegistryStorage);
    function issuersRegistry() external view returns (ITrustedIssuersRegistry);
    function topicsRegistry() external view returns (IClaimTopicsRegistry);

    //identity registry setters
    function setIdentityRegistryStorage(address _identityRegistryStorage) external;
    function setClaimTopicsRegistry(address _claimTopicsRegistry) external;
    function setTrustedIssuersRegistry(address _trustedIssuersRegistry) external;

    // registry actions
    function registerIdentity(address _userAddress, IIdentity _identity, uint16 _country) external;
    function deleteIdentity(address _userAddress) external;
    function updateCountry(address _userAddress, uint16 _country) external;
    function updateIdentity(address _userAddress, IIdentity _identity) external;
    function batchRegisterIdentity(address[] calldata _userAddresses, IIdentity[] calldata _identities, uint16[] calldata _countries) external;

    // registry consultation
    function contains(address _userAddress) external view returns (bool);
    function isVerified(address _userAddress) external view returns (bool);
    function identity(address _userAddress) external view returns (IIdentity);
    function investorCountry(address _userAddress) external view returns (uint16);
}
```

### Identity Registry Storage Interface

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 `isVerifed()` function implemented in the Identity Registries to check the eligibility of the receiver in a transfer transaction.

The standard relies on ERC-173 to define contract ownership, with the owner having the responsibility of appointing agents(in this case through the `bindIdentityRegistry` function). Any contract that fulfills the role of an Identity Registry Storage within the context of this standard must be compatible with the `IAgentRole` 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.

A detailed description of the functions can be found in the [interfaces folder](../assets/eip-3643/interfaces/IIdentityRegistryStorage.sol).

```solidity
interface IIdentityRegistryStorage {

    //events
    event IdentityStored(address indexed investorAddress, IIdentity indexed identity);
    event IdentityUnstored(address indexed investorAddress, IIdentity indexed identity);
    event IdentityModified(IIdentity indexed oldIdentity, IIdentity indexed newIdentity);
    event CountryModified(address indexed investorAddress, uint16 indexed country);
    event IdentityRegistryBound(address indexed identityRegistry);
    event IdentityRegistryUnbound(address indexed identityRegistry);

    //functions
    // storage related functions
    function storedIdentity(address _userAddress) external view returns (IIdentity);
    function storedInvestorCountry(address _userAddress) external view returns (uint16);
    function addIdentityToStorage(address _userAddress, IIdentity _identity, uint16 _country) external;
    function removeIdentityFromStorage(address _userAddress) external;
    function modifyStoredInvestorCountry(address _userAddress, uint16 _country) external;
    function modifyStoredIdentity(address _userAddress, IIdentity _identity) external;

    // role setter
    function bindIdentityRegistry(address _identityRegistry) external;
    function unbindIdentityRegistry(address _identityRegistry) external;

    // getter for bound IdentityRegistry role
    function linkedIdentityRegistries() external view returns (address[] memory);
}
```

### Compliance Interface

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 `Modules` to fit the legal requirements of the token in the same way as a custom &quot;tailor-made&quot; contract would.

This contract is triggered at every transaction by the Token and returns `TRUE` if the transaction is compliant with the rules of the offering and `FALSE` otherwise.

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.

A detailed description of the functions can be found in the [interfaces folder](../assets/eip-3643/interfaces/ICompliance.sol).

```solidity
interface ICompliance {

    // events
    event TokenBound(address _token);
    event TokenUnbound(address _token);

    // functions
    // initialization of the compliance contract
    function bindToken(address _token) external;
    function unbindToken(address _token) external;

    // check the parameters of the compliance contract
    function isTokenBound(address _token) external view returns (bool);
    function getTokenBound() external view returns (address);

    // compliance check and state update
    function canTransfer(address _from, address _to, uint256 _amount) external view returns (bool);
    function transferred(address _from, address _to, uint256 _amount) external;
    function created(address _to, uint256 _amount) external;
    function destroyed(address _from, uint256 _amount) external;
}
```

### Trusted Issuer&apos;s Registry Interface

The Trusted Issuer&apos;s Registry stores the contract addresses ([IClaimIssuer](../assets/eip-3643/ONCHAINID/IClaimIssuer.sol)) of all the trusted claim issuers for a specific security token. The Identity contract ([IIdentity](../assets/eip-3643/ONCHAINID/IIdentity.sol)) 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.

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.

A detailed description of the functions can be found in the [interfaces folder](../assets/eip-3643/interfaces/ITrustedIssuersRegistry.sol).

```solidity
interface ITrustedIssuersRegistry {

    // events
    event TrustedIssuerAdded(IClaimIssuer indexed trustedIssuer, uint[] claimTopics);
    event TrustedIssuerRemoved(IClaimIssuer indexed trustedIssuer);
    event ClaimTopicsUpdated(IClaimIssuer indexed trustedIssuer, uint[] claimTopics);

    // functions
    // setters
    function addTrustedIssuer(IClaimIssuer _trustedIssuer, uint[] calldata _claimTopics) external;
    function removeTrustedIssuer(IClaimIssuer _trustedIssuer) external;
    function updateIssuerClaimTopics(IClaimIssuer _trustedIssuer, uint[] calldata _claimTopics) external;

    // getters
    function getTrustedIssuers() external view returns (IClaimIssuer[] memory);
    function isTrustedIssuer(address _issuer) external view returns(bool);
    function getTrustedIssuerClaimTopics(IClaimIssuer _trustedIssuer) external view returns(uint[] memory);
    function getTrustedIssuersForClaimTopic(uint256 claimTopic) external view returns (IClaimIssuer[] memory);
    function hasClaimTopic(address _issuer, uint _claimTopic) external view returns(bool);
}
```

### Claim Topics Registry Interface

The Claim Topics Registry stores all the trusted claim topics for the security token. The Identity contract ([IIdentity](../assets/eip-3643/ONCHAINID/IIdentity.sol)) of token owners must contain claims of the claim topics stored in this smart contract.

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.

A detailed description of the functions can be found in the [interfaces folder](../assets/eip-3643/interfaces/IClaimTopicsRegistry.sol).

```solidity
interface IClaimTopicsRegistry {

    // events
    event ClaimTopicAdded(uint256 indexed claimTopic);
    event ClaimTopicRemoved(uint256 indexed claimTopic);

    // functions
    // setters
    function addClaimTopic(uint256 _claimTopic) external;
    function removeClaimTopic(uint256 _claimTopic) external;

    // getter
    function getClaimTopics() external view returns (uint256[] memory);
}
```

## Rationale

### Transfer Restrictions

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 `balanceOf` and `allowance` 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 `canTransfer` 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 `isVerified` which allows checking the eligibility status of the identity of the investor. Transfers can also fail if the address of the sender and/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 `paused`.

### Identity Management

Security and compliance of transfers are enforced through the management of on-chain identities. These include:

- Identity contract: A unique identifier for each investor, which is used to manage their identity and claims.
- 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/AML clearance.
- Identity Storage/Registry: A storage system for all Identity contracts and their associated wallets, which is used to 
  verify the eligibility of investors during transfers.

### Token Lifecycle Management

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&apos;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.

### Additional Compliance Rules

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.

### Inclusion of Agent-Related Functions

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.

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.

## Backwards Compatibility

T-REX tokens should be backwards compatible with ERC-20 and ERC-173
and should be able to interact with a [Claim Holder contract](../assets/eip-3643/ONCHAINID/IERC735.sol) to validate 
the claims linked to an [Identity contract](../assets/eip-3643/ONCHAINID/IIdentity.sol).


## Security Considerations

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. 

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 09 Jul 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3643</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3643</guid>
      </item>
    
      <item>
        <title>CCIP Read—Secure offchain data retrieval</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/durin-secure-offchain-data-retrieval/6728</comments>
        
        <description>## Abstract
Contracts wishing to support lookup of data from external sources may, instead of returning the data directly, revert using `OffchainLookup(address sender, string[] urls, bytes callData, bytes4 callbackFunction, bytes extraData)`. Clients supporting this specification then make an RPC call to a URL from `urls`, supplying `callData`, and getting back an opaque byte string `response`. Finally, clients call the function specified by `callbackFunction` on the contract, providing `response` and `extraData`. The contract can then decode and verify the returned data using an implementation-specific method.

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.

## Motivation
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/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.

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.

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.

Examples of this include:
 - Interacting with &apos;airdrop&apos; contracts that store a list of recipients offchain in a merkle trie.
 - Viewing token information for tokens stored on an L2 solution as if they were native L1 tokens.
 - Allowing delegation of data such as ENS domains to various L2 solutions, without requiring clients to support each solution individually.
 - Allowing contracts to proactively request external data to complete a call, without requiring the caller to be aware of the details of that data.

## Specification
### Overview
Answering a query via CCIP read takes place in three steps:

 1. Querying the contract.
 2. Querying the gateway using the URL provided in (1).
 3. Querying or sending a transaction to the contract using the data from (1) and (2).

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).

In step 2, the client calls the gateway service with the `callData` from the revert message in step (1). The gateway responds with an answer `response`, whose content is opaque to the client.

In step 3, the client calls the original contract, supplying the `response` from step (2) and the `extraData` 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.

```
┌──────┐                                          ┌────────┐ ┌─────────────┐
│Client│                                          │Contract│ │Gateway @ url│
└──┬───┘                                          └───┬────┘ └──────┬──────┘
   │                                                  │             │
   │ somefunc(...)                                    │             │
   ├─────────────────────────────────────────────────►│             │
   │                                                  │             │
   │ revert OffchainLookup(sender, urls, callData,    │             │
   │                     callbackFunction, extraData) │             │
   │◄─────────────────────────────────────────────────┤             │
   │                                                  │             │
   │ HTTP request (sender, callData)                  │             │
   ├──────────────────────────────────────────────────┼────────────►│
   │                                                  │             │
   │ Response (result)                                │             │
   │◄─────────────────────────────────────────────────┼─────────────┤
   │                                                  │             │
   │ callbackFunction(result, extraData)              │             │
   ├─────────────────────────────────────────────────►│             │
   │                                                  │             │
   │ answer                                           │             │
   │◄─────────────────────────────────────────────────┤             │
   │                                                  │             │
```

### Contract interface

A CCIP read enabled contract MUST revert with the following error whenever a function that requires offchain data is called:

```solidity
error OffchainLookup(address sender, string[] urls, bytes callData, bytes4 callbackFunction, bytes extraData)
```

`sender` 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 &apos;bubbled up&apos; from a nested call.

`urls` 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. `urls` can be the empty list `[]`, 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.

Each URL may include two substitution parameters, `{sender}` and `{data}`. Before a call is made to the URL, `sender` is replaced with the lowercase 0x-prefixed hexadecimal formatted `sender` parameter, and `data` is replaced by the 0x-prefixed hexadecimal formatted `callData` parameter.

`callData` 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.

`callbackFunction` is the 4-byte function selector for a function on the original contract to which a callback should be sent.

`extraData` 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.

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 `(bytes response, bytes extraData)`, and MUST have the same return type as the function that reverted with `OffchainLookup`.

If the client successfully calls the gateway, the callback function specified in the `OffchainLookup` error will be invoked by the client, with `response` set to the value returned by the gateway, and `extraData` set to the value returned in the contract&apos;s `OffchainLookup` 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.

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.

#### Example

Suppose a contract has the following method:

```solidity
function balanceOf(address addr) public view returns(uint balance);
```

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:

```solidity
function balanceOfWithProof(bytes calldata response, bytes calldata extraData) public view returns(uint balance);
```

One example of a valid implementation of `balanceOf` would thus be:

```solidity
function balanceOf(address addr) public view returns(uint balance) {
    revert OffchainLookup(
        address(this),
        [url],
        abi.encodeWithSelector(Gateway.getSignedBalance.selector, addr),
        ContractName.balanceOfWithProof.selector,
        abi.encode(addr)
    );
}
```

Note that in this example the contract is returning `addr` in both `callData` and `extraData`, 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.

#### Recursive calls in CCIP-aware contracts

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 `OffchainLookup` errors thrown by the callee, and revert with a different error if the `sender` field of the error does not match the callee address.

The contract MAY choose to replace all `OffchainLookup` errors with a different error. Doing so avoids the complexity of implementing support for nested CCIP read calls, but renders them impossible.

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:

 1. Contract A calls non-CCIP-aware contract B.
 2. Contract B calls back to A.
 3. In the nested call, A reverts with `OffchainLookup`.
 4. Contract B does not understand CCIP read and propagates the `OffchainLookup` to its caller.
 5. Contract A also propagates the `OffchainLookup` to its caller.

The result of this sequence of operations would be an `OffchainLookup` that looks valid to the client, as the `sender` field matches the address of the contract that was called, but does not execute correctly, as it only completes a nested invocation.

#### Example

The code below demonstrates one way that a contract may support nested CCIP read invocations. For simplicity this is shown using Solidity&apos;s try/catch syntax, although as of this writing it does not yet support catching custom errors.

```solidity
contract NestedLookup {
    error InvalidOperation();
    error OffchainLookup(address sender, string[] urls, bytes callData, bytes4 callbackFunction, bytes extraData);

    function a(bytes calldata data) external view returns(bytes memory) {
        try target.b(data) returns (bytes memory ret) {
            return ret;
        } catch OffchainLookup(address sender, string[] urls, bytes callData, bytes4 callbackFunction, bytes extraData) {
            if(sender != address(target)) {
                revert InvalidOperation();
            }
            revert OffchainLookup(
                address(this),
                urls,
                callData,
                NestedLookup.aCallback.selector,
                abi.encode(address(target), callbackFunction, extraData)
            );
        }
    }

    function aCallback(bytes calldata response, bytes calldata extraData) external view returns(bytes memory) {
        (address inner, bytes4 innerCallbackFunction, bytes memory innerExtraData) = abi.decode(extraData, (address, bytes4, bytes));
        return abi.decode(inner.call(abi.encodeWithSelector(innerCallbackFunction, response, innerExtraData)), (bytes));
    }
}
```

### Gateway Interface
The URLs returned by a contract may be of any schema, but this specification only defines how clients should handle HTTPS URLs.

Given a URL template returned in an `OffchainLookup`, the URL to query is composed by replacing  `sender` with the lowercase 0x-prefixed hexadecimal formatted `sender` parameter, and replacing `data` with the 0x-prefixed hexadecimal formatted `callData` parameter.

For example, if a contract returns the following data in an `OffchainLookup`:

```
urls = [&quot;https://example.com/gateway/{sender}/{data}.json&quot;]
sender = &quot;0xaabbccddeeaabbccddeeaabbccddeeaabbccddee&quot;
callData = &quot;0x00112233&quot;
```

The request URL to query is `https://example.com/gateway/0xaabbccddeeaabbccddeeaabbccddeeaabbccddee/0x00112233.json`.

If the URL template contains the `{data}` substitution parameter, the client MUST send a GET request after replacing the substitution parameters as described above.

If the URL template does not contain the `{data}` 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 `application/json`, and a payload matching the following schema:

```
{
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;data&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;0x-prefixed hex string containing the `callData` from the contract&quot;
        },
        &quot;sender&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;0x-prefixed hex string containing the `sender` parameter from the contract&quot;
        }
    }
}
```

Compliant gateways MUST respond with a Content-Type of `application/json`, with the body adhering to the following JSON schema:
```
{
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;data&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description: &quot;0x-prefixed hex string containing the result data.&quot;
        }
    }
}
```

Unsuccessful requests MUST return the appropriate HTTP status code - for example, 404 if the `sender` address is not supported by this gateway, 400 if the `callData` 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 `application/json`, it MUST adhere to the following JSON schema:
```
{
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;message&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description: &quot;A human-readable error message.&quot;
        }
    }
}
```

#### Examples

***GET request***

```
# Client returned a URL template `https://example.com/gateway/{sender}/{data}.json`
# Request
curl -D - https://example.com/gateway/0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8/0xd5fa2b00.json

# Successful result
    HTTP/2 200
    content-type: application/json; charset=UTF-8
    ...
    
    {&quot;data&quot;: &quot;0xdeadbeefdecafbad&quot;}

# Error result
    HTTP/2 404
    content-type: application/json; charset=UTF-8
    ...

    {&quot;message&quot;: &quot;Gateway address not supported.&quot;}
}
```

***POST request***

```
# Client returned a URL template `https://example.com/gateway/{sender}.json`
# Request
curl -D - -X POST -H &quot;Content-Type: application/json&quot; --data &apos;{&quot;data&quot;:&quot;0xd5fa2b00&quot;,&quot;sender&quot;:&quot;0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8&quot;}&apos; https://example.com/gateway/0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8.json

# Successful result
    HTTP/2 200
    content-type: application/json; charset=UTF-8
    ...
    
    {&quot;data&quot;: &quot;0xdeadbeefdecafbad&quot;}

# Error result
    HTTP/2 404
    content-type: application/json; charset=UTF-8
    ...

    {&quot;message&quot;: &quot;Gateway address not supported.&quot;}
}
```

Clients MUST support both GET and POST requests. Gateways may implement either or both as needed.

### Client Lookup Protocol

A client that supports CCIP read MUST make contract calls using the following process:

 1. Set `data` to the call data to supply to the contract, and `to` to the address of the contract to call.
 2. Call the contract at address `to` function normally, supplying `data` as the input data. If the function returns a successful result, return it to the caller and stop.
 3. If the function returns an error other than `OffchainLookup`, return it to the caller in the usual fashion.
 4. Otherwise, decode the `sender`, `urls`, `callData`, `callbackFunction` and `extraData` arguments from the `OffchainLookup` error.
 5. If the `sender` field does not match the address of the contract that was called, return an error to the caller and stop.
 6. Construct a request URL by replacing `sender` with the lowercase 0x-prefixed hexadecimal formatted `sender` parameter, and replacing `data` with the 0x-prefixed hexadecimal formatted `callData` 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.
 7. Make an HTTP GET request to the request URL.
 8. If the response code from step (7) is in the range 400-499, return an error to the caller and stop.
 9. 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.
 10. Otherwise, replace `data` with an ABI-encoded call to the contract function specified by the 4-byte selector `callbackFunction`, supplying the data returned from step (7) and `extraData` from step (4), and return to step (1).

Clients MUST handle HTTP status codes appropriately, employing best practices for error reporting and retries.

Clients MUST handle HTTP 4xx and 5xx error responses that have a content type other than application/json appropriately; they MUST NOT attempt to parse the response body as JSON.

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.

The lookup protocol for a client is described with the following pseudocode:

```javascript
async function httpcall(urls, to, callData) {
    const args = {sender: to.toLowerCase(), data: callData.toLowerCase()};
    for(const url of urls) {
        const queryUrl = url.replace(/\{([^}]*)\}/g, (match, p1) =&gt; args[p1]);
        // First argument is URL to fetch, second is optional data for a POST request.
        const response = await fetch(queryUrl, url.includes(&apos;{data}&apos;) ? undefined : args);
        const result = await response.text();
        if(result.statusCode &gt;= 400 &amp;&amp; result.statusCode &lt;= 499) {
            throw new Error(data.error.message);
        }
        if(result.statusCode &gt;= 200 &amp;&amp; result.statusCode &lt;= 299) {
            return result;
        }
    }
}
async function durin_call(provider, to, data) {
    for(let i = 0; i &lt; 4; i++) {
        try {
            return await provider.call(to, data);
        } catch(error) {
            if(error.code !== &quot;CALL_EXCEPTION&quot;) {
                throw(error);
            }
            const {sender, urls, callData, callbackFunction, extraData} = error.data;
            if(sender !== to) {
                throw new Error(&quot;Cannot handle OffchainLookup raised inside nested call&quot;);
            }
            const result = httpcall(urls, to, callData);
            data = abi.encodeWithSelector(callbackFunction, result, extraData);
        }
    }
    throw new Error(&quot;Too many CCIP read redirects&quot;);
}
```

Where:
 - `provider` is a provider object that facilitates Ethereum blockchain function calls.
 - `to` is the address of the contract to call.
 - `data` is the call data for the contract.

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 `urls` is called with the `callData` returned by the `OffchainLookup` error, and is expected to return a valid response. The response and the `extraData` are then passed to the specified callback function. This process can be repeated if the callback function returns another `OffchainLookup` error.

### Use of CCIP read for transactions
While the specification above is for read-only contract calls (eg, `eth_call`), it is simple to use this method for sending transactions (eg, `eth_sendTransaction` or `eth_sendRawTransaction`) that require offchain data. While &apos;preflighting&apos; a transaction using `eth_estimateGas` or `eth_call`, a client that receives an `OffchainLookup` revert can follow the procedure described above in [Client lookup protocol](#client-lookup-protocol), 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.

### Glossary
 - 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.
 - Contract: A smart contract existing on Ethereum or another blockchain.
 - Gateway: A service that answers application-specific CCIP read queries, usually over HTTPS.

## Rationale
### Use of `revert` to convey call information
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.

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, `balanceOf -&gt; offchainBalanceOf`). Neither solutions is particularly satisfactory.

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.

### Passing contract address to the gateway service
`address` 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 `address` 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.

### Existence of `extraData` argument
`extraData` 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.

### Use of GET and POST requests for the gateway interface
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.

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&apos;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.

## Backwards Compatibility
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.

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.

## Security Considerations

### Gateway Response Data Validation
In order to prevent a malicious gateway from causing unintended side-effects or faulty results, contracts MUST include sufficient information in the `extraData` argument to allow them to verify the relevance and validity of the gateway&apos;s response. For example, if the contract is requesting information based on an `address` supplied to the original call, it MUST include that address in the `extraData` so that the callback can verify the gateway is not providing the answer to a different query.

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.

### Client Extra Data Validation
In order to prevent a malicious client from causing unintended effects when making transactions using CCIP read, contracts MUST implement appropriate checks on the `extraData` returned to them in the callback. Any sanity/permission checks performed on input data for the initial call MUST be repeated on the data passed through the `extraData` 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 `extraData`.

### HTTP requests and fingerprinting attacks
Because CCIP read can cause a user&apos;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.

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&apos;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&apos;s wallet.

To minimise the security impact of this, we make the following recommendations:

 1. 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.
 2. 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.
 3. App authors should not supply a &apos;from&apos; address for contract calls (&apos;view&apos; 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.
 4. 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 &apos;from&apos; address supplied, or operate a proxy on their users&apos; behalf, rewriting all CCIP read calls to take place via the proxy, or both.

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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 19 Jul 2020 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3668</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3668</guid>
      </item>
    
      <item>
        <title>Poster</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-poster-a-ridiculously-simple-general-purpose-social-media-smart-contract/6751</comments>
        
        <description># Poster

## Abstract
A ridiculously simple general purpose social media smart contract.
It takes two strings (`content` and `tag`) as parameters and emits those strings, along with msg.sender, as an event. That&apos;s it.
The EIP also includes a proposed standard json format for a Twitter-like application, where each `post()` call can include multiple posts and/or operations. The assumption being that application state will be constructed off-chain via some indexer.

## Motivation
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.

## Specification

### Contract

```solidity
contract Poster {

    event NewPost(address indexed user, string content, string indexed tag);

    function post(string calldata content, string calldata tag) public {
        emit NewPost(msg.sender, content, tag);
    }
}
```

### ABI
```json
[
    {
      &quot;anonymous&quot;: false,
      &quot;inputs&quot;: [
        {
          &quot;indexed&quot;: true,
          &quot;internalType&quot;: &quot;address&quot;,
          &quot;name&quot;: &quot;user&quot;,
          &quot;type&quot;: &quot;address&quot;
        },
        {
          &quot;indexed&quot;: false,
          &quot;internalType&quot;: &quot;string&quot;,
          &quot;name&quot;: &quot;content&quot;,
          &quot;type&quot;: &quot;string&quot;
        },
        {
          &quot;indexed&quot;: true,
          &quot;internalType&quot;: &quot;string&quot;,
          &quot;name&quot;: &quot;tag&quot;,
          &quot;type&quot;: &quot;string&quot;
        }
      ],
      &quot;name&quot;: &quot;NewPost&quot;,
      &quot;type&quot;: &quot;event&quot;
    },
    {
      &quot;inputs&quot;: [
        {
          &quot;internalType&quot;: &quot;string&quot;,
          &quot;name&quot;: &quot;content&quot;,
          &quot;type&quot;: &quot;string&quot;
        },
        {
          &quot;internalType&quot;: &quot;string&quot;,
          &quot;name&quot;: &quot;tag&quot;,
          &quot;type&quot;: &quot;string&quot;
        }
      ],
      &quot;name&quot;: &quot;post&quot;,
      &quot;outputs&quot;: [],
      &quot;stateMutability&quot;: &quot;nonpayable&quot;,
      &quot;type&quot;: &quot;function&quot;
    }
]
```

### Standard json format for Twitter-like posts

```json
{
  &quot;content&quot;: [
    {
      &quot;type&quot;: &quot;microblog&quot;,
      &quot;text&quot;: &quot;this is the first post in a thread&quot;
    },
    {
      &quot;type&quot;: &quot;microblog&quot;,
      &quot;text&quot;: &quot;this is the second post in a thread&quot;,
      &quot;replyTo&quot;: &quot;this[0]&quot;
    },
    {
      &quot;type&quot;: &quot;microblog&quot;,
      &quot;text&quot;: &quot;this is a reply to some other post&quot;,
      &quot;replyTo&quot;: &quot;some_post_id&quot;
    },
    {
      &quot;type&quot;: &quot;microblog&quot;,
      &quot;text&quot;: &quot;this is a post with an image&quot;,
      &quot;image&quot;: &quot;ipfs://ipfs_hash&quot;
    },
    {
      &quot;type&quot;: &quot;microblog&quot;,
      &quot;text&quot;: &quot;this post replaces a previously posted post&quot;,
      &quot;edit&quot;: &quot;some_post_id&quot;
    },
    {
      &quot;type&quot;: &quot;delete&quot;,
      &quot;target&quot;: &quot;some_post_id&quot;
    },
    {
      &quot;type&quot;: &quot;like&quot;,
      &quot;target&quot;: &quot;some_post_id&quot;
    },
    {
      &quot;type&quot;: &quot;repost&quot;,
      &quot;target&quot;: &quot;some_post_id&quot;
    },
    {
      &quot;type&quot;: &quot;follow&quot;,
      &quot;target&quot;: &quot;some_account&quot;
    },
    {
      &quot;type&quot;: &quot;unfollow&quot;,
      &quot;target&quot;: &quot;some_account&quot;
    },
    {
      &quot;type&quot;: &quot;block&quot;,
      &quot;target&quot;: &quot;some_account&quot;
    },
    {
      &quot;type&quot;: &quot;report&quot;,
      &quot;target&quot;: &quot;some_account or some_post_id&quot;
    },
    {
      &quot;type&quot;: &quot;permissions&quot;,
      &quot;account&quot;: &quot;&lt;account_to_set_permissions&gt;&quot;,
      &quot;permissions&quot;: {
        &quot;post&quot;: true,
        &quot;delete&quot;: true,
        &quot;like&quot;: true,
        &quot;follow&quot;: true,
        &quot;block&quot;: true,
        &quot;report&quot;: true,
        &quot;permissions&quot;: true
      }
    },
    {
      &quot;type&quot;: &quot;microblog&quot;,
      &quot;text&quot;: &quot;This is a post from an account with permissions to post on behalf of another account.&quot;,
      &quot;from&quot;: &quot;&lt;from_address&gt;&quot;
    }
  ]
}

```

## Rationale
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.

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.

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.

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.

## Reference Implementation

Poster has been deployed at `0x000000000000cd17345801aa8147b8D3950260FF` on multiple networks using the [Singleton Factory](https://eips.ethereum.org/EIPS/eip-2470). 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:

&gt; **initCode:** `0x608060405234801561001057600080fd5b506101f6806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630ae1b13d14610030575b600080fd5b61004361003e3660046100fa565b610045565b005b8181604051610055929190610163565b60405180910390203373ffffffffffffffffffffffffffffffffffffffff167f6c7f3182d7e4cb876251f9ae1489975fdbbf15d9f35d393f2ac9b1ff57cec69f86866040516100a5929190610173565b60405180910390a350505050565b60008083601f8401126100c4578182fd5b50813567ffffffffffffffff8111156100db578182fd5b6020830191508360208285010111156100f357600080fd5b9250929050565b6000806000806040858703121561010f578384fd5b843567ffffffffffffffff80821115610126578586fd5b610132888389016100b3565b9096509450602087013591508082111561014a578384fd5b50610157878288016100b3565b95989497509550505050565b6000828483379101908152919050565b60006020825282602083015282846040840137818301604090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016010191905056fea2646970667358221220ee0377bd266748c5dbaf0a3f15ebd97be153932f2d14d460d9dd4271fee541b564736f6c63430008000033`
&gt;
&gt; **salt:** `0x9245db59943806d06245bc7847b3efb2c899d11b621a0f01bb02fd730e33aed2`

When verifying on the source code on a block explorer, make sure to set the optimizer to `yes` and the runs to `10000000`.

The source code is available in the [Poster contract repo](https://github.com/ETHPoster/contract/blob/master/contracts/Poster.sol).


## Security Considerations
Given the ridiculously simple implementation of Poster, there does not appear to be any real security concerns at the contract level.

At the application level, clients should confirm that posts including a `&quot;from&quot;` field that differs from `msg.sender` have been authorized by the `&quot;from&quot;` address via a `&quot;permissions&quot;` post, otherwise they should be considerred invalid or a post from `msg.sender`.

Clients should also be sure to sanitize post data.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 31 Jul 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3722</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3722</guid>
      </item>
    
      <item>
        <title>A Vanilla Non-Fungible Token Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/3753</comments>
        
        <description>## Abstract
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.

## Motivation
Non-fungible tokens are popularized by the [ERC-721](./eip-721.md) 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.

## Specification
```
interface IERC3754 {
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    function balanceOf(address owner) external view returns (uint256);
    function ownerOf(uint256 tokenId) external view returns (address);
    function approve(address to, uint256 tokenId) external;
    function getApproved(uint256 tokenId) external view returns (address);
    function setApprovalForAll(address operator, bool approved) external;
    function isApprovedForAll(address owner, address operator) external view returns (bool);
    function transferFrom(address from, address to, uint256 tokenId) external;
    function safeTransferFrom(address from, address to, uint256 tokenId) external;
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) external;
}
```

## Rationale
The NFTs defined in the [ERC-721](./eip-721.md) 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 [ERC-721](./eip-721.md), data fields and functions related to `URI` are
excluded.

## Backwards Compatibility
There is no further backwards compatibility required.

## Reference Implementation
https://github.com/simontianx/ERC3754

## Security Considerations
The security is enhanced from ERC721, given tokens are minted without having to
provide `URI`s. Errors in dealing with `URI`s can be avoided.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 21 Aug 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3754</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3754</guid>
      </item>
    
      <item>
        <title>Chain-specific addresses</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/chain-specific-addresses/6449</comments>
        
        <description>## Abstract

[ERC-3770](./eip-3770.md) introduces a new address standard to be adapted by wallets and dApps to display chain-specific addresses by using a human-readable prefix.

## Motivation

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.

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 [EIP-155](./eip-155.md) 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.

## Specification

This proposal extends addresses with a human-readable blockchain short name.

### Syntax

A chain-specific address is prefixed with a chain shortName, separated with a colon sign (:).

Chain-specific address = &quot;`shortName`&quot; &quot;`:`&quot; &quot;`address`&quot;

- `shortName` = STRING

- `address` = STRING

### Semantics

* `shortName` is mandatory and MUST be a valid chain short name from https://github.com/ethereum-lists/chains
* `address` is mandatory and MUST be a [ERC-55](./eip-55.md) compatible hexadecimal address

### Examples

![Chain-specific addresses](../assets/eip-3770/examples.png &quot;Examples of chain-specific addresses&quot;)

## Rationale

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.

## Backwards Compatibility

Ethereum addresses without the chain specifier will continue to require additional context to understand which chain the address refers to.

## Security Considerations

Similar looking chain short names can be used to confuse users.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 26 Aug 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3770</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3770</guid>
      </item>
    
      <item>
        <title>Compressed Integers</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/3772</comments>
        
        <description>## Abstract

This document specifies compression of `uint256` to smaller data structures like `uint64`, `uint96`, `uint128`, for optimizing costs for storage. The smaller data structure (represented as `cintx`) is divided into two parts, in the first one we store `significant` bits and in the other number of left `shift`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.

## Motivation

- Storage is costly, each storage slot costs almost $0.8 to initialize and $0.2 to update (20 gwei, 2000 ETHUSD).
- Usually, we store money amounts in `uint256` which takes up one entire slot.
- If it&apos;s DAI value, the range we work with most is 0.001 DAI to 1T DAI (or 10&lt;sup&gt;12&lt;/sup&gt;). If it&apos;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;/sup&gt; amounts that we care/work with.
- However, uint256 type allows us to represent $10&lt;sup&gt;-18&lt;/sup&gt; to $10&lt;sup&gt;58&lt;/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;/sup&gt; and smaller than $10&lt;sup&gt;-3&lt;/sup&gt; as negligible (i.e. P[val &gt; 10&lt;sup&gt;15&lt;/sup&gt;] ≈ 0 and P[val &lt; 10&lt;sup&gt;-3&lt;/sup&gt;] ≈ 0).
- Number of bits required to represent 10&lt;sup&gt;15&lt;/sup&gt; values = log&lt;sub&gt;2&lt;/sub&gt;(10&lt;sup&gt;15&lt;/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.

## Specification

In this specification, the structure for representing a compressed value is represented using `cintx`, where x is the number of bits taken by the entire compressed value. On the implementation level, an `uintx` can be used for storing a `cintx` value.

### Compression

#### uint256 into cint64 (up to cint120)

The rightmost, or least significant, 8 bits in `cintx` are reserved for storing the shift and the rest available bits are used to store the significant bits starting from the first `1` bit in `uintx`.

```solidity
struct cint64 { uint56 significant; uint8 shift; }

// ...

struct cint120 { uint112 significant; uint8 shift; }
```

#### uint256 into cint128 (up to cint248)

The rightmost, or least significant, 7 bits in `cintx` 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 `uintx`.

&gt; In the following code example, `uint7` is used just for representation purposes only, but it should be noted that uints in Solidity are in multiples of 8.

```solidity
struct cint128 { uint121 significant; uint7 shift; }

// ...

struct cint248 { uint241 significant; uint7 shift; }
```

Examples:

```
Example:
uint256 value: 2**100, binary repr: 1000000...(hundred zeros)
cint64 { significant: 10000000...(55 zeros), shift: 00101101 (45 in decimal)}

Example:
uint256 value: 2**100-1, binary repr: 111111...(hundred ones)
cint64 { significant: 11111111...(56 ones), shift: 00101100 (44 in decimal) }
```

### Decompression

Two decompression methods are defined: a normal `decompress` and a `decompressRoundingUp`.

```solidity
library CInt64 {
    // packs the uint256 amount into a cint64
    function compress(uint256) internal returns (cint64) {}

    // unpacks cint64, by shifting the significant bits left by shift
    function decompress(cint64) internal returns (uint256) {}

    // unpacks cint64, by shifting the significant bits left by shift
    // and having 1s in the shift bits
    function decompressRoundingUp(cint64) internal returns (uint256) {}
}
```

#### Normal Decompression

The `significant` bits in the `cintx` are moved to a `uint256` space and shifted left by `shift`.

&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.

```
Example:
cint16{significant:11010111, shift:00000011}
decompressed uint256: 11010111000 // shifted left by 3

Example:
cint64 { significant: 11111111...(56 ones), shift: 00101100 (44 in decimal) }
decompressed uint256: 1111...(56 ones)0000...(44 zeros)
```

#### Decompression along with rounding up

The `significant` bits in the `cintx` are moved to a `uint256` space and shifted left by `shift` and the least significant `shift` bits are `1`s.

```
Example:
cint16{significant:11011110, shift:00000011}
decompressed rounded up value: 11011110111 // shifted left by 3 and 1s instead of 0s

Example:
cint64 { significant: 11111111...(56 ones), shift: 00101100 (44 in decimal) }
decompressed uint256: 1111...(100 ones)
```

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&apos;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.

## Rationale

- The `significant` bits are stored in the most significant part of `cintx` while `shift` 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;/sup&gt;-1 its compressed `cint64` 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.
- It should be noted that using `cint64` doesn&apos;t render gas savings automatically. The solidity compiler needs to pack more data into the same storage slot.
- Also the packing and unpacking adds some small cost too.
- 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/shift bits (i.e 8 up to `uint120` and 7 up to `uint248`).

```solidity
// uses 3 slots
struct UserData1 {
    uint64 amountCompressed;
    bytes32 hash;
    address beneficiary;
}

// uses 2 slots
struct UserData2 {
    uint64 amountCompressed;
    address beneficiary;
    bytes32 hash;
}
```

## Backwards Compatibility

There are no known backward-incompatible issues.

## Reference Implementation

On the implementation level `uint64` may be used directly, or with custom types introduced in 0.8.9.

```soldity
function compress(uint256 full) public pure returns (uint64 cint) {
    uint8 bits = mostSignificantBitPosition(full);
    if (bits &lt;= 55) {
        cint = uint64(full) &lt;&lt; 8;
    } else {
        bits -= 55;
        cint = (uint64(full &gt;&gt; bits) &lt;&lt; 8) + bits;
    }
}

function decompress(uint64 cint) public pure returns (uint256 full) {
    uint8 bits = uint8(cint % (1 &lt;&lt; 9));
    full = uint256(cint &gt;&gt; 8) &lt;&lt; bits;
}

function decompressRoundingUp(uint64 cint) public pure returns (uint256 full) {
    uint8 bits = uint8(cint % (1 &lt;&lt; 9));
    full = uint256(cint &gt;&gt; 8) &lt;&lt; bits + ((1 &lt;&lt; bits) - 1);
}
```

The above gist has `library CInt64` that contains demonstrative logic for compression, decompression, and arithmetic for `cint64`. The gist also has an example contract that uses the library for demonstration purposes.

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.

## Security Considerations

The following security considerations are discussed:

1. Effects due to lossy compression
   - Error estimation for `cint64`
   - Handling the error
2. Losing precision due to incorrect use of `cintx`
3. Compressing something other than money `uint256`s.

### 1. Effects due to lossy compression

When a value is compressed, it causes underflow, i.e. some less significant bits are sacrificed. This results in a `cintx` value whose decompressed value is less than or equal to the actual `uint256` value.

```solidity
uint a = 2**100 - 1; // 100 # of 1s in binary format
uint c = a.compress().decompress();

a &gt; c; // true
a - (2**(100 - 56) - 1) == c; // true

// Visual example:
// before: 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
// after:  1111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000
```

#### Error estimation for cint64

Let&apos;s consider we have a `value` of the order 2&lt;sup&gt;m&lt;/sup&gt; (less than 2&lt;sup&gt;m&lt;/sup&gt; and greater than or equal to 2&lt;sup&gt;m-1&lt;/sup&gt;).

For all values such that 2&lt;sup&gt;m&lt;/sup&gt; - 1 - (2&lt;sup&gt;m-56&lt;/sup&gt; - 1) &lt;= `value` &lt;= 2&lt;sup&gt;m&lt;/sup&gt; - 1, the compressed value `cvalue` is 2&lt;sup&gt;m&lt;/sup&gt; - 1 - (2&lt;sup&gt;m-56&lt;/sup&gt; - 1).

The maximum error is 2&lt;sup&gt;m-56&lt;/sup&gt; - 1, approximating it to decimal: 10&lt;sup&gt;n-17&lt;/sup&gt; (log&lt;sub&gt;2&lt;/sub&gt;(56) is 17). Here `n` is number of decimal digits + 1.

For e.g. compressing a value of the order $1,000,000,000,000 (or 1T or 10&lt;sup&gt;12&lt;/sup&gt;) to `cint64`, the maximum error turns out to be 10&lt;sup&gt;12+1-17&lt;/sup&gt; = $10&lt;sup&gt;-4&lt;/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 `cint64`, 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).

#### Handling the error

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,

```solidity
10000001 / 2 == 5000000 // true
```

The result of the division operation is not always exact, but it&apos;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.

```
1001 / 2 * 301 == 150500 // true
1001 * 301 / 2 == 150650 // true
```

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&apos;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;/sup&gt;. If been careful with this too, the effects are minimized.

In general, one should follow the rule:

1. When a smart contract has to transfer a compressed amount to a user, they should use a rounded down value (by using `amount.decompress()`).
2. 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 `amount.decompressUp()`).

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.

### 2. Losing precision due to incorrect use of `cintx`

This is an example where dev errors while using compression can be a problem.

Usual user amounts mostly have an max entropy of 50, i.e. 10&lt;sup&gt;15&lt;/sup&gt; (or 2&lt;sup&gt;50&lt;/sup&gt;) values in use, that is the reason why we find uint56 enough for storing significant bits. However, let&apos;s see an example:

```solidity
uint64 sharesC = // reading compressed value from storage;
uint64 price = // CALL;
uint64 amountC = sharesC.cmuldiv(price, PRICE_UNIT);
user.transfer(amountC.uncompress());
```

The above code results in a serious precision loss. `sharesC` has an entropy of 50, as well as `priceC` 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, `cmul` compresses the value, which drops the entropy of `amountC` to 56 (as we have uint56 there to store significant bits).

To prevent entropy/precision from dropping, we get out from compression.

```solidity
uint64 sharesC = shares.compress();
uint64 priceC = price.compress();
uint256 amount = sharesC.uncompress() * price / PRICE_UNIT;
user.transfer(amount);
```

Compression is only useful when writing to storage while doing arithmetic with them should be done very carefully.

### 3. Compressing something other than money `uint256`s.

Compressed Integers is intended to only compress money amount. Technically there are about 10&lt;sup&gt;77&lt;/sup&gt; values that a `uint256` 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&apos;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;/sup&gt; to 10&lt;sup&gt;30&lt;/sup&gt; in uint256). 50 bits are enough to represent this information, just to round it we use 56 bits for precision.

Using the same method for compressing something else which have a completely different probability distribution will likely result in a problem. It&apos;s best to just not compress if you&apos;re not sure about the distribution of values your `uint256` is going to take. And also, for things you think you are sure about using compression for, it&apos;s better to give more thought if compression can result in edge cases (e.g. in previous multiplication example).

### 4. Compressing Stable vs Volatile money amounts

Since we have a dynamic `uint8 shift` 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.

It can be a problem for volatile tokens if the coin is extremely volatile wrt user&apos;s native currency. Imagine a very unlikely case where a coin goes 2&lt;sup&gt;56&lt;/sup&gt;x up (price went up by 10&lt;sup&gt;16&lt;/sup&gt; lol). In such cases `uint56` 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 `cint96` or `cint128`.

`cint64` 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;/sup&gt; or 64x. If the value goes down it&apos;s not a problem.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 27 Aug 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-3772</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-3772</guid>
      </item>
    
      <item>
        <title>Account Abstraction Using Alt Mempool</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-4337-account-abstraction-via-entry-point-contract-specification/7160</comments>
        
        <description>## Abstract

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 `UserOperation`. Users send `UserOperation` objects into a separate mempool. A special class of actor called bundlers package up a set of these objects into a transaction making a `handleOps` call to a special contract, and that transaction then gets included in a block.

## Motivation

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.

This proposal takes a different approach, avoiding any adjustments to the consensus layer. It seeks to achieve the following goals:

* **Achieve the key goal of Account Abstraction**: 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 [EIP-7702](./eip-7702.md).
* **Decentralization**
    * Allow any bundler (think: block builder) to participate in the process of including account-abstracted `UserOperations`
    * 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
    * Avoid trust assumptions on bundlers
* **Do not require any Ethereum consensus changes**: 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.
* **Support other use cases**
    * Privacy-preserving applications
    * Atomic multi-operations (similar goal to [EIP-7702](./eip-7702.md))
    * Pay tx fees with [ERC-20](./eip-20.md) tokens, allow developers to pay fees for their users, and [EIP-7702](./eip-7702.md)-like **sponsored transaction** use cases more generally
    * abstracting the validation allows the contract to use different signature schemes, multisig configuration, custom recovery, and more.
    * abstracting gas payments allows easy onboarding by 3rd party payments, paying with tokens, cross-chain gas payments
    * abstracting execution allows bundled transactions

## Specification

### Definitions

* **UserOperation** - a structure that describes a transaction to be sent on behalf of a user. To avoid confusion, it is not named &quot;transaction&quot;.
  * Like a transaction, it contains `to`, `calldata`, `maxFeePerGas`, `maxPriorityFeePerGas`, `nonce`, `signature`.
  * Unlike a transaction, it contains several other fields, described below.
  * Notably, the `signature` field usage is not defined by the protocol, but by the Smart Contract Account implementation.
* **Sender** - the Smart Contract Account sending a `UserOperation`.
* **EntryPoint** - a singleton contract to execute bundles of `UserOperations`. Bundlers should whitelist the supported `EntryPoint`.
* **Bundler** - a node (block builder) that can handle `UserOperations`,
  create a valid `entryPoint.handleOps()` transaction,
  and add it to the block while it is still valid.
  This can be achieved by a number of ways:
  * Bundler can act as a block builder itself.
  * If the bundler is not a block builder, it should work with the block builder through an infrastructure such as `mev-boost`, or any other kind of proposer-builder separation.
* **Paymaster** - a helper contract that agrees to pay for the transaction, instead of the sender itself.
* **Factory** - a helper contract that performs a deployment for a new `sender` contract if necessary.
* **Aggregator** - also known as &quot;authorizer contract&quot; - a contract that enables multiple `UserOperations` to share a single validation. The full design of such contracts is outside the scope of this proposal.
* **Canonical `UserOperation` mempool** - a decentralized permissionless P2P network where bundlers exchange `UserOperations` 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.
* **Alternative `UserOperation` mempool** - any other P2P mempool where the validity of `UserOperations` is determined by rules that are different from the shared set of rules, applied to the validation code, in any way.
* **Deposit** - an amount of Ether (or any L2 native currency) that a `Sender` or `Paymaster` contract has transferred to the `EntryPoint` contract intended to pay gas costs of the future `UserOperations`.

### The `UserOperation` structure

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 `UserOperation`:

| Field                           | Type      | Description                                                                                           |
|---------------------------------|-----------|-------------------------------------------------------------------------------------------------------|
| `sender`                        | `address` | The Account making the `UserOperation`                                                                |
| `nonce`                         | `uint256` | Anti-replay parameter (see &quot;Semi-abstracted Nonce Support&quot; )                                          |
| `factory`                       | `address` | Account Factory for new Accounts OR `0x7702` flag for EIP-7702 Accounts, otherwise `address(0)`       |
| `factoryData`                   | `bytes`   | data for the Account Factory if `factory` is provided OR EIP-7702 initialization data, or empty array |
| `callData`                      | `bytes`   | The data to pass to the `sender` during the main execution call                                       |
| `callGasLimit`                  | `uint256` | The amount of gas to allocate the main execution call                                                 |
| `verificationGasLimit`          | `uint256` | The amount of gas to allocate for the verification step                                               |
| `preVerificationGas`            | `uint256` | Extra gas to pay the bundler                                                                          |
| `maxFeePerGas`                  | `uint256` | Maximum fee per gas (similar to [EIP-1559](./eip-1559.md) `max_fee_per_gas`)                          |
| `maxPriorityFeePerGas`          | `uint256` | Maximum priority fee per gas (similar to EIP-1559 `max_priority_fee_per_gas`)                         |
| `paymaster`                     | `address` | Address of paymaster contract, (or empty, if the `sender` pays for gas by itself)                     |
| `paymasterVerificationGasLimit` | `uint256` | The amount of gas to allocate for the paymaster validation code (only if paymaster exists)            |
| `paymasterPostOpGasLimit`       | `uint256` | The amount of gas to allocate for the paymaster post-operation code (only if paymaster exists)        |
| `paymasterData`                 | `bytes`   | Data for paymaster (only if paymaster exists)                                                         |
| `signature`                     | `bytes`   | Data passed into the `sender` to verify authorization                                                 |

Users send `UserOperation` objects to a dedicated `UserOperation` mempool.

To prevent replay attacks, either cross-chain or with multiple `EntryPoint` contract versions,
the `signature` MUST depend on `chainid` and the `EntryPoint` address.

Note that one [EIP-7702](./eip-7702.md) &quot;authorization tuple&quot; value can be provided alongside the `UserOperation` struct,
but &quot;authorization tuples&quot; are not included in the `UserOperation` itself.

### `EntryPoint` interface

When passed on-chain, to the `EntryPoint` contract, the `Account` and the `Paymaster`, a &quot;packed&quot; version of the above structure called `PackedUserOperation` is used:

| Field                | Type      | Description                                                                                                           |
|----------------------|-----------|-----------------------------------------------------------------------------------------------------------------------|
| `sender`             | `address` |                                                                                                                       |
| `nonce`              | `uint256` |                                                                                                                       |
| `initCode`           | `bytes`   | concatenation of factory address and factoryData (or empty), or [EIP-7702 data](#support-for-eip-7702-authorizations) |
| `callData`           | `bytes`   |                                                                                                                       |
| `accountGasLimits`   | `bytes32` | concatenation of verificationGasLimit (16 bytes) and callGasLimit (16 bytes)                                          |
| `preVerificationGas` | `uint256` |                                                                                                                       |
| `gasFees`            | `bytes32` | concatenation of maxPriorityFeePerGas (16 bytes) and maxFeePerGas (16 bytes)                                          |
| `paymasterAndData`   | `bytes`   | concatenation of paymaster fields (or empty)                                                                          |
| `signature`          | `bytes`   |                                                                                                                       |


The core interface of the `EntryPoint` contract is as follows:

```solidity
function handleOps(PackedUserOperation[] calldata ops, address payable beneficiary);
```

The `beneficiary` is the address that will be paid with all the gas fees collected during the execution of the bundle.

### Smart Contract Account Interface

The core interface required for the Smart Contract Account to have is:

```solidity
interface IAccount {
  function validateUserOp
      (PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)
      external returns (uint256 validationData);
}
```

The `userOpHash` is a hash over the `userOp` (except `signature`), `entryPoint` and `chainId`.

The Smart Contract Account:

* MUST validate the caller is a trusted `EntryPoint`
* MUST validate that the signature is a valid signature of the `userOpHash`, and
  SHOULD return `SIG_VALIDATION_FAILED` (`1`) without reverting on signature mismatch. Any other error MUST revert.
* SHOULD not return early when returning `SIG_VALIDATION_FAILED` (`1`). Instead, it SHOULD complete the normal flow to enable performing a gas estimation for the validation function.
* MUST pay the `EntryPoint` (caller) at least the `missingAccountFunds` (which might be zero, in case the current `sender`&apos;s deposit is sufficient)
* The `sender` MAY pay more than this minimum to cover future transactions. It can also call `withdrawTo` to retrieve it later at any time.
* The return value MUST be packed of `aggregator`/`authorizer`, `validUntil` and `validAfter` timestamps.
  * `aggregator`/`authorizer` - 0 for valid signature, 1 to mark signature failure. Otherwise, an address of an `aggregator`/`authorizer` contract.
  * `validUntil` is 6-byte timestamp value, or zero for &quot;infinite&quot;. The `UserOperation` is valid only up to this time.
  * `validAfter` is 6-byte timestamp. The `UserOperation` is valid only after this time.
  * In order to specify a validity range using block numbers, both the `validUntil` and `validAfter` need to set their highest bit to 1.
  * **Note:** 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&apos;s validity range.

The Smart Contract Account MAY implement the interface `IAccountExecute`

```solidity
interface IAccountExecute {
  function executeUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash) external;
}
```

This method will be called by the `EntryPoint` with the current UserOperation, instead of executing the `callData` itself directly on the `sender`.

### Semi-abstracted Nonce Support

In Ethereum protocol, the sequential transaction `nonce` value is used as a replay protection method as well as to
determine the valid order of transaction being included in blocks.

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.

However, requiring a single sequential `nonce` value is limiting to the senders&apos; ability to define their custom logic
with regard to transaction ordering and replay protection.

Instead of sequential `nonce` we implement a nonce mechanism that uses a single `uint256` nonce value in the `UserOperation`,
but treats it as two values:

* 192-bit &quot;key&quot;
* 64-bit &quot;sequence&quot;

These values are represented on-chain in the `EntryPoint` contract.
We define the following method in the `EntryPoint` interface to expose these values:

```solidity
function getNonce(address sender, uint192 key) external view returns (uint256 nonce);
```

For each `key` the `sequence` is validated by the `EntryPoint` for each UserOperation.
If the nonce validation fails the `UserOperation` is considered invalid and the bundle is reverted.
The `sequence` value is incremented sequentially and monotonically for the `sender` for each UserOperation.
A new `key` can be introduced with an arbitrary value at any point, with its `sequence` starting at `0`.

This approach maintains the guarantee of `UserOperation` 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.

#### Reading and validating the nonce

When preparing the `UserOperation` bundlers may make a view call to this method to determine a valid value for the `nonce` field.

Bundler&apos;s validation of a `UserOperation` SHOULD start with `getNonce` to ensure the transaction has a valid `nonce` field.

If the bundler is willing to accept multiple `UserOperations` by the same sender into their mempool,
this bundler is supposed to track the `key` and `sequence` pair of the `UserOperations` already added in the mempool.

#### Usage examples

1. Classic sequential nonce.

   In order to require the Account to have classic, sequential nonce, the validation function MUST perform:

   ```solidity
   require(userOp.nonce&lt;type(uint64).max)
   ```

2. Ordered administrative events

   In some cases, an account may need to have an &quot;administrative&quot; channel of operations running in parallel to normal
   operations.

   In this case, the account may use a specific `key` when calling methods on the account itself:

   ```solidity
   bytes4 sig = bytes4(userOp.callData[0 : 4]);
   uint key = userOp.nonce &gt;&gt; 64;
   if (sig == ADMIN_METHODSIG) {
       require(key == ADMIN_KEY, &quot;wrong nonce-key for admin operation&quot;);
   } else {
       require(key == 0, &quot;wrong nonce-key for normal operation&quot;);
   }
   ```

### Required `EntryPoint` contract functionality

The `EntryPoint` method is `handleOps`, which handles an array of `UserOperations`

The `EntryPoint`&apos;s `handleOps` function must perform the following steps (we first describe the simpler non-paymaster case). It must make two loops, the **verification loop** and the **execution loop**.
In the verification loop, the `handleOps` call must perform the following steps for each `UserOperation`:

* **Create the `sender` Smart Contract Account if it does not yet exist**, using the `initcode` provided in the `UserOperation`.
  * If the `factory` address is &quot;0x7702&quot;, then the sender MUST be an EOA with an [EIP-7702](./eip-7702.md) authorization designation. The `EntryPoint` validates the authorized address matches the one specified in the `UserOperation` signature (see [Support for [EIP-7702] authorizations](#support-for-eip-7702-authorizations)).
  * If the `sender` does not exist, _and_ the `initcode` is empty, or does not deploy a contract at the &quot;sender&quot; address, the call must fail.
  * **WARNING**: If the `sender` does exist, _and_ the `initcode` is _not_ empty, then the `initcode` is ignored.
* calculate the maximum possible fee the `sender` needs to pay based on validation and call gas limits, and current gas values.
* calculate the fee the `sender` must add to its &quot;deposit&quot; in the `EntryPoint`
* **Call `validateUserOp` on the `sender` contract**, passing in the `UserOperation`, its hash and the required fee.
  The Smart Contract Account MUST verify the `UserOperation`&apos;s `signature` parameter, and pay the fee if the `sender` considers the `UserOperation` valid. If any `validateUserOp` call fails, `handleOps` must skip execution of at least that `UserOperation`, and may revert entirely.
* Validate the account&apos;s deposit in the `EntryPoint` is high enough to cover the max possible cost (cover the already-done verification and max execution gas)

In the execution loop, the `handleOps` call must perform the following steps for each `UserOperation`:

* **Call the account with the `UserOperation`&apos;s calldata**. It&apos;s up to the account to choose how to parse the calldata; an expected workflow is for the account to have an `execute` function that parses the remaining calldata as a series of one or more calls that the account should make.
* If the calldata starts with the methodsig `IAccountExecute.executeUserOp`, then the `EntryPoint` must build a calldata by encoding `executeUserOp(userOp,userOpHash)` and call the account using that calldata.
* After the call, refund the account&apos;s deposit with the excess gas cost that was pre-charged.\
 A penalty of `10%` (`UNUSED_GAS_PENALTY_PERCENT`) is applied on the amounts of `callGasLimit` and `paymasterPostOpGasLimit` gas that remains **unused**.\
 This penalty is only applied if the amount of the remaining unused gas is greater than or equal `40000` (`PENALTY_GAS_THRESHOLD`).\
 This penalty is necessary to prevent the `UserOperations` from reserving large parts of the gas space in the bundle but leaving it unused and preventing the bundler from including other `UserOperations`.
* After the execution of all calls, pay the collected fees from all `UserOperations` to the `beneficiary` address provided by the bundler.

![](../assets/eip-4337/bundle-seq.svg)

Before accepting a `UserOperation`, bundlers SHOULD use an RPC method to locally call the `handleOps` function on the `EntryPoint`,
to verify that the signature is correct and the `UserOperation` actually pays fees; see the [Simulation section below](#useroperation-simulation) for details.
A node/bundler MUST reject a `UserOperation` that fails the validation, meaning not adding it to the local mempool
and not propagating it to other peers.

### JSON-RPC API for [ERC-4337](./eip-4337)

In order to support sending `UserOperation` objects to bundlers, which in turn propagate them through the P2P mempool,
we introduce a set of JSON-RPC APIs including `eth_sendUserOperation` and `eth_getUserOperationReceipt`.

The full definition of the new JSON-RPC API is outside the scope of this proposal.

### Support for [EIP-712](./eip-712.md) signatures

The `userOpHash` is calculated as an [EIP-712] typed message hash with the following parameters:

```solidity
bytes32 constant TYPE_HASH =
    keccak256(
        &quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&quot;
    );

bytes32 constant PACKED_USEROP_TYPEHASH =
    keccak256(
        &quot;PackedUserOperation(address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData)&quot;
    );
```

### Support for [EIP-7702](./eip-7702.md) authorizations

On networks with [EIP-7702](./eip-7702.md) enabled, the `eth_sendUserOperation` method accepts an extra `eip7702Auth` parameter.
If this parameter is set, it MUST be a valid [EIP-7702](./eip-7702.md) authorization tuple, and signed by the `sender` address.
The bundler MUST add all required `eip7702Auth` of all `UserOperations` in a bundle to the `authorizationList` and execute
the bundle using a transaction type `SET_CODE_TX_TYPE`.
Additionally, the `UserOperation` hash calculation is updated to include the desired [EIP-7702](./eip-7702.md) delegation address.

If the `initCode` field starts with `0x7702` right-padded with 18 zeros, and this account was deployed using an EIP-7702 transaction, then the hash is calculated as follows:

* For the purpose of hash calculation, the first 20 bytes of the `initCode` field of the `UserOperation` are set to account&apos;s EIP-7702 delegate address (fetched with EXTCODECOPY)
* The `initCode` is not used to call a factory contract.
* If the `initCode` is longer than 20 bytes, then the rest of the initCode is used to call an initialization function in the account itself.

Note that a `UserOperation` may still be executed without such `initCode`.
In this case the `EntryPoint` doesn&apos;t hash the current [EIP-7702 delegate](./eip-7702.md), and can be potentially executed against a modified account.

Additionally, EIP-7702 defines the gas cost of executing an authorization equal to `PER_EMPTY_ACCOUNT_COST = 25000`.
This gas consumption is not observable on-chain by the `EntryPoint` contract and MUST be included in the `preVerificationGas` value.

### Extension: paymasters

We extend the `EntryPoint` logic to support **paymasters** 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 `paymasterAndData` field in the `UserOperation` is not empty, the `EntryPoint` implements a different flow for that UserOperation:

![](../assets/eip-4337/bundle-seq-pm.svg)

During the verification loop, in addition to calling `validateUserOp`, the `handleOps` execution also must check that the paymaster has enough ETH deposited with the `EntryPoint` to pay for the `UserOperation`, and then call `validatePaymasterUserOp` on the paymaster to verify that the paymaster is willing to pay for the `UserOperation`. Note that in this case, the `validateUserOp` is called with a `missingAccountFunds` of 0 to reflect that the account&apos;s deposit is not used for payment for this `UserOperation`.

If the paymaster&apos;s `validatePaymasterUserOp` returns a non-empty `context` byte array, then `handleOps` must call `postOp` on the paymaster after making the main execution call.
Otherwise, no call is done to the `postOp` function.

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.

#### The `paymasterAndData` field encoding and `paymasterSignature`

The `paymasterAndData` field is a byte array that contains a non-standard encoding of the following fields:
* `paymasterAddress` - 20 bytes — the address of the paymaster contract
* `paymasterVerificationGasLimit` - 16 bytes - the gas limit for the verification function
* `postOpGasLimit` - 16 bytes - the gas limit for the postOp function
* `paymasterData` - the data that the paymaster contract will receive in the `validatePaymasterUserOp` call

The following data can optionally be appended to the `paymasterAndData` field:
* `paymasterSignature` - the &quot;signature&quot; value byte array to be checked by the paymaster contract; this value can be provided **without affecting the UserOperation hash**
* `paymasterSignatureLength` - 2 bytes - the exact length of the `paymasterSignature` parameter byte array
* `PAYMASTER_SIG_MAGIC` (`0x22e325a297439656`) - the magic value that is appended to indicate the use of the `paymasterSignature` feature by the UserOperation

Note that as both the `signature` and the `paymasterSignature` fields do not affect the UserOperation hash, the signing by the Sender and the Paymaster can be performed in parallel.

The paymaster interface is as follows:

```solidity
function validatePaymasterUserOp
    (PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)
    external returns (bytes memory context, uint256 validationData);

function postOp
    (PostOpMode mode, bytes calldata context, uint256 actualGasCost, uint256 actualUserOpFeePerGas)
    external;

enum PostOpMode {
    opSucceeded, // UserOperation succeeded
    opReverted // UserOperation reverted. paymaster still has to pay for gas.
}
```

The `EntryPoint` must implement the following API to let entities like paymasters have a stake, and thus have more flexibility in their storage access.

```solidity
// add a stake to the calling entity
function addStake(uint32 _unstakeDelaySec) external payable;

// unlock the stake (must wait unstakeDelay before can withdraw)
function unlockStake() external;

// withdraw the unlocked stake
function withdrawStake(address payable withdrawAddress) external;
```

The paymaster must also have a deposit, which the `EntryPoint` will charge `UserOperation` costs from.
The deposit (for paying gas fees) is separate from the stake (which is locked).

The `EntryPoint` must implement the following interface to allow Paymasters (and optionally Accounts) to manage their deposit:

```solidity
// return the deposit of an account
function balanceOf(address account) public view returns (uint256);

// add to the deposit of the given account
function depositTo(address account) public payable;

// add to the deposit of the calling account
receive() external payable;

// withdraw from the deposit of the current account
function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;

// get the currently executing UserOperation hash, or 0 if not called during the execution
function getCurrentUserOpHash() public view returns (bytes32);
```

### Bundler behavior upon receiving a UserOperation

![](../assets/eip-4337/bundle-build-full-seq.svg)

Similar to an Ethereum transaction, the offchain flow of a `UserOperation` can be described as follows:
1. Client sends a `UserOperation` to the bundler through an RPC call `eth_sendUserOperation`.
2. Before including the `UserOperation` in the mempool, the bundler runs the *first validation* of the newly received UserOperation. If the `UserOperation` fails validation, the bundler drops it and returns an error in response to `eth_sendUserOperation`.
3. Later, once building a bundle, the bundler takes `UserOperations` from the mempool and runs the *second validation* of a single `UserOperation` on each of them. If it succeeds, it is scheduled for inclusion in the next bundle, and dropped otherwise.
4. Before submitting the new bundle onchain, the bundler performs the *third validation* of the entire `UserOperations` bundle. If any of the `UserOperations` fail validation, the bundler drops them. The bundler should keep track of the peers&apos; reputation. The full design of such a reputation system is outside the scope of this proposal.

When a bundler receives a `UserOperation`, it must first run some basic sanity checks, namely that:

* Either the `sender` is an existing contract, or the `initCode` is not empty (but not both)
* If `initCode` is not empty, parse its first 20 bytes as a factory address or an [EIP-7702](./eip-7702.md) flag.\
  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.
* The `verificationGasLimit` and `paymasterVerificationGasLimits` are lower than `MAX_VERIFICATION_GAS` (`500000`) and the `preVerificationGas` is high enough to pay for the calldata gas cost of serializing the `UserOperation` plus `PRE_VERIFICATION_OVERHEAD_GAS` (`50000`).
* The `paymasterAndData` is either empty, or starts with the **paymaster** 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&apos;s stake is also checked, depending on its storage usage.
* The `callGasLimit` is at least the cost of a `CALL` with non-zero value.
* The `maxFeePerGas` and `maxPriorityFeePerGas` 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 `block.basefee`.
* The `sender` doesn&apos;t have another `UserOperation` already present in the mempool (or it replaces an existing entry with the same sender and nonce, with a higher `maxPriorityFeePerGas` and an equally increased `maxFeePerGas`).
  Only one `UserOperation` per sender may be included in a single bundle.
  A sender is exempt from this rule and may have multiple `UserOperations` in the mempool and in a bundle if it is staked.
### UserOperation Simulation

We define `UserOperation` simulation, as the offchain view call (or trace call) to the `EntryPoint` contract with the `UserOperation`, and the enforcement of the shared set of rules applied to the validation code, as part of the `UserOperation` validation.

#### Simulation Rationale
To validate a normal Ethereum transaction `tx`, the bundler performs static checks, like:
1. `ecrecover(tx.v, tx.r, tx.s)` has to return a valid EOA
2. `tx.nonce` has to be the current nonce of the recovered EOA
3. `balance` of the recovered EOA has to be sufficient to pay for the transaction
4. `tx.gasLimit` has to be sufficient to cover the intrinsic gas cost of a transaction
5. `chainId` has to match the current chain

All of these checks do not rely on EVM state, and cannot be affected by other Accounts&apos; transactions.

In contrast, `UserOperation` validation rely on EVM state (calls to `validateUserOp`, `validatePaymasterUserOp`), can be changed by other `UserOperations` (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 `UserOperation` is sandboxed, isolated from other `UserOperations` in the same bundle.

#### Simulation Specification:

To simulate a `UserOperation` validation, the bundler makes a view call to the `handleOps()` method with the `UserOperation` to check.

Simulation should run only on the validation section of the `sender` and `paymaster`, and is not required for the `UserOperation`&apos;s execution.
A bundler MAY add second &quot;always failed&quot; `UserOperation` to the bundle, so that the simulation will 
end as soon as the first UserOperation&apos;s validation complete.

The bundler MUST drop the `UserOperation` if the simulation reverts

The simulated call performs the full validation, by calling:

1. If `initCode` is present, create the `sender` Account.
2. `account.validateUserOp`.
3. if specified a paymaster: `paymaster.validatePaymasterUserOp`.

Either `sender` or `paymaster` may return a time-range (`validAfter`/`validUntil`).
The `UserOperation` MUST be valid at the current time to be considered valid, defined as `validAfter&lt;=block.timestamp`.

A bundler MUST drop a `UserOperation` 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 `validateUserOp` and `validatePaymasterUserOp` methods.

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.

### Estimating `preVerificationGas`

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.

However, the requirement is for the estimated value to be sufficient to cover the following costs:

* Base bundle transaction cost. On Ethereum, `21000` gas divided by the number of `UserOperations`.
* The calldata gas cost related to the `UserOperation` as defined in [EIP-2028](./eip-2028.md).
* Static `EntryPoint` contract code execution.
* Static memory cost when loading the fixed size fields of the `UserOperation` into EVM memory
* Memory cost (including expansion cost) due to context returned by paymaster `validatePaymasterUserOp` function, if relevant.
  * External call to the `innerHandleOp()` function which is a major part of the `EntryPoint` implementation.
  Note that this value is not static and depends on the `UserOperation`&apos;s position in the bundle.
* [EIP-7702] authorization cost, if any.
* [EIP-7623](./eip-7623.md) calldata floor price increase is estimated as follows:
  * Apply the new formula for `tx.gasUsed`, replacing the `execution_gas_used` value with an estimate for value made for this UserOperation.
  * 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 `postOp` gas limit.

The bundler MUST require a slack in `PreVerificationGas` value, to accommodate memory expansion costs in the future bundle, and the expected position of the `UserOperation` in it.

### Alternative Mempools

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.

The procedure of using alternate mempools is outside the scope of this proposal.

### Bundling

Bundling is the process where a node/bundler collects multiple `UserOperations` and creates a single transaction to submit on-chain.

During bundling, the bundler MUST:

* Exclude `UserOperations` that access any sender address of another `UserOperation` in the same bundle.
* Exclude `UserOperations` that access any address created by another `UserOperation` validation in the same bundle (via a factory).
* For each paymaster used in the bundle, keep track of the balance while adding `UserOperations`. Ensure that it has sufficient deposit to pay for all the `UserOperations` that use it.

After creating the bundle, before including the transaction in a block, the bundler SHOULD:

* Run `debug_traceCall` with maximum possible gas, to enforce the validation rules on opcode and storage access,
  as well as to verify the entire `handleOps` bundle transaction,
  and use the consumed gas for the actual transaction execution.
* If the call reverted, the bundler MUST use the trace result to find the entity that reverted the call. \
  This is the last entity that is CALL&apos;ed by the `EntryPoint` prior to the revert. \
  (the bundler cannot assume the revert is `FailedOp`)
* If any verification context rule was violated the bundlers MUST treat it the same as
  if this `UserOperation` reverted.
* Remove the offending `UserOperation` from the current bundle and from mempool.
* If the error is caused by a `factory` or a `paymaster`, and the `sender`
  of the `UserOperation` **is not** a staked entity, then issue a &quot;ban&quot; for the guilty factory or paymaster.
* If the error is caused by a `factory` or a `paymaster`, and the `sender`
  of the `UserOperation` **is** a staked entity, do not ban the `factory` / `paymaster` from the mempool.
  Instead, issue a &quot;ban&quot; for the staked `sender` entity.
* Repeat until `debug_traceCall` succeeds.

As staked entries may use some kind of transient storage to communicate data between `UserOperations` 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 `handleOps` validation in its entirety as for individual `UserOperations`.
Otherwise, attackers may be able to use the banned opcodes to detect running on-chain and trigger a `FailedOp` revert.

When a bundler includes a bundle in a block it must ensure that earlier transactions in the block don&apos;t make any `UserOperation` fail.


### Error codes.

While performing validation, the `EntryPoint` must revert on failures. During simulation, the calling bundler MUST be able to determine which entity (`sender`,`factory` or `paymaster`) caused the failure.
The attribution of a revert to an entity is done using call-tracing: the last entity called by the `EntryPoint` prior to the revert is the entity that caused the revert.
* For diagnostic purposes, the `EntryPoint` must only revert with explicit `SignatureValidationFailed()`, `FailedOp()` or `FailedOpWithRevert()` errors.
* The message of the error starts with event code, AA##
* Event code starting with &quot;AA1&quot; signifies an error during `sender` creation
* Event code starting with &quot;AA2&quot; signifies an error during `sender` validation (`validateUserOp`)
* Event code starting with &quot;AA3&quot; signifies an error during `paymaster` validation (`validatePaymasterUserOp`)


## Rationale

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.

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 `validateUserOp` method that takes as input a `UserOperation`, verifies the signature and pays the fee.
Only if this method returns successfully, the execution will happen.

The `EntryPoint`-based approach allows for a clean separation between verification and execution, and keeps Smart Contract Accounts&apos; logic simple. It enforces the simple rule that only after validation is successful and the `UserOperation` can pay, the execution is done and only done once, and also guarantees the fee payment.

### Validation Rules Rationale
The next step is protecting the bundlers from denial-of-service attacks by a mass number of `UserOperations` that appear to be valid (and pay) but that eventually revert, and thus block the bundler from processing valid `UserOperations`.

There are two types of `UserOperations` that can fail validation:
1. `UserOperations` 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.
2. `UserOperations` that are valid when checked independently but fail when bundled together to be put on-chain.
To prevent such rogue `UserOperations`, 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.

### Reputation Rationale

UserOperation&apos;s storage access rules prevent them from interfering with each other.
But &quot;global&quot; entities - paymasters and factories are accessed by multiple `UserOperations`, and thus might invalidate multiple previously valid `UserOperations`.

To prevent abuse, we throttle down (or completely ban for a period of time) an entity that causes invalidation of a large number of `UserOperations` 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.

Unstaked entities are allowed, under the rules below.

When staked, an entity is less restricted in its use of contract storage.

The stake value is not enforced on-chain, but specifically by each bundler while simulating a transaction.

### Paymasters

Paymaster contracts allow the abstraction of gas: having a contract, that is not the sender of the transaction, to pay for the transaction fees.

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.

### First-time Smart Contract Account creation

NOTE: for contracts using EIP-7702 this flow is described in [Support for [EIP-7702] authorizations](#support-for-eip-7702-authorizations).

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.

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 `CREATE2 0xF5` (not `CREATE 0xF0`) to create the Account, so that the order of creation of the Accounts doesn&apos;t interfere with the generated addresses.
The `initCode` field (if non-zero length) is parsed as a 20-byte `factory` address, followed by `calldata` to pass to this address.
This method call is expected to create the Account and return its address.
If the factory does use `CREATE2 0xF5` or some other deterministic method to create the Account, it&apos;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 `entryPoint.getSenderAddress()`, which calls the `factory` under the hood.
When `initCode` is specified, if either the `sender` address points to an existing contract or the `sender` address still does not exist after calling the `initCode`,
then the operation is aborted.
The `initCode` MUST NOT be called directly from the `EntryPoint`, but from another address.
The contract created by this factory method MUST accept a call to `validateUserOp` to validate the `UserOperation`&apos;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&apos;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 `entryPoint.getSenderAddress()`

## Backwards Compatibility

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-[ERC-4337](./eip-4337.md) Smart Contract Accounts, because those Accounts do not have a `validateUserOp` function. If the Smart Contract Account has a function for authorizing a trusted `UserOperation` submitter, then this could be fixed by creating an [ERC-4337](./eip-4337.md) compatible Account that re-implements the verification logic as a wrapper and setting it to be the original Account&apos;s trusted `UserOperation` submitter.

## Security Considerations

The `EntryPoint` contract will need to be audited and formally verified, because it will serve as a central trust point for _all_ [ERC-4337]. In total, this architecture reduces auditing and formal verification load for the ecosystem, because the amount of work that individual _accounts_ have to do becomes much smaller (they need only verify the `validateUserOp` function and its &quot;check signature and pay fees&quot; logic) and check that other functions are `msg.sender == ENTRY_POINT` gated (perhaps also allowing `msg.sender == self`), but it is nevertheless the case that this is done precisely by concentrating security risk in the `EntryPoint` contract that needs to be verified to be very robust.

Verification would need to cover two primary claims (not including claims needed to protect paymasters, and claims needed to establish p2p-level DoS resistance):

* **Safety against arbitrary hijacking**: The `EntryPoint` only calls to the `sender` with `userOp.calldata` and only if `validateUserOp` to that specific `sender` has passed.
* **Safety against fee draining**: If the `EntryPoint` calls `validateUserOp` and passes, it also must make the generic call with calldata equal to `userOp.calldata`

### Factory contracts

All `factory` contracts MUST check that all calls to the `createAccount()` function originate from the `entryPoint.senderCreator()` address.

### Paymasters contracts

All `paymaster` contracts MUST check that all calls to the `validatePaymasterUserOp()` and `postOp()` functions originate from the `EntryPoint`.

### Aggregator contracts

All `aggregator` contracts MUST check that all calls to the `validateSignatures()` function originates from the `EntryPoint`.

### EIP-7702 delegated Smart Contract Accounts

All EIP-7702 delegated Smart Contract Account implementations MUST check that all calls to the initialization function originate from the `entryPoint.senderCreator()` address.

There is no way for the `EntryPoint` 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 `EntryPoint`.
The Account code SHOULD only allow calling it once and the Wallet Application SHOULD NOT pass the `initCode` repeatedly.

### Smart Contract Accounts

#### Storage layout collisions

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.

When changing the underlying implementation, all Accounts MUST ensure that there are no conflicts in the storage layout
of the two contracts.

One common approach to this problem is often referred to as &quot;diamond storage&quot; and is fully described in [ERC-7201](./eip-7201).

### Transient Storage

Contracts using the [EIP-1153](./eip-1153) transient storage MUST take into account that ERC-4337 allows multiple
`UserOperations` from different unrelated `sender` 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 29 Sep 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4337</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4337</guid>
      </item>
    
      <item>
        <title>Ordered NFT Batch Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://github.com/ethereum/EIPs/issues/3782</comments>
        
        <description>## Abstract
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 `tokenId`s are encoded with
the sets of `unicodes` for logographic characters and emojis. As a result, NFTs
can be utilized as carriers of meanings.

## Motivation
Non-fungible tokens are widely accepted as carriers of crypto-assets, hence in both
[ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md), the ordering information of 
multiple NFTs is discarded. However, as proposed in [EIP-3754](./eip-3754.md), 
non-fungible tokens are thought of as basic units on a blockchain and can carry 
abstract meanings with unicoded `tokenId`s. Transferring such tokens is transmitting 
an ordered sequence of unicodes, thus effectively transmitting phrases or meanings 
on a blockchain.

A **[logograph](https://en.wikipedia.org/wiki/Logogram)** is a written character
that represents a word or morpheme, examples include _hanzi_ in Mandarin, _kanji_
in Japanese, _hanja_ in Korean, and etc. A [unicode](https://en.wikipedia.org/wiki/Unicode) 
is an information technology standard for the consistent encoding, representation, and
handling of texts.

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.

A motivating example is instead of sending the two Chinese characters of the
Great Wall `长城`, two NFTs with IDs `#38271` and `#22478` 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 `(38271, 22478)` and `(22478, 38271)` can be decoded as
`长城` and `城长`, respectively, and both are legitimate words in the Chinese
language. This illustrates the key difference between this standard and [ERC-1155](./eip-1155.md).

Besides, in the eastern Asian culture, characters are sometimes considered or
practically used as gifts in holidays such as Spring Feastival, etc.
`(24685, 21916, 21457, 36001)` `恭喜发财` 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.

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.

Other practical and interesting applications include Chinese chess, wedding
vows, family generation quotes and sayings, funeral commendation words, prayers,
anecdotes and etc.

## Specification
```
pragma solidity ^0.8.0;

/**
    @title EIP-4341 Multi Ordered NFT Standard
    @dev See https://eips.ethereum.org/EIPS/eip-4341
 */
interface ERC4341 /* is ERC165 */ {
    event Transfer(address indexed from, address indexed to, uint256 id, uint256 amount);

    event TransferBatch(address indexed from, address indexed to, uint256[] ids, uint256[] amounts);

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;

    function safePhraseTransferFrom(address from, address to, uint256[] calldata phrase, bytes calldata data) external;

    function balanceOf(address owner, uint256 id) external view returns (uint256);

    function balanceOfPhrase(address owner) external view returns (uint256);

    function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view returns (uint256[] memory);

    function retrievePhrase(address owner, uint256 phraseId) external view returns (uint256[] memory);

    function setApprovalForAll(address operator, bool approved) external;

    function isApprovedForAll(address owner, address operator) external view returns (bool);
}
```

## Rationale
In [ERC-1155](./eip-1155.md) and [ERC-721](./eip-721.md), NFTs are used to represent
crypto-assets, and in this standard together with [EIP-3754](./eip-3754.md), NFTs
are equipped with utilities. In this standard, the ordering information of a batch
of NFTs is retained and managed through a construct `phrase`.

### Phrase
A `phrase` 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 [ERC-1155](./eip-1155.md) is required.

## Backwards Compatibility
[EIP-3754](./eip-3754.md) is the pre-requisite to this standard.

## Reference Implementation
https://github.com/simontianx/ERC4341

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 01 Oct 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4341</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4341</guid>
      </item>
    
      <item>
        <title>Interface for Staked Tokens in NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4353-viewing-staked-tokens-in-nft/7234</comments>
        
        <description>## Abstract
[EIP-721](./eip-721.md) 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/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.

## Motivation
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.

## Specification
```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC4353 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-4353.
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others.
 *
 * Note: The ERC-165 identifier for this interface is 0x3a3d855f.
 *
 */
interface IERC721Staked {
    
     /**
     * @dev Returns uint256 amount of on-chain tokens staked to the NFT.
     * 
     * @dev Wallets and marketplaces would need to call this for displaying
     *      the amount of tokens staked and/or bound to the NFT.
     */
    function stakedAmount(uint256 tokenId) external view returns (uint256);
    
}
```

### Suggested flow:

#### Constructor/deployment
* Creator - the owner of an NFT with its own rules for depositing tokens at and/or after the minting of a token.
* Token Amount - the current amount of on-chain [EIP-20](./eip-20.md) or derived tokens bound to an NFT from one or more deposits.
* Withdraw Mechanism - rules based approach for withdrawing staked tokens and making sure to update the balance of the staked tokens.

### Staking at mint and locking tokens in NFT
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 `burn`. Therefore, only to stake at minting and withdraw only at burning.

#### NFT displayed in wallet or marketplace
A wallet or marketplace checks if an NFT has publicly staked tokens available for display - if so, call `stakedAmount(tokenId)` to get the current amount of tokens staked and/or bound to the NFT.

The logical code looks something like this and inspired by William Entriken:

```solidity
// contracts/Token.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol&quot;;
import &quot;@openzeppelin/contracts/access/Ownable.sol&quot;;

/**
 * @title Token
 * @dev Very simple ERC721 example with stake interface example.
 * Note this implementation enforces recommended procedure:
 *  1) stake at mint
 *  2) withdraw at burn
 */
contract ERC721Staked is ERC721URIStorage, Ownable {
    /// @dev track original minter of tokenId
    mapping (uint256 =&gt; address payable) private payees;
    /// @dev map tokens to stored staked token value
    mapping (uint256 =&gt; uint256) private tokenValue;

    /// @dev metadata
    constructor() ERC721 (
        &quot;Staked NFT&quot;, 
        &quot;SNFT&quot;
    ){}

    /// @dev mints a new NFT
    /// @param _to address that will own the minted NFT
    /// @param _tokenId id the NFT
    /// @param _uri metadata
    function mint(
        address payable _to,
        uint256 _tokenId,
        string calldata _uri
    )
        external 
        payable
        onlyOwner
    {
        _mint(_to, _tokenId);
        _setTokenURI(_tokenId, _uri);
        payees[_tokenId] = _to;
        tokenValue[_tokenId] = msg.value;
    }

    /// @dev staked interface
    /// @param _tokenId id of the NFT
    /// @return _value staked value
    function stakedAmount(
        uint256 _tokenId
    ) external view returns (uint256 _value) {
        _value = tokenValue[_tokenId];
        return _value;
    }

    /// @dev removes NFT &amp; transfers crypto to minter
    /// @param _tokenId the NFT we want to remove
    function burn(
        uint256 _tokenId
    )
        external
        onlyOwner
    {
        super._burn(_tokenId);
        payees[_tokenId].transfer(tokenValue[_tokenId]);
        tokenValue[_tokenId] = 0;
    }

}
```

## Rationale
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/or to make their contracts viewable by purchasees.

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.

## Backward Compatibility
TBD

## Test Cases
```js
const { expect } = require(&quot;chai&quot;);
const { ethers, waffle } = require(&quot;hardhat&quot;);
const provider = waffle.provider;

describe(&quot;StakedNFT&quot;, function () {
    let _id = 1234567890;
    let value = &apos;1.5&apos;;
    let Token;
    let Interface;
    let owner;
    let addr1;
    let addr2;

    beforeEach(async function () {
        Token = await ethers.getContractFactory(&quot;ERC721Staked&quot;);
        [owner, addr1, ...addr2] = await ethers.getSigners();
        Interface = await Token.deploy();
    });

    describe(&quot;Staked NFT&quot;, function () {
        it(&quot;Should set the right owner&quot;, async function () {
            let mint = await Interface.mint(
                addr1.address, _id, &apos;http://foobar&apos;)
            expect(await Interface.ownerOf(_id)).to.equal(addr1.address);
        });

        it(&quot;Should not have staked balance without value&quot;, async function () {
            let mint = await Interface.mint(
                addr1.address, _id, &apos;http://foobar&apos;)
            expect(await Interface.stakedAmount(_id)).to.equal(
                ethers.utils.parseEther(&apos;0&apos;));
        });

        it(&quot;Should set and return the staked amount&quot;, async function () {
            let mint = await Interface.mint(
                addr1.address, _id, &apos;http://foobar&apos;,
                {value: ethers.utils.parseEther(value)})
            expect(await Interface.stakedAmount(_id)).to.equal(
                ethers.utils.parseEther(value));
        });

        it(&quot;Should decrease owner eth balance on mint (deposit)&quot;, async function () {
            let balance1 = await provider.getBalance(owner.address);
            let mint = await Interface.mint(
                addr1.address, _id, &apos;http://foobar&apos;,
                {value: ethers.utils.parseEther(value)})
            let balance2 = await provider.getBalance(owner.address);
            let diff = parseFloat(ethers.utils.formatEther(
                balance1.sub(balance2))).toFixed(1);
            expect(diff === value);
        });

        it(&quot;Should add to payee&apos;s eth balance on burn (withdraw)&quot;, async function () {
            let balance1 = await provider.getBalance(addr1.address);
            let mint = await Interface.mint(
                addr1.address, _id, &apos;http://foobar&apos;,
                {value: ethers.utils.parseEther(value)})
            await Interface.burn(_id);
            let balance2 = await provider.getBalance(addr1.address);
            let diff = parseFloat(ethers.utils.formatEther(
                balance2.sub(balance1))).toFixed(1);
            expect(diff === value);
        });

        it(&quot;Should update balance after transfer&quot;, async function () {
            let mint = await Interface.mint(
                addr1.address, _id, &apos;http://foobar&apos;,
                {value: ethers.utils.parseEther(value)})
            await Interface.burn(_id);
            expect(await Interface.stakedAmount(_id)).to.equal(
                ethers.utils.parseEther(&apos;0&apos;));
        });
    });
});
```

## Security Considerations
The purpose of this standard is to simply and publicly identify whether an NFT claims to have staked tokens.

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/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.

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&apos;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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 08 Oct 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4353</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4353</guid>
      </item>
    
      <item>
        <title>Sign-In with Ethereum</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4361-sign-in-with-ethereum/7263</comments>
        
        <description>## Abstract

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.

## Motivation

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&apos; 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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Overview

Sign-In with Ethereum (SIWE) works as follows:

1. The relying party generates a SIWE Message and prefixes the SIWE Message with `\x19Ethereum Signed Message:\n&lt;length of message&gt;` as defined in [ERC-191](./eip-191.md).
2. The wallet presents the user with a structured plaintext message or equivalent interface for signing the SIWE Message with the [ERC-191](./eip-191.md) signed data format.
3. The signature is then presented to the relying party, which checks the signature&apos;s validity and SIWE Message content.
4. The relying party might further fetch data associated with the Ethereum address, such as from the Ethereum blockchain (e.g., ENS, account balances, [ERC-20](./eip-20.md)/[ERC-721](./eip-721.md)/[ERC-1155](./eip-1155.md) asset ownership), or other data sources that might or might not be permissioned.

### Message Format

#### ABNF Message Format

A SIWE Message MUST conform with the following Augmented Backus–Naur Form (ABNF, [RFC 5234](https://www.rfc-editor.org/rfc/rfc5234)) expression (note that `%s` denotes case sensitivity for a string term, as per [RFC 7405](https://www.rfc-editor.org/rfc/rfc7405)).

```abnf
sign-in-with-ethereum =
    [ scheme &quot;://&quot; ] domain %s&quot; wants you to sign in with your Ethereum account:&quot; LF
    address LF
    LF
    [ statement LF ]
    LF
    %s&quot;URI: &quot; uri LF
    %s&quot;Version: &quot; version LF
    %s&quot;Chain ID: &quot; chain-id LF
    %s&quot;Nonce: &quot; nonce LF
    %s&quot;Issued At: &quot; issued-at
    [ LF %s&quot;Expiration Time: &quot; expiration-time ]
    [ LF %s&quot;Not Before: &quot; not-before ]
    [ LF %s&quot;Request ID: &quot; request-id ]
    [ LF %s&quot;Resources:&quot;
    resources ]

scheme = ALPHA *( ALPHA / DIGIT / &quot;+&quot; / &quot;-&quot; / &quot;.&quot; )
    ; See RFC 3986 for the fully contextualized
    ; definition of &quot;scheme&quot;.

domain = authority
    ; From RFC 3986:
    ;     authority     = [ userinfo &quot;@&quot; ] host [ &quot;:&quot; port ]
    ; See RFC 3986 for the fully contextualized
    ; definition of &quot;authority&quot;.

address = &quot;0x&quot; 40*40HEXDIG
    ; Must also conform to capitalization
    ; checksum encoding specified in EIP-55
    ; where applicable (EOAs).

statement = *( reserved / unreserved / &quot; &quot; )
    ; See RFC 3986 for the definition
    ; of &quot;reserved&quot; and &quot;unreserved&quot;.
    ; The purpose is to exclude LF (line break).

uri = URI
    ; See RFC 3986 for the definition of &quot;URI&quot;.

version = &quot;1&quot;

chain-id = 1*DIGIT
    ; See EIP-155 for valid CHAIN_IDs.

nonce = 8*( ALPHA / DIGIT )
    ; See RFC 5234 for the definition
    ; of &quot;ALPHA&quot; and &quot;DIGIT&quot;.

issued-at = date-time
expiration-time = date-time
not-before = date-time
    ; See RFC 3339 (ISO 8601) for the
    ; definition of &quot;date-time&quot;.

request-id = *pchar
    ; See RFC 3986 for the definition of &quot;pchar&quot;.

resources = *( LF resource )

resource = &quot;- &quot; URI
```

#### Message Fields

This specification defines the following SIWE Message fields that can be parsed from a SIWE Message by following the rules in [ABNF Message Format](#abnf-message-format):

- `scheme` OPTIONAL. The URI scheme of the origin of the request. Its value MUST be an RFC 3986 URI scheme.
- `domain` 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 `scheme` is assumed (e.g., 443 for HTTPS). If `scheme` is not specified, HTTPS is assumed by default.
- `address` REQUIRED. The Ethereum address performing the signing. Its value SHOULD be conformant to mixed-case checksum address encoding specified in [ERC-55](./eip-55.md) where applicable.
- `statement` OPTIONAL. A human-readable ASCII assertion that the user will sign which MUST NOT include `&apos;\n&apos;` (the byte `0x0a`).
- `uri` REQUIRED. An RFC 3986 URI referring to the resource that is the subject of the signing (as in the _subject of a claim_).
- `version` REQUIRED. The current version of the SIWE Message, which MUST be `1` for this specification.
- `chain-id` REQUIRED. The [EIP-155](./eip-155.md) Chain ID to which the session is bound, and the network where Contract Accounts MUST be resolved.
- `nonce` REQUIRED. A random string typically chosen by the relying party and used to prevent replay attacks, at least 8 alphanumeric characters.
- `issued-at` REQUIRED. The time when the message was generated, typically the current time. Its value MUST be an [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339) datetime string.
- `expiration-time` OPTIONAL. The time when the signed authentication message is no longer valid. Its value MUST be an [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339) datetime string.
- `not-before` OPTIONAL. The time when the signed authentication message will become valid. Its value MUST be an [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339) datetime string.
- `request-id` OPTIONAL. A system-specific identifier that MAY be used to uniquely refer to the sign-in request.
- `resources` 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 `&quot;\n- &quot;` where `\n` is the byte `0x0a`.

#### Informal Message Template

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 [ABNF Message Format](#abnf-message-format).

```
${scheme}:// ${domain} wants you to sign in with your Ethereum account:
${address}

${statement}

URI: ${uri}
Version: ${version}
Chain ID: ${chain-id}
Nonce: ${nonce}
Issued At: ${issued-at}
Expiration Time: ${expiration-time}
Not Before: ${not-before}
Request ID: ${request-id}
Resources:
- ${resources[0]}
- ${resources[1]}
...
- ${resources[n]}
```

#### Examples

The following is an example SIWE Message with an implicit scheme:

```
example.com wants you to sign in with your Ethereum account:
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

I accept the ExampleOrg Terms of Service: https://example.com/tos

URI: https://example.com/login
Version: 1
Chain ID: 1
Nonce: 32891756
Issued At: 2021-09-30T16:25:24Z
Resources:
- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/
- https://example.com/my-web2-claim.json
```

The following is an example SIWE Message with an implicit scheme and explicit port:

```
example.com:3388 wants you to sign in with your Ethereum account:
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

I accept the ExampleOrg Terms of Service: https://example.com/tos

URI: https://example.com/login
Version: 1
Chain ID: 1
Nonce: 32891756
Issued At: 2021-09-30T16:25:24Z
Resources:
- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/
- https://example.com/my-web2-claim.json
```

The following is an example SIWE Message with an explicit scheme:

```
https://example.com wants you to sign in with your Ethereum account:
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

I accept the ExampleOrg Terms of Service: https://example.com/tos

URI: https://example.com/login
Version: 1
Chain ID: 1
Nonce: 32891756
Issued At: 2021-09-30T16:25:24Z
Resources:
- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/
- https://example.com/my-web2-claim.json
```

### Signing and Verifying Messages with Ethereum Accounts

- For Externally Owned Accounts (EOAs), the verification method specified in [ERC-191](./eip-191.md) MUST be used.

- For Contract Accounts,
    - The verification method specified in [ERC-1271](./eip-1271.md) 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.
    - When performing [ERC-1271](./eip-1271.md) signature verification, the contract performing the verification MUST be resolved from the specified `chain-id`.
    - Implementers SHOULD take into consideration that [ERC-1271](./eip-1271.md) 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 [ERC-1271](./eip-1271.md) 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.

### Resolving Ethereum Name Service (ENS) Data

- 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 `address`. Resolvable ENS data include:
    - The [primary ENS name](./eip-181.md).
    - The ENS avatar.
    - Any other resolvable resources specified in the ENS documentation.
- If resolution of ENS data is performed, implementers SHOULD take precautions to preserve user privacy and consent, as their `address` could be forwarded to third party services as part of the resolution process.

### Relying Party Implementer Steps

#### Specifying the Request Origin

- The `domain` and, if present, the `scheme`, 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 `domain` (and, if present, the `scheme`) 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.

#### Verifying a signed Message

- 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., `expiration-time`, `nonce`, `request-uri` etc.), and its signature MUST be checked as defined in [Signing and Verifying Messages with Ethereum Accounts](#signing-and-verifying-messages-with-ethereum-accounts).

#### Creating Sessions

- Sessions MUST be bound to the `address` and not to further resolved resources that can change.

#### Interpreting and resolving Resources

- Implementers SHOULD ensure that URIs in the listed `resources` are human-friendly when expressed in plaintext form.
- The interpretation of the listed `resources` in the SIWE Message is out of scope of this specification.

### Wallet Implementer Steps

#### Verifying the Message Format

- The full SIWE message MUST be checked for conformance to the ABNF defined in [ABNF Message Format](#abnf-message-format).
- Wallet implementers SHOULD warn users if the substring `&quot;wants you to sign in
  with your Ethereum account&quot;` appears anywhere in an [ERC-191](./eip-191.md) message signing
  request unless the message fully conforms to the format defined [ABNF Message Format](#abnf-message-format).

#### Verifying the Request Origin

- Wallet implementers MUST prevent phishing attacks by verifying the origin of the request against the `scheme` and `domain` fields in the SIWE Message. For example, when processing the SIWE message beginning with `&quot;example.com wants you to sign in...&quot;`, the wallet checks that the request actually originated from `https://example.com`.
- The origin SHOULD be read from a trusted data source such as the browser window or over WalletConnect ([ERC-1328](./eip-1328.md)) sessions for comparison against the signing message contents.
- Wallet implementers MAY warn instead of rejecting the verification if the origin is pointing to localhost.

The following is a RECOMMENDED algorithm for Wallets to conform with the requirements on request origin verification defined by this specification.

The algorithm takes the following input variables:

- fields from the SIWE message.
- `origin` of the signing request - in the case of a browser wallet implementation - the origin of the page which requested the signin via the provider.
- `allowedSchemes` - a list of schemes allowed by the Wallet.
- `defaultScheme` - a scheme to assume when none was provided. Wallet implementers in the browser SHOULD use `https`.
- developer mode indication - a setting deciding if certain risks should be a warning instead of rejection. Can be manually configured or derived from `origin` being localhost.

The algorithm is described as follows:

- If `scheme` was not provided, then assign `defaultScheme` as `scheme`.
- If `scheme` is not contained in `allowedSchemes`, then the `scheme` is not expected and the Wallet MUST reject the request. Wallet implementers in the browser SHOULD limit the list of `allowedSchemes` to just `&apos;https&apos;` unless a developer mode is activated.
- If `scheme` does not match the scheme of `origin`, 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.
- If the `host` part of the `domain` and `origin` 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.
- If `domain` and `origin` 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.
- Let `port` be the port component of `domain`, and if no port is contained in `domain`, assign `port` the default port specified for the `scheme`.
- If `port` is not empty, then the Wallet SHOULD show a warning if the `port` does not match the port of `origin`.
- If `port` is empty, then the Wallet MAY show a warning if `origin` contains a specific port. (Note &apos;https&apos; has a default port of 443 so this only applies if `allowedSchemes` contain unusual schemes)
- Return request origin verification completed.

#### Creating Sign-In with Ethereum Interfaces

- 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: `scheme`, `domain`, `address`, `statement`, and `resources`. Other present fields MUST also be made available to the user prior to signing either by default or through an extended interface.
- 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.
- 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.

#### Supporting internationalization (i18n)

- After successfully parsing the message into ABNF terms, translation MAY happen at the UX level per human language.

## Rationale

### Requirements

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).

Additional functional requirements:

1. 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.
2. The application server must be able to implement fully usable support for its end without forcing a change in the wallets.
3. There must be a simple and straightforward upgrade path for both applications and wallets already using Ethereum account-based signing for authentication.
4. There must be facilities and guidelines for adequate mitigation of Man-in-the-Middle (MITM) attacks, replay attacks, and malicious signing requests.

### Design Goals

1. Human-Friendly
2. Simple to Implement
3. Secure
4. Machine Readable
5. Extensible

### Technical Decisions

- Why [ERC-191](./eip-191.md) (Signed Data Standard) over [EIP-712](./eip-712.md) (Ethereum typed structured data hashing and signing)
    - [ERC-191](./eip-191.md) is already broadly supported across wallets UX, while [EIP-712](./eip-712.md) support for friendly user display is pending. **(1, 2, 3, 4)**
    - [ERC-191](./eip-191.md) is simple to implement using a pre-set prefix prior to signing, while [EIP-712](./eip-712.md) 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. **(2)**
    - [ERC-191](./eip-191.md) produces more human-readable messages, while [EIP-712](./eip-712.md) creates signing outputs for machine consumption, with most wallets not displaying the payload to be signed in a manner friendly to humans. **(1)**![](../assets/eip-4361/signing.png)

    - [EIP-712](./eip-712.md) 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&apos;s scope. **(2)**
- Why not use JWTs? Wallets don&apos;t support JWTs. The keccak hash function is not assigned by IANA for use as a JOSE algorithm. **(2, 3)**
- 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. **(2, 3)**

### Out of Scope

The following concerns are out of scope for this version of the specification to define:

- Additional authentication not based on Ethereum addresses.
- Authorization to server resources.
- Interpretation of the URIs in the `resources` field as claims or other resources.
- The specific mechanisms to ensure domain-binding.
- The specific mechanisms to generate nonces and evaluation of their appropriateness.
- Protocols for use without TLS connections.

### Considerations for Forwards Compatibility

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.

- Possible support for Decentralized Identifiers and Verifiable Credentials.
- Possible cross-chain support.
- Possible SIOPv2 support.
- Possible future support for [EIP-712](./eip-712.md).
- Version interpretation rules, e.g., sign with minor revision greater than understood, but not greater major version.

## Backwards Compatibility

- Most wallet implementations already support [ERC-191](./eip-191.md), so this is used as a base pattern with additional features.
- 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.

## Reference Implementation

A reference implementation is available [here](../assets/eip-4361/example.js).

## Security Considerations

### Identifier Reuse

- 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.
- 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/or ENS names intentionally associated with their public presence. These users often prefer identifier reuse to maintain a single correlated identity across many services.
- 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.

### Key Management

- 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.
- Early adopters of this specification are likely to be already adept at key management, so this consideration becomes more relevant with mainstream adoption.
- 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 [ERC-1271](./eip-1271.md) signing.

### Wallet and Relying Party combined Security

- 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.

### Minimizing Wallet and Server Interaction

- 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 `nonce` to prevent replay attacks, which it verifies after signing. Privacy-preserving alternatives are suggested in the next section on preventing replay attacks.
- 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 `nonce` or requested set of `resources`. When communicating to the server, the wallet SHOULD take precautions to protect user privacy by mitigating user information revealed as much as possible.
- Prior to signing, the wallet MAY consult the user for preferences, such as the selection of one `address` out of many, or a preferred ENS name out of many.

### Preventing Replay Attacks

- A `nonce` 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&apos;s signature and resend it to establish a new session for themselves.
- Implementers MAY consider using privacy-preserving yet widely-available `nonce` values, such as one derived from a recent Ethereum block hash or a recent Unix timestamp.

### Preventing Phishing Attacks

- To prevent phishing attacks Wallets have to implement request origin verification as described in [Verifying the Request Origin](#verifying-the-request-origin).

### Channel Security

- For web-based applications, all communications SHOULD use HTTPS to prevent man-in-the-middle attacks on the message signing.
- When using protocols other than HTTPS, all communications SHOULD be protected with proper techniques to maintain confidentiality, data integrity, and sender/receiver authenticity.

### Session Invalidation

There are several cases where an implementer SHOULD check for state changes as they relate to sessions.

- If an [ERC-1271](./eip-1271.md) implementation or dependent data changes the signature computation, the server SHOULD invalidate sessions appropriately.
- If any resources specified in `resources` change, the server SHOULD invalidate sessions appropriately. However, the interpretation of `resources` is out of scope of this specification.

### Maximum Lengths for ABNF Terms

- 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 11 Oct 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4361</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4361</guid>
      </item>
    
      <item>
        <title>Micropayments for NFTs and Multi Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-proposal-micropayments-standard-for-nfts-and-multi-tokens/7366</comments>
        
        <description>## Abstract

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 [EIP-20](./eip-20.md) rewards.

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 [EIP-721](./eip-721.md) NFTs and [EIP-1155](./eip-1155.md) 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.

## Motivation

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 `tipBatch` function from the interface.

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.

To make the interface as minimal as possible in order to allow adoption into many different use cases.

Some use cases include:

- In game purchases and other virtual goods

- Tipping messages, posts, music and video content

- Donations/crowdfunding

- Distribution of royalties

- Pay per click advertising

- Incentivising use of services

- Reward cards and coupons

These can all leverage the security, immediacy and transparency of blockchain.

## Specification

This standard proposal outlines a generalised way to allow tipping via implementation of an `ITipToken` interface. The interface is intentionally kept to a minimum in order to allow for maximum use cases.

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.

Smart contracts implementing this EIP standard MUST implement the [EIP-165](./eip-165.md) 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.

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.

```solidity
interface ITipToken {
    /**
        @dev This emits when the tip token implementation approves the address
        of an NFT for tipping.
        The holders of the &apos;nft&apos; are approved to receive rewards.
        When an NFT Transfer event emits, this also indicates that the approved
        addresses for that NFT (if any) is reset to none.
        Note: the ERC-165 identifier for this interface is 0x985A3267.
    */
    event ApprovalForNFT(
        address[] holders,
        address indexed nft,
        uint256 indexed id,
        bool approved
    );

    /**
        @dev This emits when a user has deposited an ERC-20 compatible token to
        the tip token&apos;s contract address or to an external address.
        This also indicates that the deposit has been exchanged for an
        amount of tip tokens
    */
    event Deposit(
        address indexed user,
        address indexed rewardToken,
        uint256 amount,
        uint256 tipTokenAmount
    );

    /**
        @dev This emits when a holder withdraws an amount of ERC-20 compatible
        reward. This reward comes from the tip token&apos;s contract address or from
        an external address, depending on the tip token implementation
    */
    event WithdrawReward(
        address indexed holder,
        address indexed rewardToken,
        uint256 amount
    );

    /**
        @dev This emits when the tip token constructor or initialize method is
        executed.
        Importantly the ERC-20 compatible token &apos;rewardToken_&apos; to use as reward
        to NFT holders is set at this time and remains the same throughout the
        lifetime of the tip token contract.
        The &apos;rewardToken_&apos; and &apos;tipToken_&apos; MAY be the same.
    */
    event InitializeTipToken(
        address indexed tipToken_,
        address indexed rewardToken_,
        address owner_
    );

    /**
        @dev This emits every time a user tips an NFT holder.
        Also includes the reward token address and the reward token amount that
        will be held pending until the holder withdraws the reward tokens.
    */
    event Tip(
        address indexed user,
        address[] holder,
        address indexed nft,
        uint256 id,
        uint256 amount,
        address rewardToken,
        uint256[] rewardTokenAmount
    );

    /**
        @notice Enable or disable approval for tipping for a single NFT held
        by a holder or a multi token shared by holders
        @dev MUST revert if calling nft&apos;s supportsInterface does not return
        true for either IERC721 or IERC1155.
        MUST revert if any of the &apos;holders&apos; is the zero address.
        MUST revert if &apos;nft&apos; has not approved the tip token contract address as operator.
        MUST emit the &apos;ApprovalForNFT&apos; event to reflect approval or not approval.
        @param holders The holders of the NFT (NFT controllers)
        @param nft The NFT contract address
        @param id The NFT token id
        @param approved True if the &apos;holder&apos; is approved, false to revoke approval
    */
    function setApprovalForNFT(
        address[] calldata holders,
        address nft,
        uint256 id,
        bool approved
    ) external;

    /**
        @notice Checks if &apos;holder&apos; and &apos;nft&apos; with token &apos;id&apos; have been approved
        by setApprovalForNFT
        @dev This does not check that the holder of the NFT has changed. That is
        left to the implementer to detect events for change of ownership and to
        take appropriate action
        @param holder The holder of the NFT (NFT controller)
        @param nft The NFT contract address
        @param id The NFT token id
        @return True if &apos;holder&apos; and &apos;nft&apos; with token &apos;id&apos; have previously been
        approved by the tip token contract
    */
    function isApprovalForNFT(
        address holder,
        address nft,
        uint256 id
    ) external returns (bool);

    /**
        @notice Sends tip from msg.sender to holder of a single NFT or
        to shared holders of a multi token
        @dev If &apos;nft&apos; has not been approved for tipping, MUST revert
        MUST revert if &apos;nft&apos; is zero address.
        MUST burn the tip &apos;amount&apos; to the &apos;holder&apos; and send the reward to
        an account pending for the holder(s).
        If &apos;nft&apos; is a multi token that has multiple holders then each holder
        MUST receive tip amount in proportion of their balance of multi tokens
        MUST emit the &apos;Tip&apos; event to reflect the amounts that msg.sender tipped
        to holder(s) of &apos;nft&apos;.
        @param nft The NFT contract address
        @param id The NFT token id
        @param amount Amount of tip tokens to send to the holder of the NFT
    */
    function tip(
        address nft,
        uint256 id,
        uint256 amount
    ) external;

    /**
        @notice Sends a batch of tips to holders of &apos;nfts&apos; for gas efficiency
        @dev If NFT has not been approved for tipping, revert
        MUST revert if the input arguments lengths are not all the same
        MUST revert if any of the user addresses are zero
        MUST revert the whole batch if there are any errors
        MUST emit the &apos;Tip&apos; events so that the state of the amounts sent to
        each holder and for which nft and from whom, can be reconstructed.
        @param users User accounts to tip from
        @param nfts The NFT contract addresses whose holders to tip to
        @param ids The NFT token ids that uniquely identifies the &apos;nfts&apos;
        @param amounts Amount of tip tokens to send to the holders of the NFTs
    */
    function tipBatch(
        address[] calldata users,
        address[] calldata nfts,
        uint256[] calldata ids,
        uint256[] calldata amounts
    ) external;

    /**
        @notice Deposit an ERC-20 compatible token in exchange for tip tokens
        @dev The price of tip tokens can be different for each deposit as
        the amount of reward token sent ultimately is a ratio of the
        amount of tip tokens to tip over the user&apos;s tip tokens balance available
        multiplied by the user&apos;s deposit balance.
        The deposited tokens can be held in the tip tokens contract account or
        in an external escrow. This will depend on the tip token implementation.
        Each tip token contract MUST handle only one type of ERC-20 compatible
        reward for deposits.
        This token address SHOULD be passed in to the tip token constructor or
        initialize method. SHOULD revert if ERC-20 reward for deposits is
        zero address.
        MUST emit the &apos;Deposit&apos; event that shows the user, deposited token details
        and amount of tip tokens minted in exchange
        @param user The user account
        @param amount Amount of ERC-20 token to deposit in exchange for tip tokens.
        This deposit is to be used later as the reward token
    */
    function deposit(address user, uint256 amount) external payable;

    /**
        @notice An NFT holder can withdraw their tips as an ERC-20 compatible
        reward at a time of their choosing
        @dev MUST revert if not enough balance pending available to withdraw.
        MUST send &apos;amount&apos; to msg.sender account (the holder)
        MUST reduce the balance of reward tokens pending by the &apos;amount&apos; withdrawn.
        MUST emit the &apos;WithdrawReward&apos; event to show the holder who withdrew, the reward
        token address and &apos;amount&apos;
        @param amount Amount of ERC-20 token to withdraw as a reward
    */
    function withdrawReward(uint256 amount) external payable;

    /**
        @notice MUST have identical behaviour to ERC-20 balanceOf and is the amount
        of tip tokens held by &apos;user&apos;
        @param user The user account
        @return The balance of tip tokens held by user
    */
    function balanceOf(address user) external view returns (uint256);

    /**
        @notice The balance of deposit available to become rewards when
        user sends the tips
        @param user The user account
        @return The remaining balance of the ERC-20 compatible token deposited
    */
    function balanceDepositOf(address user) external view returns (uint256);

    /**
        @notice The amount of reward token owed to &apos;holder&apos;
        @dev The pending tokens can come from the tip token contract account
        or from an external escrow, depending on tip token implementation
        @param holder The holder of NFT(s) (NFT controller)
        @return The amount of reward tokens owed to the holder from tipping
    */
    function rewardPendingOf(address holder) external view returns (uint256);
}
```

### Tipping and rewards to holders

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.

### Tip Token transfer and value calculations

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/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.

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:

_total user balance of EIP-20 deposit _ tip amount / total user balance of tip tokens\*

Thus adding \*free\* tips to a user&apos;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.

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&apos;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&apos;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.

If not inheriting from EIP-20, then minting the tip tokens MUST emit `event Transfer(address indexed from, address indexed to, uint256 value)` 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 `IERC20` interface.

### Royalty distribution

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&apos;s balance is 25 and holder B&apos;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.

Here is an example implementation of ITipToken contract data structures:

```solidity
    /// Mapping from NFT/multi token to token id to holder(s)
    mapping(address =&gt; mapping(uint256 =&gt; address[])) private _tokenIdToHolders;

    /// Mapping from user to user&apos;s deposit balance
    mapping(address =&gt; uint256) private _depositBalances;

    /// Mapping from holder to holder&apos;s reward pending amount
    mapping(address =&gt; uint256) private _rewardsPending;
```

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 `tip` function implementation would then access `_tokenIdToHolders` via indices NFT/multi token address and token id to distribute to holder&apos;s or holders&apos; `_rewardsPending`.

For scenarios where royalties are to be distributed to holders directly, then implementation of the `tip` method of `ITipToken` contract MAY send the royalty amount straight from the user&apos;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.

### Caveats

To keep the `ITipToken` 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&apos;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.

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&apos;s address when a holder withdraws it as their reward.

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.

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.

### Minimising Gas Costs

By caching tips off-chain and then batching them up to call the `tipBatch` 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.

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.

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.

## Rationale

### Simplicity

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.

### Use of NFTs

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&apos;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):

- 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.

This mechanism allows consumers of the NFT a secure way to easily tip and reward the NFT holder.

### New Business Models

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.

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.

### Guaranteed audit trail

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.

## Backwards Compatibility

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&apos;s address. If inheriting from, for example, OpenZeppelin&apos;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&apos;s balanceOf function.

What hasn&apos;t been carried over to tip token standard, is the ability for a spender of other users&apos; tips. For the moment, this standard does not foresee a need for this.

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.

## Security Considerations

Though it is RECOMMENDED that users&apos; 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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 24 Oct 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4393</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4393</guid>
      </item>
    
      <item>
        <title>EIP-721 Consumable Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/EIP-4400-EIP721consumer-extension/7371</comments>
        
        <description>## Abstract

This specification defines standard functions outlining a `consumer` role for instance(s) of [EIP-721](./eip-721.md). An implementation allows reading the current `consumer` for a given NFT (`tokenId`) along with a standardized event for when an `consumer` has changed. The proposal depends on and extends the existing [EIP-721](./eip-721.md).

## Motivation

Many [EIP-721](./eip-721.md) contracts introduce their own custom role that grants permissions for utilising/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 `operator` / `contributor` 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).

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.

Having a `consumer` role will enable protocols to integrate and build on top of dApps that issue EIP-721 tokens. One example is the creation of generic/universal NFT renting marketplaces.

Example of kinds of contracts and applications that can benefit from this standard are:
- metaverses that have land and other types of digital assets in those metaverses (scene deployment on land, renting land / characters / clothes / passes to events etc.)
- 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

## Specification

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.

Every contract compliant to the `EIP721Consumable` extension MUST implement the `IEIP721Consumable` interface. The **consumer extension** is OPTIONAL for EIP-721 contracts.

```solidity
/// @title EIP-721 Consumer Role extension
///  Note: the EIP-165 identifier for this interface is 0x953c8dfa
interface IEIP721Consumable /* is EIP721 */ {

    /// @notice Emitted when `owner` changes the `consumer` of an NFT
    /// The zero address for consumer indicates that there is no consumer address
    /// When a Transfer event emits, this also indicates that the consumer address
    /// for that NFT (if any) is set to none
    event ConsumerChanged(address indexed owner, address indexed consumer, uint256 indexed tokenId);

    /// @notice Get the consumer address of an NFT
    /// @dev The zero address indicates that there is no consumer
    /// Throws if `_tokenId` is not a valid NFT
    /// @param _tokenId The NFT to get the consumer address for
    /// @return The consumer address for this NFT, or the zero address if there is none
    function consumerOf(uint256 _tokenId) view external returns (address);

    /// @notice Change or reaffirm the consumer address for an NFT
    /// @dev The zero address indicates there is no consumer address
    /// Throws unless `msg.sender` is the current NFT owner, an authorised
    /// operator of the current owner or approved address
    /// Throws if `_tokenId` is not valid NFT
    /// @param _consumer The new consumer of the NFT
    function changeConsumer(address _consumer, uint256 _tokenId) external;
}
```

Every contract implementing the `EIP721Consumable` extension is free to define the permissions of a `consumer` (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; approvals.

The `consumerOf(uint256 _tokenId)` function MAY be implemented as `pure` or `view`.

The `changeConsumer(address _consumer, uint256 _tokenId)` function MAY be implemented as `public` or `external`.

The `ConsumerChanged` event MUST be emitted when a consumer is changed.

On every `transfer`, the consumer MUST be changed to a default address. It is RECOMMENDED for implementors to use `address(0)` as that default address.

The `supportsInterface` method MUST return `true` when called with `0x953c8dfa`.

## Rationale

Key factors influencing the standard:

- Keeping the number of functions in the interfaces to a minimum to prevent contract bloat
- Simplicity
- Gas Efficiency
- Not reusing or overloading other already existing roles (e.g. owners, operators, approved addresses)

### Name

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.

The other name for the role that was considered was `operator`, however it is already defined and used within the `EIP-721` standard.

### Restriction on the Permissions

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.

## Backwards Compatibility

This standard is compatible with current EIP-721 standards. There are no other standards that define a similar role for NFTs and the name (`consumer`) is not used by other EIP-721 related standards.

## Test Cases

Test cases are available in the reference implementation [here](../assets/eip-4400/test/erc721-consumable.ts).

## Reference Implementation

The reference implementation can be found [here](../assets/eip-4400/contracts/ERC721Consumable.sol).

## Security Considerations

Implementors of the `EIP721Consumable` standard must consider thoroughly the permissions they give to `consumers`. Even if they implement the standard correctly and do not allow transfer/burning of NFTs, they might still provide permissions to the `consumers` that they might not want to provide otherwise and should be restricted to `owners` only.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 30 Oct 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4400</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4400</guid>
      </item>
    
      <item>
        <title>Described Transactions</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/discussion-eip-4430-described-transactions/8762</comments>
        
        <description>## Abstract

Use a contract method to provide *virtual functions* 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.


## Motivation

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).

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.

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.

It does not address malicious contracts which wish to lie, it only addresses
honest contracts that want to make their user&apos;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.


## Specification

The **description** (a string) and the matching **execcode** (bytecode)
are generated simultaneously by evaluating the method on a contract:

```solidity
function eipXXXDescribe(bytes inputs, bytes32 reserved) view returns (string description, bytes execcode)
```

The human-readable **description** can be shown in any client which supports
user interaction for approval, while the **execcode** is the data that
should be included in a transaction to the contract to perform that operation.

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.

During evaluation, the `ADDRESS` (i.e. `to`), `CALLER` (i.e. `from`), `VALUE`,
and `GASPRICE` must be the same as the values for the transaction being
described, so that the code generating the description can rely on them.

When executing the bytecode, best efforts should be made to ensure `BLOCKHASH`,
`NUMBER`, `TIMESTAMP` and `DIFFICULTY` match the `&quot;latest&quot;` block. The
`COINBASE` should be the zero address.

The method may revert, in which case the signing must be aborted.


## Rationale

### Meta Description

There have been many attempts to solve this problem, many of which attempt
to examine the encoded transaction data or message data directly.

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.

Instead this EIP uses an indirect description of the data.

For example, the `commit(bytes32)` method of ENS places a commitment
**hash** on-chain. The hash contains the **blinded** 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.

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. `commit(hash(name, owner, secret))`).

This technique of blinded data will become much more popular with L2
solutions, which use blinding not necessarily for privacy, but for 
compression.

### Entangling the Contract Address

To prevent signed data being used across contracts, the contract address
is entanlged into both the transaction implicitly via the `to` field.


### Alternatives

- 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

- 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.

- 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.

- The signTypedData [EIP-712](./eip-712.md) has many parallels to what this EIP aims to solve


## Backwards Compatibility

This does not affect backwards compatibility.


## Reference Implementation

I will add deployed examples by address and chain ID.


## Security Considerations

### Escaping Text

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:

- 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)
- In general, extreme care must be used when rendering HTML; consider the ENS names `&lt;span style=&quot;display:none&quot;&gt;not-&lt;/span&gt;ricmoo.eth` or `&amp;thinsp;ricmoo.eth`, which if rendered without care would appear as `ricmoo.eth`, which it is not
- Other marks which require escaping could be included, such as quotes (`&quot;`), formatting (`\n` (new line), `\f` (form feed), `\t` (tab), any of many non-standard whitespaces), back-slassh (`\`)
- 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 *something*) for code-points outside common planes or common sub-sets within planes
- Homoglyphs attacks
- Right-to-left mark may affect rendering
- Many other things, deplnding on your environment


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 07 Nov 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4430</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4430</guid>
      </item>
    
      <item>
        <title>Permit for ERC-721 NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-extending-erc2612-style-permits-to-erc721-nfts/7519/2</comments>
        
        <description>## Abstract
The &quot;Permit&quot; approval flow outlined in [ERC-2612](./eip-2612.md) 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.

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&apos;s address, ERC-721 permits focus on the `tokenId` of the NFT and increment nonce based on the transfers of the NFT.

## Motivation
The permit structure outlined in [ERC-2612](./eip-2612.md) allows for a signed message (structured as outlined in [ERC-712](./eip-712.md)) 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 [ERC-2612](./eip-2612.md).

[ERC-2612](./eip-2612.md) 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.

## Specification
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.

Three new functions MUST be added to [ERC-721](./eip-721.md):
```solidity
pragma solidity 0.8.10;

import &quot;./IERC165.sol&quot;;

///
/// @dev Interface for token permits for ERC-721
///
interface IERC4494 is IERC165 {
  /// ERC165 bytes to add to interface array - set in parent contract
  ///
  /// _INTERFACE_ID_ERC4494 = 0x5604e225

  /// @notice Function to approve by way of owner signature
  /// @param spender the address to approve
  /// @param tokenId the index of the NFT to approve the spender on
  /// @param deadline a timestamp expiry for the permit
  /// @param sig a traditional or EIP-2098 signature
  function permit(address spender, uint256 tokenId, uint256 deadline, bytes memory sig) external;
  /// @notice Returns the nonce of an NFT - useful for creating permits
  /// @param tokenId the index of the NFT to get the nonce of
  /// @return the uint256 representation of the nonce
  function nonces(uint256 tokenId) external view returns(uint256);
  /// @notice Returns the domain separator used in the encoding of the signature for permits, as defined by EIP-712
  /// @return the bytes32 domain separator
  function DOMAIN_SEPARATOR() external view returns(bytes32);
}
```
The semantics of which are as follows:

For all addresses `spender`, `uint256`s `tokenId`, `deadline`, and `nonce`, and `bytes` `sig`, a call to `permit(spender, tokenId, deadline, sig)` MUST set `spender` as approved on `tokenId` as long as the owner of `tokenId` remains in possession of it, and MUST emit a corresponding `Approval` event, if and only if the following conditions are met:

* the current blocktime is less than or equal to `deadline`
* the owner of the `tokenId` is not the zero address
* `nonces[tokenId]` is equal to `nonce`
* `sig` is a valid `secp256k1` or [EIP-2098](./eip-2098.md) signature from owner of the `tokenId`:
```
keccak256(abi.encodePacked(
   hex&quot;1901&quot;,
   DOMAIN_SEPARATOR,
   keccak256(abi.encode(
            keccak256(&quot;Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)&quot;),
            spender,
            tokenId,
            nonce,
            deadline))
));
```
where `DOMAIN_SEPARATOR` MUST be defined according to [EIP-712](./eip-712.md). The `DOMAIN_SEPARATOR` 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 `DOMAIN_SEPARATOR` is:
```
DOMAIN_SEPARATOR = keccak256(
    abi.encode(
        keccak256(&apos;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&apos;),
        keccak256(bytes(name)),
        keccak256(bytes(version)),
        chainid,
        address(this)
));
```
In other words, the message is the following ERC-712 typed structure:
```json
{
  &quot;types&quot;: {
    &quot;EIP712Domain&quot;: [
      {
        &quot;name&quot;: &quot;name&quot;,
        &quot;type&quot;: &quot;string&quot;
      },
      {
        &quot;name&quot;: &quot;version&quot;,
        &quot;type&quot;: &quot;string&quot;
      },
      {
        &quot;name&quot;: &quot;chainId&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      },
      {
        &quot;name&quot;: &quot;verifyingContract&quot;,
        &quot;type&quot;: &quot;address&quot;
      }
    ],
    &quot;Permit&quot;: [
      {
        &quot;name&quot;: &quot;spender&quot;,
        &quot;type&quot;: &quot;address&quot;
      },
      {
        &quot;name&quot;: &quot;tokenId&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      },
      {
        &quot;name&quot;: &quot;nonce&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      },
      {
        &quot;name&quot;: &quot;deadline&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      }
    ],
    &quot;primaryType&quot;: &quot;Permit&quot;,
    &quot;domain&quot;: {
      &quot;name&quot;: erc721name,
      &quot;version&quot;: version,
      &quot;chainId&quot;: chainid,
      &quot;verifyingContract&quot;: tokenAddress
  },
  &quot;message&quot;: {
    &quot;spender&quot;: spender,
    &quot;value&quot;: value,
    &quot;nonce&quot;: nonce,
    &quot;deadline&quot;: deadline
  }
}}
```
In addition:
* the `nonce` of a particular `tokenId` (`nonces[tokenId]`) MUST be incremented upon any transfer of the `tokenId`
* the `permit` function MUST check that the signer is not the zero address

Note that nowhere in this definition do we refer to `msg.sender`. The caller of the `permit` function can be any address.

This EIP requires [EIP-165](./eip-165.md). EIP165 is already required in [ERC-721](./eip-721.md), 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 `0x5604e225`. Contracts implementing this EIP MUST have the `supportsInterface` function return `true` when called with `0x5604e225`.

## Rationale
The `permit` function is sufficient for enabling a `safeTransferFrom` transaction to be made without the need for an additional transaction.

The format avoids any calls to unknown code.

The `nonces` mapping is given for replay protection.

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.

ERC-712 typed messages are included because of its use in [ERC-2612](./eip-2612.md), which in turn cites widespread adoption in many wallet providers.

While ERC-2612 focuses on the value being approved, this EIP focuses on the `tokenId` of the NFT being approved via `permit`. This enables a flexibility that cannot be achieved with ERC-20 (or even [ERC-1155](./eip-1155.md)) 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 `owner` simply and conclusively.

Whereas ERC-2612 splits signatures into their `v,r,s` components, this EIP opts to instead take a `bytes` array of variable length in order to support [EIP-2098](./eip-2098) signatures (64 bytes), which cannot be easily separated or reconstructed from `r,s,v` components (65 bytes).

## Backwards Compatibility
There are already some ERC-721 contracts implementing a `permit`-style architecture, most notably Uniswap v3. 

Their implementation differs from the specification here in that: 
 * the `permit` architecture is based on `owner`
 * the `nonce` is incremented at the time the `permit` is created
 * the `permit` function must be called by the NFT owner, who is set as the `owner`
 * the signature is split into `r,s,v` instead of `bytes`

 Rationale for differing on design decisions is detailed above.

## Test Cases

Basic test cases for the reference implementation can be found [here](https://github.com/dievardump/erc721-with-permits/tree/main/test).

In general, test suites should assert at least the following about any implementation of this EIP:
* the nonce is incremented after each transfer
* `permit` approves the `spender` on the correct `tokenId`
* the permit cannot be used after the NFT is transferred
* an expired permit cannot be used

## Reference Implementation

A reference implementation has been set up [here](https://github.com/dievardump/erc721-with-permits).

## Security Considerations

Extra care should be taken when creating transfer functions in which `permit` 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.

The remaining considerations have been copied from [ERC-2612](./eip-2612.md) with minor adaptation, and are equally relevant here:

Though the signer of a `Permit` may have a certain party in mind to submit their transaction, another party can always front run this transaction and call `permit` before the intended party. The end result is the same for the `Permit` signer, however.

Since the ecrecover precompile fails silently and just returns the zero address as `signer` when given malformed messages, it is important to ensure `ownerOf(tokenId) != address(0)` to avoid `permit` from creating an approval to any `tokenId` which does not have an approval set.

Signed `Permit` messages are censorable. The relaying party can always choose to not submit the `Permit` after having received it, withholding the option to submit it. The `deadline` parameter is one mitigation to this. If the signing party holds ETH they can also just submit the `Permit` themselves, which can render previously signed `Permit`s invalid.

The standard [ERC-20 race condition for approvals](https://swcregistry.io/docs/SWC-114) applies to `permit` as well.

If the `DOMAIN_SEPARATOR` contains the `chainId` 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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 25 Nov 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4494</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4494</guid>
      </item>
    
      <item>
        <title>Non-Fungible Tokens Tied to Physical Assets</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/new-proposal-of-smart-non-fungible-token/7677</comments>
        
        <description>## Abstract

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.
 
## Motivation

This standard was developed because [EIP-721](./eip-721.md) 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.

## Specification

The attributes `addressAsset` and `addressUser` 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 `addressUser`, two states define if the token is assigned or not to a user. `Figure 1` shows these states in a flow chart. When a token is created, transferred or unassigned, the token state is set to `notAssigned`. If the token is assigned to a valid user, the state is set to `userAssigned`.

![Figure 1 : Flow chart of the token states with `addressUser` defined (and `addressAsset` undefined)](../assets/eip-4519/images/Figure1.jpg)
  
In the case of defining the attribute `addressAsset` but not the attribute `addressUser`, two states define if the token is waiting for authentication with the owner or if the authentication has finished successfully. `Figure 2` 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 `waitingForOwner`. 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 `engagedWithOwner`.

![Figure 2 : Flow chart of the token states with `addressAsset` defined (and `addressUser` undefined)](../assets/eip-4519/images/Figure2.jpg)
 
Finally, if both the attributes `addressAsset` and `addressUser` are defined, the states of the NFT define if the asset has been engaged or not with the owner or the user (`waitingForOwner`, `engagedWithOwner`, `waitingForUser` and `engagedWithUser`). The flow chart in `Figure 3` shows all the possible state changes. The states related to the owner are the same as in `Figure 2`. The difference is that, at the state `engagedWithOwner`, the token can be assigned to a user. If a user is assigned (the token being at states `engagedWithOwner`, `waitingForUser` or `engagedWithUser`), then the token changes its state to `waitingForUser`. Once the asset and the user authenticate each other, the state of the token is set to `engagedWithUser`, and the user is able to use the asset.

 ![Figure 3 : Flow chart of the token states with `addressUser` and `addressUser` defined](../assets/eip-4519/images/Figure3.jpg)
 
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.

When the NFT is created or when the ownership is transferred, the token state is `waitingForOwner`. The asset sets its operating mode to `waitingForOwner`. 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;/sub&gt; and a Public Key PK&lt;sub&gt;O_A&lt;/sub&gt;, so that PK&lt;sub&gt;O_A&lt;/sub&gt; = SK&lt;sub&gt;O_A&lt;/sub&gt; * P. To generate the shared key between the owner and the asset, K&lt;sub&gt;O&lt;/sub&gt;, the public key of the asset, PK&lt;sub&gt;A&lt;/sub&gt;, is employed as follows:

K&lt;sub&gt;O&lt;/sub&gt; = PK&lt;sub&gt;A&lt;/sub&gt; * SK&lt;sub&gt;O_A&lt;/sub&gt;

Using the function `startOwnerEngagement`, PK&lt;sub&gt;O_A&lt;/sub&gt; is saved as the attribute `dataEngagement` and the hash of K&lt;sub&gt;O&lt;/sub&gt; as the attribute `hashK_OA`. The owner sends request engagement to the asset, and the asset calculates:

K&lt;sub&gt;A&lt;/sub&gt; = SK&lt;sub&gt;A&lt;/sub&gt; * PK&lt;sub&gt;O_A&lt;/sub&gt;

If everything is correctly done, K&lt;sub&gt;O&lt;/sub&gt; and K&lt;sub&gt;A&lt;/sub&gt; are the same since:

K&lt;sub&gt;O&lt;/sub&gt; = PK&lt;sub&gt;A&lt;/sub&gt; * SK&lt;sub&gt;O_A&lt;/sub&gt; = (SK&lt;sub&gt;A&lt;/sub&gt; * P) * SK&lt;sub&gt;O_A&lt;/sub&gt; = SK&lt;sub&gt;A&lt;/sub&gt; * (SK&lt;sub&gt;O_A&lt;/sub&gt; * P) = SK&lt;sub&gt;A&lt;/sub&gt; * PK&lt;sub&gt;O_A&lt;/sub&gt;

Using the function `ownerEngagement`, the asset sends the hash of K&lt;sub&gt;A&lt;/sub&gt;, and if it is the same as the data in `hashK_OA`, then the state of the token changes to `engagedWithOwner` and the event `OwnerEngaged` are sent. Once the asset receives the event, it changes its operation mode to `engagedWithOwner`. This process is shown in `Figure 4`. From this moment, the asset can be managed by the owner and they can communicate in a secure way using the shared key. 

 ![Figure 4: Steps in a successful owner and asset mutual authentication process](../assets/eip-4519/images/Figure4.jpg)

If the asset consults Ethereum and the state of its NFT is `waitingForUser`, the asset (assuming it is an electronic physical asset) sets its operating mode to `waitingForUser`. 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 `startUserEngagement`. As in `startOwnerEngagement`, this function saves the public key generated by the user, PK&lt;sub&gt;U_A&lt;/sub&gt;, as the attribute `dataEngagement` and the hash of K&lt;sub&gt;U&lt;/sub&gt; = PK&lt;sub&gt;A&lt;/sub&gt; * SK&lt;sub&gt;U_A&lt;/sub&gt; as the attribute `hashK_UA` in the NFT.

The user sends request engagement and the asset calculates:

K&lt;sub&gt;A&lt;/sub&gt; = SK&lt;sub&gt;A&lt;/sub&gt; * PK&lt;sub&gt;U_A&lt;/sub&gt;

If everything is correctly done, K&lt;sub&gt;U&lt;/sub&gt; and K&lt;sub&gt;A&lt;/sub&gt; are the same since:

K&lt;sub&gt;U&lt;/sub&gt; = PK&lt;sub&gt;A&lt;/sub&gt; * SK&lt;sub&gt;U_A&lt;/sub&gt; = (SK&lt;sub&gt;A&lt;/sub&gt; * P) * SK&lt;sub&gt;U_A&lt;/sub&gt; = SK&lt;sub&gt;A&lt;/sub&gt; * (SK&lt;sub&gt;U_A&lt;/sub&gt; * P) = SK&lt;sub&gt;A&lt;/sub&gt; * PK&lt;sub&gt;U_A&lt;/sub&gt;

Using the function `userEngagement`, the asset sends the hash of K&lt;sub&gt;A&lt;/sub&gt; obtained and if it is the same as the data in `hashK_UA`, then the state of the token changes to `engagedWithUser` and the event `UserEngaged` is sent. Once the asset receives the event, it changes its operation mode to `engagedWithUser`. This process is shown in `Figure 5`. From this moment, the asset can be managed by the user and they can communicate in a secure way using the shared key. 

 ![Figure 5: Steps in a successful user and asset mutual authentication process](../assets/eip-4519/images/Figure5.jpg)

Since the establishment of a shared secret key is very important for a secure communication, NFTs include the attributes 
`hashK_OA`, `hashK_UA` and `dataEngagement`. 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 `dataEngagement` defines the public data needed for the agreement. 

```solidity
pragma solidity ^0.8.0;
 /// @title EIP-4519 NFT: Extension of EIP-721 Non-Fungible Token Standard. 
///  Note: the EIP-165 identifier for this interface is 0x8a68abe3
 interface EIP-4519 NFT is EIP721/*,EIP165*/{
    /// @dev This emits when the NFT is assigned as utility of a new user.
    ///  This event emits when the user of the token changes.
    ///  (`_addressUser` == 0) when no user is assigned.
    event UserAssigned(uint256 indexed tokenId, address indexed _addressUser);
    
    /// @dev This emits when user and asset finish mutual authentication process successfully.
    ///  This event emits when both the user and the asset prove they share a secure communication channel.
    event UserEngaged(uint256 indexed tokenId);
    
    /// @dev This emits when owner and asset finish mutual authentication process successfully.
    ///  This event emits when both the owner and the asset prove they share a secure communication channel.
    event OwnerEngaged(uint256 indexed tokenId);
    
    /// @dev This emits when it is checked that the timeout has expired.
    ///  This event emits when the timestamp of the EIP-4519 NFT is not updated in timeout.
    event TimeoutAlarm(uint256 indexed tokenId);
    /// @notice This function defines how the NFT is assigned as utility of a new user (if &quot;addressUser&quot; is defined).
    /// @dev Only the owner of the EIP-4519 NFT can assign a user. If &quot;addressAsset&quot; is defined, then the state of the token must be
    /// &quot;engagedWithOwner&quot;,&quot;waitingForUser&quot; or &quot;engagedWithUser&quot; and this function changes the state of the token defined by &quot;_tokenId&quot; to
    /// &quot;waitingForUser&quot;. If &quot;addressAsset&quot; is not defined, the state is set to &quot;userAssigned&quot;. In both cases, this function sets the parameter 
    /// &quot;addressUser&quot; to &quot;_addressUser&quot;. 
    /// @param _tokenId is the tokenId of the EIP-4519 NFT tied to the asset.
    /// @param _addressUser is the address of the new user.
    function setUser(uint256 _tokenId, address _addressUser) external payable; 
    /// @notice This function defines the initialization of the mutual authentication process between the owner and the asset.
    /// @dev Only the owner of the token can start this authentication process if &quot;addressAsset&quot; is defined and the state of the token is &quot;waitingForOwner&quot;.
    /// The function does not change the state of the token and saves &quot;_dataEngagement&quot; 
    /// and &quot;_hashK_OA&quot; in the parameters of the token.
    /// @param _tokenId is the tokenId of the EIP-4519 NFT tied to the asset.
    /// @param _dataEngagement is the public data proposed by the owner for the agreement of the shared key.
    /// @param _hashK_OA is the hash of the secret proposed by the owner to share with the asset.
    function startOwnerEngagement(uint256 _tokenId, uint256 _dataEngagement, uint256 _hashK_OA) external payable;
 
    /// @notice This function completes the mutual authentication process between the owner and the asset.
    /// @dev Only the asset tied to the token can finish this authentication process provided that the state of the token is
    /// &quot;waitingForOwner&quot; and dataEngagement is different from 0. This function compares hashK_OA saved in
    /// the token with hashK_A. If they are equal then the state of the token changes to &quot;engagedWithOwner&quot;, dataEngagement is set to 0,
    /// and the event &quot;OwnerEngaged&quot; is emitted.
    /// @param _hashK_A is the hash of the secret generated by the asset to share with the owner.
    function ownerEngagement(uint256 _hashK_A) external payable; 
 
    /// @notice This function defines the initialization of the mutual authentication process between the user and the asset.
    /// @dev Only the user of the token can start this authentication process if &quot;addressAsset&quot; and &quot;addressUser&quot; are defined and
    /// the state of the token is &quot;waitingForUser&quot;. The function does not change the state of the token and saves &quot;_dataEngagement&quot; 
    /// and &quot;_hashK_UA&quot; in the parameters of the token.
    /// @param _tokenId is the tokenId of the EIP-4519 NFT tied to the asset.
    /// @param _dataEngagement is the public data proposed by the user for the agreement of the shared key.
    /// @param _hashK_UA is the hash of the secret proposed by the user to share with the asset.
    function startUserEngagement(uint256 _tokenId, uint256 _dataEngagement, uint256 _hashK_UA) external payable;
    
    /// @notice This function completes the mutual authentication process between the user and the asset.
    /// @dev Only the asset tied to the token can finish this authentication process provided that the state of the token is
    /// &quot;waitingForUser&quot; and dataEngagement is different from 0. This function compares hashK_UA saved in
    /// the token with hashK_A. If they are equal then the state of the token changes to &quot;engagedWithUser&quot;, dataEngagement is set to 0,
    /// and the event &quot;UserEngaged&quot; is emitted.
    /// @param _hashK_A is the hash of the secret generated by the asset to share with the user.
    function userEngagement(uint256 _hashK_A) external payable; 
 
    /// @notice This function checks if the timeout has expired.
    /// @dev Everybody can call this function to check if the timeout has expired. The event &quot;TimeoutAlarm&quot; is emitted
    /// if the timeout has expired.
    /// @param _tokenId is the tokenId of the EIP-4519 NFT tied to the asset.
    /// @return true if timeout has expired and false in other case.
    function checkTimeout(uint256 _tokenId) external returns (bool);
    
    /// @notice This function sets the value of timeout.
    /// @dev Only the owner of the token can set this value provided that the state of the token is &quot;engagedWithOwner&quot;,
    /// &quot;waitingForUser&quot; or &quot;engagedWithUser&quot;.
    /// @param _tokenId is the tokenId of the EIP-4519 NFT tied to the asset.
    /// @param _timeout is the value to assign to timeout.
    function setTimeout(uint256 _tokenId, uint256 _timeout) external; 
    
    /// @notice This function updates the timestamp, thus avoiding the timeout alarm.
    /// @dev Only the asset tied to the token can update its own timestamp.
    function updateTimestamp() external; 
    
    /// @notice This function lets obtain the tokenId from an address. 
    /// @dev Everybody can call this function. The code executed only reads from Ethereum.
    /// @param _addressAsset is the address to obtain the tokenId from it.
    /// @return tokenId of the token tied to the asset that generates _addressAsset.
    function tokenFromBCA(address _addressAsset) external view returns (uint256);
    
    /// @notice This function lets know the owner of the token from the address of the asset tied to the token.
    /// @dev Everybody can call this function. The code executed only reads from Ethereum.
    /// @param _addressAsset is the address to obtain the owner from it.
    /// @return owner of the token bound to the asset that generates _addressAsset.
    function ownerOfFromBCA(address _addressAsset) external view returns (address);
    
    /// @notice This function lets know the user of the token from its tokenId.
    /// @dev Everybody can call this function. The code executed only reads from Ethereum.
    /// @param _tokenId is the tokenId of the EIP-4519 NFT tied to the asset.
    /// @return user of the token from its _tokenId.
    function userOf(uint256 _tokenId) external view returns (address);
    
    /// @notice This function lets know the user of the token from the address of the asset tied to the token.
    /// @dev Everybody can call this function. The code executed only reads from Ethereum.
    /// @param _addressAsset is the address to obtain the user from it.
    /// @return user of the token tied to the asset that generates _addressAsset.
    function userOfFromBCA(address _addressAsset) external view returns (address);
    
    /// @notice This function lets know how many tokens are assigned to a user.
    /// @dev Everybody can call this function. The code executed only reads from Ethereum.
    /// @param _addressUser is the address of the user.
    /// @return number of tokens assigned to a user.
    function userBalanceOf(address _addressUser) external view returns (uint256);
    
    /// @notice This function lets know how many tokens of a particular owner are assigned to a user.
    /// @dev Everybody can call this function. The code executed only reads from Ethereum.
    /// @param _addressUser is the address of the user.
    /// @param _addressOwner is the address of the owner.
    /// @return number of tokens assigned to a user from an owner.
    function userBalanceOfAnOwner(address _addressUser, address _addressOwner) external view returns (uint256);
}
```
 
## Rationale

### Authentication

This EIP uses smart contracts to verify the mutual authentication process since smart contracts are trustless.

### Tie Time

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.

When the asset calls `updateTimestamp`, the smart contract must call `block.timestamp`, which provides current block timestamp as seconds since Unix epoch. For this reason, `timeout`  must be provided in seconds.

### EIP-721-based

[EIP-721](./eip-721.md) is the most commonly-used standard for generic NFTs. This EIP extends EIP-721 for backwards compatibility.
  
## Backwards Compatibility

This standard is an extension of EIP-721. It is fully compatible with both of the commonly used optional extensions (`IERC721Metadata` and `IERC721Enumerable`) mentioned in the EIP-721 standard.

## Test Cases

The test cases presented in the paper shown below are available [here](../assets/eip-4519/PoC_SmartNFT/README.md).

## Reference Implementation

A first version was presented in a paper of the Special Issue **Security, Trust and Privacy in New Computing Environments** of **Sensors** journal of **MDPI** editorial. The paper, entitled [Secure Combination of IoT and Blockchain by Physically Binding IoT Devices to Smart Non-Fungible Tokens Using PUFs](../assets/eip-4519/sensors-21-03119.pdf), was written by the same authors of this EIP.

## Security Considerations

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&apos;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.  

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 03 Dec 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4519</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4519</guid>
      </item>
    
      <item>
        <title>721/20-compatible transfer</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4521-721-20-compatible-transfer/7903</comments>
        
        <description>## Abstract
ERC-721, the popular standard for non-fungible tokens (NFTs), includes send functions, such as `transferFrom()` and `safeTransferFrom()`, but does not include a backwards-compatible `transfer()` found in fungible ERC-20 tokens. This standard provides references to add such a `transfer()`.

## Motivation
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 `transfer()`. 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 `transfer()` to both handle ERC-20 and NFTs.

## Specification
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.

The interface for ERC-4521 `transfer()` MUST conform to ERC-20 and resulting transfers MUST fire the `Transfer` event as described in ERC-721.

```sol
function transfer(address to, uint256 tokenId) external returns (bool success);
```

## Rationale
Replicating ERC-20 `transfer()` with just a minor change to accurately reflect that a unique `tokenId` rather than fungible sum is being sent is desirable for code simplicity and to make integration easier.

## Backwards Compatibility
This EIP does not introduce any known backward compatibility issues.

## Reference Implementation
A reference implementation of an ERC-4521 `transfer()`:

```sol
function transfer(address to, uint256 tokenId) public virtual returns (bool success) {
        require(msg.sender == ownerOf[tokenId], &quot;NOT_OWNER&quot;);

        unchecked {
            balanceOf[msg.sender]--; 
        
            balanceOf[to]++;
        }
        
        delete getApproved[tokenId];
        
        ownerOf[tokenId] = to;
        
        emit Transfer(msg.sender, to, tokenId); 
        
        success = true;
}
```

## Security Considerations
Implementers must be sure to include the relevant return `bool` value for an ERC-4521 in order to conform with existing contracts that use ERC-20 interfaces, otherwise, NFTs may be locked unless a `safeTransfer` is used in such contracts.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 13 Dec 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4521</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4521</guid>
      </item>
    
      <item>
        <title>Safer ERC-20</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/why-isnt-there-an-erc-for-safetransfer-for-erc20/7604</comments>
        
        <description>## Abstract

This standard extends [ERC-20](./eip-20.md) tokens with [EIP-165](./eip-165.md), and adds familiar functions from [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md) ensuring receiving contracts have implemented proper functionality.

## Motivation

[EIP-165](./eip-165.md) 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, [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md). In addition, EIP-165 is a valuable building block for extensions on popular standards to signal implementation, a trend we&apos;ve seen in a number of NFT extensions. This EIP aims to bring these innovations back to ERC-20.

The importance of [EIP-165](./eip-165.md) 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 [ERC-2612](./eip-2612.md) 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 `supportsInterface` to see if the `interfaceId` 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 [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md) standards integrating EIP-165. Our hope is that this extension to ERC-20 would also help future extensions by making them easier to integrate.

## Specification
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.

In order to be compliant with this EIP, and ERC-20-compliant contract MUST also implement the following functions:
```solidity
pragma solidity 0.8.10;

import &apos;./IERC20.sol&apos;;
import &apos;./IERC165.sol&apos;;

// the EIP-165 interfaceId for this interface is 0x534f5876

interface SaferERC-20 is IERC20, IERC165 {
  function safeTransfer(address to, uint256 amount) external returns(bool);
  function safeTransfer(address to, uint256 amount, bytes memory data) external returns(bool);
  function safeTransferFrom(address from, address to, uint256 amount) external returns(bool);
  function safeTransferFrom(address from, address to, uint256 amount, bytes memory data) external returns(bool);
}
```
`safeTransfer` and `safeTransferFrom` MUST transfer as expected to EOA addresses, and to contracts implementing `ERC20Receiver` and returning the function selector (`0x4fc35859`) when called, and MUST revert when transferring to a contract which either does not have `ERC20Receiver` implemented, or does not return the function selector when called.

In addition, a contract accepting safe transfers MUST implement the following if it wishes to accept safe transfers, and MUST return the function selector (`0x4fc35859`):
```solidity
pragma solidity 0.8.10;

import &apos;./IERC165.sol&apos;;

interface ERC20Receiver is IERC165 {
  function onERC20Received(
    address _operator,
    address _from,
    uint256 _amount,
    bytes _data
  ) external returns(bytes4);
}
```

## Rationale

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 `safeTransfer` and `safeTransferFrom` 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.

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 [EIP-1046](./eip-1046.md).

## Backwards Compatibility

There are no issues with backwards compatibility in this EIP, as the full suite of ERC-20 functions is unchanged.

## Test Cases
Test cases have been provided in the implementation repo [here](https://github.com/wschwab/SaferERC-20/blob/main/src/SaferERC-20.t.sol).

## Reference Implementation
A sample repo demonstrating an implementation of this EIP has been created [here](https://github.com/wschwab/SaferERC-20). It is (as of this writing) in a Dapptools environment, for details on installing and running Dapptools see the Dapptools repo.

## Security Considerations

`onERC20Received`  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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 05 Dec 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4524</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4524</guid>
      </item>
    
      <item>
        <title>QR Code transmission protocol for wallets</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/add-qr-code-scanning-between-software-wallet-cold-signer-hardware-wallet/6568</comments>
        
        <description>## Abstract

The purpose of this EIP is to provide a process and data transmission protocol via QR Code between offline signers and watch-only wallets.

## Motivation

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:

- 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.
- 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.
- 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.
- A smaller attack surface: USB and Bluetooth have a bigger attack surface than QR-Codes.

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.

## Specification

**Offline signer**: An offline signer is a device or application which holds the user’s private keys and does not have network access.

**Watch-only wallet**: A watch-only wallet is a wallet that has network access and can interact with the Ethereum blockchain.

### Process

In order to work with offline signers, the watch-only wallet should follow the following process.

1. The offline signer provides the public key information to the watch-only wallet to generate addresses, sync balances and etc via QR Codes.
2. 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.
3. The offline signer signs the data and provides a signature back to the watch-only wallet via QR Code.
4. The watch-only wallet receives the signature, constructs the signed data (transaction) and performs the following activities like broadcasting the transaction etc.

### Data Transmission Protocol

Since a single QR Code can only contain a limited amount of data, animated QR Codes should be utilized for data transmission. The `BlockchainCommons` 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. 

`Concise Binary Object Representation(CBOR)` will be used for binary data encoding. `Concise Data Definition Language(CDDL)` will be used for expressing the CBOR.

### Setting up the watch-only wallet with the offline signer

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.

In such a case, offline signers should provide the extended public keys and derivation path. The UR Type called `crypto-hdkey` will be used to encode this data and the derivation path will be encoded as `crypto-keypath`.

 
#### CDDL for Key Path

The `crypto-keypath` will be used to specify the key path.The following specification is written in Concise Data Definition Language(CDDL) for `crypto-key-path`

``` 
; Metadata for the derivation path of a key.
;
; `source-fingerprint`, if present, is the fingerprint of the
; ancestor key from which the associated key was derived.
;
; If `components` is empty, then `source-fingerprint` MUST be a fingerprint of
; a master key.
;
; `depth`, if present, represents the number of derivation steps in
; the path of the associated key, even if not present in the `components` element
; of this structure.
    crypto-keypath = {
        components: [path-component], ; If empty, source-fingerprint MUST be present
        ? source-fingerprint: uint32 .ne 0 ; fingerprint of ancestor key, or master key if components is empty
        ? depth: uint8 ; 0 if this is a public key derived directly from a master key
    }
    path-component = (
        child-index / child-index-range / child-index-wildcard-range,
        is-hardened
    )
    uint32 = uint .size 4
    uint31 = uint32 .lt 2147483648 ;0x80000000
    child-index = uint31
    child-index-range = [child-index, child-index] ; [low, high] where low &lt; high
    child-index-wildcard = []
    is-hardened = bool
    components = 1
    source-fingerprint = 2
    depth = 3
```

#### CDDL for Extended Public Keys

Since the purpose is to transfer public key data, the definition of `crypto-hdkey` will be kept only for public key usage purposes.

The following specification is written in Concise Data Definition Language `CDDL` and includes the crypto-keypath spec above.

```
; An hd-key must be a derived key.
hd-key = {
    derived-key
}
; A derived key must be public, has an optional chain code, and
; may carry additional metadata about its use and derivation.
; To maintain isomorphism with [BIP32] and allow keys to be derived from
; this key `chain-code`, `origin`, and `parent-fingerprint` must be present.
; If `origin` contains only a single derivation step and also contains `source-fingerprint`,
; then `parent-fingerprint` MUST be identical to `source-fingerprint` or may be omitted.
derived-key = (
    key-data: key-data-bytes,
    ? chain-code: chain-code-bytes       ; omit if no further keys may be derived from this key
    ? origin: #6.304(crypto-keypath),    ; How the key was derived
    ? name: text,                        ; A short name for this key.
    ? source: text,                      ; The device info or any other description for this key
)
key-data = 3
chain-code = 4
origin = 6
name = 9
source = 10

uint8 = uint .size 1
key-data-bytes = bytes .size 33
chain-code-bytes = bytes .size 32
```

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.

If the signer would like to provide multiple public keys instead of the extended public key for any reason, the signer can use `crypto-account` for that.

### Sending the unsigned data from the watch-only wallet to the offline signer

To send the unsigned data from a watch-only wallet to an offline signer, the new UR type `eth-sign-request` will be introduced to encode the signing request.

#### CDDL for Eth Sign Request.

The following specification is written in Concise Data Definition Language `CDDL`.
UUIDs in this specification notated UUID are CBOR binary strings tagged with #6.37, per the IANA `CBOR Tags Registry`.

```
; Metadata for the signing request for Ethereum.
; 
sign-data-type = {
    type: int .default 1 transaction data; the unsigned data type
}

eth-transaction-data = 1; legacy transaction rlp encoding of unsigned transaction data
eth-typed-data = 2; EIP-712 typed signing data
eth-raw-bytes=3;   for signing message usage, like EIP-191 personal_sign data
eth-typed-transaction=4; EIP-2718 typed transaction of unsigned transaction data

; Metadata for the signing request for Ethereum.
; request-id: the identifier for this signing request.
; sign-data: the unsigned data
; data-type: see sign-data-type definition
; chain-id: chain id definition see https://github.com/ethereum-lists/chains for detail
; derivation-path: the key path of the private key to sign the data
; address: Ethereum address of the signing type for verification purposes which is optional

eth-sign-request = (
    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
    data-type: #3.401(sign-data-type),
    chain-id: int .default 1,
    derivation-path: #5.304(crypto-keypath), ;the key path for signing this request
    ?request-id: uuid, ; the uuid for this signing request
    ?address: eth-address-bytes,            ;verification purpose for the address of the signing key
    ?origin: text  ;the origin of this sign request, like wallet name
)
request-id = 1
sign-data = 2
data-type = 3
chain-id = 4 ;it will be the chain id of ethereum related blockchain
derivation-path = 5
address = 6
origin = 7
eth-address-bytes = bytes .size 20
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.
```

### The signature provided by offline signers to watch-only wallets

After the data is signed, the offline signer should send the signature back to the watch-only wallet. The new UR type called `eth-signature` is introduced here to encode this data.

#### CDDL for Eth Signature.

The following specification is written in Concise Data Definition Language `CDDL`.

```
eth-signature  = (
    request-id: uuid,
    signature: eth-signature-bytes,
    ? origin: text, ; The device info for providing this signature
)

request-id = 1
signature = 2
origin = 3

eth-signature-bytes = bytes .size 65; the signature of the signing request (r,s,v)
```

## Rationale

This EIP uses some existing UR types like `crypto-keypath` and `crypto-hdkey` and also introduces some new UR types like `eth-sign-request` and `eth-signature`. Here are the reasons we choose UR for the QR Code data transmission protocol:

### UR provides a solid foundation for QR Code data transmission

- Uses the alphanumeric QR code mode for efficiency.
- 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.
- uses `Fountain Code` 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.

### UR provides existing helpful types and scalability for new usages

Currently, UR has provided some existing types like `crypto-keypath` and `crypto-hdkey` so it is quite easy to add a new type and definitions for new usages.

### UR has an active air-gapped wallet community.

Currently, the UR has an active `airgapped wallet community` which continues to improve the UR forward.

## Backwards Compatibility

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.

## Test Cases

The test cases can be found on the `ur-registry-eth` package released by the Keystone team.

## Reference Implementation

The reference implementation can be found on the `ur-registry-eth` package released by the Keystone team.

## Security Considerations

The offline signer should decode all the data from `eth-sign-request` and show them to the user for confirmation prior to signing. It is recommended to provide an address field in the `eth-sign-request`. If provided, the offline signer should verify the address being the same one as the address associated with the signing key.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 07 Dec 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4527</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4527</guid>
      </item>
    
      <item>
        <title>Wrapped Deposits</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/wrapped-deposit-contract-eip/7740</comments>
        
        <description>## Abstract
The wrapped deposit contract handles deposits of assets (Ether, [ERC-20](./eip-20.md), [ERC-721](./eip-721.md)) 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.

## Motivation
The current user flow for depositing assets in dapps is unnecessarily expensive and insecure. To deposit an ERC-20 asset a user must either:

  - send an approve transaction for the exact amount being sent, before making a deposit, and then repeat this process for every subsequent deposit.
  - send an approve transaction for an infinite spend amount before making deposits.

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 _every_ dapp that supports ERC20 deposits.

## Specification
The wrapped deposit contract SHOULD be deployed at an identifiable address (e.g. `0x1111119a9e30bceadf9f939390293ffacef93fe9`). The contract MUST be non-upgradable with no ability for state variables to be changed.

The wrapped deposit contract MUST have the following public functions:

```js
depositERC20(address to, address token, uint amount) external;
depositERC721(address to, address token, uint tokenId) external;
safeDepositERC721(address to, address token, uint tokenId, bytes memory data) external;
safeDepositERC1155(address to, address token, uint tokenId, uint value, bytes calldata data) external;
batchDepositERC1155(address to, address token, uint[] calldata tokenIds, uint[] calldata values, bytes calldata data) external;
depositEther(address to) external payable;
```

Each of these functions MUST revert if `to` is an address with a zero code size. Each function MUST attempt to call a method on the `to` 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.

The following interfaces SHOULD exist for contracts wishing to accept deposits:

```ts
interface ERC20Receiver {
  function acceptERC20Deposit(address depositor, address token, uint amount) external returns (bool);
}

interface ERC721Receiver {
  function acceptERC721Deposit(address depositor, address token, uint tokenId) external returns (bool);
}

interface ERC1155Receiver {
  function acceptERC1155Deposit(address depositor, address token, uint tokenId, uint value, bytes calldata data) external returns (bool);
  function acceptERC1155BatchDeposit(address depositor, address token, uint[] calldata tokenIds, uint[] calldata values, bytes calldata data) external returns (bool);
}

interface EtherReceiver {
  function acceptEtherDeposit(address depositor, uint amount) external returns (bool);
}
```

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.

## Rationale
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.

User experience is improved because a simple global dapp can be implemented with the messaging: &quot;enable token for use in other apps&quot;.

## Backwards Compatibility

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.

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.

## Reference Implementation
```ts
pragma solidity ^0.7.0;

interface ERC20Receiver {
  function acceptERC20Deposit(address depositor, address token, uint amount) external returns (bool);
}

interface ERC721Receiver {
  function acceptERC721Deposit(address depositor, address token, uint tokenId) external returns (bool);
}

interface ERC1155Receiver {
  function acceptERC1155Deposit(address depositor, address token, uint tokenId, uint value, bytes calldata data) external returns (bool);
  function acceptERC1155BatchDeposit(address depositor, address token, uint[] calldata tokenIds, uint[] calldata values, bytes calldata data) external returns (bool);
}

interface EtherReceiver {
  function acceptEtherDeposit(address depositor, uint amount) external returns (bool);
}

interface IERC20 {
  function transferFrom(address sender, address recipient, uint amount) external returns (bool);
}

interface IERC721 {
  function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
  function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory data) external payable;
}

interface IERC1155 {
  function safeTransferFrom(address _from, address _to, uint _id, uint _value, bytes calldata _data) external;
  function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;
}

contract WrappedDeposit {
  function depositERC20(address to, address token, uint amount) public {
    _assertContract(to);
    require(ERC20Receiver(to).acceptERC20Deposit(msg.sender, token, amount));
    bytes memory data = abi.encodeWithSelector(
      IERC20(token).transferFrom.selector,
      msg.sender,
      to,
      amount
    );
    (bool success, bytes memory returndata) = token.call(data);
    require(success);
    // backward compat for tokens incorrectly implementing the transfer function
    if (returndata.length &gt; 0) {
      require(abi.decode(returndata, (bool)), &quot;ERC20 operation did not succeed&quot;);
    }
  }

  function depositERC721(address to, address token, uint tokenId) public {
    _assertContract(to);
    require(ERC721Receiver(to).acceptERC721Deposit(msg.sender, token, tokenId));
    IERC721(token).transferFrom(msg.sender, to, tokenId);
  }

  function safeDepositERC721(address to, address token, uint tokenId, bytes memory data) public {
    _assertContract(to);
    require(ERC721Receiver(to).acceptERC721Deposit(msg.sender, token, tokenId));
    IERC721(token).safeTransferFrom(msg.sender, to, tokenId, data);
  }

  function safeDepositERC1155(address to, address token, uint tokenId, uint value, bytes calldata data) public {
    _assertContract(to);
    require(ERC1155Receiver(to).acceptERC1155Deposit(msg.sender, to, tokenId, value, data));
    IERC1155(token).safeTransferFrom(msg.sender, to, tokenId, value, data);
  }

  function batchDepositERC1155(address to, address token, uint[] calldata tokenIds, uint[] calldata values, bytes calldata data) public {
    _assertContract(to);
    require(ERC1155Receiver(to).acceptERC1155BatchDeposit(msg.sender, to, tokenIds, values, data));
    IERC1155(token).safeBatchTransferFrom(msg.sender, to, tokenIds, values, data);
  }

  function depositEther(address to) public payable {
    _assertContract(to);
    require(EtherReceiver(to).acceptEtherDeposit(msg.sender, msg.value));
    (bool success, ) = to.call{value: msg.value}(&apos;&apos;);
    require(success, &quot;nonpayable&quot;);
  }

  function _assertContract(address c) private view {
    uint size;
    assembly {
      size := extcodesize(c)
    }
    require(size &gt; 0, &quot;noncontract&quot;);
  }
}
```
## Security Considerations
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.

Receiving contracts MUST verify that `msg.sender` is equal to the wrapped deposit contract. Failing to do so allows anyone to simulate deposits.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 11 Dec 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4546</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4546</guid>
      </item>
    
      <item>
        <title>Tokenized Vaults</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4626-yield-bearing-vault-standard/7900</comments>
        
        <description>## Abstract

The following standard allows for the implementation of a standard API for tokenized Vaults
representing shares of a single underlying [EIP-20](./eip-20.md) token.
This standard is an extension on the EIP-20 token that provides basic functionality for depositing
and withdrawing tokens and reading balances.

## Motivation

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.

A standard for tokenized Vaults will lower the integration effort for yield-bearing vaults, while creating more consistent and robust implementation patterns.

## Specification

All [EIP-4626](./eip-4626.md) tokenized Vaults MUST implement EIP-20 to represent shares.
If a Vault is to be non-transferrable, it MAY revert on calls to `transfer` or `transferFrom`.
The EIP-20 operations `balanceOf`, `transfer`, `totalSupply`, etc. operate on the Vault &quot;shares&quot;
which represent a claim to ownership on a fraction of the Vault&apos;s underlying holdings.

All EIP-4626 tokenized Vaults MUST implement EIP-20&apos;s optional metadata extensions.
The `name` and `symbol` functions SHOULD reflect the underlying token&apos;s `name` and `symbol` in some way.

EIP-4626 tokenized Vaults MAY implement [EIP-2612](./eip-2612.md) to improve the UX of approving shares on various integrations.

### Definitions:

- asset: The underlying token managed by the Vault.
  Has units defined by the corresponding EIP-20 contract.
- share: The token of the Vault. Has a ratio of underlying assets
  exchanged on mint/deposit/withdraw/redeem (as defined by the Vault).
- 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.
- slippage: Any difference between advertised share price and economic realities of
  deposit to or withdrawal from the Vault, which is not accounted by fees.

### Methods

#### asset

The address of the underlying token used for the Vault for accounting, depositing, and withdrawing.

MUST be an EIP-20 token contract.

MUST _NOT_ revert.

```yaml
- name: asset
  type: function
  stateMutability: view

  inputs: []

  outputs:
    - name: assetTokenAddress
      type: address
```

#### totalAssets

Total amount of the underlying asset that is &quot;managed&quot; by Vault.

SHOULD include any compounding that occurs from yield.

MUST be inclusive of any fees that are charged against assets in the Vault.

MUST _NOT_ revert.

```yaml
- name: totalAssets
  type: function
  stateMutability: view

  inputs: []

  outputs:
    - name: totalManagedAssets
      type: uint256
```

#### convertToShares

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.

MUST NOT be inclusive of any fees that are charged against assets in the Vault.

MUST NOT show any variations depending on the caller.

MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.

MUST NOT revert unless due to integer overflow caused by an unreasonably large input.

MUST round down towards 0.

This calculation MAY NOT reflect the &quot;per-user&quot; price-per-share, and instead should reflect the &quot;average-user&apos;s&quot; price-per-share, meaning what the average user should expect to see when exchanging to and from.

```yaml
- name: convertToShares
  type: function
  stateMutability: view

  inputs:
    - name: assets
      type: uint256

  outputs:
    - name: shares
      type: uint256
```

#### convertToAssets

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.

MUST NOT be inclusive of any fees that are charged against assets in the Vault.

MUST NOT show any variations depending on the caller.

MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.

MUST NOT revert unless due to integer overflow caused by an unreasonably large input.

MUST round down towards 0.

This calculation MAY NOT reflect the &quot;per-user&quot; price-per-share, and instead should reflect the &quot;average-user&apos;s&quot; price-per-share, meaning what the average user should expect to see when exchanging to and from.

```yaml
- name: convertToAssets
  type: function
  stateMutability: view

  inputs:
    - name: shares
      type: uint256

  outputs:
    - name: assets
      type: uint256
```

#### maxDeposit

Maximum amount of the underlying asset that can be deposited into the Vault for the `receiver`, through a `deposit` call.

MUST return the maximum amount of assets `deposit` would allow to be deposited for `receiver` 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 `balanceOf` of `asset`.

MUST factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.

MUST return `2 ** 256 - 1` if there is no limit on the maximum amount of assets that may be deposited.

MUST NOT revert.

```yaml
- name: maxDeposit
  type: function
  stateMutability: view

  inputs:
    - name: receiver
      type: address

  outputs:
    - name: maxAssets
      type: uint256
```

#### previewDeposit

Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given current on-chain conditions.

MUST return as close to and no more than the exact amount of Vault shares that would be minted in a `deposit` call in the same transaction. I.e. `deposit` should return the same or more `shares` as `previewDeposit` if called in the same transaction.

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.

MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.

MUST NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause `deposit` to revert.

Note that any unfavorable discrepancy between `convertToShares` and `previewDeposit` SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing.

```yaml
- name: previewDeposit
  type: function
  stateMutability: view

  inputs:
    - name: assets
      type: uint256

  outputs:
    - name: shares
      type: uint256
```

#### deposit

Mints `shares` Vault shares to `receiver` by depositing exactly `assets` of underlying tokens.

MUST emit the `Deposit` event.

MUST support EIP-20 `approve` / `transferFrom` on `asset` as a deposit flow.
MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the `deposit` execution, and are accounted for during `deposit`.

MUST revert if all of `assets` cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).

Note that most implementations will require pre-approval of the Vault with the Vault&apos;s underlying `asset` token.

```yaml
- name: deposit
  type: function
  stateMutability: nonpayable

  inputs:
    - name: assets
      type: uint256
    - name: receiver
      type: address

  outputs:
    - name: shares
      type: uint256
```

#### maxMint

Maximum amount of shares that can be minted from the Vault for the `receiver`, through a `mint` call.

MUST return the maximum amount of shares `mint` would allow to be deposited to `receiver` 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 `balanceOf` of `asset`.

MUST factor in both global and user-specific limits, like if mints are entirely disabled (even temporarily) it MUST return 0.

MUST return `2 ** 256 - 1` if there is no limit on the maximum amount of shares that may be minted.

MUST NOT revert.

```yaml
- name: maxMint
  type: function
  stateMutability: view

  inputs:
    - name: receiver
      type: address

  outputs:
    - name: maxShares
      type: uint256
```

#### previewMint

Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given current on-chain conditions.

MUST return as close to and no fewer than the exact amount of assets that would be deposited in a `mint` call in the same transaction. I.e. `mint` should return the same or fewer `assets` as `previewMint` if called in the same transaction.

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.

MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.

MUST NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause `mint` to revert.

Note that any unfavorable discrepancy between `convertToAssets` and `previewMint` SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by minting.

```yaml
- name: previewMint
  type: function
  stateMutability: view

  inputs:
    - name: shares
      type: uint256

  outputs:
    - name: assets
      type: uint256
```

#### mint

Mints exactly `shares` Vault shares to `receiver` by depositing `assets` of underlying tokens.

MUST emit the `Deposit` event.

MUST support EIP-20 `approve` / `transferFrom` on `asset` as a mint flow.
MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the `mint` execution, and are accounted for during `mint`.

MUST revert if all of `shares` cannot be minted (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc).

Note that most implementations will require pre-approval of the Vault with the Vault&apos;s underlying `asset` token.

```yaml
- name: mint
  type: function
  stateMutability: nonpayable

  inputs:
    - name: shares
      type: uint256
    - name: receiver
      type: address

  outputs:
    - name: assets
      type: uint256
```

#### maxWithdraw

Maximum amount of the underlying asset that can be withdrawn from the `owner` balance in the Vault, through a `withdraw` call.

MUST return the maximum amount of assets that could be transferred from `owner` through `withdraw` and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).

MUST factor in both global and user-specific limits, like if withdrawals are entirely disabled (even temporarily) it MUST return 0.

MUST NOT revert.

```yaml
- name: maxWithdraw
  type: function
  stateMutability: view

  inputs:
    - name: owner
      type: address

  outputs:
    - name: maxAssets
      type: uint256
```

#### previewWithdraw

Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, given current on-chain conditions.

MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a `withdraw` call in the same transaction. I.e. `withdraw` should return the same or fewer `shares` as `previewWithdraw` if called in the same transaction.

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.

MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.

MUST NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause `withdraw` to revert.

Note that any unfavorable discrepancy between `convertToShares` and `previewWithdraw` SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by depositing.

```yaml
- name: previewWithdraw
  type: function
  stateMutability: view

  inputs:
    - name: assets
      type: uint256

  outputs:
    - name: shares
      type: uint256
```

#### withdraw

Burns `shares` from `owner` and sends exactly `assets` of underlying tokens to `receiver`.

MUST emit the `Withdraw` event.

MUST support a withdraw flow where the shares are burned from `owner` directly where `owner` is `msg.sender`.

MUST support a withdraw flow where the shares are burned from `owner` directly where `msg.sender` has EIP-20 approval over the shares of `owner`.

MAY support an additional flow in which the shares are transferred to the Vault contract before the `withdraw` execution, and are accounted for during `withdraw`.

SHOULD check `msg.sender` can spend owner funds, assets needs to be converted to shares and shares should be checked for allowance.

MUST revert if all of `assets` cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).

Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.

```yaml
- name: withdraw
  type: function
  stateMutability: nonpayable

  inputs:
    - name: assets
      type: uint256
    - name: receiver
      type: address
    - name: owner
      type: address

  outputs:
    - name: shares
      type: uint256
```

#### maxRedeem

Maximum amount of Vault shares that can be redeemed from the `owner` balance in the Vault, through a `redeem` call.

MUST return the maximum amount of shares that could be transferred from `owner` through `redeem` and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).

MUST factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0.

MUST NOT revert.

```yaml
- name: maxRedeem
  type: function
  stateMutability: view

  inputs:
    - name: owner
      type: address

  outputs:
    - name: maxShares
      type: uint256
```

#### previewRedeem

Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, given current on-chain conditions.

MUST return as close to and no more than the exact amount of assets that would be withdrawn in a `redeem` call in the same transaction. I.e. `redeem` should return the same or more `assets` as `previewRedeem` if called in the same transaction.

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.

MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.

MUST NOT revert due to vault specific user/global limits. MAY revert due to other conditions that would also cause `redeem` to revert.

Note that any unfavorable discrepancy between `convertToAssets` and `previewRedeem` SHOULD be considered slippage in share price or some other type of condition, meaning the depositor will lose assets by redeeming.

```yaml
- name: previewRedeem
  type: function
  stateMutability: view

  inputs:
    - name: shares
      type: uint256

  outputs:
    - name: assets
      type: uint256
```

#### redeem

Burns exactly `shares` from `owner` and sends `assets` of underlying tokens to `receiver`.

MUST emit the `Withdraw` event.

MUST support a redeem flow where the shares are burned from `owner` directly where `owner` is `msg.sender`.

MUST support a redeem flow where the shares are burned from `owner` directly where `msg.sender` has EIP-20 approval over the shares of `owner`.

MAY support an additional flow in which the shares are transferred to the Vault contract before the `redeem` execution, and are accounted for during `redeem`.

SHOULD check `msg.sender` can spend owner funds using allowance.

MUST revert if all of `shares` cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).

Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.

```yaml
- name: redeem
  type: function
  stateMutability: nonpayable

  inputs:
    - name: shares
      type: uint256
    - name: receiver
      type: address
    - name: owner
      type: address

  outputs:
    - name: assets
      type: uint256
```

### Events

#### Deposit

`sender` has exchanged `assets` for `shares`, and transferred those `shares` to `owner`.

MUST be emitted when tokens are deposited into the Vault via the `mint` and `deposit` methods.

```yaml
- name: Deposit
  type: event

  inputs:
    - name: sender
      indexed: true
      type: address
    - name: owner
      indexed: true
      type: address
    - name: assets
      indexed: false
      type: uint256
    - name: shares
      indexed: false
      type: uint256
```

#### Withdraw

`sender` has exchanged `shares`, owned by `owner`, for `assets`, and transferred those `assets` to `receiver`.

MUST be emitted when shares are withdrawn from the Vault in `EIP-4626.redeem` or `EIP-4626.withdraw` methods.

```yaml
- name: Withdraw
  type: event

  inputs:
    - name: sender
      indexed: true
      type: address
    - name: receiver
      indexed: true
      type: address
    - name: owner
      indexed: true
      type: address
    - name: assets
      indexed: false
      type: uint256
    - name: shares
      indexed: false
      type: uint256
```

## Rationale

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.

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.

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 (`mint`) rather than specific amount of underlying (`deposit`).
However, it is easy to imagine future Vault strategies which would have unique and independently useful share representations.

The `convertTo` 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 `preview` function to match each mutable function. These functions must not account for deposit or withdrawal limits, to ensure they are easily composable, the `max` functions are provided for that purpose.

## Backwards Compatibility

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.

## Reference Implementation

See [Solmate EIP-4626](https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC4626.sol):
a minimal and opinionated implementation of the standard with hooks for developers to easily insert custom logic into deposits and withdrawals.

See [Vyper EIP-4626](https://github.com/fubuloubu/ERC4626):
a demo implementation of the standard in Vyper, with hooks for share price manipulation and other testing needs.

## Security Considerations

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.

If implementors intend to support EOA account access directly, they should consider adding an additional function call for `deposit`/`mint`/`withdraw`/`redeem` with the means to accommodate slippage loss or unexpected deposit/withdrawal limits, since they have no other means to revert the transaction if the exact output amount is not achieved.

The methods `totalAssets`, `convertToShares` and `convertToAssets` are estimates useful for display purposes,
and do _not_ have to confer the _exact_ amount of underlying assets their context suggests.

The `preview` 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 `convert` 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 `convert` methods as using a time-weighted average price in converting between assets and shares.

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 (`previewRedeem`) can be significantly different than the amount that would be taken from them when minting the same quantity of shares (`previewMint`). 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.

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:

- If (1) it&apos;s calculating how many shares to issue to a user for a certain amount of the underlying tokens they provide or (2) it&apos;s determining the amount of the underlying tokens to transfer to them for returning a certain amount of shares, it should round _down_.

- If (1) it&apos;s calculating the amount of shares a user has to supply to receive a given amount of the underlying tokens or (2) it&apos;s calculating the amount of underlying tokens a user has to provide to receive a certain amount of shares, it should round _up_.

The only functions where the preferred rounding direction would be ambiguous are the `convertTo` functions. To ensure consistency across all EIP-4626 Vault implementations it is specified that these functions MUST both always round _down_. Integrators may wish to mimic rounding up versions of these functions themselves, like by adding 1 wei to the result.

Although the `convertTo` functions should eliminate the need for any use of an EIP-4626 Vault&apos;s `decimals` variable, it is still strongly recommended to mirror
the underlying token&apos;s `decimals` if at all possible, to eliminate possible sources of confusion and simplify integration across front-ends and for other off-chain users.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 22 Dec 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4626</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4626</guid>
      </item>
    
      <item>
        <title>Non-Tradable Tokens Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4671-non-tradable-token/7976</comments>
        
        <description>## Abstract

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.

As the name implies, non-tradable tokens are made to not be traded or transferred, they are &quot;soulbound&quot;. They don&apos;t have monetary value, they are personally delivered to **you**, and they only serve as a **proof of possession/achievement**.

In other words, the possession of a token carries a strong meaning in itself depending on **why** it was delivered.

## Motivation

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 **non-tradable**.

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.

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.

## Specification

### Non-Tradable Token

A NTT contract is seen as representing **one type of certificate** delivered by **one authority**. For instance, one NTT contract for the French National Id, another for Ethereum EIP creators, and so on...

* An address might possess multiple tokens. Each token has a unique identifier: `tokenId`.
* 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.
* The most typical usage for third-parties will be to verify if a user has a valid token in a given contract.

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;./IERC165.sol&quot;;

interface IERC4671 is IERC165 {
    /// Event emitted when a token `tokenId` is minted for `owner`
    event Minted(address owner, uint256 tokenId);

    /// Event emitted when token `tokenId` of `owner` is revoked
    event Revoked(address owner, uint256 tokenId);

    /// @notice Count all tokens assigned to an owner
    /// @param owner Address for whom to query the balance
    /// @return Number of tokens owned by `owner`
    function balanceOf(address owner) external view returns (uint256);

    /// @notice Get owner of a token
    /// @param tokenId Identifier of the token
    /// @return Address of the owner of `tokenId`
    function ownerOf(uint256 tokenId) external view returns (address);

    /// @notice Check if a token hasn&apos;t been revoked
    /// @param tokenId Identifier of the token
    /// @return True if the token is valid, false otherwise
    function isValid(uint256 tokenId) external view returns (bool);

    /// @notice Check if an address owns a valid token in the contract
    /// @param owner Address for whom to check the ownership
    /// @return True if `owner` has a valid token, false otherwise
    function hasValid(address owner) external view returns (bool);
}
```

#### Extensions

##### Metadata

An interface allowing to add metadata linked to each token.

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;./IERC4671.sol&quot;;

interface IERC4671Metadata is IERC4671 {
    /// @return Descriptive name of the tokens in this contract
    function name() external view returns (string memory);

    /// @return An abbreviated name of the tokens in this contract
    function symbol() external view returns (string memory);

    /// @notice URI to query to get the token&apos;s metadata
    /// @param tokenId Identifier of the token
    /// @return URI for the token
    function tokenURI(uint256 tokenId) external view returns (string memory);
}
```

##### Enumerable

An interface allowing to enumerate the tokens of an owner.

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;./IERC4671.sol&quot;;

interface IERC4671Enumerable is IERC4671 {
    /// @return emittedCount Number of tokens emitted
    function emittedCount() external view returns (uint256);

    /// @return holdersCount Number of token holders  
    function holdersCount() external view returns (uint256);

    /// @notice Get the tokenId of a token using its position in the owner&apos;s list
    /// @param owner Address for whom to get the token
    /// @param index Index of the token
    /// @return tokenId of the token
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /// @notice Get a tokenId by it&apos;s index, where 0 &lt;= index &lt; total()
    /// @param index Index of the token
    /// @return tokenId of the token
    function tokenByIndex(uint256 index) external view returns (uint256);
}
```

##### Delegation

An interface allowing delegation rights of token minting.

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;./IERC4671.sol&quot;;

interface IERC4671Delegate is IERC4671 {
    /// @notice Grant one-time minting right to `operator` for `owner`
    /// An allowed operator can call the function to transfer rights.
    /// @param operator Address allowed to mint a token
    /// @param owner Address for whom `operator` is allowed to mint a token
    function delegate(address operator, address owner) external;

    /// @notice Grant one-time minting right to a list of `operators` for a corresponding list of `owners`
    /// An allowed operator can call the function to transfer rights.
    /// @param operators Addresses allowed to mint
    /// @param owners Addresses for whom `operators` are allowed to mint a token
    function delegateBatch(address[] memory operators, address[] memory owners) external;

    /// @notice Mint a token. Caller must have the right to mint for the owner.
    /// @param owner Address for whom the token is minted
    function mint(address owner) external;

    /// @notice Mint tokens to multiple addresses. Caller must have the right to mint for all owners.
    /// @param owners Addresses for whom the tokens are minted
    function mintBatch(address[] memory owners) external;

    /// @notice Get the issuer of a token
    /// @param tokenId Identifier of the token
    /// @return Address who minted `tokenId`
    function issuerOf(uint256 tokenId) external view returns (address);
}
```

##### Consensus

An interface allowing minting/revocation of tokens based on a consensus of a predefined set of addresses.

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;./IERC4671.sol&quot;;

interface IERC4671Consensus is IERC4671 {
    /// @notice Get voters addresses for this consensus contract
    /// @return Addresses of the voters
    function voters() external view returns (address[] memory);

    /// @notice Cast a vote to mint a token for a specific address
    /// @param owner Address for whom to mint the token
    function approveMint(address owner) external;

    /// @notice Cast a vote to revoke a specific token
    /// @param tokenId Identifier of the token to revoke
    function approveRevoke(uint256 tokenId) external;
}
```

##### Pull

An interface allowing a token owner to pull his token to a another of his wallets (here `recipient`). The caller must provide a signature of the tuple `(tokenId, owner, recipient)` using the `owner` wallet.

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;./IERC4671.sol&quot;;

interface IERC4671Pull is IERC4671 {
    /// @notice Pull a token from the owner wallet to the caller&apos;s wallet
    /// @param tokenId Identifier of the token to transfer
    /// @param owner Address that owns tokenId
    /// @param signature Signed data (tokenId, owner, recipient) by the owner of the token
    function pull(uint256 tokenId, address owner, bytes memory signature) external;
}
```

### NTT Store

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.

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;./IERC165.sol&quot;;

interface IERC4671Store is IERC165 {
    // Event emitted when a IERC4671Enumerable contract is added to the owner&apos;s records
    event Added(address owner, address token);

    // Event emitted when a IERC4671Enumerable contract is removed from the owner&apos;s records
    event Removed(address owner, address token);

    /// @notice Add a IERC4671Enumerable contract address to the caller&apos;s record
    /// @param token Address of the IERC4671Enumerable contract to add
    function add(address token) external;

    /// @notice Remove a IERC4671Enumerable contract from the caller&apos;s record
    /// @param token Address of the IERC4671Enumerable contract to remove
    function remove(address token) external;

    /// @notice Get all the IERC4671Enumerable contracts for a given owner
    /// @param owner Address for which to retrieve the IERC4671Enumerable contracts
    function get(address owner) external view returns (address[] memory);
}
```

## Rationale

### On-chain vs Off-chain

A decision was made to keep the data off-chain (via `tokenURI()`) for two main reasons: 
* 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.
* Non-tradable tokens must stay generic. There could have been a possibility to make a `MetadataStore` 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.

## Reference Implementation

You can find an implementation of this standard in [../assets/eip-4671](https://github.com/ethereum/EIPs/tree/master/assets/eip-4671).

Using this implementation, this is how you would create a token:

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import &quot;./ERC4671.sol&quot;;

contract EIPCreatorBadge is ERC4671 {
    constructor() ERC4671(&quot;EIP Creator Badge&quot;, &quot;EIP&quot;) {}

    function giveThatManABadge(address owner) external {
        require(_isCreator(), &quot;You must be the contract creator&quot;);
        _mint(owner);
    }

    function _baseURI() internal pure override returns (string memory) {
        return &quot;https://eips.ethereum.org/ntt/&quot;;
    }
}
```

This could be a contract managed by the Ethereum foundation and which allows them to deliver tokens to EIP creators.

## Security Considerations

One security aspect is related to the `tokenURI` 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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 13 Jan 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4671</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4671</guid>
      </item>
    
      <item>
        <title>Multi-Fractional Non-Fungible Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4675-multi-fractional-non-fungible-token-standard/8008</comments>
        
        <description>## Abstract
This standard outlines a smart contract interface eligible to represent any number of fractionalized non-fungible tokens. Existing projects utilizing standards like [EIP-1633](./eip-1633.md) conventionally deploy separate [EIP-20](./eip-20.md) 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.

This standard is approximate in terms of using `_id` for distinguishing token types. However, this ERC has a clear difference with [EIP-1155](./eip-1155.md) as each `_id` represents a distinct NFT.

## Motivation
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.

## Specification

```solidity
/**
    @title Multi-Fractional Non-Fungible Token Standard
    @dev Note : The ERC-165 identifier for this interface is 0x83f5d35f.
*/
interface IMFNFT {
    /**
        @dev This emits when ownership of any token changes by any mechanism.
        The `_from` argument MUST be the address of an account/contract sending the token.
        The `_to` argument MUST be the address of an account/contract receiving the token.
        The `_id` argument MUST be the token type being transferred. (represents NFT)
        The `_value` argument MUST be the number of tokens the holder balance is decrease by and match the recipient balance is increased by.
    */
    event Transfer(address indexed _from, address indexed _to, uint256 indexed _id, uint256 _value);

    /**
        @dev This emits when the approved address for token is changed or reaffirmed.
        The `_owner` argument MUST be the address of account/contract approving to withdraw.
        The `_spender` argument MUST be the address of account/contract approved to withdraw from the `_owner` balance.
        The `_id` argument MUST be the token type being transferred. (represents NFT)
        The `_value` argument MUST be the number of tokens the `_approved` is able to withdraw from `_owner` balance.
    */
    event Approval(address indexed _owner, address indexed _spender, uint256 indexed _id, uint256 _value);

    /**
        @dev This emits when new token type is added which represents the share of the Non-Fungible Token.
        The `_parentToken` argument MUST be the address of the Non-Fungible Token contract.
        The `_parentTokenId` argument MUST be the token ID of the Non-Fungible Token.
        The `_id` argument MUST be the token type being added. (represents NFT)
        The `_totalSupply` argument MUST be the number of total token supply of the token type.
    */
    event TokenAddition(address indexed _parentToken, uint256 indexed _parentTokenId, uint256 _id, uint256 _totalSupply);

    /**
        @notice Transfers `_value` amount of an `_id` from the msg.sender address to the `_to` address specified
        @dev msg.sender must have sufficient balance to handle the tokens being transferred out of the account.
        MUST revert if `_to` is the zero address.
        MUST revert if balance of msg.sender for token `_id` is lower than the `_value` being transferred.
        MUST revert on any other error.
        MUST emit the `Transfer` event to reflect the balance change.
        @param _to      Source address
        @param _id      ID of the token type
        @param _value   Transfer amount
        @return         True if transfer was successful, false if not
    */
    function transfer(address _to, uint256 _id, uint256 _value) external returns (bool);

    /**
        @notice Approves `_value` amount of an `_id` from the msg.sender to the `_spender` address specified.
        @dev msg.sender must have sufficient balance to handle the tokens when the `_spender` wants to transfer the token on behalf.
        MUST revert if `_spender` is the zero address.
        MUST revert on any other error.
        MUST emit the `Approval` event.
        @param _spender Spender address(account/contract which can withdraw token on behalf of msg.sender)
        @param _id      ID of the token type
        @param _value   Approval amount
        @return         True if approval was successful, false if not
    */
    function approve(address _spender, uint256 _id, uint256 _value) external returns (bool);

    /**
        @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified.
        @dev Caller must be approved to manage the tokens being transferred out of the `_from` account.
        MUST revert if `_to` is the zero address.
        MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
        MUST revert on any other error.
        MUST emit `Transfer` event to reflect the balance change.
        @param _from    Source address
        @param _to      Target Address
        @param _id      ID of the token type
        @param _value   Transfer amount
        @return         True if transfer was successful, false if not

    */
    function transferFrom(address _from, address _to, uint256 _id, uint256 _value) external returns (bool);

    /**
        @notice Sets the NFT as a new type token
        @dev The contract itself should verify if the ownership of NFT is belongs to this contract itself with the `_parentNFTContractAddress` &amp; `_parentNFTTokenId` before adding the token.
        MUST revert if the same NFT is already registered.
        MUST revert if `_parentNFTContractAddress` is address zero.
        MUST revert if `_parentNFTContractAddress` is not ERC-721 compatible.
        MUST revert if this contract itself is not the owner of the NFT.
        MUST revert on any other error.
        MUST emit `TokenAddition` event to reflect the token type addition.
        @param _parentNFTContractAddress    NFT contract address
        @param _parentNFTTokenId            NFT tokenID
        @param _totalSupply                 Total token supply
    */
    function setParentNFT(address _parentNFTContractAddress, uint256 _parentNFTTokenId, uint256 _totalSupply) external;

    /**
        @notice Get the token ID&apos;s total token supply.
        @param _id      ID of the token
        @return         The total token supply of the specified token type
    */
    function totalSupply(uint256 _id) external view returns (uint256);

    /**
        @notice Get the balance of an account&apos;s tokens.
        @param _owner  The address of the token holder
        @param _id     ID of the token
        @return        The _owner&apos;s balance of the token type requested
    */
    function balanceOf(address _owner, uint256 _id) external view returns (uint256);

    /**
        @notice Get the amount which `_spender` is still allowed to withdraw from `_owner`
        @param _owner   The address of the token holder
        @param _spender The address approved to withdraw token on behalf of `_owner`
        @param _id      ID of the token
        @return         The amount which `_spender` is still allowed to withdraw from `_owner`
    */
    function allowance(address _owner, address _spender, uint256 _id) external view returns (uint256);

    /**
        @notice Get the bool value which represents whether the NFT is already registered and fractionalized by this contract.
        @param _parentNFTContractAddress    NFT contract address
        @param _parentNFTTokenId            NFT tokenID
        @return                             The bool value representing the whether the NFT is already registered.
    */
    function isRegistered(address _parentNFTContractAddress, uint256 _parentNFTTokenId) external view returns (bool);
}

interface ERC165 {
    /**
        @notice Query if a contract implements an interface
        @param interfaceID The interface identifier, as specified in ERC-165
        @dev Interface identification is specified in ERC-165. This function
        uses less than 30,000 gas.
        @return `true` if the contract implements `interfaceID` and
        `interfaceID` is not 0xffffffff, `false` otherwise
    */
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

To receive Non-Fungible Token on `safe Transfer` the contract should include `onERC721Received()`.
Including `onERC721Received()` is needed to be compatible with Safe Transfer Rules.
```solidity
/**
    @notice Handle the receipt of an NFT
    @param _operator The address which called `safeTransferFrom` function
    @param _from The address which previously owned the token
    @param _tokenId The NFT identifier which is being transferred
    @param _data Additional data with no specified format
    @return `bytes4(keccak256(&quot;onERC721Received(address,address,uint256,bytes)&quot;))`
*/
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external pure returns (bytes4);
```

## Rationale

**Metadata**

The `symbol()` &amp; `name()` functions were not included since the majority of users can just fetch it from the originating NFT contract. Also, copying the name &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.

**Design**

Most of the decisions made around the design of this ERC were done to keep it as flexible for diverse token design &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.

## Backwards Compatibility

To make this standard compatible with existing standards, this standard `event` &amp; `function` names are identical with ERC-20 token standard with some more `events` &amp; `functions` to add token type dynamically.

Also, the sequence of parameter in use of `_id` for distinguishing token types in `functions` and `events` are very much similar to ERC-1155 Multi-Token Standard.

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.

## Test Cases

Reference Implementation of MFNFT Token includes test cases written using hardhat. (Test coverage : 100%)

## Reference Implementation
[MFNFT - Implementation](../assets/eip-4675/README.md)

## Security Considerations

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.

If an arbitrary account has the right to call `setParentNFT()` there might be a front-running issue. The caller of `setParentNFT()` might be different from the real NFT sender. 
To prevent this issue, implementors should just allow **admin** to call, or fractionalize and receive NFT in an atomic transaction similar to flash loan(swap).

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 13 Jan 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4675</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4675</guid>
      </item>
    
      <item>
        <title>Non-Fungible Token Ownership Designation Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-4799-non-fungible-token-wrapping-standard/8396</comments>
        
        <description>## Abstract

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. 

## Motivation

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&apos;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.

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.

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.

## Specification

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.

```solidity
import &quot;@openzeppelin/contracts/utils/introspection/IERC165.sol&quot;;

interface IERC4799NFT is IERC165 {
    /// @dev This emits when ownership of any NFT changes by any mechanism.
    ///  This event emits when NFTs are created (`from` == 0) and destroyed
    ///  (`to` == 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.
    event Transfer(
        address indexed from,
        address indexed to,
        uint256 indexed tokenId
    );

    /// @notice Find the owner of an NFT
    /// @dev NFTs assigned to zero address are considered invalid, and queries
    ///  about them throw
    /// @param tokenId The identifier for an NFT
    /// @return The address of the owner of the NFT
    function ownerOf(uint256 tokenId) external view returns (address);
}
```
```solidity
/// @title ERC-4799 Non-Fungible Token Ownership Designation Standard
/// @dev See https://eips.ethereum.org/EIPS/eip-4799
/// Note: the ERC-165 identifier for this interface is [TODO].

import &quot;@openzeppelin/contracts/utils/introspection/IERC165.sol&quot;;
import &quot;./IERC4799NFT.sol&quot;;

interface IERC4799 is IERC165 {
    /// @dev Emitted when a source token designates its ownership to the owner of the target token
    event OwnershipDesignation(
        IERC4799NFT indexed sourceContract,
        uint256 sourceTokenId,
        IERC4799NFT indexed targetContract,
        uint256 targetTokenId
    );

    /// @notice Find the designated NFT
    /// @param sourceContract The contract address of the source NFT
    /// @param sourceTokenId The tokenId of the source NFT
    /// @return (targetContract, targetTokenId) contract address and tokenId of the parent NFT
    function designatedTokenOf(IERC4799NFT sourceContract, uint256 sourceTokenId)
        external
        view
        returns (IERC4799NFT, uint256);
}
```

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.

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.

## Rationale

To maximize the future compatibility of the wrapping contract, we first defined a canonical NFT interface. We created `IERC4799NFT`, an interface implicitly implemented by virtually all popular NFT contracts, including all deployed contracts that are [ERC-721](./eip-721.md) 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 `ownerOf`.

The core of our proposal is the `IERC4799` interface, an interface for a standard NFT ownership designation contract (ODC). ERC4799 requires the implementation of a `designatedTokenOf` 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.

## Backwards Compatibility

The `IERC4799NFT` interface is backwards compatible with `IERC721`, as `IERC721` implicitly extends `IERC4799NFT`. This means that the ERC-4799 standard, which wraps NFTs that implement `ERC4799NFT`, is fully backwards compatible with ERC-721.

## Reference Implementation

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity &gt;=0.8.0 &lt;0.9.0;

import &quot;./IERC4799.sol&quot;;
import &quot;./IERC4799NFT.sol&quot;;
import &quot;./ERC721.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol&quot;;

contract ERC721Composable is IERC4799, IERC721Receiver {
    mapping(IERC4799NFT =&gt; mapping(uint256 =&gt; IERC4799NFT)) private _targetContracts;
    mapping(IERC4799NFT =&gt; mapping(uint256 =&gt; uint256)) private _targetTokenIds;

    function designatedTokenOf(IERC4799NFT sourceContract, uint256 sourceTokenId)
        external
        view
        override
        returns (IERC4799NFT, uint256)
    {
        return (
            IERC4799NFT(_targetContracts[sourceContract][sourceTokenId]),
            _targetTokenIds[sourceContract][sourceTokenId]
        );
    }

    function designateToken(
        IERC4799NFT sourceContract,
        uint256 sourceTokenId,
        IERC4799NFT targetContract,
        uint256 targetTokenId
    ) external {
        require(
            ERC721(address(sourceContract)).ownerOf(sourceTokenId) == msg.sender ||
            ERC721(address(sourceContract)).getApproved(sourceTokenId) == msg.sender, 
            &quot;ERC721Composable: Only owner or approved address can set a designate ownership&quot;);
        _targetContracts[sourceContract][sourceTokenId] = targetContract;
        _targetTokenIds[sourceContract][sourceTokenId] = targetTokenId;
        emit OwnershipDesignation(
            sourceContract, 
            sourceTokenId,  
            targetContract,
            targetTokenId
        );
    }

    function onERC721Received(
        address,
        address from,
        uint256 sourceTokenId,
        bytes calldata
    ) external override returns (bytes4) {
        ERC721(msg.sender).approve(from, sourceTokenId);
        return IERC721Receiver.onERC721Received.selector;
    }

        function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            (interfaceId == type(IERC4799).interfaceId ||
            interfaceId == type(IERC721Receiver).interfaceId);
    }
}
```
```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity &gt;=0.8.0 &lt;0.9.0;

import &quot;./IERC4799.sol&quot;;
import &quot;./IERC4799NFT.sol&quot;;
import &quot;@openzeppelin/contracts/utils/introspection/ERC165Checker.sol&quot;;

contract DesignatedOwner {
    function designatedOwnerOf(
        IERC4799NFT tokenContract,
        uint256 tokenId,
        uint256 maxDepth
    ) public view returns (address owner) {
        owner = tokenContract.ownerOf(tokenId);
        if (ERC165Checker.supportsInterface(owner, type(IERC4799).interfaceId)) {
            require(maxDepth &gt; 0, &quot;designatedOwnerOf: depth limit exceeded&quot;);
            (tokenContract, tokenId) = IERC4799(owner).designatedTokenOf(
                tokenContract,
                tokenId
            );
            return designatedOwnerOf(tokenContract, tokenId, maxDepth - 1);
        }
    }
}
```

## Security Considerations

### Long/Cyclical Chains of Ownership

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 `maxDepth` parameter, cutting off computation after a certain number of chain traversals.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 13 Feb 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4799</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4799</guid>
      </item>
    
      <item>
        <title>Web3 URL to EVM Call Message Translation</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4804-web3-url-to-evm-call-message-translation/8300</comments>
        
        <description>## Abstract

This standard translates an RFC 2396 URI like `web3://uniswap.eth/` to an EVM message such as:

```
EVMMessage {
   To: 0xaabbccddee.... // where uniswap.eth&apos;s address registered at ENS
   Calldata: 0x
   ...
}
```

## Motivation

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/node service provider/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/HTML.  Moreover, this standard enables interoperability with other standards already compatible with URIs, like SVG/HTML.

## Specification

This specification only defines read-only (i.e. Solidity&apos;s `view` functions) semantics. State modifying functions may be defined as a future extension.

A Web3 URL is in the following form

```
web3URL = web3Schema [userinfo &quot;@&quot;] contractName [&quot;:&quot; chainid] path [&quot;?&quot; query]
web3Schema = [ &quot;ethereum-web3://&quot; | &quot;eth-web3://&quot; | &quot;web3://&quot; ]
contractName = address | [name &quot;.&quot; [ subDomain0 &quot;.&quot; ... ]] nsProviderSuffix
path = [&quot;/&quot; method [&quot;/&quot; argument_0 [&quot;/&quot; argument_1 ... ]]]
argument = [type &quot;!&quot;] value
query = &quot;attribute_1=value_1 [ &quot;&amp;&quot; attribute_2=value_2 ... ]
attribute = &quot;returns&quot; | &quot;returnTypes&quot; | other_attribute
```

where

- **web3Schema** indicates the schema of the URL, which is `web3://` or `w3://` for short.
- **userinfo** 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.
- **contractName** indicates the contract to be called, i.e., &quot;To&quot; field in the EVM call message. If the **contractName** is an **address**, 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, **nsProviderSuffix** 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.
- **chainid** indicates which chain to resolve **contractName** 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.
- **query** is an optional component containing a sequence of attribute-value pairs separated by &quot;&amp;&quot;.

### Resolve Mode

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:

#### Manual Mode

The manual mode will not do any interpretation of **path** and **query**, and put **path** [ &quot;?&quot; **query** ] as the calldata of the message directly.

#### Auto Mode

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 **path** 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

- **method** is a string of function method be called
- **argument_i** is the ith argument of the method. If **type** 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 **type** is not specified, then the type will be automatically detected using the following rule in a sequential way:

1. **type**=&quot;uint256&quot;, if **value** is numeric; or
2. **type**=&quot;bytes32&quot;, if **value** is in the form of 0x+32-byte-data hex; or
3. **type**=&quot;address&quot;, if **value** is in the form of 0x+20-byte-data hex; or
4. **type**=&quot;bytes&quot;, if **value** is in the form of 0x followed by any number of bytes besides 20 or 32; or
5. else **type**=&quot;address&quot; and parse the argument as a domain name in the form of `[name &quot;.&quot; [ subDomain0 &quot;.&quot; ... ]] nsProviderSuffix`. In this case, the actual value of the argument will be obtained from **nsProviderSuffix**, e.g., eth.  If **nsProviderSuffix** is not supported, an unsupported NS provider error will be returned. 

Note that if **method** does not exist, i.e., **path** is empty or &quot;/&quot;, then the contract will be called with empty calldata.

- **returns** attribute in **query** 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 **returns** is &quot;()&quot;, the returned data will be parsed in raw bytes in JSON.  Otherwise, the returned message will be parsed in the specified **returns** attribute in JSON.  If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for backward-compatible purpose.

### Examples

#### Example 1

```
web3://w3url.eth/
```

The protocol will find the address of **w3url.eth** 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;.

#### Example 2

```
web3://cyberbrokers-meta.eth/renderBroker/9999
```

The protocol will find the address of **cyberbrokers-meta.eth** 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; + `keccak(&quot;view(uint256)&quot;)[0:4] + abi.encode(uint256(9999))`.

#### Example 3

```
web3://vitalikblog.eth:5/
```

The protocol will find the address of **vitalikblog.eth** 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.

#### Example 4

```
web3://0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170/
```

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).

#### Example 5

```
web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=(uint256)
```

The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method &quot;balanceOf(address)&quot; of the contract with the **charles.eth**&apos;s address. The returned data will be parsed as uint256 like `[ &quot;10000000000000&quot; ]`.

#### Example 6

```
web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=()
```

The protocol will find the address of **vitalik.eth** 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 `[&quot;0x000000000000000000000000000000000000000000000000000009184e72a000&quot;]`.

## Rationale

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/CSS/JPG/PNG/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:

- **Human-readable**.  The Web3 URL should be easily recognized by human similar to Web2 URL (`http://`).  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.

- **Maximum-Compatible with HTTP-URL standard**.  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.

- **Simple**.  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.

- **Flexible**.  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.

## Security Considerations

No security considerations were found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 14 Feb 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4804</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4804</guid>
      </item>
    
      <item>
        <title>Common Interfaces for DAOs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4824-decentralized-autonomous-organizations/8362</comments>
        
        <description>## Abstract

An API standard for decentralized autonomous organizations (DAOs), focused on relating on-chain and off-chain representations of membership and proposals.

## Motivation

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 [ERC-721](./eip-721), 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.

## Specification

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.

Every contract implementing this EIP MUST implement the `IERC4824` interface below:

```solidity
pragma solidity ^0.8.1;

/// @title ERC-4824 DAOs
/// @dev See &lt;https://eips.ethereum.org/EIPS/eip-4824&gt;
interface IERC4824 {
    event DAOURIUpdate(address daoAddress, string daoURI);

    /// @notice A distinct Uniform Resource Identifier (URI) pointing to a JSON object following the &quot;ERC-4824 DAO JSON-LD Schema&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 &quot;ERC-4824 Members JSON-LD Schema&quot;. The proposalsURI SHOULD point to a JSON file that conforms to the &quot;ERC-4824 Proposals JSON-LD Schema&quot;. The activityLogURI SHOULD point to a JSON file that conforms to the &quot;ERC-4824 Activity Log JSON-LD Schema&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 &quot;URI&quot; suffix. For example, &quot;membersURI&quot; would be renamed to &quot;members&quot;, &quot;proposalsURI&quot; would be renamed to &quot;proposals&quot;, and so on.
    function daoURI() external view returns (string memory _daoURI);
}
```

The DAO JSON-LD Schema mentioned above:

```json
{
    &quot;@context&quot;: &quot;http://www.daostar.org/schemas&quot;,
    &quot;type&quot;: &quot;DAO&quot;,
    &quot;name&quot;: &quot;&lt;name of the DAO&gt;&quot;,
    &quot;description&quot;: &quot;&lt;description&gt;&quot;,
    &quot;membersURI&quot;: &quot;&lt;URI&gt;&quot;,
    &quot;proposalsURI&quot;: &quot;&lt;URI&gt;&quot;,
    &quot;activityLogURI&quot;: &quot;&lt;URI&gt;&quot;,
    &quot;governanceURI&quot;: &quot;&lt;URI&gt;&quot;,
    &quot;contractsURI&quot;: &quot;&lt;URI&gt;&quot;
}
```

A DAO MAY inherit the `IERC4824` 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.

When reporting information in the DAO JSON-LD Schema, if a given field has no value (for example, `description`), it SHOULD be removed rather than left with an empty or `null` value.

### Indexing

If a DAO inherits the `IERC4824` interface from a 4824-compliant DAO factory, then the DAO factory SHOULD incorporate a call to an indexer contract as part of the DAO&apos;s initialization to enable efficient network indexing. If the DAO is [ERC-165](./eip-165)-compliant, the factory can do this without additional permissions. If the DAO is _not_ compliant with ERC-165, the factory SHOULD first obtain access control rights to the indexer contract and then call `logRegistration` 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 `logRegistration` and submit a registration for a DAO which inherits the `IERC4824` interface and which is also ERC-165-compliant.

```solidity
pragma solidity ^0.8.1;

error ERC4824InterfaceNotSupported();

contract ERC4824Index is AccessControl {
    using ERC165Checker for address;

    bytes32 public constant REGISTRATION_ROLE = keccak256(&quot;REGISTRATION_ROLE&quot;);

    event DAOURIRegistered(address daoAddress);

    constructor() {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(REGISTRATION_ROLE, msg.sender);
    }

    function logRegistrationPermissioned(
        address daoAddress
    ) external onlyRole(REGISTRATION_ROLE) {
        emit DAOURIRegistered(daoAddress);
    }

    function logRegistration(address daoAddress) external {
        if (!daoAddress.supportsInterface(type(IERC4824).interfaceId))
            revert ERC4824InterfaceNotSupported();
        emit DAOURIRegistered(daoAddress);
    }
}
```

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.

#### Indexing priority
daoURIs may be published directly in the DAO&apos;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.

### Members

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 [Decentralized Identifiers](https://www.w3.org/TR/2022/REC-did-core-20220719/).

```json
{
    &quot;@context&quot;: &quot;https://www.daostar.org/schemas&quot;,
    &quot;type&quot;: &quot;DAO&quot;,
    &quot;members&quot;: [
        {
            &quot;id&quot;: &quot;&lt;CAIP-10 address, DID address, or other URI identifier&gt;&quot;
        },
        {
            &quot;id&quot;: &quot;&lt;CAIP-10 address, DID address, or other URI identifier&gt;&quot;
        }
    ]
}
```

For example, for an address on Ethereum Mainnet, the [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/ad0cfebc45a4b8368628340bf22aefb2a5edcab7/CAIPs/caip-10.md) address would be of the form `eip155:1:0x1234abcd`, while the DID address would be of the form `did:ethr:0x1234abcd`.

### Proposals

Proposals JSON-LD Schema. Every contract implementing this EIP SHOULD implement a proposalsURI pointing to a JSON object satisfying this schema.

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.

```json
{
    &quot;@context&quot;: &quot;https://www.daostar.org/schemas&quot;,
    &quot;proposals&quot;: [
        {
            &quot;type&quot;: &quot;proposal&quot;,
            &quot;id&quot;: &quot;&lt;proposal ID&gt;&quot;,
            &quot;name&quot;: &quot;&lt;name or title of proposal&gt;&quot;,
            &quot;contentURI&quot;: &quot;&lt;URI to content/text of the proposal&gt;&quot;,
            &quot;discussionURI&quot;: &quot;&lt;URI to discussion or thread for the proposal&gt;&quot;,
            &quot;status&quot;: &quot;&lt;status of proposal&gt;&quot;,
            &quot;calls&quot;: [
                {
                    &quot;type&quot;: &quot;CallDataEVM&quot;,
                    &quot;operation&quot;: &quot;&lt;call or delegate call&gt;&quot;,
                    &quot;from&quot;: &quot;&lt;EthereumAddress&gt;&quot;,
                    &quot;to&quot;: &quot;&lt;EthereumAddress&gt;&quot;,
                    &quot;value&quot;: &quot;&lt;value&gt;&quot;,
                    &quot;data&quot;: &quot;&lt;call data&gt;&quot;
                }
            ]
        }
    ]
}
```

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.

### Activity Log

Activity Log JSON-LD Schema. Every contract implementing this EIP SHOULD implement a activityLogURI pointing to a JSON object satisfying this schema.

```json
{
    &quot;@context&quot;: &quot;https://www.daostar.org/schemas&quot;,
    &quot;activities&quot;: [
        {
            &quot;id&quot;: &quot;&lt;activity ID&gt;&quot;,
            &quot;type&quot;: &quot;activity&quot;,
            &quot;proposal&quot;: {
                &quot;type&quot;: &quot;proposal&quot;
                &quot;id&quot;: &quot;&lt;proposal ID&gt;&quot;,
            },
            &quot;member&quot;: {
                &quot;id&quot;: &quot;&lt;CAIP-10 address, DID address, or other URI identifier&gt;&quot;
            }
        } 
    ]
}
```

### Contracts

Contracts JSON-LD Schema. Every contract implementing this EIP SHOULD implement a contractsURI pointing to a JSON object satisfying this schema.

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.

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 `IERC4824` 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.

```json
{
    &quot;@context&quot;: &quot;https://www.daostar.org/schemas&quot;,
    &quot;contracts&quot;: [
        {
            &quot;id&quot;: &quot;&lt;CAIP-10 address, DID address, or other URI identifier&gt;&quot;
            &quot;name&quot;: &quot;&lt;name, e.g. Treasury&gt;&quot;,
            &quot;description&quot;: &quot;&lt;description, e.g. Primary operating treasury for the DAO&gt;&quot;
        },
        {
            &quot;id&quot;: &quot;&lt;CAIP-10 address, DID address, or other URI identifier&gt;&quot;
            &quot;name&quot;: &quot;&lt;name, e.g. Governance Token&gt;&quot;,
            &quot;description&quot;: &quot;&lt;description, e.g. ERC20 governance token contract&gt;&quot;
        },
        {
            &quot;id&quot;: &quot;&lt;CAIP-10 address, DID address, or other URI identifier&gt;&quot;
            &quot;name&quot;: &quot;&lt;name, e.g. Registration Contract&gt;&quot;,
            &quot;description&quot;: &quot;&lt;description, e.g. ERC-4824 registration contract&gt;&quot;
        }
    ]
}
```

### URI fields
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, `membersURI` would be renamed to `members`, `proposalsURI` would be renamed to `proposals`, 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. `membersURI` and `members`) SHOULD NOT appear in the same JSON-LD; if they do, the field without the URI suffix MUST take precedence.

Fields which are not appended with URI MAY be appended with a URI, for example `name` and `description` may be renamed to `nameURI` and `descriptionURI`, in which case the dereferenced URI MUST return a JSON-LD object containing the `&quot;@context&quot;: &quot;https://www.daostar.org/schemas&quot;` field and the original key-value pair.

For example, descriptionURI should return:
```json
{
    &quot;@context&quot;: &quot;https://www.daostar.org/schemas&quot;,
    &quot;description&quot;: &quot;&lt;description&gt;&quot;
}
```

### Entities which are not DAOs

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 `type` field than &quot;DAO&quot;, for example &quot;Organization&quot;, &quot;Foundation&quot;, &quot;Person&quot;, or, most broadly, &quot;Entity&quot;.

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 `IERC4824`&apos;s daoURI in order to enable network indexing.

The Entity JSON-LD Schema:

```json
{
    &quot;@context&quot;: &quot;https://www.daostar.org/schemas&quot;,
    &quot;type&quot;: &quot;&lt;type of entity&gt;&quot;,
    &quot;name&quot;: &quot;&lt;name of the entity&gt;&quot;,
    &quot;description&quot;: &quot;&lt;description&gt;&quot;,
    &quot;membersURI&quot;: &quot;&lt;URI&gt;&quot;,
    &quot;proposalsURI&quot;: &quot;&lt;URI&gt;&quot;,
    &quot;activityLogURI&quot;: &quot;&lt;URI&gt;&quot;,
    &quot;governanceURI&quot;: &quot;&lt;URI&gt;&quot;,
    &quot;contractsURI&quot;: &quot;&lt;URI&gt;&quot;
}
```

## Rationale

In this standard, we assume that all DAOs possess at least two primitives: _membership_ and _behavior_. _Membership_ is defined by a set of addresses. _Behavior_ is defined by a set of possible contract actions, including calls to external contracts and calls to internal functions. _Proposals_ relate membership and behavior; they are objects that members can interact with and which, if and when executed, become behaviors of the DAO.

### APIs, URIs, and off-chain data

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.

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).

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.

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.

### membersURI

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.

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.

We encourage extensions of the Membership JSON-LD Schema, e.g. for DAOs that wish to create a state variable that captures active/inactive status or different membership levels.

### proposalsURI

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.

**Proposal ID**. 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 / layer 2 proposals and the “?proposalId=” query syntax to suggest off-chain usage.

**ContentURI**. 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.

**Status**. 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.

| Project | Proposal Statuses |
| --- | --- |
| Aragon | Not specified |
| Colony | [‘Null’, ‘Staking’, ‘Submit’, ‘Reveal’, ‘Closed’, ‘Finalizable’, ‘Finalized’, ‘Failed’] |
| Compound | [‘Pending’, ‘Active’, ‘Canceled’, ‘Defeated’, ‘Succeeded’, ‘Queued’, ‘Expired’, ‘Executed’] |
| DAOstack/ Alchemy | [‘None’, ‘ExpiredInQueue’, ‘Executed’, ‘Queued’, ‘PreBoosted’, ‘Boosted’, ‘QuietEndingPeriod’] |
| Moloch v2 | [sponsored, processed, didPass, cancelled, whitelist, guildkick] |
| Tribute | [‘EXISTS’, ‘SPONSORED’, ‘PROCESSED’] |

**ExecutionData**. 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.

### activityLogURI

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/submission of a proposal, voting on a proposal, disputing a proposal, and so on.

_Alternatives we considered: history, interactions_

### governanceURI

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.

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.

_Alternative names considered: description, readme, constitution_

### contractsURI

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 / Compound Governor. In other cases, a DAO might deploy multiple multsigs as treasuries and/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.

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.

_Alternative names considered: contractsRegistry, contractsList_

### Why JSON-LD

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.

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.

### **Community Consensus**

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.

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.

## Backwards Compatibility

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.

## Security Considerations

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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 17 Feb 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4824</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4824</guid>
      </item>
    
      <item>
        <title>Hierarchical Domains</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-4834-hierarchical-domains-standard/8388</comments>
        
        <description>## Abstract

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 [ERC-137](./eip-137.md) (also known as &quot;ENS&quot;).

## Motivation

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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Contract Interface

```solidity
interface IDomain {
    /// @notice     Query if a domain has a subdomain with a given name
    /// @param      name The subdomain to query, in right to left order
    /// @return     `true` if the domain has a subdomain with the given name, `false` otherwise
    function hasDomain(string[] memory name) external view returns (bool);

    /// @notice     Fetch the subdomain with a given name
    /// @dev        This should revert if `hasDomain(name)` is `false`
    /// @param      name The subdomain to fetch, in right to left order
    /// @return     The subdomain with the given name
    function getDomain(string[] memory name) external view returns (address);
}
```

### Name Resolution

To resolve a name (like `&quot;a.b.c&quot;`), split it by the delimiter (resulting in something like `[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]`). Set `domain` initially to the root domain, and `path` to be an empty list.

Pop off the last element of the array (`&quot;c&quot;`) and add it to the path, then call `domain.hasDomain(path)`. If it&apos;s `false`, then the domain resolution fails. Otherwise, set the domain to `domain.getDomain(path)`. Repeat until the list of split segments is empty.

There is no limit to the amount of nesting that is possible. For example, `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` would be valid if the root contains `z`, and `z` contains `y`, and so on.

Here is a solidity function that resolves a name:

```solidity
function resolve(string[] calldata splitName, IDomain root) public view returns (address) {
    IDomain current = root;
    string[] memory path = [];
    for (uint i = splitName.length - 1; i &gt;= 0; i--) {
        // Append to back of list
        path.push(splitName[i]);
        // Require that the current domain has a domain
        require(current.hasDomain(path), &quot;Name resolution failed&quot;);
        // Resolve subdomain
        current = current.getDomain(path);
    }
    return current;
}
```

### Optional Extension: Registerable

```solidity
interface IDomainRegisterable is IDomain {
    //// Events
    
    /// @notice     Must be emitted when a new subdomain is created (e.g. through `createDomain`)
    /// @param      sender msg.sender for createDomain
    /// @param      name name for createDomain
    /// @param      subdomain subdomain in createDomain
    event SubdomainCreate(address indexed sender, string name, address subdomain);

    /// @notice     Must be emitted when the resolved address for a domain is changed (e.g. with `setDomain`)
    /// @param      sender msg.sender for setDomain
    /// @param      name name for setDomain
    /// @param      subdomain subdomain in setDomain
    /// @param      oldSubdomain the old subdomain
    event SubdomainUpdate(address indexed sender, string name, address subdomain, address oldSubdomain);

    /// @notice     Must be emitted when a domain is unmapped (e.g. with `deleteDomain`)
    /// @param      sender msg.sender for deleteDomain
    /// @param      name name for deleteDomain
    /// @param      subdomain the old subdomain
    event SubdomainDelete(address indexed sender, string name, address subdomain);

    //// CRUD
    
    /// @notice     Create a subdomain with a given name
    /// @dev        This should revert if `canCreateDomain(msg.sender, name, pointer)` is `false` or if the domain exists
    /// @param      name The subdomain name to be created
    /// @param      subdomain The subdomain to create
    function createDomain(string memory name, address subdomain) external payable;

    /// @notice     Update a subdomain with a given name
    /// @dev        This should revert if `canSetDomain(msg.sender, name, pointer)` is `false` of if the domain doesn&apos;t exist
    /// @param      name The subdomain name to be updated
    /// @param      subdomain The subdomain to set
    function setDomain(string memory name, address subdomain) external;

    /// @notice     Delete the subdomain with a given name
    /// @dev        This should revert if the domain doesn&apos;t exist or if `canDeleteDomain(msg.sender, name)` is `false`
    /// @param      name The subdomain to delete
    function deleteDomain(string memory name) external;


    //// Parent Domain Access Control

    /// @notice     Get if an account can create a subdomain with a given name
    /// @dev        This must return `false` if `hasDomain(name)` is `true`.
    /// @param      updater The account that may or may not be able to create/update a subdomain
    /// @param      name The subdomain name that would be created/updated
    /// @param      subdomain The subdomain that would be set
    /// @return     Whether an account can update or create the subdomain
    function canCreateDomain(address updater, string memory name, address subdomain) external view returns (bool);

    /// @notice     Get if an account can update or create a subdomain with a given name
    /// @dev        This must return `false` if `hasDomain(name)` is `false`.
    ///             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`.
    /// @param      updater The account that may or may not be able to create/update a subdomain
    /// @param      name The subdomain name that would be created/updated
    /// @param      subdomain The subdomain that would be set
    /// @return     Whether an account can update or create the subdomain
    function canSetDomain(address updater, string memory name, address subdomain) external view returns (bool);

    /// @notice     Get if an account can delete the subdomain with a given name
    /// @dev        This must return `false` if `hasDomain(name)` is `false`.
    ///             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`.
    /// @param      updater The account that may or may not be able to delete a subdomain
    /// @param      name The subdomain to delete
    /// @return     Whether an account can delete the subdomain
    function canDeleteDomain(address updater, string memory name) external view returns (bool);
}
```

### Optional Extension: Enumerable

```solidity
interface IDomainEnumerable is IDomain {
    /// @notice     Query all subdomains. Must revert if the number of domains is unknown or infinite.
    /// @return     The subdomain with the given index.
    function subdomainByIndex(uint256 index) external view returns (string memory);
    
    /// @notice     Get the total number of subdomains. Must revert if the number of domains is unknown or infinite.
    /// @return     The total number of subdomains.
    function totalSubdomains() external view returns (uint256);
}
```

### Optional Extension: Access Control

```solidity
interface IDomainAccessControl is IDomain {
    /// @notice     Get if an account can move the subdomain away from the current domain
    /// @dev        May be called by `canSetDomain` of the parent domain - implement access control here!!!
    /// @param      updater The account that may be moving the subdomain
    /// @param      name The subdomain name
    /// @param      parent The parent domain
    /// @param      newSubdomain The domain that will be set next
    /// @return     Whether an account can update the subdomain
    function canMoveSubdomain(address updater, string memory name, IDomain parent, address newSubdomain) external view returns (bool);

    /// @notice     Get if an account can unset this domain as a subdomain
    /// @dev        May be called by `canDeleteDomain` of the parent domain - implement access control here!!!
    /// @param      updater The account that may or may not be able to delete a subdomain
    /// @param      name The subdomain to delete
    /// @param      parent The parent domain
    /// @return     Whether an account can delete the subdomain
    function canDeleteSubdomain(address updater, string memory name, IDomain parent) external view returns (bool);
}
```

## Rationale

This EIP&apos;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:

- Name resolution algorithm
  - Unlike ENS&apos;s resolution algorithm, this EIP&apos;s name resolution is fully under the control of the contracts along the resolution path.
  - This behavior is more intuitive to users.
  - This behavior allows for greater flexibility - e.g. a contract that changes what it resolves to based on the time of day.
- Parent domain access control
  - 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.
  - This also gives parent domains the ability to call subdomains&apos; access control methods so that subdomains, too, can choose whatever access control mechanism they desire
- Subdomain access control
  - These methods are included so that subdomains aren&apos;t always limited to their parent domain&apos;s access control
  - 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.
  - 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.

## Backwards Compatibility

This EIP is general enough to support ENS, but ENS is not general enough to support this EIP.

## Security Considerations

### Malicious canMoveSubdomain (Black Hole)

#### Description: Malicious `canMoveSubdomain`

Moving a subdomain using `setDomain` is a potentially dangerous operation.

Depending on the parent domain&apos;s implementation, if a malicious new subdomain unexpectedly returns `false` on `canMoveSubdomain`, that subdomain can effectively lock the ownership of the domain.

Alternatively, it might return `true` when it isn&apos;t expected (i.e. a backdoor), allowing the contract owner to take over the domain.

#### Mitigation: Malicious `canMoveSubdomain`

Clients should help by warning if `canMoveSubdomain` or `canDeleteSubdomain` for the new subdomain changes to `false`. 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 **always** audit the new subdomain&apos;s source code before calling `setDomain`.

### Parent Domain Resolution

#### Description: Parent Domain Resolution

Parent domains have full control of name resolution for their subdomains. If a particular domain is linked to `a.b.c`, then `b.c` can, depending on its code, set `a.b.c` to any domain, and `c` can set `b.c` itself to any domain.

#### Mitigation: Parent Domain Resolution

Before acquiring a domain that has been pre-linked, it is recommended to always have the contract **and** all the parents up to the root audited.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 22 Feb 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4834</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4834</guid>
      </item>
    
      <item>
        <title>Composable SVG NFT</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4883-composable-svg-nft/8765</comments>
        
        <description>## Abstract

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.

## Motivation

Onchain SVG NFTs allow for NFTs to be entirely onchain by returning artwork as SVG in a data URI of the `tokenUri` function. Composability allows onchain SVG NFTs to be crafted. e.g. adding glasses &amp; hat NFTs to a profile pic NFT or a fish NFT to a fish tank NFT.

## Specification
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.

```solidity
/// @title EIP-4883 Non-Fungible Token Standard
interface IERC4883 {
    function renderTokenById(uint256 id) external view returns (string memory);
}
```

`renderTokenById` must return the SVG body for the specified token `id` and must either be an empty string or valid SVG element(s). 

## Rationale

SVG elements can be string concatenated to compose an SVG.

### Ordering of concatenation

SVG uses a &quot;painters model&quot; of rendering.  

**Scalable Vector Graphics (SVG) 1.1 (Second Edition)**, section: **3.3 Rendering Order**
&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.

The ordering of the SVG concatenation determines the drawing order rather than any concept of a z-index.  

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. 

### Alternatives to concatenation

SVG specifies a `link` 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&apos;s is already supported, the simpler approach of concatenation is used.  

### Sizing

This EIP doesn&apos;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.

### Render function name

The render function is named `renderTokenById` as this function name was first used by Loogies and allows existing deployed NFTs to be compatible with this EIP.

## Backwards Compatibility
This EIP has no backwards compatibility concerns


## Security Considerations

- SVG uses a &quot;painters model&quot; of rendering. A rendered SVG body could be added and completely obscure the existing SVG NFT artwork.
- SVG is XML and can contain malicious content, and while it won&apos;t impact the contract, it could impact the use of the SVG.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 08 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4883</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4883</guid>
      </item>
    
      <item>
        <title>Subscription NFTs and Multi Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-subscription-token-standard/8531</comments>
        
        <description>## Abstract

The following standard allows for the implementation of a standard API for subscribing to non-fungible and multi tokens. [EIP-20](./eip-20.md) 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.

## Motivation

This standard offers a flexible, general purpose way to subscribe to the use of assets or services offered by [EIP-721](./eip-721.md) or [EIP-1155](./eip-1155.md) 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.

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.

Use cases include any sort of periodic (e.g. daily, weekly, monthly, quarterly, yearly/annual, or seasonal) use of or access to assets or services such as:

- Subscriptions for streaming music, video, e-learning or book/news services
- Sharing of digital assets among subscribers
- Club memberships such as health clubs
- Season tickets for sports and e-sports
- Agreement between parties to exchange fixed rate subscription stream with variable income in DeFi
- Renting in-game assets
- Etc.

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.

## Specification

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.

Smart contracts implementing this EIP standard MUST implement the [EIP-165](./eip-165.md) 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.

```solidity
interface ISubscriptionToken {
    /**
        @dev This emits when the subscription token constructor or initialize method is
        executed.
        @param name The name of the subscription token
        @param symbol The symbol of the subscription token
        @param provider The provider of the subscription whom receives the deposits
        @param subscriptionToken The subscription token contract address
        @param baseToken The ERC-20 compatible token to use for the deposits.
        @param nft Address of the `nft` contract that the provider mints/transfers from.
        All tokenIds referred to in this interface MUST be token instances of this `nft` contract.
    */
    event InitializeSubscriptionToken(
        string name,
        string symbol,
        address provider,
        address indexed subscriptionToken,
        address indexed baseToken,
        address indexed nft,
        string uri
    );

    /**
        @dev This emits for every new subscriber to `nft` contract of token `tokenId`.
        `subscriber` MUST have received `nft` of token `tokenId` in their account.
        @param subscriber The subscriber account
        @param tokenId MUST be token id of `nft` sent to `subscriber`
        @param uri MUST be uri of the `nft` that was sent to `subscriber` or empty string
    */
    event SubscribeToNFT(
        address indexed subscriber,
        uint256 indexed tokenId,
        string uri
    );

    /**
        @dev Emits when `subscriber` deposits ERC-20 of token type `baseToken` via the `deposit method.
        This tops up `subscriber` balance of subscription tokens
        @param depositAmount The amount of ERC-20 of type `baseToken` deposited
        @param subscriptionTokenAmount The amount of subscription tokens sent in exchange to `subscriber`
        @param subscriptionPeriod Amount of additional time in seconds subscription is extended
    */
    event Deposit(
        address indexed subscriber,
        uint256 indexed tokenId,
        uint256 depositAmount,
        uint256 subscriptionTokenAmount,
        uint256 subscriptionPeriod
    );

    /**
        @return The name of the subscription token
    */
    function name() external view returns (string memory);

    /**
        @return The symbol of the subscription token
    */
    function symbol() external view returns (string memory);

    /**
        @notice Subscribes `subscriber` to `nft` of &apos;tokenId&apos;. `subscriber` MUST receive `nft`
        of token `tokenId` in their account.
        @dev MUST revert if `subscriber` is already subscribed to `nft` of &apos;tokenId&apos;
        MUST revert if &apos;nft&apos; has not approved the `subscriptionToken` contract address as operator.
        @param subscriber The subscriber account. MUST revert if zero address.
        @param tokenId MUST be token id of `nft` contract sent to `subscriber`
        `tokenId` emitted from event `SubscribeToNFT` MUST be the same as tokenId except when
        tokenId is zero; allows OPTIONAL tokenid that is then set internally and minted by
        `nft` contract
        @param uri The OPTIONAL uri of the `nft`.
        `uri` emitted from event `SubscribeToNFT` MUST be the same as uri except when uri is empty.
    */
    function subscribeToNFT(
        address subscriber,
        uint256 tokenId,
        string memory uri
    ) external;

    /**
        @notice Top up balance of subscription tokens held by `subscriber`
        @dev MUST revert if `subscriber` is not subscribed to `nft` of &apos;tokenId&apos;
        MUST revert if &apos;nft&apos; has not approved the `subscriptionToken` contract address as operator.
        @param subscriber The subscriber account. MUST revert if zero address.
        @param tokenId The token id of `nft` contract to subscribe to
        @param depositAmount The amount of ERC-20 token of contract address `baseToken` to deposit
        in exchange for subscription tokens of contract address `subscriptionToken`
    */
    function deposit(
        address subscriber,
        uint256 tokenId,
        uint256 depositAmount
    ) external payable;

    /**
        @return The balance of subscription tokens held by `subscriber`.
        RECOMMENDED that the balance decreases linearly to zero for time limited subscriptions
        RECOMMENDED that the balance remains the same for life long subscriptions
        MUST return zero balance if the `subscriber` does not hold `nft` of &apos;tokenId&apos;
        MUST revert if subscription has not yet started via the `deposit` function
        When the balance is zero, the use of `nft` of `tokenId` MUST NOT be allowed for `subscriber`
    */
    function balanceOf(address subscriber) external view returns (uint256);
}
```

### Subscription token balances

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 `balanceOf` 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.

### Subscription token price

Subscription token price paid per token per second can be calculated from the `Deposit` event parameters as
`depositAmount` / (`subscriptionTokenAmount` \* `subscriptionPeriod`)

### NFT metadata

The NFT&apos;s metadata can store information of the asset/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.

### Subscription expiry

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&apos;s `uri` function no longer returns back a link to its metadata.

### Caveats

With some traditional subscription models based on fiat currencies, the subscribers&apos; 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.

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&apos;s Pausable. In that case, `balanceOf` method would need extra logic and storage to account for the length of time the subscription tokens were paused.

## Rationale

### Tokenisation of subscriptions

The subscription itself has value when it is exchanged for a deposit. This proposal enables subscriptions to be &apos;tokenised&apos; 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.

### Cater for current and future uses of NFTs

This proposal purposely keeps `tokenId` and `uri` optional in the `subcribeToNFT` method to keep the specification general purpose. Some use cases such as pre-computed image NFT collections don&apos;t require a different &apos;uri&apos;, just a different `tokenId` for each NFT. However, in other use cases such as those that require legal contracts between both parties, individual `uri` links are probably required as the NFT&apos;s metadata may require information from both parties to be stored on immutable storage.

### Giving back users control

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&apos; needs.

## Backwards Compatibility

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 `name`, `symbol` and `balanceOf` 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&apos;s interface by considering their own use case.

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&apos;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 &apos;nft&apos; MUST have approved the `subscriptionToken` contract address as operator.

## Security Considerations

It is normal for service providers to receive subscriber payments upfront before the subscriber gets to use the service. Indeed this proposal via the `deposit` 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.

The `subscribeToNFT` method takes a parameter `uri` link to the `nft` 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 `uri` is provided at the time of subscription rather then deployment, it is RECOMMENDED that where the use case requires, implementers ensure that the `uri` link is to immutable storage.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 08 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4885</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4885</guid>
      </item>
    
      <item>
        <title>Proxy Ownership Register</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4886-a-proxy-ownership-and-asset-delivery-register/8559</comments>
        
        <description>## Abstract

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&apos; 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.

## Motivation

To make full use of Ethereum users often need to prove their ownership of existing assets. For example:
 * Discord communities require users to sign a message with their wallet to prove they hold the tokens or NFTs of that community.
 * Whitelist events (for example recent airdrops, or NFT mints), require the user to interact using a given address to prove eligibility.
 * Voting in DAOs and other protocols require the user to sign using the address that holds the relevant assets.

 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 &apos;cold&apos;, 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.

 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 &apos;vault&apos; their NFT and lose access to a discord channel, or keep their NFT in another wallet, or even to connect their &apos;vault&apos; to discord.

 Ethereum is amazing at providing trustless proofs. The *only* 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.

 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 &apos;vault&apos;, possibly even the one they are representing in terms of asset ownership.

 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.

## Specification

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.

### Definitions

 * 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.
 * Nomination: Where a Nominator has nominated a Proxy address. Will only be active when the Proxy has accepted the nomination.
 * 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.
 * Proxy address: The address that will represent a Nominator on-chain.
 * Proxy Record: An active proxy relationship encompassing a Nominator, Proxy and Delivery.
 * Register: The main EPS contract, which holds details of both Nominations and Proxy Records.

### EPS Specification 

There are two main parts to the register - a nomination and a proxy record:

    Contract / Dapp                        Register

    Nominator: 0x1234..             Nominator: 0x1234..
    Proxy: 0x5678..     ---------&gt;  Proxy: 0x4567..
                                    Delivery: 0x9876..

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. 

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.

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.

The register is a single smart contract that stores all nomination and register records. The information held for each is as follows:
 * Nomination:
    * The address of the Nominator
    * The address of the Proposed Proxy

* Proxy Record:
    * The address of the Nominator
    * The address of the Proxy
    * The delivery address for proxied deliveries

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. 

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.

The information for both Nominations and Proxy records is held as a mapping. For the Nomination this is address =&gt; address for the Nominator to the Proxy address. For the Proxy Record the mapping is from address =&gt; struct for the Proxy Address to a struct containing the Nominator and Delivery address.

Mapping between an address and its Nominator and Delivery address is a simple process as shown below:

    Contract / Dapp                        Register

      |                                       |
      |------------- 0x4567..---------------&gt; |
      |                                       |
      | &lt;-------nominator: 0x1234..---------- |
      |         delivery: 0x9876..            |
      |                                       |

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.

    Contract / Dapp                        Register

      |                                       |
      |------------- 0x0222..---------------&gt; |
      |                                       |
      | &lt;-------nominator: 0x0222..---------- |
      |         delivery: 0x0222..            |
      |                                       |

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&apos;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&apos;s own behalf, with the Proxy address instantly losing any benefits associated with the proxy relationship.

### Solidity Interface Definition

**Nomination Exists**

    function nominationExists(address _nominator) external view returns (bool);

Returns true if a Nomination exists for the address specified.

**Nomination Exists for Caller**

    function nominationExistsForCaller() external view returns (bool);

Returns true if a Nomination exists for the msg.sender.

**Proxy Record Exists**

    function proxyRecordExists(address _proxy) external view returns (bool);

Returns true if a Proxy Record exists for the passed Proxy address.

**Proxy Record Exists for Caller**

    function proxyRecordExistsForCaller() external view returns (bool);

Returns true if a Proxy Record exists for the msg.sender.

**Nominator Record Exists**

    function nominatorRecordExists(address _nominator) external view returns (bool);

Returns true if a Proxy Record exists for the passed Nominator address.

**Nominator Record Exists for Caller**

    function nominatorRecordExistsForCaller() external view returns (bool);

Returns true if a Proxy Record exists for the msg.sender.

**Get Proxy Record**

    function getProxyRecord(address _proxy) external view returns (address nominator, address proxy, address delivery);

Returns Nominator, Proxy and Delivery address for a passed Proxy address.

**Get Proxy Record for Caller**

    function getProxyRecordForCaller() external view returns (address nominator, address proxy, address delivery);

Returns Nominator, Proxy and Delivery address for msg.sender as Proxy address.

**Get Nominator Record**

    function getNominatorRecord(address _nominator) external view returns (address nominator, address proxy, address delivery);

Returns Nominator, Proxy and Delivery address for a passed Nominator address.

**Get Nominator Record for Caller**

    function getNominatorRecordForCaller() external view returns (address nominator, address proxy, address delivery);

Returns Nominator, Proxy and Delivery address for msg.sender address as Nominator.

**Address Is Active**

    function addressIsActive(address _receivedAddress) external view returns (bool);

Returns true if the passed address is Nominator or Proxy address on an active Proxy Record.

**Address Is Active for Caller**

    function addressIsActiveForCaller() external view returns (bool);

Returns true if msg.sender is Nominator or Proxy address on an active Proxy Record.

**Get Nomination**

function getNomination(address _nominator) external view returns (address proxy);

Returns the proxy address for a Nomination when passed a Nominator.

**Get Nomination for Caller**

function getNominationForCaller() external view returns (address proxy);

Returns the proxy address for a Nomination if msg.sender is a Nominator

**Get Addresses**

    function getAddresses(address _receivedAddress) external view returns (address nominator, address delivery, bool isProxied);

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.

**Get Addresses for Caller**

    function getAddressesForCaller() external view returns (address nominator, address delivery, bool isProxied);

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.

**Get Role**

    function getRole(address _roleAddress) external view returns (string memory currentRole);

Returns a string value with a role for the passed address. Possible roles are:

None The address does not appear on the Register as either a Record or a Nomination.

Nominator - Pending The address is the Nominator on a Nomination which has yet to be accepted by the nominated Proxy address.

Nominator - Active The address is a Nominator on an active Proxy Record (i.e. the Nomination has been accepted).

Proxy - Active The address is a Proxy on an active Proxy Record.

**Get Role for Caller**

    function getRoleForCaller() external view returns (string memory currentRole);

Returns a string value with a role for msg.sender. Possible roles are:

None The msg.sender does not appear on the Register as either a Record or a Nomination.

Nominator - Pending The msg.sender is the Nominator on a Nomination which has yet to be accepted by the nominated Proxy address.

Nominator - Active The msg.sender is a Nominator on an active Proxy Record (i.e. the Nomination has been accepted).

Proxy - Active The msg.sender is a Proxy on an active Proxy Record.

**Make Nomination**

    function makeNomination(address _proxy, uint256 _provider) external payable;

Can be passed a Proxy address to create a Nomination for the msg.sender.

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 .

**Accept Nomination**

    function acceptNomination(address _nominator, address _delivery, uint256 _provider) external;

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.

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 .

**Update Delivery Record**

    function updateDeliveryAddress(address _delivery, uint256 _provider) external;

Can be passed a new Delivery address where the msg.sender is the Proxy on a Proxy Record.

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 .

**Delete Record by Nominator**

    function deleteRecordByNominator(uint256 _provider) external;

Can be called to delete a Record and Nomination when the msg.sender is a Nominator.

Note that when both a Record and Nomination exist both are deleted. If no Record exists (i.e. the Nomination hasn&apos;t been accepted by the Proxy address) the Nomination is deleted.

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 .

**Delete Record by Proxy**

    function deleteRecordByProxy(uint256 _provider) external;

Can be called to delete a Record and Nomination when the msg.sender is a Proxy.

## Rationale

The rationale for this EIP was to provide a way for all existing and future Ethereum assets to be have a &apos;beneficial owner&apos; (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.

## Backwards Compatibility

The EIP is fully backwards compatible.

## Test Cases

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 `../assets/eip-4886/`, as is the source code and example implementations.

## Reference Implementation

Please see `../assets/eip-4886/contracts`

## Security Considerations

The core intention of the EIP is to improve user security by better safeguarding assets and allowing greater use of cold wallet storage. 

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. 

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 03 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4886</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4886</guid>
      </item>
    
      <item>
        <title>EIP-721 Metadata Update Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip4906-erc-721-erc-1155-metadata-update-extension/8588</comments>
        
        <description>## Abstract

This standard is an extension of [EIP-721](./eip-721.md). It adds a `MetadataUpdate` event to EIP-721 tokens.

## Motivation

Many [EIP-721](./eip-721.md) contracts emit an event when one of its tokens&apos; 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.

Having a standard `MetadataUpdate` event will make it easy for third-party platforms to timely update the metadata of many NFTs.

## Specification

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.

The **metadata update extension** is OPTIONAL for EIP-721 contracts.


```solidity
/// @title EIP-721 Metadata Update Extension
interface IERC4906 is IERC165, IERC721 {
    /// @dev This event emits when the metadata of a token is changed.
    /// So that the third-party platforms such as NFT market could
    /// timely update the images and related attributes of the NFT.
    event MetadataUpdate(uint256 _tokenId);

    /// @dev This event emits when the metadata of a range of tokens is changed.
    /// So that the third-party platforms such as NFT market could
    /// timely update the images and related attributes of the NFTs.    
    event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
}
```

The `MetadataUpdate` or `BatchMetadataUpdate` event MUST be emitted when the JSON metadata of a token, or a consecutive range of tokens, is changed.

Not emitting `MetadataUpdate` event is RECOMMENDED when a token is minted.

Not emitting `MetadataUpdate` event is RECOMMENDED  when a token is burned.

Not emitting `MetadataUpdate` event is RECOMMENDED  when the tokenURI changes but the JSON metadata does not.

The `supportsInterface` method MUST return `true` when called with `0x49064906`.

## Rationale

Different NFTs have different metadata, and metadata generally has multiple fields. `bytes data` could be used to represents the modified value of metadata.  It is difficult for third-party platforms to identify various types of `bytes data`, so as to avoid unnecessary complexity, arbitrary metadata is not included in the `MetadataUpdate` event.

After capturing the `MetadataUpdate` event, a third party can update the metadata with information returned from the `tokenURI(uint256 _tokenId)` of EIP-721. When a range of token ids is specified, the third party can query each token URI individually.

## Backwards Compatibility

No backwards compatibility issues were found

## Reference Implementation

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;./IERC4906.sol&quot;;

contract ERC4906 is ERC721, IERC4906 {

    constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) {
    }

    /// @dev See {IERC165-supportsInterface}.
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
        return interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
    }
}
```

## Security Considerations

If there is an off-chain modification of metadata, a method that triggers `MetadataUpdate` can be added, but ensure that the function&apos;s permission controls are correct.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 13 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4906</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4906</guid>
      </item>
    
      <item>
        <title>Rental NFT, an Extension of EIP-721</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/idea-erc-721-user-and-expires-extension/8572</comments>
        
        <description>## Abstract

This standard is an extension of [EIP-721](./eip-721.md). It proposes an additional role (`user`) which can be granted to addresses, and a time where the role is automatically revoked (`expires`). The `user` role represents permission to &quot;use&quot; the NFT, but not the ability to transfer it or set users.

## Motivation

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.

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.

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.

## Specification

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.

### Contract Interface
Solidity Interface with NatSpec &amp; OpenZeppelin v4 Interfaces (also available at [`IERC4907.sol`](../assets/eip-4907/contracts/IERC4907.sol)):

```solidity
interface IERC4907 {

    // Logged when the user of an NFT is changed or expires is changed
    /// @notice Emitted when the `user` of an NFT or the `expires` of the `user` is changed
    /// The zero address for user indicates that there is no user address
    event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires);

    /// @notice set the user and expires of an NFT
    /// @dev The zero address indicates there is no user
    /// Throws if `tokenId` is not valid NFT
    /// @param user  The new user of the NFT
    /// @param expires  UNIX timestamp, The new user could use the NFT before expires
    function setUser(uint256 tokenId, address user, uint64 expires) external;

    /// @notice Get the user address of an NFT
    /// @dev The zero address indicates that there is no user or the user is expired
    /// @param tokenId The NFT to get the user address for
    /// @return The user address for this NFT
    function userOf(uint256 tokenId) external view returns(address);

    /// @notice Get the user expires of an NFT
    /// @dev The zero value indicates that there is no user
    /// @param tokenId The NFT to get the user expires for
    /// @return The user expires for this NFT
    function userExpires(uint256 tokenId) external view returns(uint256);
}
```

The `userOf(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `userExpires(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `setUser(uint256 tokenId, address user, uint64 expires)` function MAY be implemented as `public` or `external`.

The `UpdateUser` event MUST be emitted when a user address is changed or the user expires is changed.

The `supportsInterface` method MUST return `true` when called with `0xad092b5c`.

## Rationale

This model is intended to facilitate easy implementation. Here are some of the problems that are solved by this standard:

### Clear Rights Assignment

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.

### Simple On-chain Time Management

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 `expires` function, there is no need for another transaction because the “user” is invalidated automatically after the duration is over.

### Easy Third-Party Integration

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 `user` role and `expires`, 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.

## Backwards Compatibility

As mentioned in the specifications section, this standard can be fully EIP-721 compatible by adding an extension function set.

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.

## Test Cases

### Test Contract
`ERC4907Demo` Implementation: [`ERC4907Demo.sol`](../assets/eip-4907/contracts/ERC4907Demo.sol)

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

import &quot;./ERC4907.sol&quot;;

contract ERC4907Demo is ERC4907 {

    constructor(string memory name, string memory symbol)
     ERC4907(name,symbol)
     {         
     }

    function mint(uint256 tokenId, address to) public {
        _mint(to, tokenId);
    }

}
```

### Test Code
[test.js](../assets/eip-4907/test/test.js)

```JavaScript
const { assert } = require(&quot;chai&quot;);

const ERC4907Demo = artifacts.require(&quot;ERC4907Demo&quot;);

contract(&quot;test&quot;, async accounts =&gt; {

    it(&quot;should set user to Bob&quot;, async () =&gt; {
        // Get initial balances of first and second account.
        const Alice = accounts[0];
        const Bob = accounts[1];

        const instance = await ERC4907Demo.deployed(&quot;T&quot;, &quot;T&quot;);
        const demo = instance;

        await demo.mint(1, Alice);
        let expires = Math.floor(new Date().getTime()/1000) + 1000;
        await demo.setUser(1, Bob, BigInt(expires));

        let user_1 = await demo.userOf(1);

        assert.equal(
            user_1,
            Bob,
            &quot;User of NFT 1 should be Bob&quot;
        );

        let owner_1 = await demo.ownerOf(1);
        assert.equal(
            owner_1,
            Alice ,
            &quot;Owner of NFT 1 should be Alice&quot;
        );
    });
});


```

run in Terminal：
```
truffle test ./test/test.js
```

## Reference Implementation
Implementation: [`ERC4907.sol`](../assets/eip-4907/contracts/ERC4907.sol)
```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;./IERC4907.sol&quot;;

contract ERC4907 is ERC721, IERC4907 {
    struct UserInfo 
    {
        address user;   // address of user role
        uint64 expires; // unix timestamp, user expires
    }

    mapping (uint256  =&gt; UserInfo) internal _users;

    constructor(string memory name_, string memory symbol_)
     ERC721(name_, symbol_)
     {
     }
    
    /// @notice set the user and expires of an NFT
    /// @dev The zero address indicates there is no user
    /// Throws if `tokenId` is not valid NFT
    /// @param user  The new user of the NFT
    /// @param expires  UNIX timestamp, The new user could use the NFT before expires
    function setUser(uint256 tokenId, address user, uint64 expires) public virtual{
        require(_isApprovedOrOwner(msg.sender, tokenId), &quot;ERC4907: transfer caller is not owner nor approved&quot;);
        UserInfo storage info =  _users[tokenId];
        info.user = user;
        info.expires = expires;
        emit UpdateUser(tokenId, user, expires);
    }

    /// @notice Get the user address of an NFT
    /// @dev The zero address indicates that there is no user or the user is expired
    /// @param tokenId The NFT to get the user address for
    /// @return The user address for this NFT
    function userOf(uint256 tokenId) public view virtual returns(address){
        if( uint256(_users[tokenId].expires) &gt;=  block.timestamp){
            return  _users[tokenId].user;
        }
        else{
            return address(0);
        }
    }

    /// @notice Get the user expires of an NFT
    /// @dev The zero value indicates that there is no user
    /// @param tokenId The NFT to get the user expires for
    /// @return The user expires for this NFT
    function userExpires(uint256 tokenId) public view virtual returns(uint256){
        return _users[tokenId].expires;
    }

    /// @dev See {IERC165-supportsInterface}.
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC4907).interfaceId || super.supportsInterface(interfaceId);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override{
        super._beforeTokenTransfer(from, to, tokenId);

        if (from != to &amp;&amp; _users[tokenId].user != address(0)) {
            delete _users[tokenId];
            emit UpdateUser(tokenId, address(0), 0);
        }
    }
} 
```

## Security Considerations

This EIP standard can completely protect the rights of the owner, the owner can change the NFT user and expires at any time.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 11 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4907</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4907</guid>
      </item>
    
      <item>
        <title>Royalty Bearing NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/royalty-bearing-nfts/8453</comments>
        
        <description>## Abstract

The proposal directly connects NFTs and royalties in a smart contract architecture extending the [ERC-721](./eip-721.md) standard, with the aim of precluding central authorities from manipulating or circumventing payments to those who are legally entitled to them.

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/De-Listing/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. 

## Motivation

The management of royalties is an age-old problem characterized by complex contracts, opaque management, plenty of cheating and fraud. 

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. 

In the example below, the artist who created the original is eligible to receive proceeds from every sale, and resale, of a print. 

![Fig1](../assets/eip-4910/eip-4910-print-families.png)

The basic concept for hierarchical royalties utilizing the above &quot;ancestry concept&quot; is demonstrated in the figure below.

![Fig2](../assets/eip-4910/eip-4910-royalties.png)


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.

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.

## Specification

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.

### Outline

This proposal introduces several new concepts as extensions to the ERC-721 standard that warrant explanation:

* **Royalty Account (RA)**
    * A Royalty Account is attached to each NFT through its `tokenId` and consists of several sub-accounts which can be accounts of individuals or other RAs. A Royalty Account is identified by an account identifier.
* **Account Type**
    * 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.
* **Royalty Split**
    * The percentage each Sub Account receives based on a sale of an NFT that is associated with an RA
* **Royalty Balance**
    * The royalty balance associated with an RA
* **Sub Account Royalty Balance**
    * 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. 
* **Token Type**
    * Token Type is given as either ETH or the symbol of the supported utility tokens such as `DAI`
* **Asset ID**
    * This is the `tokenId` the RA belongs to.
* **Parent**
    * This indicates which `tokenId` is the immediate parent of the `tokenId` to which an RA belongs.

Below a non-normative overview is given of the data structures and functionality that are covered by the requirements in this document. 

#### Data Structures

In order to create an interconnected data structure linking NFTs to RAs certain global data structures are required:

* A Royalty Account and associated Royalty Sub Accounts to establish the concept of a Royalty Account with sub accounts.
* Connecting a `tokenId` to a Royalty Account identifier.
* A structure mapping parent-to-child NFT relationships.
* A listing of token types and last validated balance (for trading and royalty payment purposes)
* A listing of registered payments to be made in the `executePayment` function and validated in `safeTransferFrom`. This is sufficient, because a payment once received and distributed in the `safeTransferFrom` function will be removed from the listing.
* A listing of NFTs to be sold

#### Royalty Account Functions

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.

#### Minting of a Royalty Bearing NFT

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&apos;s RA. To this end the specification utilizes the `_safemint` function in a newly defined `mint` function and applies various business rules on the input variables.

#### Listing NFTs for Sale and removing a Listing

Authorized user addresses can list NFTs for sale for non-exchange mediated NFT purchases.

#### Payment Function from Buyer to Seller

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.

The payment process depends on whether the payment is received in ETH or an [ERC-20](./eip-20.md) token:

* ERC-20 Token
    1. The Buyer must `approve` the NFT contract for the purchase price, `payment` for the selected payment token (ERC-20 contract address).
    2. For an ERC-20 payment token, the Buyer must then call the `executePayment` in the NFT contract -- the ERC-20 is not directly involved.
* For a non-ERC-20 payment, the Buyer must send a protocol token (ETH) to the NFT contract, and is required to send `msg.data` encoded as an array of purchased NFTs `uint256[] tokenId`.

#### Modified NFT Transfer Function including required Trade data to allocate Royalties

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.

The proposal defines:

* Input parameter validation
* Payment Parameter Validation
* Distributing Royalties
* Update Royalty Account ownership with payout
* Transferring Ownership of the NFT 
* Removing the Payment entry in `registeredPayment` after successful transfer

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.

#### Paying out Royalties to the NFT Owner -- `from` address in `safeTransferFrom` Function

This is the final part of the proposal.

There are two versions of the payout function -- a `public` function and an `internal` function.

The public function has the following interface:

```
function royaltyPayOut (uint256 tokenId, address RAsubaccount, address payable payoutAccount, uint256 amount) public virtual nonReentrant returns (bool)
```

where we only need the `tokenId`, the RA Sub Account address, `_RAsubaccount` which is the `owner`, and the amount to be paid out, `_amount`. Note that the function has `nonReentrant` modifier protection, because funds are being payed out.

To finally send a Payout payment, the following steps need to be taken:

* find the RA Sub Account based on `RAaccount` and the `subaccountPos` and extract the balance
* extract `tokenType` from the Sub Account
* based on the token type, send the payout payment (not exceeding the available balance)

### Data Structures

#### Royalty Account and Royalty Sub Accounts

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.

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;a name=&quot;r1&quot;&gt;**[R1]**&lt;/a&gt; *One or more Royalty Sub-Account MUST be linked to a Royalty Account.*

&lt;a name=&quot;r2&quot;&gt;**[R2]**&lt;/a&gt; *The account identifier of a Royalty Account, `raAccountId`, MUST be unique.*

&lt;a name=&quot;r3&quot;&gt;**[R3]**&lt;/a&gt; *The `tokenId` of a NFT MUST be linked to a `raAccountID` in order to connect an `raAccountId` to a `tokenId`.*


#### Print (Child) NFTs

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;a name=&quot;r4&quot;&gt;**[R4]**&lt;/a&gt; *There MUST be a link for direct parent-child relationships*

#### NFT Payment Tokens

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;a name=&quot;r5&quot;&gt;**[R5]**&lt;/a&gt; *There MUST be a listing of supported token types*

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;a name=&quot;r6&quot;&gt;**[R6]**&lt;/a&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.*

#### NFT Listings and Payments

Since the contract is directly involved in the sales process, a capability to list one or more NFTs for sale is required.

&lt;a name=&quot;r7&quot;&gt;**[R7]**&lt;/a&gt; *There MUST be a list of NFTs for sale.*

&lt;a name=&quot;r8&quot;&gt;**[R8]**&lt;/a&gt; *A sales listing MUST have a unique identifier.*

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;a name=&quot;r9&quot;&gt;**[R9]**&lt;/a&gt; *There MUST be a listing for registered payments*

&lt;a name=&quot;r10&quot;&gt;**[R10]**&lt;/a&gt; *A registered payment MUST have a unique identifier.*

#### Contract Constructor and Global Variables and their update functions

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;a name=&quot;r11&quot;&gt;**[R11]**&lt;/a&gt; *The minimal contract constructor MUST contain the following input elements.*

```
///
/// @dev Definition of the contract constructor
///
/// @param name as in ERC-721
/// @param symbol as in ERC-721
/// @param baseTokenURI as in ERC-721
/// @param allowedTokenTypes is the array of allowed tokens for payment

constructor(
        string memory name,
        string memory symbol,
        string memory baseTokenURI,
        address[] memory allowedTokenTypes
    ) ERC721(name, symbol) {...}
```


### Royalty Account Management

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.

#### Get a Royalty Account

There is only one get function required because a Royalty Account and its sub accounts can be retrieved through the `tokenId` in the `ancestry` field of the Royalty Account. 

&lt;a name=&quot;r12&quot;&gt;**[R12]**&lt;/a&gt; *The `getRoyaltyAccount` function interface MUST adhere to the definition below:*

```
/// @dev Function to fetch a Royalty Account for a given tokenId
/// @param tokenId is the identifier of the NFT to which a Royalty Account is attached
/// @param RoyaltyAccount is a data structure containing the royalty account information
/// @param RASubAccount[] is an array of data structures containing the information of the royalty sub accounts associated with the royalty account

function getRoyaltyAccount (uint256 tokenId) public view virtual returns (address,
            RoyaltyAccount memory,
            RASubAccount[] memory);
```


&lt;a name=&quot;r13&quot;&gt;**[R13]**&lt;/a&gt; *The following business rules MUST be enforced in the `getRoyaltyAccount` function:*

* *`tokenId` exists and is not burned*

#### Update a Royalty Account

In order to update a Royalty Account, the caller must have both the &apos;tokenId&apos; and the `RoyaltyAccount` itself which can be obtained from the Royalty Account getter function. 


&lt;a name=&quot;r14&quot;&gt;**[R14]**&lt;/a&gt; *The `updateRoyaltyAccount` function interface MUST adhere to the definition below:*

```
/// @dev Function to update a Royalty Account and its Sub Accounts
/// @param tokenId is the identifier of the NFT to which the Royalty Account to be updated is attached
/// @param RoyaltyAccount is the Royalty Account and associated Royalty Sub Accounts with updated values  

function updateRoyaltyAccount (uint256 _tokenId, `RoyaltyAccount memory _raAccount) public virtual returns (bool)
```

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;a name=&quot;r15&quot;&gt;**[R15]**&lt;/a&gt; *The business rules for the update function are as follows:*

1. *An NFTs asset identifier MUST NOT be changed.*
2. *An NFTs ancestor MUST NOT be updated.* 
3. *An NFTs token type accepted for payment MUST NOT be updated.* 
4. *The royalty balance in a Royalty Sub Account MUST NOT be changed.*
5. *The royalty split inherited by the children from the NFT parent MUST NOT be changed.*
6. *New royalty split values MUST be larger than, or less than, or equal to any established boundary value for royalty splits, if it exists.*
7. *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.*
8. *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.*
9. *&apos;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* 
    
    9.1 *the Sub Account belonging to the account identifier MUST NOT be removed*
    
    9.2 *A royalty split MUST only be decreased, and either the existing sub account&apos;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.*
    
    9.3 *a royalty balance MUST NOT be changed*
    
    9.4 *an account identifier MUST NOT be NULL*

10. *If `msg.sender` 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* 
    
    10.1 *if the royalty split of the Royalty Sub Account belonging to `msg.sender` is reduced*
    
    * then the royalty balance in each new Royalty Sub Account MUST be zero
    
    * and the sum of the new royalty splits data MUST be equal to the royalty split of the Royalty Sub Account of `msg.sender` before it was modified
    
    10.2 *new account identifier MUST not be NULL*

11. *If the Royalty Account update is correct, the function returns `true`, otherwise `false`.* 

#### Deleting a Royalty Account

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;a name=&quot;r16&quot;&gt;**[R16]**&lt;/a&gt; *The `deleteRoyaltyAccount` function interface MUST adhere to the definition below:*

```
/// @dev Function to delete a Royalty Account
/// @param tokenId is the identifier of the NFT to which the Royalty Account to be updated is attached

function deleteRoyaltyAccount (uint256 _tokenId) public virtual returns (bool)
```

&lt;a name=&quot;r17&quot;&gt;**[R17]**&lt;/a&gt; *The business rules for this function are as follows:*

* *`_tokenId` MUST be burned, i.e., have owner `address(0)`.*
* *all `tokenId` numbers genealogically related to `_tokenId` either as ancestors or offspring MUST also be burnt.* 
* *all balances in the Royalty Sub Accounts MUST be zero.*

### NFT Minting

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;a name=&quot;r18&quot;&gt;**[R18]**&lt;/a&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&apos;s Royalty Account.* 

To this end the specification utilizes the ERC-721 `_safemint` function in a newly defined `mint` function, and applies various business rules on the function&apos;s input variables.

&lt;a name=&quot;d1&quot;&gt;**[D1]**&lt;/a&gt; *Note, that the `mint` function SHOULD have the ability to mint more than one NFT at a time.* 

&lt;a name=&quot;r19&quot;&gt;**[R19]**&lt;/a&gt; *Also, note that the `owner` of a new NFT MUST be the NFT contract itself.* 

&lt;a name=&quot;r20&quot;&gt;**[R20]**&lt;/a&gt; *The non-contract owner of the NFT MUST be set as `isApproved` which allows the non-contract owner to operate just like the `owner`.* 

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 `tokenId`.

&lt;a name=&quot;r21&quot;&gt;**[R21]**&lt;/a&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:*

```
/// @param parent is the parent tokenId of the (child) token, and if set to 0 then there is no parent.
/// @param canBeParent indicates if a tokenId can have children or not.
/// @param maxChildren defines how many children an NFT can have.
/// @param royaltySplitForItsChildren is the royalty percentage split that a child has to pay to its parent.
/// @param uri is the unique token URI of the NFT
```

&lt;a name=&quot;r22&quot;&gt;**[R22]**&lt;/a&gt; *The `mint` function interface MUST adhere to the definition below:*

```
/// @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).
/// @param to is the address to which the NFT(s) are minted
/// @param nfttoken is an array of struct type NFTToken for the meta data of the minted NFT(s)
/// @param tokenType is the type of allowed payment token for the NFT

function mint(address to, NFTToken[] memory nfttoken, address tokenType) public virtual
```

&lt;a name=&quot;r23&quot;&gt;**[R23]**&lt;/a&gt; *The following business rules for the `mint` function&apos;s input data MUST be fulfilled:*

* *The number of tokens to be minted MUST NOT be zero.*
* *`msg.sender` MUST have either the `MINTER_ROLE` or the `CREATOR_Role` identifying the creator of the first NFT.*
* *`to` address MUST NOT be the zero address.*
* *`to` address MUST NOT be a contract, unless it has been whitelisted -- see [Security Considerations](#security-considerations) for more details.* 
* *`tokenType` MUST be a token type supported by the contract.*
* *`royaltySplitForItsChildren` MUST be less or equal to 100% or numerical equivalent thereof less any constraints such as platform fees* 
* *If the new NFT(s) cannot have children, `royaltySplitForItsChildren` MUST be zero.*
* *If the new NFT(s) has a parent, the parent NFT `tokenId` MUST exist.*
* *The ancestry level of the parent MUST be less than the maximum number of allowed NFT generations, if specified.*
* *The number of allowed children for an NFT to be minted MUST be less than the maximum number of allowed children, if specified.*

### Listing and De-Listing of NFTs for Direct Sales

In the sales process, we need to minimally distinguish two types of transactions

* Exchange-mediated sales
* Direct sales

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;a name=&quot;r24&quot;&gt;**[R24]**&lt;/a&gt; *For direct sales, NFT listing, und de-listing, transactions MUST be executed through the NFT smart contract.*   

Exchange-mediated sales will be discussed when this document discusses payments.

In direct sales, authorized user addresses can list NFTs for sale, see the business rules below.

&lt;a name=&quot;r25&quot;&gt;**[R25]**&lt;/a&gt; *The `listNFT` function interface MUST adhere to the definition below:*

```
/// @dev Function to list one or more NFTs for direct sales
/// @param tokenIds is the array of tokenIds to be included in the listing
/// @param price is the price set by the owner for the listed NFT(s)
/// @param tokenType is the payment token type allowed for the listing

function listNFT (uint256[] calldata tokenIds, uint256 price, address tokenType) public virtual returns (bool)
```

The Boolean return value is `true` for a successful function execution, and `false` for an unsuccessful function execution.

&lt;a name=&quot;r26&quot;&gt;**[R26]**&lt;/a&gt; *The business rules of the `listNFT` function are as follows:*

* there MUST NOT already be a listing for one or more NFTs in the `listedNFT` mapping of the proposed listing.
* `seller` MUST be equal to `getApproved(tokenId[i])` for all NFTs in the proposed listing.
* `tokenType` MUST be supported by the smart contract.
* `price` MUST be larger than `0`.

&lt;a name=&quot;r27&quot;&gt;**[R27]**&lt;/a&gt; *If the conditions in [**[R26]**](#r26) are met, then the NFT sales list MUST be updated.*

Authorized user addresses can also remove a direct sale listing of NFTs. 

&lt;a name=&quot;r28&quot;&gt;**[R28]**&lt;/a&gt; *The `removeNFTListing` function interface MUST adhere to the definition below:*

```
/// @dev Function to de-list one or more NFTs for direct sales
/// @param listingId is the identifier of the NFT listing

function removeNFTListing (uint256 listingId) public virtual returns (bool)
```

The Boolean return value is `true` for a successful function execution, and `false` for an unsuccessful function execution.

&lt;a name=&quot;r29&quot;&gt;**[R29]**&lt;/a&gt; *The business rules of the `removeNFTListing` function below MUST be adhered to:*

* *the registered payment entry MUST be NULL*
* *`msg.sender = getApproved(tokenId)` for the NFT listing* 

&lt;a name=&quot;r30&quot;&gt;**[R30]**&lt;/a&gt; *If the conditions in [**[R29]**](#r29) are met, then the NFT sales listing MUST be removed.*

### Payments for NFT Sales

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;a name=&quot;r31&quot;&gt;**[R31]**&lt;/a&gt; *The payment process requires either one or two steps:*

1. *For an ERC-20 token*
    * *The buyer MUST `approve` the NFT contract for the purchase price, `payment`, for the selected payment token type.*
    * *The buyer MUST call the `executePayment` function.*
2. *For a protocol token* 
    * *The buyer MUST call a payment fallback function with `msg.data` not NULL.*

&lt;a name=&quot;r32&quot;&gt;**[R32]**&lt;/a&gt; *For an ERC-20 token type, the required `executePayment` function interface MUST adhere to the definition below*:

```
/// @dev Function to make a NFT direct sales or exchange-mediate sales payment
/// @param receiver is the address of the receiver of the payment
/// @param seller is the address of the NFT seller 
/// @param tokenIds are the tokenIds of the NFT to be bought
/// @param payment is the amount of that payment to be made
/// @param tokenType is the type of payment token
/// @param trxnType is the type of payment transaction -- minimally direct sales or exchange-mediated

function executePayment (address receiver, address seller, uint 256[] tokenIds, uint256 payment, string tokenType, int256 trxnType) public virtual nonReentrant returns (bool)
```

The Boolean return value is `true` for a successful function execution, and `false` for an unsuccessful function execution.

&lt;a name=&quot;r33&quot;&gt;**[R33]**&lt;/a&gt; *Independent of `trxnType`, the business rules for the input data are as follows:*

* *All purchased NFTs in the `tokenIds` array MUST exist and MUST NOT be burned.*
* *`tokenType` MUST be a supported token.*
* *`trxnType` MUST be set to either `0` (direct sale) or `1` (exchange-mediate sale), or another supported type.*
* *`receiver` MAY be NULL but MUST NOT be the Zero Address.*
* *`seller` MUST be the address in the corresponding listing.*
* *`msg.sender` MUST not be a contract, unless it is whitelisted in the NFT contract.*

In the following, this document will only discuss the differences between the two minimally required transaction types.

&lt;a name=&quot;r34&quot;&gt;**[R34]**&lt;/a&gt; *For `trxnType = 0`, the payment data MUST to be validated against the listing, based on the following rules:*

* *NFT(s) MUST be listed*
* *`payment` MUST be larger or equal to the listing price.*
* *The listed NFT(s) MUST match the NFT(s) in the payment data.* 
* *The listed NFT(s) MUST be controlled by `seller`.*

&lt;a name=&quot;r35&quot;&gt;**[R35]**&lt;/a&gt; *If all checks in [**[R33]**](#r33), and in [**[R34]**](#r34) for `trxnType = 0`, are passed, the `executePayment` function MUST call the `transfer` function in the ERC-20 contract identified by `tokenType` with `recipient = address(this)` and `amount = payment`.* 

Note the NFT contract pays itself from the available allowance set in the `approve` transaction from the buyer.

&lt;a name=&quot;r36&quot;&gt;**[R36]**&lt;/a&gt; *For `trxnType = 1`, and for a successful payment, the `registeredPayment` mapping MUST updated with the payment, such that it can be validated when the NFT is transferred in a separate `safeTransferFrom` call, and `true` MUST be returned as the return value of the function, if successful, `false` otherwise.*

&lt;a name=&quot;r37&quot;&gt;**[R37]**&lt;/a&gt; *For `trxnType = 0`, an `internal` version of the `safeTransferFrom` function with message data MUST be called to transfer the NFTs to the buyer, and upon success, the buyer MUST be given the `MINTER_ROLE`, unless the buyer already has that role.*

Note, the `_safeTransferFrom` function has the same structure as `safeTransferFrom` but skips the input data validation.

&lt;a name=&quot;r38&quot;&gt;**[R38]**&lt;/a&gt; *For `trxnType = 0`, and if the NFT transfer is successful, the listing of the NFT MUST be removed.* 

&lt;a name=&quot;r39&quot;&gt;**[R39]**&lt;/a&gt; *For a protocol token as a payment token, and independent of `trxnType`, the buyer MUST send protocol tokens to the NFT contract as the escrow, and `msg.data` MUST encode the array of paid for NFTs `uint256[] tokenIds`.*

&lt;a name=&quot;r40&quot;&gt;**[R40]**&lt;/a&gt; *For the NFT contract to receive a protocol token, a payable fallback function (`fallback() external payable`) MUST be implemented.*

Note that since the information for which NFTs the payment was for must be passed, a simple `receive()` fallback function cannot be allowed since it does not allow for `msg.data` to be sent with the transaction.

&lt;a name=&quot;r41&quot;&gt;**[R41]**&lt;/a&gt; *`msg.data` for the fallback function MUST minimally contain the following data:
`address memory seller, uint256[] memory _tokenId, address memory receiver, int256 memory trxnType`*

&lt;a name=&quot;r42&quot;&gt;**[R42]**&lt;/a&gt; *If `trxnType` is not equal to either &apos;0&apos; or &apos;1&apos;, or another supported type, then the fallback function MUST `revert`.*

&lt;a name=&quot;r43&quot;&gt;**[R43]**&lt;/a&gt; *For `trxnType` equal to either &apos;0&apos; or &apos;1&apos;, the requirements [**[R33]**](#r33) through [**[R38]**](#r38) MUST be satisfied for the fallback function to successfully execute, otherwise the fallback function MUST `revert`.*

&lt;a name=&quot;r44&quot;&gt;**[R44]**&lt;/a&gt; *In case of a transaction failure (for direct sales, `trxnType = 0`), or the buyer of the NFT listing changing their mind (for exchange-mediated sales, `trxnType = 1`), the submitted payment MUST be able to revert using the `reversePayment` function where the function interface is defined below:*

```
/// @dev Definition of the function enabling the reversal of a payment before the sale is complete
/// @param paymentId is the unique identifier for which a payment was made
/// @param tokenType is the type of payment token used in the payment
function reversePayment(uint256 paymentId, string memory tokenType) public virtual returns (bool)
```

The Boolean return value is `true` for a successful function execution, and `false` for an unsuccessful function execution.

Note, `reentrancy` protection through e.g. `nonReentrant` from the Open Zeppelin library is strongly advised since funds are being paid out.

&lt;a name=&quot;r45&quot;&gt;**[R45]**&lt;/a&gt; *The business rules for the `reversePayment` function are as follows:*

* *There MUST be registered payment for a given `paymentId` and `tokenType`.*
* *`msg.sender` MUST be the buyer address in the registered payment.*
* *The payment amount must be larger than `0`.*
* *The registered payment MUST be removed when the payment has been successfully reverted, otherwise the function must fail.*


### Modified NFT Transfer function

This document adheres to the ERC-721 interface format for the `safeTransferFrom` function as given below:

```
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) external virtual override
```

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 `tokenId` only for the first NFT to be transferred. All other transfer relevant data is encoded in `_data`. 

The high-level requirements are as follows:

* The payment parameters of the trade encoded in `_data` must be validated.
* The seller and the sold NFT token(s) must exist, and the seller must be the owner of the token.
* `msg.sender` must be the seller address or an approved address.
* the payment of the trade received by the NFT smart contract is correctly disbursed to all Royalty Sub Account owners.
* the NFT token is transferred after all Royalty Sub Accounts and their holders associated with the NFT token(s) have been properly credited.

Also, note that in order to avoid royalty circumvention attacks, there is only one NFT transfer function. 

&lt;a name=&quot;r46&quot;&gt;**[R46]**&lt;/a&gt; *Therefore, `transferFrom` and `safeTransferFrom` without `data` MUST be disabled.*

This can be achieved through for example a `revert` statement in an `override` function.

&lt;a name=&quot;r47&quot;&gt;**[R47]**&lt;/a&gt; *The requirements on input parameters of the function are as follows*:

* *`from` MUST not be `address(0)`.*
* *`from` MUST be the owner or `approved` for `tokenId` and the other tokens included in `_data`.*
* *`from` MUST not be a smart contract unless whitelisted.*
* *a Royalty Account MUST be associated to `tokenId` and the other tokens included in `_data`.*
* *`_data` MUST NOT be NULL.*
* *`msg.sender` MUST be equal to `from` or an `approved` address, or a whitelisted contract.*

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.

Turning to the `_data` object.

&lt;a name=&quot;r48&quot;&gt;**[R48]**&lt;/a&gt; *The `_data` object MUST minimally contain the following payment parameters:*

* *Seller Address as `address`.*
* *Buyer Address as `address`.*
* *Receiver Address as `address.*
* *Token identifiers as `uint256[]`.*
* *Token type used for payment.*
* *Payment amount paid to NFT contract as `uint256`.*
* *a registered payment identifier.*
* *blockchain ID, `block.chainid`, of the underlying blockchain.*

&lt;a name=&quot;r49&quot;&gt;**[R49]**&lt;/a&gt; *The following business rules MUST be met for the payment data in &apos;_data&apos;:*

* *`seller == from`.*
* *`tokenId[0] == tokenId`.*
* *Each token in `_tokenId` has an associated Royalty Account.*
* *`chainid == block.chainid`.*
* *`buyer` is equal to the buyer address in the registered payment for the given ``paymentId.*
* *`receiver == to`.*
* *the receiver of the token is not the seller.*
* *the receiver of the token is not a contract or is a whitelisted contract*
* *For all NFTs in the payment, `tokenId[i] = registeredPayment[paymentId].boughtTokens[i]`.*
* *`tokenType` is supported in the contract.* 
* *`allowedToken[tokenType]` is not NULL.*
* *`tokenType = registeredPayment[paymentId].tokenType`.*
* *`payment &gt; lastBalanceAllowedToken[allowedToken[listingId]]`.*
* *`payment = registeredPayment[paymentId].payment`.*

### Distributing Royalties in the Transfer Function

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.

Note, that the distribution function assumes that the payment made is for ALL tokens in the requested transfer. That means, that `payment` for the distribution function is equally divided between all NFTs included in the payment. 

&lt;a name=&quot;r5&quot;&gt;**[R50]**&lt;/a&gt; *The `distributePayment` function interface MUST adhere to the definition below:

```
/// @dev Function to distribute a payment as royalties to a chain of Royalty Accounts
/// @param tokenId is a tokenId included in the sale and used to look up the associated Royalty Account
/// @param payment is the payment (portion) to be distributed as royalties

function distributePayment (uint256 tokenId, uint265 payment) internal virtual returns (bool)
```

The Boolean return value is `true` for a successful function execution, and `false` for an unsuccessful function execution.

As mentioned before, the internal `distributePayment` function is called within the modified `safeTransferFrom` function.

Note, that it is necessary to multiply two `uint256` numbers with each other -- the payment amount with the royalty split percentage expressed as a whole number e.g. `10000 = 100%`. And then divide the result by the whole number representing `100%` 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;a name=&quot;r51&quot;&gt;**[R51]**&lt;/a&gt; *The processing logic of `distributePayment` function MUST be as follows:*

* *Load the Royalty Account (`RA`) and associated Royalty Sub Accounts using the passed `tokenId`.*
* *For each Royalty Sub Account in `RA` apply the following rules:*
    * *If a Royalty Sub Account in `RA` has `isIndividual` set to `true` then*
        * *apply the royalty percentage of that Royalty Sub Account to `payment` and add the calculated amount, e.g. `royaltyAmountTemp`, to the `royaltybalance` of that Royalty Sub Account.*
        * *emit an event as a notification of payment to the `accountId` of the Royalty Sub Account containing: assetId, accountId, tokenType, royaltybalance.*
        * *in the RA add `royaltyamountTemp` amount to `balance`*
    * *If a Royalty Sub Account in `RA` has `isIndividual` set to `false` then*
        * *apply the royalty percentage of that Royalty Sub Account to `payment` and store temporarily in a new variable e.g. `RApaymenttemp`, but do not update the `royaltybalance` of the Royalty Sub Account which remains `0`.*
    * *then use `ancestor` to obtain the `RA` connected to `ancestor` e.g. via a look up through a Royalty Account mapping.*
    * *load the new RA*
        * *if `isIndividual` of the Royalty Sub Account is set to `true`, pass through the Royalty Sub Accounts of the next `RA`, and apply the rule for `isIndividual = true`.*
        * *if `isIndividual` of the Royalty Sub Account is set to `false`, pass through the Royalty Sub Accounts of the next `RA`, and apply the rule for `isIndividual = false`.*
    * *Repeat the procedures for `isIndividual` equal to `true` and `false` until a `RA` is reached that does not have an `ancestor`, and where all Royalty Sub Accounts have`isIndividual` set to `true`, and apply the rule for a Royalty Sub Account that has `isIndividual` set to `true` to all Royalty Sub Accounts in that `RA`.*

### Update Royalty Sub Account Ownership with Payout to approved Address (`from`)

In order to simplify the ownership transfer, first the approved address -- the non-contract NFT owner --, `from`, is paid out its share of the royalties. And then the Royalty Sub Account is updated with the new owner, `to`. This step repeats for each token to be transferred.

&lt;a name=&quot;r52&quot;&gt;**[R52]**&lt;/a&gt; *The business rules are as follows:*

* *the internal version of the`royaltyPayOut` function MUST pay out the entire royalty balance of the Royalty Sub Account owned by the `from` address to the `from` address.*
* *the Royalty Sub Account MUST only be updated with the new owner only once the payout function has successfully completed and the `royaltybalance = 0`.*

The last step in the process chain is transferring the NFTs in the purchase to the `to` address. 

&lt;a name=&quot;r53&quot;&gt;**[R53]**&lt;/a&gt; *For every NFT (in the batch) the &apos;to&apos; address MUST be `approved&apos; (ERC-721 function) to complete the ownership transfer:* 

```
_approve(to, tokenId[i]);
```

The technical NFT owner remains the NFT contract.

### Removing the Payment Entry after successful Transfer

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;a name=&quot;r54&quot;&gt;**[R54]**&lt;/a&gt; *After the `approve` relationship has been successfully updated to the `to` address, the registered payment MUST be removed.*

### Paying out Royalties to the `from` Address in `safeTransferFrom` Function

There are two versions of the payout function -- a `public` and an `internal` function -- depending on whether there is a payout during a purchase, or a payout is requested by a Royalty Sub Account owner.

&lt;a name=&quot;r55&quot;&gt;**[R55]**&lt;/a&gt; *The public `royaltyPayOut` function interface MUST adhere to the definition below:*

```
/// @dev Function to payout a royalty payment
/// @param tokenId is the identifier of the NFT token
/// @param RAsubaccount is the address of the Royalty Sub Account from which the payout should happen
/// @param receiver is the address to receive the payout
/// @param amount is the amount to be paid out

function royaltyPayOut (uint256 tokenId, address RAsubaccount, address payable payoutAccount, uint256 amount) public virtual nonReentrant returns (bool)
```

The Boolean return value is `true` for a successful function execution, and `false` for an unsuccessful function execution.

Note, that the function has `reentrancy` protection through `nonReentrant` from the Open Zeppelin library since funds are being paid out.

&lt;a name=&quot;r56&quot;&gt;**[R56]**&lt;/a&gt; *The input parameters of the `royaltyPayOut` function MUST satisfy the following requirements:*

* *`msg.sender == RAsubaccount`.*
* *`tokenId` must exist and must not be burned.*
* *`tokenId` must be associated with a Royalty Account.*
* *`RAsubaccount` must be a valid `accountId` in a Royalty Sub Account of the Royalty Account of the `tokenId&apos;.*
* *`isIndividual == true` for the Royalty Sub Account, `RAsubaccount`.*
* *`amount &lt;= royaltybalance` of the Royalty Sub Account, `RAsubaccount.*`

&lt;a name=&quot;r57&quot;&gt;**[R57]**&lt;/a&gt; *The internal `_royaltyPayOut` function interface MUST adhere to the definition below*:

```
function _royaltyPayOut (uint256 tokenId, address RAsubaccount, address payable payoutAccount, uint256 amount) public virtual returns (bool)
```

&lt;a name=&quot;r58&quot;&gt;**[R58]**&lt;/a&gt; *The internal `_royaltyPayOut` function MUST perform the following actions:

* *send the payment to the `payoutaccount`.*
* *update the `royaltybalance` of the `RAsubaccount` of the Royalty Account upon successful transfer.*

&lt;a name=&quot;r59&quot;&gt;**[R59]**&lt;/a&gt; *The following steps MUST be taken to send out a royalty payment to its recipient:*

* *find the Royalty Sub Account.*
* *extract `tokenType` from the Royalty Sub Account.*
* *based on the token type send to the `payoutAccount` either*
    * *&apos;ETH&apos; / relevant protocol token or*
    * *another token based on token type* 
* *and only if the payout transaction is successful, deduct `amount` from `royaltybalance` of the Royalty Sub Account,`RAsubaccount`, and then return `true` as the function return parameter, otherwise return `false`.* 

## Rationale

Royalties for NFTs is at its core a distribution licensing problem. A buyer obtains the right to an asset/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. 

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 `distributePayment` function and the NFT data structures allowing for the tree structure e.g. `ancestry`,`royaltyAccount`, `RAsubaccount`. 

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 `royaltyAccount`, &apos;RAsubaccount&apos; 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 `royaltyPayout` function design.

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. 

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.

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 `approved` address. 

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:

* ERC-20 Token
    1. The Buyer must `approve` the NFT contract for the purchase price, `payment` for the selected payment token (ERC-20 contract address).
    2. For an ERC-20 payment token, the Buyer must then call the `executePayment` in the NFT contract -- the ERC-20 is not directly involved.
* 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.

In addition, the `executePayment` 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.

The `executePayment` 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.

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 -- `safeTransferFrom`. 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.

Finally the specification needed to take into account that NFTs must be able to be `minted` and `burned` to maintain compliance with the ERC-721 specification while also having to set up all the data structures for the tree.

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&apos;s royalty account to enforces the tree structure. To this end the specification utilizes the ERC-721 `_safemint` function in a newly defined `mint` function and applies various business rules on the input variables required to ensure proper set-up.

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.
 

## Backwards Compatibility

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.

## Test Cases

A full test suite is part of the reference implementation.

## Reference Implementation

The Treetrunk reference implementation of the standard can be found in the public treetrunkio Github repo under treetrunk-nft-reference-implementation.

## Security Considerations

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:

* **Payments and Payouts**:
    * Reentrancy attacks are mitigated through a reentrancy protection on all payment functions. See for example the Open Zeppelin reference implementation .
    * Payouts from unauthorized accounts. Mitigation: Royalty Sub Accounts require at least that `msg.sender` is the Royalty Sub Account owner.
    * Payments could get stuck in the NFT contract if the `executePayment` function fails. Mitigation: For exchange-mediated sales, a buyer can always reverse a payment with `reversePayment` if the `executePayment` function fails. For direct sales, `reversePayment` will be directly triggered in the `executePayment` function.
* **Circumventing Royalties**:
    * Offchain Key exchanges
        * Exchanging a private key for money off chain can not be prevented in any scenario. 
    * Smart Contract Wallets as NFT owners
        * 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.
    * Denial of Royalty Disbursement 
        * 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 `maxGeneration` 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.
        * Following the same approach as above but now targeting the `addListNFT` function, an attacker can force an out of gas error or run time errors in the `executePayment` 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.
        * 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 `maxNumberGeneration` by the creator.
    * 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. 
* **Phishing Attacks**
    * NFT phishing attacks often target the `approve` and `setApprovalForAll` 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 `_approve` function. Calling the public `approve` function will cause the function call to error out because `msg.sender` of the malicious transaction cannot be the NFT owner.
    * NFT phishing attack targeting the `addListNFT` 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 `removeListNFT` 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. 

Besides the usage of professional security analysis tools, it is also recommended that each implementation performs a security audit of its implementation.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 14 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4910</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4910</guid>
      </item>
    
      <item>
        <title>Generic Token Upgrade Standard</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4931-generic-token-upgrade-standard/8687</comments>
        
        <description>## Abstract

The following standard allows for the implementation of a standard API for [ERC-20](./eip-20.md) 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.). 

## Motivation

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.

## Specification
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.

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.
### Token Upgrade Interface Contract
``` solidity
interface IEIP4931 {
```
#### Methods

##### upgradeSource

Returns the address of the original (source) token that will be upgraded.

``` solidity
/// @dev A getter to determine the contract that is being upgraded from (&quot;source contract&quot;)
/// @return The address of the source token contract
function upgradeSource() external view returns(address)
```

##### upgradeDestination

Returns the address of the token contract that is being upgraded to. 

``` solidity
/// @dev A getter to determine the contract that is being upgraded to (&quot;destination contract&quot;)
/// @return The address of the destination token contract
function upgradeDestination() external view returns(address)
```

##### isUpgradeActive

Returns the current status of the upgrade functionality. Status MUST return `true` when the upgrade contract is functional and serving upgrades. It MUST return `false` when the upgrade contract is not currently serving upgrades.

``` solidity
/// @dev The method will return true when the contract is serving upgrades and otherwise false
/// @return The status of the upgrade as a boolean
function isUpgradeActive() external view returns(bool)
```
##### isDowngradeActive

Returns the current status of the downgrade functionality. Status MUST return `true` when the upgrade contract is functional and serving downgrades. It MUST return `false` when the upgrade contract is not currently serving downgrades. When the downgrade Optional Ext. is not implemented, this method will always return `false` to signify downgrades are not available.

``` solidity
/// @dev The method will return true when the contract is serving downgrades and otherwise false
/// @return The status of the downgrade as a boolean
function isDowngradeActive() external view returns(bool)
```
##### ratio

Returns the ratio of destination token to source token, expressed as a 2-tuple, that the upgrade will use. E.g. `(3, 1)` means the upgrade will provide 3 destination tokens for every 1 source token being upgraded.

``` solidity
/// @dev A getter for the ratio of destination tokens to source tokens received when conducting an upgrade
/// @return Two uint256, the first represents the numerator while the second represents
/// the denominator of the ratio of destination tokens to source tokens allotted during the upgrade
function ratio() external view returns(uint256, uint256)
```

##### totalUpgraded

Returns the total number of tokens that have been upgraded from source to destination. If the downgrade Optional Ext. is implemented, calls to `downgrade` will reduce the `totalUpgraded` return value making it possible for the value to decrease between calls. The return value will be strictly increasing if downgrades are not implemented.

``` solidity
/// @dev A getter for the total amount of source tokens that have been upgraded to destination tokens.
/// The value may not be strictly increasing if the downgrade Optional Ext. is implemented.
/// @return The number of source tokens that have been upgraded to destination tokens
function totalUpgraded() external view returns(uint256)
```
##### computeUpgrade

Computes the `destinationAmount` of destination tokens that correspond to a given `sourceAmount` of source tokens, according to the predefined conversion ratio, as well as the `sourceRemainder` amount of source tokens that can&apos;t be upgraded. For example, let&apos;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, `computeUpgrade(5)` must return `(6, 1)`, meaning that 6 destination tokens are expected (in this case, from 4 source tokens) and 1 source token is left as remainder.
``` solidity
/// @dev A method to mock the upgrade call determining the amount of destination tokens received from an upgrade
/// as well as the amount of source tokens that are left over as remainder
/// @param sourceAmount The amount of source tokens that will be upgraded
/// @return destinationAmount A uint256 representing the amount of destination tokens received if upgrade is called
/// @return sourceRemainder A uint256 representing the amount of source tokens left over as remainder if upgrade is called
function computeUpgrade(uint256 sourceAmount) external view
        returns (uint256 destinationAmount, uint256 sourceRemainder)
```

##### computeDowngrade (Optional Ext.)

Computes the `sourceAmount` of source tokens that correspond to a given `destinationAmount` of destination tokens, according to the predefined conversion ratio, as well as the `destinationRemainder` amount of destination tokens that can&apos;t be downgraded. For example, let&apos;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, `computeDowngrade(13)` must return `(4, 1)`, meaning that 4 source tokens are expected (in this case, from 12 destination tokens) and 1 destination token is left as remainder.
``` solidity
/// @dev A method to mock the downgrade call determining the amount of source tokens received from a downgrade
/// as well as the amount of destination tokens that are left over as remainder
/// @param destinationAmount The amount of destination tokens that will be downgraded
/// @return sourceAmount A uint256 representing the amount of source tokens received if downgrade is called
/// @return destinationRemainder A uint256 representing the amount of destination tokens left over as remainder if upgrade is called
function computeDowngrade(uint256 destinationAmount) external view
        returns (uint256 sourceAmount, uint256 destinationRemainder)
```


##### upgrade

Upgrades the `amount` of source token to the destination token in the specified ratio. The destination tokens will be sent to the `_to` 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 `throw` if the caller&apos;s address does not have enough source token to upgrade or if `isUpgradeActive` is returning `false`. The function MUST also fire the `Upgrade` event. `approve` MUST be called first on the source contract.
``` solidity
/// @dev A method to conduct an upgrade from source token to destination token.
/// The call will fail if upgrade status is not true, if approve has not been called
/// on the source contract, or if sourceAmount is larger than the amount of source tokens at the msg.sender address.
/// If the ratio would cause an amount of tokens to be destroyed by rounding/truncation, the upgrade call will
/// only upgrade the nearest whole amount of source tokens returning the excess to the msg.sender address. 
/// Emits the Upgrade event
/// @param _to The address the destination tokens will be sent to upon completion of the upgrade
/// @param sourceAmount The amount of source tokens that will be upgraded 
function upgrade(address _to, uint256 sourceAmount) external
```


##### downgrade (Optional Ext.)
Downgrades the `amount` of destination token to the source token in the specified ratio. The source tokens will be sent to the `_to` address. The function MUST unwrap the destination tokens back to the source tokens. The function MUST `throw` if the caller&apos;s address does not have enough destination token to downgrade or if `isDowngradeActive` is returning `false`. The function MUST also fire the `Downgrade` event. `approve` MUST be called first on the destination contract.
``` solidity
/// @dev A method to conduct a downgrade from destination token to source token.
/// The call will fail if downgrade status is not true, if approve has not been called
/// on the destination contract, or if destinationAmount is larger than the amount of destination tokens at the msg.sender address.
/// If the ratio would cause an amount of tokens to be destroyed by rounding/truncation, the downgrade call will only downgrade
/// the nearest whole amount of destination tokens returning the excess to the msg.sender address. 
///  Emits the Downgrade event
/// @param _to The address the source tokens will be sent to upon completion of the downgrade
/// @param destinationAmount The amount of destination tokens that will be downgraded 
function downgrade(address _to, uint256 destinationAmount) external
```

#### Events

##### Upgrade

MUST trigger when tokens are upgraded.

``` solidity
/// @param _from Address that called upgrade
/// @param _to Address that destination tokens were sent to upon completion of the upgrade
/// @param sourceAmount Amount of source tokens that were upgraded
/// @param destinationAmount Amount of destination tokens sent to the _to address
event Upgrade(address indexed _from, address indexed _to, uint256 sourceAmount, uint256 destinationAmount)
```

##### Downgrade (Optional Ext.)

MUST trigger when tokens are downgraded.

``` solidity
/// @param _from Address that called downgrade
/// @param _to Address that source tokens were sent to upon completion of the downgrade
/// @param sourceAmount Amount of source tokens sent to the _to address
/// @param destinationAmount Amount of destination tokens that were downgraded
event Downgrade(address indexed _from, address indexed _to, uint256 sourceAmount, uint256 destinationAmount)
}
```

## Rationale
There have been several notable ERC20 upgrades (Ex. Golem: GNT -&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  `upgrade` method. The agreed upon norm is that burnable tokens shall be burned. Otherwise, tokens shall be effectively burned by being sent to the `0x00` 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 `upgrade` and `downgrade` from artificially inflating the supply of either token (source or destination).

## Backwards Compatibility
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.

## Reference Implementation
``` solidity
//SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.9;

import &quot;@openzeppelin/contracts/token/ERC20/IERC20.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol&quot;;
import &quot;./IEIP4931.sol&quot;;

contract SourceUpgrade is  IEIP4931 {
	using SafeERC20  for IERC20;

	uint256 constant RATIO_SCALE = 10**18;
    
	IERC20 private source;
	IERC20 private destination;
	bool private upgradeStatus;
	bool private downgradeStatus;
	uint256 private numeratorRatio;
	uint256 private denominatorRatio;
	uint256 private sourceUpgradedTotal;

	mapping(address =&gt; uint256) public upgradedBalance;

	constructor(address _source, address _destination, bool _upgradeStatus, bool _downgradeStatus, uint256 _numeratorRatio, uint256 _denominatorRatio) {
		require(_source != _destination, &quot;SourceUpgrade: source and destination addresses are the same&quot;);
		require(_source != address(0), &quot;SourceUpgrade: source address cannot be zero address&quot;);
		require(_destination != address(0), &quot;SourceUpgrade: destination address cannot be zero address&quot;);
		require(_numeratorRatio &gt; 0, &quot;SourceUpgrade: numerator of ratio cannot be zero&quot;);
		require(_denominatorRatio &gt; 0, &quot;SourceUpgrade: denominator of ratio cannot be zero&quot;);

		source = IERC20(_source);
		destination = IERC20(_destination);
		upgradeStatus = _upgradeStatus;
		downgradeStatus = _downgradeStatus;
		numeratorRatio = _numeratorRatio;
		denominatorRatio = _denominatorRatio;
	}

	/// @dev A getter to determine the contract that is being upgraded from (&quot;source contract&quot;)
	/// @return The address of the source token contract
	function upgradeSource() external view returns(address) {
		return address(source);
	}

	/// @dev A getter to determine the contract that is being upgraded to (&quot;destination contract&quot;)
	/// @return The address of the destination token contract
	function upgradeDestination() external view returns(address) {
		return address(destination);
	}

	/// @dev The method will return true when the contract is serving upgrades and otherwise false
	/// @return The status of the upgrade as a boolean
	function isUpgradeActive() external view returns(bool) {
		return upgradeStatus;
	}

	/// @dev The method will return true when the contract is serving downgrades and otherwise false
	/// @return The status of the downgrade as a boolean
	function isDowngradeActive() external view returns(bool) {
		return downgradeStatus;
	}

	/// @dev A getter for the ratio of destination tokens to source tokens received when conducting an upgrade
	/// @return Two uint256, the first represents the numerator while the second represents
	/// the denominator of the ratio of destination tokens to source tokens allotted during the upgrade
	function ratio() external view returns(uint256, uint256) {
		return (numeratorRatio, denominatorRatio);
	}

	/// @dev A getter for the total amount of source tokens that have been upgraded to destination tokens.
	/// The value may not be strictly increasing if the downgrade Optional Ext. is implemented.
	/// @return The number of source tokens that have been upgraded to destination tokens
	function totalUpgraded() external view returns(uint256) {
		return sourceUpgradedTotal;
	}

	/// @dev A method to mock the upgrade call determining the amount of destination tokens received from an upgrade
	/// as well as the amount of source tokens that are left over as remainder
	/// @param sourceAmount The amount of source tokens that will be upgraded
	/// @return destinationAmount A uint256 representing the amount of destination tokens received if upgrade is called
	/// @return sourceRemainder A uint256 representing the amount of source tokens left over as remainder if upgrade is called
	function computeUpgrade(uint256 sourceAmount)
		public
		view
		returns (uint256 destinationAmount, uint256 sourceRemainder)
	{
		sourceRemainder = sourceAmount % (numeratorRatio / denominatorRatio);
		uint256 upgradeableAmount = sourceAmount - (sourceRemainder * RATIO_SCALE);
		destinationAmount = upgradeableAmount * (numeratorRatio / denominatorRatio);
	}

	/// @dev A method to mock the downgrade call determining the amount of source tokens received from a downgrade
	/// as well as the amount of destination tokens that are left over as remainder
	/// @param destinationAmount The amount of destination tokens that will be downgraded
	/// @return sourceAmount A uint256 representing the amount of source tokens received if downgrade is called
	/// @return destinationRemainder A uint256 representing the amount of destination tokens left over as remainder if upgrade is called
	function computeDowngrade(uint256 destinationAmount)
		public
		view
		returns (uint256 sourceAmount, uint256 destinationRemainder)
	{
		destinationRemainder = destinationAmount % (denominatorRatio / numeratorRatio);
		uint256 upgradeableAmount = destinationAmount - (destinationRemainder * RATIO_SCALE);
		sourceAmount = upgradeableAmount / (denominatorRatio / numeratorRatio);
	}

	/// @dev A method to conduct an upgrade from source token to destination token.
	/// The call will fail if upgrade status is not true, if approve has not been called
	/// on the source contract, or if sourceAmount is larger than the amount of source tokens at the msg.sender address.
	/// If the ratio would cause an amount of tokens to be destroyed by rounding/truncation, the upgrade call will
	/// only upgrade the nearest whole amount of source tokens returning the excess to the msg.sender address.
	/// Emits the Upgrade event
	/// @param _to The address the destination tokens will be sent to upon completion of the upgrade
	/// @param sourceAmount The amount of source tokens that will be upgraded
	function upgrade(address _to, uint256 sourceAmount) external {
		require(upgradeStatus == true, &quot;SourceUpgrade: upgrade status is not active&quot;);
		(uint256 destinationAmount, uint256 sourceRemainder) = computeUpgrade(sourceAmount);
		sourceAmount -= sourceRemainder;
		require(sourceAmount &gt; 0, &quot;SourceUpgrade: disallow conversions of zero value&quot;);

		upgradedBalance[msg.sender] += sourceAmount;
		source.safeTransferFrom(
			msg.sender,
			address(this),
			sourceAmount
			);
		destination.safeTransfer(_to, destinationAmount);
		sourceUpgradedTotal += sourceAmount;
		emit Upgrade(msg.sender, _to, sourceAmount, destinationAmount);
	}

	/// @dev A method to conduct a downgrade from destination token to source token.
	/// The call will fail if downgrade status is not true, if approve has not been called
	/// on the destination contract, or if destinationAmount is larger than the amount of destination tokens at the msg.sender address.
	/// If the ratio would cause an amount of tokens to be destroyed by rounding/truncation, the downgrade call will only downgrade
	/// the nearest whole amount of destination tokens returning the excess to the msg.sender address.
	///  Emits the Downgrade event
	/// @param _to The address the source tokens will be sent to upon completion of the downgrade
	/// @param destinationAmount The amount of destination tokens that will be downgraded
	function downgrade(address _to, uint256 destinationAmount) external {
		require(upgradeStatus == true, &quot;SourceUpgrade: upgrade status is not active&quot;);
		(uint256 sourceAmount, uint256 destinationRemainder) = computeDowngrade(destinationAmount);
		destinationAmount -= destinationRemainder;
		require(destinationAmount &gt; 0, &quot;SourceUpgrade: disallow conversions of zero value&quot;);
		require(upgradedBalance[msg.sender] &gt;= sourceAmount,
			&quot;SourceUpgrade: can not downgrade more than previously upgraded&quot;
			);

		upgradedBalance[msg.sender] -= sourceAmount;
		destination.safeTransferFrom(
			msg.sender,
			address(this),
			destinationAmount
			);
		source.safeTransfer(_to, sourceAmount);
		sourceUpgradedTotal -= sourceAmount;
		emit Downgrade(msg.sender, _to, sourceAmount, destinationAmount);
	}
}
```


## Security Considerations
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 `burn` for source tokens that are burnable. For non-burnable tokens, the accepted method is to send the source tokens to the `0x00` 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.

## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

</description>
        <pubDate>Tue, 02 Nov 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4931</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4931</guid>
      </item>
    
      <item>
        <title>Contract with Exactly One Non-fungible Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc721-minting-only-one-token/8602/2</comments>
        
        <description>## Abstract

The following describes standard functions for an [ERC-721](./eip-721.md) compatible contract with a total supply of one.
This allows an NFT to be associated uniquely with a single contract address.

## Motivation

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 [ERC-998](./eip-998.md) (own other ERC-721 or [ERC-20](./eip-20.md)) 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).

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.

## Specification

The constructor should mint the unique token of the contract, and then the mint function should add a restriction to avoid further minting.

Also, a `tokenTransfer` function should be added in order to allow the contract owner to transact with the ERC-20 tokens owned by the contract/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.

## Rationale

The main motivation is to keep the contract compatible with current ERC-721 platforms.

## Backwards Compatibility

There are no backwards compatibility issues.

## Reference Implementation

Add the variable `_minted` in the contract:

``` solidity
    bool private _minted;
```

In the constructor, automint the first token and set the variable to true:

``` solidity
    constructor(string memory name, string memory symbol, string memory base_uri) ERC721(name, symbol) {
        baseUri = base_uri;
        mint(msg.sender,0);
        _minted = true;
    }
```

Add additional functions to interact with the NFT properties (for instance, ERC-20):

``` solidity
    modifier onlyOwner() {
        require(balanceOf(msg.sender) &gt; 0, &quot;Caller is not the owner of the NFT&quot;);
        _;
    }

    function transferTokens(IERC20 token, address recipient, uint256 amount) public virtual onlyOwner {
        token.transfer(recipient, amount);
    }
	
    function balanceTokens(IERC20 token) public view virtual returns (uint256) {
        return token.balanceOf(address(this));
    }
```

## Security Considerations

No security issues found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 25 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4944</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4944</guid>
      </item>
    
      <item>
        <title>Entangled Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/entangled-tokens/8702</comments>
        
        <description>## Abstract

This EIP defines an interface for delegating control of a smart contract wallet to pairs of users using entangled [ERC-721](./eip-721.md) non-fungible tokens.

## Motivation

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.

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.

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/transfers it while keeping the entangled token B in the U&apos;s wallet. The piece of art and the artists will be entangled whoever is the A&apos;s owner.

These applications of entangled tokens are envisaged to be useful for:

1.	NFT authorship / art creation
2.	Distribution of royalties by the creator.
3.	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).
4.	Usowners (users that consume an NFT also become -partial- owners of the NFT)
5.	Reformulation of property rights: the one who owns the property receives it without having to follow in the footsteps of the owners.
6.	Identity: Only those credentials that have an entangled token with you are related to you.
7.	Vreservers (value-reservers).

## Specification

An entangled token contract implements [ERC-721](./eip-721.md) with the additional restriction that it only ever mints exactly two tokens at contract deployment: one with a `tokenId` of `0`, the other with a `tokenId` of `1`. The entangled token contract also implements a smart contract wallet that can be operated by the owners of those two tokens.

Also, a `tokenTransfer` function is to be be added in order to allow the token owners to transact with the [ERC-20](./eip-20.md) tokens owned by the contract/NFT itself. The function signature is as follows:

```solidity
    function tokenTransfer(IERC20 token, address recipient, uint256 amount) public onlyOwners;
```

## Rationale

We decide to extend [ERC-721](./eip-721.md) ([ERC-1155](./eip-1155.md) 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).

## Backwards Compatibility

No backwards compatibility issues.

## Reference Implementation

Mint two tokens, and only two, at the contract constructor, and set the `minted` property to true:

```solidity
bool private _minted;

constructor(string memory name, string memory symbol, string memory base_uri) ERC721(name, symbol) {
        baseUri = base_uri;
        _mint(msg.sender,0);
        _mint(msg.sender,1);
        _minted = true;
    }

function _mint(address to, uint256 tokenId) internal virtual override {
    require(!_minted, &quot;ERC4950: already minted&quot;);
    super._mint(to, tokenId);
}
```

Add additional functions to allow both NFT user owners to operate with other ERC-20 tokens owned by the contract:

```solidity
    modifier onlyOwners() {
        require(balanceOf(msg.sender) &gt; 0, &quot;Caller does not own any of the tokens&quot;);
        _;
    }

function tokenTransfer(IERC20 token, address recipient, uint256 amount) public onlyOwners {
        token.transfer(recipient, amount);
    }
```

## Security Considerations

There are no security considerations.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 28 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4950</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4950</guid>
      </item>
    
      <item>
        <title>Vendor Metadata Extension for NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4955-non-fungible-token-metadata-namespaces-extension/8746</comments>
        
        <description>## Abstract

This EIP standardizes a schema for NFTs metadata to add new field namespaces to the JSON schema for [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md) NFTs.

## Motivation

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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Schema

(subject to &quot;caveats&quot; below)

A new property called `namespaces` is introduced. This property expects one object per project as shown in the example below.

```jsonc
{
    &quot;title&quot;: &quot;Asset Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset that this NFT represents&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset that this NFT represents&quot;
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
        },
        &quot;namespaces&quot;: {
          &quot;type&quot;: &quot;object&quot;,
          &quot;description&quot;: &quot;Application-specific NFT properties&quot;
        }
    }
}
```

### Example

```jsonc
{
  &quot;name&quot;: &quot;My NFT&quot;,
  &quot;description&quot;: &quot;NFT description&quot;,
  &quot;image&quot;: &quot;ipfs://QmZfmRZHuawJDtDVMaEaPWfgWFV9iXoS9SzLvwX76wm6pa&quot;,
  &quot;namespaces&quot;: {
    &quot;myAwesomeCompany&quot;: {
      &quot;prop1&quot;: &quot;value1&quot;,
      &quot;prop2&quot;: &quot;value2&quot;,
    },
    &quot;myAwesomeCompany2&quot;: {
      &quot;prop3&quot;: &quot;value3&quot;,
      &quot;prop4&quot;: &quot;value4&quot;,
    },
  }
}

// Or by simply using a `URI` to reduce the size of the JSON response.

{
  &quot;name&quot;: &quot;My NFT&quot;,
  &quot;description&quot;: &quot;NFT description&quot;,
  &quot;image&quot;: &quot;ipfs://QmZfmRZHuawJDtDVMaEaPWfgWFV9iXoS9SzLvwX76wm6pa&quot;,
  &quot;namespaces&quot;: {
    &quot;myAwesomeCompany&quot;: &quot;URI&quot;,
    &quot;myAwesomeCompany2&quot;: &quot;URI&quot;,
  }
}
```

## Rationale

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/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.

The main differences between the projects that are rendering 3d NFTs (models) are:

### Armatures

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)

![](../assets/eip-4955/different-renders.jpeg)

### Metadata (Representations Files)

For example, every metaverse uses its own metadata representation files to make it work inside the engine depending on its game needs.

This is the JSON config of a wearable item in Decentraland:

```jsonc
&quot;data&quot;: {
  &quot;replaces&quot;: [],
  &quot;hides&quot;: [],
  &quot;tags&quot;: [],
  &quot;category&quot;: &quot;upper_body&quot;,
  &quot;representations&quot;: [
    {
      &quot;bodyShapes&quot;: [
        &quot;urn:decentraland:off-chain:base-avatars:BaseMale&quot;
      ],
      &quot;mainFile&quot;: &quot;male/Look6_Tshirt_A.glb&quot;,
      &quot;contents&quot;: [
        {
          &quot;key&quot;: &quot;male/Look6_Tshirt_A.glb&quot;,
          &quot;url&quot;: &quot;https://peer-ec2.decentraland.org/content/contents/QmX3yMhmx4AvGmyF3CM5ycSQB4F99zXh9rL5GvdxTTcoCR&quot;
        }
      ],
      &quot;overrideHides&quot;: [],
      &quot;overrideReplaces&quot;: []
    },
    {
      &quot;bodyShapes&quot;: [
        &quot;urn:decentraland:off-chain:base-avatars:BaseFemale&quot;
      ],
      &quot;mainFile&quot;: &quot;female/Look6_Tshirt_B (1).glb&quot;,
      &quot;contents&quot;: [
        {
          &quot;key&quot;: &quot;female/Look6_Tshirt_B (1).glb&quot;,
          &quot;url&quot;: &quot;https://peer-ec2.decentraland.org/content/contents/QmcgddP4L8CEKfpJ4cSZhswKownnYnpwEP4eYgTxmFdav8&quot;
        }
      ],
      &quot;overrideHides&quot;: [],
      &quot;overrideReplaces&quot;: []
    }
  ]
},
&quot;image&quot;: &quot;https://peer-ec2.decentraland.org/content/contents/QmPnzQZWAMP4Grnq6phVteLzHeNxdmbRhKuFKqhHyVMqrK&quot;,
&quot;thumbnail&quot;: &quot;https://peer-ec2.decentraland.org/content/contents/QmcnBFjhyFShGo9gWk2ETbMRDudiX7yjn282djYCAjoMuL&quot;,
&quot;metrics&quot;: {
  &quot;triangles&quot;: 3400,
  &quot;materials&quot;: 2,
  &quot;textures&quot;: 2,
  &quot;meshes&quot;: 2,
  &quot;bodies&quot;: 2,
  &quot;entities&quot;: 1
}
```

`replaces`, `overrides`, `hides`, and different body shapes representation for the same asset are needed for Decentraland in order to render the 3D asset correctly.

Using `namespaces` instead of objects like the ones below make it easy for the specific vendor/third-parties to access and index the required models. Moreover, `styles` 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&apos;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/animations/metadata.

```jsonc
{
    &quot;id&quot;: &quot;model&quot;,
    &quot;type&quot;: &quot;model/gltf+json&quot;,
    &quot;style&quot;: &quot;Decentraland&quot;,
    &quot;uri&quot;: &quot;...&quot;
},

// Or

{
    &quot;id&quot;: &quot;model&quot;,
    &quot;type&quot;: &quot;model/gltf+json&quot;,
    &quot;style&quot;: &quot;humanoide&quot;,
    &quot;uri&quot;: &quot;...&quot;
},
```

With `namespaces`, each vendor will know how to render an asset by doing:

```ts
fetch(metadata.namespaces[&quot;PROJECT_NAME&quot;].uri).then(res =&gt; render(res))
```

The idea behind extending the [EIP-721](./eip-721.md) 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&apos;s existing metadata  field minimizes the number of changes necessary. Finally, the JSON metadata is already used to store representations using the `image` field. It seems reasonable to have all the representations of an asset in the same place.

## Backwards Compatibility

Existing projects that can&apos;t modify the metadata response (schema), may be able to create a new smart contract that based on the `tokenId` 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 `tokenURI` function.

## Security Considerations

The same security considerations as with [EIP-721](./eip-721.md) apply related to using http gateways or IPFS for the tokenURI method.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 29 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4955</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4955</guid>
      </item>
    
      <item>
        <title>Name-Owned Account</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4972-name-owned-account/8822</comments>
        
        <description>## Abstract

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.

## Motivation

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Name-Owned Account

An NOA has

- a human readable name defined by [ERC-137](./eip-137.md); and
- an owned account(NOA), which is an smart contract account whose address is derived from the name; and
- owner(s) of the name that can deploy and manipulate the owned account.

The following diagram illustrates the relationship between NOA, name node, and name owner, with the ownership being guaranteed by the name service.

      ┌───────────────┐        ┌───────────┐         ┌───────────────┐
      │ Owned Account ◄──own───┤ Name Node ◄───own───┤   Name Owner  │
      └───────────────┘        └───────────┘         └───────────────┘

### Interface

The core interface required for a name service to have is:

	interface INameServiceRegistry {
	    /// @notice get account address owned by the name node
	    /// @params node represents a name node
	    /// @return the address of an account
	    function ownedAccount(
	        bytes32 node
	    ) external view returns(address);
	}

The core interface required for the name owned account is:

	interface INameOwnedAccount {
	    /// @notice get the name node is mapped to this account address
	    /// @return return a name node
	    function name() external view returns(bytes32);

	    /// @notice get the name service contract address where
	    /// the name is registered
	    /// @return return the name service the name registered at
	    function nameService() external view returns(address);
	}

## Rationale

To achieve a one-to-one mapping from the name to the NOA, where each NOA&apos;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.

## Backwards Compatibility

The name registry interface is compatible with ERC-137.

## Reference Implementation

### Name Owned Account Creation

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.

## Security Considerations

No security considerations were found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 04 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4972</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4972</guid>
      </item>
    
      <item>
        <title>Account-bound Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4973-non-transferrable-non-fungible-tokens-soulbound-tokens-or-badges/8825</comments>
        
        <description>## Abstract

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&apos;t implement a canonical interface for transfers. This EIP defines basic functionality to mint, assign, revoke and track ABTs.

## Motivation

In the popular MMORPG World of Warcraft, its game designers intentionally took some items out of the world&apos;s auction house market system to prevent them from having a publicly-discovered price and limit their accessibility.

Vanilla WoW&apos;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.

Upon voluntary pickup, the sword permanently **binds** to a character&apos;s &quot;soul,&quot; making it impossible to trade, sell or even swap it between a player&apos;s characters.

In other words, &quot;Thunderfury&quot;&apos;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.

World of Warcraft players could **trash** legendary and soulbound items like the Thunderfury to permanently remove them from their account. It was their choice to visibly **equip** or **unequip** an item and hence show their achievements to everyone.

The Ethereum community has expressed a need for non-transferrable, non-fungible, and socially-priced tokens similar to WoW&apos;s soulbound items. Popular contracts implicitly implement account-bound interaction rights today. A principled standardization helps interoperability and improves on-chain data indexing.

The purpose of this document is to make ABTs a reality on Ethereum by creating consensus around a **maximally backward-compatible** but otherwise **minimal** interface definition.

## Specification

### Solidity Interface

The key words &quot;MUST&quot;, &quot;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.

ABTs _must_ implement the interfaces:

- [ERC-165](./eip-165.md)&apos;s `ERC165` (`0x01ffc9a7`)
- [ERC-721](./eip-721.md)&apos;s `ERC721Metadata` (`0x5b5e139f`)

ABTs _must not_ implement the interfaces:

- [ERC-721](./eip-721.md)&apos;s `ERC721` (`0x80ac58cd`)

An ABT receiver must be able to always call `function unequip(address _tokenId)` to take their ABT off-chain.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.6;

/// @title Account-bound tokens
/// @dev See https://eips.ethereum.org/EIPS/eip-4973
/// Note: the ERC-165 identifier for this interface is 0xeb72bb7c
interface IERC4973 {
  /// @dev This emits when ownership of any ABT changes by any mechanism.
  ///  This event emits when ABTs are given or equipped and unequipped
  ///  (`to` == 0).
  event Transfer(
    address indexed from, address indexed to, uint256 indexed tokenId
  );

  /// @notice Count all ABTs assigned to an owner
  /// @dev ABTs assigned to the zero address are considered invalid, and this
  ///  function throws for queries about the zero address.
  /// @param owner An address for whom to query the balance
  /// @return The number of ABTs owned by `address owner`, possibly zero
  function balanceOf(address owner) external view returns (uint256);

  /// @notice Find the address bound to an ERC4973 account-bound token
  /// @dev ABTs assigned to zero address are considered invalid, and queries
  ///  about them do throw.
  /// @param tokenId The identifier for an ABT.
  /// @return The address of the owner bound to the ABT.
  function ownerOf(uint256 tokenId) external view returns (address);

  /// @notice Removes the `uint256 tokenId` from an account. At any time, an
  ///  ABT receiver must be able to disassociate themselves from an ABT
  ///  publicly through calling this function. After successfully executing this
  ///  function, given the parameters for calling `function give` or
  ///  `function take` a token must be re-equipable.
  /// @dev Must emit a `event Transfer` with the `address to` field pointing to
  ///  the zero address.
  /// @param tokenId The identifier for an ABT.
  function unequip(uint256 tokenId) external;

  /// @notice Creates and transfers the ownership of an ABT from the
  ///  transaction&apos;s `msg.sender` to `address to`.
  /// @dev Throws unless `bytes signature` represents a signature of the
  //   EIP-712 structured data hash
  ///  `Agreement(address active,address passive,bytes metadata)` expressing
  ///  `address to`&apos;s explicit agreement to be publicly associated with
  ///  `msg.sender` and `bytes metadata`. A unique `uint256 tokenId` must be
  ///  generated by type-casting the `bytes32` EIP-712 structured data hash to a
  ///  `uint256`. If `bytes signature` is empty or `address to` is a contract,
  ///  an EIP-1271-compatible call to `function isValidSignatureNow(...)` must
  ///  be made to `address to`. A successful execution must result in the
  ///  `event Transfer(msg.sender, to, tokenId)`. Once an ABT exists as an
  ///  `uint256 tokenId` in the contract, `function give(...)` must throw.
  /// @param to The receiver of the ABT.
  /// @param metadata The metadata that will be associated to the ABT.
  /// @param signature A signature of the EIP-712 structured data hash
  ///  `Agreement(address active,address passive,bytes metadata)` signed by
  ///  `address to`.
  /// @return A unique `uint256 tokenId` generated by type-casting the `bytes32`
  ///  EIP-712 structured data hash to a `uint256`.
  function give(address to, bytes calldata metadata, bytes calldata signature)
    external
    returns (uint256);

  /// @notice Creates and transfers the ownership of an ABT from an
  /// `address from` to the transaction&apos;s `msg.sender`.
  /// @dev Throws unless `bytes signature` represents a signature of the
  ///  EIP-712 structured data hash
  ///  `Agreement(address active,address passive,bytes metadata)` expressing
  ///  `address from`&apos;s explicit agreement to be publicly associated with
  ///  `msg.sender` and `bytes metadata`. A unique `uint256 tokenId` must be
  ///  generated by type-casting the `bytes32` EIP-712 structured data hash to a
  ///  `uint256`. If `bytes signature` is empty or `address from` is a contract,
  ///  an EIP-1271-compatible call to `function isValidSignatureNow(...)` must
  ///  be made to `address from`. A successful execution must result in the
  ///  emission of an `event Transfer(from, msg.sender, tokenId)`. Once an ABT
  ///  exists as an `uint256 tokenId` in the contract, `function take(...)` must
  ///  throw.
  /// @param from The origin of the ABT.
  /// @param metadata The metadata that will be associated to the ABT.
  /// @param signature A signature of the EIP-712 structured data hash
  ///  `Agreement(address active,address passive,bytes metadata)` signed by
  ///  `address from`.

  /// @return A unique `uint256 tokenId` generated by type-casting the `bytes32`
  ///  EIP-712 structured data hash to a `uint256`.
  function take(address from, bytes calldata metadata, bytes calldata signature)
    external
    returns (uint256);

  /// @notice Decodes the opaque metadata bytestring of an ABT into the token
  ///  URI that will be associated with it once it is created on chain.
  /// @param metadata The metadata that will be associated to an ABT.
  /// @return A URI that represents the metadata.
  function decodeURI(bytes calldata metadata) external returns (string memory);
}
```

See [ERC-721](./eip-721.md) for a definition of its metadata JSON Schema.

### [EIP-712](./eip-712.md) Typed Structured Data Hashing and Bytearray Signature Creation

To invoke `function give(...)` and `function take(...)` a bytearray signature must be created using [EIP-712](./eip-712.md). A tested reference implementation in Node.js is attached at [index.mjs](../assets/eip-4973/sdk/src/index.mjs), [index_test.mjs](../assets/eip-4973/sdk/test/index_test.mjs) and [package.json](../assets/eip-4973/package.json). In Solidity, this bytearray signature can be created as follows:

```solidity
bytes32 r = 0x68a020a209d3d56c46f38cc50a33f704f4a9a10a59377f8dd762ac66910e9b90;
bytes32 s = 0x7e865ad05c4035ab5792787d4a0297a43617ae897930a6fe4d822b8faea52064;
uint8 v   = 27;
bytes memory signature = abi.encodePacked(r, s, v);
```

## Rationale

### Interface

ABTs shall be maximally backward-compatible but still only expose a minimal and simple to implement interface definition.

As [ERC-721](./eip-721.md) tokens have seen widespread adoption with wallet providers and marketplaces, using its `ERC721Metadata` interface with [ERC-165](./eip-165.md) for feature-detection potentially allows implementers to support ABTs out of the box.

If an implementer of [ERC-721](./eip-721.md) properly built [ERC-165](./eip-165.md)&apos;s `function supportsInterface(bytes4 interfaceID)` function, already by recognizing that [ERC-721](./eip-721.md)&apos;s track and transfer interface component with the identifier `0x80ac58cd` is not implemented, transferring of a token should not be suggested as a user interface option.

Still, since ABTs support [ERC-721](./eip-721.md)&apos;s `ERC721Metadata` extension, wallets and marketplaces should display an account-bound token with no changes needed.

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 [ERC-165](./eip-165.md).

We expose `function unequip(address _tokenId)` and require it to be callable at any time by an ABT&apos;s owner as it ensures an owner&apos;s right to publicly disassociate themselves from what has been issued towards their account.

### Exception handling

Given the non-transferable between accounts property of ABTs, if a user&apos;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.

But this document is deliberately abstaining from offering a standardized form of exception handling in cases where user keys are compromised or rotated.

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&apos;s account that implements a multi-signature functionality.

### Provenance Indexing

ABTs can be indexed by tracking the emission of `event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)`. As with [ERC-721](./eip-721.md), transfers between two accounts are represented by `address from` and `address to` being non-zero addresses. Unequipping a token is represented through emitting a transfer with `address to` being set to the zero address. Mint operations where `address from` is set to zero don&apos;t exist. To avoid being spoofed by maliciously-implemented `event Transfer` emitting contracts, an indexer should ensure that the transaction&apos;s sender is equal to `event Transfer`&apos;s `from` value.

## Backwards Compatibility

We have adopted the [ERC-165](./eip-165.md) and `ERC721Metadata` functions purposefully to create a high degree of backward compatibility with [ERC-721](./eip-721.md). We have deliberately used [ERC-721](./eip-721.md) terminology such as `function ownerOf(...)`, `function balanceOf(...)` to minimize the effort of familiarization for ABT implementers already familiar with, e.g., [ERC-20](./eip-20.md) or [ERC-721](./eip-721.md). For indexers, we&apos;ve re-used the widely-implemented `event Transfer` event signature.

## Reference Implementation

You can find an implementation of this standard in [ERC-4973-flat.sol](../assets/eip-4973/ERC4973-flat.sol).

## Security Considerations

There are no security considerations related directly to the implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 01 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4973</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4973</guid>
      </item>
    
      <item>
        <title>Ratings</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/8805</comments>
        
        <description>## Abstract

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.

## Motivation

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.

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:

- 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.

- 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.

- 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.

- 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.

This standard is influenced by the [EIP-20](./eip-20.md) and [EIP-721](./eip-721.md) token standards and takes cues from each in its structure, style, and semantics.

## Specification

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.

Every compliant contract MUST implement the following interfaces:

```
// SPDX-License-Identifier: CC0

pragma solidity ^0.8.0;

/// @title EIP-4974 Ratings
/// @dev See https://eips.ethereum.org/EIPS/EIP-4974
///  Note: the EIP-165 identifier for this interface is #######.
///  Must initialize contracts with an `operator` address that is not `address(0)`.
interface IERC4974 /* is ERC165 */ {

    /// @dev Emits when operator changes.
    ///  MUST emit when `operator` changes by any mechanism.
    ///  MUST ONLY emit by `setOperator`.
    event NewOperator(address indexed _operator);

    /// @dev Emits when operator issues a rating. 
    ///  MUST emit when rating is assigned by any mechanism.
    ///  MUST ONLY emit by `rate`.
    event Rating(address _rated, int8 _rating);

    /// @dev Emits when operator removes a rating. 
    ///  MUST emit when rating is removed by any mechanism.
    ///  MUST ONLY emit by `remove`.
    event Removal(address _removed);

    /// @notice Appoint operator authority.
    /// @dev MUST throw unless `msg.sender` is `operator`.
    ///  MUST throw if `operator` address is either already current `operator`
    ///  or is the zero address.
    ///  MUST emit an `Appointment` event.
    /// @param _operator New operator of the smart contract.
    function setOperator(address _operator) external;

    /// @notice Rate an address.
    ///  MUST emit a Rating event with each successful call.
    /// @param _rated Address to be rated.
    /// @param _rating Total EXP tokens to reallocate.
    function rate(address _rated, int8 _rating) external;

    /// @notice Remove a rating from an address.
    ///  MUST emit a Remove event with each successful call.
    /// @param _removed Address to be removed.
    function removeRating(address _removed) external;

    /// @notice Return a rated address&apos; rating.
    /// @dev MUST register each time `Rating` emits.
    ///  SHOULD throw for queries about the zero address.
    /// @param _rated An address for whom to query rating.
    /// @return int8 The rating assigned.
    function ratingOf(address _rated) external view returns (int8);
}

interface IERC165 {
    /// @notice Query if a contract implements an interface.
    /// @dev Interface identification is specified in EIP-165. This function
    ///  uses less than 30,000 gas.
    /// @param interfaceID The interface identifier, as specified in EIP-165.
    /// @return bool `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise.
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

## Rationale

### Rating Assignment

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 *that* governance occurs. This allows for a wider range of potential use cases than optimizing for particular decision-making forms.

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.

### Choice of int8

It&apos;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.

It&apos;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.

### Rating Changes

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&apos;s standing and influence in the community. Again, while this does not ensure an ethical standard within the community, it opens the door.

Relatedly, ratings SHOULD allow removal of ratings to rescind a rating if the rater does not have confidence in their ability to rate effectively.

### Interface Detection

We chose Standard Interface Detection ([EIP-165](./eip-165.md)) to expose the interfaces that a compliant smart contract supports.

### Metadata Choices

We have required `name` and `description` functions in the metadata extension. `name` common among major standards for blockchain-based primitives. We included a `description` function that may be helpful for games or other applications with multiple ratings systems.

We remind implementation authors that the empty string is a valid response to `name` and `description` 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.

### Drawbacks

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.

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.

## Backwards Compatibility

We have adopted the `name` semantics from the EIP-20 and EIP-721 specifications.

## Reference Implementation

A reference implementation of this standard can be found in the assets folder.
&lt;!-- [../assets/EIP-4974/ERC4974.sol](../assets/EIP-4974/ERC4974.sol). --&gt;

## Security Considerations

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.

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.

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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 02 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4974</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4974</guid>
      </item>
    
      <item>
        <title>Held token interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4987-held-token-standard-nfts-defi/7117</comments>
        
        <description>## Abstract

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 [EIP-20](./eip-20.md), [EIP-721](./eip-721.md), or [EIP-1155](./eip-1155.md) tokens and is intended to be consumed by both on-chain and off-chain systems that rely on ownership and balance verification.

## Motivation

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.

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.

Example implementers of this ERC standard include

- staking or farming contracts
- lending pools
- time lock or vesting vaults
- fractionalized NFT contracts
- smart contract wallets

Example consumers of this ERC standard include

- governance systems
- gaming
- PFP verification
- art galleries or showcases
- token based membership programs

## Specification

Smart contracts implementing the `ERC20` held token standard MUST implement all of the functions in the `IERC20Holder` interface.

Smart contracts implementing the `ERC20` held token standard MUST also implement `ERC165` and return true when the interface ID `0x74c89d54` is passed.

```solidity
/**
 * @notice the ERC20 holder standard provides a common interface to query
 * token balance information
 */
interface IERC20Holder is IERC165 {
  /**
   * @notice emitted when the token is transferred to the contract
   * @param owner functional token owner
   * @param tokenAddress held token address
   * @param tokenAmount held token amount
   */
  event Hold(
    address indexed owner,
    address indexed tokenAddress,
    uint256 tokenAmount
  );

  /**
   * @notice emitted when the token is released back to the user
   * @param owner functional token owner
   * @param tokenAddress held token address
   * @param tokenAmount held token amount
   */
  event Release(
    address indexed owner,
    address indexed tokenAddress,
    uint256 tokenAmount
  );

  /**
   * @notice get the held balance of the token owner
   * @dev should throw for invalid queries and return zero for no balance
   * @param tokenAddress held token address
   * @param owner functional token owner
   * @return held token balance
   */
  function heldBalanceOf(address tokenAddress, address owner)
    external
    view
    returns (uint256);
}

```

Smart contracts implementing the `ERC721` held token standard MUST implement all of the functions in the `IERC721Holder` interface.

Smart contracts implementing the `ERC721` held token standard MUST also implement `ERC165` and return true when the interface ID `0x16b900ff` is passed.

```solidity
/**
 * @notice the ERC721 holder standard provides a common interface to query
 * token ownership and balance information
 */
interface IERC721Holder is IERC165 {
  /**
   * @notice emitted when the token is transferred to the contract
   * @param owner functional token owner
   * @param tokenAddress held token address
   * @param tokenId held token ID
   */
  event Hold(
    address indexed owner,
    address indexed tokenAddress,
    uint256 indexed tokenId
  );

  /**
   * @notice emitted when the token is released back to the user
   * @param owner functional token owner
   * @param tokenAddress held token address
   * @param tokenId held token ID
   */
  event Release(
    address indexed owner,
    address indexed tokenAddress,
    uint256 indexed tokenId
  );

  /**
   * @notice get the functional owner of a held token
   * @dev should throw for invalid queries and return zero for a token ID that is not held
   * @param tokenAddress held token address
   * @param tokenId held token ID
   * @return functional token owner
   */
  function heldOwnerOf(address tokenAddress, uint256 tokenId)
    external
    view
    returns (address);

  /**
   * @notice get the held balance of the token owner
   * @dev should throw for invalid queries and return zero for no balance
   * @param tokenAddress held token address
   * @param owner functional token owner
   * @return held token balance
   */
  function heldBalanceOf(address tokenAddress, address owner)
    external
    view
    returns (uint256);
}
```

Smart contracts implementing the `ERC1155` held token standard MUST implement all of the functions in the `IERC1155Holder` interface.

Smart contracts implementing the `ERC1155` held token standard MUST also implement `ERC165` and return true when the interface ID `0xced24c37` is passed.

```solidity
/**
 * @notice the ERC1155 holder standard provides a common interface to query
 * token balance information
 */
interface IERC1155Holder is IERC165 {
  /**
   * @notice emitted when the token is transferred to the contract
   * @param owner functional token owner
   * @param tokenAddress held token address
   * @param tokenId held token ID
   * @param tokenAmount held token amount
   */
  event Hold(
    address indexed owner,
    address indexed tokenAddress,
    uint256 indexed tokenId,
    uint256 tokenAmount
  );

  /**
   * @notice emitted when the token is released back to the user
   * @param owner functional token owner
   * @param tokenAddress held token address
   * @param tokenId held token ID
   * @param tokenAmount held token amount
   */
  event Release(
    address indexed owner,
    address indexed tokenAddress,
    uint256 indexed tokenId,
    uint256 tokenAmount
  );

  /**
   * @notice get the held balance of the token owner
   * @dev should throw for invalid queries and return zero for no balance
   * @param tokenAddress held token address
   * @param owner functional token owner
   * @param tokenId held token ID
   * @return held token balance
   */
  function heldBalanceOf(
    address tokenAddress,
    address owner,
    uint256 tokenId
  ) external view returns (uint256);
}
```

## Rationale

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.

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.

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.


## Backwards Compatibility

Importantly, the proposed specification is fully compatible with all existing EIP-20, EIP-721, and EIP-1155 token contracts.

Token holder contracts will need to be updated to implement this lightweight interface.

Consumer of this standard will need to be updated to respect this interface in any relevant ownership logic.


## Reference Implementation

A full example implementation including [interfaces](../assets/eip-4987/IERC721Holder.sol), a vault [token holder](../assets/eip-4987/Vault.sol), and a [consumer](../assets/eip-4987/Consumer.sol), can be found at `assets/eip-4987/`.

Notably, consumers of the `IERC721Holder` interface can do a chained lookup for the owner of any specific token ID using the following logic.

```solidity
  /**
   * @notice get the functional owner of a token
   * @param tokenId token id of interest
   */
  function getOwner(uint256 tokenId) external view returns (address) {
    // get raw owner
    address owner = token.ownerOf(tokenId);

    // if owner is not contract, return
    if (!owner.isContract()) {
      return owner;
    }

    // check for token holder interface support
    try IERC165(owner).supportsInterface(0x16b900ff) returns (bool ret) {
      if (!ret) return owner;
    } catch {
      return owner;
    }

    // check for held owner
    try IERC721Holder(owner).heldOwnerOf(address(token), tokenId) returns (address user) {
      if (user != address(0)) return user;
    } catch {}

    return owner;
  }
```


## Security Considerations

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.

Consumers should also verify the overall token balance and ownership of the holder contract as a sanity check.


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 21 Sep 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-4987</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-4987</guid>
      </item>
    
      <item>
        <title>Zodiac Modular Accounts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-zodiac-a-composable-design-philosophy-for-daos/8963</comments>
        
        <description>## Abstract
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 `IAvatar` interface, and guards implement the `IGuard` interface. Modules may take any form.

## Motivation
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.

By using the this EIP standard to separate concerns (decoupling authentication and execution logic), users are able to:

1. Enable flexible, module-based control of programmable accounts
2. Easily switch between tools and frameworks without unnecessary overhead.
3. Enable multiple control mechanism in parallel.
4. Enable cross-chain / cross-layer governance.
5. Progressively decentralize their governance as their project and community matures.

## Specification
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.

This EIP consists of four key concepts:

- **Avatars** 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 `IAvatar` interface.
- **Modules** are contracts enabled by an avatar that implement some execution logic.
- **Modifiers** are contracts that sit between modules and avatars to modify the module&apos;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 `IAvatar` interface.
- **Guards** 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 `IGuard` interface. Modules, modifiers, and avatars that wish to be guardable MUST inherit `Guardable`, MUST call `checkTransaction()` before triggering execution on their target, and MUST call `checkAfterExecution()` after execution is complete.

```solidity
/// @title Avatar - A contract that manages modules that can execute transactions via this contract.

pragma solidity &gt;=0.7.0 &lt;0.9.0;

import &quot;./Enum.sol&quot;;


interface IAvatar {
    event EnabledModule(address module);
    event DisabledModule(address module);
    event ExecutionFromModuleSuccess(address indexed module);
    event ExecutionFromModuleFailure(address indexed module);

    /// @dev Enables a module on the avatar.
    /// @notice Can only be called by the avatar.
    /// @notice Modules should be stored as a linked list.
    /// @notice Must emit EnabledModule(address module) if successful.
    /// @param module Module to be enabled.
    function enableModule(address module) external;

    /// @dev Disables a module on the avatar.
    /// @notice Can only be called by the avatar.
    /// @notice Must emit DisabledModule(address module) if successful.
    /// @param prevModule Address that pointed to the module to be removed in the linked list
    /// @param module Module to be removed.
    function disableModule(address prevModule, address module) external;

    /// @dev Allows a Module to execute a transaction.
    /// @notice Can only be called by an enabled module.
    /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.
    /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.
    /// @param to Destination address of module transaction.
    /// @param value Ether value of module transaction.
    /// @param data Data payload of module transaction.
    /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.
    function execTransactionFromModule(
        address to,
        uint256 value,
        bytes memory data,
        Enum.Operation operation
    ) external returns (bool success);

    /// @dev Allows a Module to execute a transaction and return data
    /// @notice Can only be called by an enabled module.
    /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.
    /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.
    /// @param to Destination address of module transaction.
    /// @param value Ether value of module transaction.
    /// @param data Data payload of module transaction.
    /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.
    function execTransactionFromModuleReturnData(
        address to,
        uint256 value,
        bytes memory data,
        Enum.Operation operation
    ) external returns (bool success, bytes memory returnData);

    /// @dev Returns if an module is enabled
    /// @return True if the module is enabled
    function isModuleEnabled(address module) external view returns (bool);

    /// @dev Returns array of modules.
    /// @param start Start of the page.
    /// @param pageSize Maximum number of modules that should be returned.
    /// @return array Array of modules.
    /// @return next Start of the next page.
    function getModulesPaginated(address start, uint256 pageSize)
        external
        view
        returns (address[] memory array, address next);
}
```

```solidity
pragma solidity &gt;=0.7.0 &lt;0.9.0;

import &quot;./Enum.sol&quot;;

interface IGuard {
    function checkTransaction(
        address to,
        uint256 value,
        bytes memory data,
        Enum.Operation operation,
        uint256 safeTxGas,
        uint256 baseGas,
        uint256 gasPrice,
        address gasToken,
        address payable refundReceiver,
        bytes memory signatures,
        address msgSender
    ) external;

    function checkAfterExecution(bytes32 txHash, bool success) external;
}

```

```solidity
pragma solidity &gt;=0.7.0 &lt;0.9.0;

import &quot;./Enum.sol&quot;;
import &quot;./BaseGuard.sol&quot;;

/// @title Guardable - A contract that manages fallback calls made to this contract
contract Guardable {
    address public guard;

    event ChangedGuard(address guard);

    /// `guard_` does not implement IERC165.
    error NotIERC165Compliant(address guard_);

    /// @dev Set a guard that checks transactions before execution.
    /// @param _guard The address of the guard to be used or the 0 address to disable the guard.
    function setGuard(address _guard) external {
        if (_guard != address(0)) {
            if (!BaseGuard(_guard).supportsInterface(type(IGuard).interfaceId))
                revert NotIERC165Compliant(_guard);
        }
        guard = _guard;
        emit ChangedGuard(guard);
    }

    function getGuard() external view returns (address _guard) {
        return guard;
    }
}
```

```solidity
pragma solidity &gt;=0.7.0 &lt;0.9.0;

import &quot;./Enum.sol&quot;;
import &quot;./IERC165.sol&quot;;
import &quot;./IGuard.sol&quot;;

abstract contract BaseGuard is IERC165 {
    function supportsInterface(bytes4 interfaceId)
        external
        pure
        override
        returns (bool)
    {
        return
            interfaceId == type(IGuard).interfaceId || // 0xe6d7a83a
            interfaceId == type(IERC165).interfaceId; // 0x01ffc9a7
    }

    /// @dev Module transactions only use the first four parameters: to, value, data, and operation.
    /// Module.sol hardcodes the remaining parameters as 0 since they are not used for module transactions.
    function checkTransaction(
        address to,
        uint256 value,
        bytes memory data,
        Enum.Operation operation,
        uint256 safeTxGas,
        uint256 baseGas,
        uint256 gasPrice,
        address gasToken,
        address payable refundReceiver,
        bytes memory signatures,
        address msgSender
    ) external virtual;

    function checkAfterExecution(bytes32 txHash, bool success) external virtual;
}
```

```solidity
pragma solidity &gt;=0.7.0 &lt;0.9.0;

/// @title Enum - Collection of enums

contract Enum {

    enum Operation {Call, DelegateCall}

}
```

## Rationale
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.

## Backwards Compatibility
No backward compatibility issues are introduced by this standard.

## Security Considerations
There are some considerations that module developers and users should take into account:
1. **Modules have absolute control:** 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.
2. **Race conditions:** 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/or other control mechanisms.
3. **Don&apos;t brick your avatar:** 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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 14 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5005</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5005</guid>
      </item>
    
      <item>
        <title>Rental NFT, NFT User Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip5006-erc-1155-usage-rights-extension/8941</comments>
        
        <description>## Abstract

This standard is an extension of [ERC-1155](./eip-1155.md). It proposes an additional role (`user`) which can be granted to addresses that represent a `user` of the assets rather than an `owner`.

## Motivation

Like [ERC-721](./eip-721.md), [ERC-1155](./eip-1155.md) 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).

## Specification

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.

```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.0;

interface IERC5006 {
    struct UserRecord {
        uint256 tokenId;
        address owner;
        uint64 amount;
        address user;
        uint64 expiry;
    }
    
    /**
     * @dev Emitted when permission for `user` to use `amount` of `tokenId` token owned by `owner`
     * until `expiry` are given.
     */
    event CreateUserRecord(
        uint256 recordId,
        uint256 tokenId,
        uint64  amount,
        address owner,
        address user,
        uint64  expiry
    );

    /**
     * @dev Emitted when record of `recordId` are deleted. 
     */
    event DeleteUserRecord(uint256 recordId);

    /**
     * @dev Returns the usable amount of `tokenId` tokens  by `account`.
     */
    function usableBalanceOf(address account, uint256 tokenId)
        external
        view
        returns (uint256);

    /**
     * @dev Returns the amount of frozen tokens of token type `id` by `account`.
     */
    function frozenBalanceOf(address account, uint256 tokenId)
        external
        view
        returns (uint256);

    /**
     * @dev Returns the `UserRecord` of `recordId`.
     */
    function userRecordOf(uint256 recordId)
        external
        view
        returns (UserRecord memory);

    /**
     * @dev Gives permission to `user` to use `amount` of `tokenId` token owned by `owner` until `expiry`.
     *
     * Emits a {CreateUserRecord} event.
     *
     * Requirements:
     *
     * - If the caller is not `owner`, it must be have been approved to spend ``owner``&apos;s tokens
     * via {setApprovalForAll}.
     * - `owner` must have a balance of tokens of type `id` of at least `amount`.
     * - `user` cannot be the zero address.
     * - `amount` must be greater than 0.
     * - `expiry` must after the block timestamp.
     */
    function createUserRecord(
        address owner,
        address user,
        uint256 tokenId,
        uint64 amount,
        uint64 expiry
    ) external returns (uint256);

    /**
     * @dev Atomically delete `record` of `recordId` by the caller.
     *
     * Emits a {DeleteUserRecord} event.
     *
     * Requirements:
     *
     * - the caller must have allowance.
     */
    function deleteUserRecord(uint256 recordId) external;
}

```

The `supportsInterface` method MUST return `true` when called with `0xc26d96cc`.

## Rationale

This model is intended to facilitate easy implementation. The following are some problems that are solved by this standard:

### Clear Rights Assignment

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.

### Easy Third-Party Integration

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 `user` 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.

## Backwards Compatibility

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 [ERC-5006](./eip-5006.md) and ERC-1155.

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.

## Test Cases

Test cases are included in [test.js](../assets/eip-5006/test/test.ts). 

Run in terminal: 

1. ```cd ../assets/eip-5006```
1. ```npm install```
1. ```npx hardhat test```

## Reference Implementation

See [`ERC5006.sol`](../assets/eip-5006/contracts/ERC5006.sol).

## Security Considerations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 12 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5006</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5006</guid>
      </item>
    
      <item>
        <title>Time NFT, ERC-721 Time Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5007-eip-721-time-extension/8924</comments>
        
        <description>## Abstract

This standard is an extension of [ERC-721](./eip-721.md). It proposes some additional functions (`startTime`, `endTime`) to help with on-chain time management.

## Motivation

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.

Some existing NFTs contain time functions, but their interfaces are not consistent, so it is difficult to develop third-party platforms for them.

By introducing these functions (`startTime`, `endTime`), it is possible to enable and disable NFTs automatically on chain.

## Specification

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.

```solidity
/**
 * @dev the ERC-165 identifier for this interface is 0xf140be0d.
 */
interface IERC5007 /* is IERC721 */ {
    /**
     * @dev Returns the start time of the NFT as a UNIX timestamp.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function startTime(uint256 tokenId) external view returns (uint64);
    
    /**
     * @dev Returns the end time of the NFT as a UNIX timestamp.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function endTime(uint256 tokenId) external view returns (uint64);

}
```

The **composable extension** is OPTIONAL for this standard. This allows your NFT to be minted from an existing NFT or to merge two NFTs into one NFT.

```solidity
/**
 * @dev the ERC-165 identifier for this interface is 0x75cf3842.
 */
interface IERC5007Composable /* is IERC5007 */ {
    /**
     * @dev Returns the asset id of the time NFT.
     * Only NFTs with same asset id can be merged.
     * 
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function assetId(uint256 tokenId) external view returns (uint256);

    /**
     * @dev Split an old token to two new tokens.
     * The assetId of the new token is the same as the assetId of the old token
     *
     * Requirements:
     *
     * - `oldTokenId` must exist.
     * - `newToken1Id` must not exist.
     * - `newToken1Owner` cannot be the zero address.
     * - `newToken2Id` must not exist.
     * - `newToken2Owner` cannot be the zero address.
     * - `splitTime`  require(oldToken.startTime &lt;= splitTime &amp;&amp; splitTime &lt; oldToken.EndTime)
     */
    function split(
        uint256 oldTokenId,
        uint256 newToken1Id,
        address newToken1Owner,
        uint256 newToken2Id,
        address newToken2Owner,
        uint64 splitTime
    ) external;

    /**
     * @dev Merge the first token and second token into the new token.
     *
     * Requirements:
     *
     * - `firstTokenId` must exist.
     * - `secondTokenId` must exist.
     * - require((firstToken.endTime + 1) == secondToken.startTime)
     * - require((firstToken.assetId()) == secondToken.assetId())
     * - `newTokenOwner` cannot be the zero address.
     * - `newTokenId` must not exist.
     */
    function merge(
        uint256 firstTokenId,
        uint256 secondTokenId,
        address newTokenOwner,
        uint256 newTokenId
    ) external;
}
```

## Rationale

### Time Data Type

The max value of `uint64` 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. `uint256` is too big for C, C++, Java, Go, etc, and `uint64` is natively supported by mainstream programming languages.

## Backwards Compatibility

This standard is fully ERC-721 compatible.

## Test Cases

Test cases are included in [test.js](../assets/eip-5007/test/test.js). 

Run in terminal:

```shell
cd ../assets/eip-5007
npm install truffle -g
npm install
truffle test
```
 
## Reference Implementation

See [`ERC5007.sol`](../assets/eip-5007/contracts/ERC5007.sol).

## Security Considerations

No security issues found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 13 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5007</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5007</guid>
      </item>
    
      <item>
        <title>ERC-721 Nonce Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip5008-eip-721-nonce-and-metadata-update-extension/8925</comments>
        
        <description>## Abstract

This standard is an extension of [ERC-721](./eip-721.md). It proposes adding a `nonce` function to ERC-721 tokens.

## Motivation

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.

This EIP proposes adding a `nonce` property to ERC-721 tokens, and the `nonce` will be changed when a token is transferred. If a `nonce` is added to an order, the order can be checked to avoid attacks.

## Specification

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.

```solidity

/// @dev the ERC-165 identifier for this interface is 0xce03fdab.
interface IERC5008 /* is IERC165 */ {
    /// @notice Emitted when the `nonce` of an NFT is changed
    event NonceChanged(uint256 tokenId, uint256 nonce);

    /// @notice Get the nonce of an NFT
    /// Throws if `tokenId` is not a valid NFT
    /// @param tokenId The id of the NFT
    /// @return The nonce of the NFT
    function nonce(uint256 tokenId) external view returns(uint256);
}
```

The `nonce(uint256 tokenId)` function MUST be implemented as `view`.

The `supportsInterface` method MUST return `true` when called with `0xce03fdab`.

## Rationale

At first `transferCount` was considered as function name, but there may some case to change the `nonce` besides transfer, such as important properties changed, then we changed `transferCount` to `nonce`.

## Backwards Compatibility

This standard is compatible with ERC-721.

## Test Cases

Test cases are included in [test.js](../assets/eip-5008/test/test.ts).

Run:

```sh
cd ../assets/eip-5008
npm install
npm run test
```

## Reference Implementation

See [`ERC5008.sol`](../assets/eip-5008/contracts/ERC5008.sol).

## Security Considerations

No security issues found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 10 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5008</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5008</guid>
      </item>
    
      <item>
        <title>Filesystem-like Interface for Contracts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5018-directory-standard/8958</comments>
        
        <description>## Abstract

The following standardizes an API for directories and files within smart contracts, similar to traditional filesystems.
This standard provides basic functionality to read/write binary objects of any size, as well as allow reading/writing chunks of the object if the object is too large to fit in a single transaction.

## Motivation

A standard interface allows any binary objects on EVM-based blockchain to be re-used by other dApps.

With [EIP-4804](./eip-4804.md), 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/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.

## Specification

### Directory

#### Methods

##### write

Writes binary `data` to the file `name` in the directory by an account with write permission.

```
function write(bytes memory name, bytes memory data) external payable
```

##### read

Returns the binary `data` from the file `name` in the directory and existence of the file.

```
function read(bytes memory name) external view returns (bytes memory data, bool exist)
```

##### fallback read

Returns the binary `data` from the file `prefixedName` (prefixed with `/`) in the directory.

```
fallback(bytes calldata prefixedName) external returns (bytes memory data) 
```

##### size

Returns the size of the `data` from the file `name` in the directory and the number of chunks of the data.

```
function size(bytes memory name) external view returns (uint256 size, uint256 chunks)
```

##### remove

Removes the file `name` in the directory and returns the number of chunks removed (0 means the file does not exist) by an account with write permission.

```
function remove(bytes memory name) external returns (uint256 numOfChunksRemoved)
```

##### countChunks

Returns the number of chunks of the file `name`.

```
function countChunks(bytes memory name) external view returns (uint256 numOfChunks);
```

##### writeChunk

Writes a chunk of data to the file by an account with write permission. The write will fail if `chunkId &gt; numOfChunks`, i.e., the write must append the file or replace the existing chunk.

```
 function writeChunk(bytes memory name, uint256 chunkId, bytes memory chunkData) external payable;
```

##### readChunk

Returns the chunk data of the file `name` and the existence of the chunk.

```
function readChunk(bytes memory name, uint256 chunkId) external view returns (bytes memory chunkData, bool exist);
```

##### chunkSize

Returns the size of a chunk of the file `name` and the existence of the chunk.

```
function chunkSize(bytes memory name, uint256 chunkId) external view returns (uint256 chunkSize, bool exist);
```

##### removeChunk

Removes a chunk of the file `name` and returns `false` if such chunk does not exist. The method should be called by an account with write permission.

```
function removeChunk(bytes memory name, uint256 chunkId) external returns (bool exist);
```

##### truncate

Removes the chunks of the file `name` in the directory from the given `chunkId` and returns the number of chunks removed by an account with write permission. When `chunkId = 0`, the method is essentially the same as `remove()`.

```
function truncate(bytes memory name, uint256 chunkId) external returns (uint256 numOfChunksRemoved);
```

##### getChunkHash

Returns the hash value of the chunk data.

```
function getChunkHash(bytes memory name, uint256 chunkId) external view returns (bytes32);
```

## Rationale

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.

### Interactions Between Unchunked/Chunked Functions

`read` method should return the concatenated chunked data written by `writeChunk` method. The following gives some examples of the interactions:

- `read(&quot;hello.txt&quot;)` =&gt; &quot;&quot; (file is empty)
- `writeChunk(&quot;hello.txt&quot;, 0, &quot;abc&quot;)` will succeed
- `read(&quot;hello.txt&quot;)` =&gt; &quot;abc&quot;
- `writeChunk(&quot;hello.txt&quot;, 1, &quot;efg&quot;)` will succeed
- `read(&quot;hello.txt&quot;)` =&gt; &quot;abcefg&quot;
- `writeChunk(&quot;hello.txt&quot;, 0, &quot;aaa&quot;)` will succeed (replace chunk 0&apos;s data)
- `read(&quot;hello.txt&quot;)` =&gt; &quot;aaaefg&quot;
- `writeChunk(&quot;hello.txt&quot;, 3, &quot;hij&quot;)` will fail because the operation is not replacement or append.

With `writeChunk` 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 `read` method (which is friendly for large web objects such as HTML/SVG/PNG/JPG, etc).

For `write` method, calling a `write` method will replace all data chunks of the file with `write` method data, and one implementation can be:

1. `writeChunk(filename, chunkId=0, data_from_write)` to chunk 0 with the same `write` method data; and
2. `truncate(filename, chunkId=1)`, which will remove the rest chunks.

## Backwards Compatibility

No backwards compatibility issues were identified.

## Security Considerations

No security considerations were found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 18 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5018</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5018</guid>
      </item>
    
      <item>
        <title>Shareable Non-Fungible Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/new-nft-concept-shareable-nfts/8681</comments>
        
        <description>## Abstract

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.


## Motivation

NFT standards such as [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md) have been developed to standardize scarce digital resources. However, many non-fungible digital resources need not be scarce.

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.

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.

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&apos; 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 &apos;shareability&apos;. 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.

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&apos;t restricted that the interface should require any specific token type.

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.

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.

## Specification

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.

```solidity
///  Note: the ERC-165 identifier for this interface is 0xded6338b
interface IERC5023 is IERC165 {

  /// @dev This emits when a token is shared, reminted and given to another wallet that isn&apos;t function caller
  event Share(address indexed from, address indexed to, uint256 indexed tokenId, uint256 derivedFromtokenId);

  /// @dev 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. 
  function share(address to, uint256 tokenIdToBeShared) external returns(uint256 newTokenId);

} 
```

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.

## Rationale

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.

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 `Share` 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 `Share` 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.

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.

```text
B -&gt; A -&gt; C 
      \
       &gt;  D
```

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.

```text
 B----A----C         
  \_______/
```

## Backwards Compatibility

This proposal is backwards compatible with EIP-721 and EIP-1155.

## Reference Implementation

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.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

import &quot;./IERC5023.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/IERC721.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol&quot;;
import &quot;@openzeppelin/contracts/utils/Address.sol&quot;;
import &quot;@openzeppelin/contracts/utils/Context.sol&quot;;
import &quot;@openzeppelin/contracts/utils/Strings.sol&quot;;
import &quot;@openzeppelin/contracts/utils/introspection/ERC165.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol&quot;;
import &quot;@openzeppelin/contracts/access/Ownable.sol&quot;;

contract ShareableERC721 is ERC721URIStorage, Ownable, IERC5023 /* EIP165 */ {

  string baseURI;

  uint256 internal _currentIndex;
    
  constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {}

  function mint(
        address account,
        uint256 tokenId
    ) external onlyOwner {
        _mint(account, tokenId);
  }

  function setTokenURI(
        uint256 tokenId, 
        string memory tokenURI
    ) external {
        _setTokenURI(tokenId, tokenURI);
  }

  function setBaseURI(string memory baseURI_) external {
        baseURI = baseURI_;
  }
    
  function _baseURI() internal view override returns (string memory) {
        return baseURI;
  }

  function share(address to, uint256 tokenIdToBeShared) external returns(uint256 newTokenId) {
      require(to != address(0), &quot;ERC721: mint to the zero address&quot;);
      require(_exists(tokenIdToBeShared), &quot;ShareableERC721: token to be shared must exist&quot;);
      
      require(msg.sender == ownerOf(tokenIdToBeShared), &quot;Method caller must be the owner of token&quot;);

      string memory _tokenURI = tokenURI(tokenIdToBeShared);
      _mint(to, _currentIndex);
      _setTokenURI(_currentIndex, _tokenURI);

      emit Share(msg.sender, to, _currentIndex, tokenIdToBeShared);

      return _currentIndex;
  }

  function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        revert(&apos;In this reference implementation tokens are not transferrable&apos;);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        revert(&apos;In this reference implementation tokens are not transferrable&apos;);
    }
}

```

## Security Considerations

Reference implementation should not be used as is in production.
There are no other security considerations related directly to implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 28 Jan 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5023</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5023</guid>
      </item>
    
      <item>
        <title>Interactive NFTs with Modular Environments</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5050-nft-interaction-standard/9922</comments>
        
        <description>## Abstract

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.

## Motivation

Tokenized item standards such as [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md) serve as the objects of the Ethereum computing environment. A growing number of projects are seeking to build interactivity and *&quot;digital physics&quot;* 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.

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 *policies for interaction* can be as well. This allows clients to easily discover compatible senders and receivers, and allowed actions.

Aggregators can also parse action event logs to derive analytics on new action types, trending/popular/new interactive contracts, which token and state contract pairs users are likely to interact with, and other discovery tools to facilitate interaction.
 
### Benefits

1. Make interactive token contracts **discoverable and usable** by applications
2. Create a decentralized &quot;digital physics&quot; layer for gaming and other applications
3. Provide developers a simple solution with viable validity guarantees to make dynamic NFTs and other tokens 
4. 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;/finalized on L1).

## Specification

The key words &quot;MUST&quot;, &quot;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.

Smart contracts implementing this EIP standard MUST implement the [EIP-165](./eip-165.md) supportsInterface function and MUST return the constant value `true` if the `IERC5050Sender` interface ID `0xc8c6c9f3` and/or the `IERC5050Receiver` interface ID `0x1a3f02f4` is passed through the `interfaceID` argument (depending on which interface(s) the contract implements).

```solidity
pragma solidity ^0.8.0;

/// @param _address The address of the interactive object
/// @param tokenId The token that is interacting (optional)
struct Object {
    address _address;
    uint256 _tokenId;
}

/// @param selector The bytes4(keccack256()) encoding of the action string
/// @param user The address of the sender
/// @param from The initiating object
/// @param to The receiving object
/// @param state The state controller contract
/// @param data Additional data with no specified format
struct Action {
    bytes4 selector;
    address user;
    Object from;
    Object to;
    address state;
    bytes data;
}

/// @title EIP-5050 Interactive NFTs with Modular Environments
interface IERC5050Sender {
    /// @notice Send an action to the target address
    /// @dev The action&apos;s `fromContract` is automatically set to `address(this)`,
    /// and the `from` parameter is set to `msg.sender`.
    /// @param action The action to send
    function sendAction(Action memory action) external payable;

    /// @notice Check if an action is valid based on its hash and nonce
    /// @dev When an action passes through all three possible contracts
    /// (`fromContract`, `to`, and `state`) the `state` contract validates the
    /// action with the initiating `fromContract` using a nonced action hash.
    /// This hash is calculated and saved to storage on the `fromContract` before
    /// action handling is initiated. The `state` contract calculates the hash
    /// and verifies it and nonce with the `fromContract`.
    /// @param _hash The hash to validate
    /// @param _nonce The nonce to validate
    function isValid(bytes32 _hash, uint256 _nonce) external returns (bool);

    /// @notice Retrieve list of actions that can be sent.
    /// @dev Intended for use by off-chain applications to query compatible contracts,
    /// and to advertise functionality in human-readable form.
    function sendableActions() external view returns (string[] memory);

    /// @notice Change or reaffirm the approved address for an action
    /// @dev The zero address indicates there is no approved address.
    ///  Throws unless `msg.sender` is the `_account`, or an authorized
    ///  operator of the `_account`.
    /// @param _account The account of the account-action pair to approve
    /// @param _action The action of the account-action pair to approve
    /// @param _approved The new approved account-action controller
    function approveForAction(
        address _account,
        bytes4 _action,
        address _approved
    ) external returns (bool);

    /// @notice Enable or disable approval for a third party (&quot;operator&quot;) to conduct
    ///  all actions on behalf of `msg.sender`
    /// @dev Emits the ApprovalForAll event. The contract MUST allow
    ///  an unbounded number of operators per owner.
    /// @param _operator Address to add to the set of authorized operators
    /// @param _approved True if the operator is approved, false to revoke approval
    function setApprovalForAllActions(address _operator, bool _approved)
        external;

    /// @notice Get the approved address for an account-action pair
    /// @dev Throws if `_tokenId` is not a valid NFT.
    /// @param _account The account of the account-action to find the approved address for
    /// @param _action The action of the account-action to find the approved address for
    /// @return The approved address for this account-action, or the zero address if
    ///  there is none
    function getApprovedForAction(address _account, bytes4 _action)
        external
        view
        returns (address);

    /// @notice Query if an address is an authorized operator for another address
    /// @param _account The address on whose behalf actions are performed
    /// @param _operator The address that acts on behalf of the account
    /// @return True if `_operator` is an approved operator for `_account`, false otherwise
    function isApprovedForAllActions(address _account, address _operator)
        external
        view
        returns (bool);

    /// @dev This emits when an action is sent (`sendAction()`)
    event SendAction(
        bytes4 indexed name,
        address _from,
        address indexed _fromContract,
        uint256 _tokenId,
        address indexed _to,
        uint256 _toTokenId,
        address _state,
        bytes _data
    );

    /// @dev This emits when the approved address for an account-action pair
    ///  is changed or reaffirmed. The zero address indicates there is no
    ///  approved address.
    event ApprovalForAction(
        address indexed _account,
        bytes4 indexed _action,
        address indexed _approved
    );

    /// @dev This emits when an operator is enabled or disabled for an account.
    ///  The operator can conduct all actions on behalf of the account.
    event ApprovalForAllActions(
        address indexed _account,
        address indexed _operator,
        bool _approved
    );
}

interface IERC5050Receiver {
    /// @notice Handle an action
    /// @dev Both the `to` contract and `state` contract are called via
    /// `onActionReceived()`.
    /// @param action The action to handle
    function onActionReceived(Action calldata action, uint256 _nonce)
        external
        payable;

    /// @notice Retrieve list of actions that can be received.
    /// @dev Intended for use by off-chain applications to query compatible contracts,
    /// and to advertise functionality in human-readable form.
    function receivableActions() external view returns (string[] memory);

    /// @dev This emits when a valid action is received.
    event ActionReceived(
        bytes4 indexed name,
        address _from,
        address indexed _fromContract,
        uint256 _tokenId,
        address indexed _to,
        uint256 _toTokenId,
        address _state,
        bytes _data
    );
}
```

### Action Naming

Actions SHOULD use dot-separation for namespacing (e.g. `&quot;spells.cast&quot;` specifies the `&quot;cast&quot;` action with namespace `&quot;spells&quot;`), and arrow-separation for sequence specification (e.g. `&quot;settle&gt;build&quot;` indicating `&quot;settle&quot;` must be received before `&quot;build&quot;`).

### How State Contracts Work

Actions do not require that a state contract be used. Actions can be transmitted from one token contract (`Object`) to another, or from a user to a single token contract. In these cases, the sending and receiving contracts each control their own state.

State contracts allow arbitrary senders and receivers to share a user-specified state environment. Each `Object` 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.

The intended workflow is for state contracts to define stateful game environments, typically with a custom `IState` interface for use by other contracts. `Objects` register with state contracts to initialize their state. Then, users commit actions using a specific state contract to make things happen in the game.

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:

- Aggregator services can analyze action events to determine likely state contracts for a given sender/receiver
- Sender/receiver contracts can require a specific state contract
- Sender/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.
- 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).

#### Example

State Contract `FightGame` defines a fighting game environment. Token holders call `FightGame.register(contract, tokenId)` to randomly initialize their stats (strength/hp/etc.). An account which holds a registered token A of contract `Fighters`, calls `Fighters.sendAction(AttackAction)`, specifying token A from `Fighters` as the sender, token B from `Pacifists` contract as the receiver, and `FightGame` as the state contract.

The action is passed to token B, which may handle the action in whatever way it wants before passing the action to the `FightGame` state contract. The state contract can verify the stored action hash with the `Fighters` contract to validate the action is authentic before updating the stats if the tokens, dealing damage to token B.

Tokens A and B may update their metadata based on stats in the `FightGame` state contract, or based on their own stored data updated in response to sending/receiving actions.

### Extensions

#### Interactive

Some contracts may have custom user interfaces that facilitate interaction.

```solidity
pragma solidity ^0.8.0;

/// @title EIP-5050 Interactive NFTs with Modular Environments
interface IERC5050Interactive {
    function interfaceURI(bytes4 _action) external view returns (string);
}
```

#### Action Proxies

Action proxies can be used to support backwards compatibility with non-upgradeable contracts, and potentially for cross-chain action bridging.

They can be implemented using a modified version of [EIP-1820](./eip-1820.md#erc-1820-registry-smart-contract) that allows [EIP-173](./eip-173.md) contract owners to call `setManager()`.

#### Controllable

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.

Contracts that support Controllers SHOULD ignore require/revert statements related to action verification, and MUST NOT pass the action to the next contract in the chain.

```solidity
pragma solidity ^0.8.0;

/// @title EIP-5050 Action Controller
interface IControllable {
    
    /// @notice Enable or disable approval for a third party (&quot;controller&quot;) to force
    ///  handling of a given action without performing EIP-5050 validity checks.
    /// @dev Emits the ControllerApproval event. The contract MUST allow
    ///  an unbounded number of controllers per action.
    /// @param _controller Address to add to the set of authorized controllers
    /// @param _action Selector of the action for which the controller is approved / disapproved
    /// @param _approved True if the controller is approved, false to revoke approval
    function setControllerApproval(address _controller, bytes4 _action, bool _approved)
        external;

    /// @notice Enable or disable approval for a third party (&quot;controller&quot;) to force
    ///  action handling without performing EIP-5050 validity checks. 
    /// @dev Emits the ControllerApproval event. The contract MUST allow
    ///  an unbounded number of controllers per action.
    /// @param _controller Address to add to the set of authorized controllers
    /// @param _approved True if the controller is approved, false to revoke approval
    function setControllerApprovalForAll(address _controller, bool _approved)
        external;

    /// @notice Query if an address is an authorized controller for a given action.
    /// @param _controller The trusted third party address that can force action handling
    /// @param _action The action selector to query against
    /// @return True if `_controller` is an approved operator for `_account`, false otherwise
    function isApprovedController(address _controller, bytes4 _action)
        external
        view
        returns (bool);
    
    /// @dev This emits when a controller is enabled or disabled for the given
    ///  action. The controller can force `action` handling on the emitting contract, 
    ///  bypassing the standard EIP-5050 validity checks.
    event ControllerApproval(
        address indexed _controller,
        bytes4 indexed _action,
        bool _approved
    );
    
    /// @dev This emits when a controller is enabled or disabled for all actions.
    ///  Disabling all action approval for a controller does not override explicit action
    ///  action approvals. Controller&apos;s approved for all actions can force action handling 
    ///  on the emitting contract for any action.
    event ControllerApprovalForAll(
        address indexed _controller,
        bool _approved
    );
}
```

#### Metadata Update

Interactive NFTs are likely to update their metadata in response to certain actions and developers MAY want to implement [EIP-4906](./eip-4906.md) event emitters.

## Rationale

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 *useful* validity assurances at minimum gas overhead, 3) is easy for developers to implement, and 4) is easy for end-users to use.

### Action Names &amp; Selectors

Actions are advertised using human-readable strings, and processed using function selectors (`bytes4(keccack256(action_key))`). 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.

Off-chain services can easily convert the strings to `bytes4` selector encoding when interacting with contracts implementing this EIP or parsing `SendAction` and `ActionReceived` event logs.

### Validation

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 `user` account beyond using `tx.origin`, which is vulnerable to phishing attacks.

We considered using a signed message to validate user-intiation, but this approach had two major drawbacks:

1. **UX** users would be required to perform two steps to commit each action (sign the message, and send the transaction)
2. **Gas** performing signature verification is computationally expensive

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 *with* the malicious contract&apos;s assets. **This protocol treats the initiating contract&apos;s token as the prime mover, not the user.** 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/disallow-lists. [`Controllable`](#controllable) contracts can also be used via trusted controllers as an alternative to action chaining.

*Alternatives considered: action transmitted as a signed message, action saved to reusable storage slot on initiating contract*

### State Contracts

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.

The specifics of state contract interfaces are outside the scope of this standard, and are intended to be purpose-built for unique interactive environments.

### Gas and Complexity (regarding action chaining)

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.

*Alternatives considered: multi-request action chains that push-pull from one contract to the next.*

## Backwards Compatibility

Non-upgradeable, already deployed token contracts will not be compatible with this standard unless a proxy registry extension is used.

## Reference Implementation

A reference implementation is included in `../assets/eip-5050` with a simple stateless example [`ExampleToken2Token.sol`](../assets/eip-5050/ExampleToken2Token.sol), and a stateful example [`ExampleStateContract.sol`](../assets/eip-5050/ExampleStateContract.sol)

## Security Considerations

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 `action.from` 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.

As discussed in [Validation](#validation), this is viable because the initiating contract / token is treated as the prime mover, not the user.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 18 Apr 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5050</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5050</guid>
      </item>
    
      <item>
        <title>Lockable Non-Fungible Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5058-erc-721-lockable-standard/9201</comments>
        
        <description>## Abstract

We propose to extend the [EIP-721](./eip-721.md) standard with a secure locking mechanism. The NFT owners approve the operator to lock the NFT through `setLockApprovalForAll()` or `lockApprove()`. The approved operator locks the NFT through `lock()`. 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.

## Motivation

NFTs, enabled by [EIP-721](./eip-721.md), 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&apos; contracts, which poses inconveniences and risks to the owners:

1. Smart contract risks: NFTs can be lost or stolen due to bugs or vulnerabilities in the contracts.
2. 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&apos; custody.
3. 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.

All of the above are bad UX, and we believe the EIP-721 standard can be improved by adopting a native locking mechanism:

1. Instead of being transferred to a smart contract, an NFT remains in self-custody but locked.
2. While an NFT is locked, its transfer is prohibited. Other properties remain unaffected.
3. The owners can receive or claim airdrops themselves.

The value of an NFT can be reflected in two aspects: collection value and utility value. Collection value needs to ensure that the holder&apos;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&apos;s wallet.

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.

## Specification

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.

Lockable EIP-721 **MUST** implement the `IERC5058` interfaces:

```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.8;

/**
 * @dev EIP-721 Non-Fungible Token Standard, optional lockable extension
 * ERC721 Token that can be locked for a certain period and cannot be transferred.
 * This is designed for a non-escrow staking contract that comes later to lock a user&apos;s NFT
 * while still letting them keep it in their wallet.
 * This extension can ensure the security of user tokens during the staking period.
 * If the nft lending protocol is compatible with this extension, the trouble caused by the NFT
 * airdrop can be avoided, because the airdrop is still in the user&apos;s wallet
 */
interface IERC5058 {
    /**
     * @dev Emitted when `tokenId` token is locked by `operator` from `from`.
     */
    event Locked(address indexed operator, address indexed from, uint256 indexed tokenId, uint256 expired);

    /**
     * @dev Emitted when `tokenId` token is unlocked by `operator` from `from`.
     */
    event Unlocked(address indexed operator, address indexed from, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to lock the `tokenId` token.
     */
    event LockApproval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to lock all of its tokens.
     */
    event LockApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the locker who is locking the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function lockerOf(uint256 tokenId) external view returns (address locker);

    /**
     * @dev Lock `tokenId` token until the block number is greater than `expired` to be unlocked.
     *
     * Requirements:
     *
     * - `tokenId` token must be owned by `owner`.
     * - `expired` must be greater than block.number
     * - If the caller is not `owner`, it must be approved to lock this token
     * by either {lockApprove} or {setLockApprovalForAll}.
     *
     * Emits a {Locked} event.
     */
    function lock(uint256 tokenId, uint256 expired) external;

    /**
     * @dev Unlock `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` token must be owned by `owner`.
     * - the caller must be the operator who locks the token by {lock}
     *
     * Emits a {Unlocked} event.
     */
    function unlock(uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to lock `tokenId` token.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved lock operator.
     * - `tokenId` must exist.
     *
     * Emits an {LockApproval} event.
     */
    function lockApprove(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an lock operator for the caller.
     * Operators can call {lock} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {LockApprovalForAll} event.
     */
    function setLockApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account lock approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getLockApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to lock all of the assets of `owner`.
     *
     * See {setLockApprovalForAll}
     */
    function isLockApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Returns if the `tokenId` token is locked.
     */
    function isLocked(uint256 tokenId) external view returns (bool);

    /**
     * @dev Returns the `tokenId` token lock expired time.
     */
    function lockExpiredTime(uint256 tokenId) external view returns (uint256);
}
```

## Rationale

### NFT lock approvals

An NFT owner can give another trusted operator the right to lock his NFT through the approve functions. The `lockApprove()` function only approves for the specified NFT, whereas `setLockApprovalForAll()` approves for all NFTs of the collection under the wallet. When a user participates in an NFTFi project, the project contract calls `lock()` to lock the user&apos;s NFT. Locked NFTs cannot be transferred, but the NFTFi project contract can use the unlock function `unlock()` to unlock the NFT.

### NFT lock/unlock

Authorized project contracts have permission to lock NFT with the `lock` method. Locked NFTs cannot be transferred until the lock time expires. The project contract also has permission to unlock NFT in advance through the `unlock` function. Note that only the address of the locked NFT has permission to unlock that NFT.

### NFT lock period

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.

### Bound NFT

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.

### Bound NFT Factory

Bound NFT Factory is a common boundNFT factory, similar to Uniswap&apos;s [EIP-20](./eip-20.md) 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.


## Backwards Compatibility

This standard is compatible with EIP-721.

## Test Cases

Test cases written using hardhat can be found [here](../assets/eip-5058/test/test.ts)

## Reference Implementation

You can find an implementation of this standard in the [assets](../assets/eip-5058/ERC5058.sol) folder.

## Security Considerations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 30 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5058</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5058</guid>
      </item>
    
      <item>
        <title>URL Format for Ethereum Network Switching</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/5094-uri-format-for-ethereum-network-switching/9277</comments>
        
        <description>## Abstract

This standard includes all needed information for adding a network to a wallet via URL, by including parameters such as `chainId`, `rpc_url`, `chain_name` and others, such that the network configuration is provided through the URL itself.

## Motivation

As observed with the use of [EIP-681](./eip-681.md) 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.

This is understandable, as the `chain_id` 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 `pay-`, `tx-`, or other Ethereum URL interactions.

As an extension to [EIP-831](./eip-831.md) and neighboring [EIP-681](./eip-681.md) and [EIP-2400](./eip-2400.md), 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.

Introduction of this EIP is meant to bridge to a safer RPC listing system to be introduced in the near future.

## Specification

### Syntax

Network Switching URLs contain &quot;ethereum&quot; in their schema (protocol) part and are constructed as follows:

    network_add             = erc831_part &quot;add&quot; &quot;@&quot; chain_id [ &quot;/&quot; ] &quot;?&quot; parameters
    erc831_part             = &quot;ethereum:network-&quot;
    chain_id                = 1*DIGIT
    parameters              = parameter *( &quot;&amp;&quot; parameter )
    parameter               = key &quot;=&quot; value
    key                     = required_keys / optional_keys
    required_keys           = &quot;rpc_url&quot; / &quot;chain_name&quot;
    optional_keys           = &quot;name&quot; / &quot;symbol&quot; / &quot;decimals&quot; / &quot;explorer_url&quot; / &quot;icon_url&quot;
    value                   = STRING / number
    number                  = 1*DIGIT

`STRING` is a URL-encoded Unicode string of arbitrary length, where delimiters and the
percentage symbol (`%`) are mandatorily hex-encoded with a `%` prefix.

If the *key* in the parameter is `decimals` the *value* MUST be a `number`.

### Semantics

`chain_id` is mandatory and denotes the decimal chain ID, such that we have the identifier of the network we would like to add.

`rpc_url` is represented as an array of RPC URLs. A minimum of 1 `rpc_url` MUST be present, in the format of `rpc_url=https%3A%2F%2Fpolygon-rpc.com`, or when multiple present `rpc_url=https%3A%2F%2Fpolygon-rpc.com&amp;rpc_url=https%3A%2F%2Frpc-mainnet.matic.network`.

`chain_name` is required to specify the name of the network to be added.

`name` and `symbol` if provided, SHOULD be a human-readable string representing the native token.

`decimals` if provided, MUST be a non-negative integer representing the decimal precision of the native token.

`explorer_url` if provided, MUST specify one or more URLs pointing to block explorer web sites for the chain.

`icon_url` if provided, MUST specify one or more URLs pointing to reasonably sized images that can be used to visually identify the chain.

An example of adding a network with RPC endpoints `https://rpc-polygon.com` and `https://rpc-mainnet.matic.network`, the name `Polygon Mainnet`, token `Matic`, symbol `MATIC`, decimals `18`, explorer at `https://polygonscan.com/`, and Chain ID `137` would look as follows:

```URL
ethereum:network-add@137/?chain_name=Polygon%20Mainnet&amp;rpc_url=https%3A%2F%2Frpc-polygon.com&amp;rpc_url=https%3A%2F%2Frpc-mainnet.matic.network&amp;name=Matic&amp;symbol=MATIC&amp;decimals=18&amp;explorer_url=https%3A%2F%2Fpolygonscan.com
```

## Rationale

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.

The URL follows [EIP-831](./eip-831.md) with the `PREFIX` being `network` and the `PAYLOAD` being a composite of `add` and [EIP-681](./eip-681.md)-like `chain_id` and parameters.

The choice for `PREFIX` being `network` is to allow further expansion and allow variants following the pattern `network-x`.

An example URL for adding the Optimism Network

```URL
ethereum:network-add@10/?chain_name=Optimistic%20Ethereum
&amp;rpc_url=https%3A%2F%2Fmainnet.optimism.io&amp;name=Ethereum&amp;symbol=ETH&amp;decimals=18&amp;explorer_url=https%3A%2F%2Foptimistic.etherscan.io
```

The specification allows for a multitude of `rpc_url` and `explorer_url` to be specified. This is done such to overlap with parsing of the `TYPE` mentioned in [EIP-681](./eip-681.md).

## Security Considerations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 13 May 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5094</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5094</guid>
      </item>
    
      <item>
        <title>Principal Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5095-principal-token-standard/9259</comments>
        
        <description>## Abstract

Principal tokens represent ownership of an underlying [EIP-20](./eip-20.md) token at a future timestamp.

This specification is an extension on the [EIP-20](./eip-20.md) token that provides basic functionality for depositing
and withdrawing tokens and reading balances and the [EIP-2612](./eip-2612.md) specification that provides
[EIP-712](./eip-712.md) signature based approvals.

## Motivation

Principal tokens lack standardization which has led to a difficult to navigate development space and diverse implementation
schemes.

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/borrow.

This inconsistency in implementation makes integration difficult at the application layer as well as
wallet layer which are key catalysts for the space&apos;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. 

## Specification

All Principal Tokens (PTs) MUST implement [EIP-20](./eip-20.md) to represent ownership of future underlying redemption.
If a PT is to be non-transferrable, it MAY revert on calls to `transfer` or `transferFrom`.
The [EIP-20](./eip-20.md) operations `balanceOf`, `transfer`, `totalSupply`, etc. operate on the Principal Token balance.

All Principal Tokens MUST implement [EIP-20](./eip-20.md)&apos;s optional metadata extensions.
The `name` and `symbol` functions SHOULD reflect the underlying token&apos;s `name` and `symbol` in some way, as well as the origination protocol, and in the case of yield tokenization protocols, the origination money-market.

All Principal Tokens MAY implement [EIP-2612](./eip-2612.md) to improve the UX of approving PTs on various integrations.

### Definitions:

- underlying: The token that Principal Tokens are redeemable for at maturity.
  Has units defined by the corresponding [EIP-20](./eip-20.md) contract.
- maturity: The timestamp (unix) at which a Principal Token matures. Principal Tokens become redeemable for underlying at or after this timestamp.
- 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.
- slippage: Any difference between advertised redemption value and economic realities of PT redemption, which is not accounted by fees.

### Methods

#### `underlying`

The address of the underlying token used by the Principal Token for accounting, and redeeming.

MUST be an EIP-20 token contract.

MUST _NOT_ revert.

```yaml
- name: underlying
  type: function
  stateMutability: view

  inputs: []

  outputs:
    - name: underlyingAddress
      type: address
```

#### `maturity`

The unix timestamp (uint256) at or after which Principal Tokens can be redeemed for their underlying deposit.

MUST _NOT_ revert.

```yaml
- name: maturity
  type: function
  stateMutability: view

  inputs: []

  outputs:
    - name: timestamp
      type: uint256
```

#### `convertToUnderlying`

The amount of underlying that would be exchanged for the amount of PTs provided, in an ideal scenario where all the conditions are met.

Before maturity, the amount of underlying returned is as if the PTs would be at maturity.

MUST NOT be inclusive of any fees that are charged against redemptions.

MUST NOT show any variations depending on the caller.

MUST NOT reflect slippage or other on-chain conditions, when performing the actual redemption.

MUST NOT revert unless due to integer overflow caused by an unreasonably large input.

MUST round down towards 0.

This calculation MAY NOT reflect the &quot;per-user&quot; price-per-principal-token, and instead should reflect the &quot;average-user&apos;s&quot; price-per-principal-token, meaning what the average user should expect to see when exchanging to and from.

```yaml
- name: convertToUnderlying
  type: function
  stateMutability: view

  inputs:
    - name: principalAmount
      type: uint256

  outputs:
    - name: underlyingAmount
      type: uint256
```

#### `convertToPrincipal`

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.

MUST NOT be inclusive of any fees.

MUST NOT show any variations depending on the caller.

MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.

MUST NOT revert unless due to integer overflow caused by an unreasonably large input.

MUST round down towards 0.

This calculation MAY NOT reflect the &quot;per-user&quot; price-per-principal-token, and instead should reflect the &quot;average-user&apos;s&quot; price-per-principal-token, meaning what the average user should expect to see when redeeming.

```yaml
- name: convertToPrincipal
  type: function
  stateMutability: view

  inputs:
    - name: underlyingAmount
      type: uint256

  outputs:
    - name: principalAmount
      type: uint256
```

#### `maxRedeem`

Maximum amount of principal tokens that can be redeemed from the `holder` balance, through a `redeem` call.

MUST return the maximum amount of principal tokens that could be transferred from `holder` through `redeem` and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).

MUST factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0.

MUST NOT revert.

```yaml
- name: maxRedeem
  type: function
  stateMutability: view

  inputs:
    - name: holder
      type: address

  outputs:
    - name: maxPrincipalAmount
      type: uint256
```

#### `previewRedeem`

Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, given current on-chain conditions.

MUST return as close to and no more than the exact amount of underliyng that would be obtained in a `redeem` call in the same transaction. I.e. `redeem` should return the same or more `underlyingAmount` as `previewRedeem` if called in the same transaction.

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.

MUST be inclusive of redemption fees. Integrators should be aware of the existence of redemption fees.

MUST NOT revert due to principal token contract specific user/global limits. MAY revert due to other conditions that would also cause `redeem` to revert.

Note that any unfavorable discrepancy between `convertToUnderlying` and `previewRedeem` SHOULD be considered slippage in price-per-principal-token or some other type of condition.

```yaml
- name: previewRedeem
  type: function
  stateMutability: view

  inputs:
    - name: principalAmount
      type: uint256

  outputs:
    - name: underlyingAmount
      type: uint256
```

#### `redeem`

At or after maturity, burns exactly `principalAmount` of Principal Tokens from `from` and sends `underlyingAmount` of underlying tokens to `to`.

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. 

MUST emit the `Redeem` event.

MUST support a redeem flow where the Principal Tokens are burned from `holder` directly where `holder` is `msg.sender` or `msg.sender` has EIP-20 approval over the principal tokens of `holder`.
MAY support an additional flow in which the principal tokens are transferred to the Principal Token contract before the `redeem` execution, and are accounted for during `redeem`.

MUST revert if all of `principalAmount` cannot be redeemed (due to withdrawal limit being reached, slippage, the holder not having enough Principal Tokens, etc).

Note that some implementations will require pre-requesting to the Principal Token before a withdrawal may be performed. Those methods should be performed separately.

```yaml
- name: redeem
  type: function
  stateMutability: nonpayable

  inputs:
    - name: principalAmount
      type: uint256
    - name: to
      type: address
    - name: from
      type: address

  outputs:
    - name: underlyingAmount
      type: uint256
```

#### `maxWithdraw`

Maximum amount of the underlying asset that can be redeemed from the `holder` principal token balance, through a `withdraw` call.

MUST return the maximum amount of underlying tokens that could be redeemed from `holder` through `withdraw` and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).

MUST factor in both global and user-specific limits, like if withdrawals are entirely disabled (even temporarily) it MUST return 0.

MUST NOT revert.

```yaml
- name: maxWithdraw
  type: function
  stateMutability: view

  inputs:
    - name: holder
      type: address

  outputs:
    - name: maxUnderlyingAmount
      type: uint256
```

#### `previewWithdraw`

Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, given current on-chain conditions.

MUST return as close to and no fewer than the exact amount of principal tokens that would be burned in a `withdraw` call in the same transaction. I.e. `withdraw` should return the same or fewer `principalAmount` as `previewWithdraw` if called in the same transaction.

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.

MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.

MUST NOT revert due to principal token contract specific user/global limits. MAY revert due to other conditions that would also cause `withdraw` to revert.

Note that any unfavorable discrepancy between `convertToPrincipal` and `previewWithdraw` SHOULD be considered slippage in price-per-principal-token or some other type of condition.

```yaml
- name: previewWithdraw
  type: function
  stateMutability: view

  inputs:
    - name: underlyingAmount
      type: uint256

  outputs:
    - name: principalAmount
      type: uint256
```

#### `withdraw`

Burns `principalAmount` from `holder` and sends exactly `underlyingAmount` of underlying tokens to `receiver`.

MUST emit the `Redeem` event.

MUST support a withdraw flow where the principal tokens are burned from `holder` directly where `holder` is `msg.sender` or `msg.sender` has [EIP-20](./eip-20.md) approval over the principal tokens of `holder`.
 MAY support an additional flow in which the principal tokens are transferred to the principal token contract before the `withdraw` execution, and are accounted for during `withdraw`.

MUST revert if all of `underlyingAmount` cannot be withdrawn (due to withdrawal limit being reached, slippage, the holder not having enough principal tokens, etc).

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.

```yaml
- name: withdraw
  type: function
  stateMutability: nonpayable

  inputs:
    - name: underlyingAmount
      type: uint256
    - name: receiver
      type: address
    - name: holder
      type: address

  outputs:
    - name: principalAmount
      type: uint256
```

### Events

#### Redeem

`from` has exchanged `principalAmount` of Principal Tokens for `underlyingAmount` of underlying, and transferred that underlying to `to`.

MUST be emitted when Principal Tokens are burnt and underlying is withdrawn from the contract in the `EIP5095.redeem` method.

```yaml
- name: Redeem
  type: event

  inputs:
    - name: from
      indexed: true
      type: address
    - name: to
      indexed: true
      type: address
    - name: amount
      indexed: false
      type: uint256
```

## Rationale

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.

[EIP-20](./eip-20.md) is enforced as implementation details such as token approval and balance calculation directly carry over. This standardization makes Principal Tokens immediately compatible with all [EIP-20](./eip-20.md) use cases in addition to EIP-5095.

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 `redeem` 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.

This EIP draws heavily on the design of [EIP-4626](./eip-4626.md) because technically Principal Tokens could be described as a subset of Yield Bearing Vaults, extended with a `maturity` variable and restrictions on the implementation. However, extending [EIP-4626](./eip-4626.md) would force PT implementations to include methods (namely, `mint` and `deposit`) that are not necessary to the business case that PTs solve. It can also be argued that partial redemptions (implemented via `withdraw`) are rare for PTs.

PTs mature at a precise second, but given the reactive nature of smart contracts, there can&apos;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 `Redeem` event, or to track themselves when each PT is expected to have matured.

## Backwards Compatibility

This EIP is fully backward compatible with the [EIP-20](./eip-20.md) 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.

## Reference Implementation

```
// SPDX-License-Identifier: MIT
pragma solidity 0.8.14;

import {ERC20} from &quot;yield-utils-v2/contracts/token/ERC20.sol&quot;;
import {MinimalTransferHelper} from &quot;yield-utils-v2/contracts/token/MinimalTransferHelper.sol&quot;;

contract ERC5095 is ERC20 {
    using MinimalTransferHelper for ERC20;

    /* EVENTS
     *****************************************************************************************************************/

    event Redeem(address indexed from, address indexed to, uint256 underlyingAmount);

    /* MODIFIERS
     *****************************************************************************************************************/

    /// @notice A modifier that ensures the current block timestamp is at or after maturity.
    modifier afterMaturity() virtual {
        require(block.timestamp &gt;= maturity, &quot;BEFORE_MATURITY&quot;);
        _;
    }

    /* IMMUTABLES
     *****************************************************************************************************************/

    ERC20 public immutable underlying;
    uint256 public immutable maturity;

    /* CONSTRUCTOR
     *****************************************************************************************************************/

    constructor(
        string memory name_,
        string memory symbol_,
        uint8 decimals_,
        ERC20 underlying_,
        uint256 maturity_
    ) ERC20(name_, symbol_, decimals_) {
        underlying = underlying_;
        maturity = maturity_;
    }

    /* CORE FUNCTIONS
     *****************************************************************************************************************/

    /// @notice Burns an exact amount of principal tokens in exchange for an amount of underlying.
    /// @dev This reverts if before maturity.
    /// @param principalAmount The exact amount of principal tokens to be burned.
    /// @param from The owner of the principal tokens to be redeemed.  If not msg.sender then must have prior approval.
    /// @param to The address to send the underlying tokens.
    /// @return underlyingAmount The total amount of underlying tokens sent.
    function redeem(
        uint256 principalAmount,
        address from,
        address to
    ) public virtual afterMaturity returns (uint256 underlyingAmount) {
        _decreaseAllowance(from, principalAmount);

        // Check for rounding error since we round down in previewRedeem.
        require((underlyingAmount = _previewRedeem(principalAmount)) != 0, &quot;ZERO_ASSETS&quot;);

        _burn(from, principalAmount);

        emit Redeem(from, to, principalAmount);

        _transferOut(to, underlyingAmount);
    }

    /// @notice Burns a calculated amount of principal tokens in exchange for an exact amount of underlying.
    /// @dev This reverts if before maturity.
    /// @param underlyingAmount The exact amount of underlying tokens to be received.
    /// @param from The owner of the principal tokens to be redeemed.  If not msg.sender then must have prior approval.
    /// @param to The address to send the underlying tokens.
    /// @return principalAmount The total amount of underlying tokens redeemed.
    function withdraw(
        uint256 underlyingAmount,
        address from,
        address to
    ) public virtual afterMaturity returns (uint256 principalAmount) {
        principalAmount = _previewWithdraw(underlyingAmount); // No need to check for rounding error, previewWithdraw rounds up.

        _decreaseAllowance(from, principalAmount);

        _burn(from, principalAmount);

        emit Redeem(from, to, principalAmount);

        _transferOut(to, underlyingAmount);
    }

    /// @notice An internal, overridable transfer function.
    /// @dev Reverts on failed transfer.
    /// @param to The recipient of the transfer.
    /// @param amount The amount of the transfer.
    function _transferOut(address to, uint256 amount) internal virtual {
        underlying.safeTransfer(to, amount);
    }

    /* ACCOUNTING FUNCTIONS
     *****************************************************************************************************************/

    /// @notice Calculates the amount of underlying tokens that would be exchanged for a given amount of principal tokens.
    /// @dev Before maturity, it converts to underlying as if at maturity.
    /// @param principalAmount The amount principal on which to calculate conversion.
    /// @return underlyingAmount The total amount of underlying that would be received for the given principal amount..
    function convertToUnderlying(uint256 principalAmount) external view returns (uint256 underlyingAmount) {
        return _convertToUnderlying(principalAmount);
    }

    function _convertToUnderlying(uint256 principalAmount) internal view virtual returns (uint256 underlyingAmount) {
        return principalAmount;
    }

    /// @notice Converts a given amount of underlying tokens to principal exclusive of fees.
    /// @dev Before maturity, it converts to principal as if at maturity.
    /// @param underlyingAmount The total amount of underlying on which to calculate the conversion.
    /// @return principalAmount The amount principal tokens required to provide the given amount of underlying.
    function convertToPrincipal(uint256 underlyingAmount) external view returns (uint256 principalAmount) {
        return _convertToPrincipal(underlyingAmount);
    }

    function _convertToPrincipal(uint256 underlyingAmount) internal view virtual returns (uint256 principalAmount) {
        return underlyingAmount;
    }

    /// @notice Allows user to simulate redemption of a given amount of principal tokens, inclusive of fees and other
    /// current block conditions.
    /// @dev This reverts if before maturity.
    /// @param principalAmount The amount of principal that would be redeemed.
    /// @return underlyingAmount The amount of underlying that would be received.
    function previewRedeem(uint256 principalAmount) external view afterMaturity returns (uint256 underlyingAmount) {
        return _previewRedeem(principalAmount);
    }

    function _previewRedeem(uint256 principalAmount) internal view virtual returns (uint256 underlyingAmount) {
        return _convertToUnderlying(principalAmount); // should include fees/slippage
    }

    /// @notice Calculates the maximum amount of principal tokens that an owner could redeem.
    /// @dev This returns 0 if before maturity.
    /// @param owner The address for which the redemption is being calculated.
    /// @return maxPrincipalAmount The maximum amount of principal tokens that can be redeemed by the given owner.
    function maxRedeem(address owner) public view returns (uint256 maxPrincipalAmount) {
        return block.timestamp &gt;= maturity ? _balanceOf[owner] : 0;
    }

    /// @notice Allows user to simulate withdraw of a given amount of underlying tokens.
    /// @dev This reverts if before maturity.
    /// @param underlyingAmount The amount of underlying tokens that would be withdrawn.
    /// @return principalAmount The amount of principal tokens that would be redeemed.
    function previewWithdraw(uint256 underlyingAmount) external view afterMaturity returns (uint256 principalAmount) {
        return _previewWithdraw(underlyingAmount);
    }

    function _previewWithdraw(uint256 underlyingAmount) internal view virtual returns (uint256 principalAmount) {
        return _convertToPrincipal(underlyingAmount); // should include fees/slippage
    }

    /// @notice Calculates the maximum amount of underlying tokens that can be withdrawn by a given owner.
    /// @dev This returns 0 if before maturity.
    /// @param owner The address for which the withdraw is being calculated.
    /// @return maxUnderlyingAmount The maximum amount of underlying tokens that can be withdrawn by a given owner.
    function maxWithdraw(address owner) public view returns (uint256 maxUnderlyingAmount) {
        return _previewWithdraw(maxRedeem(owner));
    }
}

```

## Security Considerations

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.

It is recommended that all integrators review each implementation for potential ways of losing user deposits before integrating.

The `convertToUnderlying` method is an estimate useful for display purposes,
and do _not_ have to confer the _exact_ amount of underlying assets their context suggests.

As is common across many standards, it is strongly recommended to mirror the underlying token&apos;s `decimals` if at all possible, to eliminate possible sources of confusion and simplify integration across front-ends and for other off-chain users.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 01 May 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5095</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5095</guid>
      </item>
    
      <item>
        <title>Soulbound Badge</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5114-soulbound-token/9417</comments>
        
        <description>## Abstract

A soulbound badge is a token that, when minted, is bound to another Non-Fungible Token (NFT), and cannot be transferred/moved after that.


## Specification

```solidity
interface IERC5114 {
	// fired anytime a new instance of this badge is minted
	// this event **MUST NOT** be fired twice for the same `badgeId`
	event Mint(uint256 indexed badgeId, address indexed nftAddress, uint256 indexed nftTokenId);

	// returns the NFT that this badge is bound to.
	// this function **MUST** throw if the badge hasn&apos;t been minted yet
	// this function **MUST** always return the same result every time it is called after it has been minted
	// this function **MUST** return the same value as found in the original `Mint` event for the badge
	function ownerOf(uint256 badgeId) external view returns (address nftAddress, uint256 nftTokenId);

	// returns a URI with details about this badge collection
	// the metadata returned by this is merged with the metadata return by `badgeUri(uint256)`
	// the collectionUri **MUST** be immutable (e.g., ipfs:// and not http://)
	// the collectionUri **MUST** be content addressable (e.g., ipfs:// and not http://)
	// data from `badgeUri` takes precedence over data returned by this method
	// any external links referenced by the content at `collectionUri` also **MUST** follow all of the above rules
	function collectionUri() external pure returns (string collectionUri);

	// returns a censorship resistant URI with details about this badge instance
	// the collectionUri **MUST** be immutable (e.g., ipfs:// and not http://)
	// the collectionUri **MUST** be content addressable (e.g., ipfs:// and not http://)
	// data from this takes precedence over data returned by `collectionUri`
	// any external links referenced by the content at `badgeUri` also **MUST** follow all of the above rules
	function badgeUri(uint256 badgeId) external view returns (string badgeUri);

	// returns a string that indicates the format of the `badgeUri` and `collectionUri` results (e.g., &apos;EIP-ABCD&apos; or &apos;soulbound-schema-version-4&apos;)
	function metadataFormat() external pure returns (string format);
}
```

Implementers of this standard **SHOULD** also depend on a standard for interface detection so callers can easily find out if a given contract implements this interface.


## Rationale

### Immutability

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.

### Content Addressable URIs Required

Soulbound badges are meant to be permanent badges/indicators attached to a persona.
This means that not only can the user not transfer ownership, but the minter also cannot withdraw/transfer/change ownership as well.
This includes mutating or removing any remote content as a means of censoring or manipulating specific users.

### No Specification for `badgeUri` Data Format

The format of the data pointed to by `collectionUri()` and `badgeUri(uint256)`, 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 `metadataFormat` function can be used to inform a caller what type/format/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.


## Backwards Compatibility

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 `[address,id]`).


## Security Considerations

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&apos;t.
For example, the contract could allow transfers via some mechanism and simply not utilize them initially.

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.

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.


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 30 May 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5114</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5114</guid>
      </item>
    
      <item>
        <title>SY Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5115-super-composable-yield-token-standard/9423</comments>
        
        <description>## Abstract

This standard proposes an API for wrapped yield-bearing tokens within smart contracts. It is an extension on the [ERC-20](./eip-20.md) token that provides basic functionality for transferring, depositing, withdrawing tokens, as well as reading balances.

## Motivation

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. 

[ERC-4626](./eip-4626.md) tackled a significant part of this fragmentation by standardizing the interfaces for vaults, a major category among various yield generating mechanisms.

In this ERC, we’re extending the coverage to include assets beyond ERC-4626’s reach, namely:

- yield-bearing assets that have different input tokens used for minting vs accounting for the pool value.
  - 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).
  - 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.
- 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.
- This ERC can be extended further to include the handling of rewards, such as the claiming of accrued multiple rewards tokens.

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.

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:

- ERC-4626 will still be a popular vault standard, that most vaults should adopt.
- SY tokens can wrap over most yield generating mechanisms in DeFi, including ERC-4626 vaults for projects built on top of yield-bearing tokens.
- 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).
- Reward handling can be extended from the SY token.

### Use Cases

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:

- Money market supply positions
    - Lending DAI in Compound, getting DAI interests and COMP rewards
    - Lending ETH in BenQi, getting ETH interests and QI + AVAX rewards
    - Lending USDC in Aave, getting USDC interests and stkAAVE rewards
- AMM liquidity provision
    - Provide ETH + USDC to ETHUSDC pool in SushiSwap, getting swap fees in more ETH+USDC
    - Provide ETH + USDC to ETHUSDC pool in SushiSwap and stake it in Sushi Onsen, getting swap fees and SUSHI rewards
    - Provide USDC+DAI+USDT to 3crv pool and stake it in Convex, getting 3crv swap fees and CRV + CVX rewards
- Vault positions
    - Provide ETH into Yearn ERC-4626 vault, where the vault accrues yield from Yearn’s ETH strategy
    - Provide DAI into Harvest and staking it, getting DAI interests and FARM rewards
- Liquid staking positions
    - Holding stETH (in Lido), getting yields in more stETH
- Liquidity mining programs
    - Provide USDC in Stargate, getting STG rewards
    - Provide LOOKS in LooksRare, getting LOOKS yield and WETH rewards
- Rebasing tokens
    - Stake OHM into sOHM/gOHM, getting OHM rebase yield

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.

## Specification

### Generic Yield Generating Pool

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 **assets**. There are a number of users who contribute liquidity to the pool, in exchange for **shares** of the pool, which represents units of ownership of the pool. Over time, the value (measured in **assets**) of the pool grows, such that each **share** is worth more **assets** over time. The pool could earn a number of **reward tokens** over time, which are distributed to the users according to some logic (for example, proportionally the number of **shares**).

Here are the more concrete definitions of the terms:

#### GYGP Definitions:

- **asset**: Is a unit to measure the value of the pool. At time *t*, the pool has a total value of *TotalAsset(t)* **assets**.
- **shares**: Is a unit that represents ownership of the pool. At time *t*, there are *TotalShares(t)* **shares** in total.
- **reward tokens**: Over time, the pool earns $n_{rewards}$ types of reward tokens $(n_{rewards} \ge 0)$. At time *t*, $TotalRewards_i(t)$ is the amount of **reward token *i*** that has accumulated for the pool up until time *t*.
- **exchange rate**: At time *t*, the **exchange rate** *ExchangeRate(t)* is simply how many **assets** each **shares** is worth $ExchangeRate(t) = \frac{TotalAsset(t)}{TotalShares(t)}$
- **users**: At time *t*, each user *u* has $shares_u(t)$ **shares** in the pool, which is worth $asset_u(t) = shares_u(t) \cdot ExchangeRate(t)$  **assets**. Until time *t*, user *u* is entitled to receive a total of $rewards_{u_i}(t)$ **reward token *i***. The sum of all users’ shares, assets and rewards should be the same as the total shares, assets and rewards of the whole pool.

#### State changes:

1. A user deposits $d_a$ **assets** into the pool at time $t$ ($d_a$ could be negative, which means a withdraw from the pool). $d_s = d_a / ExchangeRate(t)$ new **shares** will be created and given
to user (or removed and burned from the user when $d_a$ is negative).
2. The pool earns $d_a$ (or loses $−d_a$ if $d_a$ is negative) **assets** at time $t$. The **exchange rate** simply increases (or decreases if $d_a$ is negative) due to the additional assets.
3. The pool earns $d_r$ **reward token** $i$. Every user will receive a certain amount of **reward token** $i$.

#### Examples of GYGPs in DeFi:

| Yield generating mechanism | Asset | Shares | Reward tokens | Exchange rate |
| --- | --- | --- | --- | --- |
| Supply USDC in Compound | USDC | cUSDC | COMP | USDC value per cUSDC, increases with USDC supply interests |
| ETH liquid staking in Lido | stETH | wstETH | None | stETH value per wstETH, increases with ETH staking rewards |
| Stake LOOKS in LooksRare Compounder | LOOKS | shares (in contract) | WETH | LOOKS value per shares, increases with LOOKS rewards |
| Stake APE in $APE Compounder | sAPE | shares (in contract) | APE | sAPE value per shares, increases with APE rewards |
| Provide ETH+USDC liquidity on Sushiswap | ETHUSDC liquidity (a pool of x ETH + y USDC has sqrt(xy) ETHUSDC liquidity) | ETHUSDC Sushiswap LP (SLP) token | None | ETHUSDC liquidity value per ETHUSDC SLP, increases due to swap fees |
| Provide ETH+USDC liquidity on Sushiswap and stake into Onsen | ETHUSDC liquidity (a pool of x ETH + y USDC has sqrt(xy) ETHUSDC liquidity) | ETHUSDC Sushiswap LP (SLP) token | SUSHI | ETHUSDC liquidity value per ETHUSDC SLP, increases due to swap fees |
| Provide BAL+WETH liquidity in Balancer (80% BAL, 20% WETH) | BALWETH liquidity (a pool of x BAL + y WETH has x^0.8*y^0.2 BALWETH liquidity) | BALWETH Balancer LP token | None | BALWETH liquidity per BALWETH Balancer LP token, increases due to swap fees |
| Provide USDC+USDT+DAI liquidity in Curve | 3crv pool’s liquidity (amount of D per 3crv token) | 3crv token | CRV | 3crv pool’s liquidity per 3crv token, increases due to swap fees |
| Provide FRAX+USDC liquidity in Curve then stake LP in Convex | BALWETH liquidity (a pool of x BAL + y WETH has x^0.8*y^0.2 BALWETH liquidity) | BALWETH Balancer LP token | None | BALWETH liquidity per BALWETH Balancer LP token, increases due to swap fees |


### Standardized Yield Token Standard

#### Overview:

Standardized Yield (SY) is a token standard for any yield generating mechanism that conforms to the GYGP model. Each SY token represents **shares** in a GYGP and allows for interacting with the GYGP via a standard interface.

All SY tokens:

- **MUST** implement **`ERC-20`** to represent shares in the underlying GYGP.
- **MUST** implement ERC-20’s optional metadata extensions `name`, `symbol`, and `decimals`, which **SHOULD** reflect the underlying GYGP’s accounting asset’s `name`, `symbol`, and `decimals`.
- **MAY** implement [ERC-2612](./eip-2612.md) to improve the UX of approving SY tokens on various integrations.
- **MAY** revert on calls to `transfer` and `transferFrom` if a SY token is to be non-transferable.
- The ERC-20 operations `balanceOf`, `transfer`, `totalSupply`, etc. **SHOULD** operate on the GYGP “shares”, which represent a claim to ownership on a fraction of the GYGP’s underlying holdings.

#### SY Definitions:

On top of the definitions above for GYGPs, we need to define 2 more concepts:

- **input tokens**: Are tokens that can be converted into assets to enter the pool. Each SY can accept several possible input tokens $tokens_{in_{i}}$

- **output tokens**: Are tokens that can be redeemed from assets when exiting the pool. Each SY can have several possible output tokens $tokens_{out_{i}}$

#### Interface

```solidity
interface IStandardizedYield {
    event Deposit(
        address indexed caller,
        address indexed receiver,
        address indexed tokenIn,
        uint256 amountDeposited,
        uint256 amountSyOut
    );

    event Redeem(
        address indexed caller,
        address indexed receiver,
        address indexed tokenOut,
        uint256 amountSyToRedeem,
        uint256 amountTokenOut
    );

    function deposit(
        address receiver,
        address tokenIn,
        uint256 amountTokenToDeposit,
        uint256 minSharesOut,
        bool depositFromInternalBalance
    ) external returns (uint256 amountSharesOut);

    function redeem(
        address receiver,
        uint256 amountSharesToRedeem,
        address tokenOut,
        uint256 minTokenOut,
        bool burnFromInternalBalance
    ) external returns (uint256 amountTokenOut);

    function exchangeRate() external view returns (uint256 res);

    function getTokensIn() external view returns (address[] memory res);

    function getTokensOut() external view returns (address[] memory res);

    function yieldToken() external view returns (address);

    function previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
        external
        view
        returns (uint256 amountSharesOut);

    function previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
        external
        view
        returns (uint256 amountTokenOut);

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);
}
```

#### Methods

```solidity
function deposit(
    address receiver,
    address tokenIn,
    uint256 amountTokenToDeposit,
    uint256 minSharesOut,
    bool depositFromInternalBalance
) external returns (uint256 amountSharesOut);
```

This function will deposit *amountTokenToDeposit* of input token $i$ (*tokenIn*) to mint new SY shares.

If *depositFromInternalBalance* is set to *false*, msg.sender will need to initially deposit *amountTokenToDeposit* of input token $i$ (*tokenIn*) into the SY contract, then this function will convert the *amountTokenToDeposit* of input token $i$ into $d_a$ worth of **asset** and deposit this amount into the pool for the *receiver*, who will receive *amountSharesOut* of SY tokens (**shares**). If *depositFromInternalBalance* is set to *true*, then *amountTokenToDeposit* of input token $i$ (*tokenIn*) will be taken from receiver directly (as msg.sender), and will be converted and shares returned to the receiver similarly to the first case.

This function should revert if $amountSharesOut \lt minSharesOut$.

- **MUST** emit the `Deposit` event.
- **MUST** support ERC-20’s `approve` / `transferFrom` flow where `tokenIn` 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.
- **MUST** revert if $amountSharesOut \lt minSharesOut$ (due to deposit limit being reached, slippage, or the user not approving enough `tokenIn` **to the SY contract, etc).
- **MAY** be payable if the `tokenIn` depositing asset is the chain&apos;s native currency (e.g. ETH).

```solidity
function redeem(
    address receiver,
    uint256 amountSharesToRedeem,
    address tokenOut,
    uint256 minTokenOut,
    bool burnFromInternalBalance
) external returns (uint256 amountTokenOut);
```

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 *amountTokenOut* of output token $i$ (*tokenOut*).

If *burnFromInternalBalance* is set to *false*, the user will need to initially deposit *amountSharesToRedeem* into the SY contract, then this function will burn the floating amount $d_s$ of SY tokens (**shares**) in the SY contract to redeem to output token $i$ (*tokenOut*). This pattern is similar to UniswapV2 which allows for more gas efficient ways to interact with the contract. If *burnFromInternalBalance* is set to *true*, then this function will burn *amountSharesToRedeem* $d_s$ of SY tokens directly from the user to redeem to output token $i$ (*tokenOut*).

This function should revert if $amountTokenOut \lt minTokenOut$.

- **MUST** emit the `Redeem` event.
- **MUST** support ERC-20’s `approve` / `transferFrom` 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.
- **MUST** revert if $amountTokenOut \lt minTokenOut$ (due to redeem limit being reached, slippage, or the user not approving enough `amountSharesToRedeem` to the SY contract, etc).

```solidity
function exchangeRate() external view returns (uint256 res);
```

This method updates and returns the latest **exchange rate**, which is the **exchange rate** from SY token amount into asset amount, scaled by a fixed scaling factor of 1e18.

- **MUST** return $ExchangeRate(t_{now})$ such that $ExchangeRate(t_{now}) \times syBalance / 1e18 = assetBalance$.
- **MUST NOT** include fees that are charged against the underlying yield token in the SY contract.

```solidity
function getTokensIn() external view returns (address[] memory res);
```

This read-only method returns the list of all input tokens that can be used to deposit into the SY contract.

- **MUST** return ERC-20 token addresses.
- **MUST** return at least one address.
- **MUST NOT** revert.

```solidity
function getTokensOut() external view returns (address[] memory res);
```

This read-only method returns the list of all output tokens that can be converted into when exiting the SY contract.

- **MUST** return ERC-20 token addresses.
- **MUST** return at least one address.
- **MUST NOT** revert.

```solidity
function yieldToken() external view returns (address);
```

This read-only method returns the underlying yield-bearing token (representing a GYGP) address.

- **MUST** return a token address that conforms to the ERC-20 interface, or zero address
- **MUST NOT** revert.
- **MUST** reflect the exact underlying yield-bearing token address if the SY token is a wrapped token.
- **MAY** return 0x or zero address if the SY token is natively implemented, and not from wrapping.

```solidity
function previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
    external
    view
    returns (uint256 amountSharesOut);
```

This read-only method returns the amount of shares that a user would have received if they deposit *amountTokenToDeposit* of *tokenIn*.

- **MUST** return less than or equal of *amountSharesOut* to the actual return value of the `deposit` method, and **SHOULD NOT** return greater than the actual return value of the `deposit` method.
- **SHOULD ONLY** revert if minting SY token with the entered parameters is forbidden (e.g. exceeding supply cap).

```solidity
function previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
    external
    view
    returns (uint256 amountTokenOut);
```

This read-only method returns the amount of *tokenOut* that a user would have received if they redeem *amountSharesToRedeem* of *tokenOut*.

- **MUST** return less than or equal of *amountTokenOut* to the actual return value of the `redeem` method, and **SHOULD NOT** return greater than the actual return value of the `redeem` method.
- **SHOULD ONLY** revert if burning SY token with the entered parameters is forbidden.

#### Events

```solidity
event Deposit(
    address indexed caller,
    address indexed receiver,
    address indexed tokenIn,
    uint256 amountDeposited,
    uint256 amountSyOut
);
```

`caller` has converted exact *tokenIn* tokens into SY (shares) and transferred those SY to `receiver`.

- **MUST** be emitted when input tokens are deposited into the SY contract via `deposit` method.

```solidity
event Redeem(
    address indexed caller,
    address indexed receiver,
    address indexed tokenOut,
    uint256 amountSyToRedeem,
    uint256 amountTokenOut
);
```

`caller` has converted exact SY (shares) into input tokens and transferred those input tokens to `receiver`.

- **MUST** be emitted when input tokens are redeemed from the SY contract via `redeem` method.

**&quot;SY&quot; Word Choice:**

&quot;SY&quot; (pronunciation: */sʌɪ/*), an abbreviation of Standardized Yield, was found to be appropriate to describe a broad universe of standardized composable yield-bearing digital assets.

## Rationale

[ERC-20](./eip-20.md) 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.

[ERC-165](./eip-165.md) can optionally be implemented should you want integrations to detect the IStandardizedYield interface implementation.

[ERC-2612](./eip-2612.md) can optionally be implemented in order to improve the UX of approving SY tokens on various integrations.

## Backwards Compatibility

This ERC is fully backwards compatible as its implementation extends the functionality of [ERC-20](./eip-20.md), however the optional metadata extensions, namely `name`, `decimals`, and `symbol` semantics MUST be implemented for all SY token implementations.

## Security Considerations

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.

`yieldToken` 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 30 May 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5115</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5115</guid>
      </item>
    
      <item>
        <title>SAFE Authentication For ENS</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5131-ens-subdomain-authentication/9458</comments>
        
        <description>## Abstract
This EIP links one or more signing wallets via Ethereum Name Service Specification ([EIP-137](./eip-137.md)) to prove control and asset ownership of a main wallet.

## Motivation
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&apos;s main wallet--is both insecure and inconvenient.

***Examples:***
 1. In order for you to edit your profile on OpenSea, you must sign a message with your wallet.
 2. In order to access NFT gated content, you must sign a message with the wallet containing the NFT in order to prove ownership.
 3. 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.
 4. In order to claim an airdrop, you must interact with the smart contract with the qualifying wallet.
 5. In order to prove ownership of an NFT, you must sign a payload with the wallet that owns that NFT.

In all the above examples, one interacts with the dApp or smart contract using the wallet itself, which may be
 - inconvenient (if it is controlled via a hardware wallet or a multi-sig)
 - insecure (since the above operations are read-only, but you are signing/interacting via a wallet that has write access)

Instead, one should be able to approve multiple wallets to authenticate on behalf of a given wallet.

### Problems with existing methods and solutions
Unfortunately, we&apos;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.

In addition to this, many users keep significant portions of their assets in &apos;cold storage&apos;. With the increased security from &apos;cold storage&apos; solutions, we usually see decreased accessibility because users naturally increase the barriers required to access these wallets.

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. 

### Proposal: Use the Ethereum Name Service (EIP-137)
Rather than &apos;re-invent the wheel&apos;, this proposal aims to use the widely adopted Ethereum Name Service in conjunction with the ENS Text Records feature ([EIP-634](./eip-634.md)) in order to achieve a safer and more convenient way to sign and authenticate, and provide &apos;read only&apos; access to a main wallet via one or more secondary wallets.

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.

#### Improving dApp Interaction Security
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.

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.

#### Improving Multiple Device Access Security
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.

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.

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.

#### Improving Convenience
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.

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.

## Specification
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.

Let:
 - `mainAddress` represent the wallet address we are trying to authenticate or prove asset ownership for.
 - `mainENS` represent the reverse lookup ENS string for `mainAddress`.
 - `authAddress` represent the address we want to use for signing in lieu of `mainAddress`.
 - `authENS` represent the reverse lookup ENS string for `authAddress`.
 - `authKey` represents a string in the format `[0-9A-Za-z]+`.

Control of `mainAddress` and ownership of `mainAddress` assets by `authAddress` is proven if all the following conditions are met:
 - `mainAddress` has an ENS resolver record and a reverse record set to `mainENS`.
 - `authAddress` has an ENS resolver record and a reverse record set to `authENS`.
 - `authENS` has an ENS TEXT record `eip5131:vault` in the format `&lt;authKey&gt;:&lt;mainAddress&gt;`.
 - `mainENS` has an ENS TEXT record `eip5131:&lt;authKey&gt;`.

### Setting up one or many `authAddress` records on a single ENS domain
The `mainAddress` MUST have an ENS resolver record and reverse record configured.
In order to automatically discover the linked account, the `authAddress` SHOULD have an ENS resolver record and reverse record configured.

1. Choose an unused `&lt;authKey&gt;`. This can be any string in the format `[0-0A-Za-z]+`.
2. Set a TEXT record `eip5131:&lt;authKey&gt;` on `mainENS`, with the value set to the desired `authAddress`.
3. Set a TEXT record `eip5131:vault` on `authENS`, with the value set to the `&lt;authKey&gt;:mainAddress`.

Currently this EIP does not enforce an upper-bound on the number of `authAddress` entries you can include. Users can repeat this process with as many address as they like.

### Authenticating `mainAddress` via `authAddress`
Control of `mainAddress` and ownership of `mainAddress` assets is proven if any associated `authAddress` is the `msg.sender` or has signed the message.

Practically, this would work by performing the following operations:
1. Get the resolver for `authENS`
2. Get the `eip5131:vault` TEXT record of `authENS`
3. Parse `&lt;authKey&gt;:&lt;mainAddress&gt;` to determine the `authKey` and `mainAddress`.
4. MUST get the reverse ENS record for `mainAddress` and verify that it matches `&lt;mainENS&gt;`.
    - Otherwise one could set up other ENS nodes (with auths) that point to `mainAddress` and authenticate via those.
5. Get the `eip5131:&lt;authKey&gt;` TEXT record of `mainENS` and ensure it matches `authAddress`.

Note that this specification allows for both contract level and client/server side validation of signatures.  It is not limited to smart contracts, which is why there is no proposed external interface definition.

### Revocation of `authAddress`
To revoke permission of `authAddress`, delete the `eip5131:&lt;authKey&gt;` TEXT record of `mainENS` or update it to point to a new `authAddress`.

## Rationale

### Usage of EIP-137
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.

However, the drawback to EIP-137 is that any linked `authAddress` must contain some ETH in order to set the `authENS` reverse record as well as the `eip5131:vault` TEXT record. This can be solved by a separate reverse lookup registry that enables `mainAddress` to set the reverse record and TEXT record with a message signed by `authAddress`.

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.

### One-to-Many Authentication Relationship
This proposed specification allows for a one (`mainAddress`) to many (`authAddress`) authentication relationship.  i.e. one `mainAddress` can authorize many `authAddress` to authenticate, but an `authAddress` can only authenticate itself or a single `mainAddress`.

The reason for this design choice is to allow for simplicity of authentication via client and smart contract code. You can determine which `mainAddress` the `authAddress` is signing for without any additional user input.

Further, you can design UX without any user interaction necessary to &apos;pick&apos; the interacting address by display assets owned by `authAddress` and `mainAddress` and use the appropriate address dependent on the asset the user is attempting to authenticate with.

## Reference Implementation

### Client/Server Side
In typescript, the validation function, using ethers.js would be as follows:
```
export interface LinkedAddress {
  ens: string,
  address: string,
}

export async function getLinkedAddress(
  provider: ethers.providers.EnsProvider, address: string
): Promise&lt;LinkedAddress | null&gt; {
  const addressENS = await provider.lookupAddress(address);
  if (!addressENS) return null;

  const vaultInfo = await (await provider.getResolver(addressENS))?.getText(&apos;eip5131:vault&apos;);
  if (!vaultInfo) return null;

  const vaultInfoArray = vaultInfo.split(&apos;:&apos;);
  if (vaultInfoArray.length !== 2) {
    throw new Error(&apos;EIP5131: Authkey and vault address not configured correctly.&apos;);
  }

  const [ authKey, vaultAddress ] = vaultInfoArray;

  const vaultENS = await provider.lookupAddress(vaultAddress);
  if (!vaultENS) {
    throw new Error(`EIP5131: No ENS domain with reverse record set for vault.`);
  };

  const expectedSigningAddress = await (
    await provider.getResolver(vaultENS)
  )?.getText(`eip5131:${authKey}`);

  if (expectedSigningAddress?.toLowerCase() !== address.toLowerCase()) {
    throw new Error(`EIP5131: Authentication mismatch.`);
  };

  return {
    ens: vaultENS,
    address: vaultAddress
  };
}
```

### Contract side

#### With a backend
If your application operates a secure backend server, you could run the client/server code above, then use the result in conjunction with specs like [EIP-1271](./eip-1271.md) : `Standard Signature Validation Method for Contracts` for a cheap and secure way to validate that the message signer is indeed authenticated for the main address.

#### Without a backend (JavaScript only)
Provided is a reference implementation for an internal function to verify that the message sender has an authentication link to the main address.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

/**
 * ENS Registry Interface
 */
interface ENS {
    function resolver(bytes32 node) external view returns (address);
}

/**
 * ENS Resolver Interface
 */
interface Resolver {
    function addr(bytes32 node) external view returns (address);
    function name(bytes32 node) external view returns (string memory);
    function text(bytes32 node, string calldata key) external view returns (string memory);
}

/**
 * Validate a signing address is associtaed with a linked address
 */
library LinkedAddress {
    /**
     * Validate that the message sender is an authentication address for mainAddress
     *
     * @param ensRegistry    Address of ENS registry
     * @param mainAddress     The main address we want to authenticate for.
     * @param mainENSNodeHash The main ENS Node Hash
     * @param authKey         The TEXT record of the authKey we are using for validation
     * @param authENSNodeHash The auth ENS Node Hash
     */
    function validateSender(
        address ensRegistry,
        address mainAddress,
        bytes32 mainENSNodeHash,
        string calldata authKey,
        bytes32 authENSNodeHash
    ) internal view returns (bool) {
        return validate(ensRegistry, mainAddress, mainENSNodeHash, authKey, msg.sender, authENSNodeHash);
    }

    /**
     * Validate that the authAddress is an authentication address for mainAddress
     *
     * @param ensRegistry     Address of ENS registry
     * @param mainAddress     The main address we want to authenticate for.
     * @param mainENSNodeHash The main ENS Node Hash
     * @param authAddress     The address of the authentication wallet
     * @param authENSNodeHash The auth ENS Node Hash
     */
    function validate(
        address ensRegistry,
        address mainAddress,
        bytes32 mainENSNodeHash,
        string calldata authKey,
        address authAddress,
        bytes32 authENSNodeHash
    ) internal view returns (bool) {
        _verifyMainENS(ensRegistry, mainAddress, mainENSNodeHash, authKey, authAddress);
        _verifyAuthENS(ensRegistry, mainAddress, authKey, authAddress, authENSNodeHash);

        return true;
    }

    // *********************
    //   Helper Functions
    // *********************
    function _verifyMainENS(
        address ensRegistry,
        address mainAddress,
        bytes32 mainENSNodeHash,
        string calldata authKey,
        address authAddress
    ) private view {
        // Check if the ENS nodes resolve correctly to the provided addresses
        address mainResolver = ENS(ensRegistry).resolver(mainENSNodeHash);
        require(mainResolver != address(0), &quot;Main ENS not registered&quot;);
        require(mainAddress == Resolver(mainResolver).addr(mainENSNodeHash), &quot;Main address is wrong&quot;);

        // Verify the authKey TEXT record is set to authAddress by mainENS
        string memory authText = Resolver(mainResolver).text(mainENSNodeHash, string(abi.encodePacked(&quot;eip5131:&quot;, authKey)));
        require(
            keccak256(bytes(authText)) == keccak256(bytes(_addressToString(authAddress))),
            &quot;Invalid auth address&quot;
        );
    }

    function _verifyAuthENS(
        address ensRegistry,
        address mainAddress,
        string memory authKey,
        address authAddress,
        bytes32 authENSNodeHash
    ) private view {
        // Check if the ENS nodes resolve correctly to the provided addresses
        address authResolver = ENS(ensRegistry).resolver(authENSNodeHash);
        require(authResolver != address(0), &quot;Auth ENS not registered&quot;);
        require(authAddress == Resolver(authResolver).addr(authENSNodeHash), &quot;Auth address is wrong&quot;);

        // Verify the TEXT record is appropriately set by authENS
        string memory vaultText = Resolver(authResolver).text(authENSNodeHash, &quot;eip5131:vault&quot;);
        require(
            keccak256(abi.encodePacked(authKey, &quot;:&quot;, _addressToString(mainAddress))) ==
                keccak256(bytes(vaultText)),
            &quot;Invalid auth text record&quot;
        );
    }

    bytes16 private constant _HEX_SYMBOLS = &quot;0123456789abcdef&quot;;

    function sha3HexAddress(address addr) private pure returns (bytes32 ret) {
        uint256 value = uint256(uint160(addr));
        bytes memory buffer = new bytes(40);
        for (uint256 i = 39; i &gt; 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value &amp; 0xf];
            value &gt;&gt;= 4;
        }
        return keccak256(buffer);
    }

    function _addressToString(address addr) private pure returns (string memory ptr) {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            ptr := mload(0x40)

            // Adjust mem ptr and keep 32 byte aligned
            // 32 bytes to store string length; address is 42 bytes long
            mstore(0x40, add(ptr, 96))

            // Store (string length, &apos;0&apos;, &apos;x&apos;) (42, 48, 120)
            // Single write by offsetting across 32 byte boundary
            ptr := add(ptr, 2)
            mstore(ptr, 0x2a3078)

            // Write string backwards
            for {
                // end is at &apos;x&apos;, ptr is at lsb char
                let end := add(ptr, 31)
                ptr := add(ptr, 71)
            } gt(ptr, end) {
                ptr := sub(ptr, 1)
                addr := shr(4, addr)
            } {
                let v := and(addr, 0xf)
                // if &gt; 9, use ascii &apos;a-f&apos; (no conditional required)
                v := add(v, mul(gt(v, 9), 39))
                // Add ascii for &apos;0&apos;
                v := add(v, 48)
                mstore8(ptr, v)
            }

            // return ptr to point to length (32 + 2 for &apos;0x&apos; - 1)
            ptr := sub(ptr, 33)
        }

        return string(ptr);
    }
}
```

## Security Considerations
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 &apos;read only&apos; authentication.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 03 Jun 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5131</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5131</guid>
      </item>
    
      <item>
        <title>Remote Procedure Call Provider Lists</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5139-remote-procedure-call-provider-lists/9517</comments>
        
        <description>## Abstract
This proposal specifies a JSON schema for describing lists of remote procedure call (RPC) providers for Ethereum-like chains, including their supported [EIP-155](./eip-155.md) `CHAIN_ID`.

## Motivation
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 [EIP-3085](./eip-3085.md) 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.

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.

## Specification

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.

### List Validation &amp; Schema

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.

Lists MUST conform to the following JSON Schema:

```json
{
  &quot;$schema&quot;: &quot;https://json-schema.org/draft/2020-12/schema&quot;,

  &quot;title&quot;: &quot;Ethereum RPC Provider List&quot;,
  &quot;description&quot;: &quot;Schema for lists of RPC providers compatible with Ethereum wallets.&quot;,

  &quot;$defs&quot;: {
    &quot;VersionBase&quot;: {
      &quot;type&quot;: &quot;object&quot;,
      &quot;description&quot;: &quot;Version of a list, used to communicate changes.&quot;,

      &quot;required&quot;: [
        &quot;major&quot;,
        &quot;minor&quot;,
        &quot;patch&quot;
      ],

      &quot;properties&quot;: {
        &quot;major&quot;: {
          &quot;type&quot;: &quot;integer&quot;,
          &quot;description&quot;: &quot;Major version of a list. Incremented when providers are removed from the list or when their chain ids change.&quot;,
          &quot;minimum&quot;: 0
        },

        &quot;minor&quot;: {
          &quot;type&quot;: &quot;integer&quot;,
          &quot;description&quot;: &quot;Minor version of a list. Incremented when providers are added to the list.&quot;,
          &quot;minimum&quot;: 0
        },

        &quot;patch&quot;: {
          &quot;type&quot;: &quot;integer&quot;,
          &quot;description&quot;: &quot;Patch version of a list. Incremented for any change not covered by major or minor versions, like bug fixes.&quot;,
          &quot;minimum&quot;: 0
        },

        &quot;preRelease&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;description&quot;: &quot;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.&quot;,
          &quot;pattern&quot;: &quot;^[1-9A-Za-z][0-9A-Za-z]*(\\.[1-9A-Za-z][0-9A-Za-z]*)*$&quot;
        }
      }
    },

    &quot;Version&quot;: {
      &quot;type&quot;: &quot;object&quot;,
      &quot;additionalProperties&quot;: false,

      &quot;allOf&quot;: [
      {
        &quot;$ref&quot;: &quot;#/$defs/VersionBase&quot;
      }
      ],

      &quot;properties&quot;: {
        &quot;major&quot;: true,
        &quot;minor&quot;: true,
        &quot;patch&quot;: true,
        &quot;preRelease&quot;: true,
        &quot;build&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;description&quot;: &quot;Build metadata associated with a list.&quot;,
          &quot;pattern&quot;: &quot;^[0-9A-Za-z-]+(\\.[0-9A-Za-z-])*$&quot;
        }
      }
    },

    &quot;VersionRange&quot;: {
      &quot;type&quot;: &quot;object&quot;,
      &quot;additionalProperties&quot;: false,

      &quot;properties&quot;: {
        &quot;major&quot;: true,
        &quot;minor&quot;: true,
        &quot;patch&quot;: true,
        &quot;preRelease&quot;: true,
        &quot;mode&quot;: true
      },

      &quot;allOf&quot;: [
        {
          &quot;$ref&quot;: &quot;#/$defs/VersionBase&quot;
        }
      ],

      &quot;oneOf&quot;: [
        {
          &quot;properties&quot;: {
            &quot;mode&quot;: {
              &quot;type&quot;: &quot;string&quot;,
              &quot;enum&quot;: [&quot;^&quot;, &quot;=&quot;]
            },
            &quot;preRelease&quot;: false
          }
        },
      {
        &quot;required&quot;: [
          &quot;preRelease&quot;,
          &quot;mode&quot;
        ],

        &quot;properties&quot;: {
          &quot;mode&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;enum&quot;: [&quot;=&quot;]
          }
        }
      }
      ]
    },

    &quot;Logo&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;A URI to a logo; suggest SVG or PNG of size 64x64&quot;,
      &quot;format&quot;: &quot;uri&quot;
    },

    &quot;ProviderChain&quot;: {
      &quot;type&quot;: &quot;object&quot;,
      &quot;description&quot;: &quot;A single chain supported by a provider&quot;,
      &quot;additionalProperties&quot;: false,
      &quot;required&quot;: [
        &quot;chainId&quot;,
        &quot;endpoints&quot;
      ],
      &quot;properties&quot;: {
        &quot;chainId&quot;: {
          &quot;type&quot;: &quot;integer&quot;,
          &quot;description&quot;: &quot;Chain ID of an Ethereum-compatible network&quot;,
          &quot;minimum&quot;: 1
        },
        &quot;endpoints&quot;: {
          &quot;type&quot;: &quot;array&quot;,
          &quot;minItems&quot;: 1,
          &quot;uniqueItems&quot;: true,
          &quot;items&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;format&quot;: &quot;uri&quot;
          }
        }
      }
    },

    &quot;Provider&quot;: {
      &quot;type&quot;: &quot;object&quot;,
      &quot;description&quot;: &quot;Description of an RPC provider.&quot;,
      &quot;additionalProperties&quot;: false,

      &quot;required&quot;: [
        &quot;chains&quot;,
        &quot;name&quot;
      ],

      &quot;properties&quot;: {
        &quot;name&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;description&quot;: &quot;Name of the provider.&quot;,
          &quot;minLength&quot;: 1,
          &quot;maxLength&quot;: 40,
          &quot;pattern&quot;: &quot;^[ \\w.&apos;+\\-%/À-ÖØ-öø-ÿ:&amp;\\[\\]\\(\\)]+$&quot;
        },
        &quot;logo&quot;: {
          &quot;$ref&quot;: &quot;#/$defs/Logo&quot;
        },
        &quot;priority&quot;: {
          &quot;type&quot;: &quot;integer&quot;,
          &quot;description&quot;: &quot;Priority of this provider (where zero is the highest priority.)&quot;,
          &quot;minimum&quot;: 0
        },
        &quot;chains&quot;: {
          &quot;type&quot;: &quot;array&quot;,
          &quot;items&quot;: {
            &quot;$ref&quot;: &quot;#/$defs/ProviderChain&quot;
          }
        }
      }
    },

    &quot;Path&quot;: {
      &quot;description&quot;: &quot;A JSON Pointer path.&quot;,
      &quot;type&quot;: &quot;string&quot;
    },

    &quot;Patch&quot;: {
      &quot;items&quot;: {
        &quot;oneOf&quot;: [
          {
            &quot;additionalProperties&quot;: false,
            &quot;required&quot;: [&quot;value&quot;, &quot;op&quot;, &quot;path&quot;],
            &quot;properties&quot;: {
              &quot;path&quot;: {
                &quot;$ref&quot;: &quot;#/$defs/Path&quot;
              },
              &quot;op&quot;: {
                &quot;description&quot;: &quot;The operation to perform.&quot;,
                &quot;type&quot;: &quot;string&quot;,
                &quot;enum&quot;: [&quot;add&quot;, &quot;replace&quot;, &quot;test&quot;]
              },
              &quot;value&quot;: {
                &quot;description&quot;: &quot;The value to add, replace or test.&quot;
              }
            }
          },
          {
            &quot;additionalProperties&quot;: false,
            &quot;required&quot;: [&quot;op&quot;, &quot;path&quot;],
            &quot;properties&quot;: {
              &quot;path&quot;: {
                &quot;$ref&quot;: &quot;#/$defs/Path&quot;
              },
              &quot;op&quot;: {
                &quot;description&quot;: &quot;The operation to perform.&quot;,
                &quot;type&quot;: &quot;string&quot;,
                &quot;enum&quot;: [&quot;remove&quot;]
              }
            }
          },
          {
            &quot;additionalProperties&quot;: false,
            &quot;required&quot;: [&quot;from&quot;, &quot;op&quot;, &quot;path&quot;],
            &quot;properties&quot;: {
              &quot;path&quot;: {
                &quot;$ref&quot;: &quot;#/$defs/Path&quot;
              },

              &quot;op&quot;: {
                &quot;description&quot;: &quot;The operation to perform.&quot;,
                &quot;type&quot;: &quot;string&quot;,
                &quot;enum&quot;: [&quot;move&quot;, &quot;copy&quot;]
              },
              &quot;from&quot;: {
                &quot;$ref&quot;: &quot;#/$defs/Path&quot;,
                &quot;description&quot;: &quot;A JSON Pointer path pointing to the location to move/copy from.&quot;
              }
            }
          }
        ]
      },
      &quot;type&quot;: &quot;array&quot;
    }
  },

  &quot;type&quot;: &quot;object&quot;,
  &quot;additionalProperties&quot;: false,

  &quot;required&quot;: [
    &quot;name&quot;,
    &quot;version&quot;,
    &quot;timestamp&quot;
  ],

  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Name of the provider list&quot;,
      &quot;minLength&quot;: 1,
      &quot;maxLength&quot;: 40,
      &quot;pattern&quot;: &quot;^[\\w ]+$&quot;
    },
    &quot;logo&quot;: {
      &quot;$ref&quot;: &quot;#/$defs/Logo&quot;
    },
    &quot;version&quot;: {
      &quot;$ref&quot;: &quot;#/$defs/Version&quot;
    },
    &quot;timestamp&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;format&quot;: &quot;date-time&quot;,
      &quot;description&quot;: &quot;The timestamp of this list version; i.e. when this immutable version of the list was created&quot;
    },
    &quot;extends&quot;: true,
    &quot;changes&quot;: true,
    &quot;providers&quot;: true
  },

  &quot;oneOf&quot;: [
    {
      &quot;type&quot;: &quot;object&quot;,

      &quot;required&quot;: [
        &quot;extends&quot;,
        &quot;changes&quot;
      ],

      &quot;properties&quot;: {
        &quot;providers&quot;: false,

        &quot;extends&quot;: {
          &quot;type&quot;: &quot;object&quot;,
          &quot;additionalProperties&quot;: false,

          &quot;required&quot;: [
            &quot;version&quot;
          ],

          &quot;properties&quot;: {
            &quot;uri&quot;: {
              &quot;type&quot;: &quot;string&quot;,
              &quot;format&quot;: &quot;uri&quot;,
              &quot;description&quot;: &quot;Location of the list to extend, as a URI.&quot;
            },
            &quot;ens&quot;: {
              &quot;type&quot;: &quot;string&quot;,
              &quot;description&quot;: &quot;Location of the list to extend using EIP-1577.&quot;
            },
            &quot;version&quot;: {
              &quot;$ref&quot;: &quot;#/$defs/VersionRange&quot;
            }
          },

          &quot;oneOf&quot;: [
            {
              &quot;properties&quot;: {
                &quot;uri&quot;: false,
                &quot;ens&quot;: true
              }
            },
            {
              &quot;properties&quot;: {
                &quot;ens&quot;: false,
                &quot;uri&quot;: true
              }
            }
          ]
        },
        &quot;changes&quot;: {
          &quot;$ref&quot;: &quot;#/$defs/Patch&quot;
        }
      }
    },
    {
      &quot;type&quot;: &quot;object&quot;,

      &quot;required&quot;: [
        &quot;providers&quot;
      ],

      &quot;properties&quot;: {
        &quot;changes&quot;: false,
        &quot;extends&quot;: false,
        &quot;providers&quot;: {
          &quot;type&quot;: &quot;object&quot;,
          &quot;additionalProperties&quot;: {
            &quot;$ref&quot;: &quot;#/$defs/Provider&quot;
          }
        }
      }
    }
  ]
}
```

For illustrative purposes, the following is an example list following the schema:

```json
{
  &quot;name&quot;: &quot;Example Provider List&quot;,
  &quot;version&quot;: {
    &quot;major&quot;: 0,
    &quot;minor&quot;: 1,
    &quot;patch&quot;: 0,
    &quot;build&quot;: &quot;XPSr.p.I.g.l&quot;
  },
  &quot;timestamp&quot;: &quot;2004-08-08T00:00:00.0Z&quot;,
  &quot;logo&quot;: &quot;https://mylist.invalid/logo.png&quot;,
  &quot;providers&quot;: {
    &quot;some-key&quot;: {
      &quot;name&quot;: &quot;Frustrata&quot;,
      &quot;chains&quot;: [
        {
          &quot;chainId&quot;: 1,
          &quot;endpoints&quot;: [
            &quot;https://mainnet1.frustrata.invalid/&quot;,
            &quot;https://mainnet2.frustrana.invalid/&quot;
          ]
        },
        {
          &quot;chainId&quot;: 3,
          &quot;endpoints&quot;: [
            &quot;https://ropsten.frustrana.invalid/&quot;
          ]
        }
      ]
    },
    &quot;other-key&quot;: {
      &quot;name&quot;: &quot;Sourceri&quot;,
      &quot;priority&quot;: 3,
      &quot;chains&quot;: [
        {
          &quot;chainId&quot;: 1,
          &quot;endpoints&quot;: [
            &quot;https://mainnet.sourceri.invalid/&quot;
          ]
        },
        {
          &quot;chainId&quot;: 42,
          &quot;endpoints&quot;: [
            &quot;https://kovan.sourceri.invalid&quot;
          ]
        }
      ]
    }
  }
}
```

### Versioning

List versioning MUST follow the [Semantic Versioning 2.0.0](../assets/eip-5139/semver.md) (SemVer) specification.

The major version MUST be incremented for the following modifications:

 - Removing a provider.
 - Changing a provider&apos;s key in the `providers` object.
 - Removing the last `ProviderChain` for a chain id.

The major version MAY be incremented for other modifications, as permitted by SemVer.

If the major version is not incremented, the minor version MUST be incremented if any of the following modifications are made:

 - Adding a provider.
 - Adding the first `ProviderChain` of a chain id.

The minor version MAY be incremented for other modifications, as permitted by SemVer.

If the major and minor versions are unchanged, the patch version MUST be incremented for any change.

### Publishing

Provider lists SHOULD be published to an Ethereum Name Service (ENS) name using [EIP-1577](./eip-1577.md)&apos;s `contenthash` mechanism on mainnet.

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 `Access-Control-Allow-Origin: *`.)

### Priority

Provider entries MAY contain a `priority` field. A `priority` value of zero SHALL indicate the highest priority, with increasing `priority` values indicating decreasing priority. Multiple providers MAY be assigned the same priority. All providers without a `priority` field SHALL have equal priority. Providers without a `priority` field SHALL always have a lower priority than any provider with a `priority` field.

List consumers MAY use `priority` fields to choose when to connect to a provider, but MAY ignore it entirely. List consumers SHOULD explain to users how their implementation interprets `priority`.

### List Subtypes

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.

#### Root Lists

A root list has a top-level `providers` key.

#### Extension Lists

An extension list has top-level `extends` and `changes` keys.

##### Specifying a Parent (`extends`)

The `uri` and `ens` fields SHALL point to a source for the parent list.

If present, the `uri` field MUST use a scheme specified in [Publishing](#publishing).

If present, the `ens` field MUST specify an ENS name to be resolved using EIP-1577.

The `version` field SHALL specify a range of compatible versions. List consumers MUST reject extension lists specifying an incompatible parent version.

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.

###### Default Mode

If the `mode` field is omitted, a parent version SHALL be compatible if and only if the parent&apos;s version number matches the left-most non-zero portion in the major, minor, patch grouping.

For example:

```javascript
{
  &quot;major&quot;: &quot;1&quot;,
  &quot;minor&quot;: &quot;2&quot;,
  &quot;patch&quot;: &quot;3&quot;
}
```

Is equivalent to:

```
&gt;=1.2.3, &lt;2.0.0
```

And:

```javascript
{
  &quot;major&quot;: &quot;0&quot;,
  &quot;minor&quot;: &quot;2&quot;,
  &quot;patch&quot;: &quot;3&quot;
}
```

Is equivalent to:

```
&gt;=0.2.3, &lt;0.3.0
```

###### Caret Mode (`^`)

The `^` mode SHALL behave exactly as the default mode above.

###### Exact Mode (`=`)

In `=` mode, a parent version SHALL be compatible if and only if the parent&apos;s version number exactly matches the specified version.

##### Specifying Changes (`changes`)

The `changes` field SHALL be a JavaScript Object Notation (JSON) Patch document as specified in RFC 6902.

JSON pointers within the `changes` field MUST be resolved relative to the `providers` field of the parent list. For example, see the following lists for a correctly formatted extension.

###### Root List

```json
TODO
```

###### Extension List

```json
TODO
```

##### Applying Extension Lists

List consumers MUST follow this algorithm to apply extension lists:

 1. Is the current list an extension list?
    * Yes:
       1. Ensure that this `from` has not been seen before.
       1. Retrieve the parent list.
       1. Verify that the parent list is valid according to the JSON schema.
       1. Ensure that the parent list is version compatible.
       1. Set the current list to the parent list and go to step 1.
    * No:
       1. Go to step 2.
 1. Copy the current list into a variable `$output`.
 1. Does the current list have a child:
    * Yes:
       1. Apply the child&apos;s `changes` to `providers` in `$output`.
       1. Verify that `$output` is valid according to the JSON schema.
       1. Set the current list to the child.
       1. Go to step 3.
    * No:
       1. Replace the current list&apos;s `providers` with `providers` from `$output`.
       1. The current list is now the resolved list; return it.


List consumers SHOULD limit the number of extension lists to a reasonable number.

## Rationale

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.

Each provider may specify multiple endpoints to implement load balancing or redundancy.

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.

## Security Considerations

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.

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.

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, **can lie about the contents of the list**.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 06 Jun 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5139</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5139</guid>
      </item>
    
      <item>
        <title>Slippage Protection for Tokenized Vault</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5143-slippage-protection-for-tokenized-vaults/9554</comments>
        
        <description>## Abstract

The following standard extends the [EIP-4626](./eip-4626.md) Tokenized Vault standard with functions dedicated to the safe interaction between EOAs and the vault when price is subject to slippage.

## Motivation

[EIP-4626](./eip-4626.md) security considerations section states that:
&gt; &quot;If implementors intend to support EOA account access directly, they should consider adding an additional function call for deposit/mint/withdraw/redeem with the means to accommodate slippage loss or unexpected deposit/withdrawal limits, since they have no other means to revert the transaction if the exact output amount is not achieved.&quot;

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.

## Specification

This ERC is an extension of EIP-4626. Any contract implementing it MUST also implement EIP-4626.

### Methods

#### deposit

Overloaded version of ERC-4626&apos;s `deposit`.

Mints `shares` Vault shares to `receiver` by depositing exactly `assets` of underlying tokens.

MUST emit the `Deposit` event.

MUST support [EIP-20](./eip-20.md) `approve` / `transferFrom` on `asset` as a deposit flow.
MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the `deposit` execution, and are accounted for during `deposit`.

MUST revert if all of `assets` 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 `assets` underlying asset mints less then `minShares` shares.

Note that most implementations will require pre-approval of the Vault with the Vault&apos;s underlying `asset` token.

```yaml
- name: deposit
  type: function
  stateMutability: nonpayable

  inputs:
    - name: assets
      type: uint256
    - name: receiver
      type: address
    - name: minShares
      type: uint256

  outputs:
    - name: shares
      type: uint256
```

#### mint

Overloaded version of ERC-4626&apos;s `mint`.

Mints exactly `shares` Vault shares to `receiver` by depositing `assets` of underlying tokens.

MUST emit the `Deposit` event.

MUST support ERC-20 `approve` / `transferFrom` on `asset` as a mint flow.
MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the `mint` execution, and are accounted for during `mint`.

MUST revert if all of `shares` 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 `shares` shares cost more then `maxAssets` underlying tokens.

Note that most implementations will require pre-approval of the Vault with the Vault&apos;s underlying `asset` token.

```yaml
- name: mint
  type: function
  stateMutability: nonpayable

  inputs:
    - name: shares
      type: uint256
    - name: receiver
      type: address
    - name: maxAssets
      type: uint256

  outputs:
    - name: assets
      type: uint256
```

#### withdraw

Overloaded version of ERC-4626&apos;s `withdraw`.

Burns `shares` from `owner` and sends exactly `assets` of underlying tokens to `receiver`.

MUST emit the `Withdraw` event.

MUST support a withdraw flow where the shares are burned from `owner` directly where `owner` is `msg.sender` or `msg.sender` has ERC-20 approval over the shares of `owner`.
MAY support an additional flow in which the shares are transferred to the Vault contract before the `withdraw` execution, and are accounted for during `withdraw`.

MUST revert if all of `assets` cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).
MUST revert if withdrawing `assets` underlying tokens requires burning more then `maxShares` shares.

Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.

```yaml
- name: withdraw
  type: function
  stateMutability: nonpayable

  inputs:
    - name: assets
      type: uint256
    - name: receiver
      type: address
    - name: owner
      type: address
    - name: maxShares
      type: uint256

  outputs:
    - name: shares
      type: uint256
```

#### redeem

Overloaded version of ERC-4626&apos;s `redeem`.

Burns exactly `shares` from `owner` and sends `assets` of underlying tokens to `receiver`.

MUST emit the `Withdraw` event.

MUST support a redeem flow where the shares are burned from `owner` directly where `owner` is `msg.sender` or `msg.sender` has ERC-20 approval over the shares of `owner`.
MAY support an additional flow in which the shares are transferred to the Vault contract before the `redeem` execution, and are accounted for during `redeem`.

MUST revert if all of `shares` cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc).
MUST revert if redeeming `shares` shares sends less than `minAssets` underlying tokens to `receiver`.

Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately.

```yaml
- name: redeem
  type: function
  stateMutability: nonpayable

  inputs:
    - name: shares
      type: uint256
    - name: receiver
      type: address
    - name: owner
      type: address
    - name: minAssets
      type: uint256

  outputs:
    - name: assets
      type: uint256
```

## Rationale

This ERC&apos;s functions do not replace ERC-4626 equivalent mechanisms. They are additional (overloaded) methods designed to protect EOAs interacting with the vault.

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&apos;s interractons with an ERC-4626 vault possibly risky.

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.

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.

### Alternative approaches

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; 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.

## Reference Implementation

Given an existing ERC-4626 implementation

``` solidity
contract ERC5143 is ERC4626 {
    function deposit(uint256 assets, address receiver, uint256 minShares) public virtual returns (uint256) {
        uint256 shares = deposit(assets, receiver);
        require(shares &gt;= minShares, &quot;ERC5143: deposit slippage protection&quot;);
        return shares;
    }
    function mint(uint256 shares, address receiver, uint256 maxAssets) public virtual returns (uint256) {
        uint256 assets = mint(shares, receiver);
        require(assets &lt;= maxAssets, &quot;ERC5143: mint slippage protection&quot;);
        return assets;
    }
    function withdraw(uint256 assets, address receiver, address owner, uint256 maxShares) public virtual returns (uint256) {
        uint256 shares = withdraw(assets, receiver, owner);
        require(shares &lt;= maxShares, &quot;ERC5143: withdraw slippage protection&quot;);
        return shares;
    }
    function redeem(uint256 shares, address receiver, address owner, uint256 minAssets) public virtual returns (uint256) {
        uint256 assets = redeem(shares, receiver, owner);
        require(assets &gt;= minAssets, &quot;ERC5143: redeem slippage protection&quot;);
        return assets;
    }
}
```
## Security Considerations

This ERC addresses one of the security consideration raised by ERC-4626. Other considerations still apply.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 09 Jun 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5143</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5143</guid>
      </item>
    
      <item>
        <title>Cross-Chain Execution</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5164-cross-chain-execution/9658</comments>
        
        <description>## Abstract

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.

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.

## Motivation

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.

## Specification

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.

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:

- `MessageDispatcher`
- `MessageExecutor`

The `MessageDispatcher` lives on the origin chain and dispatches messages to the `MessageExecutor` for execution. The `MessageExecutor` lives on the destination chain and executes dispatched messages.

### MessageDispatcher

The `MessageDispatcher` lives on the chain from which messages are sent. The Dispatcher&apos;s job is to broadcast messages through a transport layer to one or more `MessageExecutor` contracts.

A unique `messageId` 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 `chainId, dispatcherAddress, messageNonce` where messageNonce is a monotonically increasing integer per message.

#### MessageDispatcher Methods

**dispatchMessage**

Will dispatch a message to be executed by the `MessageExecutor` on the destination chain specified by `toChainId`.

`MessageDispatcher`s MUST emit the `MessageDispatched` event when a message is dispatched.

`MessageDispatcher`s MUST revert if `toChainId` is not supported.

`MessageDispatcher`s MUST forward the message to a `MessageExecutor` on the `toChainId`.

`MessageDispatcher`s MUST use a unique `messageId` for each message.

`MessageDispatcher`s MUST return the `messageId` to allow the message sender to track the message.

`MessageDispatcher`s MAY require payment.

```solidity
interface MessageDispatcher {
  function dispatchMessage(uint256 toChainId, address to, bytes calldata data) external payable returns (bytes32 messageId);
}
```

```yaml
- name: dispatchMessage
  type: function
  stateMutability: payable
  inputs:
    - name: toChainId
      type: uint256
    - name: to
      type: address
    - name: data
      type: bytes
  outputs:
    - name: messageId
      type: bytes32
```

#### MessageDispatcher Events

**MessageDispatched**

The `MessageDispatched` event MUST be emitted by the `MessageDispatcher` when an individual message is dispatched.

```solidity
interface MessageDispatcher {
  event MessageDispatched(
    bytes32 indexed messageId,
    address indexed from,
    uint256 indexed toChainId,
    address to,
    bytes data,
  );
}
```

```yaml
- name: MessageDispatched
  type: event
  inputs:
    - name: messageId
      indexed: true
      type: bytes32
    - name: from
      indexed: true
      type: address
    - name: toChainId
      indexed: true
      type: uint256
    - name: to
      type: address
    - name: data
      type: bytes
```

### MessageExecutor

The `MessageExecutor` executes dispatched messages and message batches. Developers must implement a `MessageExecutor` in order to execute messages on the receiving chain.

The `MessageExecutor` 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.

#### Execution

`MessageExecutor`s SHOULD verify all message data with the bridge transport layer.

`MessageExecutor`s MUST NOT successfully execute a message more than once.

`MessageExecutor`s MUST revert the transaction when a message fails to be executed allowing the message to be retried at a later time.

**Calldata**

`MessageExecutor`s MUST append the ABI-packed (`messageId`, `fromChainId`, `from`) 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.

```solidity
to.call(abi.encodePacked(data, messageId, fromChainId, from));
```

```yaml
- name: calldata
  type: bytes
  inputs:
    - name: data
      type: bytes
    - name: messageId
      type: bytes32
    - name: fromChainId
      type: uint256
    - name: from
      type: address
```

#### MessageExecutor Events

**MessageIdExecuted**

`MessageIdExecuted` MUST be emitted once a message or message batch has been executed.

```solidity
interface MessageExecutor {
  event MessageIdExecuted(
    uint256 indexed fromChainId,
    bytes32 indexed messageId
  );
}
```

```yaml
- name: MessageIdExecuted
  type: event
  inputs:
    - name: fromChainId
      indexed: true
      type: uint256
    - name: messageId
      indexed: true
      type: bytes32
```

#### MessageExecutor Errors

**MessageAlreadyExecuted**

`MessageExecutor`s MUST revert if a messageId has already been executed and SHOULD emit a `MessageIdAlreadyExecuted` custom error.

```solidity
interface MessageExecutor {
  error MessageIdAlreadyExecuted(
    bytes32 messageId
  );
}
```

**MessageFailure**

`MessageExecutor`s MUST revert if an individual message fails and SHOULD emit a `MessageFailure` custom error.

```solidity
interface MessageExecutor {
  error MessageFailure(
    bytes32 messageId,
    bytes errorData
  );
}
```

## Rationale

The `MessageDispatcher` can be coupled to one or more `MessageExecutor`. It is up to bridges to decide how to couple the two. Users can easily bridge a message by calling `dispatchMessage` without being aware of the `MessageExecutor` address. Messages can also be traced by a client using the data logged by the `MessageIdExecuted` event.

Some bridges may require payment in the native currency, so the `dispatchMessage` function is payable.

## Backwards Compatibility

This specification is compatible with existing governance systems as it offers simple cross-chain execution.

## Security Considerations

Bridge trust profiles are variable, so users must understand that bridge security depends on the implementation.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 14 Jun 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5164</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5164</guid>
      </item>
    
      <item>
        <title>Client Script URI for Token Contracts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5169-client-script-uri-for-token-contracts/9674</comments>
        
        <description>## Abstract

This EIP provides a contract interface adding a `scriptURI()` function for locating executable scripts associated with the token.

## Motivation

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&apos;s important that a token&apos;s contract is linked to its client script, since the client script may carry out trusted tasks such as creating transactions for the user.

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 (`scriptURI`). 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 `scriptURI` 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:

- A &apos;miniDapp&apos;, which is a cut-down DApp tailored for a single token.
- A &apos;TokenScript&apos; which provides TIPS from a browser wallet.
- A &apos;TokenScript&apos; that allows users to interact with contract functions not normally provided by a wallet, eg &apos;mint&apos; function.
- An extension that is downloadable to the hardware wallet with an extension framework, such as Ledger.
- JavaScript instructions to operate a smartlock, after owner receives authorization token in their wallet.

### Overview

With the discussion above in mind, we outline the solution proposed by this EIP. For this purpose, we consider the following variables:

- `SCPrivKey`: The private signing key to administrate a smart contract implementing this EIP. Note that this doesn&apos;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 `scriptURI`.

- `newScriptURI`: an array of URIs for different ways to find the client script.

We can describe the life cycle of the `scriptURI` functionality:

- Issuance

1. The token issuer issues the tokens and a smart contract implementing this EIP, with the admin key for the smart contract being `SCPrivKey`.
2. The token issuer calls `setScriptURI` with the `scriptURI`.

- Update `scriptURI`

1. The token issuer stores the desired `script` at all the new URI locations and constructs a new `scriptURI` structure based on this. 
2. The token issuer calls `setScriptURI` with the new `scriptURI` structure.

## Specification

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.

We define a scriptURI element using the `string[]`.
Based on this, we define the smart contract interface below:

```solidity
interface IERC5169 {
    /// @dev This event emits when the scriptURI is updated, 
    /// so wallets implementing this interface can update a cached script
    event ScriptUpdate(string[] newScriptURI);

    /// @notice Get the scriptURI for the contract
    /// @return The scriptURI
    function scriptURI() external view returns(string[] memory);

    /// @notice Update the scriptURI 
    /// emits event ScriptUpdate(scriptURI memory newScriptURI);
    function setScriptURI(string[] memory newScriptURI) external;
}
```

The interface MUST be implemented under the following constraints:

- The smart contract implementing `IERC5169` MUST store variables `address owner` in its state.

- The smart contract implementing `IERC5169` MUST set `owner=msg.sender` in its constructor.

- The `ScriptUpdate(...)` event MUST be emitted when the ```setScriptURI``` function updates the `scriptURI`.

- The `setScriptURI(...)` function MUST validate that `owner == msg.sender` *before* executing its logic and updating any state.

- The `setScriptURI(...)` function MUST update its internal state such that `currentScriptURI = newScriptURI`.

- The `scriptURI()` function MUST return the `currentScriptURI` state.

- The `scriptURI()` function MAY be implemented as pure or view.

- Any user of the script learned from `scriptURI` MUST validate the script is either at an immutable location, its URI contains its hash digest, or it implements the separate `Authenticity for Client Script` EIP, which asserts authenticity using signatures instead of a digest.

## Rationale

This method avoids the need for building secure and certified centralized hosting and allows scripts to be hosted anywhere: IPFS, GitHub or cloud storage.

## Backwards Compatibility

This standard is backwards-compatible with most existing token standards, including the following commonly-used ones:

- [ERC-20](./eip-20.md)
- [ERC-721](./eip-721.md)
- [ERC-777](./eip-777.md)
- [ERC-1155](./eip-1155.md)

## Test Cases

### Test Contract

```solidity

import &quot;@openzeppelin/contracts/access/Ownable.sol&quot;;
import &quot;./IERC5169.sol&quot;;
contract ERC5169 is IERC5169, Ownable {
    string[] private _scriptURI;
    function scriptURI() external view override returns(string[] memory) {
        return _scriptURI;
    }

    function setScriptURI(string[] memory newScriptURI) external onlyOwner override {
        _scriptURI = newScriptURI;

        emit ScriptUpdate(newScriptURI);
    }
}

```

### Test Cases

```ts

const { expect } = require(&apos;chai&apos;);
const { BigNumber, Wallet } = require(&apos;ethers&apos;);
const { ethers, network, getChainId } = require(&apos;hardhat&apos;);

describe(&apos;ERC5169&apos;, function () {
  before(async function () {
    this.ERC5169 = await ethers.getContractFactory(&apos;ERC5169&apos;);
  });

  beforeEach(async function () {
    // targetNFT
    this.erc5169 = await this.ERC5169.deploy();
  });

  it(&apos;Should set script URI&apos;, async function () {
    const scriptURI = [
      &apos;uri1&apos;, &apos;uri2&apos;, &apos;uri3&apos;
    ];

    await expect(this.erc5169.setScriptURI(scriptURI))
      .emit(this.erc5169, &apos;ScriptUpdate&apos;)
      .withArgs(scriptURI);
    
    const currentScriptURI = await this.erc5169.scriptURI();

    expect(currentScriptURI.toString()).to.be.equal(scriptURI.toString());
  });
  
```

## Reference Implementation

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 `scriptURI()` function contains instructions on how to operate the door interface. This takes the form of:

1. Query for challenge string (random message from IoT interface eg &apos;Apples-5E3FA1&apos;).

2. Receive and display challenge string on Token View, and request &apos;Sign Personal&apos;.

3. On obtaining the signature of the challenge string, send back to IoT device.

4. IoT device will unlock door if ec-recovered address holds the NFT.

With `scriptURI()` the experience is greatly enhanced as the flow for the user is:

1. Receive NFT.

2. Use authenticated NFT functionality in the wallet immediately.

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: [ERC-5169 Contract Example](../assets/eip-5169/contract/ExampleContract.sol) and TokenScript:  [ERC-5169 TokenScript Example](../assets/eip-5169/tokenscript/ExampleScript.xml). 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 `scriptURI()`.

### Script location

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: 

1. The smart contract signing key is needed to make updates, causing the key to become more exposed, as it is used more often. 

2. Updates require smart contract interaction. If frequent updates are needed, smart contract calls can become an expensive hurdle.

3. 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.

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.

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 `ScriptURI` to return multiple URIs, which could be a mix of centralized, individually hosted and decentralized locations.

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.

## Security Considerations

**When a server is involved**

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&apos;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.

**When the scriptURI doesn&apos;t contain integrity (hash) information**

We separately authored `Authenticity for Client Script` 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. 

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 03 May 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5169</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5169</guid>
      </item>
    
      <item>
        <title>NFT Future Rewards (nFR)</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/non-fungible-future-rewards-token-standard/9203</comments>
        
        <description>## Abstract

This proposal introduces the Non-Fungible Future Rewards (nFR) framework, extending [ERC-721](./eip-721.md) 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.

## Motivation

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.

### Framework Components

#### The Flow mechanism

Each [ERC-5173](./eip-5173.md) 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&apos;s appreciation. This mechanism promotes collaborative value creation, equitable profit sharing, and a connected financial ecosystem, distinct from traditional financial market systems.

#### Cooperative Value (Future Rewards) Distribution 

The nFR framework transforms the zero-sum financial equation:

```
P(A) + P(B) + F ≤ 0
```
Where:

- P(A): Profit of trader A
- P(B): Profit of trader B
- F: Transaction fees, friction costs, and operational expenses

into a collaborative model:

```
P(A) + P(B) + F + FR &gt; 0
```
Where:

- FR: Shared value creation through cooperative mechanisms

This model incentivizes fairness and rewards contributions throughout the asset lifecycle.

## Specification

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.

The following is an extension of the [ERC-721](./eip-721.md) standard.

[ERC-721](./eip-721.md)-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.

Implementers of this standard MUST have all of the following functions:

```solidity

pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/utils/introspection/IERC165.sol&quot;;

/*
 *
 * @dev Interface for the Future Rewards Token Standard.
 *
 * A standardized way to receive future rewards for non-fungible tokens (NFTs.)
 *
 */
interface IERC5173 is IERC165 {

    event FRClaimed(address indexed account, uint256 indexed amount);

    event FRDistributed(uint256 indexed tokenId, uint256 indexed soldPrice, uint256 indexed allocatedFR);

    event Listed(uint256 indexed tokenId, uint256 indexed salePrice);

    event Unlisted(uint256 indexed tokenId);

    event Bought(uint256 indexed tokenId, uint256 indexed salePrice);

    function list(uint256 tokenId, uint256 salePrice) external;

    function unlist(uint256 tokenId) external;

    function buy(uint256 tokenId) payable external;

    function releaseFR(address payable account) external;

    function retrieveFRInfo(uint256 tokenId) external returns(uint8, uint256, uint256, uint256, uint256, address[] memory);

    function retrieveAllottedFR(address account) external returns(uint256);

    function retrieveListInfo(uint256 tokenId) external returns(uint256, address, bool);
    
}

```

An nFR contract MUST implement and update for each Token ID. The data in the `FRInfo` 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.

```solidity

struct FRInfo {
        uint8 numGenerations; //  Number of generations corresponding to that Token ID
        uint256 percentOfProfit; // Percent of profit allocated for FR, scaled by 1e18
        uint256 successiveRatio; // The common ratio of successive in the geometric sequence, used for distribution calculation
        uint256 lastSoldPrice; // Last sale price in ETH mantissa
        uint256 ownerAmount; // Amount of owners the Token ID has seen
        address[] addressesInFR; // The addresses currently in the FR cycle
}

struct ListInfo {
        uint256 salePrice; // ETH mantissa of the listed selling price
        address lister; // Owner/Lister of the Token
        bool isListed; // Boolean indicating whether the Token is listed or not
}

```
 
Additionally, an nFR smart contract MUST store the corresponding `ListInfo` for each Token ID in a mapping. A method to retrieve a Token ID’s corresponding `ListInfo` MUST also be accessible publicly.

An nFR smart contract MUST also store and update the amount of Ether allocated to a specific address using the `_allotedFR` mapping. The `_allottedFR` mapping MUST either be public or have a function to fetch the FR payment allotted to a specific address.

### Percent Fixed Point

The `allocatedFR` MUST be calculated using a percentage fixed point with a scaling factor of 1e18 (X/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.

### Default FR Info

A default `FRInfo` MUST be stored in order to be backward compatible with [ERC-721](./eip-721.md) mint functions. It MAY also have a function to update the `FRInfo`, assuming it has not been hard-coded.

### ERC-721 Overrides

An nFR-compliant smart contract MUST override the [ERC-721](./eip-721.md) `_mint`, `_transfer`, and `_burn` functions. When overriding the `_mint` function, a default FR model is REQUIRED to be established if the mint is to succeed when calling the [ERC-721](./eip-721.md) `_mint` function and not the nFR `_mint` function. It is also to update the owner amount and directly add the recipient address to the FR cycle. When overriding the `_transfer` 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 `_transfer` 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 `_burn` function, the smart contract SHALL delete the `FRInfo` and `ListInfo` corresponding to that Token ID after a successful burn.

Additionally, the [ERC-721](./eip-721.md) `_checkOnERC721Received` function MAY be explicitly called after mints and transfers if the smart contract aims to have safe transfers and mints.

### Safe Transfers

If the wallet/broker/auction application will accept safe transfers, then it MUST implement the [ERC-721](./eip-721.md) wallet interface.

### Listing, Unlisting, and Buying

The `list`, `unlist`, and `buy` functions MUST be implemented, as they provide the capability to sell a token.

```solidity
function list(uint256 tokenId, uint256 salePrice) public virtual override {
   //...
}


function unlist(uint256 tokenId) public virtual override {
   //...
}

function buy(uint256 tokenId) public virtual override payable {
   //...
}

```

The `list` function accepts a `tokenId` and a `salePrice` and updates the corresponding `ListInfo` for that given `tokenId` after ensuring that the `msg.sender` is either approved or the owner of the token. The `list` function SHOULD emit the `Listed` event. The function signifies that the token is listed and at what price it is listed for. 

The `unlist` function accepts a `tokenId` and it deletes the corresponding `ListInfo` after the owner verifications have been met. The `unlist` function SHOULD emit the `Unlisted` event.

The `buy` function accepts a `tokenId` and MUST be payable. It MUST verify that the `msg.value` matches the token’s `salePrice` and that the token is listed, before proceeding and calling the FR `_transferFrom` 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 `buy` function SHOULD emit the `Bought` event.


### Future Rewards `_transferFrom` Function

The FR `_transferFrom` 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.

```solidity

function transferFrom(address from, address to, uint256 tokenId, uint256 soldPrice) public virtual override payable {
       //...
}

```

Based on the stored `lastSoldPrice`, the smart contract will determine whether the sale was profitable after calling the [ERC-721](./eip-721.md) 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 `msg.value` to the `lister` depending on the implementation. Otherwise, if the transaction was profitable, the smart contract SHALL call the `_distributeFR` function, then update the `lastSoldPrice`, increment the owner amount, and finally shift generations. The `_distributeFR` function or the FR `_transferFrom` MUST return the difference between the allocated FR that is to be distributed amongst the `_addressesInFR` and the `msg.value` to the `lister`. Once the operations have completed, the function MUST clear the corresponding `ListInfo`. Similarly to the `_transfer` override, the FR `_transferFrom` SHALL ensure that the recipient is not the sender of the token or an address in the FR sliding window.

### Future Rewards Calculation

Marketplaces that support this standard MAY implement various methods of calculating or transferring Future Rewards to the previous owners.

```solidity

function _calculateFR(uint256 totalProfit, uint256 buyerReward, uint256 successiveRatio, uint256 ownerAmount, uint256 windowSize) pure internal virtual returns(uint256[] memory) {
    //...        
}

```

In this example (*Figure 1*), 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. 

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.

![Figure 1: Geometric sequence distribution](../assets/eip-5173/Total_FR_Payout_Distribution-geo.png) 

*Figure 1: Geometric sequence distribution*

The buyers/owners receive a portion ( r ) of the realized profit  (P ) from an NFT transaction. The remaining proceeds go to the seller.

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. 

The profit distribution SHALL be only available to previous owners who fall within the window. 

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.

### Future Rewards Distribution

![Figure 2: NFT Owners&apos; Future Rewards (nFR)](../assets/eip-5173/nFR_Standard_Outline.jpeg) 

*Figure 2: NFT Owners&apos; Future Rewards (nFR)*

*Figure 2* illustrates an example of a five-generation Future Rewards Distribution program based on an owner&apos;s realized profit.

```solidity

function _distributeFR(uint256 tokenId, uint256 soldPrice) internal virtual {
       //...

        emit FRDistributed(tokenId, soldPrice, allocatedFR);
 }
 
```

The `_distributeFR` function MUST be called in the FR `_transferFrom` 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 `addressesInFR` 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 `return 0` if `_transferFrom` is handling FR payment or send `msg.value` to the `lister`. The function SHALL calculate the difference between the current sale price and the `lastSoldPrice`, then it SHALL call the `_calculateFR` 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 (`allocatedFR`), in order to return the difference of the `soldPrice` and `allocatedFR` to the `lister`. Finally, it SHALL emit the `FRDistributed` event. Additionally, the function MAY return the allocated FR, which would be received by the FR `_transferFrom` function, if the `_transferFrom` function is sending the `allocatedFR` to the `lister`.

### Future Rewards Claiming

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. 

```solidity

function releaseFR(address payable account) public virtual override {
        //...
}

```

### Owner Generation Shifting

The `_shiftGenerations` function MUST be called regardless of whether the sale was profitable or not. As a result, it will be called in the `_transfer` [ERC-721](./eip-721.md) override function and the FR `transferFrom` function. The function SHALL remove the oldest account from the corresponding `_addressesInFR` array. This calculation will take into account the current length of the array versus the total number of generations for a given token ID.

## Rationale

### Fixed Percentage to 10^18

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.

### Emitting Event for Payment

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/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. 

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 [ERC-2981](./eip-2981.md).

### Number of Generations of All Owners ( n ) vs Number of Generations of Only Profitable Owners

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&apos; profits will be shared, see *Figure 3*. As part of the effort to discourage &quot;ownership hoarding,&quot; Future Rewards distributions will not be made to the current owner/purchaser if all the owners lose money holding the NFT. Further information can be found under Security Considerations.

![Figure 3: Losing owners](../assets/eip-5173/Losing_owners.jpeg)

*Figure 3: Losing owners*

### Single vs Multigenerations

In a single generation reward, the new buyer/owner receives a share of the next single generation&apos;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. 

We propose that the marketplace operator can choose between a single generational distribution system and a multigenerational distribution system.

### Direct FR Payout by the Seller vs Smart Contract-managed Payout

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. 

### Equal vs Linear Reward Distributions

#### Equal FR Payout

![Figure 4: Equal, linear reward distribution](../assets/eip-5173/Total_FR_Payout_Distribution-flat.png?raw=true)

*Figure 4: Equal, linear reward distribution*

FR distributions from the realization of profits by later owners are distributed equally to all eligible owners (*Figure 4*). 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 (*Figure 5*). 

This system does not discriminate against any buyer because each buyer will go through the same distribution curve.

#### Straight line arithmetic sequence FR payout

![Figure 5: Arithmetic sequence distribution](../assets/eip-5173/Arithmetic_Sequence_FR_Payout_Distribution.png?raw=true)

*Figure 5: Arithmetic sequence distribution*

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. 

## Backwards Compatibility

This proposal is fully compatible with current [ERC-721](./eip-721.md) standards and [ERC-2981](./eip-2981.md). It can also be easily adapted to work with [ERC-1155](./eip-1155.md).

## Test Cases

[This contract](../assets/eip-5173/Implementation/nFRImplementation.sol) contains the reference implementation for this proposal.

[Here is a visualization of the test case](../assets/eip-5173/animate-1920x1080-1750-frames.gif?raw=true). 

As a result of implementing ERC-5173, a new project has been launched called untrading.org.

## Reference Implementation

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 [ERC-721](./eip-721.md) implementation using the extension.

The code for the reference implementation is [here](../assets/eip-5173/Implementation/nFRImplementation.sol).

### Distribution of NFT Royalties to Artists and Creators

We agree that artists’ royalties should be uniform and on-chain. We support [ERC-2981](./eip-2981.md) NFT royalty Standard proposal.

All platforms can support royalty rewards for the same NFT based on on-chain parameters and functions:

- No profit, no profit sharing, no cost;
- The question of &quot;who owned it&quot; is often crucial to the provenance and value of a collectible;
- The previous owner should be re-compensated for their ownership;
- And the buyer/owner incentive in FR eliminates any motive to circumvent the royalty payout schemes;

### Distribution of NFT Owners’ Future Rewards (FRs)

#### Future Rewards calculation

Any realized profits (P) when an NFT is sold are distributed among the buyers/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.

We define a sliding window mechanism to decide which previous owners will be involved in the profit distribution. Let&apos;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.  

![Future Rewards calculation formula](../assets/eip-5173/nFR_distribution_formula.jpg?raw=true)

In this equation:

- P is the total profit, the difference between the selling price minus the buying price;
- _R_ is buyer reward ratio of the total P;
- _g_ is the common ratio of successive in the geometric sequence;
- _n_ is the actual number of owners eligible and participating in the future rewards sharing. To calculate _n_, we have _n_ = min(_m_, _w_), where _m_ is the current number of owners for a token, and _w_ is the window size of the profit distribution sliding window algorithm

#### Converting into Code

```solidity

pragma solidity ^0.8.0;
//...

/* Assumes usage of a Fixed Point Arithmetic library (prb-math) for both int256 and uint256, and OpenZeppelin Math utils for Math.min. */
function _calculateFR(uint256 p, uint256 r, uint256 g, uint256 m, uint256 w) pure internal virtual returns(uint256[] memory) {
        uint256 n = Math.min(m, w);
        uint256[] memory FR = new uint256[](n);

        for (uint256 i = 1; i &lt; n + 1; i++) {
            uint256 pi = 0;

            if (successiveRatio != 1e18) {
                int256 v1 = 1e18 - int256(g).powu(n);
                int256 v2 = int256(g).powu(i - 1);
                int256 v3 = int256(p).mul(int256(r));
                int256 v4 = v3.mul(1e18 - int256(g));
                pi = uint256(v4 * v2 / v1);
            } else {
                pi = p.mul(r).div(n);
            }

            FR[i - 1] = pi;
        }

        return FR;
}

```

The complete implementation code can be found [here](../assets/eip-5173/Implementation/nFRImplementation.sol).

## Security Considerations

### Payment Attacks

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.

### Royalty Circumventing

Many methods are being used to avoid paying royalties to creators under the current [ERC-721](./eip-721.md) standard. Through an under-the-table transaction, the new buyer&apos;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&apos;s net realized profits ( P x r ). Acting in his or her own interests, the buyer rejects any loyalty circumventing proposal.

### FR Hoarding through Wash Sales

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.

#### Wash trading by users

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 (*Figure 6*). 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).

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. 

![Figure 6: Same owner using different wallets](../assets/eip-5173/Same_owner_using_different_wallets.jpeg)

*Figure 6: Same owner using different wallets*

#### Wash trading by the marketplace operator

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.

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.

### Long/Cyclical FR-Entitled Owner Generations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 08 May 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5173</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5173</guid>
      </item>
    
      <item>
        <title>NFT Updatable Metadata Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-721-erc-1155-updatable-metadata-extension/9077</comments>
        
        <description>## Abstract

This specification defines a standard way to allow controlled NFTs&apos; 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 [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md).

## Motivation

Storing voluminous NFT metadata on-chain is often neither practical nor cost-efficient.

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 `tokenURI`). 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.

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. 

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).

This standard extension is compatible with NFTs bridged between Ethereum and L2 networks and allows efficient caching solutions.

## Specification

The key words &quot;MUST&quot;, &quot;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.

The **metadata updates extension** is OPTIONAL for [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md) contracts.

```solidity
/// @title ERC-721/ERC-1155 Updatable Metadata Extension
interface IERC5185UpdatableMetadata {
    /// @notice A distinct Uniform Resource Identifier (URI) for a set of updates
    /// @dev This event emits an URI (defined in RFC 3986) of a set of metadata updates.
    /// The URI should point to a JSON file that conforms to the &quot;NFT Metadata Updates JSON Schema&quot;
    /// Third-party platforms such as NFT marketplace can deterministically calculate the latest
    /// metadata for all tokens using these events by applying them in sequence for each token.
    event MetadataUpdates(string URI);
}
```

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.

&quot;ERC-5185 Updatable Metadata JSON Schema&quot; :

```json
{
    &quot;title&quot;: &quot;Asset Updatable Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset to which this NFT represents&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset to which this NFT represents&quot;
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
        },
        &quot;updatable&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;required&quot;: [&quot;engine&quot;, &quot;recipes&quot;],
            &quot;properties&quot;: {
                &quot;engine&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;Non ambiguous transformation method/language (with version) to process updates along recipes defined below&quot;
                },
                &quot;schema&quot;: {
                    &quot;type&quot;: &quot;object&quot;,
                    &quot;description&quot;: &quot;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.&quot;
                },
                &quot;recipes&quot;: {
                    &quot;type&quot;: &quot;object&quot;,
                    &quot;description&quot;: &quot;A catalog of all possibles recipes identified by their keys&quot;,
                    &quot;patternProperties&quot;: {
                        &quot;.*&quot;: {
                            &quot;type&quot;: &quot;object&quot;,
                            &quot;description&quot;: &quot;The key of this object is used to select which recipe to apply for each update&quot;,
                            &quot;required&quot;: [&quot;eval&quot;],
                            &quot;properties&quot;: {
                                &quot;eval&quot;: {
                                    &quot;type&quot;: &quot;string&quot;,
                                    &quot;description&quot;: &quot;The evaluation formula to transform the last JSON metadata using the engine above (can take arguments)&quot;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```

&quot;NFT Metadata Updates JSON Schema&quot; : 

```json
{
    &quot;title&quot;: &quot;Metadata Updates JSON Schema&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;updates&quot;: {
            &quot;type&quot;: &quot;array&quot;,
            &quot;description&quot;: &quot;A list of updates to apply sequentially to calculate updated metadata&quot;,
            &quot;items&quot;: { &quot;$ref&quot;: &quot;#/$defs/update&quot; },
            &quot;$defs&quot;: {
                &quot;update&quot;: {
                    &quot;type&quot;: &quot;object&quot;,
                    &quot;required&quot;: [&quot;tokenId&quot;, &quot;recipeKey&quot;],
                    &quot;properties&quot;: {
                        &quot;tokenId&quot;: {
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;description&quot;: &quot;The tokenId for which the update recipe should apply&quot;
                         },
                        &quot;recipeKey&quot;: {
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;description&quot;: &quot;recipeKey to use to get the JSON transformation expression in current metadata&quot;
                        },
                        &quot;args&quot;: {
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;description&quot;: &quot;arguments to pass to the JSON transformation&quot;
                        }
                    }
                 }
            }
        }
    }
}
```

### Engines

Only one engine is currently defined in this extension proposal.

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 `MetadataUpdates` for which tokenId matches).

For each step, the next metadata is obtained by the javascript calculation (or compatible jsonata implementation in other language) :

```js
const nextMetadata = jsonata(evalString).evaluate(previousMetadata, args)
```

With `evalString` is found with `recipeKey` in the original metadata recipes list.

If the key is not present in the original metadata list, `previousMetadata` is kept as the valid updated metadata.

If the evaluation throws any errors, `previousMetadata` is kept as the valid updated metadata.

If a validation Schema JSON has been defined and the result JSON `nextMetadata` does not conform, that update is not valid and `previousMetadata` is kept as the valid updated metadata.

## Rationale

There have been numerous interesting uses of [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md) 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.

Most use cases have chosen intermediate solutions like IPFS or arweave to provide some permanence or partial/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.

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.

The original metadata for a given NFT is always defined as the JSON pointed by the result of `tokenURI` for [EIP-721](./eip-721.md) and function `uri` for [EIP-1155](./eip-1155.md).

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.

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 `MetadataUpdates` and the frequency of these on-chain updates is left at the discretion of this standard implementation.

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 `emit`.

## Reference Implementation

### Transformation engines

We have been experimenting with this generic Metadata update proposal using the JSONata transformation language. 

Here is a very simple example of a NFT metadata for an imaginary &apos;little monster&apos; game :

```json
{
    &quot;name&quot;: &quot;Monster 1&quot;,
    &quot;description&quot;: &quot;Little monsters you can play with.&quot;,
    &quot;attributes&quot;: [
      { &quot;trait_type&quot;: &quot;Level&quot;, &quot;value&quot;: 0 },
      { &quot;trait_type&quot;: &quot;Stamina&quot;, &quot;value&quot;: 100 }
    ],
    &quot;updatable&quot;: {
      &quot;engine&quot;: &quot;jsonata@1.8.*&quot;,
      &quot;recipes&quot;: {
        &quot;levelUp&quot;: {
          &quot;eval&quot;: &quot;$ ~&gt; | attributes[trait_type=&apos;Level&apos;] | {&apos;value&apos;: value + 1} |&quot;
        },
        &quot;updateDescription&quot;: {
          &quot;eval&quot;: &quot;$ ~&gt; | $ | {&apos;description&apos;: $newDescription} |&quot;
        }
      }
    }
}
 ```

This updatable metadata can only be updated to increment by one the trait attribute &quot;Level&quot;.

An example JSON updates metadata would be :
```json
{
    &quot;updates&quot;: [
      {&quot;tokenId&quot;:&quot;1&quot;,&quot;action&quot;:&quot;levelUp&quot;},
      {&quot;tokenId&quot;:&quot;2&quot;,&quot;action&quot;:&quot;levelUp&quot;},
      {&quot;tokenId&quot;:&quot;1&quot;,&quot;action&quot;:&quot;updateDescription&quot;,&quot;args&quot;:{&quot;newDescription&quot;:&quot;Now I&apos;m a big monster&quot;}},
      {&quot;tokenId&quot;:&quot;1&quot;,&quot;action&quot;:&quot;levelUp&quot;},
      {&quot;tokenId&quot;:&quot;3&quot;,&quot;action&quot;:&quot;levelUp&quot;}
    ]
}
 ```

## Security Considerations

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.

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 `tokenURI` or `uri` 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;. 

## Backwards Compatibility

The proposal is fully compatible with both [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md). Third-party applications that don&apos;t support this EIP will still be able to use the original metadata for each NFT.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 27 Jun 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5185</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5185</guid>
      </item>
    
      <item>
        <title>Extend EIP-1155 with rentable usage rights</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-draft-extending-erc1155-with-rentable-usage-rights/9553/4</comments>
        
        <description>## Abstract

This standard is an extension of [EIP-1155](./eip-1155.md). 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.

The property owner always retains ownership and is able to transfer the NFT to others during the lease.

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.

## Motivation

The well-accepted [EIP-721](./eip-721.md) 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.
### First Step: &quot;Expirable&quot; NFTs
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.

The lease/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.
### Then, Make Everything Transferable
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&apos;s the beauty of blockchain. Without permission, without trust, code is the law.

Making ownership and usage rights transferable may further revolutionize the game rules in NFT&apos;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.


## Specification

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.

```solidity
pragma solidity ^0.8.0;

///  Note: the ERC-165 identifier for this interface is 0x6938e358.
 interface IRental /* is IERC165,IERC1155 */ {
    /**
     * @notice This emits when user rent NFT
     * - `id` The id of the current token
     * - `user` The address to rent the NFT usage rights
     * - `amount` The amount of usage rights
     * - `expire` The specified period of time to rent
     **/
    event Rented(uint256 indexed id,address indexed user,uint256 amount,uint256 expire);

    /**
    * MUST trigger on any successful call to `renew(address user,uint256 id)`
    *  - `id` The id of the current token
    *  - `user` The user of the NFT
    *  - `expire` The new specified period of time to rent
    **/
    event Renew(uint256 indexed id,address indexed user,uint256 expire);

    /**
    *  MUST trigger on any successful call to `renew(address user,uint256 id,uint256 expire)`
    *  - `id` The id of the current token
    *  - `from` The current user of the NFT
    *  - `to` The new user
    **/
    event Sublet(uint256 indexed id,address indexed from,address to);

    /**
     * @notice This emits when the NFT owner takes back the usage rights from the tenant (the `user`)
     * - id The id of the current token
     * - user The address to rent the NFT&apos;s usage rights
     * - amount Amount of usage rights
     **/
    event TakeBack(uint256 indexed id, address indexed user, uint256 amount);

    /**
     * @notice Function to rent out usage rights
     * - from The address to approve
     * - to The address to rent the NFT usage rights
     * - id The id of the current token
     * - amount The amount of usage rights
     * - expire The specified period of time to rent
     **/
    function safeRent(address from,address to,uint256 id,uint256 amount,uint256 expire) external;

    /**
     * @notice Function to take back usage rights after the end of the tenancy
     * - user The address to rent the NFT&apos;s usage rights
     * - tokenId The id of the current token
     **/
    function takeBack(address user,uint256 tokenId) external;

    /**
    * @notice Return the NFT to the address of the NFT property right owner.
    **/
    function propertyRightOf(uint256 id) external view returns (address);

    /**
    * @notice Return the total supply amount of the current token
    **/
    function totalSupply(uint256 id) external view returns (uint256);

    /**
    * @notice Return expire The specified period of time to rent
    **/
    function expireAt(uint256 id,address user) external view returns(uint256);

    /**
    *   extended rental period
    *  - `id` The id of the current token
    *  - `user` The user of the NFT
    *  - `expire` The new specified period of time to rent
    **/
    function renew(address user,uint256 id,uint256 expire)  external;

    /**
    *  transfer of usage right
    *  - `id` The id of the current token
    *  - `user` The user of the NFT
    *  - `expire` The new specified period of time to rent
    **/
    function sublet(address to,uint256 id) external;
}


```

## Rationale

Implementing the proposal to create rentable NFTs has two main benefits.

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.

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.

## Backwards Compatibility

As mentioned at the beginning, this is an extension of EIP-1155. Therefore, it is fully backward compatible with EIP-1155.

## Security Considerations

Needs discussion.

## Copyright

Disclaimer of copyright and related rights through [CC0](/LICENSE).
</description>
        <pubDate>Sun, 17 Apr 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5187</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5187</guid>
      </item>
    
      <item>
        <title>Account Abstraction via Endorsed Operations</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-account-abstraction-via-endorsed-operations/9799</comments>
        
        <description>## Abstract

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 `endorser` 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 `endorser` or use an existing one compatible with their wallet.

## Motivation

This account abstraction proposal aims to implement a generalized system for executing AA transactions while maintaining the following goals:

* **Achieve the primary goal of account abstraction:** allow users to use smart contract wallets containing arbitrary verification and execution logic instead of EOAs as their primary account.
* **Decentralization:**
  * Allow any bundler to participate in the process of including AA transactions.
  * Work with all activity happening over a public mempool without having to concentrate transactions on centralized relayers.
  * Define structures that help maintain a healthy mempool without risking its participants from getting flooded with invalid or malicious payloads.
  * Avoid trust assumptions between bundlers, developers, and wallets.
* **Support existing smart contract wallet implementations:** Work with all the smart contract wallets already deployed and active while avoiding forcing each wallet instance to be manually upgraded.
* **Provide an unrestrictive framework:** Smart contract wallets are very different in design, limitations, and capabilities from one another; the proposal is designed to accommodate almost all possible variations.
* **No overhead:** Smart contract wallets already have a cost overhead compared to EOA alternatives, the proposal does not worsen the current situation.
* **Support other use cases:**
  * Privacy-preserving applications.
  * Atomic multi-operations (similar to [EIP-3074](./eip-3074.md)).
  * Payment of transaction fees using tokens. (E.g. [ERC-20](./eip-20.md), [ERC-777](./eip-777.md), etc.)
  * Scheduled execution of smart contracts without any user input.
  * Applications that require a generalistic relayer.

## Specification

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 `Operation`, operations are structs composed by the following fields:

| Field                      | Type    | Description                                                                                                                                                 |
| -------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| entrypoint                 | address | Contract address that must be called with `callData` to execute the `operation`.                                                                            |
| callData                   | bytes   | Data that must be passed to the `entrypoint` call to execute the `operation`.                                                                               |
| fixedGas                   | uint64  | Amount of gas that the operation will pay for, regardless execution costs, and independent from `gasLimit`.                                                 |
| gasLimit                   | uint64  | Minimum gasLimit that must be passed when executing the `operation`.                                                                                        |
| feeToken                   | address | Contract address of the token used to repay the bundler. _(`address(0)` for the native token)_.                                                             |
| endorser                   | address | Address of the endorser contract that should be used to validate the `operation`.                                                                           |
| endorserCallData           | bytes   | Additional data that must be passed to the `endorser` when calling `isOperationReady()`.                                                                    |
| endorserGasLimit           | uint64  | Amount of gas that should be passed to the endorser when validating the `operation`.                                                                        |
| maxFeePerGas               | uint256 | Max amount of basefee that the `operation` execution is expected to pay. _(Similar to [EIP-1559](./eip-1559.md) `max_fee_per_gas`)_.                        |
| priorityFeePerGas          | uint256 | Fixed amount of fees that the `operation` execution is expected to pay to the bundler. _(Similar to [EIP-1559](./eip-1559.md) `max_priority_fee_per_gas`)_. |
| feeScalingFactor           | uint256 | Scaling factor to convert the computed fee into the `feeToken` unit.                                                                                        |
| feeNormalizationFactor     | uint256 | Normalization factor to convert the computed fee into the `feeToken` unit.                                                                                  |
| hasUntrustedContext        | bool    | If `true`, the operation _may_ have untrusted code paths. These should be treated differently by the bundler (see untrusted environment).                   |
| chainId                    | uint256 | Chain ID of the network where the `operation` is intended to be executed.                                                                                   |

These `Operation` 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.

Transactions are executed by calling the `entrypoint` with the provided `callData`. The `entrypoint` 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.

### Endorser functionality

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).

This categorization is facilitated by the `endorser`; the endorser must be a deployed smart contract that implements the following interface:

```solidity
interface Endorser {
  struct Operation {
    address entrypoint;
    bytes callData;
    uint256 fixedGas;
    uint256 gasLimit;
    address endorser;
    bytes endorserCallData;
    uint256 endorserGasLimit;
    uint256 maxFeePerGas;
    uint256 priorityFeePerGas;
    address feeToken;
    uint256 feeScalingFactor;
    uint256 feeNormalizationFactor;
    bool hasUntrustedContext;
  }

  struct GlobalDependency {
    bool baseFee;
    bool blobBaseFee;
    bool chainId;
    bool coinBase;
    bool difficulty;
    bool gasLimit;
    bool number;
    bool timestamp;
    bool txOrigin;
    bool txGasPrice;
    uint256 maxBlockNumber;
    uint256 maxBlockTimestamp;
  }

  struct Constraint {
    bytes32 slot;
    bytes32 minValue;
    bytes32 maxValue;
  }

  struct Dependency {
    address addr;
    bool balance;
    bool code;
    bool nonce;
    bool allSlots;
    bytes32[] slots;
    Constraint[] constraints;
  }

  struct Replacement {
    address oldAddr;
    address newAddr;
    SlotReplacement[] slots;
  }

  struct SlotReplacement {
    bytes32 slot;
    bytes32 value;
  }

  function simulationSettings(
    Operation calldata _operation
  ) external view returns (
    Replacement[] memory replacements
  );

  function isOperationReady(
    Operation calldata _operation
  ) external returns (
    bool readiness,
    GlobalDependency memory globalDependency,
    Dependency[] memory dependencies
  );
}
```

Endorsers SHOULD be registered in the `EndorserRegistry` 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.

To check for operation status, the caller must first call `simulationSettings` to retrieve a list of on chain alterations.
Then call when the `isOperationReady` method is called, the endorser must return this information:

* **readiness:** when returning `true`, 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).
* **globalDependency:** a list of possible dependencies that don&apos;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. `maxBlockNumber` and `maxBlockTimestamp` are used as global constraints.
* **dependencies:** 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&apos;s readiness.

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.

If the result of a simulation fails and the endorser still returns `readiness == true` with the same dependencies, then the endorser can not be trusted and it MUST be banned by the mempool operator.

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.

For efficiency, additional information MAY be provided to the endorser with `endorserCallData`.
If used, the endorser MUST validate that the provided `endorserCallData` is valid and relevant to the other values provided.

While the endorser is deployed on chain, calls to the endorser MUST NOT be submitted on chain. The bundler MUST read the results of `simulationSettings`, perform chain alterations and simulate the execution off chain.

### Global Dependencies

| Field             | Type    | Description                                                           |
| ----------------- | ------- | --------------------------------------------------------------------- |
| baseFee           | bool    | `true` if the `block.basefee` should be considered a dependency.      |
| blobBaseFee       | bool    | `true` if the `block.blockbasefee` should be considered a dependency. |
| chainId           | bool    | `true` if the `block.chainid` should be considered a dependency.      |
| coinbase          | bool    | `true` if the `block.coinbase` should be considered a dependency.     |
| difficulty        | bool    | `true` if the `block.difficulty` should be considered a dependency.   |
| gasLimit          | bool    | `true` if the `block.gaslimit` should be considered a dependency.     |
| number            | bool    | `true` if the `block.number` should be considered a dependency.       |
| timestamp         | bool    | `true` if the `block.timestamp` should be considered a dependency.    |
| txOrigin          | bool    | `true` if the `tx.origin` should be considered a dependency.          |
| txGasPrice        | bool    | `true` if the `tx.gasprice` should be considered a dependency.        |
| maxBlockNumber    | uint256 | The maximum value of `block.number` that `readiness` applies to.      |
| maxBlockTimestamp | uint256 | The maximum value of `block.timestamp` that `readiness` applies to.   |

The `endorser` MUST use the `maxBlockNumber` and `maxBlockTimestamp` fields to limit the validity of the `readiness` result. This is useful for operations that are only valid for a certain period of time.

Note that all values are **inclusive**. If the `endorser` determines the validity of the `operation` is indefinite, the `maxBlockNumber` and `maxBlockTimestamp` fields MUST be set to `type(uint256).max`.

### Dependencies

| Field       | Type         | Description                                                                                 |
| ----------- | ------------ | ------------------------------------------------------------------------------------------- |
| addr        | address      | Contract address of the dependencies entry. _(Only one entry per address is allowed)_.      |
| balance     | bool         | `true` if the balance of `addr` should be considered a dependency of the `operation`.       |
| code        | bool         | `true` if the code of `addr` should be considered a dependency of the `operation`.          |
| nonce       | bool         | `true` if the nonce of `addr` should be considered a dependency of the `operation`.         |
| allSlots    | bool         | `true` if all storage slots of `addr` should be considered a dependency of the `operation`. |
| slots       | bytes32[]    | List of all storage slots of `addr` that should be considered dependencies of `operation`.  |
| constraints | Constraint[] | List of storage slots of `addr` that have a range of specific values as dependencies.       |

The `endorser` 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.

Note that `allSlots`, `constraints` and `slots` are mutually exclusive. If `allSlots` is set to `true`, then `constraints` and `slots` MUST be empty arrays.
If a slot is listed in `constraints`, it MUST NOT be listed in `slots`.
The `endorser` should prefer to use `constraints` over `slots`, and `slots` over `allSlots` whenever possible to limit reevaluation requirements of the bundler.

&gt; E.g. A wallet may pay fees using funds stored as WETH. During `isOperationReady()`, the endorser contract may call the `balanceOf` method of the `WETH` contract to determine if the wallet has enough `WETH` 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&apos;s WETH balance for this operation and hence does not include these as dependencies.

#### Constraints

| Field    | Type    | Description                                                                 |
| -------- | ------- | --------------------------------------------------------------------------- |
| slot     | bytes32 | Storage slot of `addr` that has a range of specific values as dependencies. |
| minValue | bytes32 | Minimum value (inclusive) of `slot` that `readiness` applies to.            |
| maxValue | bytes32 | Maximum value (inclusive) of `slot` that `readiness` applies to.            |

The `endorser` can use the `minValue` and `maxValue` fields to limit the validity of the `readiness` 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.

Note that all values are **inclusive**. When an exact value is required, `minValue` and `maxValue` should be set to the same value.

### Simulation settings

The `simulationSettings` method returns a list of replacements that the bundler should apply to the operation before simulating the `isOperationReady`. Note that these replacements are only used for `isOperationReady` simulation and are not applied when simulating the operation itself.

| Field       | Type    | Description                                                                 |
| ----------- | ------- | --------------------------------------------------------------------------- |
| oldAddr     | address | The on chain address where contract code is currently located.              |
| newAddr     | address | The address the contract code should be located when performing simulation. |
| slots.slot  | bytes32 | The slot location to be changed.                                            |
| slots.value | bytes32 | The value of the slot to be set before performing simulation.               |

The `endorser` MAY use the `simulationSettings` method to provide a list of replacements that the bundler should apply to the network before simulating `isOperationReady`. This is useful for operations that must be called from specific contract addresses or that depend on specific storage values (e.g. [ERC-4337](./eip-4337.md)&apos;s EntryPoint).

The `endorser` MAY provide it&apos;s own address for replacement. In this event, the bundler should update the `endorser` address used when calling `isOperationReady`.

### Misbehavior detection

It is possible for `endorser` contracts to behave maliciously or erratically in the following ways:

* (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.
* (2) It considers an operation &quot;ready&quot;, but when the operation is executed the top-level call fails.
* (3) It changes the readiness from `true` to `false` while none of the dependencies register any change.

The bundler MUST discard and re-evaluate the readiness status after a change on any of the dependencies of the `operation`, meaning that only operations considered `ready` are candidates for constructing the next block.

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 `endorser`.

When an `endorser` is banned, the mempool operator MUST drop all `operations` related to the endorser.

### Untrusted environment

In some scenarios, the `endorser` may not be able to fully validate the `operation` but may be able to infer that a given code path *should* be safe. In these cases, the endorser can mark a section of the operation as `untrusted`. Any storage slots (balance, code, nonce, or specific slots) accessed in this untrusted context should be automatically considered as dependencies.

```sol
interface Endorser {
  event UntrustedStarted();
  event UntrustedEnded();
}
```

The endorser can use the `UntrustedStarted` and `UntrustedEnded` events to signal the start and end of an untrusted context. The bundler should listen to these events and extend the dependencies list accordingly.

Only the top-level `endorser` can signal an untrusted context; any other events with the same signature but emitted by a different contract should be ignored.

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 `UntrustedStarted` and `UntrustedEnded` events and only consider the untrusted context as ended when the number of `UntrustedEnded` events is equal to the number of `UntrustedStarted` events.

If `hasUntrustedContext` is set to `false`, the bundler should ignore any `UntrustedStarted` and `UntrustedEnded` events.

#### Automatic dependency graph construction

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.

| Opcode      | Dependency                              |
|-------------|-----------------------------------------|
| BALANCE     | `dependencies[addr].balance = true`     |
| ORIGIN      | `global.txOrigin = true`                |
| CODESIZE    | None                                    |
| CODECOPY    | None                                    |
| GASPRICE    | `global.txGasPrice = true`              |
| EXTCODESIZE | `dependencies[addr].code = true`        |
| EXTCODECOPY | `dependencies[addr].code = true`        |
| EXTCODEHASH | `dependencies[addr].code = true`        |
| COINBASE    | `global.coinbase = true`                |
| TIMESTAMP   | `global.timestamp = true`               |
| NUMBER      | `global.number = true`                  |
| DIFFICULTY  | `global.difficulty = true`              |
| PREVRANDAO  | `global.difficulty = true`              |
| CHAINID     | `global.chainId = true`                 |
| SELFBALANCE | `dependencies[self].balance = true`     |
| BASEFEE     | `global.baseFee = true`                 |
| SLOAD       | `dependencies[addr].slots[slot] = true` |
| CREATE      | `dependencies[addr].nonce = true`       |
| CREATE2     | `dependencies[contract].code = true`    |

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.

Block-level dependencies are specially sensitive as they will be shared with a large number of operations.

It is recommended to use untrusted contexts only when necessary, like when an `endorser` needs to validate a nested signature to a wallet that is not under its control.

### Fee payment

The `endorser` MUST guarantee that the operation will repay at least the spent gas to `tx.origin`.

The payment is always made in the `feeToken`, which can be any token standard (E.g. [ERC-20](./eip-20.md)). If `feeToken` is `address(0)`, then payment is made in the native currency. When `feeToken` is `address(0)`, `feeScalingFactor` and `feeNormalizationFactor` MUST be equal to `1`.

All units are expressed in the native token unit. The result of the fee calculation is then converted to the `feeToken` unit using the `feeScalingFactor` and `feeNormalizationFactor`.

The gas units consider a fixed amount of gas (`fixedGas`) and a variable amount of gas (`gasLimit`). 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.

The expected gas repayment is calculated as follows:

```
gasUnits = op.fixedGas + Min(gasUsed, op.gasLimit)
feePerGas = Min(op.maxFeePerGas, block.baseFee + op.priorityFeePerGas)
expectedRepayment = (gasUnits * feePerGas * op.feeScalingFactor) / op.feeNormalizationFactor
```

While the `endorser` MUST guarantee the repayment of `expectedRepayment`, 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.

### Operation identification

Operations can be identified by their operation hash, which is calculated as a CIDv1 multihash of a `raw` 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.

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.

### Bundler behavior upon receiving an operation

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.

When a bundler receives an `operation`, it SHOULD perform these sanity checks:

* The `endorserGasLimit` is sufficiently low (&lt;= `MAX_ENDORSER_GAS`).
* The endorser (i) is registered and has enough burn (&gt;= `MIN_ENDORSER_BURN`), and (ii) it has not been internally flagged as banned.
* The `fixedGas` is large enough to cover the cost associated with submitting the transaction (i.e. calldata gas costs).
* The `gasLimit` is at least the cost of a `CALL` with a non-zero value.
* The `feeToken` is `address(0)` or a known token address that the bundler is willing to accept.
* The `feeScalingFactor` and `feeNormalizationFactor` are `1` for a `feeToken` value of `address(0)` or values the bundler is willing to accept.
* The `maxFeePerGas` and `priorityPerGas` are above a configurable minimum value the bundler is willing to accept.
* If another operation exists in the mempool with the exact same dependency set AND the same endorser address, the `maxFeePerGas` and `priorityFeePerGas` 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)

The bundler should then perform evaluation of the operation.

### Evaluation

To evaluate the `operation`, the bundler MUST call `simulationSettings()` on the `endorser` to obtain simulation setting values. The bundler MUST apply the settings and **simulate** a call to `isOperationReady()` on the `endorser`. 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.

The `endorser` 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 `false`, the operation MUST be discarded.

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 **before** the operation must be simulated and then the `endorser` must be queried for readiness in-case some dependencies changed. Then constraints MUST be re-evaluated for correctness. Finally, the **operation** MUST be simulated.

If the **operation** fails during the final simulation, the `endorser` MUST be banned because (i) it returned a bad readiness state or (ii) it changed the operation readiness independently from the dependencies.

### Optional rules

Mempool clients MAY implement additional rules to further protect against maliciously constructed transactions.

* Limit the size of accepted dependencies to `MAX_OPERATION_DEPENDENCIES`, dropping operations that cross the boundary.
* Limit the number of times an operation may trigger a re-evaluation to `MAX_OPERATION_REEVALS`, dropping operations that cross the boundary.
* Limit the number of operations in the mempool that depend on the same dependency slots.

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.

### After operation inclusion

There is no limit in-place that defines that an operation can only be executed once.

The bundler SHOULD NOT drop an `operation` after successfully including such operation in a block, the bundler MAY perform evaluation.

If the `endorser` still returns `readiness == true` (after inclusion) then the operation SHOULD be treated as any other healthy operation, and thus it MAY be kept in the mempool.

### Endorser registry

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 `addBurn()` function.

All burn is effectively locked forever; slashing can&apos;t be reliably proved on-chain without protocol alterations, so it remains a virtual event on which mempool operators will ignore the deposited ETH.

#### Implementation

(EXAMPLE)

```solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.15;

contract EndorserRegistry {
  event Burned(
      address indexed _endorser,
      address indexed _sender,
      uint256 _new,
      uint256 _total
  );

  mapping(address =&gt; uint256) public burn;

  function addBurn(address _endorser) external payable returns (uint256) {
    uint256 total = burn[_endorser] + msg.value;
    burn[_endorser] = total;

    emit Burned(_endorser, msg.sender, msg.value, total);

    return total;
  }
}
```

## Rationale

### Griefing protection

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?

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:

* The bundler does not have a way to simulate the transaction with a reduced amount of gas; it has to use the whole `gasLimit`, exposing itself to a higher level of griefing.
* 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.
* The bundler does not have a way to know if a change to the state will invalidate a large portion of the mempool.

In this proposal, we add the `endorser` 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.

In effect, we move the responsibility from the wallet to the wallet developer; the developer must code, deploy and burn ETH for the `endorser`; 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.

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.

### Burned ETH

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.

### Minimum overhead

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.

### Differences with alternative proposals

1. 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.
2. 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 `dependency`.
3. This proposal does not specify a pre-deployment logic because it can be handled directly by the entrypoint.
4. This proposal does not require wallets to accept `execution` transactions from a trusted entrypoint contract, reducing overhead and allowing existing wallets to be compatible with the proposal.
5. This proposal does not distinguish between `execution` and `signature` payloads, this distinction remains implementation-specific.

## Backwards Compatibility

This ERC does not change he consensus layer, nor does impose changes on existing smart contract wallets, so there are no backwards compatibility issues.

## Security Considerations

This ERC does not make changes to on-chain interactions. Endorsers are explicitly for off-chain validations.

Bundlers are responsible for managing their own security and for ensuring that they are paid for the transactions they include in blocks.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 29 Jun 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5189</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5189</guid>
      </item>
    
      <item>
        <title>Minimal Soulbound NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5192-minimal-soulbound-nfts/9814</comments>
        
        <description>## Abstract

This standard is an extension of [EIP-721](./eip-721.md). It proposes a minimal interface to make tokens soulbound using the feature detection functionality of [EIP-165](./eip-165.md). A soulbound token is a non-fungible token bound to a single account.

## Motivation

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&apos;s invocation of transfer functionalities. Over the long term, this will lead to fragmentation and less composability.

In this document, we outline a minimal addition to [EIP-721](./eip-721.md) that allows wallet implementers to check for a token contract&apos;s permanent (non-)transferability using [EIP-165](./eip-165.md).

## Specification

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.

### Contract Interface

A token with a `uint256 tokenId` may be bound to a receiving account with `function locked(...)` returning `true`. In this case, all [EIP-721](./eip-721.md) functions of the contract that transfer the token from one account to another must throw.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IERC5192 {
  /// @notice Emitted when the locking status is changed to locked.
  /// @dev If a token is minted and the status is locked, this event should be emitted.
  /// @param tokenId The identifier for a token.
  event Locked(uint256 tokenId);

  /// @notice Emitted when the locking status is changed to unlocked.
  /// @dev If a token is minted and the status is unlocked, this event should be emitted.
  /// @param tokenId The identifier for a token.
  event Unlocked(uint256 tokenId);

  /// @notice Returns the locking status of an Soulbound Token
  /// @dev SBTs assigned to zero address are considered invalid, and queries
  /// about them do throw.
  /// @param tokenId The identifier for an SBT.
  function locked(uint256 tokenId) external view returns (bool);
}
```

To aid recognition that an [EIP-721](./eip-721.md) token implements &quot;soulbinding&quot; via this EIP upon calling [EIP-721](./eip-721.md)&apos;s `function supportsInterface(bytes4 interfaceID) external view returns (bool)` with `interfaceID=0xb45a3c0e`, a contract implementing this EIP must return `true`.

## Rationale

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.

## Backwards Compatibility

This proposal is fully backward compatible with [EIP-721](./eip-721.md).

## Security Considerations

There are no security considerations related directly to the implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 01 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5192</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5192</guid>
      </item>
    
      <item>
        <title>Blueprint contract format</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-5202-standard-factory-contract-format/9851</comments>
        
        <description>## Abstract

Define a standard for &quot;blueprint&quot; contracts, or contracts which represent initcode that is stored on-chain.

## Motivation

To decrease deployer contract size, a useful pattern is to store initcode on chain as a &quot;blueprint&quot; contract, and then use `EXTCODECOPY` to copy the initcode into memory, followed by a call to `CREATE` or `CREATE2`. However, this comes with the following problems:

- 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.
- 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, *anybody* 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 `SELFDESTRUCT` 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.

## Specification

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.

A blueprint contract MUST use the preamble `0xFE71&lt;version bits&gt;&lt;length encoding bits&gt;`. 6 bits are allocated to the version, and 2 bits to the length encoding. The first version begins at 0 (`0b000000`), and versions increment by 1. The value `0b11` for `&lt;length encoding bits&gt;` is reserved. In the case that the length bits are `0b11`, 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.

A blueprint contract MUST contain at least one byte of initcode.

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 `0xFE71&lt;version bits&gt;&lt;length encoding bits&gt;&lt;length bytes&gt;&lt;data&gt;`. The `&lt;length encoding bits&gt;` represent a number between 0 and 2 (inclusive) describing how many bytes `&lt;length bytes&gt;` takes, and `&lt;length bytes&gt;` is the big-endian encoding of the number of bytes that `&lt;data&gt;` takes.

## Rationale

- To save gas and storage space, the preamble should be as minimal as possible.

- It is considered &quot;bad&quot; behavior to try to CALL a blueprint contract directly, therefore the preamble starts with `INVALID (0xfe)` to end execution with an exceptional halting condition (rather than a &quot;gentler&quot; opcode like `STOP (0x00)`).

- To help distinguish a blueprint contract from other contracts that may start with `0xFE`, a &quot;magic&quot; byte is used. The value `0x71` was arbitrarily chosen by taking the last byte of the keccak256 hash of the bytestring &quot;blueprint&quot; (i.e.: `keccak256(b&quot;blueprint&quot;)[-1]`).

- An empty initcode is disallowed by the spec to prevent what might be a common mistake.

- 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 `len(data bytes)` is smaller than 256), two bits of the third byte are reserved to specify how many bytes the encoded length takes.

- 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;length bytes&gt;` (as [EIP-170](./eip-170.md) restricts contract length to 24KB), a `&lt;length encoding bits&gt;` value of 3 would never be required to describe `&lt;length bytes&gt;`. For that reason, the special `&lt;length encoding bits&gt;` value of `0b11` is reserved as a continuation sequence marker.

- 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 `EXTCODESIZE`.

- 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.


## Backwards Compatibility

No known issues

## Test Cases

- An example (and trivial!) blueprint contract with no data section, whose initcode is just the `STOP` instruction:

```
0xFE710000
```

- An example blueprint contract whose initcode is the trivial `STOP` instruction and whose data section contains the byte `0xFF` repeated seven times:

```
0xFE710107FFFFFFFFFFFFFF00
```

Here, 0xFE71 is the magic header, `0x01` means version 0 + 1 length bit, `0x07` 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 `0xFE71|01|07|FFFFFFFFFFFFFF|00`.

- An example blueprint whose initcode is the trivial `STOP` instruction and whose data section contains the byte `0xFF` repeated 256 times:

```
0xFE71020100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
```

Delimited, that would be `0xFE71|02|0100|FF...FF|00`.

## Reference Implementation

```python
from typing import Optional, Tuple

def parse_blueprint_preamble(bytecode: bytes) -&gt; Tuple[int, Optional[bytes], bytes]:
    &quot;&quot;&quot;
    Given bytecode as a sequence of bytes, parse the blueprint preamble and
    deconstruct the bytecode into:
        the ERC version, preamble data and initcode.
    Raises an exception if the bytecode is not a valid blueprint contract
    according to this ERC.
    arguments:
        bytecode: a `bytes` object representing the bytecode
    returns:
        (version,
         None if &lt;length encoding bits&gt; is 0, otherwise the bytes of the data section,
         the bytes of the initcode,
        )
    &quot;&quot;&quot;
    if bytecode[:2] != b&quot;\xFE\x71&quot;:
        raise Exception(&quot;Not a blueprint!&quot;)

    erc_version = (bytecode[2] &amp; 0b11111100) &gt;&gt; 2

    n_length_bytes = bytecode[2] &amp; 0b11
    if n_length_bytes == 0b11:
        raise Exception(&quot;Reserved bits are set&quot;)

    data_length = int.from_bytes(bytecode[3:3 + n_length_bytes], byteorder=&quot;big&quot;)

    if n_length_bytes == 0:
        preamble_data = None
    else:
        data_start = 3 + n_length_bytes
        preamble_data = bytecode[data_start:data_start + data_length]

    initcode = bytecode[3 + n_length_bytes + data_length:]

    if len(initcode) == 0:
        raise Exception(&quot;Empty initcode!&quot;)

    return erc_version, preamble_data, initcode
```

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):

```python
def blueprint_deployer_bytecode(initcode: bytes) -&gt; bytes:
    blueprint_preamble = b&quot;\xFE\x71\x00&quot;  # ERC5202 preamble
    blueprint_bytecode = blueprint_preamble + initcode

    # the length of the deployed code in bytes
    len_bytes = len(blueprint_bytecode).to_bytes(2, &quot;big&quot;)

    # copy &lt;blueprint_bytecode&gt; to memory and `RETURN` it per EVM creation semantics
    # PUSH2 &lt;len&gt; RETURNDATASIZE DUP2 PUSH1 10 RETURNDATASIZE CODECOPY RETURN
    deploy_bytecode = b&quot;\x61&quot; + len_bytes + b&quot;\x3d\x81\x60\x0a\x3d\x39\xf3&quot;

    return deploy_bytecode + blueprint_bytecode
```

## Security Considerations

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.

As of 2022-07-08, no contracts deployed on the Ethereum mainnet have a bytecode starting with `0xFE71`.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 23 Jun 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5202</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5202</guid>
      </item>
    
      <item>
        <title>ERC-1155 Allowance Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-erc1155-approval-by-amount/9898</comments>
        
        <description>## Abstract

This ERC defines standard functions for granular approval of [ERC-1155](./eip-1155.md) tokens by both `id` and `amount`. This ERC extends [ERC-1155](./eip-1155.md).

## Motivation

[ERC-1155](./eip-1155.md)&apos;s popularity means that multi-token management transactions occur on a daily basis. Although it can be used as a more comprehensive alternative to [ERC-721](./eip-721.md), ERC-1155 is most commonly used as intended: creating multiple `id`s, each with multiple tokens. While many projects interface with these semi-fungible tokens, by far the most common interactions are with NFT marketplaces.

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 `setApprovalForAll` function, which approves ALL tokens with a specific `id`. This system has obvious minimum required trust flaws. This ERC combines ideas from [ERC-20](./eip-20.md) and [ERC-721](./eip-721.md) 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 `id`.

## Specification

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.

Contracts using this ERC MUST implement the `IERC5216` interface.

### Interface implementation

```solidity
/**
 * @title ERC-1155 Allowance Extension
 * Note: the ERC-165 identifier for this interface is 0x1be07d74
 */
interface IERC5216 is IERC1155 {

    /**
     * @notice Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `id` and with an amount: `amount`.
     */
    event Approval(address indexed account, address indexed operator, uint256 id, uint256 amount);

    /**
     * @notice Grants permission to `operator` to transfer the caller&apos;s tokens, according to `id`, and an amount: `amount`.
     * Emits an {Approval} event.
     *
     * Requirements:
     * - `operator` cannot be the caller.
     */
    function approve(address operator, uint256 id, uint256 amount) external;

    /**
     * @notice Returns the amount allocated to `operator` approved to transfer `account`&apos;s tokens, according to `id`.
     */
    function allowance(address account, address operator, uint256 id) external view returns (uint256);
}
```

The `approve(address operator, uint256 id, uint256 amount)` function MUST be either `public` or `external`.

The `allowance(address account, address operator, uint256 id)` function MUST be either `public` or `external` and MUST be `view`.

The `safeTrasferFrom` function (as defined by ERC-1155) MUST:

- Not revert if the user has approved `msg.sender` with a sufficient `amount`
- Subtract the transferred amount of tokens from the approved amount if `msg.sender` is not approved with `setApprovalForAll`

In addition, the `safeBatchTransferFrom` MUST:

- Add an extra condition that checks if the `allowance` of all `ids` have the approved `amounts` (See `_checkApprovalForBatch` function reference implementation)

The `Approval` event MUST be emitted when a certain number of tokens are approved.

The `supportsInterface` method MUST return `true` when called with `0x1be07d74`.

## Rationale

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 `id` and `amount` to `operator`s.

By having a way to approve and revoke in a manner similar to [ERC-20](./eip-20.md), the trust level can be more directly managed by users:

- Using the `approve` function, users can approve an operator to spend an `amount` of tokens for each `id`.
- Using the `allowance` function, users can see the approval that an operator has for each `id`.

The [ERC-20](./eip-20.md) name patterns were used due to similarities with [ERC-20](./eip-20.md) approvals.

## Backwards Compatibility

This standard is compatible with [ERC-1155](./eip-1155.md).

## Reference Implementation

The reference implementation can be found [here](../assets/eip-5216/ERC5216.sol).

## Security Considerations

Users of this ERC must thoroughly consider the amount of tokens they give permission to `operators`, and should revoke unused authorizations.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 11 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5216</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5216</guid>
      </item>
    
      <item>
        <title>NFT Rights Management</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5218-nft-rights-management/9911</comments>
        
        <description>## Abstract

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.

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. 


## Motivation

The [ERC-721](./eip-721.md) 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 *tether* 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 [ERC-721](./eip-721.md)) or rental (see [ERC-4907](./eip-4907.md)).

This EIP attempts to provide a standard to facilitate rights management of NFTs in the world of Web3. In particular, [ERC-5218](./eip-5218.md) smart contracts allow all licenses to an NFT, including the *root license* issued to the NFT owner and *sublicenses* 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.



## Specification

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.

**Every ERC-5218 compliant contract *must* implement the `IERC5218` interface**:

```solidity
pragma solidity ^0.8.0;

/// @title ERC-5218: NFT Rights Management
interface IERC5218 is IERC721 {

  /// @dev This emits when a new license is created by any mechanism.
  event CreateLicense(uint256 _licenseId, uint256 _tokenId, uint256 _parentLicenseId, address _licenseHolder, string _uri, address _revoker);
 
  /// @dev This emits when a license is revoked. Note that under some
  ///  license terms, the sublicenses may be `implicitly` revoked following the
  ///  revocation of some ancestral license. In that case, your smart contract
  ///  may only emit this event once for the ancestral license, and the revocation
  ///  of all its sublicenses can be implied without consuming additional gas.
  event RevokeLicense(uint256 _licenseId);
 
  /// @dev This emits when the a license is transferred to a new holder. The
  ///  root license of an NFT should be transferred with the NFT in an ERC721
  ///  `transfer` function call. 
  event TransferLicense(uint256 _licenseId, address _licenseHolder);
  
  /// @notice Check if a license is active.
  /// @dev A non-existing or revoked license is inactive and this function must
  ///  return `false` upon it. Under some license terms, a license may become
  ///  inactive because some ancestral license has been revoked. In that case,
  ///  this function should return `false`.
  /// @param _licenseId The identifier for the queried license
  /// @return Whether the queried license is active
  function isLicenseActive(uint256 _licenseId) external view returns (bool);

  /// @notice Retrieve the token identifier a license was issued upon.
  /// @dev Throws unless the license is active.
  /// @param _licenseId The identifier for the queried license
  /// @return The token identifier the queried license was issued upon
  function getLicenseTokenId(uint256 _licenseId) external view returns (uint256);

  /// @notice Retrieve the parent license identifier of a license.
  /// @dev Throws unless the license is active. If a license doesn&apos;t have a
  ///  parent license, return a special identifier not referring to any license
  ///  (such as 0).
  /// @param _licenseId The identifier for the queried license
  /// @return The parent license identifier of the queried license
  function getParentLicenseId(uint256 _licenseId) external view returns (uint256);

  /// @notice Retrieve the holder of a license.
  /// @dev Throws unless the license is active.   
  /// @param _licenseId The identifier for the queried license
  /// @return The holder address of the queried license
  function getLicenseHolder(uint256 _licenseId) external view returns (address);

  /// @notice Retrieve the URI of a license.
  /// @dev Throws unless the license is active.   
  /// @param _licenseId The identifier for the queried license
  /// @return The URI of the queried license
  function getLicenseURI(uint256 _licenseId) external view returns (string memory);

  /// @notice Retrieve the revoker address of a license.
  /// @dev Throws unless the license is active.   
  /// @param _licenseId The identifier for the queried license
  /// @return The revoker address of the queried license
  function getLicenseRevoker(uint256 _licenseId) external view returns (address);

  /// @notice Retrieve the root license identifier of an NFT.
  /// @dev Throws unless the queried NFT exists. If the NFT doesn&apos;t have a root
  ///  license tethered to it, return a special identifier not referring to any
  ///  license (such as 0).   
  /// @param _tokenId The identifier for the queried NFT
  /// @return The root license identifier of the queried NFT
  function getLicenseIdByTokenId(uint256 _tokenId) external view returns (uint256);
  
  /// @notice Create a new license.
  /// @dev Throws unless the NFT `_tokenId` exists. Throws unless the parent
  ///  license `_parentLicenseId` is active, or `_parentLicenseId` is a special
  ///  identifier not referring to any license (such as 0) and the NFT
  ///  `_tokenId` doesn&apos;t have a root license tethered to it. Throws unless the
  ///  message sender is eligible to create the license, i.e., either the
  ///  license to be created is a root license and `msg.sender` is the NFT owner,
  ///  or the license to be created is a sublicense and `msg.sender` is the holder
  ///  of the parent license. 
  /// @param _tokenId The identifier for the NFT the license is issued upon
  /// @param _parentLicenseId The identifier for the parent license
  /// @param _licenseHolder The address of the license holder
  /// @param _uri The URI of the license terms
  /// @param _revoker The revoker address
  /// @return The identifier of the created license
  function createLicense(uint256 _tokenId, uint256 _parentLicenseId, address _licenseHolder, string memory _uri, address _revoker) external returns (uint256);

  /// @notice Revoke a license.
  /// @dev Throws unless the license is active and the message sender is the
  ///  eligible revoker. This function should be used for revoking both root
  ///  licenses and sublicenses. Note that if a root license is revoked, the
  ///  NFT should be transferred back to its creator.
  /// @param _licenseId The identifier for the queried license
  function revokeLicense(uint256 _licenseId) external;
  
  /// @notice Transfer a sublicense.
  /// @dev Throws unless the sublicense is active and `msg.sender` is the license
  ///  holder. Note that the root license of an NFT should be tethered to and
  ///  transferred with the NFT. Whenever an NFT is transferred by calling the
  ///  ERC721 `transfer` function, the holder of the root license should be
  ///  changed to the new NFT owner.
  /// @param _licenseId The identifier for the queried license
  /// @param _licenseHolder The new license holder
  function transferSublicense(uint256 _licenseId, address _licenseHolder) external;
}
```

Licenses to an NFT in general have a tree structure as below:

![The license tree](../assets/eip-5218/license-tree.png)

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.

The full log of license creation, transfer, and revocation *must* be traceable via event logs. Therefore, all license creations and transfers *must* emit a corresponding log event. Revocation may differ a bit. An implementation of this EIP may emit a `Revoke` 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.

The `revoker` of a license may be the licensor, the license holder, or a smart contract address which calls the `revokeLicense` function when some conditions are met. Implementers should be careful with the authorization, and may make the `revoker` smart contract forward compatible with transfers by not hardcoding the addresses of `licensor` or `licenseHolder`.

The license `URI` 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:

```json
{
    &quot;title&quot;: &quot;License Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;legal-code&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;The legal code of the license.&quot;
        },
        &quot;human-readable&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;The human readable license deed.&quot;
        },
        &quot;machine-readable&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;The machine readable code of the license that can be recognized by software, such as CC REL.&quot;
        }
    }
}
```

Note that this EIP doesn&apos;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.

The `supportsInterface` method MUST return `true` when called with `0xac7b5ca9`.

## Rationale

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&apos;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&apos;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.

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 [ERC-5289](./eip-5289.md) 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.

## Backwards Compatibility

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.

## Test Cases

Test cases are available [here](../assets/eip-5218/contracts/test/Contract.t.sol).

## Reference Implementation

A reference implementation maintains the following data structures:

```solidity
  struct License {
    bool active; // whether the license is active
    uint256 tokenId; // the identifier of the NFT the license is tethered to
    uint256 parentLicenseId; // the identifier of the parent license
    address licenseHolder; // the license holder
    string uri; // the license URI
    address revoker; // the license revoker
  }
  mapping(uint256 =&gt; License) private _licenses; // maps from a license identifier to a license object
  mapping(uint256 =&gt; uint256) private _licenseIds; // maps from an NFT to its root license identifier
```

Each NFT has a license tree and starting from each license, one can trace back to the root license via `parentLicenseId` along the path. 

In the reference implementation, once a license is revoked, all sublicenses under it are revoked. This is realized in a *lazy* manner for lower gas cost, i.e., assign `active=false` only for licenses that are explicitly revoked in a `revokeLicense` function call. Therefore, `isLicenseActive` returns `true` only if all its ancestral licenses haven&apos;t been revoked.

For non-root licenses, the creation, transfer and revocation are straightforward:

1. Only the holder of an active license can create sublicenses.
2. Only the holder of an active license can transfer it to a different license holder. 
3. Only the revoker of an active license can revoke it.

The root license must be compatible with `ERC-721`: 

1. When an NFT is minted, a license is granted to the NFT owner.
2. When an NFT is transferred, the license holder is changed to the new owner of the NFT.
3. 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.

The complete implementation can be found [here](../assets/eip-5218/contracts/src/RightsManagement.sol). 

In addition, the [Token-Bound NFT License](../assets/eip-5218/ic3license/ic3license.pdf) is specifically designed to work with this interface and provides a reference to the language of NFT licenses.

## Security Considerations

Implementors of the `IERC5218` standard must consider thoroughly the permissions they give to `licenseHolder` and `revoker`. If the license is ever to be transferred to a different license holder, the `revoker` smart contract should not hardcode the `licenseHolder` address to avoid undesirable scenarios.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Mon, 11 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5218</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5218</guid>
      </item>
    
      <item>
        <title>Contract Resource Requests</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/pr-5219-discussion-contract-rest/9907</comments>
        
        <description>## Abstract

This EIP standardizes an interface to make resource requests to smart contracts and to receive HTTP-like responses.

## Motivation

Ethereum is the most-established blockchain for building decentralized applications (referred to as `DApp`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 *centralized* website containing the DApp&apos;s front-end code, presenting a few issues. The following are some risks associated with using centralized websites to interface with decentralized applications:

- Trust Minimization: An unnecessarily large number of entities need to be trusted
- Censorship: A centralized website is not resistant to being censored
- Permanence: The interface may not have a mechanism that permits it to be permanently stored
- Interoperability: Smart Contracts cannot directly interact with DApp interfaces
  
## Specification

The key words &quot;MUST&quot;, &quot;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.

### Name Resolution

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.

### Separation of Concerns

It is RECOMMENDED to separate the application logic from the front-end logic (the contract implementing the interface defined in [Contract Interface](#contract-interface)).

### Contract Interface

DApp contracts MUST implement the interface defined in the following file: [Contract Interface](../assets/eip-5219/IDecentralizedApp.sol).

### Note to Implementers

To save gas costs, it is recommended to use the `message/external-body` 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:

```yaml
statusCode: 200
body: THIS IS NOT REALLY THE BODY!
headers:
  - key: Content-type
    value: message/external-body; access-type=URL; URL=&quot;ipfs://11148a173fd3e32c0fa78b90fe42d305f202244e2739&quot;
```

## Rationale

The `request` method was chosen to be readonly because all data should be sent to the contract from the parsed DApp. Here are some reasons why:

- 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.
- 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&apos;s machine.
- Separation of Concerns: the front-end contract shouldn&apos;t have to worry about interacting with the back-end smart contract.
- Other EIPs can be used to request state changing operations in conjunction with a `307 Temporary Redirect` status code.

Instead of mimicking a full HTTP request, a highly slimmed version was chosen for the following reasons:

- The only particularly relevant HTTP method is `GET`
- Query parameters can be encoded in the resource.
- Request headers are, for the most part, unnecessary for `GET` requests.

## Backwards Compatibility

This EIP is backwards compatible with all standards listed in the [Name Resolution](#name-resolution) section.

## Security Considerations

The normal security considerations of accessing normal URLs apply here, such as potential privacy leakage by following `3XX` redirects.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 10 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5219</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5219</guid>
      </item>
    
      <item>
        <title>Smart Contract Executable Proposal Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-5247-executable-proposal-standard/9938</comments>
        
        <description>## Abstract

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.

## Motivation

It is oftentimes necessary to separate the code that is to be executed from the actual execution of the code.

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 [ERC-1202](./eip-1202.md)). Finally, when consensus has been formed, the proposal is executed.

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.

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.

## Specification

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.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface IERC5247 {
    event ProposalCreated(
        address indexed proposer,
        uint256 indexed proposalId,
        address[] targets,
        uint256[] values,
        uint256[] gasLimits,
        bytes[] calldatas,
        bytes extraParams
    );

    event ProposalExecuted(
        address indexed executor,
        uint256 indexed proposalId,
        bytes extraParams
    );

    function createProposal(
        uint256 proposalId,
        address[] calldata targets,
        uint256[] calldata values,
        uint256[] calldata gasLimits,
        bytes[] calldata calldatas,
        bytes calldata extraParams
    ) external returns (uint256 registeredProposalId);

    function executeProposal(uint256 proposalId, bytes calldata extraParams) external;
}
```

## Rationale

* Originally, this interface was part of [ERC-1202](./eip-1202.md). 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 decided to *decouple the voting interface and proposal interface*.
* Arrays were used for `target`s, `value`s, `calldata`s instead of single variables, allowing a proposal to carry arbitrarily many function calls.
* `registeredProposalId` is returned in `createProposal` so the standard can support implementation to decide their own format of proposal id.

## Test Cases

A simple test case can be found as

```ts
        it(&quot;Should work for a simple case&quot;, async function () {
            const { contract, erc721, owner } = await loadFixture(deployFixture);
            const callData1 = erc721.interface.encodeFunctionData(&quot;mint&quot;, [owner.address, 1]);
            const callData2 = erc721.interface.encodeFunctionData(&quot;mint&quot;, [owner.address, 2]);
            await contract.connect(owner)
                .createProposal(
                    0,
                    [erc721.address, erc721.address],
                    [0,0],
                    [0,0],
                    [callData1, callData2],
                    []);
            expect(await erc721.balanceOf(owner.address)).to.equal(0);
            await contract.connect(owner).executeProposal(0, []);
            expect(await erc721.balanceOf(owner.address)).to.equal(2);
        });
```

See [testProposalRegistry.ts](../assets/eip-5247/testProposalRegistry.ts) for the whole test set.

## Reference Implementation

A simple reference implementation can be found.

```solidity
    function createProposal(
        uint256 proposalId,
        address[] calldata targets,
        uint256[] calldata values,
        uint256[] calldata gasLimits,
        bytes[] calldata calldatas,
        bytes calldata extraParams
    ) external returns (uint256 registeredProposalId) {
        require(targets.length == values.length, &quot;GeneralForwarder: targets and values length mismatch&quot;);
        require(targets.length == gasLimits.length, &quot;GeneralForwarder: targets and gasLimits length mismatch&quot;);
        require(targets.length == calldatas.length, &quot;GeneralForwarder: targets and calldatas length mismatch&quot;);
        registeredProposalId = proposalCount;
        proposalCount++;

        proposals[registeredProposalId] = Proposal({
            by: msg.sender,
            proposalId: proposalId,
            targets: targets,
            values: values,
            calldatas: calldatas,
            gasLimits: gasLimits
        });
        emit ProposalCreated(msg.sender, proposalId, targets, values, gasLimits, calldatas, extraParams);
        return registeredProposalId;
    }
    function executeProposal(uint256 proposalId, bytes calldata extraParams) external {
        Proposal storage proposal = proposals[proposalId];
        address[] memory targets = proposal.targets;
        string memory errorMessage = &quot;Governor: call reverted without message&quot;;
        for (uint256 i = 0; i &lt; targets.length; ++i) {
            (bool success, bytes memory returndata) = proposal.targets[i].call{value: proposal.values[i]}(proposal.calldatas[i]);
            Address.verifyCallResult(success, returndata, errorMessage);
        }
        emit ProposalExecuted(msg.sender, proposalId, extraParams);
    }
```

See [ProposalRegistry.sol](../assets/eip-5247/ProposalRegistry.sol) for more information.

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 13 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5247</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5247</guid>
      </item>
    
      <item>
        <title>Account-bound Finance</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/pr-5252-discussion-account-bound-finance/10027</comments>
        
        <description>## Abstract

This EIP proposes a form of smart contract design pattern and a new type of account abstraction on how one&apos;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&apos;s assets using a personal finance contract for each individual. The separation between an investor&apos;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&apos;s control.

This EIP extends [ERC-5114](./eip-5114.md) to further enable transferring fund to other accounts for mobility between managing multiple wallets.

## Motivation

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&apos;s own investments with the operators&apos; clout in Web3.0.

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&apos; 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.

The pattern with personal finance contract also offers more transparency than storing mixed fund financial data in the operating team&apos;s contract. With a personal finance contract, an account&apos;s activity is easier to track than one global smart contract&apos;s activity. The pattern introduces a Non-Fungiible Account-Bound Token (ABT) to store credentials from the personal finance contract.

### Offchain-identity vs Soul-bound token on credentials

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.

## Specification

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.

The specification consists of two patterns for **Interaction** and **Governance**.

### Interaction

#### Interfaces

The interaction pattern consists of 4 components for interaction; manager, factory, finance, account-bound token, and extension.

Interaction contract pattern is defined with these contracts:

- A soul-bound or account bound token contract to give access to interact with a financial contract with credentials
- A manager contract that interacts first contact with an investor
- A factory contract that creates a financial contract for each user
- A finance contract that can interact with the investor

#### Requirements

A soul-bound or account bound token contract is defined with these properties:

1. It SHALL be non-fungible and MUST satisfy [ERC-721](./eip-721.md).
2. Credentials SHOULD be represented with its metadata with `tokenURI()` function.
3. It MUST only reference factory to verify its minting.
4. If it is transferrable, it is account-bound. If not, it is soul-bound.

A manager contract is defined with these properties:

1. It MUST be the only kind of contract which calls factory to create.
2. It SHOULD store all related configurations for financial parameters.

A factory contract is defined with these properties:

1. It SHALL clone the finance contract with uniform implementation.
2. It MUST be the only contract that can mint account-bound token.
3. It MUST keep an recent id of account bound token.

A finance contract is defined with these properties:

1. A finance contract MUST only be initialized once from factory contract in constructor.
2. 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.
3. 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).
4. Global function SHOULD be commented as `/* global */` to clarify the function is can be accessed with anyone.
5. Each finance contract SHOULD be able to represent transaction that has happened only with those who had account-bound token.
6. 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.

#### Contracts

![Diagram](../assets/eip-5252/media/media.svg)

&lt;center&gt;
Contract Diagram of [ERC-5252](eip-5252.md)
&lt;/center&gt;

**`Manager`**: **`Manager`** contract acts as an entry point to interact with the investor. The contract also stores parameters for **`Finance`** contract.

**`Factory`**: **`Factory`** contract manages contract bytecode to create for managing investor&apos;s fund and clones **`Finance`** contract on **`Manager`** contract&apos;s approval. It also mints account-bound tokens to interact with the `Finance` contract.

**`Finance`**: **`Finance`** contract specifies all rules on managing an investor&apos;s fund. The contract is only accessible with an account that has an Account-bound token. When an investor deposits a fund to **`Manager`** contract, the contract sends the fund to **`Finance`** contract account after separating fees for operation.

**`Account-bound token`**: **`Account-bound token`** contract in this EIP can bring the **`Finance`** contract&apos;s data and add metadata. For example, if there is a money market lending
**`Finance`** contract, its **`Account-bound token`** can show how much balance is in agreement using SVG.

**`Extension`**: **`Extension`** contract is another contract that can utilize locked funds in **`Finance`** contract. The contract can access with **`Finance`** contract on operator&apos;s approval managed in **`Manager`** contract. Example use case of `Extension` can be a membership.

**`Metadata`**: **`Metadata`** 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.

---

### Governance

The governance pattern consists of 2 components; influencer and governor.

#### Interfaces

#### Requirements

An influencer contract is defined with these properties:

1. The contract SHALL manage multiplier for votes.
2. The contract SHALL set a decimal to calculated normalized scores.
3. The contract SHALL set a function where governance can decide factor parameters.

A governor contract is defined with these properties:

1. The contract MUST satisfy Governor contract from OpenZeppelin.
2. The contract SHALL refer influencer contract for multiplier
3. The contract MUST limit transfer of account bound token once claimed for double vote prevention.

#### From Token Governance To Contribution Based Governance

|             | Token Governance             | Credential-based Governance        |
| ----------- | ---------------------------- | ---------------------------------- |
| Enforcement | More tokens, more power      | More contribution, More power      |
| Incentives  | More tokens, more incentives | More contribution, more incentives |
| Penalty     | No penalty                   | Loss of power                      |
| Assignment  | One who holds the token      | One who has the most influence     |

&lt;center&gt;
Token Governance vs Credential Based Governance
&lt;/center&gt;

Token governance is not sustainable in that it gives **more** 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.

New governance that considers contributions to the protocol is needed because:

- **Rulers can be penalized on breaking the protocol**
- **Rulers can be more effectively incentivized on maintaining the protocol**

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 **`Influence`**.

#### Calculating Influence

**`Influence`** is a multiplier on staked tokens that brings more voting power of a DAO to its contributors. To get **`Influence`**, a score is calculated on weighted contribution matrix. Then, the score is normalized to give a member&apos;s position in whole distribution. Finally, the multiplier is determined on the position in every community members.

#### Calculating score

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.

|     | Description                                                                               |
| --- | ----------------------------------------------------------------------------------------- |
| α   | Contribution value per each **`Finance`** contract from current proposal                  |
| β   | Time they maintained **`Finance`** per each contract from current timestamp of a proposal |

```math
(score per each ABT) = α * (contribution value) + β * (time that abt was maintained from now)
```

#### Normalization

Normalization is applied for data integrity on user&apos;s contribution in a DAO.
Normalized score can be calculated from the state of submitting a proposal

```math
(Normalized score per each ABT) = α * (contribution value)/(total contribution value at submitting tx) + β * (time that abt was maintained)/(time passed from genesis to proposal creation)
```

and have a value between 0 and 1 (since α + β = 1).

#### Multiplier

The multiplier is determined linearly from base factor (b) and multiplier(m).

The equation for influence is :

```math
(influence) = m * (sum(normalized_score))
```

#### Example

For example, if a user has 3 **`Account-bound tokens`** 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

````math
0.5 * {(1.0 + 0.5 + 0.3) / 3} + 1.5 = 1.8

 The total voting power would be

```math
(voting power) = 1.8 * sqrt(100)  = 18
````

#### Stakers vs Enforcers

|              | Stakers                           | Enforcers                                                                               |
| ------------ | --------------------------------- | --------------------------------------------------------------------------------------- |
| Role         | stake governance token for voting | Contributed on the system, can make proposal to change rule, more voting power like 1.5 |
| Populations  | many                              | small                                                                                   |
| Contribution | Less effect                       | More effect                                                                             |
| Influence    | sqrt(locked token)                | Influence \* sqrt(locked token)                                                         |

&lt;center&gt;
Stakers vs Enforcers
&lt;/center&gt;

**Stakers**: Stakers are people who vote to enforcers&apos; proposals and get dividend for staked tokens

**Enforcers**: Enforcers are people who takes risk on managing protocol and contributes to the protocol by making a proposal and change to it.

#### Contracts

**`Influencer`**: An **`Influencer`** 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.

**`Governor`**: **`Governor`** 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 **`Manager`** configs. Only the `Enforcer` can propose new parameters.

## Rationale

### Gas saving for end user

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&apos; 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&apos;s contract operating cost is sometimes over 0.1 ETH, limitimg users&apos; 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.

#### Separation between investor&apos;s and operation fund

The separation between an investor&apos;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&apos;s control.

## Backwards Compatibility

This EIP has no known backward compatibility issues.

## Reference Implementation

[Reference implementation](../assets/eip-5252/README.md) is a simple deposit account contract as `Finance` contract and its contribution value α is measured with deposit amount with ETH.

## Security Considerations

- **`Factory`** contracts must ensure that each **`Finance`** contract is registered in the factory and check that **`Finance`** contracts are sending transactions related to their bounded owner.

- Reentrancy attack guard should be applied or change state before delegatecall in each user function in **`Manager`** contract or **`Finance`** contract. Otherwise, **`Finance`** can be generated as double and ruin whole indices.

- Once a user locks influence on a proposal&apos;s vote, an **`Account Bound Token`** cannot be transferred to another wallet. Otherwise, double influence can happen.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 29 Jun 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5252</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5252</guid>
      </item>
    
      <item>
        <title>Retrieval of EIP-712 domain</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5267-retrieval-of-eip-712-domain/9951</comments>
        
        <description>## Abstract

This EIP complements [EIP-712](./eip-712.md) 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.

## Motivation

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 [EIP-2612](./eip-2612.md) (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.

## Specification

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.

Compliant contracts MUST define `eip712Domain` exactly as declared below. All specified values MUST be returned even if they are not used, to ensure proper decoding on the client side.

```solidity
function eip712Domain() external view returns (
    bytes1 fields,
    string name,
    string version,
    uint256 chainId,
    address verifyingContract,
    bytes32 salt,
    uint256[] extensions
);
```

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 `EIP712Domain` struct (i.e., which of the optional fields and extensions are present) and the value of each field, as follows.

- `fields`: A bit map where bit `i` is set to 1 if and only if domain field `i` is present (`0 ≤ i ≤ 4`). 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.
- `name`, `version`, `chainId`, `verifyingContract`, `salt`: The value of the corresponding field in `EIP712Domain`, if present according to `fields`. If the field is not present, the value is unspecified. The semantics of each field is defined in EIP-712.
- `extensions`: 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 `fields` does not affect their inclusion.

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 `chainId` field, if used, SHOULD change to mirror the [EIP-155](./eip-155.md) id of the underlying chain. Contracts MAY emit the event `EIP712DomainChanged` defined below to signal that the domain could have changed.

```solidity
event EIP712DomainChanged();
```

## Rationale

A notable application of EIP-712 signatures is found in EIP-2612 (permit), which specifies a `DOMAIN_SEPARATOR` function that returns a `bytes32` value (the actual domain separator, i.e., the result of `hashStruct(eip712Domain)`). 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.

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;

## Backwards Compatibility

This is an optional extension to EIP-712 that does not introduce backwards compatibility issues.

Upgradeable contracts that make use of EIP-712 signatures MAY be upgraded to implement this EIP.

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 `DOMAIN_SEPARATOR` or `domainSeparator` function in the contract.

## Reference Implementation

### Solidity Example

```solidity
pragma solidity 0.8.0;

contract EIP712VerifyingContract {
  function eip712Domain() external view returns (
      bytes1 fields,
      string memory name,
      string memory version,
      uint256 chainId,
      address verifyingContract,
      bytes32 salt,
      uint256[] memory extensions
  ) {
      return (
          hex&quot;0d&quot;, // 01101
          &quot;Example&quot;,
          &quot;&quot;,
          block.chainid,
          address(this),
          bytes32(0),
          new uint256[](0)
      );
  }
}
```

This contract&apos;s domain only uses the fields `name`, `chainId`, and `verifyingContract`, therefore the `fields` value is `01101`, or `0d` in hexadecimal.

Assuming this contract is on Ethereum mainnet and its address is 0x0000000000000000000000000000000000000001, the domain it describes is:

```json5
{
  name: &quot;Example&quot;,
  chainId: 1,
  verifyingContract: &quot;0x0000000000000000000000000000000000000001&quot;
}
```

### JavaScript

A domain object can be constructed based on the return values of an `eip712Domain()` invocation.

```javascript
/** Retrieves the EIP-712 domain of a contract using EIP-5267 without extensions. */
async function getDomain(contract) {
  const { fields, name, version, chainId, verifyingContract, salt, extensions } =
    await contract.eip712Domain();

  if (extensions.length &gt; 0) {
    throw Error(&quot;Extensions not implemented&quot;);
  }

  return buildBasicDomain(fields, name, version, chainId, verifyingContract, salt);
}

const fieldNames = [&apos;name&apos;, &apos;version&apos;, &apos;chainId&apos;, &apos;verifyingContract&apos;, &apos;salt&apos;];

/** Builds a domain object without extensions based on the return values of `eip712Domain()`. */
function buildBasicDomain(fields, name, version, chainId, verifyingContract, salt) {
  const domain = { name, version, chainId, verifyingContract, salt };

  for (const [i, field] of fieldNames.entries()) {
    if (!(fields &amp; (1 &lt;&lt; i))) {
      delete domain[field];
    }
  }

  return domain;
}
```

#### Extensions

Suppose EIP-XYZ defines a new field `subdomain` of type `bytes32` and a function `getSubdomain()` to retrieve its value.

The function `getDomain` from above would be extended as follows.

```javascript
/** Retrieves the EIP-712 domain of a contract using EIP-5267 with support for EIP-XYZ. */
async function getDomain(contract) {
  const { fields, name, version, chainId, verifyingContract, salt, extensions } =
    await contract.eip712Domain();

  const domain = buildBasicDomain(fields, name, version, chainId, verifyingContract, salt);

  for (const n of extensions) {
    if (n === XYZ) {
      domain.subdomain = await contract.getSubdomain();
    } else {
      throw Error(`EIP-${n} extension not implemented`);
    }
  }

  return domain;
}
```

Additionally, the type of the `EIP712Domain` struct needs to be extended with the `subdomain` field. This is left out of scope of this reference implementation.

## Security Considerations

While this EIP allows a contract to specify a `verifyingContract` other than itself, as well as a `chainId` 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 14 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5267</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5267</guid>
      </item>
    
      <item>
        <title>ERC Detection and Discovery</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc5269-human-readable-interface-detection/9957</comments>
        
        <description>## Abstract

An interface for better identification and detection of ERCs by number.
It designates a field called `majorERCIdentifier` which is normally known or referred to as &quot;ERC number&quot;. For example, [ERC-721](./eip-721.md) has a `majorERCIdentifier = 721`. This ERC has a `majorERCIdentifier = 5269`.

Calling it a `majorERCIdentifier` instead of `ERCNumber` makes it future-proof: anticipating there is a possibility where future ERCs are not numbered or if we want to incorporate other types of standards.

It also proposes a new concept of `minorERCIdentifier` which is left for authors of
individual ERC to define. For example, ERC-721&apos;s author may define `ERC721Metadata`
interface as `minorERCIdentifier= keccak256(&quot;ERC721Metadata&quot;)`.

It also proposes an event to allow smart contracts to optionally declare the ERCs they support.

## Motivation

This ERC is created as a competing standard for [ERC-165](./eip-165.md).

Here are the major differences between this ERC and [ERC-165](./eip-165.md).

1. [ERC-165](./eip-165.md) uses the hash of a method&apos;s signature which declares the existence of one method or multiple methods,
therefore it requires at least one method to *exist* in the first place. In some cases, some ERC interfaces do 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.
1. [ERC-165](./eip-165.md) doesn&apos;t provide query ability based on the caller.
The compliant contract of this ERC will respond to whether it supports certain ERC *based on* a given caller.

Here is the motivation for this ERC given ERC-165 already exists:

1. Using ERC numbers improves human readability as well as make it easier to work with named contracts such as ENS.

2. 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

- [ERC-5267](./eip-5267.md) specifies `extensions` to be a list of ERC numbers.
- [ERC-600](./eip-600.md), and [ERC-601](./eip-601.md) specify an `ERC` number in the `m / purpose&apos; / subpurpose&apos; / ERC&apos; / wallet&apos;` path.
- [ERC-5568](./eip-5568.md) specifies `The instruction_id of an instruction defined by an ERC MUST be its ERC number unless there are exceptional circumstances (be reasonable)`
- [ERC-6120](./eip-6120.md) specifies `struct Token { uint eip; ..., }` where `uint eip` is an ERC number to identify ERCs.
- [ERC-867](./eip-867.md) (Stagnant) proposes creating an `erpId`, described as a string identifier for that ERP, likely based on the associated ERC number.

3. Having an ERC/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.

4. 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.

## Specification

In the following description, we use ERC and ERC interchangeably. 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&apos;t recognized as ERCs but has behavior that&apos;s worthy of a query.

1. Any compliant smart contract MUST implement the following interface

```solidity
// DRAFTv1
pragma solidity ^0.8.9;

interface IERC5269 {
  event OnSupportERC(
      address indexed caller, // when emitted with `address(0x0)` means all callers.
      uint256 indexed majorERCIdentifier,
      bytes32 indexed minorERCIdentifier, // 0 means the entire ERC
      bytes32 ercStatus,
      bytes extraData
  );

  /// @dev The core method of ERC Interface Detection
  /// @param caller, a `address` value of the address of a caller being queried whether the given ERC is supported.
  /// @param majorERCIdentifier, 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&apos;s choice or for future ERCs to specify.
  /// @param minorERCIdentifier, a `bytes32` value reserved for authors of individual ERC to specify. For example the author of [ERC-721](/ERCS/eip-721) MAY specify `keccak256(&quot;ERC721Metadata&quot;)` or `keccak256(&quot;ERC721Metadata.tokenURI&quot;)` as `minorERCIdentifier` to be queried for support. Author could also use this minorERCIdentifier to specify different versions, such as ERC-712 has its V1-V4 with different behavior.
  /// @param extraData, a `bytes` for [ERC-5750](/ERCS/eip-5750) for future extensions.
  /// @return ercStatus, a `bytes32` indicating the status of ERC the contract supports.
  ///                    - For FINAL ERCs, it MUST return `keccak256(&quot;FINAL&quot;)`.
  ///                    - For non-FINAL ERCs, it SHOULD return `keccak256(&quot;DRAFT&quot;)`.
  ///                      During ERC procedure, ERC authors are allowed to specify their own
  ///                      ercStatus other than `FINAL` or `DRAFT` at their discretion such as `keccak256(&quot;DRAFTv1&quot;)`
  ///                      or `keccak256(&quot;DRAFT-option1&quot;)`and such value of ercStatus MUST be documented in the ERC body
  function supportERC(
    address caller,
    uint256 majorERCIdentifier,
    bytes32 minorERCIdentifier,
    bytes calldata extraData)
  external view returns (bytes32 ercStatus);
}
```

In the following description, `ERC_5269_STATUS` is set to be `keccak256(&quot;DRAFTv1&quot;)`.

In addition to the behavior specified in the comments of `IERC5269`:

1. Any `minorERCIdentifier=0` is reserved to be referring to the main behavior of the ERC being queried.
2. The Author of compliant ERC is RECOMMENDED to declare a list of `minorERCIdentifier` for their optional interfaces, behaviors and value range for future extension.
3. When this ERC is FINAL, any compliant contract MUST return an `ERC_5269_STATUS` for the call of `supportERC((any caller), 5269, 0, [])`

*Note*: at the current snapshot, the `supportERC((any caller), 5269, 0, [])` MUST return `ERC_5269_STATUS`.

4. Any complying contract SHOULD emit an `OnSupportERC(address(0), 5269, 0, ERC_5269_STATUS, [])` event upon construction or upgrade.
5. Any complying contract MAY declare for easy discovery any ERC main behavior or sub-behaviors by emitting an event of `OnSupportERC` with relevant values and when the compliant contract changes whether the support an ERC or certain behavior for a certain caller or all callers.
6. For any `ERC-XXX` that is NOT in `Final` status, when querying the `supportERC((any caller), xxx, (any minor identifier), [])`, it MUST NOT return `keccak256(&quot;FINAL&quot;)`. It is RECOMMENDED to return `0` in this case but other values of `ercStatus` is allowed. Caller MUST treat any returned value other than `keccak256(&quot;FINAL&quot;)` as non-final, and MUST treat 0 as strictly &quot;not supported&quot;.
7. The function `supportERC` MUST be mutability `view`, i.e. it MUST NOT mutate any global state of EVM.

## Rationale

1. When data type `uint256 majorERCIdentifier`, there are other alternative options such as:

- (1) using a hashed version of the ERC number,
- (2) use a raw number, or
- (3) use an ERC-165 identifier.

The pros for (1) are that it automatically supports any evolvement of future ERC numbering/naming conventions.
But the cons are it&apos;s not backward readable: seeing a `hash(ERC-number)` one usually can&apos;t easily guess what their ERC number is.

We choose the (2) in the rationale laid out in motivation.

2. We have a `bytes32 minorERCIdentifier` 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 `bytes32` 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.

3. Alternatively, it&apos;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.

4. Compared to [ERC-165](./eip-165.md), we also add an additional input of `address caller`, given the increasing popularity of proxy patterns such as those enabled by [ERC-1967](./eip-1967.md). One may ask: why not simply use `msg.sender`? This is because we want to allow query them without transaction or a proxy contract to query whether interface ERC-`number` will be available to that particular sender.

1. We reserve the input `majorERCIdentifier` greater than or equals `2^32` in case we need to support other collections of standards which is not an ERC/ERC.

## Test Cases

```typescript

describe(&quot;ERC5269&quot;, function () {
  async function deployFixture() {
    // ...
  }

  describe(&quot;Deployment&quot;, function () {
    // ...
    it(&quot;Should emit proper OnSupportERC events&quot;, async function () {
      let { txDeployErc721 } = await loadFixture(deployFixture);
      let events = txDeployErc721.events?.filter(event =&gt; event.event === &apos;OnSupportERC&apos;);
      expect(events).to.have.lengthOf(4);

      let ev5269 = events!.filter(
        (event) =&gt; event.args!.majorERCIdentifier.eq(5269));
      expect(ev5269).to.have.lengthOf(1);
      expect(ev5269[0].args!.caller).to.equal(BigNumber.from(0));
      expect(ev5269[0].args!.minorERCIdentifier).to.equal(BigNumber.from(0));
      expect(ev5269[0].args!.ercStatus).to.equal(ethers.utils.id(&quot;DRAFTv1&quot;));

      let ev721 = events!.filter(
        (event) =&gt; event.args!.majorERCIdentifier.eq(721));
      expect(ev721).to.have.lengthOf(3);
      expect(ev721[0].args!.caller).to.equal(BigNumber.from(0));
      expect(ev721[0].args!.minorERCIdentifier).to.equal(BigNumber.from(0));
      expect(ev721[0].args!.ercStatus).to.equal(ethers.utils.id(&quot;FINAL&quot;));

      expect(ev721[1].args!.caller).to.equal(BigNumber.from(0));
      expect(ev721[1].args!.minorERCIdentifier).to.equal(ethers.utils.id(&quot;ERC721Metadata&quot;));
      expect(ev721[1].args!.ercStatus).to.equal(ethers.utils.id(&quot;FINAL&quot;));

      // ...
    });

    it(&quot;Should return proper ercStatus value when called supportERC() for declared supported ERC/features&quot;, async function () {
      let { erc721ForTesting, owner } = await loadFixture(deployFixture);
      expect(await erc721ForTesting.supportERC(owner.address, 5269, ethers.utils.hexZeroPad(&quot;0x00&quot;, 32), [])).to.equal(ethers.utils.id(&quot;DRAFTv1&quot;));
      expect(await erc721ForTesting.supportERC(owner.address, 721, ethers.utils.hexZeroPad(&quot;0x00&quot;, 32), [])).to.equal(ethers.utils.id(&quot;FINAL&quot;));
      expect(await erc721ForTesting.supportERC(owner.address, 721, ethers.utils.id(&quot;ERC721Metadata&quot;), [])).to.equal(ethers.utils.id(&quot;FINAL&quot;));
      // ...

      expect(await erc721ForTesting.supportERC(owner.address, 721, ethers.utils.id(&quot;WRONG FEATURE&quot;), [])).to.equal(BigNumber.from(0));
      expect(await erc721ForTesting.supportERC(owner.address, 9999, ethers.utils.hexZeroPad(&quot;0x00&quot;, 32), [])).to.equal(BigNumber.from(0));
    });

    it(&quot;Should return zero as ercStatus value when called supportERC() for non declared ERC/features&quot;, async function () {
      let { erc721ForTesting, owner } = await loadFixture(deployFixture);
      expect(await erc721ForTesting.supportERC(owner.address, 721, ethers.utils.id(&quot;WRONG FEATURE&quot;), [])).to.equal(BigNumber.from(0));
      expect(await erc721ForTesting.supportERC(owner.address, 9999, ethers.utils.hexZeroPad(&quot;0x00&quot;, 32), [])).to.equal(BigNumber.from(0));
    });
  });
});
```

See [`TestERC5269.ts`](../assets/eip-5269/test/TestERC5269.ts).

## Reference Implementation

Here is a reference implementation for this ERC:

```solidity
contract ERC5269 is IERC5269 {
    bytes32 constant public ERC_STATUS = keccak256(&quot;DRAFTv1&quot;);
    constructor () {
        emit OnSupportERC(address(0x0), 5269, bytes32(0), ERC_STATUS, &quot;&quot;);
    }

    function _supportERC(
        address /*caller*/,
        uint256 majorERCIdentifier,
        bytes32 minorERCIdentifier,
        bytes calldata /*extraData*/)
    internal virtual view returns (bytes32 ercStatus) {
        if (majorERCIdentifier == 5269) {
            if (minorERCIdentifier == bytes32(0)) {
                return ERC_STATUS;
            }
        }
        return bytes32(0);
    }

    function supportERC(
        address caller,
        uint256 majorERCIdentifier,
        bytes32 minorERCIdentifier,
        bytes calldata extraData)
    external virtual view returns (bytes32 ercStatus) {
        return _supportERC(caller, majorERCIdentifier, minorERCIdentifier, extraData);
    }
}
```

See [`ERC5269.sol`](../assets/eip-5269/contracts/ERC5269.sol).

Here is an example where a contract of [ERC-721](./eip-721.md) also implements this ERC to make it easier
to detect and discover:

```solidity
import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;../ERC5269.sol&quot;;
contract ERC721ForTesting is ERC721, ERC5269 {

    bytes32 constant public ERC_FINAL = keccak256(&quot;FINAL&quot;);
    constructor() ERC721(&quot;ERC721ForTesting&quot;, &quot;E721FT&quot;) ERC5269() {
        _mint(msg.sender, 0);
        emit OnSupportERC(address(0x0), 721, bytes32(0), ERC_FINAL, &quot;&quot;);
        emit OnSupportERC(address(0x0), 721, keccak256(&quot;ERC721Metadata&quot;), ERC_FINAL, &quot;&quot;);
        emit OnSupportERC(address(0x0), 721, keccak256(&quot;ERC721Enumerable&quot;), ERC_FINAL, &quot;&quot;);
    }

  function supportERC(
    address caller,
    uint256 majorERCIdentifier,
    bytes32 minorERCIdentifier,
    bytes calldata extraData)
  external
  override
  view
  returns (bytes32 ercStatus) {
    if (majorERCIdentifier == 721) {
      if (minorERCIdentifier == 0) {
        return keccak256(&quot;FINAL&quot;);
      } else if (minorERCIdentifier == keccak256(&quot;ERC721Metadata&quot;)) {
        return keccak256(&quot;FINAL&quot;);
      } else if (minorERCIdentifier == keccak256(&quot;ERC721Enumerable&quot;)) {
        return keccak256(&quot;FINAL&quot;);
      }
    }
    return super._supportERC(caller, majorERCIdentifier, minorERCIdentifier, extraData);
  }
}

```

See [`ERC721ForTesting.sol`](../assets/eip-5269/contracts/testing/ERC721ForTesting.sol).

## Security Considerations

Similar to [ERC-165](./eip-165.md) callers of the interface MUST assume the smart contract
declaring they support such ERC interfaces doesn&apos;t necessarily correctly support them.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 15 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5269</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5269</guid>
      </item>
    
      <item>
        <title>Ethereum Notary Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/pr-5289-discussion-notary-interface/9980</comments>
        
        <description>## Abstract

Currently, the real-world applications of smart contracts are limited by the fact that they aren&apos;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.

Please note that the authors are not lawyers, and that this EIP is not legal advice.

## Motivation

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).

## Specification

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.

### Legal Contract Library Interface

```solidity
/// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

import &quot;./IERC165.sol&quot;;

interface IERC5289Library is IERC165 {
    /// @notice Emitted when signDocument is called
    event DocumentSigned(address indexed signer, uint16 indexed documentId);
    
    /// @notice 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.
    function legalDocument(uint16 documentId) external view returns (string memory);
    
    /// @notice Returns whether or not the given user signed the document.
    function documentSigned(address user, uint16 documentId) external view returns (bool signed);

    /// @notice Returns when the given user signed the document.
    /// @dev If the user has not signed the document, the timestamp may be anything.
    function documentSignedAt(address user, uint16 documentId) external view returns (uint64 timestamp);

    /// @notice Sign a document
    /// @dev This MUST be validated by the smart contract. This MUST emit DocumentSigned or throw.
    function signDocument(address signer, uint16 documentId) external;
}
```

### Requesting a Signature

To request that certain documents be signed, revert with an [ERC-5568](./eip-5568.md) signal. The format of the `instruction_data` is an ABI-encoded `(address, uint16)` pair, where the address is the address of the library, and the `uint16` is the `documentId` of the document:

```solidity
throw WalletSignal24(0, 5289, abi.encode(0xcbd99eb81b2d8ca256bb6a5b0ef7db86489778a7, 12345));
```

### Signing a Document

When a signature is requested, wallets MUST call `legalDocument`, display the resulting document to the user, and prompt them to either sign the document or cancel:

![image](../assets/eip-5289/example-popup.png)

If the user agrees, the wallet MUST call `signDocument`.

## Rationale

- `uint64` was chosen for the timestamp return type as 64-bit time registers are standard.
- `uint16` was chosen for the document ID as 65536 documents are likely sufficient for any use case, and the contract can always be re-deployed.
- `signDocument` doesn&apos;t take an ECDSA signature for future compatibility with account abstraction. In addition, future extensions can supply this functionality.
- IPFS is mandatory because the authenticity of the signed document can be proven.

## Backwards Compatibility

No backwards compatibility issues found.

## Reference Implementation

### Legal Contract Library

See [`IERC5289Library`](../assets/eip-5289/interfaces/IERC5289Library.sol), [`ERC5289Library`](../assets/eip-5289/ERC5289Library.sol).

## Security Considerations

Users can claim that their private key was stolen and used to fraudulently &quot;sign&quot; contracts. As such, **documents must only be permissive in nature, not restrictive.** 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 16 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5289</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5289</guid>
      </item>
    
      <item>
        <title>ENS Trust to hold NFTs under ENS name</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-eip-5198-ens-as-token-holder/10374</comments>
        
        <description>## Abstract

This EIP standardizes an interface for smart contracts to hold [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md) tokens on behalf of ENS domains.

## Motivation

Currently, if someone wants to receive a token, they have to set up a wallet address. This EIP decouples NFT ownership from wallet addresses.

## Specification

1. Compliant contracts MUST implement `ERC721TokenReceiver`, as defined in [EIP-721](./eip-721.md).
2. Compliant contracts implement the following interface:

```solidity
interface IERC_ENS_TRUST is ERC721Receiver, ERC1155Receiver {
    function claimTo(address to, bytes32 ensNode, address operator, uint256 tokenId) payable external;
}
```

3. `claimTo` MUST check if `msg.sender` is the owner of the ENS node identified by `bytes32 ensNode` (and/or approved by the domain in implementation-specific ways). The compliant contract then MUST make a call to the `safeTransferFrom` function of [EIP-721](./eip-712.md) or [EIP-1155](./eip-1155.md).

4. Any `ensNode` is allowed.

## Rationale

1. ENS was chosen because it is a well-established scoped ownership namespace.
This is nonetheless compatible with other scoped ownership namespaces.

2. We didn&apos;t expose getters or setters for ensRoot because it is outside the scope of this EIP.

## Backwards Compatibility

No backward compatibility issues were found.

## Test Cases

```ts
import { loadFixture } from &quot;@nomicfoundation/hardhat-network-helpers&quot;;
import { expect } from &quot;chai&quot;;
import { ethers } from &quot;hardhat&quot;;

describe(&quot;FirstENSBankAndTrust&quot;, function () {

    describe(&quot;Receive and Claim Token&quot;, function () {

        it(&quot;Should ACCEPT/REJECT claimTo based on if ENS owner is msg.sender&quot;, async function () {
            ...
            // Steps of testing:
            // mint to charlie
            // charlie send to ENSTrust and recorded under bob.xinbenlvethsf.eth
            // bob tries to claimTo alice, first time it should be rejected
            // bob then set the ENS record
            // bob claim to alice, second time it should be accepted

            // mint to charlie
            await erc721ForTesting.mint(charlie.address, fakeTokenId);

            // charlie send to ENSTrust and recorded under bob.xinbenlvethsf.eth
            await erc721ForTesting.connect(charlie)[&quot;safeTransferFrom(address,address,uint256,bytes)&quot;](
                charlie.address, firstENSBankAndTrust.address,
                fakeTokenId,
                fakeReceiverENSNamehash
            );

            // bob tries to claimTo alice, first time it should be rejected
            await expect(firstENSBankAndTrust.connect(bob).claimTo(
                alice.address,
                fakeReceiverENSNamehash,
                firstENSBankAndTrust.address,
                fakeTokenId
                ))
                .to.be.rejectedWith(&quot;ENSTokenHolder: node not owned by sender&quot;);

            // bob then set the ENS record
            await ensForTesting.setOwner(
                fakeReceiverENSNamehash, bob.address
            );

            // bob claim to alice, second time it should be accepted
            await expect(firstENSBankAndTrust.connect(bob).claimTo(
                alice.address,
                fakeReceiverENSNamehash,
                erc721ForTesting.address,
                fakeTokenId
            ));
        });
    });
});
```

## Reference Implementation

```solidity
pragma solidity ^0.8.9;

contract FirstENSBankAndTrust is IERC721Receiver, Ownable {
    function getENS() public view returns (ENS) {
        return ENS(ensAddress);
    }

    function setENS(address newENSAddress) public onlyOwner {
        ensAddress = newENSAddress;
    }

    // @dev This function is called by the owner of the token to approve the transfer of the token
    // @param data MUST BE the ENS node of the intended token receiver this ENSHoldingServiceForNFT is holding on behalf of.
    function onERC721Received(
        address operator,
        address /*from*/,
        uint256 tokenId,
        bytes calldata data
    ) external override returns (bytes4) {
        require(data.length == 32, &quot;ENSTokenHolder: last data field must be ENS node.&quot;);
        // --- START WARNING ---
        // DO NOT USE THIS IN PROD
        // this is only a demonstration of using extraData for node information
        // In prod, you should use a struct to store the data. struct should clearly identify the data is for ENS
        // rather than anything else.
        bytes32 ensNode = bytes32(data[0:32]);
        // --- END OF WARNING ---

        addToHolding(ensNode, operator, tokenId); // conduct the book keeping
        return ERC721_RECEIVER_MAGICWORD;
    }

    function claimTo(address to, bytes32 ensNode, address tokenContract uint256 tokenId) public {
        require(getENS().owner(ensNode) == msg.sender, &quot;ENSTokenHolder: node not owned by sender&quot;);
        removeFromHolding(ensNode, tokenContract, tokenId);
        IERC721(tokenContract).safeTransferFrom(address(this), to, tokenId);
    }
}
```

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 12 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5298</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5298</guid>
      </item>
    
      <item>
        <title>Light Contract Ownership</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5313-light-contract-ownership/10052</comments>
        
        <description>## Abstract

This specification defines the minimum interface required to identify an account that controls a contract.

## Motivation

This is a slimmed-down alternative to [EIP-173](./eip-173.md).

## Specification

The key word “MUST” in this document is to be interpreted as described in RFC 2119.

Every contract compliant with this EIP MUST implement the `EIP5313` interface.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.15;

/// @title EIP-5313 Light Contract Ownership Standard
interface EIP5313 {
    /// @notice Get the address of the owner    
    /// @return The address of the owner
    function owner() view external returns(address);
}
```

## Rationale

Key factors influencing the standard: 

- Minimize the number of functions in the interface
- Backwards compatibility with existing contracts

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;.

Implementing [EIP-165](./eip-165.md) 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).

## Backwards Compatibility

Every contract that implements EIP-173 already implements this specification.

## Security Considerations

Because this specification does not extend EIP-165, calling this EIP&apos;s `owner` 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 22 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5313</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5313</guid>
      </item>
    
      <item>
        <title>EIP-721 User And Expires And Level Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-721-user-and-expires-and-level-extension/10097</comments>
        
        <description>## Abstract

An [EIP-721](./eip-721.md) extension that adds an additional role (`user`) which can be granted to addresses, and a time where the role is automatically revoked (`expires`) and (`level`) . The `user` role represents permission to &quot;use&quot; the NFT, but not the ability to transfer it or set users.

## Motivation

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.

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.

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.

Here are some of the problems that are solved by this standard:

### Clear Rights Assignment

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.

### Simple On-chain Time Management

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 `expires` function, there is no need for another transaction because the “user” is invalidated automatically after the duration is over.

### Easy Third-Party Integration

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 `user` role and `expires` and `level`, 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.

## Specification

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.

### Contract Interface
Solidity Interface with NatSpec &amp; OpenZeppelin v4 Interfaces (also available at [`IERC5334.sol`](../assets/eip-5334/IERC5334.sol)):

```solidity
interface IERC5334 {

    // Logged when the user of a NFT, expires, or level is changed
    /// @notice Emitted when the `user` of an NFT or the `expires` of the `user` is changed or the user `level` is changed
    /// The zero address for user indicates that there is no user address
    event UpdateUser(uint256 indexed tokenId, address indexed user, uint64 expires, uint8 level);

    /// @notice set the user and expires and level of a NFT
    /// @dev The zero address indicates there is no user
    /// Throws if `tokenId` is not valid NFT
    /// @param user  The new user of the NFT
    /// @param expires  UNIX timestamp, The new user could use the NFT before expires
    /// @param level user level
    function setUser(uint256 tokenId, address user, uint64 expires, uint8 level) external;

    /// @notice Get the user address of an NFT
    /// @dev The zero address indicates that there is no user or the user is expired
    /// @param tokenId The NFT to get the user address for
    /// @return The user address for this NFT
    function userOf(uint256 tokenId) external view returns(address);

    /// @notice Get the user expires of an NFT
    /// @dev The zero value indicates that there is no user
    /// @param tokenId The NFT to get the user expires for
    /// @return The user expires for this NFT
    function userExpires(uint256 tokenId) external view returns(uint256);

    /// @notice Get the user level of an NFT
    /// @dev The zero value indicates that there is no user
    /// @param tokenId The NFT to get the user level for
    /// @return The user level for this NFT
    function userLevel(uint256 tokenId) external view returns(uint256);
}
```

The `userOf(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `userExpires(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `userLevel(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `setUser(uint256 tokenId, address user, uint64 expires)` function MAY be implemented as `public` or `external`.

The `UpdateUser` event MUST be emitted when a user address is changed or the user expires is changed or the user level is changed.

&lt;!-- The `supportsInterface` method MUST return `true` when called with `0xTODO`. --&gt;

## Rationale

TBD

## Backwards Compatibility

As mentioned in the specifications section, this standard can be fully EIP-721 compatible by adding an extension function set.

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.

## Reference Implementation
A reference implementation of this standard can be found in the assets folder.
&lt;!-- [../assets/EIP-5334/ERC5334.sol](../assets/EIP-5334/ERC5334.sol). --&gt;

## Security Considerations

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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Mon, 25 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5334</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5334</guid>
      </item>
    
      <item>
        <title>NFT Author Information and Consent</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5375-nft-authorship/10182</comments>
        
        <description>## Abstract

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 _authorship consent_: proofs that the authors have agreed to be named as authors. Note that a proof of authorship _consent_ is not a proof of authorship: an address can consent without having authored the NFT.

## Motivation

There is currently no standard to identify authors of an NFT, and existing techniques have issues:

- Using the mint `tx.origin` or `msg.sender`
  - Assumes that the minter and the author are the same
  - Does not support multiple authors
- Using the first Transfer event for a given ID
  - Contract/minter can claim that someone else is the author without their consent
  - Does not support multiple authors
- Using a custom method/custom JSON field
  - Requires per-contract support by NFT platforms
  - Contract/minter can claim that someone else is the author without their consent

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:

- NFTs minted by a contract
- Lazy minting
- NFTs minted by an intermediary (which can be particularly useful when the author is not tech-savvy and/or the minting process is convoluted)

This document thus defines a standard which allows the minter to provide authorship information, while also preventing authorship claims without the author&apos;s consent.

## Specification

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.

All addresses used in this standard MUST follow the casing rules described in [EIP-55](./eip-55.md).

### Definitions

- **Authors**: creators of an NFT
- **Minter**: entity responsible for the actual minting transaction; the minter and the authors MAY be the same
- **Verifier**: entity that wants to verify the authorship of an NFT (e.g. a user or an NFT marketplace)
- **Author Consent Proof (ACP)**: a signed message that proves that the signer agrees to be considered the author of the NFT

### Authorship Support

The standard introduces a new JSON field, named `authorInfo`. It provides a REQUIRED interface for authorship claiming, as well as an OPTIONAL interface for author consent proofs.

`authorInfo` is a top-level field of the NFT metadata. Specifically:

- If a contract supports the metadata extension for [EIP-721](./eip-721.md), the JSON document pointed by `tokenURI(uint256 _tokenId)` MUST include the top-level field `authorInfo`
- If a contract supports the metadata extension for [EIP-1155](./eip-1155.md), the JSON document pointed by `uri(uint256 _id)` MUST include a top-level field `authorInfo`

The JSON schema of `authorInfo` (named `ERC5375AuthorInfoSchema`) is defined as follows:

```json
{
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;consentInfo&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;description&quot;: &quot;Helper fields for consent verification&quot;,
            &quot;properties&quot;: {
                &quot;chainId&quot;: {
                    &quot;type&quot;: &quot;integer&quot;,
                    &quot;description&quot;: &quot;EIP-155 chain id&quot;
                },
                &quot;id&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;NFT id&quot;
                },
                &quot;contractAddress&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;0x-prefixed address of the smart contract&quot;
                }
            }
        },
        &quot;authors&quot;: {
            &quot;type&quot;: &quot;array&quot;,
            &quot;items&quot;: &quot;ERC5375AuthorSchema&quot;
        }
    },
    &quot;required&quot;: [ &quot;authors&quot; ]
}
```

Note that `authors` MAY be an empty array.

`ERC5375AuthorSchema` is defined as follows:

```json
{
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;address&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;0x-prefixed address of the author&quot;
        },
        &quot;consent&quot;: {
            &quot;type&quot;: &quot;ERC5375AuthorConsentSchema&quot;,
            &quot;description&quot;: &quot;Author consent information&quot;
        }
    },
    &quot;required&quot;: [ &quot;address&quot; ]
}
```

Moreover, if the `consent` field is present, the `consentInfo` field of `authorInfo` MUST be present.

`ERC5375AuthorConsentSchema` is defined as follows:

```json
{
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;consentData&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;properties&quot;: {
                &quot;version&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;NFT authorship consent schema version&quot;
                },
                &quot;issuer&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;0x-prefixed address of the author&quot;
                },
                &quot;metadataFields&quot;: {
                    &quot;type&quot;: &quot;object&quot;
                }
            },
            &quot;required&quot;: [&quot;version&quot;, &quot;issuer&quot;, &quot;metadataFields&quot;]
        },
        &quot;publicKey&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;EVM public key of the author&quot;
        },
        &quot;signature&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;EIP-712 signature of the consent message&quot;
        }
    },
    &quot;required&quot;: [&quot;consentData&quot;, &quot;publicKey&quot;, &quot;signature&quot;]
}
```

where `metadataFields` is an object containing the JSON top-level fields (excluding `authorInfo`) that the author will certify. Note that the keys of `metadataFields` MAY be a (potentially empty) subset of the set of fields.

`consentData` MAY support additional fields as defined by other EIPs. `consentData` MUST contain all the information (which is not already present in other fields) required to verify the validity of an authorship consent proof.

### Author Consent

Consent is obtained by signing an [EIP-712](./eip-712.md) compatible message. Specifically, the structure is defined as follows:

```solidity
struct Author {
    address subject;
    uint256 tokenId;
    string metadata;
}
```

where `subject` is the address of the NFT contract, `tokenId` is the id of the NFT and `metadata` is the JSON encoding of the fields listed in `metadataFields`. `metadata`:

- MUST contain exactly the same fields as the ones listed in `metadataFields`, in the same order
- MUST escape all non-ASCII characters. If the escaped character contains hexadecimal letters, they MUST be uppercase
- MUST not contain any whitespace that is not part of a field name or value

For example, if the top-level JSON fields are:

```json
{
    &quot;name&quot;: &quot;The Holy Hand Grenade of Antioch&quot;,
    &quot;description&quot;: &quot;Throw in the general direction of your favorite rabbit, et voilà&quot;,
    &quot;damage&quot;: 500,
    &quot;authors&quot;: [...],
    ...
}
```

and the content of `metadataFields` is `[&quot;name&quot;, &quot;description&quot;]`, the content of `metadata` is:

```json
{
    &quot;name&quot;: &quot;The Holy Hand Grenade of Antioch&quot;,
    &quot;description&quot;: &quot;Throw in the general direction of your favorite rabbit, et voil\u00E0&quot;
}
```

Similarly to `consentData`, this structure MAY support additional fields as defined by other EIPs.

The domain separator structure is

```solidity
struct EIP712Domain {
    string name;
    string version;
    uint256 chainId;
}
```

where `name` and `version` are the same fields described in `consentData`

This structure MAY support additional fields as defined by other EIPs.

### Author Consent Verification

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:

- D1 has a top-level `authorInfo` field that matches `ERC5375AuthorInfoSchema`
- `consent` exists and matches `ERC5375AuthorConsentSchema`;
- If calling `tokenURI` (for EIP-721) or `uri` (for EIP-1155) returns the URI of a JSON document D2, all the top-level fields listed in `metadataFields` MUST exist and have the same value;
- The EIP-712 signature in `signature` (computed using the fields specified in the JSON document) is valid;

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.

## Rationale

### Why provide only an author consent proof?

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;.

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&apos;, and rightfully claim to be the author of Y&apos;, 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.

Note that this issue is also present when using the minter&apos;s address as a proxy for the author.

### Why off-chain?

There are three reasons:

- Adding off-chain support does not require modifications to existing smart contracts;
- Off-chain storage is usually much cheaper than on-chain storage, thus reducing the implementation barrier;
- 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.

### Why repeat id, chainId and contractAddress?

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.

### Why not implement a revocation system?

Authorship is usually final: either someone created an NFT or they didn&apos;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.

#### Why escape non-ASCII characters in the signature message?

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.

### Usability Improvements for Authors

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&apos;s wallet. Specifically, the author only needs to:

- Obtain an EVM wallet;
- Learn how to read and sign a EIP-712 message (which can often be simplified by using a Dapp)

without needing to:

- Obtain the chain&apos;s native token (e.g. through trading or bridging);
- Sign a transaction;
- Understand the pricing mechanism of transactions;
- Verify if a transaction has been included in a block

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.

### Limitations of Address-Based Consent

The standard defines a protocol to verify that a certain _address_ provided consent. However, it does not guarantee that the address corresponds to the expected author (such as the one provided in the `name` field). Proving a link between an address and the entity behind it is beyond the scope of this document.

## Backwards Compatibility

No backward compatibility issues were found.

## Security Considerations

### Attacks

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.

A more subtle approach involves not adding important fields to `metadataFields`. By doing so, the author signature might be valid even if the minter changes critical information.

### Deprecated Features

`ERC5375AuthorInfoSchema` 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.:

- Alice mints an NFT using Bob&apos;s name and Alice&apos;s address
- Charlie does not check the address and instead relies on the provided name
- Charlie buys Alice&apos;s NFT while believing that it was created by Bob

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 _author&apos;s address_, instead of with the NFT itself.

### Replay Attack Resistance

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).

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 30 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5375</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5375</guid>
      </item>
    
      <item>
        <title>ERC-721 Entitlement Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/pr-5380-eip-4907-alternative-design/10190</comments>
        
        <description>## Abstract

This EIP proposes a new interface that allows [ERC-721](./eip-721.md) token owners to grant limited usage of those tokens to other addresses.

## Motivation

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. 

## Specification

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.

### Base

Compliant entitlement contracts MUST implement the following Solidity interface:

```solidity
/// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface ERC5380Entitlement is ERC165 {
    /// @notice Emitted when the amount of entitlement a user has changes. If user is the zero address, then the user is the owner
    event EntitlementChanged(address indexed user, address indexed contract, uint256 indexed tokenId);

    /// @notice             Set the user associated with the given ERC-721 token as long as the owner is msg.sender.
    /// @dev                SHOULD NOT revert if the owner is not msg.sender.
    /// @param  user        The user to grant the entitlement to
    /// @param  contract    The property to grant
    /// @param  tokenId     The tokenId to grant the properties of
    function entitle(address user, address contract, uint256 tokenId) external;

    /// @notice             Get the maximum number of users that can receive this entitlement
    /// @param  contract    The contract to query
    /// @param  tokenId     The tokenId to query
    function maxEntitlements(address contract, uint256 tokenId) external view (uint256 max);

    /// @notice             Get the user associated with the given contract and tokenId.
    /// @dev                Defaults to maxEntitlements(contract, tokenId) assigned to contract.ownerOf(tokenId)
    /// @param  user        The user to query
    /// @param  contract    The contract to query
    /// @param  tokenId     The tokenId to query
    function entitlementOf(address user, address contract, uint256 tokenId) external view returns (uint256 amt);
}
```

`supportsInterface` MUST return true when called with `ERC5380Entitlement`&apos;s interface ID.

### Enumerable Extension

This OPTIONAL Solidity interface is RECOMMENDED.

```solidity
/// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface ERC5380EntitlementEnumerable is ERC5380Entitlement { // Also implicitly supports ERC-165
    /// @notice         Enumerate tokens with nonzero entitlement assigned to a user
    /// @dev            Throws if the index is out of bounds or if user == address(0)
    /// @param  user    The user to query
    /// @param  index   A counter
    function entitlementOfUserByIndex(address user, uint256 index) external view returns (address contract, uint256 tokenId);
}
```

`supportsInterface` MUST return true when called with `ERC5380EntitlementEnumerable`&apos;s interface ID.

### Metadata Extension

This OPTIONAL Solidity interface is RECOMMENDED.

This extension uses [ERC-1046](./eip-1046.md) for `tokenURI` compatibility.

```solidity
/// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface ERC5380EntitlementMetadata is ERC5380Entitlement { // Also implicitly supports ERC-165
    /// @notice             ERC-1046 token URI
    /// @dev                See ERC-1046 and the metadata schema below
    function tokenURI() external view returns (string);
}
```

`supportsInterface` MUST return true when called with `ERC5380EntitlementMetadata`&apos;s interface ID.

#### Interoperability Metadata Extension

ERC-1046&apos;s `InteroperabilityMetadata` is extended with the following TypeScript interface:

```typescript
/**
 * ERC-5380&apos;s extension to ERC-1046&apos;s Interoperability metadata.
 */
interface ERC5380InteroperabilityMetadata is InteroperabilityMetadata {
    /**
     * This MUST be true if this is ERC-5380 Token Metadata, otherwise, this MUST be omitted.
     * Setting this to true indicates to wallets that the address should be treated as an ERC-5380 entitlement.
     **/
    erc5380?: boolean | undefined;
}
```

#### `tokenURI` Metadata Schema

The resolved `tokenURI` data MUST conform to the following TypeScript interface:

```typescript
/**
 * ERC-5380 Asset Metadata
 * Can be extended
 */
interface ERC5380TokenMetadata {
    /**
     * Interoperabiliy, to differentiate between different types of tokens and their corresponding URIs.
     **/
    interop: ERC5380InteroperabilityMetadata;
    
    /**
     * The name of the ERC-5380 token. 
     */
    name?: string;
    
    /**
     * The symbol of the ERC-5380 token. 
     */
    symbol?: string;
    
    /**
     * Provides a short one-paragraph description of the ERC-5380 token, without any markup or newlines.
     */
    description?: string;
    
    /**
     * One or more URIs each pointing to a resource with mime type `image/*` that represents this token.
     * If an image is a bitmap, it SHOULD have a width between 320 and 1080 pixels
     * Images SHOULD have an aspect ratio between 1.91:1 and 4:5 inclusive.
     */
    images?: string[];
    
    /**
     * One or more URIs each pointing to a resource with mime type `image/*` that represent an icon for this token.
     * 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
     * Images MUST have an aspect ratio of 1:1, and use a transparent background
     */
    icons?: string[];
}
```

## Rationale

[ERC-20](./eip-20.md) and [ERC-1155](./eip-1155.md) are unsupported as partial ownership is much more complex to track than boolean ownership.

## Backwards Compatibility

No backward compatibility issues were found.

## Security Considerations

The security considerations of [ERC-721](./eip-721.md) and [ERC-1046](./eip-1046.md) apply.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 11 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5380</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5380</guid>
      </item>
    
      <item>
        <title>EIP-1155 Non-Fungible Token extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5409-non-fungible-token-extension-for-eip-1155/10240</comments>
        
        <description>## Abstract

This standard is an extension of [EIP-1155](./eip-1155.md). It proposes an additional function, `ownerOf`, which allows EIP-1155 tokens to support Non-Fungibility (unique owners). By implementing this extra function, EIP-1155 tokens can benefit from [EIP-721](./eip-721.md)&apos;s core functionality without implementing the (less efficient) EIP-721 specification in the same contract.

## Motivation

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.

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&apos;s `ownerOf`.

The ability to get the owner of a token enables novel use-cases, including the ability for the owner to associate data with it.

## Specification

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.

### Contract Interface

```solidity
interface IERC1155OwnerOf {

    /// @notice Find the owner of an NFT
    /// @dev 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)
    /// @param tokenId The identifier for an NFT
    /// @return The address of the owner of the NFT
    function ownerOf(uint256 tokenId) external view returns (address);
}
```

The `ownerOf(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `supportsInterface` method MUST return `true` when called with `0x6352211e`.

## Rationale

`ownerOf` 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.

## Backwards Compatibility

This EIP is fully backward compatible with EIP-1155.

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 23 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5409</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5409</guid>
      </item>
    
      <item>
        <title>Security Contact Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-interface-for-security-contract/10303</comments>
        
        <description>## Abstract
An interface for security notice using asymmetric encryption. The interface exposes an asymmetric encryption key and a destination of delivery.

## Motivation
Currently there is no consistent way to specify an official channel for security researchers to report security issues to smart contract maintainers.

## Specification
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.

```solidity
interface IEIP5437 {

    /// REQUIRED
    function getSecurityContact(uint8 type, bytes memory data) public view
    returns (
        uint8 type,
        bytes memory publicKey,
        bytes memory extraData
    );

    /// OPTIONAL
    // TODO consider remove if not needed before finalized
    function setSecurityContact(
        uint8 type,
        bytes memory publicKey,
        bytes memory extraData) public;
    event SecurityContactChanged(uint8 type, bytes memory publicKeyForEncryption, bytes memory extraData);

    /// OPTIONAL
    function securityNotify(uint8 type, bytes memory data) public payable;
    /// OPTIONAL
    event OnSecurityNotification(uint8 type, bytes memory sourceData, uint256 value);

    /// OPTIONAL
    // TODO consider to make it a separate EIP
    function bountyPolicy(uint256 id) public view returns(string, bytes memory extraData);
}
```

1. Compliant interfaces MUST implement the `getSecurityContact` method.

`type` is a one byte data with valid range of `[0x10, 0x7f]`. The ranges of `[0x00, 0x0f]` and `[0x80, 0xff]` are reserved for future extension.

The `type` indicates the format of the `publicKey` and `extraData` in the following way

------------------------------------------------------------------------------------------------
| Type | Encryption scheme                   | extraData                                       |
-------|-------------------------------------|--------------------------------------------------
| 0x10 | GnuPG - RSA/3072                    | Email address(es) encoded in format of RFC 2822 |
------------------------------------------------------------------------------------------------

A new version of this table can be proposed by future EIPs by specifying a new `type` number.

2. The `publicKey` returned from `getSecurityContact` MUST follow the encryption scheme specified
in the table above.

The following is an example of a `publicKey` using `RSA/3072` generated via GnuPG in an RFC 20 ASCII-encoding of the public key string:

```text
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQGNBGLzM2YBDADnCxAW/A0idvKNeQ6s/iYUeIIE+2mWmHcBGqLi0zrfz7pKWI+D
m6Hek51sg2c7ZlswPEp8KqANrj/CV1stXHF+KAZtYeFiAqpIZl1wtB6QgKYWGsJf
sXjBU3duLzLut2yvTfbEZsWAvrEaDjlXywdpboorHvfTE2vOvI6iGcjdh7PW7W7g
IGzlL6ukLGG7y9FUO2dSMjCR/tWMLCupnDDLN2cUHnfEnHZ34FMd61NxcHLC7cIk
P8xkFt8GCxURniTjqI5HAB8bGfR34kflVpr2+iKD5e+vQxcWK7vB443nruVf8osn
udDF8Z6mgl7bKBbGyYH58QsVlmZ8g3E4YaMKjpwOzEK3V2R8Yh4ETdr670ZCRrIz
QWVkibGgmQ3J/9RYps5Hfqpj4wV60Bsh1xUIJEIAs3ubMt7Z5JYFeze7VlXGlwot
P+SnAfKzlZT4CDEl2LEEDrbpnpOEdp0x9hYsEaXTxBGSpTDaxP2MyhW3u6pYeehG
oD0UVTLjWgU+6akAEQEAAbQjc29tZXJlYWxuYW1lIDxncGcubG9jYWwuZ2VuQHp6
bi5pbT6JAdQEEwEIAD4WIQTDk/9jzRZ+lU2cY8rSVJNbud1lrQUCYvMzZgIbAwUJ
EswDAAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRDSVJNbud1lraulDACqFbQg
e9hfoK17UcPVz/u4ZnwmFd9zFAWSYkGqrK9XMvz0R8pr7Y3Dp5hfvaptqID/lHhA
2oPEZ1ViIYDBcqG9WoWjCOYNoIosEAczrvf8YtUC2MHI+5DdYHtST74jDLuWMw3U
AbBXHds3KcRY5/j01kqqi4uwsMBCYyH3Jl3IwjKgy0KDBbuQakvaHPmNnt81ayvZ
ucdsNB9n/JMDxUWNCcySR+cllW4mk68pdiuK5qw0JMaoUjHFoWsgMTbFSlAV/lre
qu8MnrLSs5iPvvaJ3uDOuYROB2FsbvWxayfAAVS1iZf2vQFBJPnDwDdYoPNYMjLp
s2SfU02MVRGp3wanbtvM52uP42SLLNjBqUvJV03/QwfxCRejgAJOBn+iaOxP9NOe
qfQdKzYPbA9FohdkL9991n21XBZcZzAgF9RyU9IZAPAnwZyex1zfzJsUp/HrjhP8
Ljs8MIcjIlmpLk66TmJte4dN5eML1bpohmfMX8k0ILESLSUhxEg1JBNYIDK5AY0E
YvMzZgEMALnIkONpqCkV+yaP8Tb8TBjmM+3TioJQROViINUQZh6lZM3/M+DPxAWZ
r0MIh1a3+o+ThlZ70tlS67w3Sjd62sWAFzALzW4F+gTqjBTh6LURDqDV8OXUrggA
SKK222aDP+Fr21h/TtPLeyDvcgm8Xvi4Cy7Jmf5CfT5jDio7a+FyFBNlTFSVqzLM
TgFOkUFBg8kJKvDjWIrS2fcTkELwZ8+IlQ52YbrXwbDar843x1fRmsY+x9nnuGuP
RYn1U4Jbptu2pEkG5q94jzUzTkGZHCzBJY7a8mtvS0mLqIE0Se1p+HFLY76Rma/F
HB6J4JNOTzBZ0/1FVvUOcMkjuZ2dX81qoCZ8NP6eafzKvNYZrGa5NJnjWO1ag5jQ
D8qHuOwxs8Fy9evmkwAVl51evLFNT532I4LK0zHSbF8MccZjpEFMSKwalKJn02Ml
yTd+ljYLf8SKMOLVps8kc4VyMR1lz0PwSpKDFOmkC1LRURpM7UTtCK+/RFg1OLyQ
SKBmdI37KQARAQABiQG8BBgBCAAmFiEEw5P/Y80WfpVNnGPK0lSTW7ndZa0FAmLz
M2YCGwwFCRLMAwAACgkQ0lSTW7ndZa2oFgv8DAxHtRZchTvjxtdLhQEUSHt80JCQ
zgHd7OUI9EU3K+oDj9AKtKZF1fqMlQoOskgBsLy/xpWwyhatv2ONLtHSjYDkZ7qs
jsXshqpuvJ3X00Yn9PXG1Z1jKl7rzy2/0DnQ8aFP+gktfu2Oat4uIu4YSqRsVW/Z
sbdTsW3T4E6Uf0qUKDf49mK3Y2nhTwY0YZqJnuQkSuUvpuM5a/4zSoaIRz+vSNjX
MoXUIK/f8UnWABPm90OCptTMTzXCC1UXEHTNm6iBJThFiq3GeLZH+GnIola5KLO1
+YbsFEchLfLZ27pWGfIbyppvsuQmrHef+J3g6sXybOWDHVYr3Za1fzxQVIbwoIEe
ndKG0bu7ZAi2b/c8uH/wHT5IvtfzHLeSTjDqG8UyLTnaDxHQZIE9JIzWSQ1DSoNC
YrU7CQtL+/HRpiGFHfClaXln8VWkjnUvp+Fg1ZPtE1t/SKddZ7m29Hd9nzUc0OQW
MOA+HDqgA3a9kWbQKSloORq4unft1eu/FCra
=O6Bf
-----END PGP PUBLIC KEY BLOCK-----
```

3. IF `setSecurityContact` is implemented and a call to it has succeeded in setting a new security contact, an event `SecurityContactChanged` MUST be emitted with the identical passed-in-parameters of `setSecurityContact`

4. It&apos;s also RECOMMENDED that an on-chain security notify method `securityNotify`
be implemented to receive security notice onchain. If it&apos;s implemented and a call
has succeeded, it MUST emit an `OnSecurityNotification` with identical passed-in parameter data.

5. Compliant interfaces MUST implement [EIP-165](./eip-165.md).
&lt;!-- TODO: add EIP-165 interfaces. --&gt;
&lt;!-- TODO also consider requiring/recommending implementing EIP-5629 ERC-interface detection. --&gt;

6. It&apos;s recommended to set a bounty policy via the `bountyPolicy` method. The `id = 0` 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.

## Rationale
1. For simplicity, this EIP specifies a simple GPG scheme with a given encryption scheme and uses email addresses as a contact method. It&apos;s possible that future EIPs will specify new encryption schemes or delivery methods.
2. This EIP adds an optional method, `setSecurityContact`, to set the security contact, because it might change due to circumstances such as the expiration of the cryptographic keys.
3. This EIP explicitly marks `securityNotify` as `payable`, in order to allow implementers to set a staking amount to report a security vulnerability.
4. This EIP allows for future expansion by adding the `bountyPolicy` and `extraData` fields. Additional values of these fields may be added in future EIPs.

## Backwards Compatibility
Currently, existing solutions such as OpenZeppelin use plaintext in source code

```solidity
/// @custom:security-contact some-user@some-domain.com
```

It&apos;s recommended that new versions of smart contracts adopt this EIP in addition to the legacy `@custom:security-contact` approach.

## Security Considerations

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:

1. Keep security contact information up-to-date;
2. Rotate encryption keys in the period recommended by best practice;
3. Regularly monitor the channel to receive notices in a timely manner.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 09 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5437</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5437</guid>
      </item>
    
      <item>
        <title>Endorsement - Permit for Any Functions</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-5453-endorsement-standard/10355</comments>
        
        <description>## Abstract

This EIP establishes a general protocol for permitting and approving function calls in the same transaction relying on [ERC-5750](./eip-5750.md).
Unlike a few prior art ([ERC-2612](./eip-2612.md) for [ERC-20](./eip-20.md), [ERC-4494](./eip-4494.md) for [ERC-721](./eip-721.md) that
usually only permit for a single behavior (`transfer` for ERC-20 and `safeTransferFrom` for ERC-721) and a single approver in two transactions (first a `permit(...)` TX, then a `transfer`-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.

## Motivation

1. Support permit(approval) alongside a function call.
2. Support a second approval from another user.
3. Support pay-for-by another user
4. Support multi-sig
5. Support persons acting in concert by endorsements
6. Support accumulated voting
7. Support off-line signatures

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Interfaces

The interfaces and structures referenced here are as follows

```solidity
pragma solidity ^0.8.9;

struct ValidityBound {
    bytes32 functionParamStructHash;
    uint256 validSince;
    uint256 validBy;
    uint256 nonce;
}

struct SingleEndorsementData {
    address endorserAddress; // 32
    bytes sig; // dynamic = 65
}

struct GeneralExtensionDataStruct {
    bytes32 erc5453MagicWord;
    uint256 erc5453Type;
    uint256 nonce;
    uint256 validSince;
    uint256 validBy;
    bytes endorsementPayload;
}

interface IERC5453EndorsementCore {
    function eip5453Nonce(address endorser) external view returns (uint256);
    function isEligibleEndorser(address endorser) external view returns (bool);
}

interface IERC5453EndorsementDigest {
    function computeValidityDigest(
        bytes32 _functionParamStructHash,
        uint256 _validSince,
        uint256 _validBy,
        uint256 _nonce
    ) external view returns (bytes32);

    function computeFunctionParamHash(
        string memory _functionName,
        bytes memory _functionParamPacked
    ) external view returns (bytes32);
}

interface IERC5453EndorsementDataTypeA {
    function computeExtensionDataTypeA(
        uint256 nonce,
        uint256 validSince,
        uint256 validBy,
        address endorserAddress,
        bytes calldata sig
    ) external view returns (bytes memory);
}


interface IERC5453EndorsementDataTypeB {
    function computeExtensionDataTypeB(
        uint256 nonce,
        uint256 validSince,
        uint256 validBy,
        address[] calldata endorserAddress,
        bytes[] calldata sigs
    ) external view returns (bytes memory);
}
```

See [`IERC5453.sol`](../assets/eip-5453/IERC5453.sol).

### Behavior specification

As specified in [ERC-5750 General Extensibility for Method Behaviors](./eip-5750.md), any compliant method that has a `bytes extraData` parameter as its
last designated parameter for extending behaviors can conform to [ERC-5453](./eip-5453.md) as the way to indicate a permit from a certain user.

1. Any compliant method of this EIP MUST be a [ERC-5750](./eip-5750.md) compliant method.
2. Caller MUST pass in the last parameter `bytes extraData` conforming to Solidity memory-encoded bytes of `GeneralExtensionDataStruct` specified in _Section Interfaces_. The following descriptions are based on when decoding `bytes extraData` into a `GeneralExtensionDataStruct`
3. In the `GeneralExtensionDataStruct`-decoded `extraData`, caller MUST set the value of `GeneralExtensionDataStruct.erc5453MagicWord` to be the `keccak256(&quot;ERC5453-ENDORSEMENT&quot;)`.
4. Caller MUST set the value of `GeneralExtensionDataStruct.erc5453Type` to be one of the supported values.

```solidity
uint256 constant ERC5453_TYPE_A = 1;
uint256 constant ERC5453_TYPE_B = 2;
```

5. When the value of `GeneralExtensionDataStruct.erc5453Type` is set to be `ERC5453_TYPE_A`, `GeneralExtensionDataStruct.endorsementPayload` MUST be abi encoded bytes of a `SingleEndorsementData`.
6. When the value of `GeneralExtensionDataStruct.erc5453Type` is set to be `ERC5453_TYPE_B`, `GeneralExtensionDataStruct.endorsementPayload` MUST be abi encoded bytes of `SingleEndorsementData[]` (a dynamic array).

7. Each `SingleEndorsementData` MUST have a `address endorserAddress;` and a 65-bytes `bytes sig` signature.

8. Each `bytes sig` MUST be an ECDSA (secp256k1) signature using private key of signer whose corresponding address is `endorserAddress` signing `validityDigest` which is the hashTypeDataV4 of [EIP-712](./eip-712.md) of hashStruct of `ValidityBound` data structure as follows:

```solidity
bytes32 validityDigest =
    eip712HashTypedDataV4(
        keccak256(
            abi.encode(
                keccak256(
                    &quot;ValidityBound(bytes32 functionParamStructHash,uint256 validSince,uint256 validBy,uint256 nonce)&quot;
                ),
                functionParamStructHash,
                _validSince,
                _validBy,
                _nonce
            )
        )
    );
```

9. The `functionParamStructHash` MUST be computed as follows

```solidity
        bytes32 functionParamStructHash = keccak256(
            abi.encodePacked(
                keccak256(bytes(_functionStructure)),
                _functionParamPacked
            )
        );
        return functionParamStructHash;
```

whereas

- `_functionStructure` MUST be computed as `function methodName(type1 param1, type2 param2, ...)`.
- `_functionParamPacked` MUST be computed as `enc(param1) || enco(param2) ...`

10. Upon validating that `endorserAddress == ecrecover(validityDigest, signature)` or `EIP1271(endorserAddress).isValidSignature(validityDigest, signature) == ERC1271.MAGICVALUE`, the single endorsement MUST be deemed valid.
11. Compliant method MAY choose to impose a threshold for a number of endorsements needs to be valid in the same `ERC5453_TYPE_B` kind of `endorsementPayload`.

12. The `validSince` and `validBy` are both inclusive. Implementer MAY choose to use blocknumber or timestamp. Implementors SHOULD find a way to indicate whether `validSince` and `validBy` is blocknumber or timestamp.

## Rationale

1. We chose to have both `ERC5453_TYPE_A`(single-endorsement) and `ERC5453_TYPE_B`(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 [ERC-4494](./eip-4494.md) can be supported by `ERC5453_TYPE_A`. And threshold approvals can be done via `ERC5453_TYPE_B`. More complicated approval types can also be extended by defining new `ERC5453_TYPE_?`

2. We chose to include both `validSince` and `validBy` to allow maximum flexibility in expiration. This can also be supported natively by the EVM if [ERC-5081](./eip-5081.md) is adopted, but [ERC-5081](./eip-5081.md) will not be adopted anytime soon, so we choose to add these two numbers in our protocol to allow
smart contract level support.

## Backwards Compatibility

The design assumes a `bytes calldata extraData` to maximize the flexibility of future extensions. This assumption is compatible with [ERC-721](eip-721.md), [ERC-1155](eip-1155.md) and many other ERC-track EIPs. Those that aren&apos;t, such as [ERC-20](./eip-20.md), can also be updated to support it, such as using a wrapper contract or proxy upgrade.

## Reference Implementation

In addition to the specified algorithm for validating endorser signatures, we also present the following reference implementations.

```solidity
pragma solidity ^0.8.9;

import &quot;@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol&quot;;
import &quot;@openzeppelin/contracts/utils/cryptography/EIP712.sol&quot;;

import &quot;./IERC5453.sol&quot;;

abstract contract AERC5453Endorsible is EIP712,
    IERC5453EndorsementCore, IERC5453EndorsementDigest, IERC5453EndorsementDataTypeA, IERC5453EndorsementDataTypeB {
    // ...

    function _validate(
        bytes32 msgDigest,
        SingleEndorsementData memory endersement
    ) internal virtual {
        require(
            endersement.sig.length == 65,
            &quot;AERC5453Endorsible: wrong signature length&quot;
        );
        require(
            SignatureChecker.isValidSignatureNow(
                endersement.endorserAddress,
                msgDigest,
                endersement.sig
            ),
            &quot;AERC5453Endorsible: invalid signature&quot;
        );
    }
    // ...

    modifier onlyEndorsed(
        bytes32 _functionParamStructHash,
        bytes calldata _extensionData
    ) {
        require(_isEndorsed(_functionParamStructHash, _extensionData));
        _;
    }

    function computeExtensionDataTypeB(
        uint256 nonce,
        uint256 validSince,
        uint256 validBy,
        address[] calldata endorserAddress,
        bytes[] calldata sigs
    ) external pure override returns (bytes memory) {
        require(endorserAddress.length == sigs.length);
        SingleEndorsementData[]
            memory endorsements = new SingleEndorsementData[](
                endorserAddress.length
            );
        for (uint256 i = 0; i &lt; endorserAddress.length; ++i) {
            endorsements[i] = SingleEndorsementData(
                endorserAddress[i],
                sigs[i]
            );
        }
        return
            abi.encode(
                GeneralExtensionDataStruct(
                    MAGIC_WORLD,
                    ERC5453_TYPE_B,
                    nonce,
                    validSince,
                    validBy,
                    abi.encode(endorsements)
                )
            );
    }
}

```

See [`AERC5453.sol`](../assets/eip-5453/AERC5453.sol)

### Reference Implementation of `EndorsableERC721`

Here is a reference implementation of `EndorsableERC721` that achieves similar behavior to [ERC-4494](./eip-4494.md).

```solidity
pragma solidity ^0.8.9;

contract EndorsableERC721 is ERC721, AERC5453Endorsible {
    //...

    function mint(
        address _to,
        uint256 _tokenId,
        bytes calldata _extraData
    )
        external
        onlyEndorsed(
            _computeFunctionParamHash(
                &quot;function mint(address _to,uint256 _tokenId)&quot;,
                abi.encode(_to, _tokenId)
            ),
            _extraData
        )
    {
        _mint(_to, _tokenId);
    }
}
```

See [`EndorsableERC721.sol`](../assets/eip-5453/EndorsableERC721.sol)

### Reference Implementation of `ThresholdMultiSigForwarder`

Here is a reference implementation of ThresholdMultiSigForwarder that achieves similar behavior of multi-sig threshold approval
remote contract call like a Gnosis-Safe wallet.

```solidity
pragma solidity ^0.8.9;

contract ThresholdMultiSigForwarder is AERC5453Endorsible {
    //...
    function forward(
        address _dest,
        uint256 _value,
        uint256 _gasLimit,
        bytes calldata _calldata,
        bytes calldata _extraData
    )
        external
        onlyEndorsed(
            _computeFunctionParamHash(
                &quot;function forward(address _dest,uint256 _value,uint256 _gasLimit,bytes calldata _calldata)&quot;,
                abi.encode(_dest, _value, _gasLimit, keccak256(_calldata))
            ),
            _extraData
        )
    {
        string memory errorMessage = &quot;Fail to call remote contract&quot;;
        (bool success, bytes memory returndata) = _dest.call{value: _value}(
            _calldata
        );
        Address.verifyCallResult(success, returndata, errorMessage);
    }

}

```

See [`ThresholdMultiSigForwarder.sol`](../assets/eip-5453/ThresholdMultiSigForwarder.sol)

## Security Considerations

### Replay Attacks

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 _public_ 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 `chainId`, or any other similar attack surfaces. The `nonce`, `validSince`, and `validBy` fields are meant to restrict the surface of attack but might not fully eliminate the risk of all such attacks, e.g. see the [Phishing](#phishing) section.

### Phishing

It&apos;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 may be tricked into signing a smart endorsement for a seemingly legitimate purpose, but the data-to-designed matches the target application

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 12 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5453</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5453</guid>
      </item>
    
      <item>
        <title>Consensual Soulbound Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5484-consensual-soulbound-tokens/10424</comments>
        
        <description>## Abstract

This EIP defines an interface extending [EIP-721](./eip-721.md) 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&apos;t be transferred, but can be burned based on a predetermined immutable burn authorization.

## Motivation

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.

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.

## Specification

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.

- The token MUST implement the following interfaces:

  1. [EIP-165](./eip-165.md)’s `ERC165` (`0x01ffc9a7`)
  1. [EIP-721](./eip-721.md)’s `ERC721` (`0x80ac58cd`)

- `burnAuth` SHALL be presented to receiver before issuance.
- `burnAuth` SHALL be Immutable after issuance.
- `burnAuth` SHALL be the sole factor that determines which party has the rights to burn token.
- The issuer SHALL present token metadata to the receiver and acquire receiver&apos;s signature before issuance.
- The issuer SHALL NOT change metadata after issuance.

/// Note: the EIP-165 identifier for this interface is 0x0489b56f

### Contract Interface

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IERC5484 {
    /// A guideline to standardlize burn-authorization&apos;s number coding
    enum BurnAuth {
        IssuerOnly,
        OwnerOnly,
        Both,
        Neither
    }

    /// @notice Emitted when a soulbound token is issued.
    /// @dev This emit is an add-on to nft&apos;s transfer emit in order to distinguish sbt 
    /// from vanilla nft while providing backward compatibility.
    /// @param from The issuer
    /// @param to The receiver
    /// @param tokenId The id of the issued token
    event Issued (
        address indexed from,
        address indexed to,
        uint256 indexed tokenId,
        BurnAuth burnAuth
    );

    /// @notice provides burn authorization of the token id.
    /// @dev unassigned tokenIds are invalid, and queries do throw
    /// @param tokenId The identifier for a token.
    function burnAuth(uint256 tokenId) external view returns (BurnAuth);
}
```

## Rationale

### Soulbound Token (SBTs) as an extension to EIP-721

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.

### Non-Transferable

One problem with current soulbound token implementations that extend from [EIP-721](./eip-721.md) 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.

### Burn Authorization

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:

- `IssuerOnly`: Loan record
- `ReceiverOnly`: Paid membership
- `Both`: Credentials
- `Neither`: Credit history

Burn authorization is tied to specific tokens and immutable after issuance. It is therefore important to inform the receiver and gain receiver&apos;s consent before the token is issued.

### Issued Event

On issuing, an `Issued` event will be emitted alongside [EIP-721](./eip-721.md)&apos;s `Transfer` event. This design keeps backward compatibility while giving clear signals to thrid-parties that this is a soulBound token issuance event.

### Key Rotations

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.

## Backwards Compatibility

This proposal is fully backward compatible with [EIP-721](./eip-721.md)

## Security Considerations

There are no security considerations related directly to the implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 17 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5484</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5484</guid>
      </item>
    
      <item>
        <title>Jurisdiction, Accreditation, and Enforcement</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-5485-interface-for-legitimacy-jurisdiction-and-sovereignty/10425</comments>
        
        <description>## Abstract

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.

## Motivation

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.

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.

This ERC proposes a standardized interface for representing four foundational concepts:

- **Sovereignty** — whether a contract is self-sovereign or claims allegiance to a higher-order system;
- **Jurisdiction** — which external authority it chooses to observe;
- **Accreditation** — whether that authority formally recognizes the contract as a valid participant within its system; and
- **Enforcement** — how decisions, rulings, or binding actions issued by that authority can be delivered to and acknowledged by the contract.

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.

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.

### Use Cases (Primary)

The primary use cases address questions related to the status of a contract itself.

- **Stablecoins (e.g., USDC):** Require jurisdiction because reserve custody, redemptions, freezes, and regulatory compliance depend on a specific legal authority.
- **Tokenized Stocks / RWAs:** Require jurisdiction because securities laws, transfer restrictions, investor rights, and enforcement vary entirely by legal venue.
- **Regulated Lending Protocols:** Require jurisdiction to define collateral rights, default resolution, licensing requirements, and enforceability of loan agreements.
- **Private Company Equity for Qualified Investors:** Require jurisdiction to enforce accreditation rules, transfer limits, corporate law, and cap-table validity.

### Use Cases (Secondary)

The secondary use cases address the questions related to the interactions between contracts.

- **Jurisdiction Compatibility Checks:** Ensuring that interacting contracts operate under compatible or acceptable jurisdictions.
- **Regulatory Boundary Enforcement:** Gateways, bridges, or marketplaces can restrict integration to contracts meeting specific jurisdictional or accreditation requirements.
- **Good-Standing Verification:** Validating whether a contract is accredited and in compliance under its declared jurisdiction.
- **Jurisdiction-Based Access Control:** Allowing or restricting participation based on jurisdiction or accreditation metadata.
- **Cross-Contract Legal Cohesion:** Ensuring coherent jurisdictional alignment across multi-contract systems, federated DAOs, or hierarchical governance structures.
- **Automated Dispute-Path Selection:** Determining which arbitration venue, legal process, or enforcement route applies when disputes arise

## Specification

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.

A contract compliant with this ERC MUST implement the interface defined below.
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.

### 1. Data Structures

For backward compatibility with existing contracts that implement
[ERC-5247](./eip-5247.md), the interface extends
the `IERC5247Executable` and `IERC5247Executables` data structures.

#### `IERC5247Executable`

Represents a single action that MAY be proposed as part of an enforcement submission.
This structure follows a generic “executable call” pattern: a target address, an optional ETH value, a gas limit, and calldata for invocation.
No guarantees are made regarding execution; implementations MAY ignore or reinterpret these fields.

```solidity
/// @notice A single executable action that MAY be proposed as part of an enforcement.
struct IERC5247Executable {
    /// @notice The target address to be called if this executable is processed.
    address target;

    /// @notice The amount of ETH (in wei) to send along with the call to `target`.
    uint256 value;

    /// @notice The gas limit for the call. Implementations MAY ignore this field.
    uint256 gasLimit;

    /// @notice The calldata to send to `target`.
    bytes data;
}
```

#### `IERC5247Executables`

A batch of `IERC5247Executable` items representing an ordered enforcement proposal.

```solidity
/// @notice A batch of executable actions forming an enforcement proposal.
struct IERC5247Executables {
    /// @notice Ordered list of executable actions included in this proposal.
    IERC5247Executable[] executables;
}
```

### 2. Interface

#### `sourceOfAccreditation()`

Returns the address that accredited this contract as a valid participant within some jurisdiction or governance system.

* MUST return the accrediting authority’s address if one exists.
* MUST return `address(0)` if the contract does not recognize any external accreditation source (e.g., self-sovereign behavior).
* SHOULD remain stable over the contract’s lifetime or change only through a defined governance or upgrade mechanism.

#### `jurisdiction()`

Returns the primary jurisdiction or system whose rules this contract claims to observe.

* MAY return the same address as `sourceOfAccreditation()` when a single contract performs both roles.
* MUST return `address(0)` if the contract claims no external jurisdiction.
* Represents the higher-order system the contract aligns with, independently of accreditation.

#### `imposeEnforcement(IERC5247Executables _proposal)`

A standardized entry point for submitting an enforcement proposal to the contract.

* Implementations MUST define and document the access control for this function (e.g., restricted to `jurisdiction()`, `sourceOfAccreditation()`, or a curated authority list).
* Implementations MAY:

  * immediately execute some or all proposed actions,
  * record the proposal for later deliberation,
  * partially honor or completely ignore the proposal based on policy.
* Implementations SHOULD emit events or persist state enabling verifiable on-chain acknowledgment that an enforcement attempt occurred.
* The function is payable to allow ETH to accompany proposals when executables specify non-zero `value` or when processing fees apply.

### Full Interface

```solidity
interface IERC5485 {
    /// @notice Returns the address that accredited this contract, if any.
    /// @dev MUST return address(0) if the contract does not recognize
    ///      an external accreditation source. SHOULD remain stable or change
    ///      only via defined governance.
    function sourceOfAccreditation() external view returns (address);

    /// @notice Returns the jurisdiction or higher-order system this contract
    ///      observes.
    /// @dev MAY be the same as `sourceOfAccreditation()`. MUST return address(0)
    ///      when the contract claims no external jurisdiction (self-sovereign
    ///      behavior). SHOULD remain stable or change only via defined governance.
    function jurisdiction() external view returns (address);

    /// @notice Submits an enforcement proposal to this contract.
    /// @dev Implementations MUST define access control. Implementations MAY execute,
    ///      schedule, partially honor, reject, or only record `_proposal`.
    /// @dev Implementations SHOULD emit events or store state acknowledging receipt of
    ///      enforcement proposals. Payable to allow ETH forwarding for executables that
    ///      specify non-zero value.
    function imposeEnforcement(IERC5247Executables _proposal) external payable;
}
```

## Rationale

### Separation of Jurisdiction and Accreditation

This ERC separates **jurisdiction** from **accreditation** because
they represent fundamentally different relationships:

- **Jurisdiction is voluntary.**
  A contract may unilaterally declare that it observes the rules or
  norms of a particular system.

- **Accreditation requires external approval.**
  Only the authority itself can grant formal recognition that a contract
  is an accepted participant within its system.

- **Jurisdiction expresses alignment; accreditation expresses acceptance.**
  Declaring jurisdiction does not imply the authority recognizes the contract.
  Accreditation establishes the reciprocal relationship.

- **Accreditation enables enforcement.**
  Authorities typically issue enforcement only to contracts they have
  accredited. Jurisdiction alone does not create this binding pathway.

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.


## Backwards Compatibility

1. 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.

2. Using [ERC-5247](./eip-5247.md) as a base interface for enforcement proposals is backward
compatible with existing contracts that implement [ERC-5247](./eip-5247.md), such as Multi-Sig
wallets such as the treasury of a DAO.

## Security Considerations

Similar to a real-world scenario, when observing a jurisdiction
practically gives the contract the ability to enforce rules on the
contract&apos;s behavior. Similar to &quot;Ownable&quot; ([ERC-173](./eip-173.md)) 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 17 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5485</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5485</guid>
      </item>
    
      <item>
        <title>NFT Hyperlink Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5489-nft-hyperlink-extension/10431</comments>
        
        <description>## Abstract

This EIP proposes a new extension for NFTs (non-fungible token, aka [EIP-721](./eip-721.md)): 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.


## Motivation

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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Interface

#### `IERC5489`

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IERC5489 {
    /**
     * @dev this event emits when the slot on `tokenId` is authorzized to `slotManagerAddr`
     */
    event SlotAuthorizationCreated(uint256 indexed tokenId, address indexed slotManagerAddr);

    /**
     * @dev this event emits when the authorization on slot `slotManagerAddr` of token `tokenId` is revoked.
     * So, the corresponding DApp can handle this to stop on-going incentives or rights
     */
    event SlotAuthorizationRevoked(uint256 indexed tokenId, address indexed slotManagerAddr);

    /**
     * @dev this event emits when the uri on slot `slotManagerAddr` of token `tokenId` has been updated to `uri`.
     */
    event SlotUriUpdated(uint256 indexed tokenId, address indexed slotManagerAddr, string uri);

    /**
     * @dev
     * Authorize a hyperlink slot on `tokenId` to address `slotManagerAddr`.
     * Indeed slot is an entry in a map whose key is address `slotManagerAddr`.
     * Only the address `slotManagerAddr` can manage the specific slot.
     * This method will emit SlotAuthorizationCreated event
     */
    function authorizeSlotTo(uint256 tokenId, address slotManagerAddr) external;

    /**
     * @dev
     * Revoke the authorization of the slot indicated by `slotManagerAddr` on token `tokenId`
     * This method will emit SlotAuthorizationRevoked event
     */
    function revokeAuthorization(uint256 tokenId, address slotManagerAddr) external;

    /**
     * @dev
     * Revoke all authorizations of slot on token `tokenId`
     * This method will emit SlotAuthorizationRevoked event for each slot
     */
    function revokeAllAuthorizations(uint256 tokenId) external;

    /**
     * @dev
     * Set uri for a slot on a token, which is indicated by `tokenId` and `slotManagerAddr`
     * Only the address with authorization through {authorizeSlotTo} can manipulate this slot.
     * This method will emit SlotUriUpdated event
     */
    function setSlotUri(
        uint256 tokenId,
        string calldata newUri
    ) external;

    /**
     * @dev Throws if `tokenId` is not a valid NFT. URIs are defined in RFC 3986.
     * The URI MUST point to a JSON file that conforms to the &quot;EIP5489 Metadata JSON schema&quot;.
     * 
     * returns the latest uri of an slot on a token, which is indicated by `tokenId`, `slotManagerAddr`
     */
    function getSlotUri(uint256 tokenId, address slotManagerAddr)
        external
        view
        returns (string memory);
}
```

The `authorizeSlotTo(uint256 tokenId, address slotManagerAddr)` function MAY be implemented as public or external.

The `revokeAuthorization(uint256 tokenId, address slotManagerAddr)` function MAY be implemented as public or external.

The `revokeAllAuthorizations(uint256 tokenId)` function MAY be implemented as public or external.

The `setSlotUri(uint256 tokenId, string calldata newUri)` function MAY be implemented as public or external.

The `getSlotUri(uint256 tokenId, address slotManagerAddr)` function MAY be implemented as pure or view.

The `SlotAuthorizationCreated` event MUST be emitted when a slot is authorized to an address.

The `SlotAuthorizationRevoked` event MUST be emitted when a slot authorization is revoked.

The `SlotUriUpdated` event MUSt be emitted when a slot&apos;s URI is changed.

The `supportInterface` method MUST return true when called with `0x8f65987b`.

### Authentication

The `authorizeSlotTo`, `revokeAuthorization`, and `revokeAllAuthorizations` functions are authenticated if and only if the message sender is the owner of the token.

### Metadata JSON schema

```json
{
    &quot;title&quot;: &quot;AD Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;icon&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* representing the slot&apos;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&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A paragraph which briefly introduce what is the target resource&quot;
        },
        &quot;target&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to target resource, sugguest to follow 30X status code to support more redirections, the mime type and content rely on user&apos;s setting&quot;
        } 
    }
}
```

## Rationale

### Extends NFT with hyperlinks

URIs are used to represent the value of slots to ensure enough flexibility to deal with different use cases.

### Authorize slot to address

We use addresses to represent the key of slots to ensure enough flexibility to deal with all use cases.

## Backwards Compatibility

As mentioned in the specifications section, this standard can be fully EIP-721 compatible by adding an extension function set.

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.

## Reference Implementation

You can find an implementation of this standard in [`ERC5489.sol`](../assets/eip-5489/contracts/ERC5489.sol).

## Security Considerations

No security considerations were found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 16 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5489</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5489</guid>
      </item>
    
      <item>
        <title>Multi-privilege Management NFT Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5496-multi-privilege-management-extension-for-erc-721/10427</comments>
        
        <description>## Abstract

This EIP defines an interface extending [EIP-721](./eip-721.md) 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.

## Motivation

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.

[EIP-721](./eip-721.md) only records the ownership and its transfer, the privileges of an NFT are not recorded on-chain. This extension would allow merchants/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.

For example, an airline company issues a series of [EIP-721](./eip-721.md)/[EIP-1155](./eip-1155.md) 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.

## Specification

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.

Every contract complying with this standard MUST implement the `IERC5496` interface. The **shareable multi-privilege extension** is OPTIONAL for EIP-721 contracts.

```solidity
/// @title multi-privilege extension for EIP-721
///  Note: the EIP-165 identifier for this interface is 0x076e1bbb
interface IERC5496{
    /// @notice Emitted when `owner` changes the `privilege holder` of a NFT.
    event PrivilegeAssigned(uint256 tokenId, uint256 privilegeId, address user, uint256 expires);
    /// @notice Emitted when `contract owner` changes the `total privilege` of the collection
    event PrivilegeTotalChanged(uint256 newTotal, uint256 oldTotal);

    /// @notice set the privilege holder of a NFT.
    /// @dev expires should be less than 30 days
    /// Throws if `msg.sender` is not approved or owner of the tokenId.
    /// @param tokenId The NFT to set privilege for
    /// @param privilegeId The privilege to set
    /// @param user The privilege holder to set
    /// @param expires For how long the privilege holder can have
    function setPrivilege(uint256 tokenId, uint256 privilegeId, address user, uint256 expires) external;

    /// @notice Return the expiry timestamp of a privilege
    /// @param tokenId The identifier of the queried NFT
    /// @param privilegeId The identifier of the queried privilege
    /// @return Whether a user has a certain privilege
    function privilegeExpires(uint256 tokenId, uint256 privilegeId) external view returns(uint256);

    /// @notice Check if a user has a certain privilege
    /// @param tokenId The identifier of the queried NFT
    /// @param privilegeId The identifier of the queried privilege
    /// @param user The address of the queried user
    /// @return Whether a user has a certain privilege
    function hasPrivilege(uint256 tokenId, uint256 privilegeId, address user) external view returns(bool);
}
```

Every contract implementing this standard SHOULD set a maximum privilege number before setting any privilege, the `privilegeId` MUST NOT be greater than the maximum privilege number.

The `PrivilegeAssigned` event MUST be emitted when `setPrivilege` is called.

The `PrivilegeTotalChanged` event MUST be emitted when the `total privilege` of the collection is changed.

The `supportsInterface` method MUST return `true` when called with `0x076e1bbb`.

```solidity
/// @title Cloneable extension - Optional for EIP-721
interface IERC721Cloneable {
    /// @notice Emitted when set the `privilege ` of a NFT cloneable.
    event PrivilegeCloned(uint tokenId, uint privId, address from, address to);

    /// @notice set a certain privilege cloneable
    /// @param tokenId The identifier of the queried NFT
    /// @param privilegeId The identifier of the queried privilege
    /// @param referrer The address of the referrer
    /// @return Whether the operation is successful or not
    function clonePrivilege(uint tokenId, uint privId, address referrer) external returns (bool);
}
```

The `PrivilegeCloned` event MUST be emitted when `clonePrivilege` is called.

For Compliant contract, it is RECOMMENDED to use [EIP-1271](./eip-1271.md) to validate the signatures.

## Rationale

### Shareable Privileges

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/her own privilege to them. This mechanism greatly enhances the spread of privileges as well as the adoption of NFTs.

### Expire Date Type

The expiry timestamp of a privilege is a timestamp and stored in `uint256` typed variables.

### Beneficiary of Referrer

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&apos;s say Tom gets 30% off Coupon from the shop and he shares the coupon with Alice. Alice gets the coupon too and Alice&apos;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.

### Proposal: NFT Transfer

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 [EIP-721](./eip-721.md) token from the wrapped NFT through `unwrap()` 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.

```solidity
function unwrap(uint256 tokenId, address to) external {
    require(getBlockTimestamp() &gt;= privilegeBook[tokenId].lastExpiresAt, &quot;privilege not yet expired&quot;);

    require(ownerOf(tokenId) == msg.sender, &quot;not owner&quot;);

    _burn(tokenId);

    IERC721(nft).transferFrom(address(this), to, tokenId);

    emit Unwrap(nft, tokenId, msg.sender, to);
}
```

## Backwards Compatibility

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 [EIP-721](./eip-721.md) standard.

## Test Cases

Test cases are implemented with the reference implementation.

### Test Code

[test.js](../assets/eip-5496/test/test.js)

Run in terminal:

```shell
truffle test ./test/test.js
```

[testCloneable.js](../assets/eip-5496/test/testCloneable.js)

Run in terminal:

```shell
truffle test ./test/testCloneable.js
```

## Reference Implementation

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0; 

import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;@openzeppelin/contracts/utils/introspection/IERC165.sol&quot;;
import &quot;./IERC5496.sol&quot;;

contract ERC5496 is ERC721, IERC5496 {
    struct PrivilegeRecord {
        address user;
        uint256 expiresAt;
    }
    struct PrivilegeStorage {
        uint lastExpiresAt;
        // privId =&gt; PrivilegeRecord
        mapping(uint =&gt; PrivilegeRecord) privilegeEntry;
    }

    uint public privilegeTotal;
    // tokenId =&gt; PrivilegeStorage
    mapping(uint =&gt; PrivilegeStorage) public privilegeBook;
    mapping(address =&gt; mapping(address =&gt; bool)) private privilegeDelegator;

    constructor(string memory name_, string memory symbol_)
    ERC721(name_,symbol_)
    {
    
    }

    function setPrivilege(
        uint tokenId,
        uint privId,
        address user,
        uint64 expires
    ) external virtual {
        require((hasPrivilege(tokenId, privId, ownerOf(tokenId)) &amp;&amp; _isApprovedOrOwner(msg.sender, tokenId)) || _isDelegatorOrHolder(msg.sender, tokenId, privId), &quot;ERC721: transfer caller is not owner nor approved&quot;);
        require(expires &lt; block.timestamp + 30 days, &quot;expire time invalid&quot;);
        require(privId &lt; privilegeTotal, &quot;invalid privilege id&quot;);
        privilegeBook[tokenId].privilegeEntry[privId].user = user;
        if (_isApprovedOrOwner(msg.sender, tokenId)) {
            privilegeBook[tokenId].privilegeEntry[privId].expiresAt = expires;
            if (privilegeBook[tokenId].lastExpiresAt &lt; expires) {
                privilegeBook[tokenId].lastExpiresAt = expires;
            }
        }
        emit PrivilegeAssigned(tokenId, privId, user, uint64(privilegeBook[tokenId].privilegeEntry[privId].expiresAt));
    }

    function hasPrivilege(
        uint256 tokenId,
        uint256 privId,
        address user
    ) public virtual view returns(bool) {
        if (privilegeBook[tokenId].privilegeEntry[privId].expiresAt &gt;= block.timestamp){
            return privilegeBook[tokenId].privilegeEntry[privId].user == user;
        }
        return ownerOf(tokenId) == user;
    }

    function privilegeExpires(
        uint256 tokenId,
        uint256 privId
    ) public virtual view returns(uint256){
        return privilegeBook[tokenId].privilegeEntry[privId].expiresAt;
    }

    function _setPrivilegeTotal(
        uint total
    ) internal {
        emit PrivilegeTotalChanged(total, privilegeTotal);
        privilegeTotal = total;
    }

    function getPrivilegeInfo(uint tokenId, uint privId) external view returns(address user, uint256 expiresAt) {
        return (privilegeBook[tokenId].privilegeEntry[privId].user, privilegeBook[tokenId].privilegeEntry[privId].expiresAt);
    }

    function setDelegator(address delegator, bool enabled) external {
        privilegeDelegator[msg.sender][delegator] = enabled;
    }

    function _isDelegatorOrHolder(address delegator, uint256 tokenId, uint privId) internal virtual view returns (bool) {
        address holder = privilegeBook[tokenId].privilegeEntry[privId].user;
         return (delegator == holder || isApprovedForAll(holder, delegator) || privilegeDelegator[holder][delegator]);
    }

    function supportsInterface(bytes4 interfaceId) public override virtual view returns (bool) {
        return interfaceId == type(IERC5496).interfaceId || super.supportsInterface(interfaceId);
    }
}
```

## Security Considerations

Implementations must thoroughly consider who has the permission to set or clone privileges.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 30 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5496</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5496</guid>
      </item>
    
      <item>
        <title>Rental &amp; Delegation NFT - EIP-721 Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-tbd-rental-delegation-nft-erc-721-extension/10441</comments>
        
        <description>## Abstract
The following standard proposes an additional `user` role for [EIP-721](./eip-721.md). 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. `Owner` 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.

## Motivation
Collectibles, gaming assets, metaverse, event tickets, music, video, domains, real item representation are several among many NFT use cases. With [EIP-721](./eip-721.md) 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. 

The two reasons why to set the user are: 

* **delegation** - Assign user to your hot wallet to interact with applications securely. In this case, the owner can change the user at any time.
* **renting** - 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 `expires` of the user. It is also necessary to protect the borrower against resetting their status by the owner. Thus, `isBorrowed` check must be implemented to disable the option to set the user before the contract expires.

The most common use cases for having an additional user role are: 

* **delegation** - For security reasons.
* **gaming** - 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.
* **guilds** - 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.
* **events** - Distinguish between `ownerOf` and `userOf`. Each role has a different access.
* **social** - Differentiate between roles for different rooms. For example owner has read + write access while userOf has read access only.

This proposal is a follow up on [EIP-4400](./eip-4400.md) and [EIP-4907](./eip-4907.md) and introduces additional upgrades for lending and borrowing which include: 

* **NFT stays in owner&apos;s wallet during rental period** 
* **Listing and sale of NFT without termination of the rent**
* **Claiming owner benefits during rental period**

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.

Decentralized applications can now differentiate between ownerOf and userOf while both statuses can coexist.
  
## Specification
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.

**Every compliant contract MUST implement the `IERC5501` interface. This extension is OPTIONAL for [EIP-721](./eip-721.md) contracts.** 

```solidity
/**
 * @title IERC5501: Rental &amp; Delegation NFT - EIP-721 Extension
 * @notice the EIP-165 identifier for this interface is 0xf808ec37.
 */
interface IERC5501 /* is IERC721 */ {
    /**
     * @dev Emitted when the user of an NFT is modified.
     */
    event UpdateUser(uint256 indexed _tokenId, address indexed _user, uint64 _expires, bool _isBorrowed);

    /**
     * @notice Set the user info of an NFT.
     * @dev User address cannot be zero address.
     * Only approved operator or NFT owner can set the user.
     * If NFT is borrowed, the user info cannot be changed until user status expires.
     * @param _tokenId uint256 ID of the token to set user info for
     * @param _user address of the new user
     * @param _expires Unix timestamp when user info expires
     * @param _isBorrowed flag whether or not the NFT is borrowed
     */
    function setUser(uint256 _tokenId, address _user, uint64 _expires, bool _isBorrowed) external;

    /**
     * @notice Get the user address of an NFT.
     * @dev Reverts if user is not set.
     * @param _tokenId uint256 ID of the token to get the user address for
     * @return address user address for this NFT
     */
    function userOf(uint256 _tokenId) external view returns (address);

    /**
     * @notice Get the user expires of an NFT.
     * @param _tokenId uint256 ID of the token to get the user expires for
     * @return uint64 user expires for this NFT
     */
    function userExpires(uint256 _tokenId) external view returns (uint64);

    /**
     * @notice Get the user isBorrowed of an NFT.
     * @param _tokenId uint256 ID of the token to get the user isBorrowed for
     * @return bool user isBorrowed for this NFT
     */
    function userIsBorrowed(uint256 _tokenId) external view returns (bool);
}
``` 

Every contract implementing the `IERC5501` interface is free to define the permissions of a `user`. However, user MUST NOT be considered an `owner`. They MUST NOT be able to execute transfers and approvals. Furthermore, `setUser` MUST be blocked from executing if `userIsBorrowed` returns `true` and `userExpires` is larger than or equal to `block.timestamp`. 

The `UpdateUser` event MUST be emitted when a `user` is changed.   
The `setUser(uint256 _tokenId, address _user, uint64 _expires, bool _isBorrowed)` function SHOULD `revert` unless the `msg.sender` is the `owner` or an approved operator. It MUST revert if a token is borrowed and status has not expired yet. It MAY be `public` or `external`.   
The `userOf(uint256 _tokenId)` function SHOULD revert if `user` is not set or expired.   
The `userExpires(uint256 _tokenId)` function returns a timestamp when user status expires.   
The `userIsBorrowed(uint256 _tokenId)` function returns whether NFT is borrowed or not.   
The `supportsInterface` function MUST return `true` when called with `0xf808ec37`.   
On every `transfer`, the `user` MUST be reset if the token is not borrowed. If the token is borrowed the `user` MUST stay the same.   

**The Balance extension is OPTIONAL. This gives the option to query the number of tokens a `user` has.** 

```solidity
/**
 * @title IERC5501Balance
 * Extension for ERC5501 which adds userBalanceOf to query how many tokens address is userOf.
 * @notice the EIP-165 identifier for this interface is 0x0cb22289.
 */
interface IERC5501Balance /* is IERC5501 */{
    /**
     * @notice Count of all NFTs assigned to a user.
     * @dev Reverts if user is zero address.
     * @param _user an address for which to query the balance
     * @return uint256 the number of NFTs the user has
     */
    function userBalanceOf(address _user) external view returns (uint256);
}
``` 

The `userBalanceOf(address _user)` function SHOULD `revert` for zero address. 

**The Enumerable extension is OPTIONAL. This allows to iterate over user balance.** 

```solidity
/**
 * @title IERC5501Enumerable
 * This extension for ERC5501 adds the option to iterate over user tokens.
 * @notice the EIP-165 identifier for this interface is 0x1d350ef8.
 */
interface IERC5501Enumerable /* is IERC5501Balance, IERC5501 */ {
    /**
     * @notice Enumerate NFTs assigned to a user.
     * @dev Reverts if user is zero address or _index &gt;= userBalanceOf(_owner).
     * @param _user an address to iterate over its tokens
     * @return uint256 the token ID for given index assigned to _user
     */
    function tokenOfUserByIndex(address _user, uint256 _index) external view returns (uint256);
}
``` 

The `tokenOfUserByIndex(address _user, uint256 _index)` function SHOULD `revert` for zero address and `throw` if the index is larger than or equal to `user` balance. 

**The Terminable extension is OPTIONAL. This allows terminating the rent early if both parties agree.**

```solidity
/**
 * @title IERC5501Terminable
 * This extension for ERC5501 adds the option to terminate borrowing if both parties agree.
 * @notice the EIP-165 identifier for this interface is 0x6a26417e.
 */
interface IERC5501Terminable /* is IERC5501 */ {
    /**
     * @dev Emitted when one party from borrowing contract approves termination of agreement.
     * @param _isLender true for lender, false for borrower
     */
    event AgreeToTerminateBorrow(uint256 indexed _tokenId, address indexed _party, bool _isLender);

    /**
     * @dev Emitted when agreements to terminate borrow are reset.
     */
    event ResetTerminationAgreements(uint256 indexed _tokenId);

    /**
     * @dev Emitted when borrow of token ID is terminated.
     */
    event TerminateBorrow(uint256 indexed _tokenId, address indexed _lender, address indexed _borrower, address _caller);

    /**
     * @notice Agree to terminate a borrowing.
     * @dev Lender must be ownerOf token ID. Borrower must be userOf token ID.
     * If lender and borrower are the same, set termination agreement for both at once.
     * @param _tokenId uint256 ID of the token to set termination info for
     */
    function setBorrowTermination(uint256 _tokenId) external;

    /**
     * @notice Get if it is possible to terminate a borrow agreement.
     * @param _tokenId uint256 ID of the token to get termination info for
     * @return bool, bool first indicates lender agrees, second indicates borrower agrees
     */
    function getBorrowTermination(uint256 _tokenId) external view returns (bool, bool);

    /**
     * @notice Terminate a borrow if both parties agreed.
     * @dev Both parties must have agreed, otherwise revert.
     * @param _tokenId uint256 ID of the token to terminate borrow of
     */
    function terminateBorrow(uint256 _tokenId) external;
}
``` 

The `AgreeToTerminateBorrow` event MUST be emitted when either the lender or borrower agrees to terminate the rent.   
The `ResetTerminationAgreements` event MUST be emitted when a token is borrowed and transferred or `setUser` and `terminateBorrow` functions are called.   
The `TerminateBorrow` event MUST be emitted when the rent is terminated.   
The `setBorrowTermination(uint256 _tokenId)`. 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.   
The `getBorrowTermination(uint256 _tokenId)` returns if agreements from both parties are `true` or `false`.   
The `terminateBorrow(uint256 _tokenId)` function MAY be called by anyone. It MUST `revert` if both agreements to terminate are not `true`. This function SHOULD change the `isBorrowed` flag from `true` to `false`.   
On every `transfer`, the termination agreements from either party MUST be reset if the token is borrowed.

## Rationale
The main factors influencing this standard are: 

* **[EIP-4400](./eip-4400.md) and [EIP-4907](./eip-4907.md)**
* **Allow lending and borrowing without the necessary stake or overcollateralization while owner retains ownership**
* **Leave the delegation option available**
* **Keep the number of functions in the interfaces to a minimum while achieving desired functionality**
* **Modularize additional extensions to let developers choose what they need for their project**

### Name
The name for the additional role has been chosen to fit the purpose and to keep compatibility with EIP-4907.

### Ownership retention
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.

### Balance and Enumerable extensions
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 `userBalanceOf` and `tokenOfUserByIndex` functions there must be a way to determine whether or not user status has expired. 

### Terminable extension
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.
 
### Security
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.

## Backwards Compatibility
This standard is compatible with current [EIP-721](./eip-721.md) 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 [EIP-4907](./eip-4907.md) considering user role and its expiry which means applications will be able to determine the user if either of the standards is used.

## Test Cases
Test cases can be found in the reference implementation:
* [Main contract](../assets/eip-5501/test/ERC5501Test.ts)
* [Balance extension](../assets/eip-5501/test/ERC5501BalanceTest.ts)
* [Enumerable extension](../assets/eip-5501/test/ERC5501EnumerableTest.ts)
* [Terminable extension](../assets/eip-5501/test/ERC5501TerminableTest.ts)
* [Scenario combined of all extensions](../assets/eip-5501/test/ERC5501CombinedTest.ts)

## Reference Implementation
The reference implementation is available here:
* [Main contract](../assets/eip-5501/contracts/ERC5501.sol)
* [Balance extension](../assets/eip-5501/contracts/ERC5501Balance.sol)
* [Enumerable extension](../assets/eip-5501/contracts/ERC5501Enumerable.sol)
* [Terminable extension](../assets/eip-5501/contracts/ERC5501Terminable.sol)
* [Solution combined of all extensions](../assets/eip-5501/contracts/ERC5501Combined.sol)

## Security Considerations
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.
  
## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 18 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5501</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5501</guid>
      </item>
    
      <item>
        <title>EIP-1155 asset backed NFT extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-draft-erc1155-asset-backed-nft-extension/10437</comments>
        
        <description>## Abstract
To propose an extension of smart contract interfaces for asset-backed, fractionalized projects using the [EIP-1155](./eip-1155.md) standard such that total acquisition will become possible. This proposal focuses on physical asset, where total acquisition should be able to happen.

## Motivation
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.

## Specification
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.

[EIP-1155](./eip-1155.md) compliant contracts MAY implement this EIP for adding functionalities to support total acquisition.

```solidity
//set the percentage required for any acquirer to trigger a forced sale
//set also the payment token to settle for the acquisition

function setForcedSaleRequirement(
	uint128 requiredBP,
	address erc20Token
) public onlyOwner

//set the unit price to acquire the remaining NFTs (100% - requiredBP)
//suggest to use a Time Weighted Average Price for a certain period before reaching the requiredBP
//emit ForcedSaleSet

function setForcedSaleTWAP(
	uint256 amount
) public onlyOwner

//acquirer deposit remainingQTY*TWAP
//emit ForcedSaleFinished
//after this point, the acquirer is the new owner of the whole asset

function execForcedSale (
	uint256 amount
) public external payable

//burn ALL NFTs and collect funds
//emit ForcedSaleClaimed

function claimForcedSale()
public

event ForcedSaleSet(
	bool isSet
)
event ForceSaleClaimed(
	uint256 qtyBurned,
	uint256 amountClaimed,
	address claimer
)
```


## Rationale
Native ETH is supported by via Wrapped Ether [EIP-20](./eip-20.md).
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.

## Security Considerations
The major security risks considered include
- 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 **council** to safeguard the fairness of the forcedSale. 
- 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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 18 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5505</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5505</guid>
      </item>
    
      <item>
        <title>Refundable Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5507-refundable-nfts/10451</comments>
        
        <description>## Abstract

This ERC adds refund functionality for initial token offerings to [ERC-20](./eip-20.md), [ERC-721](./eip-721.md), and [ERC-1155](./eip-1155.md). 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.

## Motivation

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.

A standard interface for this particular use case allows for certain benefits:

- Greater Compliance with EU &quot;Distance Selling Regulations,&quot; which require a 14-day refund period for goods (such as tokens) purchased online
- Interoperability with various NFT-related applications, such as portfolio browsers, and marketplaces
  - 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
  - DExes could offer to refund tokens if doing so would give a higher yield
- Better wallet confirmation dialogs
  - 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
  - DAOs can better display the functionality of smart proposals that include refunding tokens

## Specification

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.

All implementations MUST use and follow the directions of [ERC-165](./eip-165.md).

### ERC-20 Refund Extension
  
```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.17;

import &quot;ERC20.sol&quot;;
import &quot;ERC165.sol&quot;;

/// @notice Refundable ERC-20 tokens
/// @dev    The ERC-165 identifier of this interface is `0xf0ca2917`
interface ERC20Refund is ERC20, ERC165 {
    /// @notice           Emitted when a token is refunded
    /// @dev              Emitted by `refund`
    /// @param  _from     The account whose assets are refunded
    /// @param  _amount   The amount of token (in terms of the indivisible unit) that was refunded
    event Refund(
        address indexed _from,
        uint256 indexed _amount
    );

    /// @notice           Emitted when a token is refunded
    /// @dev              Emitted by `refundFrom`
    /// @param  _sender   The account that sent the refund
    /// @param  _from     The account whose assets are refunded
    /// @param  _amount   The amount of token (in terms of the indivisible unit) that was refunded
    event RefundFrom(
        address indexed _sender,
        address indexed _from,
        uint256 indexed _amount
    );

    /// @notice         As long as the refund is active, refunds the user
    /// @dev            Make sure to check that the user has the token, and be aware of potential re-entrancy vectors
    /// @param  amount  The `amount` to refund
    function refund(uint256 amount) external;

    /// @notice         As long as the refund is active and the sender has sufficient approval, refund the tokens and send the ether to the sender
    /// @dev            Make sure to check that the user has the token, and be aware of potential re-entrancy vectors
    ///                 The ether goes to msg.sender.
    /// @param  from    The user from which to refund the assets
    /// @param  amount  The `amount` to refund
    function refundFrom(address from, uint256 amount) external;

    /// @notice         Gets the refund price
    /// @return _wei    The amount of ether (in wei) that would be refunded for a single token unit (10**decimals indivisible units)
    function refundOf() external view returns (uint256 _wei);
 
    /// @notice         Gets the first block for which the refund is not active
    /// @return block   The first block where the token cannot be refunded
    function refundDeadlineOf() external view returns (uint256 block);
}
```

### ERC-721 Refund Extension
  
```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.17;

import &quot;ERC721.sol&quot;;
import &quot;ERC165.sol&quot;;

/// @notice Refundable ERC-721 tokens
/// @dev    The ERC-165 identifier of this interface is `0xe97f3c83`
interface ERC721Refund is ERC721 /* , ERC165 */ {
    /// @notice           Emitted when a token is refunded
    /// @dev              Emitted by `refund`
    /// @param  _from     The account whose assets are refunded
    /// @param  _tokenId  The `tokenId` that was refunded
    event Refund(
        address indexed _from,
        uint256 indexed _tokenId
    );

    /// @notice           Emitted when a token is refunded
    /// @dev              Emitted by `refundFrom`
    /// @param  _sender   The account that sent the refund
    /// @param  _from     The account whose assets are refunded
    /// @param  _tokenId  The `tokenId` that was refunded
    event RefundFrom(
        address indexed _sender,
        address indexed _from,
        uint256 indexed _tokenId
    );

    /// @notice         As long as the refund is active for the given `tokenId`, refunds the user
    /// @dev            Make sure to check that the user has the token, and be aware of potential re-entrancy vectors
    /// @param  tokenId The `tokenId` to refund
    function refund(uint256 tokenId) external;

    /// @notice         As long as the refund is active and the sender has sufficient approval, refund the token and send the ether to the sender
    /// @dev            Make sure to check that the user has the token, and be aware of potential re-entrancy vectors
    ///                 The ether goes to msg.sender.
    /// @param  from    The user from which to refund the token
    /// @param  tokenId The `tokenId` to refund
    function refundFrom(address from, uint256 tokenId) external;

    /// @notice         Gets the refund price of the specific `tokenId`
    /// @param  tokenId The `tokenId` to query
    /// @return _wei    The amount of ether (in wei) that would be refunded
    function refundOf(uint256 tokenId) external view returns (uint256 _wei);
 
    /// @notice         Gets the first block for which the refund is not active for a given `tokenId`
    /// @param  tokenId The `tokenId` to query
    /// @return block   The first block where token cannot be refunded
    function refundDeadlineOf(uint256 tokenId) external view returns (uint256 block);
}
```

#### Optional ERC-721 Batch Refund Extension

```solidity
// SPDX-License-Identifier: CC0-1.0;

import &quot;ERC721Refund.sol&quot;;

/// @notice Batch Refundable ERC-721 tokens
/// @dev    The ERC-165 identifier of this interface is ``
contract ERC721BatchRefund is ERC721Refund {
    /// @notice           Emitted when one or more tokens are batch refunded
    /// @dev              Emitted by `refundBatch`
    /// @param  _from     The account whose assets are refunded
    /// @param  _tokenId  The `tokenIds` that were refunded
    event RefundBatch(
        address indexed _from,
        uint256[] _tokenIds // This may or may not be indexed
    );

    /// @notice           Emitted when one or more tokens are batch refunded
    /// @dev              Emitted by `refundFromBatch`
    /// @param  _sender   The account that sent the refund
    /// @param  _from     The account whose assets are refunded
    /// @param  _tokenId  The `tokenId` that was refunded
    event RefundFromBatch(
        address indexed _sender,
        address indexed _from,
        uint256 indexed _tokenId
    );
    
    /// @notice           As long as the refund is active for the given `tokenIds`, refunds the user
    /// @dev              Make sure to check that the user has the tokens, and be aware of potential re-entrancy vectors
    ///                   These must either succeed or fail together; there are no partial refunds.
    /// @param  tokenIds  The `tokenId`s to refund
    function refundBatch(uint256[] tokenIds) external;

    /// @notice           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
    /// @dev              Make sure to check that the user has the tokens, and be aware of potential re-entrancy vectors
    ///                   The ether goes to msg.sender.
    ///                   These must either succeed or fail together; there are no partial refunds.
    /// @param  from      The user from which to refund the token
    /// @param  tokenIds  The `tokenId`s to refund
    function refundFromBatch(address from, uint256[] tokenIds) external;
}
```

### ERC-1155 Refund Extension
  
```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.17;

import &quot;ERC1155.sol&quot;;
import &quot;ERC165.sol&quot;;

/// @notice Refundable ERC-1155 tokens
/// @dev    The ERC-165 identifier of this interface is `0x94029f5c`
interface ERC1155Refund is ERC1155 /* , ERC165 */ {
    /// @notice           Emitted when a token is refunded
    /// @dev              Emitted by `refund`
    /// @param  _from     The account that requested a refund
    /// @param  _tokenId  The `tokenId` that was refunded
    /// @param  _amount   The amount of `tokenId` that was refunded
    event Refund(
        address indexed _from,
        uint256 indexed _tokenId,
        uint256 _amount
    );

    /// @notice           Emitted when a token is refunded
    /// @dev              Emitted by `refundFrom`
    /// @param  _sender   The account that sent the refund
    /// @param  _from     The account whose assets are refunded
    /// @param  _tokenId  The `tokenId` that was refunded
    /// @param  _amount   The amount of `tokenId` that was refunded
    event RefundFrom(
        address indexed _sender,
        address indexed _from,
        uint256 indexed _tokenId
    );

    /// @notice         As long as the refund is active for the given `tokenId`, refunds the user
    /// @dev            Make sure to check that the user has enough tokens, and be aware of potential re-entrancy vectors
    /// @param  tokenId The `tokenId` to refund
    /// @param  amount  The amount of `tokenId` to refund
    function refund(uint256 tokenId, uint256 amount) external;

    /// @notice         As long as the refund is active and the sender has sufficient approval, refund the tokens and send the ether to the sender
    /// @dev            Make sure to check that the user has enough tokens, and be aware of potential re-entrancy vectors
    ///                 The ether goes to msg.sender.
    /// @param  from    The user from which to refund the token
    /// @param  tokenId The `tokenId` to refund
    /// @param  amount  The amount of `tokenId` to refund
    function refundFrom(address from, uint256 tokenId, uint256 amount) external;

    /// @notice         Gets the refund price of the specific `tokenId`
    /// @param  tokenId The `tokenId` to query
    /// @return _wei    The amount of ether (in wei) that would be refunded for a single token
    function refundOf(uint256 tokenId) external view returns (uint256 _wei);

    /// @notice         Gets the first block for which the refund is not active for a given `tokenId`
    /// @param  tokenId The `tokenId` to query
    /// @return block   The first block where the token cannot be refunded
    function refundDeadlineOf(uint256 tokenId) external view returns (uint256 block);
}
```

#### Optional ERC-1155 Batch Refund Extension

```solidity
// SPDX-License-Identifier: CC0-1.0;

import &quot;ERC1155Refund.sol&quot;;

/// @notice Batch Refundable ERC-1155 tokens
/// @dev    The ERC-165 identifier of this interface is ``
contract ERC1155BatchRefund is ERC1155Refund {
    /// @notice           Emitted when one or more tokens are batch refunded
    /// @dev              Emitted by `refundBatch`
    /// @param  _from     The account that requested a refund
    /// @param  _tokenIds The `tokenIds` that were refunded
    /// @param  _amounts  The amount of each `tokenId` that was refunded
    event RefundBatch(
        address indexed _from,
        uint256[] _tokenIds, // This may or may not be indexed
        uint256[] _amounts
    );

    /// @notice           Emitted when one or more tokens are batch refunded
    /// @dev              Emitted by `refundFromBatch`
    /// @param  _sender   The account that sent the refund
    /// @param  _from     The account whose assets are refunded
    /// @param  _tokenIds The `tokenIds` that was refunded
    /// @param  _amounts  The amount of each `tokenId` that was refunded
    event RefundFromBatch(
        address indexed _sender,
        address indexed _from,
        uint256[] _tokenId, // This may or may not be indexed
        uint256[] _amounts
    );
    
    /// @notice           As long as the refund is active for the given `tokenIds`, refunds the user
    /// @dev              Make sure to check that the user has enough tokens, and be aware of potential re-entrancy vectors
    ///                   These must either succeed or fail together; there are no partial refunds.
    /// @param  tokenIds  The `tokenId`s to refund
    /// @param  amounts   The amount of each `tokenId` to refund
    function refundBatch(uint256[] tokenIds, uint256[] amounts) external;

    /// @notice           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
    /// @dev              Make sure to check that the user has the tokens, and be aware of potential re-entrancy vectors
    ///                   The ether goes to msg.sender.
    ///                   These must either succeed or fail together; there are no partial refunds.
    /// @param  from      The user from which to refund the token
    /// @param  tokenIds  The `tokenId`s to refund
    /// @param  amounts   The amount of each `tokenId` to refund
    function refundFromBatch(address from, uint256[] tokenIds, uint256[] amounts external;
}
```

## Rationale

`refundDeadlineOf` uses blocks instead of timestamps, as timestamps are less reliable than block numbers.

The function names of `refund`, `refundOf`, and `refundDeadlineOf` were chosen to fit the naming style of ERC-20, ERC-721, and ERC-1155.

[ERC-165](./eip-165.md) is required as introspection by DApps would be made significantly harder if it were not.

Custom ERC-20 tokens are not supported, as it needlessly increases complexity, and the `refundFrom` function allows for this functionality when combined with a DEx.

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.

## Backwards Compatibility

No backward compatibility issues were found.

## Security Considerations

There is a potential re-entrancy risk with the `refund` function. Make sure to perform the ether transfer **after** the tokens are destroyed (i.e. obey the checks, effects, interactions pattern).

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 19 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5507</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5507</guid>
      </item>
    
      <item>
        <title>Soulbound Multi-owner Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/EIP-5516-soulbound-multi-token-standard/10485</comments>
        
        <description>## Abstract

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.

## Motivation

This EIP was inspired by the main characteristics of the [ERC-1155](./eip-1155.md) token standard and by articles in which benefits and potential use cases of Soulbound/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.

### Characteristics

- The NFT will be non-transferable after the initial transfer
- Multi-Token
- Multi-Owner
- Semi-Fungible

### Applications

- Academic Degrees
- Code audits
- POAPs (Proof of Attendance Protocol NFTs)

## Specification

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.

**Smart contracts implementing this EIP MUST implement all of the functions in the [ERC-5516](./eip-5516.md) interface.**

**Smart contracts implementing this EIP MUST implement the [EIP-165](./eip-165.md) `supportsInterface` function and MUST return the constant value `true` if `0x45b253ba` is passed through the `interfaceID` argument.**

```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.4;

/**
    @title Soulbound, Multi-Token standard.
    @notice Interface of the EIP-5516
    Note: The ERC-165 identifier for this interface is 0x45b253ba.
 */

interface IERC5516 {
    /**
     * @dev Emitted when `issuer` creates a new soulbound token and distributes it to `recipients[]`.
     *
     * @param tokenId The unique identifier of the newly created token.
     * @param issuer The address of the entity that issued the credential.
     * @param recipients Array of addresses that received the soulbound token.
     * @param metadataURI URI pointing to the token metadata (e.g., IPFS hash).
     */
    event Issued(
        uint256 indexed tokenId,
        address indexed issuer,
        address[] recipients,
        string metadataURI
    );

    /**
     * @dev Emitted when `who` voluntarily renounces their soulbound token under `tokenId`.
     *
     * @param tokenId The unique identifier of the renounced token.
     * @param who The address that renounced ownership of the token.
     */
    event Renounced(uint256 indexed tokenId, address indexed who);

    /**
     * @dev Issues a new soulbound token to multiple recipients.
     *
     * Creates a unique token identifier and distributes it to all addresses in `recipients[]`.
     * The token is non-transferable after issuance.
     *
     * Requirements:
     * - `recipients[]` MUST NOT be empty.
     * - All addresses in `recipients[]` MUST be non-zero.
     * - All addresses in `recipients[]` MUST NOT already own a token under the generated `tokenId`.
     * - Caller MUST be an authorized issuer.
     *
     * Emits an {Issued} event.
     *
     * @param recipients Array of addresses that will receive the soulbound token.
     * @param metadataURI URI pointing to the token metadata (IPFS, Arweave, HTTP, etc.).
     * @return tokenId The unique identifier of the newly created token.
     */
    function issue(
        address[] memory recipients,
        string calldata metadataURI
    ) external returns (uint256 tokenId);

    /**
     * @dev Allows the token holder to voluntarily renounce their soulbound token.
     *
     * Once renounced, the holder no longer owns the token and cannot reclaim it.
     * This action is irreversible.
     *
     * Requirements:
     * - Caller MUST own the token under `tokenId`.
     * - `tokenId` MUST exist.
     *
     * Emits a {Renounced} event.
     *
     * @param tokenId The unique identifier of the token to renounce.
     */
    function renounce(uint256 tokenId) external;

    /**
     * @dev Checks if a given address owns a specific soulbound token.
     *
     * @param who The address to check ownership for.
     * @param tokenId The unique identifier of the token.
     * @return True if `who` owns the token under `tokenId`, false otherwise.
     */
    function has(address who, uint256 tokenId) external view returns (bool);

    /**
     * @dev Returns the URI for a given token ID.
     *
     * The URI typically points to a JSON file containing token metadata.
     * This may be an IPFS hash, Arweave transaction ID, or HTTP URL.
     *
     * Requirements:
     * - `tokenId` MUST exist.
     *
     * @param tokenId The unique identifier of the token.
     * @return The complete URI string for the token metadata.
     */
    function uri(uint256 tokenId) external view returns (string memory);
}
```

## Rationale

### [ERC-5516](./eip-5516.md) as certificates

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 [ERC-1155](./eip-1155.md) partial-compatible implementation.

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 [ERC-1155](./eip-1155.md).

### SBT as a _spinoff_ of [EIP-1155](./eip-1155.md)

We saw the vision of the [ERC-1155](./eip-1155.md#metadata) and tried to apply it to Soulbound/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.

### Metadata.

We implement a standard method of obtaining metadata (`uri`) similar to the one defined in [ERC-1155](./eip-1155.md#metadata):

The URI value allows for ID substitution by clients. If the string `{id}` 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.

- The string format of the substituted hexadecimal ID MUST be lowercase alphanumeric: `[0-9a-f]` with no 0x prefix.
- 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: `https://token-cdn-domain/{id}.json` would be replaced with `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` if the client is referring to token ID 314592/0x4CCE0.

### Guaranteed log trace

The [ERC-5516](./eip-5516.md) 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-5516](./eip-5516.md) token in the contract.

### Exception handling

Given the non-transferability property of SBTs, if a user&apos;s keys to an account get compromised or rotated, such user may lose the ability to associate themselves with the token.

**Given the multi-owner characteristic of this EIP, SBTs will be able to bind to multiple accounts, providing a potential solution to the issue.**

Multi-owner SBTs can also be issued to a contract account that implements a multi-signature functionality (As recommended in [EIP-4973](./eip-4973.md#exception-handling)).

### Multi-token

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.

## Backwards Compatibility

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 `[address,id]`).

## Reference Implementation

You can find an implementation of this standard [here](../assets/eip-5516/ERC5516.sol).

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 19 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5516</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5516</guid>
      </item>
    
      <item>
        <title>Referable NFT</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-x-erc-721-referable-nft/10310</comments>
        
        <description>## Abstract

This standard is an extension of [ERC-721](./eip-721.md). It proposes two referable indicators, referring and referred, and a time-based indicator `createdTimestamp`. The relationship between each NFT forms a directed acyclic graph (DAG). The standard allows users to query, track and analyze their relationships.


![System Architecture](../assets/eip-5521/system-arch.png)


## Motivation

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.

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.

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 `referring` and `referred` 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. 

An intuitive example: users can create new NFTs (C, D, E) by referencing existing ones (A, B), while the `referred` function informs the original NFTs (A, B) about their citations (e.g., A &amp;#8592; D; C &amp;#8592; E; B &amp;#8592; E, and A &amp;#8592; E). Here, the `createdTimestamp` (block-level) serves as an indicator for the creation time of NFTs (A, B, C, D, E).

### Key Takeaways

This standard provides several advantages:

*Clear ownership inheritance*: 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.

*Incentive Compatibility*: 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.

*Easy Integration*: 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. [ERC-5006](./eip-5006.md) 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). 

*Scalable Interoperability*: This standard enables cross-contract references, giving a scalable adoption for the broader public with stronger interoperability.


## Specification

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.

- `UpdateNode`: event emitted when `setNode` is invoked;
- `safeMint`: mint a new rNFT;
- `setNode`: set the referring list of an rNFT and update the referred list of each one in the referring list;
    - `setNodeReferring`: set the referring list of an rNFT;
    - `setNodeReferred`: set the referred list of the given rNFTs sourced from different contracts;
        - `setNodeReferredExternal`: set the referred list of the given rNFTs sourced from external contracts;
- `referringOf`: get the referring list of an rNFT;
- `referredOf`: get the referred list of an rNFT;
- `createdTimestampOf`: get the timestamp of an rNFT when it is being created.

Implementers of this standard **MUST** have all of the following functions:

```solidity

pragma solidity ^0.8.4;

import &quot;@openzeppelin/contracts/utils/introspection/IERC165.sol&quot;;

interface IERC_5521 is IERC165 {

    /// Logged when a node in the rNFT gets referred and changed.
    /// @notice Emitted when the `node` (i.e., an rNFT) is changed.
    event UpdateNode(uint256 indexed tokenId, 
                     address indexed owner, 
                     address[] _address_referringList,
                     uint256[][] _tokenIds_referringList,
                     address[] _address_referredList,
                     uint256[][] _tokenIds_referredList
    );

    /// @notice 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**.
    /// @param `tokenId` of rNFT being set. `addresses` of the contracts in which rNFTs with `tokenIds` being referred accordingly. 
    /// @requirement 
    /// - the size of `addresses` **MUST** be the same as that of `tokenIds`;
    /// - once the size of `tokenIds` is non-zero, the inner size **MUST** also be non-zero;
    /// - the `tokenId` **MUST** be unique within the same contract;
    /// - the `tokenId` **MUST NOT** be the same as `tokenIds[i][j]` if `addresses[i]` is essentially `address(this)`.
    function setNode(uint256 tokenId, address[] memory addresses, uint256[][] memory tokenIds) external;

    /// @notice get the referring list of an rNFT.
    /// @param `tokenId` of the rNFT being focused, `_address` of contract address associated with the focused rNFT.
    /// @return the referring mapping of the rNFT.
    function referringOf(address _address, uint256 tokenId) external view returns(address[] memory, uint256[][] memory);

    /// @notice get the referred list of an rNFT.
    /// @param `tokenId` of the rNFT being focused, `_address` of contract address associated with the focused rNFT.
    /// @return the referred mapping of the rNFT.
    function referredOf(address _address, uint256 tokenId) external view returns(address[] memory, uint256[][] memory);

    /// @notice get the timestamp of an rNFT when is being created.
    /// @param `tokenId` of the rNFT being focused, `_address` of contract address associated with the focused rNFT.
    /// @return the timestamp of the rNFT when is being created with uint256 format.
    function createdTimestampOf(address _address, uint256 tokenId) external view returns(uint256);
    
    /// @notice check supported interfaces, adhereing to ERC165.
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

interface TargetContract is IERC165 {
    /// @notice set the referred list of an rNFT associated with external contract addresses. 
    /// @param `_tokenIds` of rNFTs associated with the contract address `_address` being referred by the rNFT with `tokenId`.
    /// @requirement
    /// - `_address` **MUST NOT** be the same as `address(this)` where `this` is executed by an external contract where `TargetContract` interface is implemented.
    function setNodeReferredExternal(address _address, uint256 tokenId, uint256[] memory _tokenIds) external;

    function referringOf(address _address, uint256 tokenId) external view returns(address[] memory, uint256[][] memory);

    function referredOf(address _address, uint256 tokenId) external view returns(address[] memory, uint256[][] memory);

    function createdTimestampOf(address _address, uint256 tokenId) external view returns(uint256);
    
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

```

## Rationale

### Is this event informative enough? 
`UpdateNode`: This event disseminates crucial information, including the rNFT ID, its owner, and lists of contract addresses/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.

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 `UpdateNode` event.

### Why `createdTimestampOf`?
`createdTimestamp`: 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 `createdTimestamp = block.timestamp` 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.


### How is cross-contract reference performed?
`setNodeReferredExternal`: 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.



## Backwards Compatibility

This standard can be fully [ERC-721](./eip-721.md) compatible by adding an extension function set.

## Test Cases

Test cases are included in [ERC_5521.test.js](../assets/eip-5521/ERC_5521.test.js)

## Reference Implementation

The recommended implementation is demonstrated as follows:

- `Relationship`: a structure that contains `referring`, `referred`, `referringKeys`, `referredKeys`, `createdTimestamp`, and other customized and optional attributes (i.e., not necessarily included in the standard) such as `privityOfAgreement` recording the ownerships of referred NFTs at the time the Referable NFTs (rNFTs) were being created or `profitSharing` recording the profit sharing of `referring`.
- `referring`: an out-degree indicator, used to show the users this NFT refers to;
- `referred`: an in-degree indicator, used to show the users who have refereed this NFT;
- `referringKeys`: a helper for mapping conversion of out-degree indicators, used for events;
- `referredKeys`: a helper for mapping conversion of in-degree indicators, used for events;
- `createdTimestamp`: a time-based indicator, used to compare the timestamp of mint, which should not be editable anyhow by callers.
- `referringOf` and `referredOf`: First, the current `referringOf` and `referredOf` allow cross-contract looking up, while this cannot be done by directly accessing `_relationship`. Secondly, only if privacy is not a concern, making `_relationship` 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 `_relationship` includes details about specific users’ interactions or transactions or some private extensible parameters (in the updated version, we specifically highlight the `Relationship` can be extended to meet different requirements), always making this data public could reveal users’ behavior patterns or preferences, leading to potential privacy breaches.
- `convertMap`: This function is essential for retrieving the full mapping contents within a struct. Even if `_relationship` is public, The getters only allow retrieval of individual values for specific keys. Since we need comprehensive access to all stored addresses, `convertMap` is necessary to fulfill our event emission requirements.

```solidity

pragma solidity ^0.8.4;

import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;./IERC_5521.sol&quot;;

contract ERC_5521 is ERC721, IERC_5521, TargetContract {

    struct Relationship {
        mapping (address =&gt; uint256[]) referring;
        mapping (address =&gt; uint256[]) referred;
        address[] referringKeys;
        address[] referredKeys;
        uint256 createdTimestamp; // unix timestamp when the rNFT is being created

        // extensible parameters
        // ...
    }

    mapping (uint256 =&gt; Relationship) internal _relationship;
    address contractOwner = address(0);

    constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) {
        contractOwner = msg.sender;
    }

    function safeMint(uint256 tokenId, address[] memory addresses, uint256[][] memory _tokenIds) public {
        // require(msg.sender == contractOwner, &quot;ERC_rNFT: Only contract owner can mint&quot;);
        _safeMint(msg.sender, tokenId);
        setNode(tokenId, addresses, _tokenIds);
    }

    /// @notice set the referred list of an rNFT associated with different contract addresses and update the referring list of each one in the referred list
    /// @param tokenIds array of rNFTs, recommended to check duplication at the caller&apos;s end
    function setNode(uint256 tokenId, address[] memory addresses, uint256[][] memory tokenIds) public virtual override {
        require(
            addresses.length == tokenIds.length,
            &quot;Addresses and TokenID arrays must have the same length&quot;
        );
        for (uint i = 0; i &lt; tokenIds.length; i++) {
            if (tokenIds[i].length == 0) { revert(&quot;ERC_5521: the referring list cannot be empty&quot;); }
        }
        setNodeReferring(addresses, tokenId, tokenIds);
        setNodeReferred(addresses, tokenId, tokenIds);
    }

    /// @notice set the referring list of an rNFT associated with different contract addresses 
    /// @param _tokenIds array of rNFTs associated with addresses, recommended to check duplication at the caller&apos;s end
    function setNodeReferring(address[] memory addresses, uint256 tokenId, uint256[][] memory _tokenIds) private {
        require(_isApprovedOrOwner(msg.sender, tokenId), &quot;ERC_5521: transfer caller is not owner nor approved&quot;);

        Relationship storage relationship = _relationship[tokenId];

        for (uint i = 0; i &lt; addresses.length; i++) {
            if (relationship.referring[addresses[i]].length == 0) { relationship.referringKeys.push(addresses[i]); } // Add the address if it&apos;s a new entry
            relationship.referring[addresses[i]] = _tokenIds[i];
        }

        relationship.createdTimestamp = block.timestamp;
        emitEvents(tokenId, msg.sender);
    }

    /// @notice set the referred list of an rNFT associated with different contract addresses 
    /// @param _tokenIds array of rNFTs associated with addresses, recommended to check duplication at the caller&apos;s end
    function setNodeReferred(address[] memory addresses, uint256 tokenId, uint256[][] memory _tokenIds) private {
        for (uint i = 0; i &lt; addresses.length; i++) {
            if (addresses[i] == address(this)) {
                for (uint j = 0; j &lt; _tokenIds[i].length; j++) {
                    Relationship storage relationship = _relationship[_tokenIds[i][j]];
                    if (relationship.referred[addresses[i]].length == 0) { relationship.referredKeys.push(addresses[i]); } // Add the address if it&apos;s a new entry
                    
                    require(tokenId != _tokenIds[i][j], &quot;ERC_5521: self-reference not allowed&quot;);
                    if (relationship.createdTimestamp &gt;= block.timestamp) { revert(&quot;ERC_5521: the referred rNFT needs to be a predecessor&quot;); } // Make sure the reference complies with the timing sequence

                    relationship.referred[address(this)].push(tokenId);
                    emitEvents(_tokenIds[i][j], ownerOf(_tokenIds[i][j]));
                }
            } else {
                TargetContract targetContractInstance = TargetContract(addresses[i]);
                bool isSupports = targetContractInstance.supportsInterface(type(TargetContract).interfaceId);
                if (isSupports) {
                    // The target contract supports the interface, safe to call functions of the interface.
                    targetContractInstance.setNodeReferredExternal(address(this), tokenId, _tokenIds[i]);
                }
            }
        }
    }

    /// @notice set the referred list of an rNFT associated with different contract addresses 
    /// @param _tokenIds array of rNFTs associated with addresses, recommended to check duplication at the caller&apos;s end
    function setNodeReferredExternal(address _address, uint256 tokenId, uint256[] memory _tokenIds) external {
        for (uint i = 0; i &lt; _tokenIds.length; i++) {
            Relationship storage relationship = _relationship[_tokenIds[i]];
            if (relationship.referred[_address].length == 0) { relationship.referredKeys.push(_address); } // Add the address if it&apos;s a new entry

            require(_address != address(this), &quot;ERC_5521: this must be an external contract address&quot;);
            if (relationship.createdTimestamp &gt;= block.timestamp) { revert(&quot;ERC_5521: the referred rNFT needs to be a predecessor&quot;); } // Make sure the reference complies with the timing sequence

            relationship.referred[_address].push(tokenId);
            emitEvents(_tokenIds[i], ownerOf(_tokenIds[i]));
        }
    }

    /// @notice Get the referring list of an rNFT
    /// @param tokenId The considered rNFT, _address The corresponding contract address
    /// @return The referring mapping of an rNFT
    function referringOf(address _address, uint256 tokenId) external view virtual override(IERC_5521, TargetContract) returns (address[] memory, uint256[][] memory) {
        address[] memory _referringKeys;
        uint256[][] memory _referringValues;

        if (_address == address(this)) {
            require(_exists(tokenId), &quot;ERC_5521: token ID not existed&quot;);
            (_referringKeys, _referringValues) = convertMap(tokenId, true);
        } else {
            TargetContract targetContractInstance = TargetContract(_address);
            require(targetContractInstance.supportsInterface(type(TargetContract).interfaceId), &quot;ERC_5521: target contract not supported&quot;);
            (_referringKeys, _referringValues) = targetContractInstance.referringOf(_address, tokenId);     
        }      
        return (_referringKeys, _referringValues);
    }

    /// @notice Get the referred list of an rNFT
    /// @param tokenId The considered rNFT, _address The corresponding contract address
    /// @return The referred mapping of an rNFT
    function referredOf(address _address, uint256 tokenId) external view virtual override(IERC_5521, TargetContract) returns (address[] memory, uint256[][] memory) {
        address[] memory _referredKeys;
        uint256[][] memory _referredValues;

        if (_address == address(this)) {
            require(_exists(tokenId), &quot;ERC_5521: token ID not existed&quot;);
            (_referredKeys, _referredValues) = convertMap(tokenId, false);
        } else {
            TargetContract targetContractInstance = TargetContract(_address);
            require(targetContractInstance.supportsInterface(type(TargetContract).interfaceId), &quot;ERC_5521: target contract not supported&quot;);
            (_referredKeys, _referredValues) = targetContractInstance.referredOf(_address, tokenId);           
        }
        return (_referredKeys, _referredValues);
    }

    /// @notice Get the timestamp of an rNFT when is being created.
    /// @param `tokenId` of the rNFT being focused, `_address` of contract address associated with the focused rNFT.
    /// @return The timestamp of the rNFT when is being created with uint256 format.
    function createdTimestampOf(address _address, uint256 tokenId) external view returns(uint256) {
        uint256 memory createdTimestamp;

        if (_address == address(this)) {
            require(_exists(tokenId), &quot;ERC_5521: token ID not existed&quot;);
            Relationship storage relationship = _relationship[tokenId];
            createdTimestamp = relationship.createdTimestamp;
        } else {
            TargetContract targetContractInstance = TargetContract(_address);
            require(targetContractInstance.supportsInterface(type(TargetContract).interfaceId), &quot;ERC_5521: target contract not supported&quot;);
            createdTimestamp = targetContractInstance.createdTimestampOf(_address, tokenId);            
        }
        return createdTimestamp;
    }

    /// @dev See {IERC165-supportsInterface}.
    function supportsInterface(bytes4 interfaceId) public view virtual override (ERC721, IERC_5521, TargetContract) returns (bool) {
        return interfaceId == type(IERC_5521).interfaceId
            || interfaceId == type(TargetContract).interfaceId
            || super.supportsInterface(interfaceId);    
    }

    // @notice Emit an event of UpdateNode
    function emitEvents(uint256 tokenId, address sender) private {
        (address[] memory _referringKeys, uint256[][] memory _referringValues) = convertMap(tokenId, true);
        (address[] memory _referredKeys, uint256[][] memory _referredValues) = convertMap(tokenId, false);
        
        emit UpdateNode(tokenId, sender, _referringKeys, _referringValues, _referredKeys, _referredValues);
    }

    // @notice Convert a specific `local` token mapping to a key array and a value array
    function convertMap(uint256 tokenId, bool isReferring) private view returns (address[] memory, uint256[][] memory) {
        Relationship storage relationship = _relationship[tokenId];

        address[] memory returnKeys;
        uint256[][] memory returnValues;

        if (isReferring) {
            returnKeys = relationship.referringKeys;
            returnValues = new uint256[][](returnKeys.length);
            for (uint i = 0; i &lt; returnKeys.length; i++) {
                returnValues[i] = relationship.referring[returnKeys[i]];
            }            
        } else {
            returnKeys = relationship.referredKeys;
            returnValues = new uint256[][](returnKeys.length);
            for (uint i = 0; i &lt; returnKeys.length; i++) {
                returnValues[i] = relationship.referred[returnKeys[i]];
            }
        }
        return (returnKeys, returnValues);
    }
}

```


## Security Considerations

### Timestamp

The `createdTimestamp` only covers the block-level timestamp (based on block headers), which does not support fine-grained comparisons such as transaction-level.

### Ownership and Reference

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.

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 `referring` to explicitly define the distribution of profits.

### Open Minting and Relationship Risks

The `safeMint` 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&apos;s flexibility against potential reliability concerns. 

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 10 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5521</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5521</guid>
      </item>
    
      <item>
        <title>Refundable Fungible Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5528-refundable-token-standard/10494</comments>
        
        <description>## Abstract

This standard is an extension of [EIP-20](./eip-20.md). This specification defines a type of escrow service with the following flow:

- The seller issues tokens.
- The seller creates an escrow smart contract with detailed escrow information like contract addresses, lock period, exchange rate, additional escrow success conditions, etc.
- The seller funds seller tokens to the *Escrow Contract*.
- Buyers fund buyer tokens which are pre-defined in the *Escrow Contract*.
- When the escrow status meets success, the seller can withdraw buyer tokens, and buyers can withdraw seller tokens based on exchange rates.
- Buyers can withdraw (or refund) their funded token if the escrow process is failed or is in the middle of the escrow process.

## Motivation

Because of the pseudonymous nature of cryptocurrencies, there is no automatic recourse to recover funds that have already been paid.

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.

## Specification

There are two types of contract for the escrow process:

- *Payable Contract*: The sellers and buyers use this token to fund the *Escrow Contract*. This contract MUST override [EIP-20](./eip-20.md) interfaces.
- *Escrow Contract*: Defines the escrow policies and holds *Payable Contract*&apos;s token for a certain period. This contract does not requires override [EIP-20](./eip-20.md) interfaces.

### Methods

#### `constructor`

The *Escrow Contract* demonstrates details of escrow policies as none-mutable matter in constructor implementation.

The *Escrow Contract* MUST define the following policies:

- Seller token contract address
- Buyer token contract address

The *Escrow Contract* MAY define the following policies:

- Escrow period
- Maximum (or minimum) number of investors
- Maximum (or minimum) number of tokens to fund
- Exchange rates of seller/buyer token
- KYC verification of users

#### `escrowFund`

Funds `_value` amount of tokens to address `_to`.

In the case of *Escrow Contract*:

 - `_to` MUST be the user address.
 - `msg.sender` MUST be the *Payable Contract* address.
 - MUST check policy validations.

In the case of *Payable Contract*:

  - The address `_to` MUST be the *Escrow Contract* address.
  - MUST call the same function of the *Escrow Contract* interface. The parameter `_to` MUST be `msg.sender` to recognize the user address in the *Escrow Contract*.

```solidity
function escrowFund(address _to, uint256 _value) public returns (bool)
```

#### `escrowRefund`

Refunds `_value` amount of tokens from address `_from`.

In the case of *Escrow Contract*:

 - `_from` MUST be the user address.
 - `msg.sender` MUST be the *Payable Contract* address.
 - MUST check policy validations.

In the case of *Payable Contract*:

  - The address `_from` MUST be the *Escrow Contract* address.
  - MUST call the same function of the *Escrow Contract* interface. The parameter `_from` MUST be `msg.sender` to recognize the user address in the *Escrow Contract*.

```solidity
function escrowRefund(address _from, uint256 _value) public returns (bool)
```

#### `escrowWithdraw`

Withdraws funds from the escrow account.

In the case of *Escrow Contract*:

 - MUST check the escrow process is completed.
 - MUST send the remaining balance of seller and buyer tokens to `msg.sender`&apos;s seller and buyer contract wallets.

In the case of *Payable Contract*, it is optional.

```solidity
function escrowWithdraw() public returns (bool)
```

### Example of interface

This example demonstrates simple exchange of one seller and one buyer in one-to-one exchange rates.

```solidity
pragma solidity ^0.4.20;

interface IERC5528 {

    function escrowFund(address _to, uint256 _value) public returns (bool);

    function escrowRefund(address _from, uint256 _value) public returns (bool);

    function escrowWithdraw() public returns (bool);

}

contract PayableContract is IERC5528, IERC20 {
    /*
      General ERC20 implementations
    */

    function _transfer(address from, address to, uint256 amount) internal {
        uint256 fromBalance = _balances[from];
        require(fromBalance &gt;= amount, &quot;ERC20: transfer amount exceeds balance&quot;);
        _balances[from] = fromBalance - amount;
        _balances[to] += amount;
    }

    function transfer(address to, uint256 amount) public returns (bool) {
        address owner = msg.sender;
        _transfer(owner, to, amount);
        return true;
    }

    function escrowFund(address _to, uint256 _value) public returns (bool){
        bool res = IERC5528(to).escrowFund(msg.sender, amount);
        require(res, &quot;Fund Failed&quot;);
        _transfer(msg.sender, to, amount);
        return true;
    }

    function escrowRefund(address _from, uint256 _value) public returns (bool){
        bool res = IERC5528(_from).escrowRefund(msg.sender, _value);
        require(res, &quot;Refund Failed&quot;);
        _transfer(_from, msg.sender, _value);
        return true;
    }
}

contract EscrowContract is IERC5528 {

    enum State { Inited, Running, Success, Closed }
    struct BalanceData {
        address addr;
        uint256 amount;
    }

    address _addrSeller;
    address _addrBuyer;
    BalanceData _fundSeller;
    BalanceData _fundBuyer;
    EscrowStatus _status;

    constructor(address sellerContract, address buyerContract){
        _addrSeller = sellerContract;
        _addrBuyer = buyerContract;
        _status = State.Inited;
    }

    function escrowFund(address _to, uint256 _value) public returns (bool){
        if(msg.sender == _addrSeller){
            require(_status.state == State.Running, &quot;must be running state&quot;);
            _fundSeller.addr = _to;
            _fundSeller.amount = _value;
            _status = State.Success;
        }else if(msg.sender == _addrBuyer){
            require(_status.state == State.Inited, &quot;must be init state&quot;);
            _fundBuyer.addr = _to;
            _fundBuyer.amount = _value;
            _status = State.Running;
        }else{
            require(false, &quot;Invalid to address&quot;);
        }
        return true;
    }

    function escrowRefund(address _from, uint256 amount) public returns (bool){
        require(_status.state == State.Running, &quot;refund is only available on running state&quot;);
        require(msg.sender == _addrBuyer, &quot;invalid caller for refund&quot;);
        require(_fundBuyer.addr == _from, &quot;only buyer can refund&quot;);
        require(_fundBuyer.amount &gt;= amount, &quot;buyer fund is not enough to refund&quot;);
        _fundBuyer.amount = _fundBuyer.amount - amount
        return true;
    }

    function escrowWithdraw() public returns (bool){
        require(_status.state == State.Success, &quot;withdraw is only available on success state&quot;);
        uint256 common = MIN(_fundBuyer.amount, _fundSeller.amount);

        if(common &gt; 0){
            _fundBuyer.amount = _fundBuyer.amount - common;
            _fundSeller.amount = _fundSeller.amount - common;

            // Exchange
            IERC5528(_addrSeller).transfer(_fundBuyer.addr, common);
            IERC5528(_addrBuyer).transfer(_fundSeller.addr, common);

            // send back the remaining balances
            if(_fundBuyer.amount &gt; 0){
                IERC5528(_addrBuyer).transfer(_fundBuyer.addr, _fundBuyer.amount);
            }
            if(_fundSeller.amount &gt; 0){
                IERC5528(_addrSeller).transfer(_fundSeller.addr, _fundSeller.amount);
            }
        }

        _status = State.Closed;
    }

}

```

## Rationale

The interfaces cover the escrow operation&apos;s refundable issue.

The suggested 3 functions (`escrowFund`, `escrowRefund` and `escrowWithdraw`) are based on `transfer` function in EIP-20.

`escrowFund` send tokens to the *Escrow Contract*. The *Escrow Contract* can hold the contract in the escrow process or reject tokens if the policy does not meet.

`escrowRefund` can be invoked in the middle of the escrow process or when the escrow process fails.

`escrowWithdraw` allows users (sellers and buyers) to transfer tokens from the escrow account. When the escrow process completes, the seller can get the buyer&apos;s token, and the buyers can get the seller&apos;s token.

## Backwards Compatibility

The *Payable Contract* which implements this EIP is fully backward compatible with the [EIP-20](./eip-20.md) specification.

## Test Cases

[Unit test example by truffle](../assets/eip-5528/truffule-test.js).

This test case demonstrates the following conditions for exchanging seller/buyer tokens.

- The exchange rate is one-to-one.
- If the number of buyers reaches 2, the escrow process will be terminated(success).
- Otherwise (not meeting success condition yet), buyers can refund (or withdraw) their funded tokens.

## Security Considerations

Since the *Escrow Contract* controls seller and buyer rights, flaws within the *Escrow Contract* will directly lead to unexpected behavior and potential loss of funds.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 16 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5528</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5528</guid>
      </item>
    
      <item>
        <title>Revocation List Registry</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5539-revocation-list-registry/10573</comments>
        
        <description>## Abstract
This EIP proposes a set of methods and standards for a role-based registry of indicators aimed for usage in revocations.

## Motivation
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.

The largest problem with traditional revocation lists is the centralized aspect of them. Most of the world&apos;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.

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.

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.

## Specification
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.

This EIP specifies a contract called `EthereumRevocationRegistry` that is deployed once and may then be commonly used by everyone. By default, an Ethereum address **MAY** own and manage a multitude of revocation lists in a namespace that **MUST** contain the revocation states for a set of revocation keys. 

An owner of a namespace **MAY** allow delegates to manage one or more of its revocation lists. Delegates **MUST** be removable by the respective list&apos;s owner. In certain situations, an owner **MAY** also want to transfer a revocation list in a namespace and its management rights to a new owner.

### Definitions
- `namespace`: 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&apos;s owner address.
- `revocation list`: 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.
- `revocation key`: 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.
- `owner`: 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.
- `delegate`: 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.

### Revocation Management

#### isRevoked
**MUST** implement a function that returns the revocation status of a particular revocation key in a namespace&apos;s revocation list. It **MAY** also respect the revocation lists revocation status.
```solidity
function isRevoked(address namespace, bytes32 list, bytes32 key) public view returns (bool);
```

#### changeStatus
**MUST** implement a function to change the revocation status of a particular revocation key in a namespace&apos;s revocation list
```solidity
function changeStatus(bool revoked, address namespace, bytes32 revocationList, bytes32 revocationKey) public;
```

#### changeStatusSigned ([see Meta Transactions](#MetaTransactions))
**OPTIONAL** implements a function to change the revocation status of a particular revocation key in a namespace&apos;s revocation list with a raw signature.
```solidity
function changeStatusSigned(bool revoked, address namespace, bytes32 revocationList, bytes32 revocationKey, address signer, bytes calldata signature) public;
```

#### changeStatusDelegated
**OPTIONAL** implements a function to change the revocation status of a particular revocation key in a namespace&apos;s revocation list by a revocation list&apos;s delegate.
```solidity
function changeStatusDelegated(bool revoked, address namespace, bytes32 revocationList, bytes32 revocationKey) public;
```

#### changeStatusDelegatedSigned ([see Meta Transactions](#MetaTransactions))
**OPTIONAL** implements a function to change the revocation status of a particular revocation key in a namespace&apos;s revocation list with a raw signature.
```solidity
function changeStatusDelegatedSigned(bool revoked, address namespace, bytes32 revocationList, bytes32 revocationKey, address signer, bytes calldata signature) public;
```

#### changeStatusesInList
**OPTIONAL** implements a function to change multiple revocation statuses in a namespace&apos;s revocation list at once.
```solidity
function changeStatusesInList(bool[] memory revoked, address namespace, bytes32 revocationList, bytes32[] memory revocationKeys) public;
```

#### changeStatusesInListSigned ([see Meta Transactions](#MetaTransactions))
**OPTIONAL** implements a function to change multiple revocation statuses in a namespace&apos;s revocation list at once with a raw signature.
```solidity
function changeStatusesInListSigned(bool[] memory revoked, address namespace, bytes32 revocationList, bytes32[] memory revocationKeys, address signer, bytes calldata signature) public;
```

#### changeStatusesInListDelegated
**OPTIONAL** implements a function to change multiple revocation statuses in a namespace&apos;s revocation list at once by a revocation list&apos;s delegate.
```solidity
function changeStatusesInListDelegated(bool[] memory revoked, address namespace, bytes32 revocationList, bytes32[] memory revocationKeys) public;
```

#### changeStatusesInListDelegatedSigned ([see Meta Transactions](#MetaTransactions))
**OPTIONAL** implements a function to change multiple revocation statuses in a namespace&apos;s revocation list at once with a raw signature generated by a revocation list&apos;s delegate.
```solidity
function changeStatusesInListDelegatedSigned(bool[] memory revoked, address namespace, bytes32 revocationList, bytes32[] memory revocationKeys, address signer, bytes calldata signature) public;
```

### Revocation List Management

####
**OPTIONAL** implements a function that returns the revocation status of a particular revocation list in a namespace.
```solidity
function listIsRevoked(address namespace, bytes32 revocationList) view public returns (bool);
```

#### changeListStatus
**OPTIONAL** 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.
```solidity
function changeListStatus(bool revoked, address namespace, bytes32 revocationList) public;
```

#### changeListStatusSigned ([see Meta Transactions](#MetaTransactions))
**OPTIONAL** 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.
```solidity
function changeListStatusSigned(bool revoked, address namespace, bytes32 revocationList, address signer, bytes calldata signature) public;
```

### Owner management

#### changeListOwner
**OPTIONAL** 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.
```solidity
function changeListOwner(address newOwner, address namespace, bytes32 revocationList) public;
```

#### changeListOwnerSigned ([see Meta Transactions](#MetaTransactions))
**OPTIONAL** 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.
```solidity
function changeListOwnerSigned(address newOwner, address namespace, bytes32 revocationList, address signer, bytes calldata signature) public;
```

### Delegation management

#### addListDelegate
**OPTIONAL** implements a function to add a delegate to an owner&apos;s revocation list in a namespace.
```solidity
function addListDelegate(address delegate, address namespace, bytes32 revocationList) public;
```

#### addListDelegateSigned ([see Meta Transactions](#MetaTransactions))
**OPTIONAL** implements a function to add a delegate to an owner&apos;s revocation list in a namespace with a raw signature.
```solidity
function addListDelegateSigned(address delegate, address namespace, bytes32 revocationList, address signer, bytes calldata signature) public;
```

#### removeListDelegate
**OPTIONAL** implements a function to remove a delegate from an owner&apos;s revocation list in a namespace.
```solidity
function removeListDelegate(address delegate, address owner, bytes32 revocationList) public;
```

#### removeListDelegateSigned ([see Meta Transactions](#MetaTransactions))
**OPTIONAL** implements a function to remove a delegate from an owner&apos;s revocation list in a namespace with a raw signature.
```solidity
function removeListDelegateSigned(address delegate, address namespace, bytes32 revocationList, address signer, bytes calldata signature) public;
```

### Events

#### RevocationStatusChanged
**MUST** be emitted when `changeStatus`, `changeStatusSigned`, `changeStatusDelegated`, `changeStatusDelegatedSigned`, `changeStatusesInList`, `changeStatusesInListSigned`, `changeStatusesInListDelegated`, or `changeStatusesInListDelegatedSigned` was successfully executed.

```solidity
event RevocationStatusChanged(
    address indexed namespace,
    bytes32 indexed revocationList,
    bytes32 indexed revocationKey,
    bool revoked
);
```

#### RevocationListOwnerChanged
**MUST** be emitted when `changeListOwner` or `changeListOwnerSigned` was successfully executed.

```solidity
event RevocationListOwnerChanged(
    address indexed namespace,
    bytes32 indexed revocationList,
    address indexed newOwner
);
```

#### RevocationListDelegateAdded
**MUST** be emitted when `addListDelegate` or `addListDelegateSigned` was successfully executed.

```solidity
event RevocationListDelegateAdded(
    address indexed namespace,
    bytes32 indexed revocationList,
    address indexed delegate
);
```

#### RevocationListDelegateRemoved
**MUST** be emitted when `removeListDelegate` or `removeListDelegateSigned` was successfully executed.

```solidity
event RevocationListDelegateRemoved(
    address indexed namespace,
    bytes32 indexed revocationList,
    address indexed delegate
);
```

#### RevocationListStatusChanged
**MUST** be emitted when `changeListStatus` or `changeListStatusSigned` was successfully executed.

```solidity
event RevocationListStatusChanged(
    address indexed namespace,
    bytes32 indexed revocationlist,
    bool revoked
);
```

### Meta Transactions &lt;span id=&quot;MetaTransactions&quot;&gt;&lt;/span&gt;

This section uses the following terms:
- **`transaction signer`**: An Ethereum address that signs arbitrary data for the contract to execute **BUT** does not commit the transaction.
- **`transaction sender`**: An Ethereum address that takes signed data from a **transaction signer** and commits it wrapped with its own signature to the smart contract.

An address (**transaction signer**) **MAY** be able to deliver a signed payload off-band to another address (**transaction sender**) that initiates the Ethereum interaction with the smart contract. The signed payload **MUST** be limited to be used only once ([Signed Hash](#SignedHash) + [nonces](#Nonce)).

#### Signed Hash &lt;span id=&quot;SignedHash&quot;&gt;&lt;/span&gt;

The signature of the **transaction signer** **MUST** conform [EIP-712](./eip-712.md). This helps users understand what the payload they&apos;re signing consists of &amp; it improves the protection against replay attacks.

#### Nonce &lt;span id=&quot;Nonce&quot;&gt;&lt;/span&gt;

This EIP **RECOMMENDS** the use of a **dedicated nonce mapping** for meta transactions. If the signature of the **transaction sender** and its meta contents are verified, the contract increases a nonce for this **transaction signer**. This effectively removes the possibility for any other sender to execute the same transaction again with another wallet. 

## Rationale

### Why the concept of namespaces?
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.

### Why does a namespace always represent the initial owner address? 
The change of an owner of a list shouldn&apos;t break the link to a revocation key in it, as already existing off-chain data may depend on it. 

## Backwards Compatibility
No backward compatibility issues were found.

## Security Considerations

### Meta Transactions
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 [EIP-712](./eip-712.md)

### Rights Management
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.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 26 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5539</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5539</guid>
      </item>
    
      <item>
        <title>Representing IP and its Royalty Structure</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5553-representing-intellectual-property-on-chain-with-royalty-rights/10551</comments>
        
        <description>## Abstract
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.

This standard allows market participants to:
1) Observe the canonical on-chain representation of an intellectual property
2) Discover its attached metadata
3) Discover its related royalty structure
4) This will enable building registration, licensing, and payout mechanisms for intellectual property assets in the future.

## Motivation

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:

1) Declare that IP exists, SEPARATELY from its purchase ability
2) Declare possibly multiple interested parties to be paid for such IP 

For 1, no standard exists today.

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.



## Specification 

The key words &quot;MUST&quot;, &quot;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.

**contracts that want to represent IP on chain MUST implement [EIP-721](./eip-721.md) AND this Proposal**

This standard extends [EIP-721](./eip-721.md) with the following `IIPRepresentation` (IPR for short) interface.
Implementers of this standard **MUST** have all of the following functions:

### royaltyPortionTokens() function
This function MUST return an array of addresses related to [EIP-20](./eip-20.md) 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. 

For example, for a musical IP, we might have two tokens representing the composition/writing/publishing royalty portion side and the recording/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.

### metadataURI() function
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&apos;s contents are not changeable without changing the URI.

### changeMetadataURI() function
This function allows changing the metadata URI to point to a new version of the metadata file. Calling this function MUST trigger the event `MetadataChanged` in case of success.

### ledger() function
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.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.9;
import &apos;@openzeppelin/contracts/interfaces/IERC165.sol&apos;;


///
/// @dev Interface for Intellectual Property Representation
///
interface IIPRepresentation is IERC165 {
    
    /// @notice Called with the new URI to an updated metadata file
    /// @param _newUri - the URI pointing to a metadata file (file standard is up to the implementer)
    /// @param _newFileHash - The hash of the new metadata file for future reference and verification
    function changeMetadataURI(string memory _newUri, string memory _newFileHash) external ;

    /// @return array of addresses of ERC20 tokens representing royalty portion in the IP
    /// @dev i.e implementing ERC5501 (IRoyaltyInterestToken interface)
    function royaltyPortionTokens() external view returns (address[] memory) ;

    /// @return the address of the contract or EOA that initialized the IP registration
    /// @dev i.e., a registry or registrar, to be implemented in the future
    function ledger() external view returns (address) ;

    /// @return the URI of the current metadata file for the II P
    function metadataURI() external view returns (string memory) ;

    /// @dev event to be triggered whenever metadata URI is changed
    /// @param byAddress the addresses that triggered this operation
    /// @param oldURI the URI to the old metadata file before the change
    /// @param oldFileHash the hash of the old metadata file before the change
    /// @param newURI the URI to the new metadata file 
    /// @param newFileHash the hash of the new metadata file 
    event MetadaDataChanged(address byAddress, string oldURI, string oldFileHash, string newURI, string newFileHash);
}
```


## Rationale

### Returning an array of EIP-20 tokens presents a more robust royalty portions structure/

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.

With this proposal, multiple **types** of royalty scenarios are allowed. A classic case is the music industry, in which we have writing/composition royalties and recording/master royalties. Different licensing types will pay different percentages to different parties based on context.

In the case of a song cover, a license payment formula can be created so that that 
a) Original IP&apos;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.

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.

### Separating the IP contract from the collectible and licensing NFTs enables scaling licensing types
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.

### A single pointer to the IP&apos;s metadata
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.

## Reference Implementation 

#### Implementing a Musical IP Representation (MIPR for short) based on IIPRepresentation
```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.9;
import &apos;@openzeppelin/contracts/token/ERC721/ERC721.sol&apos;;
import &quot;./interfaces/IIPRepresentation.sol&quot;;
import &quot;./interfaces/Structs.sol&quot;;


contract MusicalIP is ERC721, IIPRepresentation {
    address public songLedger;
    address public compToken;
    address public recToken;
    string public metadataURI;
    string public fileHash;
    uint256 public tokenId;
    bool public activated =false;

    function supportsInterface(bytes4 interfaceId) public view virtual override( ERC721, IERC165) returns (bool) {
        return
            interfaceId == type(IIPRepresentation).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    function getInterfaceId() public pure returns (bytes4){
        return type(IIPRepresentation).interfaceId;
    }

    constructor (
        uint256 _tokenId,
        address _songLedger,
        SongMintingParams memory _params,
        address _compAddress,
        address _recAddress
        )
    ERC721(_params.shortName, _params.symbol){

        songLedger = _songLedger;
        compToken = _compAddress;
        recToken = _recAddress;
        metadataURI = _params.metadataUri;
        fileHash = _params.fileHash;
        tokenId = _tokenId;
        
        _safeMint(_songLedger, _tokenId);
        emit Minted(_params.shortName,_songLedger,_compAddress,_recAddress,_msgSender(),tokenId,_params.metadataUri);
    }

    function changeMetadataURI(string memory _newURI,string memory _newFileHash) public 
     {
        string memory oldURI = metadataURI;
        string memory oldHash = fileHash;
        metadataURI = _newURI; 
        fileHash = _newFileHash;
        
        emit MetadataChanged(oldURI, oldHash,_newURI,_newFileHash);
    }
    
    function royaltyPortionTokens() external view returns (address[] memory) {
        address[] memory items = new address[](2); 
        items[0] = compToken;
        items[1] = recToken;
        return items;
    }
    function ledger() external view returns (address) {
         return songLedger;
    }

    event MetadataChanged(
        string  oldUri, string oldFileHash,
        string  newUri, string newFileHash
        );
    event Minted(
        string  abbvName,
        address ledger,
        address compToken,
        address recToken,
        address creator,
        uint256 tokenId,
        string metadataUri
        );
}



```

#### Deploying a new Musical IP using a simple song registry contract

```solidity  
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.9;
import &quot;@openzeppelin/contracts/utils/Counters.sol&quot;;
import &quot;./MusicalIP.sol&quot;;
import &quot;./CompositionRoyaltyToken.sol&quot;;
import &quot;./RecordingRoyaltyToken.sol&quot;;


contract SimpleSongLedger is IERC721Receiver {
    using Counters for Counters.Counter;
    Counters.Counter private mipIds;
      function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {
        return IERC721Receiver.onERC721Received.selector;
    }

    function mintSong(SongMintingParams memory _params) public {
        CompositionRoyaltyToken comp = new CompositionRoyaltyToken(address(this),&quot;SONGCOMP&quot;,&quot;COMP&quot;);
        RecordingRoyaltyToken rec = new RecordingRoyaltyToken(address(this),&quot;SONGREC&quot;,&quot;REC&quot;);
        mipIds.increment();

        MusicalIP mip = new MusicalIP(
                                        mipIds.current(),
                                        address(this),
                                        _params,
                                        address(comp),
                                        address(rec)
                                    );
    }
}


```
## Security Considerations

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.

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).

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 17 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5553</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5553</guid>
      </item>
    
      <item>
        <title>NFT Legal Use, Repurposing, and Remixing</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5999-legal-use-sharing-repurposing-and-remixing-standard-compatible-with-creative-commons/10553</comments>
        
        <description>## Abstract

This EIP extends any other token standard to provide:

* Explicit rights for the token holder related to commercial exploitation, derivative works, and reproduction;
* [EIP-5218](./eip-5218.md) interface for creating, viewing, and checking the status of licenses
* Standard format for extended license information in the token metadata;
* Standard events to track off chain creation of derivative works, commercial exploitation, and reproduction;
* On chain tracking of derivative works and reproductions
* Additional required fields in the smart contract to reference the copyright owner
* Function calls for commercial exploitation, derivative works and reproduction.

## Motivation
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. 

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. 

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. 

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.

Our current work is drafting the legalese and technical specifications.

## Specification
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.

Every contract compliant with this EIP must implement the `IERC5554` interface:

```solidity
pragma solidity ^0.8.0;

interface IERC5554 is IERC5218 {

    event CommercialExploitation(uint256 _tokenId, uint256 _licenseId, string _externalUri);
    event ReproductionCreated(uint256 _tokenId, uint256 _licenseId, uint256 _reproductionId, address _reproduction, uint256 _reproductionTokenId);
    event DerivativeCreated(uint256 _tokenId, uint256 _licenseId, uint256 _derivativeId, address _derivative, uint256 _derivativeTokenId);

    /// @notice Retrieve the copyright owner address
    /// @dev Throws unless the token exists
    /// @param tokenId The identifier for the queried token
    /// @return address of the copyright owner
    function getCopyrightOwner(uint256 tokenId)
        external
        virtual
        returns (address);
    
    /// @notice Requests to log an execution of a license
    /// @dev Throws unless the token issuance conditions are met
    /// @param tokenId The identifier for the queried token
    /// @return uint256 tracking reproduction ID
    function logReproduction(uint256 tokenId, address reproduction, uint256 reproductionTokenId)
        external
        virtual
        returns (uint256);

    /// @notice Requests to log an executions of a license
    /// @dev Throws unless the token issuance conditions are met
    /// @param tokenId The identifier for the queried token
    /// @return uint256 tracking derivative ID
    function logDerivative(uint256 tokenId, address derivative, uint256 derivativeTokenId)
        external
        virtual
        returns (uint256);

    /// @notice Requests to log an execution of a license
    /// @dev Throws unless the commercial exploitation conditions are met
    /// @param tokenId The identifier for the queried token
    function logCommercialExploitation(uint256 tokenId, string calldata uri)
        external;

    /// @notice Retrieve the token associated with a reproduction
    /// @dev Throws unless the reproduction exists
    /// @param _reproductionId The identifier for the reproduction
    /// @return uint256 The identifier for the token used to generate the reproduction
    function getReproductionTokenId(uint256 _reproductionId)
        external
        view
        returns (uint256);

    /// @notice Retrieve the token associated with a reproduction
    /// @dev Throws unless the reproduction exists
    /// @param _reproductionId The identifier for the reproduction
    /// @return uint256 The identifier for the license used to generate the reproduction
    function getReproductionLicenseId(uint256 _reproductionId)
        external
        view
        returns (uint256);

    /// @notice Retrieve the token associated with a reproduction
    /// @dev Throws unless the reproduction exists
    /// @param _reproductionId The identifier for the derivative work
    /// @return address The address of the reproduction collection
    function getReproductionCollection(uint256 _reproductionId)
        external
        view
        returns (address);

    /// @notice Retrieve the token associated with a derivative
    /// @dev Throws unless the derivative exists
    /// @param _derivativeId The identifier for the derivative work
    /// @return uint256 The identifier for the token used to generate the derivative work
    function getDerivativeTokenId(uint256 _derivativeId)
        external
        view
        returns (uint256);

    /// @notice Retrieve the token associated with a derivative
    /// @dev Throws unless the derivative exists
    /// @param _derivativeId The identifier for the derivative work
    /// @return uint256 The identifier for the license used to generate the derivative work
    function getDerivativeLicenseId(uint256 _derivativeId)
        external
        view
        returns (uint256);

    /// @notice Retrieve the token associated with a derivative
    /// @dev Throws unless the derivative exists
    /// @param _derivativeId The identifier for the derivative work
    /// @return address The address of the derivative collection
    function getDerivativeCollection(uint256 _derivativeId)
        external
        view
        returns (address);

}
```



### Token based Attribution/ Remix
On chain derivative works and reproductions
* Reproductions and derivative works are tracked in the contract.


### Event based attribution
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.

```solidity
event CommercialExploitation(uint256 tokenID, string uri)

function logCommercialExploitation(uint256 tokenId, string calldata uri) external returns bool;
```

#### Example:
When a token holder uses an NFT for off-chain merchandise, log a reference to the off-chain work in the event uri

### Required fields

```solifity
function copyrightOwner(uint256 tokenId) external returns address;
```

Copyright owner per tokenID. Could just be the tokenID owner in a simple use case, or something else if desired by the creator.

## Rationale
We expand here upon the Motivation section to justify every decision made with regard to the specs of the standard:

The `getLicenseId()` function takes a tokenID as a parameter, making it possible for different tokenID to be associated with different licensing terms.

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.

When the license allows for the reproduction and/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

For commercial exploitation or other off-chain uses of a creative work, the standard implements the `logCommercialExploitation()` 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.

The standard introduces a new field, `copyrightOwner`, 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. 

The artist address is not registered as an on-chain variable, but rather as part of the metadata, because it is an immutable field. 

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.

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. 


### Examples

#### Bored Koalas merchandising

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.

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 `logCommercialExploitation()` 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.

#### Musical Remix

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 `requestDerivativeToken()` 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. 

#### Royalties Remix

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. 

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 `requestDerivativeToken()` 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. 

## Backwards Compatibility
The interface defined in this standard is backward compatible with most NFT standards used in the Ethereum ecosystem as of this writing.

## Security Considerations
Needs discussion.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 07 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5554</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5554</guid>
      </item>
    
      <item>
        <title>Cross Chain Write Deferral Protocol</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-cross-chain-write-deferral-protocol/10576</comments>
        
        <description>## Abstract
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/network. These external handlers act as an extension to the core L1 contract.

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. 

This standard can be implemented in conjunction with [EIP-3668](./eip-3668) 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.

## Motivation
[EIP-3668](./eip-3668) 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. 

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.

Examples of this include:
 - Allowing the management of ENS domains externally resolved on an L2 solution or off-chain database as if they were native L1 tokens.
 - Allowing the management of digital identities stored on external handlers as if they were in the stored in the native L1 smart contract. 

## Specification
### Overview
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. 

From a high level:
- Handlers hosted on an L2 solution are EVM compatible and can use attributes native to the Ethereum ecosystem (such as address) to permission access. 
- Handlers hosted on an Off-Chain Database require additional parameters and signatures to correctly enforce the authenticity and check the validity of a request.  

A deferred mutation can be handled in as little as two steps. However, in some cases the mutation might be deferred multiple times.

1. Querying or sending a transaction to the contract
2. Querying or sending a transaction to the handler using the parameters provided in step 1

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:

- `StorageHandledByL2(chainId, contractAddress)`
- `StorageHandledByOffChainDatabase(sender, url, data)`

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:

- [StorageHandledByL2](#data-stored-in-an-l2)
- [StorageHandledByOffChainDatabase](#data-stored-in-an-off-chain-database) 

In some cases, the mutation may be deferred multiple times
- [Storage Deferred Twice L1 &gt; L2 &gt; Off-Chain](#data-stored-in-an-l2--an-off-chain-database) 

### Data Stored in an L1
```
┌──────┐                ┌───────────┐ 
│Client│                │L1 Contract│ 
└──┬───┘                └─────┬─────┘ 
   │                          │       
   │ somefunc(...)            │       
   ├─────────────────────────►│       
   │                          │       
   │ response                 │       
   │◄─────────────────────────┤       
   │                          │       
```

In the case in which no reversion occurs, data is stored in the L1 contract when the transaction is executed.

### Data Stored in an L2

```
┌──────┐                                           ┌───────────┐  ┌─────────────┐
│Client│                                           │L1 Contract│  │ L2 Contract │
└──┬───┘                                           └─────┬─────┘  └──────┬──────┘
   │                                                     │               │       
   │ somefunc(...)                                       │               │       
   ├────────────────────────────────────────────────────►│               │       
   │                                                     │               │       
   │ revert StorageHandledByL2(chainId, contractAddress) │               │       
   │◄────────────────────────────────────────────────────┤               │       
   │                                                     │               │       
   │ Execute Tx [chainId] [contractAddress] [callData]   │               │       
   ├─────────────────────────────────────────────────────┼──────────────►│       
   │                                                     │               │       
   │ response                                            │               │       
   │◄────────────────────────────────────────────────────┼───────────────┤       
   │                                                     │               │       
```

The call or transaction to the L1 contract reverts with the `StorageHandledByL2(chainId, contractAddress)` error.

In this case, the client builds a new transaction for `contractAddress` with the original `callData` and sends it to a RPC of their choice for the corresponding `chainId`. The `chainId` parameter corresponds to an L2 Solution that is EVM compatible.

#### Example

Suppose a contract has the following method:

```solidity
function setAddr(bytes32 node, address a) external;
```

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 `StorageHandledByL2(chainId, contractAddress)` error.

One example of a valid implementation of `setAddr` would be:

```solidity
function setAddr(bytes32 node, address a) external {
   revert StorageHandledByL2(
      10,
      _l2HandlerContractAddress
   ); 
}
```

For example, if a contract returns the following data in an `StorageHandledByL2`:

```text
chainId = 10
contractAddress = 0x0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff
```

The user, receiving this error, creates a new transaction for the corresponding `chainId`, and builds a transaction with the original `callData` to send to `contractAddress`. The user will have to choose an RPC of their choice to send the transaction to for the corresponding `chainId`.

### Data Stored in an Off-Chain Database
```
┌──────┐                                           ┌───────────┐  ┌────────────────────┐
│Client│                                           │L1 Contract│  │ Off-Chain Database │
└──┬───┘                                           └─────┬─────┘  └──────────┬─────────┘
   │                                                     │                   │ 
   │ somefunc(...)                                       │                   │ 
   ├────────────────────────────────────────────────────►│                   │ 
   │                                                     │                   │ 
   │ revert StorageHandledByOffChainDatabase(sender,     |                   │ 
   │                               urls, requestParams)  │                   │ 
   │◄────────────────────────────────────────────────────┤                   │ 
   │                                                     │                   │ 
   │ HTTP Request [requestParams, signature]             │                   │ 
   ├─────────────────────────────────────────────────────┼──────────────────►│ 
   │                                                     │                   │ 
   │ response                                            │                   │ 
   │◄────────────────────────────────────────────────────┼───────────────────┤ 
   │                                                     │                   │ 
```

The call or transaction to the L1 contract reverts with the `StorageHandledByOffChainDatabase(sender, url, data)` error.

In this case, the client performs a HTTP POST request to the gateway service. The gateway service is defined by `url`. The body attached to the request is a JSON object that includes `sender`, `data`, and a signed copy of `data` denoted `signature`. The signature is generated according to a [EIP-712](./eip-712), in which a typed data signature is generated using domain definition, `sender`, and the message context, `data`.

`sender` ia an ABI-encoded struct defined as:

```solidity
/**
* @notice Struct used to define the domain of the typed data signature, defined in EIP-712.
* @param name The user friendly name of the contract that the signature corresponds to.
* @param version The version of domain object being used.
* @param chainId The ID of the chain that the signature corresponds to (ie Ethereum mainnet: 1, Goerli testnet: 5, ...). 
* @param verifyingContract The address of the contract that the signature pertains to.
*/
struct domainData {
    string name;
    string version;
    uint64 chainId;
    address verifyingContract;
}    
```

`data` ia an abi encoded struct defined as:

```solidity
/**
* @notice Struct used to define the message context used to construct a typed data signature, defined in EIP-712, 
* to authorize and define the deferred mutation being performed.
* @param functionSelector The function selector of the corresponding mutation.
* @param sender The address of the user performing the mutation (msg.sender).
* @param parameter[] A list of &lt;key, value&gt; pairs defining the inputs used to perform the deferred mutation.
*/
struct messageData {
    bytes4 functionSelector;
    address sender;
    parameter[] parameters;
    uint256 expirationTimestamp;
}

/**
* @notice Struct used to define a parameter for Off-Chain Database Handler deferral.
* @param name The variable name of the parameter.
* @param value The string encoded value representation of the parameter.
*/
struct parameter {
    string name;
    string value;
}
```

`signature` is generated by using the `sender` &amp; `data` parameters to construct an [EIP-712](./eip-712) typed data signature.

The body used in the HTTP POST request is defined as:

```json
{
    &quot;sender&quot;: &quot;&lt;abi encoded domainData (sender)&gt;&quot;,
    &quot;data&quot;: &quot;&lt;abi encoded messageData (data)&gt;&quot;,
    &quot;signature&quot;: &quot;&lt;EIP-712 typed data signature of corresponding message data &amp; domain definition&gt;&quot;
}
```

#### Example

Suppose a contract has the following method:

```solidity
function setAddr(bytes32 node, address a) external;
```

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 `Addr` without having to pay a gas fee. Therefore, the mutation is deferred to a off-chain handler by reverting with the `StorageHandledByOffChainDatabase(sender, url, data)` error.

One example of a valid implementation of `setAddr` would be:

```solidity
function setAddr(bytes32 node, address a) external {
    IWriteDeferral.parameter[] memory params = new IWriteDeferral.parameter[](3);

    params[0].name = &quot;node&quot;;
    params[0].value = BytesToString.bytes32ToString(node);

    params[1].name = &quot;coin_type&quot;;
    params[1].value = Strings.toString(coinType);

    params[2].name = &quot;address&quot;;
    params[2].value = BytesToString.bytesToString(a);

    revert StorageHandledByOffChainDatabase(
        IWriteDeferral.domainData(
            {
                name: WRITE_DEFERRAL_DOMAIN_NAME,
                version: WRITE_DEFERRAL_DOMAIN_VERSION,
                chainId: 1,
                verifyingContract: address(this)
            }
        ),
        _offChainDatabaseUrl,
        IWriteDeferral.messageData(
            {
                functionSelector: msg.sig,
                sender: msg.sender,
                parameters: params,
                expirationTimestamp: block.timestamp + _offChainDatabaseTimeoutDuration
            }
        )
    );
}
```

For example, if a contract reverts with the following:

```text
StorageHandledByOffChainDatabase(
    (
        &quot;CoinbaseResolver&quot;, 
        &quot;1&quot;, 
        1, 
        0x32f94e75cde5fa48b6469323742e6004d701409b
    ), 
    &quot;https://example.com/r/{sender}&quot;, 
    (
        0xd5fa2b00, 
        0x727f366727d3c9cc87f05d549ee2068f254b267c, 
        [
            (&quot;node&quot;, &quot;0x418ae76a9d04818c7a8001095ad01a78b9cd173ee66fe33af2d289b5dc5f4cba&quot;), 
            (&quot;coin_type&quot;, &quot;60&quot;), 
            (&quot;address&quot;, &quot;0x727f366727d3c9cc87f05d549ee2068f254b267c&quot;)
        ], 
        181
    )
)
```

The user, receiving this error, constructs the typed data signature, signs it, and performs that request via a HTTP POST to `url`. 

Example HTTP POST request body including `requestParams` and `signature`:

```json
{
    &quot;sender&quot;: &quot;&lt;abi encoded domainData (sender)&gt;&quot;,
    &quot;data&quot;: &quot;&lt;abi encoded messageData (data)&gt;&quot;,
    &quot;signature&quot;: &quot;&lt;EIP-712 typed data signature of corresponding message data &amp; domain definition&gt;&quot;
}
```

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&apos;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&apos;s responsibility to permission and handle those requests.


### Data Stored in an L2 &amp; an Off-Chain Database

```text
┌──────┐                                           ┌───────────┐  ┌─────────────┐  ┌────────────────────┐
│Client│                                           │L1 Contract│  │ L2 Contract │  │ Off-Chain Database │
└──┬───┘                                           └─────┬─────┘  └──────┬──────┘  └──────────┬─────────┘
   │                                                     │               │                    │
   │ somefunc(...)                                       │               │                    │
   ├────────────────────────────────────────────────────►│               │                    │
   │                                                     │               │                    │
   │ revert StorageHandledByL2(chainId, contractAddress) │               │                    │
   │◄────────────────────────────────────────────────────┤               │                    │
   │                                                     │               │                    │
   │ Execute Tx [chainId] [contractAddress] [callData]   │               │                    │
   ├─────────────────────────────────────────────────────┼──────────────►│                    │
   │                                                     │               │                    │
   │ revert StorageHandledByOffChainDatabase(sender, url, data)          │                    │
   │◄────────────────────────────────────────────────────┼───────────────┤                    │
   │                                                     │               │                    │
   │ HTTP Request {requestParams, signature}             │               │                    │
   ├─────────────────────────────────────────────────────┼───────────────┼───────────────────►│
   │                                                     │               │                    │
   │ response                                            │               │                    │
   │◄────────────────────────────────────────────────────┼───────────────┼────────────────────┤
   │                                                     │               │                    │
```

The call or transaction to the L1 contract reverts with the `StorageHandledByL2(chainId, contractAddress)` error.

In this case, the client builds a new transaction for `contractAddress` with the original `callData` and sends it to a RPC of their choice for the corresponding `chainId`. 

That call or transaction to the L2 contract then reverts with the `StorageHandledByOffChainDatabase(sender, url, data)` error.

In this case, the client then performs a HTTP POST request against the gateway service. The gateway service is defined by `url`. The body attached to the request is a JSON object that includes `sender`, `data`, and `signature` -- a typed data signature corresponding to [EIP-712](./eip-712). 

### Events

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 `chainId` and `contractAddress` for L2 solutions and `url` for Off-Chain Database solutions. The events are outlined below in the WriteDeferral Interface.

### Write Deferral Interface

Below is a basic interface that defines and describes all of the reversion types and their corresponding parameters.

```solidity
pragma solidity ^0.8.13;

interface IWriteDeferral {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    /// @notice Event raised when the default chainId is changed for the corresponding L2 handler.
    event L2HandlerDefaultChainIdChanged(uint256 indexed previousChainId, uint256 indexed newChainId);
    /// @notice Event raised when the contractAddress is changed for the L2 handler corresponding to chainId.
    event L2HandlerContractAddressChanged(uint256 indexed chainId, address indexed previousContractAddress, address indexed newContractAddress);

    /// @notice Event raised when the url is changed for the corresponding Off-Chain Database handler.
    event OffChainDatabaseHandlerURLChanged(string indexed previousUrl, string indexed newUrl);

    /*//////////////////////////////////////////////////////////////
                                 STRUCTS
    //////////////////////////////////////////////////////////////*/

    /**
     * @notice Struct used to define the domain of the typed data signature, defined in EIP-712.
     * @param name The user friendly name of the contract that the signature corresponds to.
     * @param version The version of domain object being used.
     * @param chainId The ID of the chain that the signature corresponds to (ie Ethereum mainnet: 1, Goerli testnet: 5, ...). 
     * @param verifyingContract The address of the contract that the signature pertains to.
     */
    struct domainData {
        string name;
        string version;
        uint64 chainId;
        address verifyingContract;
    }    

    /**
     * @notice Struct used to define the message context used to construct a typed data signature, defined in EIP-712, 
     * to authorize and define the deferred mutation being performed.
     * @param functionSelector The function selector of the corresponding mutation.
     * @param sender The address of the user performing the mutation (msg.sender).
     * @param parameter[] A list of &lt;key, value&gt; pairs defining the inputs used to perform the deferred mutation.
     */
    struct messageData {
        bytes4 functionSelector;
        address sender;
        parameter[] parameters;
        uint256 expirationTimestamp;
    }

    /**
     * @notice Struct used to define a parameter for off-chain Database Handler deferral.
     * @param name The variable name of the parameter.
     * @param value The string encoded value representation of the parameter.
     */
    struct parameter {
        string name;
        string value;
    }


    /*//////////////////////////////////////////////////////////////
                                 ERRORS
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev Error to raise when mutations are being deferred to an L2.
     * @param chainId Chain ID to perform the deferred mutation to.
     * @param contractAddress Contract Address at which the deferred mutation should transact with.
     */
    error StorageHandledByL2(
        uint256 chainId, 
        address contractAddress
    );

    /**
     * @dev Error to raise when mutations are being deferred to an Off-Chain Database.
     * @param sender the EIP-712 domain definition of the corresponding contract performing the off-chain database, write 
     * deferral reversion.
     * @param url URL to request to perform the off-chain mutation.
     * @param data the EIP-712 message signing data context used to authorize and instruct the mutation deferred to the 
     * off-chain database handler. 
     * In order to authorize the deferred mutation to be performed, the user must use the domain definition (sender) and message data 
     * (data) to construct a type data signature request defined in EIP-712. This signature, message data (data), and domainData (sender) 
     * are then included in the HTTP POST request, denoted sender, data, and signature.
     * 
     * Example HTTP POST request:
     *  {
     *      &quot;sender&quot;: &lt;abi encoded domainData (sender)&gt;,
     *      &quot;data&quot;: &lt;abi encoded message data (data)&gt;,
     *      &quot;signature&quot;: &lt;EIP-712 typed data signature of corresponding message data &amp; domain definition&gt;
     *  }
     * 
     */
    error StorageHandledByOffChainDatabase(
        domainData sender, 
        string url, 
        messageData data
    );     
}
```

### Use of transactions with storage-deferral reversions
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 `preflighting` the transaction.

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. 

## Rationale
### Use of `revert` to convey call information
[EIP-3668](./eip-3668) adopted the idea of using a `revert` 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. 

This is very similar for the write deferral protocol, defined in this EIP; without any modifications to the ABI or underlying EVM, `revert` 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. 

### Use of multiple reversion &amp; handler types to better define security guarantees 
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.   


## Backwards Compatibility
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.

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.

## Security Considerations
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 `calldata`, this prevents against potentially malicious contextual changes in the transaction.

### Fingerprinting attacks
As all deferred mutations will include the `msg.sender` parameter in `data`, it is possible that `StorageHandledByOffChainDatabase` 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:

1. 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 / risks associated with the resolution location.
2. Client libraries should provide clients with a hook to override Cross Chain Write Deferral `StorageHandledByOffChainDatabase` 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.

We encourage applications to be as transparent as possible with their setup and different precautions put in place.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 23 Jun 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5559</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5559</guid>
      </item>
    
      <item>
        <title>Redeemable NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-redeemable-nft-extension/10589</comments>
        
        <description>## Abstract

The EIP is a Redeemable NFT extension which adds a `redeem` function to [EIP-721](./eip-721.md). It can be implemented when an NFT issuer wants his/her NFT to be redeemed for a physical object.

## Motivation

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.

## Specification

_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._

`EIP-721` compliant contracts MAY implement this EIP to provide a standard method of receiving information on redeemability.

The NFT issuer **MUST** decide who is allowed to redeem the NFT, and restrict access to the `redeem()` function accordingly.

Anyone **MAY** access the `isRedeemable()` function to check the redeemability status: it returns `true` when the NFT redeemable, and `false` when already redeemed.

Third-party services that support this standard **MAY** use the `Redeem` event to listen to changes on the redeemable status of the NFT.

Implementers of this standard **MUST** have all of the following functions:

```solidity
import &apos;@openzeppelin/contracts/utils/introspection/ERC165.sol&apos;;

/**
 * @dev Implementation of Redeemable for ERC-721s
 *
 */

interface IRedeemable is ERC165 {
	/*
	 * ERC165 bytes to add to interface array - set in parent contract implementing this standard
	 *
	 * bytes4 private constant _INTERFACE_ID_ERC721REDEEM = 0x2f8ca953;
	 */
	 
	/// @dev This event emits when a token is redeemed.
	event Redeem(address indexed from, uint256 indexed tokenId);
	 
	/// @notice Returns the redeem status of a token
	/// @param tokenId Identifier of the token.
	function isRedeemable(uint256 _tokenId) external view returns (bool);

	/// @notice Redeeem a token
	/// @param tokenId Identifier of the token to redeeem
	function redeem(uint256 _tokenId) external;
}
```

The `Redeem` event is emitted when the `redeem()` function is called.

The `supportsInterface` method **MUST** return `true` when called with `0x2f8ca953`.

## Rationale

When the NFT contract is deployed, the `isRedeemable()` function returns `true` by default.

By default, the `redeem()` function visibility is public, so anyone can trigger it. It is **RECOMMENDED** to add a `require` to restrict the access:

```solidity
require(ownerOf(tokenId) == msg.sender, &quot;ERC721Redeemable: You are not the owner of this token&quot;);
```

After the `redeem()` function is triggered, `isRedeemable()` function returns `false`.

### `Redeem` event

When the `redeem()` function is triggered, the following event **MUST** be emitted:

```solidity
event Redeem(address indexed from, uint256 indexed tokenId);
```

## Backwards Compatibility

This standard is compatible with EIP-721.

## Reference Implementation

Here&apos;s an example of an EIP-721 that includes the Redeemable extension:

```solidity
contract ERC721Redeemable is ERC721, Redeemable {

	constructor(string memory name, string memory symbol) ERC721(name, symbol) {
	}

	function isRedeemable(uint256 tokenId) public view virtual override returns (bool) {
		require(_exists(tokenId), &quot;ERC721Redeemable: Redeem query for nonexistent token&quot;);
		return super.isRedeemable(tokenId);
	}

	function redeem(uint256 tokenId) public virtual override {
		require(_exists(tokenId), &quot;ERC721Redeemable: Redeem query for nonexistent token&quot;);
		require(ownerOf(tokenId) == msg.sender, &quot;ERC721Redeemable: You are not the owner of this token&quot;);
		super.redeem(tokenId);
	}

	function supportsInterface(bytes4 interfaceId) public view override(ERC721, Redeemable) returns (bool) {
		return super.supportsInterface(interfaceId);
	}
}
```

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 30 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5560</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5560</guid>
      </item>
    
      <item>
        <title>Stealth Addresses</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5566-stealth-addresses-for-smart-contract-wallets/10614</comments>
        
        <description>## Abstract

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 `0x55649E01B5Df198D18D95b5cc5051630cfD45564` 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.

## Motivation

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&apos;s stealth address with their identity, thereby preserving the recipient&apos;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.

## Specification

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.

Definitions:

- 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.
- 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.
- 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.

Different stealth address schemes will have different expected stealth meta-address lengths. A scheme that uses public keys of length `n` bytes MUST define stealth meta-addresses as follows:

- A stealth meta-address of length `n` uses the same stealth meta-address for the spending public key and viewing public key.
- A stealth meta-address of length `2n` uses the first `n` bytes as the spending public key and the last `n` bytes as the viewing public key.

Given a recipient&apos;s stealth meta-address, a sender MUST be able generate a stealth address for the recipient by calling a method with the following signature:

```solidity
/// @notice Generates a stealth address from a stealth meta address.
/// @param stealthMetaAddress The recipient&apos;s stealth meta-address.
/// @return stealthAddress The recipient&apos;s stealth address.
/// @return ephemeralPubKey The ephemeral public key used to generate the stealth address.
/// @return viewTag The view tag derived from the shared secret.
function generateStealthAddress(bytes memory stealthMetaAddress)
  external
  view
  returns (address stealthAddress, bytes memory ephemeralPubKey, bytes1 viewTag);
```

A recipient MUST be able to check if a stealth address belongs to them by calling a method with the following signature:

```solidity
/// @notice Returns true if funds sent to a stealth address belong to the recipient who controls
/// the corresponding spending key.
/// @param stealthAddress The recipient&apos;s stealth address.
/// @param ephemeralPubKey The ephemeral public key used to generate the stealth address.
/// @param viewingKey The recipient&apos;s viewing private key.
/// @param spendingPubKey The recipient&apos;s spending public key.
/// @return True if funds sent to the stealth address belong to the recipient.
function checkStealthAddress(
  address stealthAddress,
  bytes memory ephemeralPubKey,
  bytes memory viewingKey,
  bytes memory spendingPubKey
) external view returns (bool);
```

A recipient MUST be able to compute the private key for a stealth address by calling a method with the following signature:

```solidity
/// @notice Computes the stealth private key for a stealth address.
/// @param stealthAddress The expected stealth address.
/// @param ephemeralPubKey The ephemeral public key used to generate the stealth address.
/// @param viewingKey The recipient&apos;s viewing private key.
/// @param spendingKey The recipient&apos;s spending private key.
/// @return stealthKey The stealth private key corresponding to the stealth address.
/// @dev The stealth address input is not strictly necessary, but it is included so the method
/// can validate that the stealth private key was generated correctly.
function computeStealthKey(
  address stealthAddress,
  bytes memory ephemeralPubKey,
  bytes memory viewingKey,
  bytes memory spendingKey
) external view returns (bytes memory);
```

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.

A 256 bit integer (`schemeId`) 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 `schemeId`s are chosen to be monotonically incrementing integers for simplicity, but arbitrary or meaningful `schemeId`s may be chosen. This ERC introduces a `schemeId` of `1` with the following extensions:

- `1` is the integer identifier for the scheme,
- `viewTags` MUST be included in the announcement event and is used to reduce the parsing time for the recipients.
- SECP256k1 is the algorithm for encoding a stealth meta-address (i.e. the spending public key and viewing public key) into a `bytes` array, and decoding it from `bytes` to the native key types of that scheme.
- SECP256k1 with view tags will be used in `generateStealthAddress`, `checkStealthAddress`, and `computeStealthKey` methods.

This specification additionally defines a singleton `ERC5564Announcer` 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:

```solidity
/// @notice Interface for announcing when something is sent to a stealth address.
contract IERC5564Announcer {
  /// @dev Emitted when sending something to a stealth address.
  /// @dev See the `announce` method for documentation on the parameters.
  event Announcement (
    uint256 indexed schemeId,
    address indexed stealthAddress,
    address indexed caller,
    bytes ephemeralPubKey,
    bytes metadata
  );

  /// @dev Called by integrators to emit an `Announcement` event.
  /// @param schemeId The integer specifying the applied stealth address scheme.
  /// @param stealthAddress The computed stealth address for the recipient.
  /// @param ephemeralPubKey Ephemeral public key used by the sender.
  /// @param metadata An arbitrary field MUST include the view tag in the first byte.
  /// Besides the view tag, the metadata can be used by the senders however they like,
  /// but the below guidelines are recommended:
  /// The first byte of the metadata MUST be the view tag.
  /// - When sending/interacting with the native token of the blockchain (cf. ETH), the metadata SHOULD be structured as follows:
  ///     - Byte 1 MUST be the view tag, as specified above.
  ///     - Bytes 2-5 are `0xeeeeeeee`
  ///     - Bytes 6-25 are the address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE.
  ///     - Bytes 26-57 are the amount of ETH being sent.
  /// - When interacting with ERC-20/ERC-721/etc. tokens, the metadata SHOULD be structured as follows:
  ///   - Byte 1 MUST be the view tag, as specified above.
  ///   - Bytes 2-5 are a function identifier. When a function selector (e.g.
  ///     the first (left, high-order in big-endian) four bytes of the Keccak-256
  ///     hash of the signature of the function, like Solidity and Vyper use) is
  ///     available, it MUST be used.
  ///   - Bytes 6-25 are the token contract address.
  ///   - Bytes 26-57 are the amount of tokens being sent/interacted with for fungible tokens, or
  ///     the token ID for non-fungible tokens.
  function announce (
    uint256 schemeId,
    address stealthAddress,
    bytes memory ephemeralPubKey,
    bytes memory metadata
  )
    external
  {
    emit Announcement(schemeId, stealthAddress, msg.sender, ephemeralPubKey, metadata);
  }
}
```

### Stealth meta-address format

The new address format for the stealth meta-address extends the chain specific address format by adding a `st:` (_stealth_) prefix.
Thus, a stealth meta-address on Ethereum has the following format:

```
st:eth:0x&lt;spendingPubKey&gt;&lt;viewingPubKey&gt;
```

Stealth meta-addresses may be managed by the user and/or registered within a publicly available `Registry` contract, as delineated in [ERC-6538](./eip-6538.md). 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.

_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._

---

### Initial Implementation of SECP256k1 with View Tags

This ERC provides a foundation that is not tied to any specific cryptographic system through the `IERC5564Announcer` 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$.

The following reference is divided into three sections:

1. Stealth address generation

2. Parsing announcements

3. Stealth private key derivation

Definitions:

- $G$ represents the generator point of the curve.

#### Generation - Generate stealth address from stealth meta-address:

- Recipient has access to the private keys $p_{spend}$, $p_{view}$ from which public keys $P_{spend}$ and $P_{view}$ are derived.

- Recipient has published a stealth meta-address that consists of the public keys $P_{spend}$ and $P_{view}$.

- Sender passes the stealth meta-address to the `generateStealthAddress` function.

- The `generateStealthAddress` function performs the following computations:
  - Generate a random 32-byte entropy ephemeral private key $p_{ephemeral}$.
  - Derive the ephemeral public key $P_{ephemeral}$ from $p_{ephemeral}$.
  - Parse the spending and viewing public keys, $P_{spend}$ and $P_{view}$, from the stealth meta-address.
  - A shared secret $s$ is computed as $s = p_{ephemeral} \cdot P_{view}$.
  - The secret is hashed $s_{h} = \textrm{h}(s)$.
  - The view tag $v$ is extracted by taking the most significant byte $s_{h}[0]$,
  - Multiply the hashed shared secret with the generator point $S_h = s_h \cdot G$.
  - The recipient&apos;s stealth public key is computed as $P_{stealth} = P_{spend} + S_h$.
  - The recipient&apos;s stealth address $a_{stealth}$ is computed as $\textrm{pubkeyToAddress}(P_{stealth})$.
  - The function returns the stealth address $a_{stealth}$, the ephemeral public key $P_{ephemeral}$ and the view tag $v$.

#### Parsing - Locate one&apos;s own stealth address(es):

- User has access to the viewing private key $p_{view}$ and the spending public key $P_{spend}$.

- User has access to a set of `Announcement` events and applies the `checkStealthAddress` function to each of them.

- The `checkStealthAddress` function performs the following computations:
  - Shared secret $s$ is computed by multiplying the viewing private key with the ephemeral public key of the announcement $s = p_{view}$ * $P_{ephemeral}$.
  - The secret is hashed $s_{h} = h(s)$.
  - 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 `Announcement` is not for the user and the remaining steps can be skipped. If the view tags match, continue on.
  - Multiply the hashed shared secret with the generator point $S_h = s_h \cdot G$.
  - The stealth public key is computed as $P_{stealth} = P_{spend} + S_h$.
  - The derived stealth address $a_{stealth}$ is computed as $\textrm{pubkeyToAddress}(P_{stealth})$.
  - Return `true` if the stealth address of the announcement matches the derived stealth address, else return `false`.

#### Private key derivation - Generate the stealth address private key from the hashed shared secret and the spending private key.

- User has access to the viewing private key $p_{view}$ and spending private key $p_{spend}$.

- User has access to a set of `Announcement` events for which the `checkStealthAddress` function returns `true`.

- The `computeStealthKey` function performs the following computations:
  - Shared secret $s$ is computed by multiplying the viewing private key with the ephemeral public key of the announcement $s = p_{view}$ * $P_{ephemeral}$.
  - The secret is hashed $s_{h} = h(s)$.
  - The stealth private key is computed as $p_{stealth} = p_{spend} + s_h$.

### Parsing considerations

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:

- 2x ecMUL,

- 2x HASH,

- 1x ecADD,

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 `viewTag`, the probability for users to skip the remaining computations after hashing the shared secret $h(s)$ is $255/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.

---

## Rationale

This ERC emerged from the need for privacy-preserving ways to transfer ownership without disclosing any information about the recipients&apos; 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.

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.

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.

The recipient&apos;s address and the `viewTag` must be included in the announcement event, allowing users to quickly verify ownership without querying the chain for positive account balances.

## Backwards Compatibility

This ERC is fully backward compatible.

### Deployment Method

The `ERC5564Announcer` contract is deployed at `0x55649E01B5Df198D18D95b5cc5051630cfD45564` using `CREATE2` via the deterministic deployer at `0x4e59b44847b379578588920ca78fbf26c0b4956c` with a salt of `0xd0103a290d760f027c9ca72675f5121d725397fb2f618f05b6c44958b25b4447`.

## Reference Implementation

You can find the implementation of the `ERC5564Announcer` contract [here](../assets/eip-5564/contracts/ERC5564Announcer.sol) and the interface `IERC5564Announcer.sol` [here](../assets/eip-5564/contracts/interfaces/IERC5564Announcer.sol).

## Security Considerations

### DoS Countermeasures

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 _can_ be a detriment to the user experience, as it _can_ lead to longer parsing times.
We consider the incentives to carry out such an attack to be low because **no monetary benefit can be obtained**
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 `caller` keyword may help parsing providers to effectively filter known spammers.

Furthermore, parsing providers have a few options to counter spam, such as introducing staking mechanisms or requiring senders to pay a `toll` before including their `Announcement`. Moreover, a Staking mechanism may allow users to stake an unslashable amount of ETH (similarly to [ERC-4337](./eip-4337)), to help mitigate potential spam through _sybil attacks_ and enable parsing providers filtering spam more effectively.
Introducing a `toll`, paid by sending users, would simply put a cost on each stealth address transaction, making spamming economically unattractive.

### Recipients&apos; transaction costs

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.

Thus, the sender may attach a small amount of ETH to each stealth address transaction, thereby sponsoring subsequent transactions of the recipient.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 13 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5564</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5564</guid>
      </item>
    
      <item>
        <title>Well-Known Format for Required Actions</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5568-revert-signals/10622</comments>
        
        <description>## Abstract

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.

## Motivation

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.

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.

## Specification

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.

### Action Detection

```solidity
interface IERC5568 {
    function walletSignal24(bytes32 selector, bytes function_data) view returns (uint24 instruction_id, bytes instruction_data);
}
```

The `instruction_id` 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 `instruction_id`. The structure of the instruction data for any `instruction_id` MUST be defined by the ERC that defines the `instruction_id`.

To indicate that an action needs to be taken, return the `instruction_id` and `instruction_data`. To indicate no actions need to be taken, set `instruction_id` to be `0` and `instruction_data` to any value.

### Custom Revert Reason

To signal an action was not taken, a compliant smart contract MUST revert with the following error:

```solidity
error WalletSignal24(uint24 instruction_id, bytes instruction_data)
```

The `instruction_id` 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 `instruction_id`. The structure of the instruction data for any `instruction_id` MUST be defined by the ERC that defines the `instruction_id`.

### Responding to a Revert

Before submitting a transaction to the mempool, the `walletSignal24` function MUST be simulated locally. It MUST be treated as if it were a non-`view` function capable of making state changes (e.g. `CALLS` to non-`view` functions are allowed). If the resulting `instruction_id` is nonzero, an action needs to be taken.

The `instruction_id`, and `instruction_data` MUST be taken from the `walletSignal24` 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.

If an instruction is invalid, or the `instruction_id`, and `instruction_data` cannot be parsed, then an error MUST be displayed to the user indicating that is the case. The transaction MUST NOT be re-evaluated.

## Rationale

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.

[ERC-165](./eip-165.md) is not used, since the interface is simple enough that it can be detected simply by calling the function.

## Backwards Compatibility

### Human-Readable Revert Messages

See [Revert Reason Collisions](#revert-reason-collisions).

### [ERC-3668](./eip-3668.md)

ERC-3668 can be used alongside this ERC, but it uses a different mechanism than this ERC.

## Security Considerations

### Revert Reason Collisions

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 31 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5568</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5568</guid>
      </item>
    
      <item>
        <title>Digital Receipt Non-Fungible Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/idea-standard-digital-receipts-using-erc-721/9908</comments>
        
        <description>## Abstract

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 [ERC-721](./eip-721.md) which allows for the management and ownership of unique tokens.

## Motivation

Purchases from online retailers include a receipt that is emailed and/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 -&gt; Analogue -&gt; Digital process which requires unnecessary data entry or the use of clunky receipt-scanning applications.

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. 

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.

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.

Digital receipt as NFTs can also conceptually include other important information such as item serial numbers and delivery tracking etc.

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.

## Specification

Transaction Flow:

 - A customer purchases an item from an online retailer, checking out leads the customer to an option to mint a NFT.
 - The smart contract provides the user with a Digital Receipt Non-Fungible Token.
 - 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.

### Digital Receipt JSON Schema

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.

#### Root Schema

```json
{
  &quot;id&quot;: &quot;receipt.json#&quot;,
  &quot;description&quot;: &quot;Receipt Schema for Digital Receipt Non-Fungible Tokens&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;required&quot;: [&quot;name&quot;, &quot;description&quot;, &quot;image&quot;, &quot;receipt&quot;],
  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;title&quot;: &quot;Name&quot;,
      &quot;description&quot;: &quot;Identifies the token as a digital receipt&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;description&quot;: {
      &quot;title&quot;: &quot;Description&quot;,
      &quot;description&quot;: &quot;Brief description of a digital receipt&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;receipt&quot;: {
      &quot;title&quot;: &quot;Receipt&quot;,
      &quot;description&quot;: &quot;Details of the receipt&quot;,
      &quot;type&quot;: &quot;object&quot;,
      &quot;required&quot;: [&quot;id&quot;, &quot;date&quot;, &quot;vendor&quot;, &quot;items&quot;],
      &quot;properties&quot;: {
        &quot;id&quot;: {
          &quot;title&quot;: &quot;ID&quot;,
          &quot;description&quot;: &quot;Unique ID for the receipt generated by the vendor&quot;,
          &quot;type&quot;: &quot;string&quot;
        },
        &quot;date&quot;: {
          &quot;title&quot;: &quot;Date&quot;,
          &quot;description&quot;: &quot;Date Receipt Issued&quot;,
          &quot;type&quot;: &quot;string&quot;,
          &quot;format&quot;: &quot;date&quot;
        },
        &quot;vendor&quot;: {
          &quot;title&quot;: &quot;Vendor&quot;,
          &quot;description&quot;: &quot;Details of the entity issuing the receipt&quot;,
          &quot;type&quot;: &quot;object&quot;,
          &quot;required&quot;: [&quot;name&quot;, &quot;website&quot;],
          &quot;properties&quot;: {
            &quot;name&quot;: {
              &quot;title&quot;: &quot;Name&quot;,
              &quot;description&quot;: &quot;Name of the vendor. E.g. Acme Corp&quot;,
              &quot;type&quot;: &quot;string&quot;
            },
            &quot;logo&quot;: {
              &quot;title&quot;: &quot;Logo&quot;,
              &quot;description&quot;: &quot;URL of the issuer&apos;s logo&quot;,
              &quot;type&quot;: &quot;string&quot;,
              &quot;format&quot;: &quot;uri&quot;
            },
            &quot;address&quot;: {
              &quot;title&quot;: &quot;Address&quot;,
              &quot;description&quot;: &quot;List of strings comprising the address of the issuer&quot;,
              &quot;type&quot;: &quot;array&quot;,
              &quot;items&quot;: { &quot;type&quot;: &quot;string&quot; },
              &quot;minItems&quot;: 2,
              &quot;maxItems&quot;: 6
            },
            &quot;website&quot;: {
              &quot;title&quot;: &quot;Website&quot;,
              &quot;description&quot;: &quot;URL of the issuer&apos;s website&quot;,
              &quot;type&quot;: &quot;string&quot;,
              &quot;format&quot;: &quot;uri&quot;
            },
            &quot;contact&quot;: {
              &quot;title&quot;: &quot;Contact Details&quot;,
              &quot;description&quot;: &quot;Details of the person to contact&quot;,
              &quot;type&quot;: &quot;object&quot;,
              &quot;required&quot;: [],
              &quot;properties&quot;: {
                &quot;name&quot;: {
                  &quot;title&quot;: &quot;Name&quot;,
                  &quot;description&quot;: &quot;Name of the contact person&quot;,
                  &quot;type&quot;: &quot;string&quot;
                },
                &quot;position&quot;: {
                  &quot;title&quot;: &quot;Position&quot;,
                  &quot;description&quot;: &quot;Position / Role of the contact person&quot;,
                  &quot;type&quot;: &quot;string&quot;
                },
                &quot;tel&quot;: {
                  &quot;title&quot;: &quot;Telephone Number&quot;,
                  &quot;description&quot;: &quot;Telephone number of the contact person&quot;,
                  &quot;type&quot;: &quot;string&quot;
                },
                &quot;email&quot;: {
                  &quot;title&quot;: &quot;Email&quot;,
                  &quot;description&quot;: &quot;Email of the contact person&quot;,
                  &quot;type&quot;: &quot;string&quot;,
                  &quot;format&quot;: &quot;email&quot;
                },
                &quot;address&quot;: {
                  &quot;title&quot;: &quot;Address&quot;,
                  &quot;description&quot;: &quot;List of strings comprising the address of the contact person&quot;,
                  &quot;type&quot;: &quot;array&quot;,
                  &quot;items&quot;: { &quot;type&quot;: &quot;string&quot; },
                  &quot;minItems&quot;: 2,
                  &quot;maxItems&quot;: 6
                }
              }
            }
          }
        },
        &quot;items&quot;: {
          &quot;title&quot;: &quot;Items&quot;,
          &quot;description&quot;: &quot;Items included into the receipt&quot;,
          &quot;type&quot;: &quot;array&quot;,
          &quot;minItems&quot;: 1,
          &quot;uniqueItems&quot;: true,
          &quot;items&quot;: {
            &quot;$ref&quot;: &quot;item.json#&quot;
          }
        },
        &quot;comments&quot;: {
          &quot;title&quot;: &quot;Comments&quot;,
          &quot;description&quot;: &quot;Any messages/comments the issuer wishes to convey to the customer&quot;,
          &quot;type&quot;: &quot;string&quot;
        }
      }
    },
    &quot;image&quot;: {
      &quot;title&quot;: &quot;Image&quot;,
      &quot;description&quot;: &quot;Viewable/Printable Image of the Digital Receipt&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;signature&quot;: {
      &quot;title&quot;: &quot;Signature&quot;,
      &quot;description&quot;: &quot;Digital signature by the vendor of receipts data&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;extra&quot;: {
      &quot;title&quot;: &quot;Extra&quot;,
      &quot;description&quot;: &quot;Extra information about the business/receipt as needed&quot;,
      &quot;type&quot;: &quot;string&quot;
    }
  }
}
```

#### Line Items Schema

```json
{
  &quot;type&quot;: &quot;object&quot;,
  &quot;id&quot;: &quot;item.json#&quot;,
  &quot;required&quot;: [&quot;id&quot;, &quot;title&quot;, &quot;date&quot;, &quot;amount&quot;, &quot;tax&quot;, &quot;quantity&quot;],
  &quot;properties&quot;: {
    &quot;id&quot;: {
      &quot;title&quot;: &quot;ID&quot;,
      &quot;description&quot;: &quot;Unique identifier of the goods or service&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;title&quot;: {
      &quot;title&quot;: &quot;Title&quot;,
      &quot;description&quot;: &quot;Title of the goods or service&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;description&quot;: {
      &quot;title&quot;: &quot;Description&quot;,
      &quot;description&quot;: &quot;Description of the goods or service&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;link&quot;: {
      &quot;title&quot;: &quot;Link&quot;,
      &quot;description&quot;: &quot;URL link to the web page for the product or sevice&quot;,
      &quot;type&quot;: &quot;string&quot;,
      &quot;format&quot;: &quot;uri&quot;
    },
    &quot;contract&quot;: {
      &quot;title&quot;: &quot;Contract&quot;,
      &quot;description&quot;: &quot;URL link or hash to an external contract for this product or service&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;serial_number&quot;: {
      &quot;title&quot;: &quot;Serial Number&quot;,
      &quot;description&quot;: &quot;Serial number of the item&quot;,
      &quot;type&quot;: &quot;string&quot;
    },
    &quot;date&quot;: {
      &quot;title&quot;: &quot;Supply Date&quot;,
      &quot;description&quot;: &quot;The date the goods or service were provided&quot;,
      &quot;type&quot;: &quot;string&quot;,
      &quot;format&quot;: &quot;date&quot;
    },
    &quot;amount&quot;: {
      &quot;title&quot;: &quot;Unit Price&quot;,
      &quot;description&quot;: &quot;Unit Price per item (excluding tax)&quot;,
      &quot;type&quot;: &quot;number&quot;
    },
    &quot;tax&quot;: {
      &quot;title&quot;: &quot;Tax&quot;,
      &quot;description&quot;: &quot;Amount of tax charged for unit&quot;,
      &quot;type&quot;: &quot;array&quot;,
      &quot;items&quot;: {
        &quot;type&quot;: &quot;object&quot;,
        &quot;required&quot;: [&quot;name&quot;, &quot;rate&quot;, &quot;amount&quot;],
        &quot;properties&quot;: {
          &quot;name&quot;: {
            &quot;title&quot;: &quot;Name of Tax&quot;,
            &quot;description&quot;: &quot;GST/PST etc&quot;,
            &quot;type&quot;: &quot;string&quot;
          },
          &quot;rate&quot;: {
            &quot;title&quot;: &quot;Tax Rate&quot;,
            &quot;description&quot;: &quot;Tax rate as a percentage&quot;,
            &quot;type&quot;: &quot;number&quot;
          },
          &quot;amount&quot;: {
            &quot;title&quot;: &quot;Tax Amount&quot;,
            &quot;description&quot;: &quot;Total amount of tax charged&quot;,
            &quot;type&quot;: &quot;number&quot;
          }
        }
      }
    },
    &quot;quantity&quot;: {
      &quot;title&quot;: &quot;Quantity&quot;,
      &quot;description&quot;: &quot;Number of units&quot;,
      &quot;type&quot;: &quot;integer&quot;
    }
  }
}
```

## Rationale

The schema introduced complies with ERC-721&apos;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.

## Backwards Compatibility

This standard is an extension of ERC-721. It is compatible with both optional extensions, Metadata and Enumerable, mentioned in ERC-721.

## Security Considerations

The data stored in the digital receipt includes various types of personally identifying information (PII), such as the vendor&apos;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.

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&apos;s privacy is maintained, and their data is protected from potential misuse.

While encrypting PII is essential, it is important to note that defining a specific encryption standard is beyond the scope of this ERC. 

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

</description>
        <pubDate>Thu, 01 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5570</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5570</guid>
      </item>
    
      <item>
        <title>Sign-In with Ethereum Capabilities, ReCaps</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5573-siwe-recap/10627</comments>
        
        <description>## Abstract

[ERC-4361](./eip-4361.md), 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.

## Motivation

SIWE ReCaps unlock integration of protocols and/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).

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.

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.

## Specification

This specification has three different audiences:

- Web3 application developers that want to integrate ReCaps to authenticate with any protocols and APIs that support object capabilities.
- Protocol or API developers that want to learn how to define their own ReCaps.
- Wallet implementers that want to improve the UI for ReCaps.

### Terms and Definitions

- ReCap - A SIWE Message complying with this specification, i.e. containing at least one ReCap URI in the `Resources` section and the corresponding human-readable ReCap Statement appended to the SIWE `statement`.
- ReCap URI - A type of URI that resolves to a ReCap Details Object.
- ReCap Details Object - A JSON object describing the actions and optionally the resources associated with a ReCap Capability.
- Resource Service (RS) - The entity that is providing third-party services for the Ethereum account.
- SIWE Client (SC) - The entity initiating the authorization (SIWE authentication and ReCap flow).
- Relying Party (RP) - same as SC in the context of authorization.

### Overview

This specification defines the following:

- ReCap SIWE Extension
- ReCap Capability
  - ReCap URI Scheme
  - ReCap Details Object Schema
- ReCap Translation Algorithm
- ReCap Verification

### ReCap SIWE Extension

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 `Resources` array of the SIWE message that MUST deterministically translate the ReCap Capability in human-readable form to the `statement` field in the SIWE message using the ReCap Translation Algorithm.

The following SIWE message fields are used to further define (or limit) the scope of all ReCap Capabilities:

- The `URI` field MUST specify the intended Relying Party, e.g., `https://example.com`, `did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK`. It is expected that the RS authenticates the Relying Party before invoking an action for the ReCap Capability.
- The `Issued At` field MUST be used to specify the issuance date of the ReCap Capabilities.
- If present, the `Expiration Time` 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.
- If present, the `Not Before` field MUST be used as the time that has to expire before the RS starts accepting invocations of the capabilities expressed in the message.

The following is a non-normative example of a SIWE message with the SIWE ReCap Extension:

```text
example.com wants you to sign in with your Ethereum account:
0x0000000000000000000000000000000000000000

I further authorize the stated URI to perform the following actions on my behalf: (1) &apos;example&apos;: &apos;append&apos;, &apos;read&apos; for &apos;https://example.com&apos;. (2) &apos;other&apos;: &apos;action&apos; for &apos;https://example.com&apos;. (3) &apos;example&apos;: &apos;append&apos;, &apos;delete&apos; for &apos;my:resource:uri.1&apos;. (4) &apos;example&apos;: &apos;append&apos; for &apos;my:resource:uri.2&apos;. (5) &apos;example&apos;: &apos;append&apos; for &apos;my:resource:uri.3&apos;.

URI: did:key:example
Version: 1
Chain ID: 1
Nonce: mynonce1
Issued At: 2022-06-21T12:00:00.000Z
Resources:
- urn:recap:eyJhdHQiOnsiaHR0cHM6Ly9leGFtcGxlLmNvbSI6eyJleGFtcGxlL2FwcGVuZCI6W10sImV4YW1wbGUvcmVhZCI6W10sIm90aGVyL2FjdGlvbiI6W119LCJteTpyZXNvdXJjZTp1cmkuMSI6eyJleGFtcGxlL2FwcGVuZCI6W10sImV4YW1wbGUvZGVsZXRlIjpbXX0sIm15OnJlc291cmNlOnVyaS4yIjp7ImV4YW1wbGUvYXBwZW5kIjpbXX0sIm15OnJlc291cmNlOnVyaS4zIjp7ImV4YW1wbGUvYXBwZW5kIjpbXX19LCJwcmYiOltdfQ
```

#### ReCap Capability

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., `URI`, `Issued At`, `Expiration Time`, `Not Before`.

##### ReCap URI Scheme

A ReCap URI starts with `urn:recap:` 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.

The following is a non-normative example of a ReCap Capability:

```text
urn:recap:eyJhdHQiOnsiaHR0cHM6Ly9leGFtcGxlLmNvbS9waWN0dXJlcy8iOnsiY3J1ZC9kZWxldGUiOlt7fV0sImNydWQvdXBkYXRlIjpbe31dLCJvdGhlci9hY3Rpb24iOlt7fV19LCJtYWlsdG86dXNlcm5hbWVAZXhhbXBsZS5jb20iOnsibXNnL3JlY2VpdmUiOlt7Im1heF9jb3VudCI6NSwidGVtcGxhdGVzIjpbIm5ld3NsZXR0ZXIiLCJtYXJrZXRpbmciXX1dLCJtc2cvc2VuZCI6W3sidG8iOiJzb21lb25lQGVtYWlsLmNvbSJ9LHsidG8iOiJqb2VAZW1haWwuY29tIn1dfX0sInByZiI6WyJ6ZGo3V2o2Rk5TNHJVVWJzaUp2amp4Y3NOcVpkRENTaVlSOHNLUVhmb1BmcFNadUF3Il19
```

##### Ability Strings

Ability Strings identify an action or Ability within a Namespace. They are serialized as `&lt;namespace&gt;/&lt;ability&gt;`. Namespaces and Abilities MUST contain only alphanumeric characters as well as the characters `.`, `*`, `_`, `+`, `-`, conforming to the regex `^[a-zA-Z0-9.*_+-]$`. The ability string as a whole MUST conform to `^[a-zA-Z0-9.*_+-]+\/[a-zA-z0-9.*_+-]+$`. For example, `crud/update` has an ability-namespace of `crud` and an ability-name of `update`.

##### ReCap Details Object Schema

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:

```jsonc
{
  &quot;$schema&quot;: &quot;http://json-schema.org/draft-04/schema#&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;att&quot;: {
      &quot;type&quot;: &quot;object&quot;,
      &quot;propertyNames&quot;: {
        &quot;format&quot;: &quot;uri&quot;
      },
      &quot;patternProperties&quot;: {
        &quot;^.+:.*$&quot;: {
          &quot;type&quot;: &quot;object&quot;,
          &quot;patternProperties&quot;: {
            &quot;^[a-zA-Z0-9.*_+-]+\/[a-zA-z0-9.*_+-]+$&quot;: {
              &quot;type&quot;: &quot;array&quot;,
              &quot;items&quot;: {
                &quot;type&quot;: &quot;object&quot;
              }
            }
          },
          &quot;additionalProperties&quot;: false,
          &quot;minProperties&quot;: 1
        }
      },
      &quot;additionalProperties&quot;: false,
      &quot;minProperties&quot;: 1
    },
    &quot;prf&quot;: {
      &quot;type&quot;: &quot;array&quot;,
      &quot;items&quot;: {
        &quot;type&quot;: &quot;string&quot;,
        &quot;format&quot;: &quot;CID&quot;
      },
      &quot;minItems&quot;: 1
    }
  }
}
```

A ReCap Details Object defines the following properties:

- `att`: (CONDITIONAL) If present, `att` 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.
- `prf`: (CONDITIONAL) If present, `prf` 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 `att` if the SIWE `address` does not identify the controller of the `att` entries.

Objects in the `att` field (including nested objects) MUST NOT contain duplicate keys and MUST have their keys ordered lexicographically with two steps:

1. Sort by byte value.
2. If a string starts with another, the shorter string comes first (e.g. `msg/send` comes before `msg/send-to`)

This is the same as the `Array.sort()` method in JavaScript. In the example below, `crud/delete` must appear before `crud/update` and `other/action`, similarly `msg/receive` must appear before `msg/send`.

The following is a non-normative example of a ReCap Capability Object with `att` and `prf`:

```jsonc
{
   &quot;att&quot;:{
      &quot;https://example.com/pictures/&quot;:{
         &quot;crud/delete&quot;: [{}],
         &quot;crud/update&quot;: [{}],
         &quot;other/action&quot;: [{}]
      },
      &quot;mailto:username@example.com&quot;:{
          &quot;msg/receive&quot;: [{
              &quot;max_count&quot;: 5,
              &quot;templates&quot;: [&quot;newsletter&quot;, &quot;marketing&quot;]
          }],
          &quot;msg/send&quot;: [{ &quot;to&quot;: &quot;someone@email.com&quot; }, { &quot;to&quot;: &quot;joe@email.com&quot; }]
      }
   },
   &quot;prf&quot;:[&quot;bafybeigk7ly3pog6uupxku3b6bubirr434ib6tfaymvox6gotaaaaaaaaa&quot;]
}
```

In the example above, the Relying Party is authorized to perform the actions `crud/update`, `crud/delete` and `other/action` on resource `https://example.com/pictures/` without limitations for any. Additionally the Relying Party is authorized to perform actions `msg/send` and `msg/recieve` on resource `mailto:username@example.com`, where `msg/send` is limited to sending to `someone@email.com` or `joe@email.com` and `msg/recieve` is limited to a maximum of 5 and templates `newsletter` or `marketing`. 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.

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.

This example is expected to transform into the following `recap-transformed-statement` (for `URI` of `https://example.com`):

```text
I further authorize the stated URI to perform the following actions on my behalf: (1) &apos;crud&apos;: &apos;delete&apos;, &apos;update&apos; for &apos;https://example.com/pictures/&apos;. (2) &apos;other&apos;: &apos;action&apos; for &apos;https://example.com/pictures/&apos;. (3) &apos;msg&apos;: &apos;receive&apos;, &apos;send&apos; for &apos;mailto:username@example.com&apos;.
```

This example is also expected to transform into the following `recap-uri`:

```text
urn:recap:eyJhdHQiOnsiaHR0cHM6Ly9leGFtcGxlLmNvbS9waWN0dXJlcy8iOnsiY3J1ZC9kZWxldGUiOlt7fV0sImNydWQvdXBkYXRlIjpbe31dLCJvdGhlci9hY3Rpb24iOlt7fV19LCJtYWlsdG86dXNlcm5hbWVAZXhhbXBsZS5jb20iOnsibXNnL3JlY2VpdmUiOlt7Im1heF9jb3VudCI6NSwidGVtcGxhdGVzIjpbIm5ld3NsZXR0ZXIiLCJtYXJrZXRpbmciXX1dLCJtc2cvc2VuZCI6W3sidG8iOiJzb21lb25lQGVtYWlsLmNvbSJ9LHsidG8iOiJqb2VAZW1haWwuY29tIn1dfX0sInByZiI6WyJ6ZGo3V2o2Rk5TNHJVVWJzaUp2amp4Y3NOcVpkRENTaVlSOHNLUVhmb1BmcFNadUF3Il19
```

##### Merging Capability Objects

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:

```jsonc
{
  &quot;att&quot;: {
    &quot;https://example1.com&quot;: {
      &quot;crud/read&quot;: [{}]
    }
  },
  &quot;prf&quot;: [&quot;bafyexample1&quot;]
}

{
  &quot;att&quot;: {
    &quot;https://example1.com&quot;: {
      &quot;crud/update&quot;: [{
        &quot;max_times&quot;: 1
      }]
    },
    &quot;https://example2.com&quot;: {
      &quot;crud/delete&quot;: [{}]
    }
  },
  &quot;prf&quot;: [&quot;bafyexample2&quot;]
}
```

combine into:

```jsonc
{
  &quot;att&quot;: {
    &quot;https://example1.com&quot;: {
      &quot;crud/read&quot;: [{}],
      &quot;crud/update&quot;: [{
        &quot;max_times&quot;: 1
      }]
    },
    &quot;https://example2.com&quot;: {
      &quot;crud/delete&quot;: [{}]
    }
  },
  &quot;prf&quot;: [&quot;bafyexample1&quot;, &quot;bafyexample2&quot;]
}
```

#### ReCap Translation Algorithm

After applying the ReCap Translation Algorithm on a given SIWE message that MAY include a pre-defined `statement`, the `recap-transformed-statement` in a ReCap SIWE message MUST conform to the following ABNF:

```text
recap-transformed-statement = statement recap-preamble 1*(&quot; &quot; recap-statement-entry &quot;.&quot;)
   ; see ERC-4361 for definition of input-statement
recap-preamble = &quot;I further authorize the stated URI to perform the following actions on my behalf:&quot;
recap-statement-entry = &quot;(&quot; number &quot;) &quot; action-namespace &quot;: &quot; 
                          action-name *(&quot;,&quot; action-name) &quot;for&quot;
                          recap-resource
   ; see RFC8259 for definition of number
ability-namespace = string
   ; see RFC8259 for definition of string
ability-name = string
   ; see RFC8259 for definition of string
recap-resource = string
   ; see RFC8259 for definition of string
```

The following algorithm or an algorithm that produces the same output MUST be performed to generate the SIWE ReCap Transformed Statement.

Inputs:

- Let `recap-uri` 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.
- [Optional] Let `statement` be the statement field of the input SIWE message conforming to ERC-4361.
Algorithm:
- Let `recap-transformed-statement` be an empty string value.
- If `statement` is present, do the following:
  - Append the value of the `statement` field of `siwe` to `recap-transformed-statement`.
  - Append a single space character `&quot; &quot;` to `recap-transformed-statement`.
- Append the following string to `recap-transformed-statement`: `&quot;I further authorize the stated URI to perform the following actions on my behalf:&quot;`.
- Let `numbering` be an integer starting with 1.
- Let `attenuations` be the `att` field of the ReCap Details Object
- For each key and value pair in `attenuations` (starting with the first entry), perform the following:
  - Let `resource` be the key and `abilities` be the value
  - Group the keys of the `abilities` object by their `ability-namespace`
  - For each `ability-namespace`, perform the following:
    - Append the string concatenation of `&quot; (&quot;`, `numbering`, `&quot;)&quot;` to `recap-transformed-statement`.
    - Append the string concatenation of `&apos;`, `ability-namespace`, `&apos;:` to `recap-transformed-statement`.
    - For each `ability-name` in the `ability-namespace` group, perform the following:
      - Append the string concatenation of `&apos;`, `ability-name`, `&apos;` to `recap-transformed-statement`
      - If not the final `ability-name`, append `,` to `recap-transformed-statement`
    - Append `for &apos;`, `resource`, `&apos;.` to `recap-transformed-statement`
    - Increase `numbering` by 1
- Return `recap-transformed-statement`.

#### ReCap Verification Algorithm

The following algorithm or an algorithm that produces the same output MUST be performed to verify a SIWE ReCap.

Inputs:

- Let `recap-siwe` be the input SIWE message conforming to ERC-4361 and this EIP.
- Let `siwe-signature` be the output of signing `recap-siwe`, as defined in ERC-4361.
Algorithm:
- Perform ERC-4361 signature verification with `recap-siwe` and `siwe-signature` as inputs.
- Let `uri` be the uri field of `recap-siwe`.
- Let `recap-uri` be a recap URI taken from the last entry of the resources field of `recap-siwe`.
- Let `recap-transformed-statement` be the result of performing the above `ReCap Translation Algorithm` with `uri` and `recap-uri` as input.
- Assert that the statement field of `recap-siwe` ends with `recap-transformed-statement`.

### Implementer&apos;s Guide

TBD

#### Web3 Application Implementers

TBD

#### Wallet Implementers

TBD

#### Protocol or API Implementers

TBD

## Rationale

TBD

## Security Considerations

Resource service implementer&apos;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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 20 Jul 2021 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5573</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5573</guid>
      </item>
    
      <item>
        <title>ERC-721 NFT Authorization</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/nft-authorization-erc721-extension/10661</comments>
        
        <description>## Abstract

This EIP separates the [ERC-721](./eip-721.md) NFT&apos;s commercial usage rights from its ownership to allow for the independent management of those rights.

## Motivation

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&apos;s ownership and user rights can enhance its commercial value.

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.

## Specification

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.

### Contract Interface

```solidity
interface IERC5585 {

    struct UserRecord {
        address user;
        string[] rights;
        uint256 expires;
    }

    /// @notice Get all available rights of this NFT project
    /// @return All the rights that can be authorized to the user
    function getRights() external view returns(string[]);

    /// @notice NFT holder authorizes all the rights of the NFT to a user for a specified period of time
    /// @dev The zero address indicates there is no user
    /// @param tokenId The NFT which is authorized
    /// @param user The user to whom the NFT is authorized
    /// @param duration The period of time the authorization lasts
    function authorizeUser(uint256 tokenId, address user, uint duration) external;

    /// @notice NFT holder authorizes specific rights to a user for a specified period of time
    /// @dev The zero address indicates there is no user. It will throw exception when the rights are not defined by this NFT project
    /// @param tokenId The NFT which is authorized
    /// @param user The user to whom the NFT is authorized
    /// @param rights Rights authorized to the user, such as renting, distribution or display etc
    /// @param duration The period of time the authorization lasts
    function authorizeUser(uint256 tokenId, address user, string[] rights, uint duration) external;
    
    /// @notice The user of the NFT transfers his rights to the new user
    /// @dev The zero address indicates there is no user
    /// @param tokenId The rights of this NFT is transferred to the new user
    /// @param newUser The new user
    function transferUserRights(uint256 tokenId, address newUser) external;

    /// @notice NFT holder extends the duration of authorization
    /// @dev The zero address indicates there is no user. It will throw exception when the rights are not defined by this NFT project
    /// @param tokenId The NFT which has been authorized
    /// @param user The user to whom the NFT has been authorized
    /// @param duration The new duration of the authorization
    function extendDuration(uint256 tokenId, address user, uint duration) external;

    /// @notice NFT holder updates the rights of authorization
    /// @dev The zero address indicates there is no user
    /// @param tokenId The NFT which has been authorized
    /// @param user The user to whom the NFT has been authorized
    /// @param rights New rights authorized to the user
    function updateUserRights(uint256 tokenId, address user, string[] rights) external;

    /// @notice Get the authorization expired time of the specified NFT and user
    /// @dev The zero address indicates there is no user
    /// @param tokenId The NFT to get the user expires for
    /// @param user The user who has been authorized
    /// @return The authorization expired time
    function getExpires(uint256 tokenId, address user) external view returns(uint);

    /// @notice Get the rights of the specified NFT and user
    /// @dev The zero address indicates there is no user
    /// @param tokenId The NFT to get the rights
    /// @param user The user who has been authorized
    /// @return The rights has been authorized
    function getUserRights(uint256 tokenId, address user) external view returns(string[]);

    /// @notice The contract owner can update the number of users that can be authorized per NFT
    /// @param userLimit The number of users set by operators only
    function updateUserLimit(uint256 userLimit) external onlyOwner;

    /// @notice resetAllowed flag can be updated by contract owner to control whether the authorization can be revoked or not 
    /// @param resetAllowed It is the boolean flag
    function updateResetAllowed(bool resetAllowed) external onlyOwner;

    /// @notice Check if the token is available for authorization
    /// @dev Throws if tokenId is not a valid NFT
    /// @param tokenId The NFT to be checked the availability
    /// @return true or false whether the NFT is available for authorization or not
    function checkAuthorizationAvailability(uint256 tokenId) public view returns(bool);

    /// @notice Clear authorization of a specified user
    /// @dev The zero address indicates there is no user. The function  works when resetAllowed is true and it will throw exception when false  
    /// @param tokenId The NFT on which the authorization based
    /// @param user The user whose authorization will be cleared
    function resetUser(uint256 tokenId, address user) external;


    /// @notice Emitted when the user of a NFT is changed or the authorization expires time is updated
    /// param tokenId The NFT on which the authorization based
    /// param indexed user The user to whom the NFT authorized
    /// @param rights Rights authorized to the user
    /// @param expires The expires time of the authorization
    event authorizeUser(uint256 indexed tokenId, address indexed user, string[] rights, uint expires);

    /// @notice Emitted when the number of users that can be authorized per NFT is updated
    /// @param userLimit The number of users set by operators only
    event updateUserLimit(uint256 userLimit);
}
```

The `getRights()` function MAY be implemented as pure and view.

The `authorizeUser(uint256 tokenId, address user, uint duration)` function MAY be implemented as `public` or `external`.

The `authorizeUser(uint256 tokenId, address user, string[] rights; uint duration)` function MAY be implemented as `public` or `external`.

The `transferUserRights(uint256 tokenId, address newUser)` function MAY be implemented as `public` or `external`.

The `extendDuration(uint256 tokenId, address user, uint duration)` function MAY be implemented as `public` or `external`.

The `updateUserRights(uint256 tokenId, address user, string[] rights)` function MAY be implemented as `public` or `external`.

The `getExpires(uint256 tokenId, address user)` function MAY be implemented as `pure` or `view`.

The `getUserRights(uint256 tokenId, address user)` function MAY be implemented as pure and view.

The `updateUserLimit(unit256 userLimit)` function MAY be implemented as `public` or `external`.

The `updateResetAllowed(bool resetAllowed)` function MAY be implemented as `public` or `external`.

The `checkAuthorizationAvailability(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `resetUser(uint256 tokenId, address user)` function MAY be implemented as `public` or `external`.

The `authorizeUser` event MUST be emitted when the user of a NFT is changed or the authorization expires time is updated.

The `updateUserLimit` event MUST be emitted when the number of users that can be authorized per NFT is updated.

## Rationale

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.

Secondly, there is a `resetAllowed` 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.

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.

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.

## Backwards Compatibility

This standard is compatible with [ERC-721](./eip-721.md) since it is an extension of it.

## Security Considerations

When the `resetAllowed` 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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 15 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5585</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5585</guid>
      </item>
    
      <item>
        <title>NFT Lien</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/creating-a-new-erc-proposal-for-nft-lien/10683</comments>
        
        <description>## Abstract

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 remove a lien, plus an event.

## Motivation

Liens are widely used in financial 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.

## Specification

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.

1. Any compliant contract MUST implement [ERC-721](./eip-721.md) and [ERC-165](./eip-165.md).

2. Any compliant contract MUST implement the following interface:

```solidity
interface IERC_LIEN is ERC721, ERC165 {

    /// === Events ===

    /// @notice MUST be emitted when new lien is successfully placed.
    /// @param tokenId the token a lien is placed on.
    /// @param holder the holder of the lien.
    /// @param extraParams of the original request to add the lien.
    event OnLienPlaced(uint256 tokenId, address holder, bytes calldata extraParams);

    /// @notice MUST be emitted when an existing lien is successfully removed.
    /// @param tokenId the token a lien was removed from.
    /// @param holder the holder of the lien.
    /// @param extraParams of the original request to remove the lien.
    event OnLienRemoved(uint256 tokenId, address holder, bytes calldata extraParams);

    /// === CRUD ===

    /// @notice The method to place a lien on a token
    ///         it MUST throw an error if the same holder already has a lien on the same token.
    /// @param tokenId the token a lien is placed on.
    /// @param holder the holder of the lien
    /// @param extraParams extra data for future extension.
    function addLienHolder(uint256 tokenId, address holder, bytes calldata extraParams) public;

    /// @notice The method to remove a lien on a token
    ///         it MUST throw an error if the holder already has a lien.
    /// @param tokenId the token a lien is being removed from.
    /// @param holder the holder of the lien
    /// @param extraParams extra data for future extension.
    function removeLienHolder(uint256 tokenId, address holder, bytes calldata extraParams) public;

    /// @notice The method to query if an active lien exists on a token.
    ///         it MUST throw an error if the tokenId doesn&apos;t exist or is not owned.
    /// @param tokenId the token a lien is being queried for
    /// @param holder the holder about whom the method is querying about lien holding.
    /// @param extraParams extra data for future extension.
    function hasLien(uint256 tokenId, address holder, bytes calldata extraParams) public view returns (bool);
}
```

## Rationale

1. We only support [ERC-721](./eip-721.md) NFTs for simplicity and gas efficiency. We have not considered other ERCs, which can be left for future extensions. For example, [ERC-20](./eip-20.md) and [ERC-1155](./eip-1155.md) were not considered.

2. We choose separate &quot;addLienHolder&quot; and &quot;removeLienHolder&quot; instead of using a single `changeLienholder` with amount because we believe
the add and remove actions 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.

3. 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.

4. We have not specified how endorsement can be applied to allow holders to signal their approval for transfer or swapping. We believe this is complex enough and worthy of an individual ERC by itself.

## Backwards Compatibility

The ERC is designed as an extension of [ERC-721](./eip-721.md), and therefore compliant contracts need to fully comply with [ERC-721](./eip-721.md).

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 05 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5604</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5604</guid>
      </item>
    
      <item>
        <title>Multiverse NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5606-multiverse-nfts-for-digital-asset-interoperability/10698</comments>
        
        <description>## Abstract

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 [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md). 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.

## Motivation

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.

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.

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.

## Specification

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.

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.

```
/**
* @dev Interface of the Multiverse NFT standard as defined in the EIP.
*/
interface IMultiverseNFT {

   /**
    * @dev struct to store delegate token details
    *
    */
   struct DelegateData {
       address contractAddress;
       uint256 tokenId;
       uint256 quantity;
   }

   /**
    * @dev Emitted when one or more new delegate NFTs are added to a Multiverse NFT
    */
   event Bundled(uint256 multiverseTokenID, DelegateData[] delegateData, address ownerAddress);


   /**
    * @dev Emitted when one or more delegate NFTs are removed from a Multiverse NFT
    */
   event Unbundled(uint256 multiverseTokenID, DelegateData[] delegateData);

   /**
    * @dev Accepts the tokenId of the Multiverse NFT and returns an array of delegate token data
    */
   function delegateTokens(uint256 multiverseTokenID) external view returns (DelegateData[] memory);

   /**
    * @dev Removes one or more delegate NFTs from a Multiverse NFT
    * This function accepts the delegate NFT details and transfers those NFTs out of the Multiverse NFT contract to the owner&apos;s wallet
    */
   function unbundle(DelegateData[] memory delegateData, uint256 multiverseTokenID) external;

   /**
    * @dev Adds one or more delegate NFTs to a Multiverse NFT
    * This function accepts the delegate NFT details and transfers those NFTs to the Multiverse NFT contract
    * Need to ensure that approval is given to this Multiverse NFT contract for the delegate NFTs so that they can be transferred programmatically
    */
   function bundle(DelegateData[] memory delegateData, uint256 multiverseTokenID) external;

   /**
    * @dev Initialises a new bundle, mints a Multiverse NFT and assigns it to msg.sender
    * Returns the token ID of a new Multiverse NFT
    * Note - When a new Multiverse NFT is initialised, it is empty; it does not contain any delegate NFTs
    */
   function initBundle(DelegateData[] memory delegateData) external;
}
```

Any dapp implementing this standard would initialise a bundle by calling the function `initBundle`. 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.

Once a bundle is initialised, the delegate NFT tokens can then be transferred to this Multiverse NFT contract by calling the function `bundle` 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.

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 `unbundle`. This function transfers the particular delegate NFT token(s) to msg.sender (only if `msg.sender` is the owner of the multiverse NFT).

## Rationale

The `delegateData` struct contains information about the delegate NFT tokens on each platform. It contains variables such as `contractAddress`, `tokenId`, `quantity` to differentiate the NFTs. These NFTs could be following either the ERC-721 standard or the ERC-1155 standard.

The `bundle` and `unbundle` 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.

## Backwards Compatibility

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.

## Reference Implementation

[MultiverseNFT.sol](../assets/eip-5606/contracts/MultiverseNFT.sol)

## Security Considerations

The bundle function involves calling an external contract(s). So reentrancy prevention measures should be applied while implementing this function.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 06 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5606</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5606</guid>
      </item>
    
      <item>
        <title>ERC-1155 Supply Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5615-eip-1155-supply-extension/10732</comments>
        
        <description>## Abstract

This ERC standardizes an existing mechanism to fetch token supply data from [ERC-1155](./eip-1155.md) tokens. It adds a `totalSupply` function, which fetches the number of tokens with a given `id`, and an `exists` function, which checks for the existence of a given `id`.

## Specification

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.

```solidity
interface ERC1155Supply is ERC1155 {
  // @notice      This function MUST return whether the given token id exists, previously existed, or may exist
  // @param   id  The token id of which to check the existence
  // @return      Whether the given token id exists, previously existed, or may exist
  function exists(uint256 id) external view returns (bool);

  // @notice      This function MUST return the number of tokens with a given id. If the token id does not exist, it MUST return 0.
  // @param   id  The token id of which fetch the total supply
  // @return      The total supply of the given token id
  function totalSupply(uint256 id) external view returns (uint256);
}
```

Implementations MAY support [ERC-165](./eip-165.md) interface discovery, but consumers MUST NOT rely on it.

## Rationale

This ERC does not implement [ERC-165](./eip-165.md), as this interface is simple enough that the extra complexity is unnecessary and would cause incompatibilities with pre-existing implementations.

The `totalSupply` and `exists` functions were modeled after [ERC-721](./eip-721.md) and [ERC-20](./eip-20.md).

`totalSupply` does not revert if the token ID does not exist, since contracts that care about that case should use `exists` instead (which might return false even if `totalSupply` is zero).

`exists` is included to differentiate between the two ways that `totalSupply` 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).

## Backwards Compatibility

This ERC is designed to be backward compatible with the OpenZeppelin `ERC1155Supply`.

## Security Considerations

None.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 25 May 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5615</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5615</guid>
      </item>
    
      <item>
        <title>NFT Metadata JSON Schema dStorage Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5625-nft-metadata-json-schema-dstorage-extension/10754</comments>
        
        <description>## Abstract

This EIP extends the NFT metadata JSON schema defined in [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md), adding a `dStorage` key that provides information about how the NFT data is stored. 

## Motivation

As highly valuable crypto properties, NFT assets intrinsically demand guaranteed storage to assure their **immutability**, **reliability**, and **durability**. NFT ownership is tracked by [EIP-721](./eip-721.md) or [EIP-1155](./eip-1155.md) 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 **decentralized storage** adoption in NFT world, we propose to add additional **dStorage** information into NFT metadata JSON schema.

As a refresher, let&apos;s review existing NFT metadata JSON schema standards. [EIP-721](./eip-721.md) defines a standard contract method `tokenURI` to return a given NFT&apos;s metadata JSON file, conforming to the *[EIP-721](./eip-721.md) Metadata JSON Schema*, which defines three properties: `name`, `description` and `image`.

Similarly, [EIP-1155](./eip-1155.md) also defines a standard contract method `uri` to return NFT metadata JSON files conforming to the *[EIP-1155](./eip-1155.md) Metadata JSON Schema*, which defines properties like `name`, `decimals`, `description`, `image`, `properties`, `localization`, etc.

Besides, as the world&apos;s largest NFT marketplace nowadays, OpenSea defines their own *Metadata Standards*, including a few more properties like `image_data`, `external_url`, `attributes`, `background_color`, `animation_url`, `youtube_url`, etc. This standard is de facto respected and followed by other NFT marketplaces like LooksRare.

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.


## Specification

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.

In addition to the existing properties, the Metadata JSON file returned by [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md) smart contracts (via `tokenURI` and `uri` methods, respectively), should OPTIONALLY contains one more `dStorage` property.

For [EIP-721](./eip-721.md) smart contracts, the Metadata JSON file schema is:

```json
{
    &quot;title&quot;: &quot;Asset Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset to which this NFT represents&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset to which this NFT represents&quot;
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
        },
        &quot;dStorage&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;required&quot;: [&quot;platform&quot;, &quot;description&quot;, &quot;persistence_mechanism&quot;, &quot;challenge_mechanism&quot;, &quot;consensus&quot;, &quot;dstorage_note&quot;],
            &quot;properties&quot;: {
                &quot;platform&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;dStorage platform name like Swarm, Arweave, Filecoin, Crust, etc&quot;
                },
                &quot;description&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;A brief description of the dStorage platform&quot;
                },
                &quot;persistence_mechanism&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;Persistence mechanism or incentive structure of the dStorage platform, like &apos;blockchain-based&apos;, &apos;contract-based&apos;, etc&quot;
                },
                &quot;challenge_mechanism&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;Challenge mechanism of the dStorage platform, like Arweave&apos;s proof-of-access, etc&quot;
                },
                &quot;consensus&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;Consensus mechanism of the dStorage platform, like PoW, PoS, etc&quot;
                },
                &quot;dstorage_note&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;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&quot;
                }
            }
        }
    }
}
```

For [EIP-1155](./eip-1155.md) smart contracts, the Metadata JSON file schema is:

```json
{
    &quot;title&quot;: &quot;Token Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset to which this token represents&quot;,
        },
        &quot;decimals&quot;: {
            &quot;type&quot;: &quot;integer&quot;,
            &quot;description&quot;: &quot;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.&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset to which this token represents&quot;
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
        },
        &quot;properties&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;description&quot;: &quot;Arbitrary properties. Values may be strings, numbers, object or arrays.&quot;,
        },
        &quot;localization&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;required&quot;: [&quot;uri&quot;, &quot;default&quot;, &quot;locales&quot;],
            &quot;properties&quot;: {
                &quot;uri&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;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.&quot;
                },
                &quot;default&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;The locale of the default data within the base JSON&quot;
                },
                &quot;locales&quot;: {
                    &quot;type&quot;: &quot;array&quot;,
                    &quot;description&quot;: &quot;The list of locales for which data is available. These locales should conform to those defined in the Unicode Common Locale Data Repository (http://cldr.unicode.org/).&quot;
                }
            }
        },
        &quot;dStorage&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;required&quot;: [&quot;platform&quot;, &quot;description&quot;, &quot;persistence_mechanism&quot;, &quot;challenge_mechanism&quot;, &quot;consensus&quot;, &quot;dstorage_note&quot;],
            &quot;properties&quot;: {
                &quot;platform&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;dStorage platform name like Swarm, Arweave, Filecoin, Crust, etc&quot;
                },
                &quot;description&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;A brief description of the dStorage platform&quot;
                },
                &quot;persistence_mechanism&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;Persistence mechanism or incentive structure of the dStorage platform, like &apos;blockchain-based&apos;, &apos;contract-based&apos;, etc&quot;
                },
                &quot;challenge_mechanism&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;Challenge mechanism of the dStorage platform, like Arweave&apos;s proof-of-access, etc&quot;
                },
                &quot;consensus&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;Consensus mechanism of the dStorage platform, like PoW, PoS, etc&quot;
                },
                &quot;dstorage_note&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;description&quot;: &quot;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&quot;
                }
            }
        }
    }
}
```

## Rationale

### Choice between Interface and JSON Schema Extension

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.

# Backwards Compatibility

This EIP is backward compatible with [EIP-721](./eip-721.md)  and [EIP-1155](./eip-1155.md).

## Security Considerations

This EIP does not introduce any new security risks or vulnerabilities, as the `dStorage` property is only an informational field of the Metadata JSON file returned by [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md) smart contracts. It does not affect the execution or validity of NFT transactions.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 08 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5625</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5625</guid>
      </item>
    
      <item>
        <title>New approach for encryption / decryption</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5630-encryption-and-decryption/10761</comments>
        
        <description>## Abstract

This EIP proposes a new way to encrypt and decrypt using Ethereum keys. This EIP uses _only_ the `secp256k1` curve, and proposes two new RPC methods: `eth_getEncryptionPublicKey` and `eth_performECDH`. These two methods, in conjunction, allow users to receive encryptions and perform decryptions (respectively). We require that the wallet _only_ 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 _different_ curves (namely, `secp256k1` and `ec25519`), and hardcoded a particular version of ECIES.

## Motivation

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 _only_ the encryption procedure—that is, the generation of the ciphertext—and _not_ 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 `data` field available in each standard transfer.)

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&apos;s HD wallet hierarchy—and then post the resulting ciphertext to secure storage (e.g., on-chain).  This design pattern allows the dApp/user to bootstrap the security of the _fresh_ secret onto the security of the user&apos;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).

## Specification

We describe our approach here; we compare our approach to prior EIPs in the **Rationale** section below. Throughout, we make reference to SEC 1: Elliptic Curve Cryptography, by Daniel R. L. Brown.

We use the `secp256k1` curve for both signing and encryption.
For encryption, we use ECIES. We specify that the wallet _only_ perform the sensitive ECDH operation. This lets implementers select their own ECIES variants at will.

We propose that all binary data be serialized to and from `0x`-prefixed hex strings. We moreover use `0x`-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 (`0x`-prefixed, 20-byte hex strings). Specifically, to serialize and deserialize elliptic curve points, implementers MUST use the following standard:

- to serialize a point: use [SEC 1, §2.3.3], with point compression.
- to deserialize a point: use [SEC 1, §2.3.3], while _requiring_ point compression; that is:

  - the input byte string MUST have length ⌈log₂q / 8⌉ + 1 = `33`.
  - the first byte MUST be `0x02` or `0x03`.
  - the integer represented by the remaining 32 bytes (as in [SEC 1, §2.3.8]) MUST reside in {0, ..., _p_ - 1}, and moreover MUST yield a quadratic residue modulo _p_ under the Weierstrass expression X^3 + 7 (modulo _p_).

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:

- the KDF `ANSI-X9.63-KDF`, where the hash function `SHA-512` is used,
- the HMAC `HMAC–SHA-256–256 with 32 octet or 256 bit keys`,
- the symmetric encryption scheme `AES–256 in CBC mode`.

We propose that the binary, _concatenated_ serialization mode for ECIES ciphertexts be used, both for encryption and decryption, where moreover elliptic curve points are _compressed_.

Thus, on the request:

```javascript
request({
  method: &apos;eth_getEncryptionPublicKey&apos;,
  params: [account]
})
```

where `account` is a standard 20-byte, `0x`-prefixed, hex-encoded Ethereum account, the client should operate as follows:

- find the secret signing key `sk` corresponding to the Ethereum account `account`, or else return an error if none exists.
- compute the `secp256k1` public key corresponding to `sk`.
- return this public key in compressed, `0x`-prefixed, hex-encoded form, following [SEC 1, §2.3.3].

On the request

```javascript
request({
  method: &apos;eth_performECDH&apos;,
  params: [account, ephemeralKey]
})
```

where `account` is as above, and `ephemeralKey` is an elliptic curve point encoded as above:

- find the secret key `sk` corresponding to the Ethereum account `account`, or else return an error if none exists.
- deserialize `ephemeralKey` to an elliptic curve point using [SEC 1, §2.3.3] (where compression is required), throwing an error if deserialization fails.
- compute the elliptic curve Diffie–Hellman secret, following [SEC 1, §3.3.1].
- return the resulting field element as an 0x-prefixed, hex-encoded, 32-byte string, using [SEC 1, §2.3.5].

Test vectors are given below.

### Encrypting to a smart contract

In light of account abstraction, [EIP-4337](eip-4337.md), 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 _advertise_ how it would like encryptions to it to be constructed. This should be viewed as an analogue of [EIP-1271](eip-1271.md), but for encryption, as opposed to signing.

Our specification is as follows.

```solidity
pragma solidity ^0.8.0;

contract ERC5630 {
  /**
   * @dev Should return an encryption of the provided plaintext, using the provided randomness.
   * @param plaintext      Plaintext to be encrypted
   * @param randomness     Entropy to be used during encryption
   */
  function encryptTo(bytes memory plaintext, bytes32 randomness)
    public
    view
    returns (bytes memory ciphertext);
}
```

Each contract MAY implement `encryptTo` as it desires. Unless it has a good reason to do otherwise, it SHOULD use the ECIES variant we propose above.

## Rationale

There is _no security proof_ for a scheme which simultaneously invokes signing on the `secp256k1` curve and encryption on the `ec25519` curve, and where _the same secret key is moreover used in both cases_. 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 _the same curve is used in both_. This very setting has been studied in prior work; see, e.g., Degabriele, Lehmann, Paterson, Smart and Strefler, _On the Joint Security of Encryption and Signature in EMV_, 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.

We now discuss a few further aspects of our approach.

**On-chain public key discovery.** Our proposal has an important feature whereby an encryption _to_ some account can be constructed whenever that account has signed at least one transaction.
Indeed, it is possible to recover an account&apos;s `secp256k1` public key directly from any signature on behalf of that account.

**ECDH vs. ECIES.** We specify that the wallet _only_ perform the sensitive ECDH operation, and let application-level implementers perform the remaining steps of ECIES. This has two distinct advantages:

- **Flexibility.** It allows implementers to select arbitrary variants of ECIES, without having to update what the wallet does.
- **Bandwidth.** 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. 

**Twist attacks.** A certain GitHub post by Christian Lundkvist warns against &quot;twist attacks&quot; on the `secp256k1` curve. These attacks are not applicable to this EIP, for multiple _distinct_ reasons, which we itemize:

- **Only applies to classical ECDH, not ECIES.** 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 _encryption_, 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.
- **Only applies to uncompressed points.** Indeed, we use compressed points in this EIP. When compressed points are used, each 33-byte string _necessarily_ 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).
- **Only applies when you fail to check a point is on the curve.** But this is inapplicable for us anyway, since we use compressed points (see above). We also require that all validations be performed.

## Backwards Compatibility

Our `eth_performECDH` method is new, and so doesn&apos;t raise any backwards compatibility issues.

A previous proposal proposed an `eth_getEncryptionPublicKey` method (together with an `eth_decrypt` method unrelated to this EIP). Our proposal overwrites the previous behavior of `eth_getEncryptionPublicKey`.
It is unlikely that this will be an issue, since encryption keys need be newly retrieved _only_ upon the time of encryption; on the other hand, _new_ 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 `eth_decrypt`ed.)

In any case, the previous EIP was never standardized, and is _not_ (to our knowledge) implemented in a non-deprecated manner in _any_ production code today.

### Test Cases

The secret _signing key_

```
    0x439047a312c8502d7dd276540e89fe6639d39da1d8466f79be390579d7eaa3b2
```

with Ethereum address `0x72682F2A3c160947696ac3c9CC48d290aa89549c`, has `secp256k1` public key

```
    0x03ff5763a2d3113229f2eda8305fae5cc1729e89037532a42df357437532770010
```

Thus, the request:

```javascript
request({
  method: &apos;eth_getEncryptionPublicKey&apos;,
  params: [&quot;0x72682F2A3c160947696ac3c9CC48d290aa89549c&quot;]
})
```

should return:

```javascript
&quot;0x03ff5763a2d3113229f2eda8305fae5cc1729e89037532a42df357437532770010&quot;
```

If an encryptor were to encrypt a message—say, `I use Firn Protocol to gain privacy on Ethereum.`—under the above public key, using the above ECIES variant, he could obtain, for example:

```javascript
&quot;0x036f06f9355b0e3f7d2971da61834513d5870413d28a16d7d68ce05dc78744daf850e6c2af8fb38e3e31d679deac82bd12148332fa0e34aecb31981bd4fe8f7ac1b74866ce65cbe848ee7a9d39093e0de0bd8523a615af8d6a83bbd8541bf174f47b1ea2bd57396b4a950a0a2eb77af09e36bd5832b8841848a8b302bd816c41ce&quot;
```

Upon obtaining this ciphertext, the decryptor would extract the relevant ephemeral public key, namely:

```javascript
&quot;0x036f06f9355b0e3f7d2971da61834513d5870413d28a16d7d68ce05dc78744daf8&quot;
```

And submit the request:

```javascript
request({
  method: &apos;eth_performECDH&apos;,
  params: [
    &quot;0x72682F2A3c160947696ac3c9CC48d290aa89549c&quot;,
    &quot;0x036f06f9355b0e3f7d2971da61834513d5870413d28a16d7d68ce05dc78744daf8&quot;
  ]
})
```

which in turn would return the Diffie–Hellman secret:

```javascript
&quot;0x4ad782e7409702101abe6d0279f242a2c545c46dd50a6704a4b9e3ae2730522e&quot;
```

Upon proceeding with the above ECIES variant, the decryptor would then obtain the string `I use Firn Protocol to gain privacy on Ethereum.`.

## Security Considerations

Our proposal uses heavily standardized algorithms and follows all best practices.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 07 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5630</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5630</guid>
      </item>
    
      <item>
        <title>Composable Soulbound NFT, EIP-1155 Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/composable-soulbound-nft-eip-1155-extension/10773</comments>
        
        <description>## Abstract

This standard is an extension of [EIP-1155](./eip-1155.md). 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. 

## Motivation

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. 

This standard outline a interface to EIP-1155 that allows wallet implementers and developers to check for soulbound property of token ID using [EIP-165](./eip-165.md). the soulbound property can be checked in advance, and the transfer function can be called only when the token is not soulbound.

## Specification
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.

A token type with a `uint256 id`  is soulbound if function `isSoulbound(uint256 id)` 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. 

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IERC5633 {
  /**
   * @dev Emitted when a token type `id` is set or cancel to soulbound, according to `bounded`.
   */
  event Soulbound(uint256 indexed id, bool bounded);

  /**
   * @dev Returns true if a token type `id` is soulbound.
   */
  function isSoulbound(uint256 id) external view returns (bool);
}
```
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.

## Rationale

If all tokens in a contract are soulbound by default, `isSoulbound(uint256 id)` should return true by default during implementation.

## Backwards Compatibility

This standard is fully EIP-1155 compatible.

## Test Cases

Test cases are included in [test.js](../assets/eip-5633/test/test.js). 

Run in terminal:

```shell
cd ../assets/eip-5633
npm install
npx hardhat test
```

Test contract are included in [`ERC5633Demo.sol`](../assets/eip-5633/contracts/ERC5633Demo.sol). 

## Reference Implementation

See [`ERC5633.sol`](../assets/eip-5633/contracts/ERC5633.sol).

## Security Considerations

There are no security considerations related directly to the implementation of this standard.

## Copyright
Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 09 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5633</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5633</guid>
      </item>
    
      <item>
        <title>NFT Licensing Agreements</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5635-discussion-nft-licensing-agreement-standard/10779</comments>
        
        <description>## Abstract

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.

In this standard, an NFT derivative work is referred to as a **dNFT**, while the original underlying NFT is referred to as an **oNFT**.

The NFT owner, known as the `licensor`, may authorize another creator, known as the `licensee`, to create a derivative works (dNFTs), in exchange for an agreed payment, known as a `Royalty`. A licensing agreement outlines terms and conditions related to the deal between the licensor and licensee.

## Specification

The key words &quot;MUST&quot;, &quot;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.

In general, there are three important roles in this standard:

- oNFT: An original underlying NFT. The holder of an oNFT is a licensor. An oNFT can be any NFT.
- dNFT: A derivative work based on one or more oNFTs. The holder of a dNFT is a licensee.
- Registry: A trusted smart contract able to verify whether a credential is signed or released by the holder of oNFT.

Every **dNFT** contract must implement the `IERC5635NFT` and `IERC165` inferfaces.

```solidity
pragma solidity ^0.6.0;
import &quot;./IERC165.sol&quot;;

///
/// @notice Interface of NFT derivatives (dNFT) for the NFT Licensing Standard
/// @dev The ERC-165 identifier for this interface is 0xd584841c.
interface IERC5635DNFT is IERC165 {

    /// ERC165 bytes to add to interface array - set in parent contract
    /// implementing this standard
    ///
    /// bytes4(keccak256(&quot;IERC5635DNFT{}&quot;)) == 0xd584841c
    /// bytes4 private constant _INTERFACE_ID_IERC5635DNFT = 0xd584841c;
    /// _registerInterface(_INTERFACE_ID_IERC5635XDNFT);
    
    /// @notice Get the number of credentials.
    /// @param _tokenId - ID of the dNFT asset queried
    /// @return _number - the number of credentials 
    function numberOfCredentials(
		uint256 _tokenId
    ) external view returns (
        uint256 _number
    );

    /// @notice Called with the sale price to determine how much royalty is owed and to whom.
    /// @param _tokenId - ID of the dNFT asset queried
    /// @param _credentialId - ID of the licensing agreement credential, the max id is numberOfCredentials(_tokenId)-1
    /// @return _oNFT - the oNFT address where the licensing from
    /// @return _tokenID - the oNFT ID where the licensing from
    /// @return _registry - the address of registry which can verify this credential
    function authorizedBy(
        uint256 _tokenId,
        uint256 _credentialId
    ) external view returns (
        address _oNFT,
        uint256 _tokenId,
        address _registry
    );
    
}

interface IERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
```

Every **Registry** contract must implement the `IERC5635Registry` and `IERC165` inferfaces.

```solidity
pragma solidity ^0.6.0;
import &quot;./IERC165.sol&quot;;

///
/// @dev Interface of NFT derivatives (dNFT) for the NFT Licensing Standard
///  Note: the ERC-165 identifier for this interface is 0xb5065e9f
interface IERC5635Registry is IERC165 {

    /// ERC165 bytes to add to interface array - set in parent contract
    /// implementing this standard
    ///
    /// bytes4(keccak256(&quot;IERC5635Registry{}&quot;)) == 0xb5065e9f
    /// bytes4 private constant _INTERFACE_ID_IERC5635Registry = 0xb5065e9f;
    /// _registerInterface(_INTERFACE_ID_IERC5635Registry);

    // TODO: Is the syntax correct?
    enum LicensingAgreementType {
      NonExclusive,
      Exclusive,
      Sole
    } 


    /// @notice 
    /// @param _dNFT - 
    /// @param _dNFT_Id - 
    /// @param _oNFT - 
    /// @param _oNFT_Id - 
    /// @return _licensed - 
    /// @return _tokenID - the oNFT ID where the licensing from
    /// @return _registry - the address of registry which can verify this credential
    function isLicensed(
        address _dNFT,
        uint256 _dNFT_Id,
        address _oNFT,
        uint256 _oNFT_Id
    ) external view returns (
        bool _licensed
    );
    
    /// @return _licenseIdentifier - the identifier, e.g. `MIT` or `Apache`, similar to `SPDX-License-Identifier: MIT` in SPDX.
    function licensingInfo(
        address _dNFT,
        uint256 _dNFT_Id,
        address _oNFT,
        uint256 _oNFT_Id
    ) external view returns (
        bool _licensed,
        address _licensor,
        uint64 _timeOfSignature,
        uint64 _expiryTime,
        LicensingAgreementType _type,
        string _licenseName,
        string _licenseUri //
    );
    
    function royaltyRate(
        address _dNFT,
        uint256 _dNFT_Id,
        address _oNFT,
        uint256 _oNFT_Id
    ) external view returns (
        address beneficiary, 
        uint256 rate // The decimals is 9, means to divide the rate by 1,000,000,000
    );
}
```

The **Registry** contract MAY implement the `IERC5635Licensing` and `IERC165` inferfaces.

```solidity
pragma solidity ^0.6.0;
import &quot;./IERC165.sol&quot;;

///
///
interface IERC5635Licensing is IERC165, IERC5635Registry {

    event Licence(address indexed _oNFT, uint256 indexed _oNFT_Id, address indexed _dNFT, uint256 indexed _dNFT_Id, uint64 _expiryTime, LicensingAgreementType _type, string _licenseName, string _licenseUri);

    event Approval(address indexed _oNFT, address indexed _owner, address indexed _approved, uint256 indexed _tokenId);
    
    event ApprovalForAll(address indexed _oNFT, address indexed _owner, address indexed _operator, bool _approved);

    function licence(address indexed _oNFT, uint256 indexed _oNFT_Id, address indexed _dNFT, uint256 indexed _dNFT_Id, uint64 _expiryTime, LicensingAgreementType _type, string _licenseName, string _licenseUri) external payable; //TODO: mortgages or not?
    
    function approve(address indexed _oNFT, address _approved, uint256 _tokenId) external payable; //TODO: why payable?
    
    function setApprovalForAll(address indexed _oNFT, address _operator, bool _approved) external;
    
    function getApproved(address indexed _oNFT, uint256 _tokenId) external view returns (address);
    
    function isApprovedForAll(address indexed _oNFT, address _owner, address _operator) external view returns (bool);

}
```

## Rationale

Licensing credentials from a dNFT&apos;s contract can be retrieved with `authorizedBy`, which specifies the details of a licensing agreement, which may include the oNFT. Those credentials may be verified with a `registry` service.

Anyone can retrieve licensing royalty information with `licensingRoyalty` via the registry. While it is not possible to enforce the rules set out in this EIP on-chain, just like [EIP-2981](./eip-2981.md), we encourages NFT marketplaces to follow this EIP.

### Two stages: Licensing and Discovery

Taking the moment when the dNFT is minted as the cut-off point, the stage before is called the **Licensing** stage, and the subsequent stage is called the **Discovery** stage. The interface `IERC5635Licensing` is for the **Licensing** stage, and the interfaces `IERC5635DNFT` and `IERC5635Registry` are for the **Discovery** stage. 

### Design decision: beneficiary of licensing agreement 

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.

### Difference between CantBeEvil Licenses and Licensing Agreements.

CantBeEvil licenses are creator-holder licenses which indicate what rights the NFTs&apos; 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.

### Design decision: Relationship between different approval levels

The approved address can `license()` the licensing agreement to **dNFT** on behalf of the holder of an **oNFT**. We define two levels of approval like that: 

1. `approve` will lead to approval for one NFT related to an id.
2. `setApprovalForAll` will lead to approval of all NFTs owned by `msg.sender`.

## Backwards Compatibility

This standard is compatible with [EIP-721](./eip-721.md), [EIP-1155](./eip-1155.md), and [EIP-2981](./eip-2981.md).

## Reference Implementation

### Examples

#### Deploying an [EIP-721](./eip-721.md) NFT and signaling support for dNFT

```solidity
constructor (string memory name, string memory symbol, string memory baseURI) {
        _name = name;
        _symbol = symbol;
        _setBaseURI(baseURI);
        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
        // dNFT interface
        _registerInterface(_INTERFACE_ID_IERC5635DNFT);
}
```

#### Checking if the NFT being sold on your marketplace is a dNFT

```solidity
bytes4 private constant _INTERFACE_ID_IERC5635DNFT = 0xd584841c;

function checkDNFT(address _contract) internal returns (bool) {
    (bool success) = IERC165(_contract).supportsInterface(_INTERFACE_ID_IERC5635DNFT);
    return success;
}
```

#### Checking if an address is a Registry

```solidity
bytes4 private constant _INTERFACE_ID_IERC5635Registry = 0xb5065e9f;

function checkLARegistry(address _contract) internal returns (bool) {
    (bool success) = IERC165(_contract).supportsInterface(_INTERFACE_ID_IERC5635Registry);
    return success;
}
```

## Security Considerations

Needs discussion.


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 10 Aug 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5635</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5635</guid>
      </item>
    
      <item>
        <title>Delegation Registry</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5639-delegation-registry/10949</comments>
        
        <description>## Abstract

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.

## Motivation

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&apos;s main wallet--is both insecure and inconvenient.

***Examples:***

 1. In order for you to edit your profile on OpenSea, you must sign a message with your wallet.
 2. In order to access NFT gated content, you must sign a message with the wallet containing the NFT in order to prove ownership.
 3. 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.
 4. In order to claim an airdrop, you must interact with the smart contract with the qualifying wallet.
 5. In order to prove ownership of an NFT, you must sign a payload with the wallet that owns that NFT.

In all the above examples, one interacts with the dApp or smart contract using the wallet itself, which may be

 - inconvenient (if it is controlled via a hardware wallet or a multi-sig)
 - insecure (since the above operations are read-only, but you are signing/interacting via a wallet that has write access)

Instead, one should be able to approve multiple wallets to authenticate on behalf of a given wallet.

### Problems with existing methods and solutions

Unfortunately, we&apos;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.

In addition to this, many users keep significant portions of their assets in &apos;cold storage&apos;. With the increased security from &apos;cold storage&apos; solutions, we usually see decreased accessibility because users naturally increase the barriers required to access these wallets.

### Proposal: Use of a Delegation Registry

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 &apos;read only&apos; access to a vault wallet via one or more secondary wallets.

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.

#### Improving dApp Interaction Security

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.

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.

#### Improving Multiple Device Access Security

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.

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.

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.

#### Improving Convenience

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.

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.

## Specification

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.

Let:

 - `vault` represent the vault address we are trying to authenticate or prove asset ownership for.
 - `delegate` represent the address we want to use for signing in lieu of `vault`.

**A Delegation Registry must implement IDelegationRegistry**

```solidity
/**
 * @title An immutable registry contract to be deployed as a standalone primitive
 * @dev New project launches can read previous cold wallet -&gt; hot wallet delegations
 * from here and integrate those permissions into their flow
 */
interface IDelegationRegistry {
    /// @notice Delegation type
    enum DelegationType {
        NONE,
        ALL,
        CONTRACT,
        TOKEN
    }

    /// @notice Info about a single delegation, used for onchain enumeration
    struct DelegationInfo {
        DelegationType type_;
        address vault;
        address delegate;
        address contract_;
        uint256 tokenId;
    }

    /// @notice Info about a single contract-level delegation
    struct ContractDelegation {
        address contract_;
        address delegate;
    }

    /// @notice Info about a single token-level delegation
    struct TokenDelegation {
        address contract_;
        uint256 tokenId;
        address delegate;
    }

    /// @notice Emitted when a user delegates their entire wallet
    event DelegateForAll(address vault, address delegate, bool value);

    /// @notice Emitted when a user delegates a specific contract
    event DelegateForContract(address vault, address delegate, address contract_, bool value);

    /// @notice Emitted when a user delegates a specific token
    event DelegateForToken(address vault, address delegate, address contract_, uint256 tokenId, bool value);

    /// @notice Emitted when a user revokes all delegations
    event RevokeAllDelegates(address vault);

    /// @notice Emitted when a user revoes all delegations for a given delegate
    event RevokeDelegate(address vault, address delegate);

    /**
     * -----------  WRITE -----------
     */

    /**
     * @notice Allow the delegate to act on your behalf for all contracts
     * @param delegate The hotwallet to act on your behalf
     * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking
     */
    function delegateForAll(address delegate, bool value) external;

    /**
     * @notice Allow the delegate to act on your behalf for a specific contract
     * @param delegate The hotwallet to act on your behalf
     * @param contract_ The address for the contract you&apos;re delegating
     * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking
     */
    function delegateForContract(address delegate, address contract_, bool value) external;

    /**
     * @notice Allow the delegate to act on your behalf for a specific token
     * @param delegate The hotwallet to act on your behalf
     * @param contract_ The address for the contract you&apos;re delegating
     * @param tokenId The token id for the token you&apos;re delegating
     * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking
     */
    function delegateForToken(address delegate, address contract_, uint256 tokenId, bool value) external;

    /**
     * @notice Revoke all delegates
     */
    function revokeAllDelegates() external;

    /**
     * @notice Revoke a specific delegate for all their permissions
     * @param delegate The hotwallet to revoke
     */
    function revokeDelegate(address delegate) external;

    /**
     * @notice Remove yourself as a delegate for a specific vault
     * @param vault The vault which delegated to the msg.sender, and should be removed
     */
    function revokeSelf(address vault) external;

    /**
     * -----------  READ -----------
     */

    /**
     * @notice Returns all active delegations a given delegate is able to claim on behalf of
     * @param delegate The delegate that you would like to retrieve delegations for
     * @return info Array of DelegationInfo structs
     */
    function getDelegationsByDelegate(address delegate) external view returns (DelegationInfo[] memory);

    /**
     * @notice Returns an array of wallet-level delegates for a given vault
     * @param vault The cold wallet who issued the delegation
     * @return addresses Array of wallet-level delegates for a given vault
     */
    function getDelegatesForAll(address vault) external view returns (address[] memory);

    /**
     * @notice Returns an array of contract-level delegates for a given vault and contract
     * @param vault The cold wallet who issued the delegation
     * @param contract_ The address for the contract you&apos;re delegating
     * @return addresses Array of contract-level delegates for a given vault and contract
     */
    function getDelegatesForContract(address vault, address contract_) external view returns (address[] memory);

    /**
     * @notice Returns an array of contract-level delegates for a given vault&apos;s token
     * @param vault The cold wallet who issued the delegation
     * @param contract_ The address for the contract holding the token
     * @param tokenId The token id for the token you&apos;re delegating
     * @return addresses Array of contract-level delegates for a given vault&apos;s token
     */
    function getDelegatesForToken(address vault, address contract_, uint256 tokenId)
        external
        view
        returns (address[] memory);

    /**
     * @notice Returns all contract-level delegations for a given vault
     * @param vault The cold wallet who issued the delegations
     * @return delegations Array of ContractDelegation structs
     */
    function getContractLevelDelegations(address vault)
        external
        view
        returns (ContractDelegation[] memory delegations);

    /**
     * @notice Returns all token-level delegations for a given vault
     * @param vault The cold wallet who issued the delegations
     * @return delegations Array of TokenDelegation structs
     */
    function getTokenLevelDelegations(address vault) external view returns (TokenDelegation[] memory delegations);

    /**
     * @notice Returns true if the address is delegated to act on the entire vault
     * @param delegate The hotwallet to act on your behalf
     * @param vault The cold wallet who issued the delegation
     */
    function checkDelegateForAll(address delegate, address vault) external view returns (bool);

    /**
     * @notice Returns true if the address is delegated to act on your behalf for a token contract or an entire vault
     * @param delegate The hotwallet to act on your behalf
     * @param contract_ The address for the contract you&apos;re delegating
     * @param vault The cold wallet who issued the delegation
     */
    function checkDelegateForContract(address delegate, address vault, address contract_)
        external
        view
        returns (bool);

    /**
     * @notice Returns true if the address is delegated to act on your behalf for a specific token, the token&apos;s contract or an entire vault
     * @param delegate The hotwallet to act on your behalf
     * @param contract_ The address for the contract you&apos;re delegating
     * @param tokenId The token id for the token you&apos;re delegating
     * @param vault The cold wallet who issued the delegation
     */
    function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId)
        external
        view
        returns (bool);
}
```

### Checking Delegation

A dApp or smart contract would check whether or not a delegate is authenticated for a vault by checking the return value of checkDelegateForAll.

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.

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.

A delegate can act on a token if they have a token level delegation, contract level delegation (for that token&apos;s contract) or vault level delegation.

A delegate can act on a contract if they have contract level delegation or vault level delegation.

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.

## Rationale

### Allowing for vault, contract or token level delegation

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.

### On-chain enumeration

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.

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.


## Security Considerations

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 &apos;read only&apos; authentication.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 09 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5639</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5639</guid>
      </item>
    
      <item>
        <title>Subscription NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5643-subscription-nfts/10802</comments>
        
        <description>## Abstract

This standard is an extension of [EIP-721](./eip-721.md). It proposes an additional interface for NFTs to be used as recurring, expirable subscriptions. The interface includes functions to renew and cancel the subscription.

## Motivation

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.

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&apos;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/cancel them as requested.

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.

## Specification

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.

```solidity
interface IERC5643 {
    /// @notice Emitted when a subscription expiration changes
    /// @dev When a subscription is canceled, the expiration value should also be 0.
    event SubscriptionUpdate(uint256 indexed tokenId, uint64 expiration);

    /// @notice Renews the subscription to an NFT
    /// Throws if `tokenId` is not a valid NFT
    /// @param tokenId The NFT to renew the subscription for
    /// @param duration The number of seconds to extend a subscription for
    function renewSubscription(uint256 tokenId, uint64 duration) external payable;

    /// @notice Cancels the subscription of an NFT
    /// @dev Throws if `tokenId` is not a valid NFT
    /// @param tokenId The NFT to cancel the subscription for
    function cancelSubscription(uint256 tokenId) external payable;

    /// @notice Gets the expiration date of a subscription
    /// @dev Throws if `tokenId` is not a valid NFT
    /// @param tokenId The NFT to get the expiration date of
    /// @return The expiration date of the subscription
    function expiresAt(uint256 tokenId) external view returns(uint64);

    /// @notice Determines whether a subscription can be renewed
    /// @dev Throws if `tokenId` is not a valid NFT
    /// @param tokenId The NFT to get the expiration date of
    /// @return The renewability of a the subscription
    function isRenewable(uint256 tokenId) external view returns(bool);
}
```

The `expiresAt(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `isRenewable(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `renewSubscription(uint256 tokenId, uint64 duration)` function MAY be implemented as `external` or `public`.

The `cancelSubscription(uint256 tokenId)` function MAY be implemented as `external` or `public`.

The `SubscriptionUpdate` event MUST be emitted whenever the expiration date of a subscription is changed.

The `supportsInterface` method MUST return `true` when called with `0x8c65f84d`.

## Rationale

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.

### Subscription Management

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 `renewSubscription` and `cancelSubscription` 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 `expiresAt` function provides this functionality. Finally, it is possible that a subscription may not be renewed once expired. The `isRenewable` function gives users and applications that information.

### Easy Integration

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&apos;s expiration, determine whether a subscription is expired, and see whether it can be renewed.

## Backwards Compatibility

This standard can be fully EIP-721 compatible by adding an extension function set.

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.

## Test Cases

The following tests require Foundry.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.13;

import &quot;forge-std/Test.sol&quot;;
import &quot;../src/ERC5643.sol&quot;;

contract ERC5643Mock is ERC5643 {
    constructor(string memory name_, string memory symbol_) ERC5643(name_, symbol_) {}

    function mint(address to, uint256 tokenId) public {
        _mint(to, tokenId);
    }
}

contract ERC5643Test is Test {
    event SubscriptionUpdate(uint256 indexed tokenId, uint64 expiration);

    address user1;
    uint256 tokenId;
    ERC5643Mock erc5643;

    function setUp() public {
        tokenId = 1;
        user1 = address(0x1);

        erc5643 = new ERC5643Mock(&quot;erc5369&quot;, &quot;ERC5643&quot;);
        erc5643.mint(user1, tokenId);
    }

    function testRenewalValid() public {
        vm.warp(1000);
        vm.prank(user1);
        vm.expectEmit(true, true, false, true);
        emit SubscriptionUpdate(tokenId, 3000);
        erc5643.renewSubscription(tokenId, 2000);
    }

    function testRenewalNotOwner() public {
        vm.expectRevert(&quot;Caller is not owner nor approved&quot;);
        erc5643.renewSubscription(tokenId, 2000);
    }

    function testCancelValid() public {
        vm.prank(user1);
        vm.expectEmit(true, true, false, true);
        emit SubscriptionUpdate(tokenId, 0);
        erc5643.cancelSubscription(tokenId);
    }

    function testCancelNotOwner() public {
        vm.expectRevert(&quot;Caller is not owner nor approved&quot;);
        erc5643.cancelSubscription(tokenId);
    }

    function testExpiresAt() public {
        vm.warp(1000);

        assertEq(erc5643.expiresAt(tokenId), 0);
        vm.startPrank(user1);
        erc5643.renewSubscription(tokenId, 2000);
        assertEq(erc5643.expiresAt(tokenId), 3000);

        erc5643.cancelSubscription(tokenId);
        assertEq(erc5643.expiresAt(tokenId), 0);
    }
}
```

## Reference Implementation

Implementation: `ERC5643.sol`

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.13;

import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;./IERC5643.sol&quot;;

contract ERC5643 is ERC721, IERC5643 {
    mapping(uint256 =&gt; uint64) private _expirations;

    constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_) {}

    function renewSubscription(uint256 tokenId, uint64 duration) external payable {
        require(_isApprovedOrOwner(msg.sender, tokenId), &quot;Caller is not owner nor approved&quot;);

        uint64 currentExpiration = _expirations[tokenId];
        uint64 newExpiration;
        if (currentExpiration == 0) {
            newExpiration = uint64(block.timestamp) + duration;
        } else {
            if (!_isRenewable(tokenId)) {
                revert SubscriptionNotRenewable();
            }
            newExpiration = currentExpiration + duration;
        }

        _expirations[tokenId] = newExpiration;

        emit SubscriptionUpdate(tokenId, newExpiration);
    }

    function cancelSubscription(uint256 tokenId) external payable {
        require(_isApprovedOrOwner(msg.sender, tokenId), &quot;Caller is not owner nor approved&quot;);
        delete _expirations[tokenId];
        emit SubscriptionUpdate(tokenId, 0);
    }

    function expiresAt(uint256 tokenId) external view returns(uint64) {
        return _expirations[tokenId];
    }

    function isRenewable(uint256 tokenId) external pure returns(bool) {
        return true;
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC5643).interfaceId || super.supportsInterface(interfaceId);
    }
}
```

## Security Considerations

This EIP standard does not affect ownership of an NFT and thus can be considered secure.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 10 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5643</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5643</guid>
      </item>
    
      <item>
        <title>Token State Fingerprint</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5646-discussion-token-state-fingerprint/10808</comments>
        
        <description>## Abstract

This specification defines the minimum interface required to unambiguously identify the state of a mutable token without knowledge of implementation details.

## Motivation

Currently, protocols need to know about tokens&apos; state properties to create the unambiguous identifier. Unfortunately, this leads to an obvious bottleneck in which protocols need to support every new token specifically.

![](../assets/eip-5646/support-per-abi.png)

## Specification

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.

```solidity
pragma solidity ^0.8.0;

interface ERC5646 is ERC165 {

    /// @notice Function to return current token state fingerprint.
    /// @param tokenId Id of a token state in question.
    /// @return Current token state fingerprint.
    function getStateFingerprint(uint256 tokenId) external view returns (bytes32);

}
```

- `getStateFingerprint` MUST return a different value when the token state changes.
- `getStateFingerprint` MUST NOT return a different value when the token state remains the same.
- `getStateFingerprint` MUST include all state properties that might change during the token lifecycle (are not immutable).
- `getStateFingerprint` MAY include computed values, such as values based on a current timestamp (e.g., expiration, maturity).
- `getStateFingerprint` MAY include token metadata URI.
- `supportsInterface(0xf5112315)` MUST return `true`.

## Rationale

Protocols can use state fingerprints as a part of a token identifier and support mutable tokens without knowing any state implementation details.

![](../assets/eip-5646/support-per-eip.png)

State fingerprints don&apos;t have to factor in state properties that are immutable, because they can be safely identified by a token id. 

This standard is not for use cases where token state property knowledge is required, as these cases cannot escape the bottleneck problem described earlier.

## Backwards Compatibility

This EIP is not introducing any backward incompatibilities.

## Reference Implementation

```solidity
pragma solidity ^0.8.0;

/// @title Example of a mutable token implementing state fingerprint.
contract LPToken is ERC721, ERC5646 {

    /// @dev Stored token states (token id =&gt; state).
    mapping (uint256 =&gt; State) internal states;

    struct State {
        address asset1;
        address asset2;
        uint256 amount1;
        uint256 amount2;
        uint256 fee; // Immutable
        address operator; // Immutable
        uint256 expiration; // Parameter dependent on a block.timestamp
    }


    /// @dev State fingerprint getter.
    /// @param tokenId Id of a token state in question.
    /// @return Current token state fingerprint.
    function getStateFingerprint(uint256 tokenId) override public view returns (bytes32) {
        State storage state = states[tokenId];

        return keccak256(
            abi.encode(
                state.asset1,
                state.asset2,
                state.amount1,
                state.amount2,
                // state.fee don&apos;t need to be part of the fingerprint computation as it is immutable
                // state.operator don&apos;t need to be part of the fingerprint computation as it is immutable
                block.timestamp &gt;= state.expiration
            )
        );
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return super.supportsInterface(interfaceId) ||
            interfaceId == type(ERC5646).interfaceId;
    }

}
```

## Security Considerations

Token state fingerprints from two different contracts may collide. Because of that, they should be compared only in the context of one token contract.

If the `getStateFingerprint` 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 11 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5646</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5646</guid>
      </item>
    
      <item>
        <title>Token Minting and Burning</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-5679-mint-and-burn-tokens/10913</comments>
        
        <description>## Abstract

This EIP introduces a consistent way to extend token standards for minting and burning.

## Motivation

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.

Some implementations of [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md)
have been able to use `transfer` 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.

## Specification

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.

1. Any contract complying with [EIP-20](./eip-20.md) when extended with this EIP,
**MUST** implement the following interface:

```solidity
// The EIP-165 identifier of this interface is 0xd0017968
interface IERC5679Ext20 {
   function mint(address _to, uint256 _amount, bytes calldata _data) external;
   function burn(address _from, uint256 _amount, bytes calldata _data) external;
}
```

2. Any contract complying with [EIP-721](./eip-721.md) when extended with this EIP,
**MUST** implement the following interface:

```solidity
// The EIP-165 identifier of this interface is 0xcce39764
interface IERC5679Ext721 {
   function safeMint(address _to, uint256 _id, bytes calldata _data) external;
   function burn(address _from, uint256 _id, bytes calldata _data) external;
}
```

3. Any contract complying with [EIP-1155](./eip-1155.md) when extended with this EIP,
**MUST** implement the following interface:

```solidity
// The EIP-165 identifier of this interface is 0xf4cedd5a
interface IERC5679Ext1155 {
   function safeMint(address _to, uint256 _id, uint256 _amount, bytes calldata _data) external;
   function safeMintBatch(address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;
   function burn(address _from, uint256 _id, uint256 _amount, bytes[] calldata _data) external;
   function burnBatch(address _from, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata _data) external;
}
```

4. When the token is being minted, the transfer events **MUST** be emitted as if
the token in the `_amount` for EIP-20 and EIP-1155 and token id being `_id` for EIP-721 and EIP-1155
were transferred from address `0x0` to the recipient address identified by `_to`.
The total supply **MUST** increase accordingly.

5. When the token is being burned, the transfer events **MUST** be emitted as if
the token in the `_amount` for EIP-20 and EIP-1155 and token id being `_id` for EIP-721 and EIP-1155
were transferred from the recipient address identified by `_to` to the address of `0x0`.
The total supply **MUST** decrease accordingly.

6. `safeMint` MUST implement the same receiver restrictions as `safeTransferFrom` as defined in
[EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md).

7. It&apos;s RECOMMENDED for the client to implement [EIP-165](./eip-165.md) identifiers as specified above.

## Rationale

1. It&apos;s possible that the interface be consolidated to the same as EIP-1155 which is always bearing `_amount` field,
regardless of whether it&apos;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 `_id` and `_amount` in their original
token standard.

2. We have chosen to identify the interface with [EIP-165](./eip-165.md) identifiers each individually,
instead of having a single identifier because the signatures of interface are different.

3. 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.

4. We have chosen to add `safeMintBatch` and `burnBatch` methods for EIP-1155 but not for EIP-721 to follow the
convention of EIP-721 and EIP-1155 respectively.

5. We have not add extension for [EIP-777](./eip-777.md) because it already handles Minting and Burning.

## Backwards Compatibility

This EIP is designed to be compatible for EIP-20, EIP-721 and EIP-1155 respectively.

## Security Considerations

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.

The burning should also carefully design the access control. Typically only the following two roles are entitled to burn a token:

- Role 1. The current token holder
- Role 2. An role with special privilege.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 17 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5679</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5679</guid>
      </item>
    
      <item>
        <title>Bindable Token Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5700-bindable-token-standard/11077</comments>
        
        <description>## Abstract

This standard defines an interface for [ERC-721](./eip-721.md) or [ERC-1155](./eip-155.md) tokens, known as &quot;bindables&quot;, to &quot;bind&quot; to [ERC-721](./eip-721.md) NFTs.

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. 

This standard supports various use-cases such as:

- NFT-bundled physical assets like microchipped streetwear, digitized car collections, and digitally twinned real estate.
- NFT-bundled digital assets such as accessorizable virtual wardrobes, composable music tracks, and customizable metaverse land.

## Motivation

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.

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 [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md) standards.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### ERC-721 Bindable

**Smart contracts implementing the ERC-721 bindable standard MUST implement the `IERC721Bindable` interface.**

**Implementers of the `IER721Bindable` interface MUST return `true` if `0x82a34a7d` is passed as the identifier to the `supportsInterface` function.**

```solidity
/// @title ERC-721 Bindable Token Standard
/// @dev See https://eips.ethereum.org/ERCS/eip-5700
///  Note: the ERC-165 identifier for this interface is 0x82a34a7d.
interface IERC721Bindable /* is IERC721 */ {

    /// @notice This event emits when an unbound token is bound to an NFT.
    /// @param operator The address approved to perform the binding.
    /// @param from The address of the unbound token owner.
    /// @param bindAddress The contract address of the NFT being bound to.
    /// @param bindId The identifier of the NFT being bound to.
    /// @param tokenId The identifier of binding token.
    event Bind(
        address indexed operator,
        address indexed from,
        address indexed bindAddress,
        uint256 bindId,
        uint256 tokenId
    );

    /// @notice This event emits when an NFT-bound token is unbound.
    /// @param operator The address approved to perform the unbinding.
    /// @param from The owner of the NFT the token is bound to.
    /// @param to The address of the new unbound token owner.
    /// @param bindAddress The contract address of the NFT being unbound from.
    /// @param bindId The identifier of the NFT being unbound from.
    /// @param tokenId The identifier of the unbinding token.
    event Unbind(
        address indexed operator,
        address indexed from,
        address to,
        address indexed bindAddress,
        uint256 bindId,
        uint256 tokenId
    );

    /// @notice Binds token `tokenId` to NFT `bindId` at address `bindAddress`.
    /// @dev The function MUST throw unless `msg.sender` is the current owner, 
    ///  an authorized operator, or the approved address for the token. It also
    ///  MUST throw if the token is already bound or if `from` is not the token
    ///  owner. Finally, it MUST throw if the NFT contract does not support the
    ///  ERC-721 interface or if the NFT being bound to does not exist. Before 
    ///  binding, token ownership MUST be transferred to the contract address of
    ///  the NFT. On bind completion, the function MUST emit `Transfer` &amp; `Bind` 
    ///  events to reflect the implicit token transfer and subsequent bind.
    /// @param from The address of the unbound token owner.
    /// @param bindAddress The contract address of the NFT being bound to.
    /// @param bindId The identifier of the NFT being bound to.
    /// @param tokenId The identifier of the binding token.
    function bind(
        address from,
        address bindAddress,
        uint256 bindId,
        uint256 tokenId
    ) external;

    /// @notice Unbinds token `tokenId` from NFT `bindId` at address `bindAddress`.
    /// @dev The function MUST throw unless `msg.sender` is the current owner, 
    ///  an authorized operator, or the approved address for the NFT the token
    ///  is bound to. It also MUST throw if the token is unbound, if `from` is
    ///  not the owner of the bound NFT, or if `to` is the zero address. After
    ///  unbinding, token ownership MUST be transferred to `to`, during which
    ///  the function MUST check if `to` is a valid contract (code size &gt; 0),
    ///  and if so, call `onERC721Received`, throwing if the wrong identifier is
    ///  returned. On unbind completion, the function MUST emit `Unbind` &amp;
    ///  `Transfer` events to reflect the unbind and subsequent transfer.
    /// @param from The address of the owner of the NFT the token is bound to.
    /// @param to The address of the unbound token new owner.
    /// @param bindAddress The contract address of the NFT being unbound from.
    /// @param bindId The identifier of the NFT being unbound from.
    /// @param tokenId The identifier of the unbinding token.
    function unbind(
        address from,
        address to,
        address bindAddress,
        uint256 bindId,
        uint256 tokenId
    ) external;

    /// @notice Gets the NFT address and identifier token `tokenId` is bound to.
    /// @dev When the token is unbound, this function MUST return the zero
    ///  address for the address portion to indicate no binding exists.
    /// @param tokenId The identifier of the token being queried.
    /// @return The token-bound NFT contract address and numerical identifier.
    function binderOf(uint256 tokenId) external view returns (address, uint256);

    /// @notice Gets total tokens bound to NFT `bindId` at address `bindAddress`.
    /// @param bindAddress The contract address of the NFT being queried.
    /// @param bindId The identifier of the NFT being queried.
    /// @return The total number of tokens bound to the queried NFT.
    function boundBalanceOf(address bindAddress, uint256 bindId) external view returns (uint256);

```

### ERC-1155 Bindable

**Smart contracts implementing the ERC-1155 Bindable standard MUST implement the `IERC1155Bindable` interface.**

**Implementers of the `IER1155Bindable` interface MUST return `true` if `0xd0d55c6` is passed as the identifier to the `supportsInterface` function.**

```solidity
/// @title ERC-1155 Bindable Token Standard
/// @dev See https://eips.ethereum.org/ERCS/eip-5700
///  Note: the ERC-165 identifier for this interface is 0xd0d555c6.
interface IERC1155Bindable /* is IERC1155 */ {

    /// @notice This event emits when token(s) are bound to an NFT.
    /// @param operator The address approved to perform the binding.
    /// @param from The owner address of the unbound tokens.
    /// @param bindAddress The contract address of the NFT being bound to.
    /// @param bindId The identifier of the NFT being bound to.
    /// @param tokenId The identifier of the binding token type.
    /// @param amount The number of tokens binding to the NFT.
    event Bind(
        address indexed operator,
        address indexed from,
        address indexed bindAddress,
        uint256 bindId,
        uint256 tokenId,
        uint256 amount
    );

    /// @notice This event emits when token(s) of different types are bound to an NFT.
    /// @param operator The address approved to perform the batch binding.
    /// @param from The owner address of the unbound tokens.
    /// @param bindAddress The contract address of the NFTs being bound to.
    /// @param bindId The identifier of the NFT being bound to.
    /// @param tokenIds The identifiers of the binding token types.
    /// @param amounts The number of tokens per type binding to the NFTs.
    event BindBatch(
        address indexed operator,
        address indexed from,
        address indexed bindAddress,
        uint256 bindId,
        uint256[] tokenIds,
        uint256[] amounts
    );

    /// @notice This event emits when token(s) are unbound from an NFT.
    /// @param operator The address approved to perform the unbinding.
    /// @param from The owner address of the NFT the tokens are bound to.
    /// @param to The address of the unbound tokens&apos; new owner.
    /// @param bindAddress The contract address of the NFT being unbound from.
    /// @param bindId The identifier of the NFT being unbound from.
    /// @param tokenId The identifier of the unbinding token type.
    /// @param amount The number of tokens unbinding from the NFT.
    event Unbind(
        address indexed operator,
        address indexed from,
        address to,
        address indexed bindAddress,
        uint256 bindId,
        uint256 tokenId,
        uint256 amount
    );

    /// @notice This event emits when token(s) of different types are unbound from an NFT.
    /// @param operator The address approved to perform the batch binding.
    /// @param from The owner address of the unbound tokens.
    /// @param to The address of the unbound tokens&apos; new owner.
    /// @param bindAddress The contract address of the NFTs being unbound from.
    /// @param bindId The identifier of the NFT being unbound from.
    /// @param tokenIds The identifiers of the unbinding token types.
    /// @param amounts The number of tokens per type unbinding from the NFTs.
    event UnbindBatch(
        address indexed operator,
        address indexed from,
        address to,
        address indexed bindAddress,
        uint256 bindId,
        uint256[] tokenIds,
        uint256[] amounts
    );

    /// @notice Binds `amount` tokens of `tokenId` to NFT `bindId` at address `bindAddress`.
    /// @dev The function MUST throw unless `msg.sender` is an approved operator
    ///  for `from`. It also MUST throw if the `from` owns fewer than `amount`
    ///  tokens. Finally, it MUST throw if the NFT contract does not support the
    ///  ERC-721 interface or if the NFT being bound to does not exist. Before 
    ///  binding, tokens MUST be transferred to the contract address of the NFT. 
    ///  On bind completion, the function MUST emit `Transfer` &amp; `Bind` events 
    ///  to reflect the implicit token transfers and subsequent bind.
    /// @param from The owner address of the unbound tokens.
    /// @param bindAddress The contract address of the NFT being bound to.
    /// @param bindId The identifier of the NFT being bound to.
    /// @param tokenId The identifier of the binding token type.
    /// @param amount The number of tokens binding to the NFT.
    function bind(
        address from,
        address bindAddress,
        uint256 bindId,
        uint256 tokenId,
        uint256 amount
    ) external;

    /// @notice Binds `amounts` tokens of `tokenIds` to NFT `bindId` at address `bindAddress`.
    /// @dev The function MUST throw unless `msg.sender` is an approved operator
    ///  for `from`. It also MUST throw if the length of `amounts` is not the 
    ///  same as `tokenIds`, or if any balances of `tokenIds` for `from` is less
    ///  than that of `amounts`. Finally, it MUST throw if the NFT contract does 
    ///  not support the ERC-721 interface or if the bound NFT does not exist. 
    ///  Before binding, tokens MUST be transferred to the contract address of 
    ///  the NFT. On bind completion, the function MUST emit `TransferBatch` and
    ///  `BindBatch` events to reflect the batch token transfers and bind.
    /// @param from The owner address of the unbound tokens.
    /// @param bindAddress The contract address of the NFTs being bound to.
    /// @param bindId The identifier of the NFT being bound to.
    /// @param tokenIds The identifiers of the binding token types.
    /// @param amounts The number of tokens per type binding to the NFTs.
    function batchBind(
        address from,
        address bindAddress,
        uint256 bindId,
        uint256[] calldata tokenIds,
        uint256[] calldata amounts
    ) external;

    /// @notice Unbinds `amount` tokens of `tokenId` from NFT `bindId` at address `bindAddress`.
    /// @dev The function MUST throw unless `msg.sender` is an approved operator
    ///  for `from`. It also MUST throw if `from` is not the owner of the bound
    ///  NFT, if the NFT&apos;s token balance is fewer than `amount`, or if `to` is 
    ///  the zero address. After unbinding, tokens MUST be transferred to `to`,
    ///  during which the function MUST check if `to` is a valid contract (code 
    ///  size &gt; 0), and if so, call `onERC1155Received`, throwing if the wrong \
    ///  identifier is returned. On unbind completion, the function MUST emit 
    ///  `Unbind` &amp; `Transfer` events to reflect the unbind and transfers.
    /// @param from The owner address of the NFT the tokens are bound to.
    /// @param to The address of the unbound tokens&apos; new owner.
    /// @param bindAddress The contract address of the NFT being unbound from.
    /// @param bindId The identifier of the NFT being unbound from.
    /// @param tokenId The identifier of the unbinding token type.
    /// @param amount The number of tokens unbinding from the NFT.
    function unbind(
        address from,
        address to,
        address bindAddress,
        uint256 bindId,
        uint256 tokenId,
        uint256 amount
    ) external;

    /// @notice Unbinds `amount` tokens of `tokenId` from NFT `bindId` at address `bindAddress`.
    /// @dev The function MUST throw unless `msg.sender` is an approved operator
    ///  for `from`. It also MUST throw if the length of `amounts` is not the
    ///  same as `tokenIds`, if any balances of `tokenIds` for the NFT is less 
    ///  than that of `amounts`, or if `to` is the zero addresss. After 
    ///  unbinding, tokens MUST be transferred to `to`, during which the 
    ///  function MUST check if `to` is a valid contract (code size &gt; 0), and if 
    ///  so, call `onERC1155BatchReceived`, throwing if the wrong identifier is 
    ///  returned. On unbind completion, the function MUST emit `UnbindBatch` &amp; 
    ///  `TransferBatch` events to reflect the batch unbind and transfers.
    /// @param from The owner address of the unbound tokens.
    /// @param to The address of the unbound tokens&apos; new owner.
    /// @param bindAddress The contract address of the NFTs being unbound from.
    /// @param bindId The identifier of the NFT being unbound from.
    /// @param tokenIds The identifiers of the unbinding token types.
    /// @param amounts The number of tokens per type unbinding from the NFTs.
    function batchUnbind(
        address from,
        address to,
        address bindAddress,
        uint256 bindId,
        uint256[] calldata tokenIds,
        uint256[] calldata amounts
    ) external;

    /// @notice Gets the number of tokens of type `tokenId` bound to NFT `bindId` at address `bindAddress`.
    /// @param bindAddress The contract address of the bound NFT.
    /// @param bindId The identifier of the bound NFT.
    /// @param tokenId The identifier of the token type bound to the NFT.
    /// @return The number of tokens of type `tokenId` bound to the NFT.
    function boundBalanceOf(
        address bindAddress,
        uint256 bindId,
        uint256 tokenId
    ) external view returns (uint256);

    /// @notice Gets the number of tokens of types `bindIds` bound to NFTs `bindIds` at address `bindAddress`.
    /// @param bindAddress The contract address of the bound NFTs.
    /// @param bindIds The identifiers of the bound NFTs.
    /// @param tokenIds The identifiers of the token types bound to the NFTs.
    /// @return balances The bound balances for each token type / NFT pair.
    function boundBalanceOfBatch(
        address bindAddress,
        uint256[] calldata bindIds,
        uint256[] calldata tokenIds
    ) external view returns (uint256[] memory balances);

}
```

## Rationale

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.

### Binding Mechanism

During binding, a bindable token&apos;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.

## Backwards Compatibility

The bindable token interface is designed to be compatible with existing ERC-721 and ERC-1155 standards.

## Reference Implementation

- [ERC-721 Bindable](../assets/eip-5700/erc721/ERC721Bindable.sol).
- [ERC-1155 Bindable](../assets/eip-5700/erc1155/ERC1155Bindable.sol).

## Security Considerations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 22 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5700</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5700</guid>
      </item>
    
      <item>
        <title>Signature replacement interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-signature-replacing-for-smart-contract-wallets/11059</comments>
        
        <description>## Abstract

Smart contract wallet signed messages can become stale, meaning a signature that once was valid could become invalid at any point.

Signatures MAY become stale for reasons like:

* The internal set of signers changed
* The wallet makes signatures expirable
* The contract was updated to a new implementation

The following standard allows smart contract wallets to expose a URI that clients can use to replace a stale signature with a valid one.

## Motivation

In contrast to EOA signatures, [EIP-1271](./eip-1271.md) 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.

A signature MAY need to be mutated due to one of the following scenarios:

1. The wallet removes a signer that contributed to signing the initial message.
2. The wallet uses a Merkle tree to store signers, adding a new signer.
3. The wallet uses a Merkle tree to store signatures, adding new signatures.
4. The wallet is updated to a new implementation, and the signature schema changes.

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.

## Specification

The wallet contract MUST implement the following function:

```solidity
function getAlternativeSignature(bytes32 _digest) external view returns (string);
```

The returned string MUST be a URI pointing to a JSON object with the following schema:

```json
{
    &quot;title&quot;: &quot;Signature alternative&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;blockHash&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A block.hash on which the signature should be valid.&quot;
        },
        &quot;signature&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;The alternative signature for the given digest.&quot;
        }
    }
}
```

### Client process for replacing a signature

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:

1) Try validating the signature using [EIP-1271](./eip-1271.md); if the signature is valid, then the signature can be used as-is.
2) If the signature is not valid, call `getAlternativeSignature(_digest)`, passing the `digest` corresponding to the old signature.
3) If the call fails, no URI is returned, or the content of the URI is not valid, then the signature MUST be considered invalid.
4) Try validating the new signature using [EIP-1271](./eip-1271.md); if the signature is valid, it can be used as a drop-in replacement of the original signature.
5) If the validation fails, repeat the process from step (2) (notice: if the URI returns the same signature, the signature MUST be considered invalid).

Clients MUST implement a retry limit when fetching alternative signatures. This limit is up to the client to define.

## Rationale

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.

The `getAlternativeSignature` method points to an off-chain source because it&apos;s expected that the smart contract wallet doesn&apos;t contain on-chain records for all signed digests, if that were the case then such contract wouldn&apos;t need to use this EIP since it could directly validate the `digest` on`isValidSignature` ignoring the stale signature.

## Backwards Compatibility

Existing wallets that do not implement the `getAlternativeSignature` method can still sign messages without any changes; if any signatures become invalidated, clients will drop them on step (3).

## Security Considerations

Some applications use signatures as secrets; these applications would risk leaking such secrets if the EIP exposes the signatures.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 26 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5719</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5719</guid>
      </item>
    
      <item>
        <title>Transferable Vesting NFT</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5725-transferable-vesting-nft/11099</comments>
        
        <description>## Abstract

A **Non-Fungible Token** (NFT) standard used to vest tokens ([ERC-20](./eip-20.md) or otherwise) over a vesting release curve.

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 ([ERC-20](./eip-20.md) or otherwise) that is emitted to the NFT holder. This standard is an extension of the [ERC-721](./eip-721.md) token that provides basic functionality for creating vesting NFTs, claiming the tokens and reading vesting curve properties.

## Motivation

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 **Simple Agreement for Future Tokens** (SAFTs) or **Externally Owned Account** (EOA)-based vesting as it enables transferability and the ability to attach metadata similar to the existing functionality offered by with traditional NFTs.

Such a standard will not only provide a much-needed [ERC-20](./eip-20.md) token lock standard, but will also enable the creation of secondary marketplaces tailored for semi-liquid SAFTs.

This standard also allows for a variety of different vesting curves to be implement easily.

These curves could represent:

- linear vesting
- cliff vesting
- exponential vesting
- custom deterministic vesting

### Use Cases

1. 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.
2. Replicating SAFT contracts in a standardized form of semi-liquid vesting NFT assets.
   - SAFTs are generally off-chain, while today&apos;s on-chain versions are mainly address-based, which makes distributing vesting shares to many representatives difficult. Standardization simplifies this convoluted process.
3. Providing a path for the standardization of vesting and token timelock contracts.
   - There are many such contracts in the wild and most of them differ in both interface and implementation.
4. NFT marketplaces dedicated to vesting NFTs.
   - Whole new sets of interfaces and analytics could be created from a common standard for token vesting NFTs.
5. Integrating vesting NFTs into services like Safe Wallet.
   - 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.
6. Enable standardized fundraising implementations and general fundraising that sell vesting tokens (eg. SAFTs) in a more transparent manner.
7. Allows tools, front-end apps, aggregators, etc. to show a more holistic view of the vesting tokens and the properties available to users.
   - 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.
   - Such tooling can easily discover compliance through the [ERC-165](./eip-165.md) `supportsInterface(InterfaceID)` check.
8. 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.

## Specification

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.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
import &quot;@openzeppelin/contracts/token/ERC721/IERC721.sol&quot;;

/**
 * @title Non-Fungible Vesting Token Standard.
 * @notice A non-fungible token standard used to vest ERC-20 tokens over a vesting release curve 
 *  scheduled using timestamps.
 * @dev Because this standard relies on timestamps for the vesting schedule, it&apos;s important to keep track of the 
 *  tokens claimed per Vesting NFT so that a user cannot withdraw more tokens than allotted for a specific Vesting NFT.
 * @custom:interface-id 0xbd3a202b
 */
interface IERC5725 is IERC721 {
    /**
     *  This event is emitted when the payout is claimed through the claim function.
     *  @param tokenId the NFT tokenId of the assets being claimed.
     *  @param recipient The address which is receiving the payout.
     *  @param claimAmount The amount of tokens being claimed.
     */
    event PayoutClaimed(uint256 indexed tokenId, address indexed recipient, uint256 claimAmount);

    /**
     *  This event is emitted when an `owner` sets an address to manage token claims for all tokens.
     *  @param owner The address setting a manager to manage all tokens.
     *  @param spender The address being permitted to manage all tokens.
     *  @param approved A boolean indicating whether the spender is approved to claim for all tokens.
     */
    event ClaimApprovalForAll(address indexed owner, address indexed spender, bool approved);

    /**
     *  This event is emitted when an `owner` sets an address to manage token claims for a `tokenId`.
     *  @param owner The `owner` of `tokenId`.
     *  @param spender The address being permitted to manage a tokenId.
     *  @param tokenId The unique identifier of the token being managed.
     *  @param approved A boolean indicating whether the spender is approved to claim for `tokenId`.
     */
    event ClaimApproval(address indexed owner, address indexed spender, uint256 indexed tokenId, bool approved);

    /**
     * @notice Claim the pending payout for the NFT.
     * @dev MUST grant the claimablePayout value at the time of claim being called to `msg.sender`. 
     *  MUST revert if not called by the token owner or approved users. 
     *  MUST emit PayoutClaimed. 
     *  SHOULD revert if there is nothing to claim.
     * @param tokenId The NFT token id.
     */
    function claim(uint256 tokenId) external;

    /**
     * @notice Number of tokens for the NFT which have been claimed at the current timestamp.
     * @param tokenId The NFT token id.
     * @return payout The total amount of payout tokens claimed for this NFT.
     */
    function claimedPayout(uint256 tokenId) external view returns (uint256 payout);

    /**
     * @notice Number of tokens for the NFT which can be claimed at the current timestamp.
     * @dev It is RECOMMENDED that this is calculated as the `vestedPayout()` subtracted from `payoutClaimed()`.
     * @param tokenId The NFT token id.
     * @return payout The amount of unlocked payout tokens for the NFT which have not yet been claimed.
     */
    function claimablePayout(uint256 tokenId) external view returns (uint256 payout);

    /**
     * @notice Total amount of tokens which have been vested at the current timestamp. 
     *  This number also includes vested tokens which have been claimed.
     * @dev It is RECOMMENDED that this function calls `vestedPayoutAtTime` 
     *  with `block.timestamp` as the `timestamp` parameter.
     * @param tokenId The NFT token id.
     * @return payout Total amount of tokens which have been vested at the current timestamp.
     */
    function vestedPayout(uint256 tokenId) external view returns (uint256 payout);

    /**
     * @notice Total amount of vested tokens at the provided timestamp. 
     *  This number also includes vested tokens which have been claimed.
     * @dev `timestamp` MAY be both in the future and in the past. 
     *  Zero MUST be returned if the timestamp is before the token was minted.
     * @param tokenId The NFT token id.
     * @param timestamp The timestamp to check on, can be both in the past and the future.
     * @return payout Total amount of tokens which have been vested at the provided timestamp.
     */
    function vestedPayoutAtTime(uint256 tokenId, uint256 timestamp) external view returns (uint256 payout);

    /**
     * @notice Number of tokens for an NFT which are currently vesting.
     * @dev The sum of vestedPayout and vestingPayout SHOULD always be the total payout.
     * @param tokenId The NFT token id.
     * @return payout The number of tokens for the NFT which are vesting until a future date.
     */
    function vestingPayout(uint256 tokenId) external view returns (uint256 payout);

    /**
     * @notice The start and end timestamps for the vesting of the provided NFT. 
     *  MUST return the timestamp where no further increase in vestedPayout occurs for `vestingEnd`.
     * @param tokenId The NFT token id.
     * @return vestingStart The beginning of the vesting as a unix timestamp.
     * @return vestingEnd The ending of the vesting as a unix timestamp.
     */
    function vestingPeriod(uint256 tokenId) external view returns (uint256 vestingStart, uint256 vestingEnd);

    /**
     * @notice Token which is used to pay out the vesting claims.
     * @param tokenId The NFT token id.
     * @return token The token which is used to pay out the vesting claims.
     */
    function payoutToken(uint256 tokenId) external view returns (address token);

    /**
     * @notice Sets a global `operator` with permission to manage all tokens owned by the current `msg.sender`.
     * @param operator The address to let manage all tokens.
     * @param approved A boolean indicating whether the spender is approved to claim for all tokens.
     */
    function setClaimApprovalForAll(address operator, bool approved) external;

    /**
     * @notice Sets a tokenId `operator` with permission to manage a single `tokenId` owned by the `msg.sender`.
     * @param operator The address to let manage a single `tokenId`.
     * @param tokenId the `tokenId` to be managed.
     * @param approved A boolean indicating whether the spender is approved to claim for all tokens.
     */
    function setClaimApproval(address operator, bool approved, uint256 tokenId) external;

    /**
     * @notice Returns true if `owner` has set `operator` to manage all `tokenId`s.
     * @param owner The owner allowing `operator` to manage all `tokenId`s.
     * @param operator The address who is given permission to spend tokens on behalf of the `owner`.
     */
    function isClaimApprovedForAll(address owner, address operator) external view returns (bool isClaimApproved);

    /**
     * @notice Returns the operating address for a `tokenId`. 
     *  If `tokenId` is not managed, then returns the zero address.
     * @param tokenId The NFT `tokenId` to query for a `tokenId` manager.
     */
    function getClaimApproved(uint256 tokenId) external view returns (address operator);
}

```

## Rationale

### Terms

These are base terms used around the specification which function names and definitions are based on.

- _vesting_: Tokens which a vesting NFT is vesting until a future date.
- _vested_: Total amount of tokens a vesting NFT has vested.
- _claimable_: Amount of vested tokens which can be unlocked.
- _claimed_: Total amount of tokens unlocked from a vesting NFT.
- _timestamp_: The unix `timestamp` (seconds) representation of dates used for vesting.

### Vesting Functions

**`vestingPayout` + `vestedPayout`**

`vestingPayout(uint256 tokenId)` and `vestedPayout(uint256 tokenId)` add up to the total number of tokens which can be claimed by the end of the vesting schedule. This is also equal to `vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)` with `type(uint256).max` as the `timestamp`.

The rationale for this is to guarantee that the tokens `vested` and tokens `vesting` are always in sync. The intent is that the vesting curves created are deterministic across the `vestingPeriod`. 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.

**`vestedPayout` vs `claimedPayout` &amp; `claimablePayout`**

```solidity
vestedPayout - claimedPayout - claimablePayout = lockedPayout
```

- `vestedPayout(uint256 tokenId)` provides the total amount of payout tokens which have **vested** _including `claimedPayout(uint256 tokenId)`_.
- `claimedPayout(uint256 tokenId)` provides the total amount of payout tokens which have been unlocked at the current `timestamp`.
- `claimablePayout(uint256 tokenId)` provides the amount of payout tokens which can be unlocked at the current `timestamp`.

The rationale for providing three functions is to support a number of features:

1. The return of `vestedPayout(uint256 tokenId)` will always match the return of `vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)` with `block.timestamp` as the `timestamp`.
2. `claimablePayout(uint256 tokenId)` can be used to easily see the current payout unlock amount and allow for unlock cliffs by returning zero until a `timestamp` has been passed.
3. `claimedPayout(uint256 tokenId)` is helpful to see tokens unlocked from an NFT and it is also necessary for the calculation of vested-but-locked payout tokens: `vestedPayout - claimedPayout - claimablePayout = lockedPayout`. This would depend on how the vesting curves are configured by the an implementation of this standard.

`vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)` provides functionality to iterate through the `vestingPeriod(uint256 tokenId)` and provide a visual of the release curve. The intent is that release curves are created which makes `vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)` deterministic.

### Timestamps

Generally in Solidity development it is advised against using `block.timestamp` as a state dependent variable as the timestamp of a block can be manipulated by a miner. The choice to use a `timestamp` over a `block` is to allow the interface to work across multiple **Ethereum Virtual Machine** (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.

The `timestamp` 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.

### Limitation of Scope

- **Historical claims**: While historical vesting schedules can be determined on-chain with `vestedPayoutAtTime(uint256 tokenId, uint256 timestamp)`, historical claims would need to be calculated through historical transaction data. Most likely querying for `PayoutClaimed` events to build a historical graph.

### Extension Possibilities

These feature are not supported by the standard as is, but the standard could be extended to support these more advanced features.

- **Custom Vesting Curves**: This standard intends on returning deterministic `vesting` values given NFT `tokenId` and a **timestamp** as inputs. This is intentional as it provides for flexibility in how the vesting curves work under the hood which doesn&apos;t constrain projects who intend on building a complex smart contract vesting architecture.
- **NFT Rentals**: Further complex DeFi tools can be created if vesting NFTs could be rented.

This is done intentionally to keep the base standard simple. These features can and likely will be added through extensions of this standard.

## Backwards Compatibility

- The Vesting NFT standard is meant to be fully backwards compatible with any current [ERC-721](./eip-721.md) integrations and marketplaces.
- The Vesting NFT standard also supports [ERC-165](./eip-165.md) interface detection for detecting `EIP-721` compatibility, as well as Vesting NFT compatibility.

## Test Cases

The reference vesting NFT repository includes tests written in Hardhat.

## Reference Implementation

A reference implementation of this EIP can be found in [ERC-5725 assets](../assets/eip-5725/README.md).

## Security Considerations

**timestamps**

- Vesting schedules are based on timestamps. As such, it&apos;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.
  - `vestedPayoutAtTime(tokenId, type(uint256).max)`, for example, must return the total payout for a given `tokenId`

**approvals**

- When an [ERC-721](./eip-721.md) 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.
- 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 08 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5725</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5725</guid>
      </item>
    
      <item>
        <title>Semi-Fungible Soulbound Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5727-semi-fungible-soulbound-token/11086</comments>
        
        <description>## Abstract

An interface for soulbound tokens (SBT), which are non-transferable tokens representing a person&apos;s identity, credentials, affiliations, and reputation.

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.

This interface aims to provide a flexible and extensible framework for the development of soulbound token systems.

## Motivation

The current Web3 ecosystem is heavily focused on financialized, transferable tokens. However, there&apos;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.

Our interface can be used to represent non-transferable ownerships, and provides features for common use cases including but not limited to:

- Lifecycle Management: Robust tools for minting, revocation, and managing the subscription and expiration of SBTs.
- DAO Governance and Delegation: Empower community-driven decisions and operational delegation for SBT management.
- Account Recovery: Advanced mechanisms for account recovery and key rotation, ensuring security and continuity.
- 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.
- Token Grouping: Innovative slot-based system for organizing SBTs, ideal for complex reward structures including vouchers, points, and badges.
- Claimable SBTs: Streamlined distribution of SBTs for airdrops, giveaways, and referral programs.

This interface not only enriches the Web3 landscape but also paves the way for a more decentralized and personalized digital society.

## Specification

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.

A token is identified by its `tokenId`, which is a 256-bit unsigned integer. A token can also have a value denoting its denomination.

A slot is identified by its `slotId`, 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.

### Core

The core methods are used to manage the lifecycle of SBTs. They MUST be supported by all semi-fungible SBT implementations.

```solidity
/**
 * @title ERC5727 Soulbound Token Interface
 * @dev The core interface of the ERC5727 standard.
 */
interface IERC5727 is IERC3525, IERC5192, IERC5484, IERC4906 {
    /**
     * @dev MUST emit when a token is revoked.
     * @param from The address of the owner
     * @param tokenId The token id
     */
    event Revoked(address indexed from, uint256 indexed tokenId);

    /**
     * @dev MUST emit when a token is verified.
     * @param by The address that initiated the verification
     * @param tokenId The token id
     * @param result The result of the verification
     */
    event Verified(address indexed by, uint256 indexed tokenId, bool result);

    /**
     * @notice Get the verifier of a token.
     * @dev MUST revert if the `tokenId` does not exist
     * @param tokenId the token for which to query the verifier
     * @return The address of the verifier of `tokenId`
     */
    function verifierOf(uint256 tokenId) external view returns (address);

    /**
     * @notice Get the issuer of a token.
     * @dev MUST revert if the `tokenId` does not exist
     * @param tokenId the token for which to query the issuer
     * @return The address of the issuer of `tokenId`
     */
    function issuerOf(uint256 tokenId) external view returns (address);

    /**
     * @notice Issue a token in a specified slot to an address.
     * @dev MUST revert if the `to` address is the zero address.
     *      MUST revert if the `verifier` address is the zero address.
     * @param to The address to issue the token to
     * @param tokenId The token id
     * @param slot The slot to issue the token in
     * @param burnAuth The burn authorization of the token
     * @param verifier The address of the verifier
     * @param data Additional data used to issue the token
     */
    function issue(
        address to,
        uint256 tokenId,
        uint256 slot,
        BurnAuth burnAuth,
        address verifier,
        bytes calldata data
    ) external payable;

    /**
     * @notice Issue credit to a token.
     * @dev MUST revert if the `tokenId` does not exist.
     * @param tokenId The token id
     * @param amount The amount of the credit
     * @param data The additional data used to issue the credit
     */
    function issue(
        uint256 tokenId,
        uint256 amount,
        bytes calldata data
    ) external payable;

    /**
     * @notice Revoke a token from an address.
     * @dev MUST revert if the `tokenId` does not exist.
     * @param tokenId The token id
     * @param data The additional data used to revoke the token
     */
    function revoke(uint256 tokenId, bytes calldata data) external payable;

    /**
     * @notice Revoke credit from a token.
     * @dev MUST revert if the `tokenId` does not exist.
     * @param tokenId The token id
     * @param amount The amount of the credit
     * @param data The additional data used to revoke the credit
     */
    function revoke(
        uint256 tokenId,
        uint256 amount,
        bytes calldata data
    ) external payable;

    /**
     * @notice Verify if a token is valid.
     * @dev MUST revert if the `tokenId` does not exist.
     * @param tokenId The token id
     * @param data The additional data used to verify the token
     * @return A boolean indicating whether the token is successfully verified
     */
    function verify(
        uint256 tokenId,
        bytes calldata data
    ) external returns (bool);
}
```

### Extensions

All extensions below are OPTIONAL for [ERC-5727](./eip-5727.md) implementations. An implementation MAY choose to implement some, none, or all of them.

#### Enumerable

This extension provides methods to enumerate the tokens of a owner. It is recommended to be implemented together with the core interface.

```solidity
/**
 * @title ERC5727 Soulbound Token Enumerable Interface
 * @dev This extension allows querying the tokens of a owner.
 */
interface IERC5727Enumerable is IERC3525SlotEnumerable, IERC5727 {
    /**
     * @notice Get the number of slots of a owner.
     * @param owner The owner whose number of slots is queried for
     * @return The number of slots of the `owner`
     */
    function slotCountOfOwner(address owner) external view returns (uint256);

    /**
     * @notice Get the slot with `index` of the `owner`.
     * @dev MUST revert if the `index` exceed the number of slots of the `owner`.
     * @param owner The owner whose slot is queried for.
     * @param index The index of the slot queried for
     * @return The slot is queried for
     */
    function slotOfOwnerByIndex(
        address owner,
        uint256 index
    ) external view returns (uint256);

    /**
     * @notice Get the balance of a owner in a slot.
     * @dev MUST revert if the slot does not exist.
     * @param owner The owner whose balance is queried for
     * @param slot The slot whose balance is queried for
     * @return The balance of the `owner` in the `slot`
     */
    function ownerBalanceInSlot(
        address owner,
        uint256 slot
    ) external view returns (uint256);
}
```

#### Metadata

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).

```solidity
/**
 * @title ERC5727 Soulbound Token Metadata Interface
 * @dev This extension allows querying the metadata of soulbound tokens.
 */
interface IERC5727Metadata is IERC3525Metadata, IERC5727 {

}
```

#### Governance

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.

```solidity
/**
 * @title ERC5727 Soulbound Token Governance Interface
 * @dev This extension allows issuing of tokens by community voting.
 */
interface IERC5727Governance is IERC5727 {
    enum ApprovalStatus {
        Pending,
        Approved,
        Rejected,
        Removed
    }

    /**
     * @notice Emitted when a token issuance approval is changed.
     * @param approvalId The id of the approval
     * @param creator The creator of the approval, zero address if the approval is removed
     * @param status The status of the approval
     */
    event ApprovalUpdate(
        uint256 indexed approvalId,
        address indexed creator,
        ApprovalStatus status
    );

    /**
     * @notice Emitted when a voter approves an approval.
     * @param voter The voter who approves the approval
     * @param approvalId The id of the approval
     */
    event Approve(
        address indexed voter,
        uint256 indexed approvalId,
        bool approve
    );

    /**
     * @notice Create an approval of issuing a token.
     * @dev MUST revert if the caller is not a voter.
     *      MUST revert if the `to` address is the zero address.
     * @param to The owner which the token to mint to
     * @param tokenId The id of the token to mint
     * @param amount The amount of the token to mint
     * @param slot The slot of the token to mint
     * @param burnAuth The burn authorization of the token to mint
     * @param data The additional data used to mint the token
     */
    function requestApproval(
        address to,
        uint256 tokenId,
        uint256 amount,
        uint256 slot,
        BurnAuth burnAuth,
        address verifier,
        bytes calldata data
    ) external;

    /**
     * @notice Remove `approvalId` approval request.
     * @dev MUST revert if the caller is not the creator of the approval request.
     *      MUST revert if the approval request is already approved or rejected or non-existent.
     * @param approvalId The approval to remove
     */
    function removeApprovalRequest(uint256 approvalId) external;

    /**
     * @notice Approve `approvalId` approval request.
     * @dev MUST revert if the caller is not a voter.
     *     MUST revert if the approval request is already approved or rejected or non-existent.
     * @param approvalId The approval to approve
     * @param approve True if the approval is approved, false if the approval is rejected
     * @param data The additional data used to approve the approval (e.g. the signature, voting power)
     */
    function voteApproval(
        uint256 approvalId,
        bool approve,
        bytes calldata data
    ) external;

    /**
     * @notice Get the URI of the approval.
     * @dev MUST revert if the `approvalId` does not exist.
     * @param approvalId The approval whose URI is queried for
     * @return The URI of the approval
     */
    function approvalURI(
        uint256 approvalId
    ) external view returns (string memory);
}
```

#### Delegate

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.

```solidity
/**
 * @title ERC5727 Soulbound Token Delegate Interface
 * @dev This extension allows delegation of issuing and revocation of tokens to an operator.
 */
interface IERC5727Delegate is IERC5727 {
    /**
     * @notice Emitted when a token issuance is delegated to an operator.
     * @param operator The owner to which the issuing right is delegated
     * @param slot The slot to issue the token in
     */
    event Delegate(address indexed operator, uint256 indexed slot);

    /**
     * @notice Emitted when a token issuance is revoked from an operator.
     * @param operator The owner to which the issuing right is delegated
     * @param slot The slot to issue the token in
     */
    event UnDelegate(address indexed operator, uint256 indexed slot);

    /**
     * @notice Delegate rights to `operator` for a slot.
     * @dev MUST revert if the caller does not have the right to delegate.
     *      MUST revert if the `operator` address is the zero address.
     *      MUST revert if the `slot` is not a valid slot.
     * @param operator The owner to which the issuing right is delegated
     * @param slot The slot to issue the token in
     */
    function delegate(address operator, uint256 slot) external;

    /**
     * @notice Revoke rights from `operator` for a slot.
     * @dev MUST revert if the caller does not have the right to delegate.
     *      MUST revert if the `operator` address is the zero address.
     *      MUST revert if the `slot` is not a valid slot.
     * @param operator The owner to which the issuing right is delegated
     * @param slot The slot to issue the token in
     */

    function undelegate(address operator, uint256 slot) external;

    /**
     * @notice Check if an operator has the permission to issue or revoke tokens in a slot.
     * @param operator The operator to check
     * @param slot The slot to check
     */
    function isOperatorFor(
        address operator,
        uint256 slot
    ) external view returns (bool);
}

```

#### Recovery

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 [EIP-712](./eip-712.md) for readability and usability.

```solidity
/**
 * @title ERC5727 Soulbound Token Recovery Interface
 * @dev This extension allows recovering soulbound tokens from an address provided its signature.
 */
interface IERC5727Recovery is IERC5727 {
    /**
     * @notice Emitted when the tokens of `owner` are recovered.
     * @param from The owner whose tokens are recovered
     * @param to The new owner of the tokens
     */
    event Recovered(address indexed from, address indexed to);

    /**
     * @notice Recover the tokens of `owner` with `signature`.
     * @dev MUST revert if the signature is invalid.
     * @param owner The owner whose tokens are recovered
     * @param signature The signature signed by the `owner`
     */
    function recover(address owner, bytes memory signature) external;
}
```

#### Expirable

This extension provides methods to manage the expiration of tokens. It is useful if you want to expire/invalidate tokens after a certain period of time.

```solidity
/**
 * @title ERC5727 Soulbound Token Expirable Interface
 * @dev This extension allows soulbound tokens to be expirable and renewable.
 */
interface IERC5727Expirable is IERC5727, IERC5643 {
    /**
     * @notice Set the expiry date of a token.
     * @dev MUST revert if the `tokenId` token does not exist.
     *      MUST revert if the `date` is in the past.
     * @param tokenId The token whose expiry date is set
     * @param expiration The expire date to set
     * @param isRenewable Whether the token is renewable
     */
    function setExpiration(
        uint256 tokenId,
        uint64 expiration,
        bool isRenewable
    ) external;
}
```

## Rationale

### Token storage model

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 [ERC-1155](./eip-1155.md).

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.

Secondly, unlike [ERC-1155](./eip-1155.md), 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&apos;s credibility, membership, etc.

### Recovery mechanism

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 [ERC-1271](./eip-1271.md).

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 `recover` function instead of `transferFrom` or `safeTransferFrom`.

## Backwards Compatibility

This EIP proposes a new token interface which is compatible with [ERC-721](./eip-721.md), [ERC-3525](./eip-3525.md), [ERC-4906](./eip-4906.md), [ERC-5192](./eip-5192.md), [ERC-5484](./eip-5484.md).

This EIP is also compatible with [ERC-165](./eip-165.md).

## Test Cases

Our sample implementation includes test cases written using Hardhat.

## Reference Implementation

You can find our reference implementation [here](../assets/eip-5727/ERC5727.sol).

## Security Considerations

This EIP does not involve the general transfer of tokens, and thus there will be no security issues related to token transfer generally.

However, users should be aware of the security risks of using the recovery mechanism. If a user loses his/her private key, all his/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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 28 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5727</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5727</guid>
      </item>
    
      <item>
        <title>Commit Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-5732-simple-commit-interface-to-support-commit-reveal-schemes/11115</comments>
        
        <description>## Abstract

A simple commit interface to support commit-reveal scheme which provides **only** a commit
method but no reveal method, allowing implementations to integrate this interface
with arbitrary reveal methods such as `vote` or `transfer`.

## Motivation

1. support commit-reveal privacy for applications such as voting.
2. make it harder for attackers for front-running, back-running or sandwich attacks.

## Specification

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.

Interfaces referenced in this specification are as follows:

```solidity
pragma solidity &gt;=0.7.0 &lt;0.9.0;

// The EIP-165 identifier of this interface is 0xf14fcbc8
interface IERC_COMMIT_CORE {
    function commit(bytes32 _commitment) payable external;
}

pragma solidity &gt;=0.7.0 &lt;0.9.0;

// The EIP-165 identifier of this interface is 0x67b2ec2c
interface IERC_COMMIT_GENERAL {
    event Commit(
        uint256 indexed _timePoint,
        address indexed _from,
        bytes32 indexed _commitment,
        bytes _extraData);
    function commitFrom(
        address _from,
        bytes32 _commitment,
        bytes calldata _extraData)
    payable external returns(uint256 timePoint);
}
```

1. A compliant contract MUST implement the `IERC_COMMIT_CORE` interface.
2. A compliant contract SHOULD implement the `IERC_COMMIT_GENERAL` interface.
3. A compliant contract that implements the `IERC_COMMIT_GENERAL` interface MUST accept `commit(_commitment)` as equivalent to `commitFrom(msg.sender, _commitment, [/*empty array*/])`.
4. The `timePoint` return value of `commitFrom` is RECOMMENDED to use `block.timestamp` or `block.number` or a number that indicates the ordering of different commitments. When `commitFrom` is being called.
5. A compliant contract that implements `IERC_COMMIT_GENERAL` MUST emit event `Commit` when a commitment is accepted and recorded. In the parameter of both `Commit` and the `commitFrom` method, the `_timePoint` is a time-point-representing value that represents ordering of commitments in which a latter commitment will always have a _greater or equal value_ than a former commitment, such as `block.timestamp` or `block.number` or other time scale chosen by implementing contracts.

6. The `extraData` is reserved for future behavior extension. If the `_from` is different from the TX signer, it is RECOMMENDED that compliant contract SHOULD validate signature for `_from`. For EOAs this will be validating its ECDSA signatures on chain. For smart contract accounts, it is RECOMMENDED to use [EIP-1271](./eip-1271.md) to validate the signatures.

7. One or more methods of a compliant contract MAY be used for reveal.

But there MUST be a way to supply an extra field of `secret_salt`, so that committer can later open the `secret_salt` in the reveal TX that exposes the `secret_salt`. The size and location of `secret_salt` is intentionally unspecified in this EIP to maximize flexibility for integration.

8. It is RECOMMENDED for compliant contracts to implement [EIP-165](./eip-165.md).

## Rationale

1. 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.

2. The key derived design decision we made is we will have  a standardized `commit` method without a standardized `reveal` method, making room for customized reveal method or using `commit` with existing standard.

3. We chose to have a simple one parameter method of `commit` in our Core interface to make it fully backward compatible with a few prior-adoptions e.g. ENS

4. We also add a `commitFrom` to easy commitment being generated off-chain and submitted by some account on behalf by another account.

## Backwards Compatibility

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.

The `IERC_COMMIT_CORE` is backward compatible with ENS implementations and other existing prior-art.

## Reference Implementation

### Commit with ENS Register as Reveal

In ENS registering process, currently inside of `ETHRegistrarController` contract a commit function is being used to allow registerer fairly register a desire domain to avoid being front-run.

Here is how ENS uses commitment in its registration logic:

```solidity
function commit(bytes32 commitment) public {
    require(commitments[commitment] + maxCommitmentAge &lt; now);
    commitments[commitment] = now;
}
```

With this EIP it can be updated to

```solidity
function commit(bytes32 commitment, bytes calldata data) public {
    require(commitments[commitment] + maxCommitmentAge &lt; now);
    commitments[commitment] = now;
    emit Commit(...);
}
```

## Security Considerations

1. Do not use the reference implementation in production. It is just for demonstration purposes.
2. The reveal transactions and parameters, especially `secret_salt`, MUST be kept secret before they are revealed.
3. The length of `secret_salt` must be cryptographically long enough and the random values used to generate `secret_salt` must be cryptographically safe.
4. Users must NEVER reuse a used `secret_salt`. It&apos;s recommended for client applications to warn users who attempt to do so.
5. Contract implementations should consider deleting the commitment of a given sender immediately to reduce the chances of a replay attack or re-entry attack.
6. Contract implementations may consider including the ordering of commitment received to add restrictions on the order of reveal transactions.
7. 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 [EIP-712](./eip-712.md) to compose commitments before creating their own new solution.
8. Proper time gaps are suggested if the purpose is to avoid frontrunning attacks.
9. For compliant contract that requires the `_timePoint` from the next transaction to be _strictly greater_ than that of any previous transaction, `block.timestamp` and `block.number` are not reliable as two transactions could co-exist in the same block resulting in the same `_timePoint` 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/other TX that shares the same `block.timestamp` or `block.number`.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 29 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5732</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5732</guid>
      </item>
    
      <item>
        <title>Latent Fungible Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5744-latent-fungible-token/11111</comments>
        
        <description>## Abstract

The following standard is an extension of [EIP-20](./eip-20.md) 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.

## Motivation

Example use cases include:

- 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.
- Vesting tokens that cannot be transferred or used until the vesting period has elapsed.

## Specification

All latent fungible tokens MUST implement EIP-20 to represent the token.
The `balanceOf` and `totalSupply` return quantities for all tokens, not just the matured, fungible tokens.
A new method called `balanceOfMatured` MUST be added to the ABI.
This method returns the balance of matured tokens for a given address:

```solidity
function balanceOfMatured(address user) external view returns (uint256);
```

An additional method called `getMints` MUST be added, which returns an array of all mint metadata for a given address:

```solidity
struct MintMetadata {
  // Amount of tokens minted.
  uint256 amount;
  // Timestamp of the mint, in seconds.
  uint256 time;
  // Delay in seconds until these tokens mature and become fungible. When the
  // delay is not known (e.g. if it&apos;s dependent on other factors aside from
  // simply elapsed time), this value must be `type(uint256).max`.
  uint256 delay;
}

function getMints(address user) external view returns (MintMetadata[] memory);
```

Note that the implementation does not require that each of the above metadata parameters are stored as a `uint256`, just that they are returned as `uint256`.

An additional method called `mints` MAY be added.
This method returns the metadata for a mint based on its ID:

```solidity
function mints(address user, uint256 id) external view returns (MintMetadata memory);
```

The ID is not prescriptive—it may be an index in an array, or may be generated by other means.

The `transfer` and `transferFrom` 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.

All latent fungible tokens MUST implement EIP-20’s optional metadata extensions.
The `name` and `symbol` functions MUST reflect the underlying token’s `name` and `symbol` in some way.

## Rationale

The `mints` 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.

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.

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 `eth_call`.
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 `getMints(address user, uint256 startId, uint256 endId)`.
However, if IDs are not sequential, a different signature may be required, and therefore this was not included in the specification.

## Backwards Compatibility

This proposal is fully backward compatible with the EIP-20 standard and has no known compatibility issues with other standards.

## Security Considerations

Iterating over large arrays of mints is not recommended, as this is very expensive and may cause the protocol, or just a user&apos;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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 29 Sep 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5744</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5744</guid>
      </item>
    
      <item>
        <title>General Extensibility for Method Behaviors</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-5750-method-with-extra-data/11176</comments>
        
        <description>## Abstract

This EIP standardizes the passing of unstructured call data to functions to enable future extensibility.

## Motivation

The purpose of having extra data in a method is to allow further extensions to existing method interfaces.

It is it useful to make methods extendable. Any methods complying with this EIP, such as overloaded `transfer` and `vote` 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/commit scheme. Finally, data can be passed forward to callbacks.

There are two ways to achieve extensibility for existing functions. Each comes with their set of challenges:

1. Add a new method

  * What will the method name be?
  * What will the parameters be?
  * How many use-cases does a given method signature support?
  * Does this support off-chain signatures?

2. Use one or more existing parameters, or add one or more new ones

  * Should existing parameters be repurposed, or should more be added?
  * How many parameters should be used?
  * What are their sizes and types?

Standardizing how methods can be extended helps to answer these questions.

Finally, this EIP aims to achieve maximum backward and future compatibility. Many EIPs already partially support this EIP, such as [EIP-721](./eip-721.md) and [EIP-1155](./eip-1155.md). This EIP supports many use cases, from commit-reveal schemes ([EIP-5732](./eip-5732.md)), 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.

## Specification

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.

When used in this EIP, the term `bytes` MUST be interpreted as the dynamically-sized byte array in Solidity data types.

1. Unlike many other ERCs which is compliant at the `contract` level, this ERC&apos;s specification specify compliance at `method` level.

2. Any method with a bytes as this method&apos;s last parameter is an _eligible_ method. It looks like this `function methodName(type1 value1, type2 value2, ... bytes data)`.

3. A _compliant_ method MUST be an _eligible_ method and MUST also designate that last `bytes` field in its method parameter for behaviors extensions.

4. If an _eligible_ method has an overloaded sibling method that
has the exact same method name and exact same preceding parameters
except for not having the last `bytes` parameter, the behavior
of the compliant method MUST be identical to
its overloaded sibling method when last `bytes` is an empty array.

### Examples of compliant and non-compliant methods

1. Here is a compliant method `methodName1` in a `Foo` contract

```solidity
contract Foo {
  // @dev This method allows extension behavior via `_data` field;
  function methodName1(uint256 _param1, address _param2, bytes calldata _data);
  function firstNonRelatedMethod(uint256 someValue);
  function secondNonRelatedMethod(uint256 someValue);
}
```

2. Here is a compliant method `methodName2` in a `Bar` contract which is an overloaded method for another `methodName2`.


```solidity
contract Foo {
  // @dev This is a sibling method to `methodName2(uint256 _param1, address _param2, bytes calldata _data);`
  function methodName2(uint256 _param1, address _param2);

  // @dev This method allows extension behavior via `_data` field;
  //      When passed in an empty array for `_data` field, this method
  //      MUST behave IDENTICAL to
  //      its overloaded sibling `methodName2(uint256 _param1, address _param2);`
  function methodName2(uint256 _param1, address _param2, bytes calldata _data);

  function firstNonRelatedMethod(uint256 someValue);
  function secondNonRelatedMethod(uint256 someValue);
}
```

3. Here is a non-compliant method `methodName1` because it do not allow extending behavior

```solidity
contract Foo {
  // @dev This method DO NOT allow extension behavior via `_data` field;
  function methodName1(uint256 _param1, address _param2, bytes calldata _data);
  function firstNonRelatedMethod(uint256 someValue);
  function secondNonRelatedMethod(uint256 someValue);
}
```

4. Here is a non-compliant method
`methodName2(uint256 _param1, address _param2, bytes calldata _data);`
because it behaves differently
to its overloaded sibling method
`methodName2(uint256 _param1, address _param2);` when `_data` is empty array.

```solidity
contract Foo {
  // @dev This is a sibling method to `methodName2(uint256 _param1, address _param2, bytes calldata _data);`
  function methodName2(uint256 _param1, address _param2);

  // @dev This method allows extension behavior via `_data` field;
  //      When passed in an empty array for `_data` field, this method
  //      behave DIFFERENTLY to
  //      its overloaded sibling `methodName2(uint256 _param1, address _param2);`
  function methodName2(uint256 _param1, address _param2, bytes calldata _data);

  function firstNonRelatedMethod(uint256 someValue);
  function secondNonRelatedMethod(uint256 someValue);
}
```

## Rationale

1. Using the dynamically-sized `bytes` type allows for maximum flexibility by enabling payloads of arbitrary types.
2. Having the bytes specified as the last parameter makes this EIP compatible with the calldata layout of solidity.

## Backwards Compatibility

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.

Here is an incomplete list:

* In [EIP-721](./eip-721.md), the following method is already compliant:
  * `function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) external payable;` is already compliant
* In [EIP-1155](./eip-1155.md), the following methods are already compliant
  * `function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;`
  * `function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;`
* In [EIP-777](./eip-777.md), the following methods are already compliant
  * `function burn(uint256 amount, bytes calldata data) external;`
  * `function send(address to, uint256 amount, bytes calldata data) external;`

However, not all functions that have a `bytes` as the last parameter are compliant. The following functions are not compliant without an overload since their last parameter is involved in functionality:

* In [EIP-2535](./eip-2535.md), the following methods is not compliant:
  * `function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external;`
  * **Either** of the following can be done to create a compliance.
    1. An overload MUST be created: `function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata, bytes calldata _data) external;` which adds a new `_data` after all parameters of original method.
    2. The use of `bytes memory _calldata` MUST be relaxed to allow for extending behaviors.
* In [EIP-1271](./eip-1271.md), the following method is not compliant:
  * `function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue);`
  * **Either** of the following can be done to create a compliance:
    1. An new overload MUST be created: `function isValidSignature(bytes32 _hash, bytes memory _signature, bytes calldata _data) public view returns (bytes4 magicValue);` which adds a new `_data` after all parameters of original method.
    2. The use of `bytes memory _signature` MUST be relaxed to allow for extending behaviors.

## Security Considerations

1. 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.
2. 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. **Unencrypted personally identifiable information must never be included in the data parameter.**

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 04 Oct 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5750</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5750</guid>
      </item>
    
      <item>
        <title>Lockable Extension for EIP-721</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/lockable-nfts-extension/8800</comments>
        
        <description>## Abstract

This standard is an extension of [EIP-721](./eip-721.md). It introduces lockable NFTs. The locked asset can be used in any way except by selling and/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 `unlock` the token.

## Motivation

With NFTs, digital objects become digital goods, which are verifiably ownable, easily tradable, and immutably stored on the blockchain. That&apos;s why it&apos;s very important to continuously improve UX for non-fungible tokens, not just inherit it from one of the fungible tokens.

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.

However, it should be different for NFTs because NFTs have plenty of use cases that require the NFT to stay in the holder&apos;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.

The following use cases are enabled for lockable NFTs:

- **NFT-collateralised loans** 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.
- **No collateral rentals of NFTs** 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.
- **Primary sales** Mint NFT for only the part of the price and pay the rest when you are satisfied with how the collection evolves.
- **Secondary sales** Buy and sell your NFT by installments. Buyer gets locked NFT and immediately starts using it. At the same time he/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.
- **S is for Safety** 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 `Lockable` 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 `Lockable` NFTs safe.
- **Metaverse ready** 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.
- **Non-custodial staking** 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&apos;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.
- **Safe and convenient co-ownership and co-usage** 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&apos; wallet and he will be able to use it in any way (except transfers) without requiring multi-approval. Transfers will require multi-approval.


## Specification

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.

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 `getLocked` function MUST return an address that is able to unlock the token.
For tokens that are not locked, the `getLocked` function MUST return `address(0)`.
The user MAY permanently lock the token by calling `lock(address(1), tokenId)`.

When the token is locked, all the [EIP-721](./eip-721.md) transfer functions MUST revert, except if the transaction has been initiated by an unlocker.
When the token is locked, the [EIP-721](./eip-721.md) `approve` method MUST revert for this token.
When the token is locked, the [EIP-721](./eip-721.md) `getApproved` method SHOULD return `unlocker` address for this token so the unlocker is able to transfer this token.
When the token is locked, the `lock` method MUST revert for this token, even when it is called with the same `unlocker` as argument.
When the locked token is transferred by an unlocker, the token MUST be unlocked after the transfer.

Marketplaces should call `getLocked` 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.  

### Contract Interface

```solidity
pragma solidity &gt;=0.8.0;

/// @dev Interface for the Lockable extension

interface ILockable {

    /**
     * @dev Emitted when `id` token is locked, and `unlocker` is stated as unlocking wallet.
     */
    event Lock (address indexed unlocker, uint256 indexed id);

    /**
     * @dev Emitted when `id` token is unlocked.
     */
    event Unlock (uint256 indexed id);

    /**
     * @dev Locks the `id` token and gives the `unlocker` address permission to unlock.
     */
    function lock(address unlocker, uint256 id) external;

    /**
     * @dev Unlocks the `id` token.
     */
    function unlock(uint256 id) external;

    /**
     * @dev Returns the wallet, that is stated as unlocking wallet for the `tokenId` token.
     * If address(0) returned, that means token is not locked. Any other result means token is locked.
     */
    function getLocked(uint256 tokenId) external view returns (address);

}
```

The `supportsInterface` method MUST return `true` when called with `0x72b68110`.

## Rationale

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.

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.

When there is a need to grant temporary and/or redeemable rights for the token (rentals, purchase with instalments) this EIP involves the real transfer of the token to the temporary user&apos;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.

Naming and reference implementation for the functions and storage entities mimics that of Approval flow for [EIP-721] in order to be intuitive.

## Backwards Compatibility

This standard is compatible with current [EIP-721](./eip-721.md) standards.

## Reference Implementation

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity &gt;=0.8.0;

import &apos;../ILockable.sol&apos;;
import &apos;@openzeppelin/contracts/token/ERC721/ERC721.sol&apos;;

/// @title Lockable Extension for ERC721

abstract contract ERC721Lockable is ERC721, ILockable {

    /*///////////////////////////////////////////////////////////////
                            LOCKABLE EXTENSION STORAGE                        
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 =&gt; address) internal unlockers;

    /*///////////////////////////////////////////////////////////////
                              LOCKABLE LOGIC
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev Public function to lock the token. Verifies if the msg.sender is the owner
     *      or approved party.
     */

    function lock(address unlocker, uint256 id) public virtual {
        address tokenOwner = ownerOf(id);
        require(msg.sender == tokenOwner || isApprovedForAll(tokenOwner, msg.sender)
        , &quot;NOT_AUTHORIZED&quot;);
        require(unlockers[id] == address(0), &quot;ALREADY_LOCKED&quot;); 
        unlockers[id] = unlocker;
        _approve(unlocker, id);
    }

    /**
     * @dev Public function to unlock the token. Only the unlocker (stated at the time of locking) can unlock
     */
    function unlock(uint256 id) public virtual {
        require(msg.sender == unlockers[id], &quot;NOT_UNLOCKER&quot;);
        unlockers[id] = address(0);
    }

    /**
     * @dev Returns the unlocker for the tokenId
     *      address(0) means token is not locked
     *      reverts if token does not exist
     */
    function getLocked(uint256 tokenId) public virtual view returns (address) {
        require(_exists(tokenId), &quot;Lockable: locking query for nonexistent token&quot;);
        return unlockers[tokenId];
    }

    /**
     * @dev Locks the token
     */
    function _lock(address unlocker, uint256 id) internal virtual {
        unlockers[id] = unlocker;
    }

    /**
     * @dev Unlocks the token
     */
    function _unlock(uint256 id) internal virtual {
        unlockers[id] = address(0);
    }

    /*///////////////////////////////////////////////////////////////
                              OVERRIDES
    //////////////////////////////////////////////////////////////*/

    function approve(address to, uint256 tokenId) public virtual override {
        require (getLocked(tokenId) == address(0), &quot;Can not approve locked token&quot;);
        super.approve(to, tokenId);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        // if it is a Transfer or Burn
        if (from != address(0)) { 
            // token should not be locked or msg.sender should be unlocker to do that
            require(getLocked(tokenId) == address(0) || msg.sender == getLocked(tokenId), &quot;LOCKED&quot;);
        }
    }

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        // if it is a Transfer or Burn, we always deal with one token, that is startTokenId
        if (from != address(0)) { 
            // clear locks
            delete unlockers[tokenId];
        }
    }

    /**
     * @dev Optional override, if to clear approvals while the tken is locked
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        if (getLocked(tokenId) != address(0)) {
            return address(0);
        }
        return super.getApproved(tokenId);
    }

    /*///////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            interfaceId == type(IERC721Lockable).interfaceId ||
            super.supportsInterface(interfaceId);
    }

}
```

## Security Considerations

There are no security considerations related directly to the implementation of this standard for the contract that manages [EIP-721](./eip-721.md) tokens.

### Considerations for the contracts that work with lockable tokens

- Make sure that every contract that is stated as `unlocker` can actually unlock the token in all cases.
- 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 `transferFrom` instead of `safeTransferFrom` to avoid re-entrancies.
- There are no MEV considerations regarding lockable tokens as only authorized parties are allowed to lock and unlock.


## Copyright

Copyright and related rights waived via [CC0](/LICENSE)
</description>
        <pubDate>Wed, 05 Oct 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5753</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5753</guid>
      </item>
    
      <item>
        <title>Context-Dependent Multi-Asset Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/multiresource-tokens/11326</comments>
        
        <description>## Abstract

The Multi-Asset NFT standard allows for the construction of a new primitive: context-dependent output of information per single NFT.

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.

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.

## Motivation

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.

In the four years since [ERC-721](./eip-721.md) was published, the need for additional functionality has resulted in countless extensions. This EIP improves upon ERC-721 in the following areas:

- [Cross-metaverse compatibility](#cross-metaverse-compatibility)
- [Multi-media output](#multi-media-output)
- [Media redundancy](#media-redundancy)
- [NFT evolution](#nft-evolution)

### Cross-metaverse compatibility

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.

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.

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.

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/trailer of the cosmetic item.

This EIP adds a layer of abstraction, allowing game developers to directly pull asset data from a user&apos;s NFTs instead of hard-coding it.

### Multi-media output

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&apos;s cover image) for identification on various marketplaces, Search Engine Result Pages (SERPs), or portfolio trackers.

### Media redundancy

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.

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.

### NFT evolution

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&apos;s server which replaces username/password logins with reading an account&apos;s NFT balance.

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 [cross-metaverse](#cross-metaverse-compatibility) compatibility above).

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.

Replacing an asset could, to some extent, be similar to replacing an ERC-721 token&apos;s URI. When an asset is replaced a clear line of traceability remains; the old asset is still reachable and verifiable. Replacing an asset&apos;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.

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.

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&apos;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.

Alternative example of this, could be version control of an IoT device&apos;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.

## Specification

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.

```solidity
/// @title ERC-5773 Context-Dependent Multi-Asset Tokens
/// @dev See https://eips.ethereum.org/EIPS/eip-5773
/// @dev Note: the ERC-165 identifier for this interface is 0x06b4329a.

pragma solidity ^0.8.16;

interface IERC5773 /* is ERC165 */ {
    /**
     * @notice Used to notify listeners that an asset object is initialised at `assetId`.
     * @param assetId ID of the asset that was initialised
     */
    event AssetSet(uint64 assetId);

    /**
     * @notice Used to notify listeners that an asset object at `assetId` is added to token&apos;s pending asset
     *  array.
     * @param tokenIds An array of IDs of the tokens that received a new pending asset
     * @param assetId ID of the asset that has been added to the token&apos;s pending assets array
     * @param replacesId ID of the asset that would be replaced
     */
    event AssetAddedToTokens(
        uint256[] tokenIds,
        uint64 indexed assetId,
        uint64 indexed replacesId
    );

    /**
     * @notice Used to notify listeners that an asset object at `assetId` is accepted by the token and migrated
     *  from token&apos;s pending assets array to active assets array of the token.
     * @param tokenId ID of the token that had a new asset accepted
     * @param assetId ID of the asset that was accepted
     * @param replacesId ID of the asset that was replaced
     */
    event AssetAccepted(
        uint256 indexed tokenId,
        uint64 indexed assetId,
        uint64 indexed replacesId
    );

    /**
     * @notice Used to notify listeners that an asset object at `assetId` is rejected from token and is dropped
     *  from the pending assets array of the token.
     * @param tokenId ID of the token that had an asset rejected
     * @param assetId ID of the asset that was rejected
     */
    event AssetRejected(uint256 indexed tokenId, uint64 indexed assetId);

    /**
     * @notice Used to notify listeners that token&apos;s priority array is reordered.
     * @param tokenId ID of the token that had the asset priority array updated
     */
    event AssetPrioritySet(uint256 indexed tokenId);

    /**
     * @notice Used to notify listeners that owner has granted an approval to the user to manage the assets of a
     *  given token.
     * @dev Approvals must be cleared on transfer
     * @param owner Address of the account that has granted the approval for all token&apos;s assets
     * @param approved Address of the account that has been granted approval to manage the token&apos;s assets
     * @param tokenId ID of the token on which the approval was granted
     */
    event ApprovalForAssets(
        address indexed owner,
        address indexed approved,
        uint256 indexed tokenId
    );

    /**
     * @notice Used to notify listeners that owner has granted approval to the user to manage assets of all of their
     *  tokens.
     * @param owner Address of the account that has granted the approval for all assets on all of their tokens
     * @param operator Address of the account that has been granted the approval to manage the token&apos;s assets on all of the
     *  tokens
     * @param approved Boolean value signifying whether the permission has been granted (`true`) or revoked (`false`)
     */
    event ApprovalForAllForAssets(
        address indexed owner,
        address indexed operator,
        bool approved
    );

    /**
     * @notice Accepts an asset at from the pending array of given token.
     * @dev Migrates the asset from the token&apos;s pending asset array to the token&apos;s active asset array.
     * @dev Active assets cannot be removed by anyone, but can be replaced by a new asset.
     * @dev Requirements:
     *
     *  - The caller must own the token or be approved to manage the token&apos;s assets
     *  - `tokenId` must exist.
     *  - `index` must be in range of the length of the pending asset array.
     * @dev Emits an {AssetAccepted} event.
     * @param tokenId ID of the token for which to accept the pending asset
     * @param index Index of the asset in the pending array to accept
     * @param assetId Id of the asset expected to be in the index
     */
    function acceptAsset(
        uint256 tokenId,
        uint256 index,
        uint64 assetId
    ) external;

    /**
     * @notice Rejects an asset from the pending array of given token.
     * @dev Removes the asset from the token&apos;s pending asset array.
     * @dev Requirements:
     *
     *  - The caller must own the token or be approved to manage the token&apos;s assets
     *  - `tokenId` must exist.
     *  - `index` must be in range of the length of the pending asset array.
     * @dev Emits a {AssetRejected} event.
     * @param tokenId ID of the token that the asset is being rejected from
     * @param index Index of the asset in the pending array to be rejected
     * @param assetId Id of the asset expected to be in the index
     */
    function rejectAsset(
        uint256 tokenId,
        uint256 index,
        uint64 assetId
    ) external;

    /**
     * @notice Rejects all assets from the pending array of a given token.
     * @dev Effectively deletes the pending array.
     * @dev Requirements:
     *
     *  - The caller must own the token or be approved to manage the token&apos;s assets
     *  - `tokenId` must exist.
     * @dev Emits a {AssetRejected} event with assetId = 0.
     * @param tokenId ID of the token of which to clear the pending array
     * @param maxRejections to prevent from rejecting assets which arrive just before this operation.
     */
    function rejectAllAssets(uint256 tokenId, uint256 maxRejections) external;

    /**
     * @notice Sets a new priority array for a given token.
     * @dev The priority array is a non-sequential list of `uint16`s, where the lowest value is considered highest
     *  priority.
     * @dev Value `0` of a priority is a special case equivalent to uninitialised.
     * @dev Requirements:
     *
     *  - The caller must own the token or be approved to manage the token&apos;s assets
     *  - `tokenId` must exist.
     *  - The length of `priorities` must be equal the length of the active assets array.
     * @dev Emits a {AssetPrioritySet} event.
     * @param tokenId ID of the token to set the priorities for
     * @param priorities An array of priorities of active assets. The succession of items in the priorities array
     *  matches that of the succession of items in the active array
     */
    function setPriority(uint256 tokenId, uint64[] calldata priorities)
        external;

    /**
     * @notice Used to retrieve IDs of the active assets of given token.
     * @dev Asset data is stored by reference, in order to access the data corresponding to the ID, call
     *  `getAssetMetadata(tokenId, assetId)`.
     * @dev You can safely get 10k
     * @param tokenId ID of the token to retrieve the IDs of the active assets
     * @return uint64[] An array of active asset IDs of the given token
     */
    function getActiveAssets(uint256 tokenId)
        external
        view
        returns (uint64[] memory);

    /**
     * @notice Used to retrieve IDs of the pending assets of given token.
     * @dev Asset data is stored by reference, in order to access the data corresponding to the ID, call
     *  `getAssetMetadata(tokenId, assetId)`.
     * @param tokenId ID of the token to retrieve the IDs of the pending assets
     * @return uint64[] An array of pending asset IDs of the given token
     */
    function getPendingAssets(uint256 tokenId)
        external
        view
        returns (uint64[] memory);

    /**
     * @notice Used to retrieve the priorities of the active assets of a given token.
     * @dev Asset priorities are a non-sequential array of uint16 values with an array size equal to active asset
     *  priorites.
     * @param tokenId ID of the token for which to retrieve the priorities of the active assets
     * @return uint16[] An array of priorities of the active assets of the given token
     */
    function getActiveAssetPriorities(uint256 tokenId)
        external
        view
        returns (uint64[] memory);

    /**
     * @notice Used to retrieve the asset that will be replaced if a given asset from the token&apos;s pending array
     *  is accepted.
     * @dev Asset data is stored by reference, in order to access the data corresponding to the ID, call
     *  `getAssetMetadata(tokenId, assetId)`.
     * @param tokenId ID of the token to check
     * @param newAssetId ID of the pending asset which will be accepted
     * @return uint64 ID of the asset which will be replaced
     */
    function getAssetReplacements(uint256 tokenId, uint64 newAssetId)
        external
        view
        returns (uint64);

    /**
     * @notice Used to fetch the asset metadata of the specified token&apos;s active asset with the given index.
     * @dev Can be overridden to implement enumerate, fallback or other custom logic.
     * @param tokenId ID of the token from which to retrieve the asset metadata
     * @param assetId Asset Id, must be in the active assets array
     * @return string The metadata of the asset belonging to the specified index in the token&apos;s active assets
     *  array
     */
    function getAssetMetadata(uint256 tokenId, uint64 assetId)
        external
        view
        returns (string memory);

    /**
     * @notice Used to grant permission to the user to manage token&apos;s assets.
     * @dev This differs from transfer approvals, as approvals are not cleared when the approved party accepts or
     *  rejects an asset, or sets asset priorities. This approval is cleared on token transfer.
     * @dev Only a single account can be approved at a time, so approving the `0x0` address clears previous approvals.
     * @dev Requirements:
     *
     *  - The caller must own the token or be an approved operator.
     *  - `tokenId` must exist.
     * @dev Emits an {ApprovalForAssets} event.
     * @param to Address of the account to grant the approval to
     * @param tokenId ID of the token for which the approval to manage the assets is granted
     */
    function approveForAssets(address to, uint256 tokenId) external;

    /**
     * @notice Used to retrieve the address of the account approved to manage assets of a given token.
     * @dev Requirements:
     *
     *  - `tokenId` must exist.
     * @param tokenId ID of the token for which to retrieve the approved address
     * @return address Address of the account that is approved to manage the specified token&apos;s assets
     */
    function getApprovedForAssets(uint256 tokenId)
        external
        view
        returns (address);

    /**
     * @notice Used to add or remove an operator of assets for the caller.
     * @dev Operators can call {acceptAsset}, {rejectAsset}, {rejectAllAssets} or {setPriority} for any token
     *  owned by the caller.
     * @dev Requirements:
     *
     *  - The `operator` cannot be the caller.
     * @dev Emits an {ApprovalForAllForAssets} event.
     * @param operator Address of the account to which the operator role is granted or revoked from
     * @param approved The boolean value indicating whether the operator role is being granted (`true`) or revoked
     *  (`false`)
     */
    function setApprovalForAllForAssets(address operator, bool approved)
        external;

    /**
     * @notice Used to check whether the address has been granted the operator role by a given address or not.
     * @dev See {setApprovalForAllForAssets}.
     * @param owner Address of the account that we are checking for whether it has granted the operator role
     * @param operator Address of the account that we are checking whether it has the operator role or not
     * @return bool The boolean value indicating whether the account we are checking has been granted the operator role
     */
    function isApprovedForAllForAssets(address owner, address operator)
        external
        view
        returns (bool);
}
```

The `getAssetMetadata` function returns the asset&apos;s metadata URI. The metadata, to which the metadata URI of the asset points, MAY contain a JSON response with the following fields:

```json
{
  &quot;name&quot;: &quot;Asset Name&quot;,
  &quot;description&quot;: &quot;The description of the token or asset&quot;,
  &quot;mediaUri&quot;: &quot;ipfs://mediaOfTheAssetOrToken&quot;,
  &quot;thumbnailUri&quot;: &quot;ipfs://thumbnailOfTheAssetOrToken&quot;,
  &quot;externalUri&quot;: &quot;https://uriToTheProjectWebsite&quot;,
  &quot;license&quot;: &quot;License name&quot;,
  &quot;licenseUri&quot;: &quot;https://uriToTheLicense&quot;,
  &quot;tags&quot;: [&quot;tags&quot;, &quot;used&quot;, &quot;to&quot;, &quot;help&quot;, &quot;marketplaces&quot;, &quot;categorize&quot;, &quot;the&quot;, &quot;asset&quot;, &quot;or&quot;, &quot;token&quot;],
  &quot;preferThumb&quot;: false, // A boolean flag indicating to UIs to prefer thumbnailUri instead of mediaUri wherever applicable
  &quot;attributes&quot;: [
    {
      &quot;label&quot;: &quot;rarity&quot;,
      &quot;type&quot;: &quot;string&quot;,
      &quot;value&quot;: &quot;epic&quot;,
      // For backward compatibility
      &quot;trait_type&quot;: &quot;rarity&quot;
    },
    {
      &quot;label&quot;: &quot;color&quot;,
      &quot;type&quot;: &quot;string&quot;,
      &quot;value&quot;: &quot;red&quot;,
      // For backward compatibility
      &quot;trait_type&quot;: &quot;color&quot;
    },
    {
      &quot;label&quot;: &quot;height&quot;,
      &quot;type&quot;: &quot;float&quot;,
      &quot;value&quot;: 192.4,
      // For backward compatibility
      &quot;trait_type&quot;: &quot;height&quot;,
      &quot;display_type&quot;: &quot;number&quot;
    }
  ]
}
```

While this is the suggested JSON schema for the asset metadata, it is not enforced and MAY be structured completely differently based on implementer&apos;s preference.

## Rationale

Designing the proposal, we considered the following questions:

1. **Should we use Asset or Resource when referring to the structure that comprises the token?**\
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 *asset* represents it better.\
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.
2. **Why are [EIP-712](./eip-712.md) permit-style signatures to manage approvals not used?**\
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.
3. **Why use indexes?**\
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.\
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.\
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.
4. **Why is a method to get all the assets not included?**\
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.
5. **Why is pagination not included?**\
Asset IDs use `uint64`, 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.
6. **How does this proposal differ from the other proposals trying to address a similar problem?**\
After reviewing them, we concluded that each contains at least one of these limitations:
   - Using a single URI which is replaced as new assets are needed, this introduces a trust issue for the token owner.
   - Focusing only on a type of asset, while this proposal is asset type agnostic.
   - Having a different token for each new use case, this means that the token is not forward-compatible.

### Multi-Asset Storage Schema

Assets are stored within a token as an array of `uint64` identifiers.

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 `uint64` mapping to asset data.

An asset array is an array of these `uint64` asset ID references.

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 *SRC* in the asset and the *token ID*. 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 `tokenId` dependent assets.

Structuring token&apos;s assets in such a way allows for URIs to be derived programmatically through concatenation, especially when they differ only by `tokenId`.

### Propose-Commit pattern for asset addition

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 *&quot;Pending&quot;* array, and MUST be migrated to the *&quot;Active&quot;* array by the token&apos;s owner. The *&quot;Pending&quot;* assets array SHOULD be limited to 128 slots to prevent spam and griefing.

### Asset management

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.

## Backwards Compatibility

The MultiAsset token standard has been made compatible with [ERC-721](./eip-721.md) in order to take advantage of the robust tooling available for implementations of ERC-721 and to ensure compatibility with existing ERC-721 infrastructure.

## Test Cases

Tests are included in [`multiasset.ts`](../assets/eip-5773/test/multiasset.ts).

To run them in terminal, you can use the following commands:

```
cd ../assets/eip-5773
npm install
npx hardhat test
```

## Reference Implementation

See [`MultiAssetToken.sol`](../assets/eip-5773/contracts/MultiAssetToken.sol).

## Security Considerations

The same security considerations as with [ERC-721](./eip-721.md) apply: hidden logic may be present in any of the functions, including burn, add asset, accept asset, and more.

Caution is advised when dealing with non-audited contracts.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 10 Oct 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5773</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5773</guid>
      </item>
    
      <item>
        <title>Physical Backed Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/physical-backed-tokens/11350</comments>
        
        <description>## Abstract

This standard is an extension of [ERC-721](./eip-721.md). It proposes a minimal interface for a [ERC-721](./eip-721.md) NFT to be &quot;physically backed&quot; and owned by whoever owns the NFT&apos;s physical counterpart.

## Motivation

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:

- The ownership of the physical item and the ownership of the NFT are decoupled.

- Verifying the authenticity of the physical item requires action from a trusted 3rd party (e.g. StockX).

## Specification

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.

### Requirements

This approach requires that the physical item must have a chip attached to it that should be secure and signal authenticity:

- The chip can securely generate and store an asymmetric key pair;
- The chip can sign messages using the private key of the previously-generated asymmetric key pair;
- The chip exposes the public key; and
- The private key cannot be extracted or duplicated by design

The approach also requires that the contract uses an account-bound implementation of [ERC-721](./eip-721.md) (where all [ERC-721](./eip-721.md) functions that transfer must throw, e.g. the &quot;read only NFT registry&quot; implementation referenced in [ERC-721](./eip-721.md)). 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.

### Approach

Each NFT is conceptually linked to a physical chip.

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.

The interface includes a function called `transferToken` 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 [ERC-191](./eip-191.md) and [EIP-2](./eip-2.md) (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.

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.

### Interface

```solidity

interface IERC5791 {
    /// @dev Returns the ERC-721 `tokenId` for a given chip address.
    ///      Reverts if `chipId` has not been paired to a `tokenId`.
    ///      For minimalism, this will NOT revert if the `tokenId` does not exist.
    ///      If there is a need to check for token existence, external contracts can
    ///      call `ERC721.ownerOf(uint256 tokenId)` and check if it passes or reverts.
    /// @param chipId The address for the chip embedded in the physical item
    ///               (computed from the chip&apos;s public key).
    function tokenIdFor(address chipId) external view returns (uint256 tokenId);

    /// @dev Returns true if `signature` is signed by the chip assigned to `tokenId`, else false.
    ///      Reverts if `tokenId` has not been paired to a chip.
    ///      For minimalism, this will NOT revert if the `tokenId` does not exist.
    ///      If there is a need to check for token existence, external contracts can
    ///      call `ERC721.ownerOf(uint256 tokenId)` and check if it passes or reverts.
    /// @param tokenId ERC-721 `tokenId`.
    /// @param data      Arbitrary bytes string that is signed by the chip to produce `signature`.
    /// @param signature EIP-191 signature by the chip to check.
    function isChipSignatureForToken(uint256 tokenId, bytes calldata data, bytes calldata signature)
        external
        view
        returns (bool);

    /// @dev Transfers the token into the address.
    ///      Returns the `tokenId` transferred.
    /// @param to                  The recipient. Dynamic to allow easier transfers to vaults.
    /// @param chipId              Chip ID (address) of chip being transferred.
    /// @param chipSignature       EIP-191 signature by the chip to authorize the transfer.
    /// @param signatureTimestamp  Timestamp used in `chipSignature`.
    /// @param useSafeTransferFrom Whether ERC-721&apos;s `safeTransferFrom` should be used,
    ///                            instead of `transferFrom`.
    /// @param extras              Additional data that can be used for additional logic/context
    ///                            when the PBT is transferred.
    function transferToken(
        address to,
        address chipId,
        bytes calldata chipSignature,
        uint256 signatureTimestamp,
        bool useSafeTransferFrom,
        bytes calldata extras
    ) external returns (uint256 tokenId);

    /// @dev Emitted when `chipId` is paired to `tokenId`.
    /// `tokenId` may not necessarily exist during assignment.
    /// Indexers can combine this event with the {ERC721.Transfer} event to
    /// infer which tokens exists and are paired with a chip ID.
    event ChipSet(uint256 indexed tokenId, address indexed chipId);
}

```

To aid recognition that an [ERC-721](./eip-721.md) token implements physical binding via this EIP: upon calling [ERC-165](./eip-165.md)’s `function supportsInterface(bytes4 interfaceID) external view returns (bool)` with `interfaceID=0x4901df9f`, a contract implementing this EIP must return true.

The mint interface is up to the implementation. The minted NFT&apos;s owner should be the owner of the physical chip (this authentication could be implemented using the signature scheme defined for `transferToken`).

## Rationale

This solution&apos;s intent is to be the simplest possible path towards linking physical items to digital NFTs without a centralized authority.

The interface includes a `transferToken` function that&apos;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.

The chip address is included in `transferToken` 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.

### Out of Scope

The following are some peripheral problems that are intentionally not within the scope of this EIP:

- trusting that a specific NFT collection&apos;s chip addresses actually map to physical chips embedded in items, instead of arbitrary EOAs that purport to be chips
- ensuring that the chip does not deteriorate or get damaged
- ensuring that the chip stays attached to the physical item
- etc.

Work is being done on these challenges in parallel.

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 `(tokenId, chipId)` tuple passed into a mint function that&apos;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.

Additionally, it&apos;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&apos;s owner temporarily lending the item to somebody else, since (1) the item&apos;s owner must be involved for this to happen as the one signing with the chip, and (2) the item&apos;s owner can reclaim ownership of the NFT at any time.

## Backwards Compatibility

This proposal is backward compatible with [ERC-721](./eip-721.md) on an API level. As mentioned above, for the token to be physical-backed, the contract must use a account-bound implementation of [ERC-721](./eip-721.md) (all [ERC-721](./eip-721.md) functions that transfer must throw) so that transfers go through the new function introduced here, which requires a chip signature.

## Reference Implementation

The following is a snippet on how to validate a chip signature in a transfer event.

```solidity
import &apos;@openzeppelin/contracts/utils/cryptography/ECDSA.sol&apos;;

/// @dev Transfers the `tokenId` assigned to `chipId` to `to`.
function transferToken(
    address to,
    address chipId,
    bytes memory chipSignature,
    uint256 signatureTimestamp,
    bool useSafeTransfer,
    bytes memory extras
) public virtual returns (uint256 tokenId) {
    tokenId = tokenIdFor(chipId);
    _validateSigAndUpdateNonce(to, chipId, chipSignature, signatureTimestamp, extras);
    if (useSafeTransfer) {
        _safeTransfer(ownerOf(tokenId), to, tokenId, &quot;&quot;);
    } else {
        _transfer(ownerOf(tokenId), to, tokenId);
    }
}

/// @dev Validates the `chipSignature` and update the nonce for the future signature of `chipId`.
function _validateSigAndUpdateNonce(
    address to,
    address chipId,
    bytes memory chipSignature,
    uint256 signatureTimestamp,
    bytes memory extras
) internal virtual {
    bytes32 hash = _getSignatureHash(signatureTimestamp, chipId, to, extras);
    if (!SignatureCheckerLib.isValidSignatureNow(chipId, hash, chipSignature)) {
        revert InvalidSignature();
    }
    chipNonce[chipId] = bytes32(uint256(hash) ^ uint256(blockhash(block.number - 1)));
}

/// @dev Returns the digest to be signed by the `chipId`.
function _getSignatureHash(uint256 signatureTimestamp, address chipId, address to, bytes memory extras)
    internal
    virtual
    returns (bytes32)
{
    if (signatureTimestamp &gt; block.timestamp) revert SignatureTimestampInFuture();
    if (signatureTimestamp + maxDurationWindow &lt; block.timestamp) revert SignatureTimestampTooOld();
    bytes32 hash = keccak256(
        abi.encode(address(this), block.chainid, chipNonce[chipId], to, signatureTimestamp, keccak256(extras))
    );
    return ECDSA.toEthSignedMessageHash(hash);
}

```

## Security Considerations

The [ERC-191](./eip-191.md) signature passed to `transferToken` requires the function caller&apos;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&apos;s recommended to use a non-deterministic `chipNonce` when generating signatures.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 17 Oct 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5791</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5791</guid>
      </item>
    
      <item>
        <title>Voting with delegation</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5805-voting-with-delegation/11407</comments>
        
        <description>## Abstract

Many DAOs (decentralized autonomous organizations) rely on tokens to represent one&apos;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 [ERC-20](./eip-20.md) and [ERC-721](./eip-721.md). 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 `block.number`, `block.timestamp`, or any other non-decreasing function.

## Motivation

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 ([ERC-20](./eip-20.md), [ERC-721](./eip-721.md), other). In this context, the more tokens one owns, the more voting power one has. Governor contracts, such as Compound&apos;s `GovernorBravo`, read from these &quot;voting token&quot; contracts to get the voting power of the users.

Unfortunately, simply using the `balanceOf(address)` function present in most token standards is not good enough:

- The values are not checkpointed, so a user can vote, transfer its tokens to a new account, and vote again with the same tokens.
- A user cannot delegate their voting power to someone else without transferring full ownership of the tokens.

These constraints have led to the emergence of voting tokens with delegation that contain the following logic:

- Users can delegate the voting power of their tokens to themselves or a third party. This creates a distinction between balance and voting weight.
- The voting weights of accounts are checkpointed, allowing lookups for past values at different points in time.
- The balances are not checkpointed.

This ERC is proposing to standardize the interface and behavior of these voting tokens.

Additionally, the existing (non-standardized) implementations are limited to `block.number` 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.

## Specification

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.

Following pre-existing (but not-standardized) implementation, the EIP proposes the following mechanism.

Each user account (address) can delegate to an account of its choice. This can be itself, someone else, or no one (represented by `address(0)`). Assets held by the user cannot express their voting power unless they are delegated.

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&apos;s voting power and added to the new delegate&apos;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.

Whenever tokens are transferred from one account to another, the associated voting power should be deducted from the sender&apos;s delegate and added to the receiver&apos;s delegate.

Tokens that are delegated to `address(0)` should not be tracked. This allows users to optimize the gas cost of their token transfers by skipping the checkpoint update for their delegate.

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.

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.

### Methods

#### [ERC-6372](./eip-6372.md): clock and CLOCK_MODE

Compliant contracts SHOULD implement ERC-6372 (Contract clock) to announce the clock that is used for vote tracking.

If the contract does not implement ERC-6372, it MUST operate according to a block number clock, exactly as if ERC-6372&apos;s `CLOCK_MODE` returned `mode=blocknumber&amp;from=default`.

In the following specification, &quot;the current clock&quot; refers to either the result of ERC-6372&apos;s `clock()`, or the default of `block.number` in its absence.

#### getVotes

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.

As tokens delegated to `address(0)` should not be counted/snapshotted, `getVotes(0)` SHOULD always return `0`.

This function MUST be implemented

```yaml
- name: getVotes
  type: function
  stateMutability: view
  inputs:
    - name: account
      type: address
  outputs:
    - name: votingWeight
      type: uint256
```

#### getPastVotes

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.

- Calling this function with a timepoint that is greater or equal to the current clock SHOULD revert.
- Calling this function with a timepoint strictly smaller than the current clock SHOULD NOT revert.
- For any integer that is strictly smaller than the current clock, the value returned by `getPastVotes` 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.

As tokens delegated to `address(0)` should not be counted/snapshotted, `getPastVotes(0,x)` SHOULD always return `0` (for all values of `x`).

This function MUST be implemented

```yaml
- name: getPastVotes
  type: function
  stateMutability: view
  inputs:
    - name: account
      type: address
    - name: timepoint
      type: uint256
  outputs:
    - name: votingWeight
      type: uint256
```

#### delegates

This function returns the address to which the voting power of an account is currently delegated.

Note that if the delegate is `address(0)` then the voting power SHOULD NOT be checkpointed, and it should not be possible to vote with it.

This function MUST be implemented

```yaml
- name: delegates
  type: function
  stateMutability: view
  inputs:
    - name: account
      type: address
  outputs:
    - name: delegatee
      type: address
```

#### delegate

This function changes the caller&apos;s delegate, updating the vote delegation in the meantime.

This function MUST be implemented

```yaml
- name: delegate
  type: function
  stateMutability: nonpayable
  inputs:
    - name: delegatee
      type: address
  outputs: []
```

#### delegateBySig

This function changes an account&apos;s delegate using a signature, updating the vote delegation in the meantime.

This function MUST be implemented

```yaml
- name: delegateBySig
  type: function
  stateMutability: nonpayable
  inputs:
    - name: delegatee
      type: address
    - name: nonce
      type: uint256
    - name: expiry
      type: uint256
    - name: v
      type: uint8
    - name: r
      type: bytes32
    - name: s
      type: bytes32
  outputs: []
```

This signature should follow the [EIP-712](./eip-712.md) format:

A call to `delegateBySig(delegatee, nonce, expiry, v, r, s)` changes the signer&apos;s delegate to `delegatee`, increment the signer&apos;s nonce by 1, and emits a corresponding `DelegateChanged` event, and possibly `DelegateVotesChanged` events for the old and the new delegate accounts, if and only if the following conditions are met:


- The current timestamp is less than or equal to `expiry`.
- `nonces(signer)` (before the state update) is equal to `nonce`.

If any of these conditions are not met, the `delegateBySig` call must revert. This translates to the following solidity code:

```sol
require(expiry &lt;= block.timestamp)
bytes signer = ecrecover(
  keccak256(abi.encodePacked(
    hex&quot;1901&quot;,
    DOMAIN_SEPARATOR,
    keccak256(abi.encode(
      keccak256(&quot;Delegation(address delegatee,uint256 nonce,uint256 expiry)&quot;),
      delegatee,
      nonce,
      expiry)),
  v, r, s)
require(signer != address(0));
require(nounces[signer] == nonce);
// increment nonce
// set delegation of `signer` to `delegatee`
```

where `DOMAIN_SEPARATOR` is defined according to [EIP-712](./eip-712.md). The `DOMAIN_SEPARATOR` 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 `DOMAIN_SEPARATOR` is:

```solidity
DOMAIN_SEPARATOR = keccak256(
    abi.encode(
        keccak256(&apos;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&apos;),
        keccak256(bytes(name)),
        keccak256(bytes(version)),
        chainid,
        address(this)
));
```

In other words, the message is the EIP-712 typed structure:

```js
{
  &quot;types&quot;: {
    &quot;EIP712Domain&quot;: [
      {
        &quot;name&quot;: &quot;name&quot;,
        &quot;type&quot;: &quot;string&quot;
      },
      {
        &quot;name&quot;: &quot;version&quot;,
        &quot;type&quot;: &quot;string&quot;
      },
      {
        &quot;name&quot;: &quot;chainId&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      },
      {
        &quot;name&quot;: &quot;verifyingContract&quot;,
        &quot;type&quot;: &quot;address&quot;
      }
    ],
    &quot;Delegation&quot;: [{
      &quot;name&quot;: &quot;delegatee&quot;,
      &quot;type&quot;: &quot;address&quot;
      },
      {
        &quot;name&quot;: &quot;nonce&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      },
      {
        &quot;name&quot;: &quot;expiry&quot;,
        &quot;type&quot;: &quot;uint256&quot;
      }
    ],
    &quot;primaryType&quot;: &quot;Permit&quot;,
    &quot;domain&quot;: {
      &quot;name&quot;: contractName,
      &quot;version&quot;: version,
      &quot;chainId&quot;: chainid,
      &quot;verifyingContract&quot;: contractAddress
  },
  &quot;message&quot;: {
    &quot;delegatee&quot;: delegatee,
    &quot;nonce&quot;: nonce,
    &quot;expiry&quot;: expiry
  }
}}
```

Note that nowhere in this definition do we refer to `msg.sender`. The caller of the `delegateBySig` function can be any address.

When this function is successfully executed, the delegator&apos;s nonce MUST be incremented to prevent replay attacks.

#### nonces

This function returns the current nonce for a given account.

Signed delegations (see `delegateBySig`) are only accepted if the nonce used in the EIP-712 signature matches the return of this function. This value of `nonce(delegator)` should be incremented whenever a call to `delegateBySig` is performed on behalf of `delegator`.

This function MUST be implemented

```yaml
- name: nonces
  type: function
  stateMutability: view
  inputs:
    - name: account
      type: delegator
  outputs:
    - name: nonce
      type: uint256
```

### Events

#### DelegateChanged

`delegator` changes the delegation of its assets from `fromDelegate` to `toDelegate`.

MUST be emitted when the delegate for an account is modified by `delegate(address)` or `delegateBySig(address,uint256,uint256,uint8,bytes32,bytes32)`.

```yaml
- name: DelegateChanged
  type: event
  inputs:
    - name: delegator
      indexed: true
      type: address
    - name: fromDelegate
      indexed: true
      type: address
    - name: toDelegate
      indexed: true
      type: address
```

#### DelegateVotesChanged

`delegate` available voting power changes from `previousBalance` to `newBalance`.

This MUST be emitted when:

- an account (that holds more than 0 assets) updates its delegation from or to `delegate`,
- an asset transfer from or to an account that is delegated to `delegate`.

```yaml
- name: DelegateVotesChanged
  type: event
  inputs:
    - name: delegate
      indexed: true
      type: address
    - name: previousBalance
      indexed: false
      type: uint256
    - name: newBalance
      indexed: false
      type: uint256
```

### Solidity interface

```sol
interface IERC5805 is IERC6372 /* (optional) */ {
  event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
  event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);

  function getVotes(address account) external view returns (uint256);
  function getPastVotes(address account, uint256 timepoint) external view returns (uint256);
  function delegates(address account) external view returns (address);
  function nonces(address owner) public view virtual returns (uint256)

  function delegate(address delegatee) external;
  function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
}
```

### Expected properties

Let `clock` be the current clock.

- For all timepoints `t &lt; clock`, `getVotes(address(0))` and `getPastVotes(address(0), t)` SHOULD return 0.
- For all accounts `a != 0`, `getVotes(a)` SHOULD be the sum of the &quot;balances&quot; of all the accounts that delegate to `a`.
- For all accounts `a != 0` and all timestamp `t &lt; clock`, `getPastVotes(a, t)` SHOULD be the sum of the &quot;balances&quot; of all the accounts that delegated to `a` when `clock` overtook `t`.
- For all accounts `a`, `getPastVotes(a, t)` MUST be constant after `t &lt; clock` is reached.
- For all accounts `a`, the action of changing the delegate from `b` to `c` MUST not increase the current voting power of `b` (`getVotes(b)`) and MUST not decrease the current voting power of `c` (`getVotes(c)`).

## Rationale

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.

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/receiver&apos;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, ...).

While timestamps produced by ERC-6372&apos;s `clock` are represented as `uint48`, `getPastVotes`&apos;s timepoint argument is `uint256` for backward compatibility. Any timepoint `&gt;=2**48` passed to `getPastVotes` SHOULD cause the function to revert, as it would be a lookup in the future.

`delegateBySig` is necessary to offer a gasless workflow to token holders that do not want to pay gas for voting.

The `nonces` mapping is given for replay protection.

EIP-712 typed messages are included because of their widespread adoption in many wallet providers.

## Backwards Compatibility

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&apos;s implementation (with return type uint256) as Compound&apos;s implementation causes significant restrictions of the acceptable values (return type is uint96).

Both implementations use `block.number` for their checkpoints and do not implement ERC-6372, which is compatible with this ERC.

Existing governors, that are currently compatible with OpenZeppelin&apos;s implementation will be compatible with the &quot;block number mode&quot; of this ERC.

## Security Considerations

Before doing a lookup, one should check the return value of `clock()` 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.

Though the signer of a `Delegation` may have a certain party in mind to submit their transaction, another party can always front-run this transaction and call `delegateBySig` before the intended party. The result is the same for the `Delegation` signer, however.

Since the ecrecover precompile fails silently and just returns the zero address as `signer` when given malformed messages, it is important to ensure `signer != address(0)` to avoid `delegateBySig` from delegating &quot;zombie funds&quot; belonging to the zero address.

Signed `Delegation` messages are censorable. The relaying party can always choose to not submit the `Delegation` after having received it, withholding the option to submit it. The `expiry` parameter is one mitigation to this. If the signing party holds ETH they can also just submit the `Delegation` themselves, which can render previously signed `Delegation`s invalid.

If the `DOMAIN_SEPARATOR` contains the `chainId` 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 04 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5805</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5805</guid>
      </item>
    
      <item>
        <title>Auto-renewable allowance extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5827-auto-renewable-allowance-extension/10392</comments>
        
        <description>## Abstract

This extension adds a renewable allowance mechanism to [ERC-20](./eip-20.md) allowances, in which a `recoveryRate` defines the amount of token per second that the allowance regains towards the initial maximum approval `amount`.

## Motivation

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).

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&apos; accounts up to the allowance granted, and users may not be aware of the implications of granting allowances.

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.


## Specification

The key words &quot;MUST&quot;, &quot;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.

```solidity
pragma solidity ^0.8.0;

interface IERC5827 /* is ERC20, ERC165 */ {
    /*
     * Note: the ERC-165 identifier for this interface is 0x93cd7af6.
     * 0x93cd7af6 ===
     *   bytes4(keccak256(&apos;approveRenewable(address,uint256,uint256)&apos;)) ^
     *   bytes4(keccak256(&apos;renewableAllowance(address,address)&apos;)) ^
     *   bytes4(keccak256(&apos;approve(address,uint256)&apos;) ^
     *   bytes4(keccak256(&apos;transferFrom(address,address,uint256)&apos;) ^
     *   bytes4(keccak256(&apos;allowance(address,address)&apos;) ^
     */

    /**
     * @notice  Thrown when the available allowance is less than the transfer amount.
     * @param   available       allowance available; 0 if unset
     */
    error InsufficientRenewableAllowance(uint256 available);

    /**
     * @notice  Emitted when any allowance is set.
     * @dev     MUST be emitted even if a non-renewable allowance is set; if so, the
     * @dev     `_recoveryRate` MUST be 0.
     * @param   _owner          owner of token
     * @param   _spender        allowed spender of token
     * @param   _value          initial and maximum allowance granted to spender
     * @param   _recoveryRate   recovery amount per second
     */
    event RenewableApproval(
        address indexed _owner,
        address indexed _spender,
        uint256 _value,
        uint256 _recoveryRate
    );

    /**
     * @notice  Grants an allowance of `_value` to `_spender` initially, which recovers over time 
     * @notice  at a rate of `_recoveryRate` up to a limit of `_value`.
     * @dev     SHOULD cause `allowance(address _owner, address _spender)` to return `_value`, 
     * @dev     SHOULD throw when `_recoveryRate` is larger than `_value`, and MUST emit a 
     * @dev     `RenewableApproval` event.
     * @param   _spender        allowed spender of token
     * @param   _value          initial and maximum allowance granted to spender
     * @param   _recoveryRate   recovery amount per second
     */
    function approveRenewable(
        address _spender,
        uint256 _value,
        uint256 _recoveryRate
    ) external returns (bool success);

    /**
     * @notice  Returns approved max amount and recovery rate of allowance granted to `_spender` 
     * @notice  by `_owner`.
     * @dev     `amount` MUST also be the initial approval amount when a non-renewable allowance 
     * @dev     has been granted, e.g. with `approve(address _spender, uint256 _value)`.
     * @param    _owner         owner of token
     * @param   _spender        allowed spender of token
     * @return  amount initial and maximum allowance granted to spender
     * @return  recoveryRate recovery amount per second
     */
    function renewableAllowance(address _owner, address _spender)
        external
        view
        returns (uint256 amount, uint256 recoveryRate);

    /// Overridden ERC-20 functions

    /**
     * @notice  Grants a (non-increasing) allowance of _value to _spender and clears any existing 
     * @notice  renewable allowance.
     * @dev     MUST clear set `_recoveryRate` to 0 on the corresponding renewable allowance, if 
     * @dev     any.
     * @param   _spender        allowed spender of token
     * @param   _value          allowance granted to spender
     */
    function approve(address _spender, uint256 _value)
        external
        returns (bool success);

    /**
    * @notice   Moves `amount` tokens from `from` to `to` using the caller&apos;s allowance.
    * @dev      When deducting `amount` from the caller&apos;s allowance, the allowance amount used 
    * @dev      SHOULD include the amount recovered since the last transfer, but MUST NOT exceed 
    * @dev      the maximum allowed amount returned by `renewableAllowance(address _owner, address 
    * @dev      _spender)`. 
    * @dev      SHOULD also throw `InsufficientRenewableAllowance` when the allowance is 
    * @dev      insufficient.
    * @param    from            token owner address
    * @param    to              token recipient
    * @param    amount          amount of token to transfer
    */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);

    /**
     * @notice  Returns amount currently spendable by `_spender`.
     * @dev     The amount returned MUST be as of `block.timestamp`, if a renewable allowance 
     * @dev     for the `_owner` and `_spender` is present.
     * @param   _owner         owner of token
     * @param   _spender       allowed spender of token
     * @return  remaining allowance at the current point in time
     */
    function allowance(address _owner, address _spender)
        external
        view
        returns (uint256 remaining);
}
```

Base method `approve(address _spender, uint256 _value)` MUST set `recoveryRate` to 0.

Both `allowance()` and `transferFrom()` MUST be updated to include allowance recovery logic.

`approveRenewable(address _spender, uint256 _value, uint256 _recoveryRate)` MUST set both the initial allowance amount and the maximum allowance limit (to which the allowance can recover) to `_value`.

`supportsInterface(0x93cd7af6)` MUST return `true`.

### Additional interfaces

**Token Proxy**

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.

```solidity
interface IERC5827Proxy /* is IERC5827 */ {

    /*
     * Note: the ERC-165 identifier for this interface is 0xc55dae63.
     * 0xc55dae63 ===
     *   bytes4(keccak256(&apos;baseToken()&apos;)
     */

    /**
     * @notice   Get the underlying base token being proxied.
     * @return   baseToken address of the base token
     */
    function baseToken() external view returns (address);
}
```

The `transfer()` function on the proxy MUST NOT emit the `Transfer` event (as the underlying token already does so).

**Automatic Expiration**

```solidity
interface IERC5827Expirable /* is IERC5827 */ {
    /*
     * Note: the ERC-165 identifier for this interface is 0x46c5b619.
     * 0x46c5b619 ===
     *   bytes4(keccak256(&apos;approveRenewable(address,uint256,uint256,uint64)&apos;)) ^
     *   bytes4(keccak256(&apos;renewableAllowance(address,address)&apos;)) ^
     */

    /**
     * @notice  Grants an allowance of `_value` to `_spender` initially, which recovers over time 
     * @notice  at a rate of `_recoveryRate` up to a limit of `_value` and expires at 
     * @notice  `_expiration`.
     * @dev     SHOULD throw when `_recoveryRate` is larger than `_value`, and MUST emit 
     * @dev     `RenewableApproval` event.
     * @param   _spender        allowed spender of token
     * @param   _value          initial allowance granted to spender
     * @param   _recoveryRate   recovery amount per second
     * @param   _expiration     Unix time (in seconds) at which the allowance expires
     */
    function approveRenewable(
        address _spender,
        uint256 _value,
        uint256 _recoveryRate,
        uint64 _expiration
    ) external returns (bool success);

    /**
     * @notice  Returns approved max amount, recovery rate, and expiration timestamp.
     * @return  amount initial and maximum allowance granted to spender
     * @return  recoveryRate recovery amount per second
     * @return  expiration Unix time (in seconds) at which the allowance expires
     */
    function renewableAllowance(address _owner, address _spender)
        external
        view
        returns (uint256 amount, uint256 recoveryRate, uint64 expiration);
}
```

## Rationale

Renewable allowances can be implemented with discrete resets per time cycle. However, a continuous `recoveryRate` allows for more flexible use cases not bound by reset cycles and can be implemented with simpler logic.

## Backwards Compatibility

Existing ERC-20 token contracts can delegate allowance enforcement to a proxy contract that implements this specification.

## Reference Implementation

An minimal implementation is included [here](../assets/eip-5827/ERC5827.sol)

An audited, open source implemention of this standard as a `IERC5827Proxy` can be found at `https://github.com/suberra/funnel-contracts`

## Security Considerations

This EIP introduces a stricter set of constraints compared to ERC-20 with unlimited allowances. However, when `_recoveryRate` is set to a large value, large amounts can still be transferred over multiple transactions.

Applications that are not [ERC-5827](./eip-5827.md)-aware may erroneously infer that the value returned by `allowance(address _owner, address _spender)` or included in `Approval` events is the maximum amount of tokens that `_spender` can spend from `_owner`. This may not be the case, such as when a renewable allowance is granted to `_spender` by `_owner`.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 22 Oct 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5827</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5827</guid>
      </item>
    
      <item>
        <title>Complex Numbers stored in `bytes32` types</title>
        <category>Standards Track/ERC</category>
        
          <comments>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</comments>
        
        <description>## Abstract

This EIP proposes a natural way for complex numbers to be stored in and retrieved from the `bytes32` 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.

## Motivation

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.

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.  

Packing complex numbers into a single `bytes32` 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 `bytes32` are common and indexing in the 2D complex plane may improve code legibility.  

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.

## Specification

A complex number would be defined as `bytes32` and a cartesian representation would be initialized with the `cnNew` function and converted back with `RealIm`, both given below.

To create the complex number one would use

```solidity
function cnNew(int128 _Real, int128 _Imag) public pure returns (bytes32){
    bytes32 Imag32 = bytes16(uint128(_Imag));
    bytes32 Real32 = bytes16(uint128(_Real));
    return (Real32&gt;&gt; 128) | Imag32;
}
```

and to convert back

```solidity
function RealIm(bytes32 _cn)  public pure returns (int128 Real, int128 Imag){
    bytes16[2] memory tmp = [bytes16(0), 0];
    assembly {
        mstore(tmp, _cn)
        mstore(add(tmp, 16), _cn)
    }
    Imag=int128(uint128(tmp[0]));
    Real=int128(uint128(tmp[1]));
}
```

## Rationale

An EIP is required as this proposal defines a complex numbers storage/type standard for multiple apps to use.

This EIP proposes to package both the real and imaginary within one existing data type, `bytes32`.  This allows compact storage without the need for structures and facilitates easy library implementations.  The `bytes32` would remain available for existing, non-complex number uses.
Only the split and position of the real &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.

Defining real numbers in the 16 least-significant bytes allows direct conversion from `uint128` to `bytes32` for positive integers less than 2**127.  
Direct conversion back from `bytes32` -&gt; `uint` -&gt; `int` are not recommended as the complex number may contain imaginary parts and/or the real part may be negative. It is better to always use `RealIm` for separating the complex part.  

Libraries for complex number manipulation can be implemented with the `Using Complex for bytes32` syntax where `Complex` would be the name of the library.  

## Backwards Compatibility

There is no impact on other uses of the `bytes32` datatype.  

## Security Considerations

If complex numbers are manipulated in `bytes32` form then overflow checks must be performed manually during the manipulation.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 29 Oct 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5850</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5850</guid>
      </item>
    
      <item>
        <title>On-Chain Verifiable Credentials</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5815-kyc-certification-issuer-and-verifier-standard/11513</comments>
        
        <description>## Abstract

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: `age &gt;= 18`), and are certified by issuers using a Soundbound Token (SBT).

## Motivation

On-chain issuance of verifiable attestations are essential for use-case like:

- Avoiding Sybil attacks with one person one vote
- Participation in certain events with credentials
- Compliance to government financial regulations etc.

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.

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.

## Specification

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.

### Definitions

- 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.

- Soulbound Token (SBT): A non-fungible and non-transferrable token that is used for defining the identity of the users.

- SBT Certificate: An SBT that represents the ownership of ID signatures corresponding to the claims defined in `function standardClaim()`.

- 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.

- Claim: An assertion that the DID Holder must fulfill to be verified.

- 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.

- Claimer: The party making a claim, such as in an identity verification process.

- 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.

- Verifier: An entity that validates data provided by an issuer of verifiable credentials, determining its accuracy, origin, currency and trustworthiness.



### Metadata Standard

Claims MUST be exposed in the following structures:

#### 1. Metadata information

Each claim requirement MUST be exposed using the following structure:

```solidity
    /** Metadata
    * 
    * @param title defines the name of the claim field
    * @param _type is the type of the data (bool,string,address,bytes,..)
    * @param description additional information about claim details.
     */
    struct Metadata {
        string title;
        string _type;
        string description;
    }
```

#### 2. Values Information

This following structure will be used to define the actual claim information, based on the description of the `Metadata` structure, the structure is the same as `Values` structure of [EIP-3475](./eip-3475.md).

```solidity
   struct Values{
       string stringValue;
       uint uintValue;
       address addressValue;
       bool boolValue;
  }
```

#### 3. Claim structure

Claims (eg. `age &gt;= 18`, jurisdiction in allowlist, etc.) are represented by one or many instances of the `Claim` structure below:

```solidity
    /** Claims
    * 
    * Claims structure consist of the conditions and value that holder claims to associate and verifier has to validate them.
    * @notice 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.
    * @dev structure that defines the parameters for specific claims of the SBT certificate
    * @notice this structure is used for the verification process, it contains the metadata, logic and expectation
    * @notice 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: 
(&quot;⊄&quot; = U+2284, &quot;⊂&quot; = U+2282,  &quot;&lt;&quot; = U+003C , &quot;&lt;=&quot; = U + 2265,&quot;==&quot; = U + 003D, &quot;!=&quot;U + 2260, &quot;&gt;=&quot; = U + 2265,&quot;&gt;&quot; =  U + 2262).
    */
    struct Claim {
        Metadata metadata;
        string logic;
        Values expectation;
   
    }
```

description of some logic functions that can be used are as follows: 

| Symbol | Description |
|--------|--------------|
| ⊄ | does not belong to the set of values (or range) defined by the corresponding `Values`  |
| ⊂ | condition that the parameter belongs to one of values defined by the `Values`  |
| &lt; | condition that the parameter is greater than  value defined by the `Values`  |
| == | condition that the parameter is strictly equal to the value defined by the `Values` structure |

#### Claim Example

```json
{
   &quot;title&quot;:&quot;age&quot;,
   &quot;type&quot;:&quot;unit&quot;,
   &quot;description&quot;:&quot;age of the person based on the birth date on the legal document&quot;,
   &quot;logic&quot;:&quot;&gt;=&quot;,
   &quot;value&quot;:&quot;18&quot;
}
```

Defines the condition encoded for the index 1 (i.e the holder must be equal or more than 18 years old).

### Interface specification

#### Verifier

```solidity

    /// @notice getter function to validate if the address `claimer` is the holder of the claim defined by the tokenId `SBTID`
    /// @dev it MUST be defining the conditional operator (logic explained below) to allow the application to convert it into code logic 
    /// @dev logic given here MUST be the conditiaonl operator, MUST be one of (&quot;⊄&quot;, &quot;⊂&quot;, &quot;&lt;&quot;, &quot;&lt;=&quot;, &quot;==&quot;, &quot;!=&quot;, &quot;&gt;=&quot;, &quot;&gt;&quot;)
    /// @param claimer is the EOA address that wants to validate the SBT issued to it by the issuer. 
    /// @param SBTID is the Id of the SBT that user is the claimer.
    /// @return true if the assertion is valid, else false
    /**
    example ifVerified(0xfoo, 1) =&gt; true will mean that 0xfoo is the holder of the SBT identity token defined by tokenId of the given collection. 
    */
    function ifVerified(address claimer, uint256 SBTID) external view returns (bool);
```

#### Issuer  

```solidity
  
    /// @notice getter function to fetch the on-chain identification logic for the given identity holder.
    /// @dev it MUST not be defined for address(0). 
    /// @param SBTID is the Id of the SBT that the user is the claimer.
    /// @return the struct array of all the descriptions of condition metadata that is defined by the administrator for the given KYC provider.
    /**
    ex: standardClaim(1) --&gt; {
    { &quot;title&quot;:&quot;age&quot;,
        &quot;type&quot;: &quot;uint&quot;,
        &quot;description&quot;: &quot;age of the person based on the birth date on the legal document&quot;,
        },
       &quot;logic&quot;: &quot;&gt;=&quot;,
    &quot;value&quot;:&quot;18&quot;  
    }
    Defines the condition encoded for the identity index 1, defining the identity condition that holder must be equal or more than 18 years old.
    **/

    function standardClaim(uint256 SBTID) external view returns (Claim[] memory);

    /// @notice function for setting the claim requirement logic (defined by Claims metadata) details for the given identity token defined by SBTID.
    /// @dev it should only be called by the admin address.
    /// @param SBTID is the Id of the SBT-based identity certificate for which the admin wants to define the Claims.
    /// @param `claims` is the struct array of all the descriptions of condition metadata that is defined by the administrator. check metadata section for more information.
    /**
    example: changeStandardClaim(1, { &quot;title&quot;:&quot;age&quot;,
            &quot;type&quot;: &quot;uint&quot;,
            &quot;description&quot;: &quot;age of the person based on the birth date on the legal document&quot;,
            },
        &quot;logic&quot;: &quot;&gt;=&quot;,
        &quot;value&quot;:&quot;18&quot;  
    }); 
    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.
    **/

    function changeStandardClaim(uint256 SBTID, Claim[] memory _claims) external returns (bool);

    /// @notice function which uses the ZKProof protocol to validate the identity based on the given 
    /// @dev it should only be called by the admin address.
    /// @param SBTID is the Id of the SBT-based identity certificate for which admin wants to define the Claims.
    /// @param claimer is the address that needs to be proven as the owner of the SBT defined by the tokenID.
    /**
    example: certify(0xA....., 10) means that admin assigns the DID badge with id 10 to the address defined by the `0xA....` wallet.
    */
    function certify(address claimer, uint256 SBTID) external returns (bool);

    /// @notice function which uses the ZKProof protocol to validate the identity based on the given 
    /// @dev it should only be called by the admin address.
    /// @param SBTID is the Id of the SBT-based identity certificate for which the admin wants to define the Claims.
    /// @param claimer is the address that needs to be proven as the owner of the SBT defined by the tokenID.
    /* eg: revoke(0xfoo,1): means that KYC admin revokes the SBT certificate number 1 for the address &apos;0xfoo&apos;. */
    function revoke(address certifying, uint256 SBTID) external returns (bool);

```

#### Events

```solidity
    /** 
    * standardChanged
    * @notice standardChanged MUST be triggered when claims are changed by the admin. 
    * @dev standardChanged MUST also be triggered for the creation of a new SBTID.
    e.g : emit StandardChanged(1, Claims(Metadata(&apos;age&apos;, &apos;uint&apos;, &apos;age of the person based on the birth date on the legal document&apos; ), &quot;&gt;=&quot;, &quot;18&quot;);
    is emitted when the Claim condition is changed 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.
    */
    event StandardChanged(uint256 SBTID, Claim[] _claims);
    
    /** 
    * certified
    * @notice certified MUST be triggered when the SBT certificate is given to the certifying address. 
    * 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.
    */
    event Certified(address claimer, uint256 SBTID);
    
    /** 
    * revoked
    * @notice revoked MUST be triggered when the SBT certificate is revoked. 
    * eg: Revoked( 0xfoo,1); means that entity user 0xfoo has been revoked to all the function access defined by the SBT ID 1.
    */
    event Revoked(address claimer, uint256 SBTID);
}
```

## Rationale

TBD

## Backwards Compatibility

- This EIP is backward compliant for the contracts that keep intact the metadata structure of previous issued SBT&apos;s with their ID and claim requirement details.
  - 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.

## Test Cases

Test cases for the minimal reference implementation can be found [here](../assets/eip-5851/contracts/test.sol) for using transaction verification regarding whether the users hold the tokens or not. Use Remix IDE to compile and test the contracts.

## Reference Implementation

The [interface](../assets/eip-5851/contracts/interfaces/IERC5851.sol) is divided into two separate implementations:

- [EIP-5851 Verifier](../assets/eip-5851/contracts/ERC5851Verifier.sol) 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.

- [EIP-5851 Issuer](../assets/eip-5851/contracts/ERC5851Issuer.sol) 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.

## Security Considerations

1. Implementation of functional interfaces for creating KYC on SBT (i.e `changeStandardClaim()`, `certify()` and `revoke()`) 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 18 Oct 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5851</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5851</guid>
      </item>
    
      <item>
        <title>Token Transfer by Social Recovery</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5806-delegate-transaction/11409</comments>
        
        <description>## Abstract

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/No decision) and a threshold is reached, a token is transferred from an old to a new identity.

## Motivation

It is a known problem that the private key of an account can be lost. If that key is lost it&apos;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.


## Specification

```solidity

pragma solidity ^0.8.7;

interface ISocialRecovery {
    /// @dev Related but independent identity approves the transfer
    function approveTransfer(address from_, address to_) external;

    /// @dev User wants to move their onchain identity to another wallet which needs to be approved by n-nearest neighbour identities
    function requestTransfer(address from_, address to_) external payable;

    function addNeighbour(address neighbour_) external;

    function removeNeighbour(address neighbour_) external;
}
```

**The math behind it**:

A compliant contract SHOULD calculate the score of a node n with the following formula:

$$ score(n) = tanh({ { {\displaystyle\sum_{i = 1}^{|N|} } {log{(n_i^{r} {1 \over t - n_i^{t} + 1})}} \over{|N| + 1}} + n^{r}}) $$

where:

$t$ is the current time (can be any time-identifying value such as `block.timestamp`, `block.number`, etc.)

$n^{r}$ is the reward count of the node n

$N$ is the list of neighbours of n

$n_i^{r}$ is the reward count of neighbour node i from n

$n_i^{t}$ is the last timestamp (where a reward was booked on that account) of neighbour node i from n


**Flows**:

```mermaid
%% Approval of asset movement
 sequenceDiagram
  AnyWallet-&gt;SmartContract: Requests transfer
  SmartContract-&gt;All neighbours: Centralized notification via Websocket, EPNS, etc.
  Neighbour-&gt;SmartContract: Approve Transfer
  alt Threshold amount of approvers reached
  alt Cumulative Score of approvers above threshold
  SmartContract-&gt;NewAssetOwner: Transfer asset (e.g. identity token)
  end
  end
  SmartContract-&gt;Neighbour: Add Reward to approver
```


## Rationale

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. 


## Security Considerations


1) 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.

2) 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.

3) 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/she wants to perform. Hence the contract lives from its usage and if it tends to be not used anymore it will get useless.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 19 Jul 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5883</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5883</guid>
      </item>
    
      <item>
        <title>Smart Contract Event Hooks</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/idea-smart-contract-event-hooks-standard/11503</comments>
        
        <description>## Abstract

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.

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.

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&apos;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.

## Motivation

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.

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.

Examples of use cases that would benefit from this scheme include:

### Collateralised Lending Protocols

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.

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.

### Automated Market Makers

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.

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/sell tokens once an asset&apos;s spot price breaches a pre-specified threshold.

### DAO Voting

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.

### Scheduled Function Calls

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.

### Recurring Payments

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&apos;s contract to transfer funds due.

### Coordination via Delegation

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Registering a Publisher

Both the publisher and subscriber contracts **MUST** register in a specific register contract, similarly to how smart contracts register an interface in the [ERC-1820](./eip-1820.md) contract.  The registry contract **MUST** must use a deterministic deployment mechanism, i.e. using a factory contract and a specific salt.

To register a publisher contract&apos;s hook, the `registerHook` function **MUST** be called on the registry contract.  The parameters that need to be supplied are:

 - (address) The publisher contract address
 - (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)
 - (bytes) The public key associated with the hook events (optional)

When the `registerHook` function is called on the registry contract, the registry contract **MUST** make a downstream call to the publisher contract address, by calling the publisher contract&apos;s `verifyEventHookRegistration` function, with the same arguments as passed to the `registerHook` function on the registry contract.  The `verifyEventHookRegistration` function in the publisher contract **MUST** return true in order to indicate that the contract will allow itself to be added to the registry as a publisher.  The registry contract **MUST** emit a `HookRegistered` event to indicate that a new publisher contract has been added.

### Updating a Hook

Publishers may want to update the details associated with a Hook event, or indeed remove support for a Hook event completely.  The registry contract **MUST** implement the `updatePublisher` function to allow for an existing publisher contract to be updated in the registry.  The registry contract **MUST** emit a `PublisherUpdated` event to indicate that the publisher contract was updated.

### Removing a Hook

To remove a previously registered Hook, the function `removeHook` function must be called on the Registry contract, with the same parameters as the `updateHook` function. The registry contract **MUST** emit a `HookRemoved` event with the same parameters as passed to the &apos;removeHook&apos; function and the `msg.sender` value.

### Registering a Subscriber

To register a subscriber to a hook, the `registerSubscriber` function **MUST** be called on the registry contract with the following parameters:

 - (address) The publisher contract address
 - (bytes32) The subscriber contract address
 - (uint256) The thread id to subscribe to
 - (uint256) The fee that the subscriber is willing to pay to get updates
 - (uint256) The maximum gas that the subscriber will allow for updates, to prevent griefing attacks, or 0 to indicate no maximum
 - (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
 - (uint256) The chain id that the subscriber wants updates from
 - (address) The address of the token that the fee will be paid in or 0x0 for the chain&apos;s native asset (e.g. ETH, MATIC etc.)

The subscriber contract **MAY** implement gas refunds on top of the fixed fee per update. Where a subscriber chooses to do this, then they **SHOULD** specify the `maximum gas` and `maximum gas price` parameters in order to protect themselves from griefing attacks. This is so that a malicious or careless relay doesn&apos;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.

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.

### Updating a Subscription

To update a subscription, the `updateSubscriber` function **MUST** be called with the same set of parameters as the `registerSubscriber` function.  This might be done in order to cancel a subscription, or to change the subscription fee. Note that the `updateSubscriber` function **MUST** maintain the same `msg.sender` that the `registerSubscriber` function was called with.

### Removing a Subscription

To remove a previously registered subscription, the function `removeSubscriber` **MUST** be called on the Registry contract, with the same parameters as the `updateSubscriber` function, but without the `fee` 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 **MUST** emit a `SubscriptionRemoved` event with publisher contract address, subscriber contract address and the thread id as topics.

### Publishing an Event

A publisher contract **SHOULD** emit a hook event from at least one function. The emitted event **MUST** be called `Hook` and **MUST** contain the following parameters:

 - uint256 (indexed) - threadId
 - uint256 (indexed) - nonce
 - bytes32 digest
 - bytes payload
 - bytes32 checksum

The `nonce` value **MUST** be incremented every time a Hook event is fired by a publisher contract.  Every Hook event **MUST** have a unique `nonce` value.  The `nonce` property is initiated to 1, but the first Hook event ever fired **MUST** be set to 2.  This is to prevent ambiguity between an uninitiated nonce variable and a nonce variable that is explicitly initiated to zero.

The `digest` parameter of the event **MUST** be the keccak256 hash of the payload, and the `checksum` **MUST** be the keccak256 hash of the concatenation of the digest with the current blockheight, e.g.:

`bytes32 checksum = keccak256(abi.encodePacked(digest, block.number));`

The `Hook` 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 **SHOULD** call the `verifyEventHook` function on the publisher contract to verify that the received Hook payload is valid.

The payload **MAY** 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 **MUST** sign a hash of the payload, and it is strongly recommended to use the [EIP-712](./eip-712.md) standard, and to follow the data structure outlined at the end of this proposal.  This signature **SHOULD** be verified by the subscribers to ensure they are getting authentic events. The signature **MUST** correspond to the public key that was registered with the event.  With this approach, the signature **SHOULD** 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 `verifyHookEvent` of the publisher contract on another chain.

The payload **MUST** be passed to subscribers as a byte array in calldata.  The subscriber smart contract **SHOULD** 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.:

```
struct SnarkProof {
    uint256[2] a;
    uint256[2][2] b;
    uint256[2] c;
    uint256[1] input;
}

SnarkProof memory zkproof = abi.decode(payload, SnarkProof);
```

### Relayers

Relayers are independent parties that listen to `Hook` 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&apos;s payload to the subscriber contracts by broadcasting a transaction that executes the subscriber contract&apos;s `verifyHook` function.  Relayers are incentivised to do this because it is expected that the subscriber contract will remunerate them with ETH, or some other asset.

Relayers **SHOULD** 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 **MAY** 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.

### Verifying a Hook Event

The `verifyHook` function of the subscriber contracts **SHOULD** include logic to ensure that they are retrieving authentic events. In the case where the Hook event contains a signature, then subscriber contracts **SHOULD** create a hash of the required parameters, and **SHOULD** verify that the signature in the hook event is valid against the derived hash and the publisher&apos;s public key (see the reference implemenetation for an example).  The hook function **SHOULD** also verify the nonce of the hook event and record it internally, in order to prevent replay attacks.

For Hook events without signatures, the subscriber contract **SHOULD** call the `verifyHookEvent` on the publisher contract in order to verify that the hook event is valid.  The publisher smart contract **MUST** implement the `verifyHookEvent`, 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&apos;s authenticity.

### Interfaces

IRegistry.sol

```js
/// @title IRegistry
/// @dev Implements the registry contract
interface IRegistry {
    /// @dev Registers a new hook event by a publisher
    /// @param publisherContract The address of the publisher contract
    /// @param threadId The id of the thread these hook events will be fired on
    /// @param signingKey The public key that corresponds to the signature of externally generated payloads (optional)
    /// @return Returns true if the hook is successfully registered
    function registerHook(
        address publisherContract,
        uint256 threadId,
        bytes calldata signingKey
    ) external returns (bool);

    /// @dev Verifies a hook with the publisher smart contract before adding it to the registry
    /// @param publisherAddress The address of the publisher contract
    /// @param threadId The id of the thread these hook events will be fired on
    /// @param signingKey The public key used to verify the hook signatures
    /// @return Returns true if the hook is successfully verified
    function verifyHook(
        address publisherAddress,
        uint256 threadId,
        bytes calldata signingKey
    ) external returns (bool);

    /// @dev Update a previously registered hook event
    /// @dev Can be used to transfer hook authorization to a new address
    /// @dev To remove a hook, transfer it to the burn address
    /// @param publisherContract The address of the publisher contract
    /// @param threadId The id of the thread these hook events will be fired on
    /// @param signingKey The public key used to verify the hook signatures
    /// @return Returns true if the hook is successfully updated
    function updateHook(
        address publisherContract,
        uint256 threadId,
        bytes calldata signingKey
    ) external returns (bool);

    /// @dev Remove a previously registered hook event
    /// @param publisherContract The address of the publisher contract
    /// @param threadId The id of the thread these hook events will be fired on
    /// @param signingKey The public key used to verify the hook signatures
    /// @return Returns true if the hook is successfully updated
    function removeHook(
        address publisherContract,
        uint256 threadId,
        bytes calldata signingKey
    ) external returns (bool);

    /// @dev Registers a subscriber to a hook event
    /// @param publisherContract The address of the publisher contract
    /// @param subscriberContract The address of the contract subscribing to the event hooks
    /// @param threadId The id of the thread these hook events will be fired on
    /// @param fee The fee that the subscriber contract will pay the relayer
    /// @param maxGas The maximum gas that the subscriber allow to spend, to prevent griefing attacks
    /// @param maxGasPrice The maximum gas price that the subscriber is willing to rebate
    /// @param chainId The chain id that the subscriber wants updates on
    /// @param feeToken The address of the token that the fee will be paid in or 0x0 for the chain&apos;s native asset (e.g. ETH)
    /// @return Returns true if the subscriber is successfully registered
    function registerSubscriber(
        address publisherContract,
        address subscriberContract,
        uint256 threadId,
        uint256 fee,
        uint256 maxGas,
        uint256 maxGasPrice,
        uint256 chainId,
        address feeToken
    ) external returns (bool);

    /// @dev Registers a subscriber to a hook event
    /// @param publisherContract The address of the publisher contract
    /// @param subscriberContract The address of the contract subscribing to the event hooks
    /// @param threadId The id of the thread these hook events will be fired on
    /// @param fee The fee that the subscriber contract will pay the relayer
    /// @return Returns true if the subscriber is successfully updated
    function updateSubscriber(
        address publisherContract,
        address subscriberContract,
        uint256 threadId,
        uint256 fee
    ) external returns (bool);

    /// @dev Removes a subscription to a hook event
    /// @param publisherContract The address of the publisher contract
    /// @param subscriberContract The address of the contract subscribing to the event hooks
    /// @param threadId The id of the thread these hook events will be fired on
    /// @return Returns true if the subscriber is subscription removed
    function removeSubscription(
        address publisherContract,
        address subscriberContract,
        uint256 threadId
    ) external returns (bool);
}
```

IPublisher.sol

```js
/// @title IPublisher
/// @dev Implements a publisher contract
interface IPublisher {
    /// @dev Example of a function that fires a hook event when it is called
    /// @param payload The actual payload of the hook event
    /// @param digest Hash of the hook event payload that was signed
    /// @param threadId The thread number to fire the hook event on
    function fireHook(
        bytes calldata payload,
        bytes32 digest,
        uint256 threadId
    ) external;

    /// @dev Adds / updates a new hook event internally
    /// @param threadId The thread id of the hook
    /// @param signingKey The public key associated with the private key that signs the hook events
    function addHook(uint256 threadId, bytes calldata signingKey) external;

    /// @dev Called by the registry contract when registering a hook, used to verify the hook is valid before adding
    /// @param threadId The thread id of the hook
    /// @param signingKey The public key associated with the private key that signs the hook events
    /// @return Returns true if the hook is valid and is ok to add to the registry
    function verifyEventHookRegistration(
        uint256 threadId,
        bytes calldata signingKey
    ) external view returns (bool);

    /// @dev Returns true if the specified hook is valid
    /// @param payloadhash The hash of the hook&apos;s data payload
    /// @param threadId The thread id of the hook
    /// @param nonce The nonce of the current thread
    /// @param blockheight The blockheight that the hook was fired at
    /// @return Returns true if the specified hook is valid
    function verifyEventHook(
        bytes32 payloadhash,
        uint256 threadId,
        uint256 nonce,
        uint256 blockheight
    ) external view returns (bool);
}
```

ISubscriber.sol

```js
/// @title ISubscriber
/// @dev Implements a subscriber contract
interface ISubscriber {
    /// @dev Example of a function that is called when a hook is fired by a publisher
    /// @param publisher The address of the publisher contract in order to verify hook event with
    /// @param payload Hash of the hook event payload that was signed
    /// @param threadId The id of the thread this hook was fired on
    /// @param nonce Unique nonce of this hook
    /// @param blockheight The block height at which the hook event was fired
    function verifyHook(
        address publisher,
        bytes calldata payload,
        uint256 threadId,
        uint256 nonce,
        uint256 blockheight
    ) external;
}

```

## Rationale

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.

This improves on the existing solutions to achieve a pub/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 / 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.

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.

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 `verifyHook` function on each subscriber contract, which will incur potentially significant gas costs for the publisher contract.

## Security Considerations

### Griefing Attacks

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.

### Front-running Attacks

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&apos;s transaction in the mempool before it actually executes in the publisher&apos;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 `verifyEventHook` function on the publisher contract when they receive a Hook event.

Another risk from front-running affects relayers, whereby the relayer&apos;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.

### Relayer Competition

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&apos;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.

### Optimal Fees

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.

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.

### Without an Auction

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).

Another approach would be to implement a logical condition that checks the gas price of the transaction that is calling the `verifyHook` 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&apos;s `verifyHook` function, and to check that the condition `minFee &gt;= fee - (gasPrice * gasUsed)` is true.  This will mitigate against competitive bidding that would drive the _effective_ 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 `fee - minFee + ε` where `ε ~= 1 gwei`.  This will require careful estimation of the gas cost of the `verifyHook` function and an awareness that the gas used may change over time as the contract&apos;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.

### Relayer Transaction Batching

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&apos;s batch is included in the same block in front of relayer B&apos;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&apos;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.

### Replay Attacks

When using signature verification, it is advised to use the [EIP-712](./eip-712.md) 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.

For this reason, it is recommended to use [ERC-721](./eip-712.md) Typed Data Signatures.  In this case the process that initiates the hook should create the signature according to the following data structure:

```js
const domain = [
  { name: &quot;name&quot;, type: &quot;string&quot;  },
  { name: &quot;version&quot;, type: &quot;string&quot; },
  { name: &quot;chainId&quot;, type: &quot;uint256&quot; },
  { name: &quot;verifyingContract&quot;, type: &quot;address&quot; },
  { name: &quot;salt&quot;, type: &quot;bytes32&quot; }
]
 
const hook = [
  { name: &quot;payload&quot;, type: &quot;string&quot; },
  { type: &quot;uint256&quot;, name: &quot;nonce&quot; },
  { type: &quot;uint256&quot;, name: &quot;blockheight&quot; },
  { type: &quot;uint256&quot;, name: &quot;threadId&quot; },
]
 
const domainData = {
  name: &quot;Name of Publisher Dapp&quot;,
  version: &quot;1&quot;,
  chainId: parseInt(web3.version.network, 10),
  verifyingContract: &quot;0x123456789abcedf....publisher contract address&quot;,
  salt: &quot;0x123456789abcedf....random hash unique to publisher contract&quot;
}
 
const message = {
  payload: &quot;bytes array serialized payload&quot;
  nonce: 1,
  blockheight: 999999,
  threadId: 1,
}
 
const eip712TypedData = {
  types: {
    EIP712Domain: domain,
    Hook: hook
  },
  domain: domainData,
  primaryType: &quot;Hook&quot;,
  message: message
}
```

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.

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&apos;s state.  If the hook nonce is not valid, or has already been recorded, the transaction should revert.

### Cross-chain Messaging

There is also the possibility to leverage the `chainId` 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 `chainId` to the chain it wants to receive hook events from.

## Copyright

Copyright and related rights waived via CC0.
</description>
        <pubDate>Wed, 09 Nov 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5902</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5902</guid>
      </item>
    
      <item>
        <title>Role-based Access Control</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-5982-role-based-access-control/11759</comments>
        
        <description>## Abstract

This EIP defines an interface for role-based access control for smart contracts. Roles are defined as `byte32`. The interface specifies how to read, grant, create, and destroy roles. It specifies the meaning of role power in terms of the ability to call a given method
identified by a `bytes4` method selector. It also specifies how metadata of roles are represented.

## Motivation

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.

## Specification

The key words &quot;MUST&quot;, &quot;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 reference interfaces are described as follows:

```solidity
interface IERC_ACL_CORE {
    function hasRole(bytes32 role, address account) external view returns (bool);
    function grantRole(bytes32 role, address account) external;
    function revokeRole(bytes32 role, address account) external;
}
```

```solidity
interface IERC_ACL_GENERAL {
    event RoleGranted(address indexed grantor, bytes32 indexed role, address indexed grantee, bytes _data);
    event RoleRevoked(address indexed revoker, bytes32 indexed role, address indexed revokee, bytes _data);

    event RoleCreated(address indexed roleGrantor, bytes32 role, bytes32 adminOfRole, string name, string desc, string uri, bytes32 calldata _data);
    event RoleDestroyed(address indexed roleDestroyer, bytes32 role, bytes32 calldata _data);
    event RolePowerSet(address indexed rolePowerSetter, bytes32 role, bytes4 methods, bytes calldata _data);

    function grantRole(bytes32 role, address account, bytes calldata _data) external;
    function revokeRole(bytes32 role, address account, bytes calldata _data) external;

    function createRole(bytes32 role, bytes32 adminOfRole, string name, string desc, string uri, bytes32 calldata _data) external;
    function destroyRole(bytes32 role, bytes32 calldata _data) external;
    function setRolePower(bytes32 role, bytes4 methods, bytes calldata _data) view external returns(bool);

    function hasRole(bytes32 role, address account, bytes calldata _data) external view returns (bool);
    function canGrantRole(bytes32 grantor, bytes32 grantee, bytes calldata _data) view external returns(bool);
    function canRevokeRole(bytes32 revoker, bytes32 revokee, address account, bytes calldata _data) view external returns(bool);
    function canExecute(bytes32 executor, bytes4 methods, bytes32 calldata payload, bytes calldata _data) view external returns(bool);
}
```

```solidity
interface IERC_ACL_METADATA {
    function roleName(bytes32) external view returns(string);
    function roleDescription(bytes32) external view returns(string);
    function roleURI(bytes32) external view returns(string);
}
```

1. Compliant contracts MUST implement `IERC_ACL_CORE`
2. It is RECOMMENDED for compliant contracts to implement the optional extension `IERC_ACL_GENERAL`.
3. Compliant contracts MAY implement the optional extension `IERC_ACL_METADATA`.
4. A role in a compliant smart contract is represented in the format of `bytes32`. It is RECOMMENDED that the value of such a role be computed as a
`keccak256` hash of the role name, in this format: `bytes32 role = keccak256(&quot;&lt;role_name&gt;&quot;)`, such as `bytes32 role = keccak256(&quot;MINTER&quot;)`.
5. Compliant contracts SHOULD implement [ERC-165](./eip-165.md) identifier.

## Rationale

1. The names and parameters of methods in `IERC_ACL_CORE` are chosen to allow backward compatibility with OpenZeppelin&apos;s implementation.
2. The methods in `IERC_ACL_GENERAL` conform to [ERC-5750](./eip-5750.md) to allow extension.
3. The `renounceRole` method was not adopted, and was consolidated into `revokeRole` to simplify the interface.


## Backwards Compatibility

Needs discussion.

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 15 Nov 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-5982</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-5982</guid>
      </item>
    
      <item>
        <title>ERC-721 Balance indexing via Transfer event</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-xxx-require-erc721-to-always-emit-transfer/11894</comments>
        
        <description>## Abstract

This EIP extends [ERC-721](./eip-721.md) to allow the tracking and indexing of NFTs by mandating that a pre-existing event be emitted during contract creation.

ERC-721 requires a `Transfer` event to be emitted whenever a transfer or mint (i.e. transfer from `0x0`) or burn (i.e. transfer to `0x0`) occurs, **except during contract creation**. This EIP mandates that compliant contracts emit a `Transfer` event **regardless of whether it occurs during or after contract creation.**

## Motivation

[ERC-721](./eip-721.md) requires a `Transfer` event to be emitted whenever a transfer or mint (i.e. transfer from `0x0`) or burn (i.e. transfer to `0x0`) 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 [ERC-1155](./eip-1155.md) 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.

This EIP removes this exception granted by ERC-721 and mandates emitting the `Transfer` event 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&apos;s `Transfer` event log.

## Specification

The key words &quot;MUST&quot;, &quot;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.

1. Compliant contracts MUST implement [ERC-721](./eip-721.md)
2. Compliant contracts MUST emit a `Transfer` event whenever a token is transferred, minted (i.e. transferred from `0x0`), or burned (i.e. transferred to `0x0`), **including during contract creation.**

## Rationale

Using the existing `Transfer` event instead of creating a new event (e.g. `Creation`) allows this EIP to be backward compatible with existing indexers.

## Backwards Compatibility

All contracts compliant with this EIP are compliant with ERC-721. However, not all contracts compliant with ERC-721 are compliant with this EIP.

## Security Considerations

No new security concerns.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 26 Nov 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6047</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6047</guid>
      </item>
    
      <item>
        <title>Parent-Governed Nestable Non-Fungible Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6059-parent-governed-nestable-non-fungible-tokens/11914</comments>
        
        <description>## Abstract

The Parent-Governed Nestable NFT standard extends [ERC-721](./eip-721.md) by allowing for a new inter-NFT relationship and interaction.

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.

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.

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&apos;s owner, but can be proposed by anyone.

![Nestable tokens](../assets/eip-6059/img/eip-6059-nestable-tokens.png)

The graph illustrates how a child token can also be a parent token, but both are still administered by the root parent token&apos;s owner.

## Motivation

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.

In the four years since [ERC-721](./eip-721.md) was published, the need for additional functionality has resulted in countless extensions. This ERC improves upon ERC-721 in the following areas:

- [Bundling](#bundling)
- [Collecting](#collecting)
- [Membership](#membership)
- [Delegation](#delegation)

### Bundling

One of the most frequent uses of [ERC-721](./eip-721.md) 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.

### Collecting

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&apos;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.

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.

### Membership

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.

### Delegation

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.

## Specification

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.

```solidity
/// @title EIP-6059 Parent-Governed Nestable Non-Fungible Tokens
/// @dev See https://eips.ethereum.org/EIPS/eip-6059
/// @dev Note: the ERC-165 identifier for this interface is 0x42b0e56f.

pragma solidity ^0.8.16;

interface IERC6059 /* is ERC165 */ {
    /**
     * @notice The core struct of ownership.
     * @dev The `DirectOwner` struct is used to store information of the next immediate owner, be it the parent token,
     * an `ERC721Receiver` contract or an externally owned account.
     * @dev If the token is not owned by an NFT, the `tokenId` MUST equal `0`.
     * @param tokenId ID of the parent token
     * @param ownerAddress Address of the owner of the token. If the owner is another token, then the address MUST be
     *  the one of the parent token&apos;s collection smart contract. If the owner is externally owned account, the address
     *  MUST be the address of this account
     */
    struct DirectOwner {
        uint256 tokenId;
        address ownerAddress;
    }

    /**
     * @notice Used to notify listeners that the token is being transferred.
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     * @param from Address of the previous immediate owner, which is a smart contract if the token was nested.
     * @param to Address of the new immediate owner, which is a smart contract if the token is being nested.
     * @param fromTokenId ID of the previous parent token. If the token was not nested before, the value MUST be `0`
     * @param toTokenId ID of the new parent token. If the token is not being nested, the value MUST be `0`
     * @param tokenId ID of the token being transferred
     */
    event NestTransfer(
        address indexed from,
        address indexed to,
        uint256 fromTokenId,
        uint256 toTokenId,
        uint256 indexed tokenId
    );

    /**
     * @notice Used to notify listeners that a new token has been added to a given token&apos;s pending children array.
     * @dev Emitted when a child NFT is added to a token&apos;s pending array.
     * @param tokenId ID of the token that received a new pending child token
     * @param childIndex Index of the proposed child token in the parent token&apos;s pending children array
     * @param childAddress Address of the proposed child token&apos;s collection smart contract
     * @param childId ID of the child token in the child token&apos;s collection smart contract
     */
    event ChildProposed(
        uint256 indexed tokenId,
        uint256 childIndex,
        address indexed childAddress,
        uint256 indexed childId
    );

    /**
     * @notice Used to notify listeners that a new child token was accepted by the parent token.
     * @dev Emitted when a parent token accepts a token from its pending array, migrating it to the active array.
     * @param tokenId ID of the token that accepted a new child token
     * @param childIndex Index of the newly accepted child token in the parent token&apos;s active children array
     * @param childAddress Address of the child token&apos;s collection smart contract
     * @param childId ID of the child token in the child token&apos;s collection smart contract
     */
    event ChildAccepted(
        uint256 indexed tokenId,
        uint256 childIndex,
        address indexed childAddress,
        uint256 indexed childId
    );

    /**
     * @notice Used to notify listeners that all pending child tokens of a given token have been rejected.
     * @dev Emitted when a token removes all a child tokens from its pending array.
     * @param tokenId ID of the token that rejected all of the pending children
     */
    event AllChildrenRejected(uint256 indexed tokenId);

    /**
     * @notice Used to notify listeners a child token has been transferred from parent token.
     * @dev Emitted when a token transfers a child from itself, transferring ownership.
     * @param tokenId ID of the token that transferred a child token
     * @param childIndex Index of a child in the array from which it is being transferred
     * @param childAddress Address of the child token&apos;s collection smart contract
     * @param childId ID of the child token in the child token&apos;s collection smart contract
     * @param fromPending A boolean value signifying whether the token was in the pending child tokens array (`true`) or
     *  in the active child tokens array (`false`)
     */
    event ChildTransferred(
        uint256 indexed tokenId,
        uint256 childIndex,
        address indexed childAddress,
        uint256 indexed childId,
        bool fromPending
    );

    /**
     * @notice The core child token struct, holding the information about the child tokens.
     * @return tokenId ID of the child token in the child token&apos;s collection smart contract
     * @return contractAddress Address of the child token&apos;s smart contract
     */
    struct Child {
        uint256 tokenId;
        address contractAddress;
    }

    /**
     * @notice Used to retrieve the *root* owner of a given token.
     * @dev The *root* owner of the token is the top-level owner in the hierarchy which is not an NFT.
     * @dev If the token is owned by another NFT, it MUST recursively look up the parent&apos;s root owner.
     * @param tokenId ID of the token for which the *root* owner has been retrieved
     * @return owner The *root* owner of the token
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @notice Used to retrieve the immediate owner of the given token.
     * @dev If the immediate owner is another token, the address returned, MUST be the one of the parent token&apos;s
     *  collection smart contract.
     * @param tokenId ID of the token for which the direct owner is being retrieved
     * @return address Address of the given token&apos;s owner
     * @return uint256 The ID of the parent token. MUST be `0` if the owner is not an NFT
     * @return bool The boolean value signifying whether the owner is an NFT or not
     */
    function directOwnerOf(uint256 tokenId)
        external
        view
        returns (
            address,
            uint256,
            bool
        );

    /**
     * @notice Used to burn a given token.
     * @dev When a token is burned, all of its child tokens are recursively burned as well.
     * @dev When specifying the maximum recursive burns, the execution MUST be reverted if there are more children to be
     *  burned.
     * @dev Setting the `maxRecursiveBurn` value to 0 SHOULD only attempt to burn the specified token and MUST revert if
     *  there are any child tokens present.
     * @param tokenId ID of the token to burn
     * @param maxRecursiveBurns Maximum number of tokens to recursively burn
     * @return uint256 Number of recursively burned children
     */
    function burn(uint256 tokenId, uint256 maxRecursiveBurns)
        external
        returns (uint256);

    /**
     * @notice Used to add a child token to a given parent token.
     * @dev This adds the child token into the given parent token&apos;s pending child tokens array.
     * @dev The destination token MUST NOT be a child token of the token being transferred or one of its downstream
     *  child tokens.
     * @dev This method MUST NOT be called directly. It MUST only be called from an instance of `IERC6059` as part of a 
        `nestTransfer` or `transferChild` to an NFT.
     * @dev Requirements:
     *
     *  - `directOwnerOf` on the child contract MUST resolve to the called contract.
     *  - the pending array of the parent contract MUST not be full.
     * @param parentId ID of the parent token to receive the new child token
     * @param childId ID of the new proposed child token
     */
    function addChild(uint256 parentId, uint256 childId) external;

    /**
     * @notice Used to accept a pending child token for a given parent token.
     * @dev This moves the child token from parent token&apos;s pending child tokens array into the active child tokens
     *  array.
     * @param parentId ID of the parent token for which the child token is being accepted
     * @param childIndex Index of the child token to accept in the pending children array of a given token
     * @param childAddress Address of the collection smart contract of the child token expected to be at the specified
     *  index
     * @param childId ID of the child token expected to be located at the specified index
     */
    function acceptChild(
        uint256 parentId,
        uint256 childIndex,
        address childAddress,
        uint256 childId
    ) external;

    /**
     * @notice Used to reject all pending children of a given parent token.
     * @dev Removes the children from the pending array mapping.
     * @dev The children&apos;s ownership structures are not updated.
     * @dev Requirements:
     *
     * - `parentId` MUST exist
     * @param parentId ID of the parent token for which to reject all of the pending tokens
     * @param maxRejections Maximum number of expected children to reject, used to prevent from
     *  rejecting children which arrive just before this operation.
     */
    function rejectAllChildren(uint256 parentId, uint256 maxRejections) external;

    /**
     * @notice Used to transfer a child token from a given parent token.
     * @dev MUST remove the child from the parent&apos;s active or pending children.
     * @dev When transferring a child token, the owner of the token MUST be set to `to`, or not updated in the event of `to`
     *  being the `0x0` address.
     * @param tokenId ID of the parent token from which the child token is being transferred
     * @param to Address to which to transfer the token to
     * @param destinationId ID of the token to receive this child token (MUST be 0 if the destination is not a token)
     * @param childIndex Index of a token we are transferring, in the array it belongs to (can be either active array or
     *  pending array)
     * @param childAddress Address of the child token&apos;s collection smart contract
     * @param childId ID of the child token in its own collection smart contract
     * @param isPending A boolean value indicating whether the child token being transferred is in the pending array of the
     *  parent token (`true`) or in the active array (`false`)
     * @param data Additional data with no specified format, sent in call to `to`
     */
    function transferChild(
        uint256 tokenId,
        address to,
        uint256 destinationId,
        uint256 childIndex,
        address childAddress,
        uint256 childId,
        bool isPending,
        bytes data
    ) external;

    /**
     * @notice Used to retrieve the active child tokens of a given parent token.
     * @dev Returns array of Child structs existing for parent token.
     * @dev The Child struct consists of the following values:
     *  [
     *      tokenId,
     *      contractAddress
     *  ]
     * @param parentId ID of the parent token for which to retrieve the active child tokens
     * @return struct[] An array of Child structs containing the parent token&apos;s active child tokens
     */
    function childrenOf(uint256 parentId)
        external
        view
        returns (Child[] memory);

    /**
     * @notice Used to retrieve the pending child tokens of a given parent token.
     * @dev Returns array of pending Child structs existing for given parent.
     * @dev The Child struct consists of the following values:
     *  [
     *      tokenId,
     *      contractAddress
     *  ]
     * @param parentId ID of the parent token for which to retrieve the pending child tokens
     * @return struct[] An array of Child structs containing the parent token&apos;s pending child tokens
     */
    function pendingChildrenOf(uint256 parentId)
        external
        view
        returns (Child[] memory);

    /**
     * @notice Used to retrieve a specific active child token for a given parent token.
     * @dev Returns a single Child struct locating at `index` of parent token&apos;s active child tokens array.
     * @dev The Child struct consists of the following values:
     *  [
     *      tokenId,
     *      contractAddress
     *  ]
     * @param parentId ID of the parent token for which the child is being retrieved
     * @param index Index of the child token in the parent token&apos;s active child tokens array
     * @return struct A Child struct containing data about the specified child
     */
    function childOf(uint256 parentId, uint256 index)
        external
        view
        returns (Child memory);

    /**
     * @notice Used to retrieve a specific pending child token from a given parent token.
     * @dev Returns a single Child struct locating at `index` of parent token&apos;s active child tokens array.
     * @dev The Child struct consists of the following values:
     *  [
     *      tokenId,
     *      contractAddress
     *  ]
     * @param parentId ID of the parent token for which the pending child token is being retrieved
     * @param index Index of the child token in the parent token&apos;s pending child tokens array
     * @return struct A Child struct containing data about the specified child
     */
    function pendingChildOf(uint256 parentId, uint256 index)
        external
        view
        returns (Child memory);

    /**
     * @notice Used to transfer the token into another token.
     * @dev The destination token MUST NOT be a child token of the token being transferred or one of its downstream
     *  child tokens.
     * @param from Address of the direct owner of the token to be transferred
     * @param to Address of the receiving token&apos;s collection smart contract
     * @param tokenId ID of the token being transferred
     * @param destinationId ID of the token to receive the token being transferred
     */
    function nestTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        uint256 destinationId
    ) external;
}
```

ID MUST never be a `0` value, as this proposal uses `0` values do signify that the token/destination is not an NFT.

## Rationale

Designing the proposal, we considered the following questions:

1. **How to name the proposal?**\
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&apos;s role is only to be able to be `Nestable` and support a token owning it. This is how we landed on the `Parent-Centered` part of the title.
2. **Why is automatically accepting a child using [EIP-712](./eip-712.md) permit-style signatures not a part of this proposal?**\
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.
3. **Why use indexes?**\
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.\
To avoid race conditions in which the index of a token changes, the expected token ID as well as the expected token&apos;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.\
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.
4. **Why is the pending children array limited instead of supporting pagination?**\
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.\
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.\
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.
5. **Should we allow tokens to be nested into one of its children?**\
The proposal enforces that a parent token can&apos;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&apos;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.
6. **Why is there not a &quot;safe&quot; nest transfer method?**\
`nestTransfer` is always &quot;safe&quot; since it MUST check for `IERC6059` compatibility on the destination.
7. **How does this proposal differ from the other proposals trying to address a similar problem?**\
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.

### Propose-Commit pattern for child token management

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 *&quot;Pending&quot;* array, and MUST be migrated to the *&quot;Active&quot;* array by the parent token&apos;s root owner. The *&quot;Pending&quot;* child tokens array SHOULD be limited to 128 slots to prevent spam and griefing.

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&apos;t want to.

### Parent Governed pattern

The parent NFT of a nested token and the parent&apos;s root owner are in all aspects the true owners of it. Once you send a token to another one you give up ownership.

We continue to use ERC-721&apos;s `ownerOf` 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 *root owner*. Additionally we provide the `directOwnerOf` 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.

The root owner or an approved party MUST be able do the following operations on children: `acceptChild`, `rejectAllChildren` and `transferChild`.

The root owner or an approved party MUST also be allowed to do these operations only when token is not owned by an NFT: `transferFrom`, `safeTransferFrom`, `nestTransferFrom`, `burn`.

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 `transferChild`, this method in turn SHOULD call `nestTransferFrom` or `safeTransferFrom` in the child token&apos;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.

We add this restriction to prevent inconsistencies on parent contracts, since only the `transferChild` method takes care of removing the child from the parent when it is being transferred out of it.

### Child token management

This proposal introduces a number of child token management functions. In addition to the permissioned migration from *&quot;Pending&quot;* to *&quot;Active&quot;* child tokens array, the main token management function from this proposal is the `tranferChild` function. The following state transitions of a child token are available with it:

1. Reject child token
2. Abandon child token
3. Unnest child token
4. Transfer the child token to an EOA or an `ERC721Receiver`
5. Transfer the child token into a new parent token

To better understand how these state transitions are achieved, we have to look at the available parameters passed to `transferChild`:

```solidity
    function transferChild(
        uint256 tokenId,
        address to,
        uint256 destinationId,
        uint256 childIndex,
        address childAddress,
        uint256 childId,
        bool isPending,
        bytes data
    ) external;
```

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):

1. **Reject child token**\
![Reject child token](../assets/eip-6059/img/eip-6059-reject-child.png)
2. **Abandon child token**\
![Abandon child token](../assets/eip-6059/img/eip-6059-abandon-child.png)
3. **Unnest child token**\
![Unnest child token](../assets/eip-6059/img/eip-6059-unnest-child.png)
4. **Transfer the child token to an EOA or an `ERC721Receiver`**\
![Transfer child token to EOA](../assets/eip-6059/img/eip-6059-transfer-child-to-eoa.png)
5. **Transfer the child token into a new parent token**\
![Transfer child token to parent token](../assets/eip-6059/img/eip-6059-transfer-child-to-token.png)\
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&apos;s root owner in order to be placed into the active array of that token.

## Backwards Compatibility

The Nestable token standard has been made compatible with [ERC-721](./eip-721.md) in order to take advantage of the robust tooling available for implementations of ERC-721 and to ensure compatibility with existing ERC-721 infrastructure.

## Test Cases

Tests are included in [`nestable.ts`](../assets/eip-6059/test/nestable.ts).

To run them in terminal, you can use the following commands:

```
cd ../assets/eip-6059
npm install
npx hardhat test
```

## Reference Implementation

See [`NestableToken.sol`](../assets/eip-6059/contracts/NestableToken.sol).


## Security Considerations

The same security considerations as with [ERC-721](./eip-721.md) apply: hidden logic may be present in any of the functions, including burn, add child, accept child, and more.

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.

Caution is advised when dealing with non-audited contracts.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 15 Nov 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6059</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6059</guid>
      </item>
    
      <item>
        <title>Real Estate Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/updated-eip-6065-real-estate-token/11936</comments>
        
        <description>## Abstract

This proposal introduces an open structure for physical real estate and property to exist on the blockchain. This standard builds off of [ERC-721](./eip-721.md), 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.

## Motivation

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.

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.

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.

## Specification

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.

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.

### Token Components:

1. Inherits ERC-721 - Allows for backwards compatibility with the most widely accepted NFT token standard.
2. operatingAgreementHashOf - immutable hash of the legal agreement detailing the right to ownership and conditions of use with regard to the property
3. Property Unique Identifiers - legal description (from physical deed), street address, GIS coordinates, parcel/tax ID, legal owning entity (on deed)
4. debtOf - readable debt value, currency, and foreclosure status of the NFT
5. managerOf - readable Ethereum address with managing control of property

### Interfaces

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 [Backwards Compatibility](#backwards-compatibility) and [Security Considerations](#security-considerations).


#### Solidity Interface

```
pragma solidity ^0.8.13;

import &quot;forge-std/interfaces/IERC721.sol&quot;;

interface IERC6065 is IERC721 {

	// This event MUST emit if the asset is ever foreclosed.
	event Foreclosed(uint256 id);

	/* 
	Next getter functions return immutable data for NFT.
	*/
	function legalDescriptionOf(uint256 _id) external view returns (string memory);
	function addressOf(uint256 _id) external view returns (string memory);
	function geoJsonOf(uint256 _id) external view returns (string memory);
	function parcelIdOf(uint256 _id) external view returns (string memory);
	function legalOwnerOf(uint256 _id) external view returns (string memory);
	function operatingAgreementHashOf(uint256 _id) external view returns (bytes32);

	/*
	Next getter function returns the debt denomination token of the NFT, the amount of debt (negative debt == credit), and if the underlying 
	asset backing the NFT has been foreclosed on. This should be utilized specifically for off-chain debt and required payments on the RWA asset.
	It&apos;s recommended that administrators only use a single token type to denominate the debt. It&apos;s unrealistic to require integrating smart
	contracts to implement possibly unbounded tokens denominating the off-chain debt of an asset.

	If the foreclosed status == true, then the RWA can be seen as severed from the NFT. The NFT is now &quot;unbacked&quot; by the RWA.
	*/
	function debtOf(uint256 _id) external view returns (address debtToken, int256 debtAmt, bool foreclosed);

	// Get the managerOf an NFT. The manager can have additional rights to the NFT or RWA on or off-chain.
	function managerOf(uint256 _id) external view returns (address);
}
```

## Rationale

### Introduction

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.

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 [Reference Implementation](#reference-implementation). 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.

### Guiding Objectives

We have designed this EIP to achieve three primary objectives necessary for creating an NFT representation of physical real estate:

#### 1. Real Estate NFTs are universally transferable

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.

#### 2. All rights associated with property ownership are able to be maintained and guaranteed by the NFT

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.

#### 3. Property rights are transferred atomically with the transfer of the NFT

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. 

The following section specifies the technological components required to meet these three objectives. 

### operatingAgreementHashOf

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. 

### Property Unique Identifiers

The following unique identifiers of the property are contained within the NFT and are immutable:

`legalDescriptionOf`: written description of the property taken from the physical property deed
`addressOf`: street address of the property
`geoJsonOf`: the GeoJSON format of the property’s geospatial coordinates
`parcelIdOf`: ID number used to identify the property by the local authority
`legalOwnerOf`: the legal entity that is named on the verifiable physical deed

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. 

These identifiers, especially `legalOwnerOf`, 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. 

### debtOf

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.

The `debtOf` 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 `Operating Agreement`, 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.

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. 

### managerOf 

A readable Ethereum address that can be granted a right to action on the property without being the underlying owner of the NFT. 

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. 

## Backwards Compatibility

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 [Security Considerations](#security-considerations) for more details.

## Reference Implementation

Klasma Labs offers a work in progress [reference implementation](../assets/eip-6065/Implementation.sol). The technical implementation includes the following additional components for reference, this implementation is not required.

Summary of this implementation:

* NFT burn and mint function
* Immutable NFT data (unique identifiers and operating agreement hash)
* Simple debt tracking by Administrator
* Blocklist function to freeze asset held by fraudulent addresses (NOTE: to be implemented in the future)
* Simple foreclosure logic initiated by Administrator
* `managerOf` function implementation to chain this call to other supported smart contracts

### Legal Structure Implementation

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.

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.

![Corporate Structure Image](../assets/eip-6065/corporate-structure.png)


The legal structure for this token is as follows:

* A parent company and property Administrator, owns a bankruptcy remote LLC for each individual property they act as Administrator for.
* 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.
* This structure enables the following three outcomes:

    1. 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.
    2. 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.

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.

## Security Considerations

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.

* 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. 
* Protocol integrators are recommended to check the debtOf value for an accurate representation of the value of this token.
* Protocol integrators are recommended to check the foreclose status to ensure this token is still backed by the asset it was originally tied to.
* 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. 

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6065</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6065</guid>
      </item>
    
      <item>
        <title>Signature Validation Method for NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6066-signature-validation-method-for-nfts/11943</comments>
        
        <description>## Abstract

While **E**xternally **O**wned **A**ccounts can validate signed messages with `ecrecover()` and smart contracts can validate signatures using specifications outlined in [ERC-1271](./eip-1271.md), 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 [ERC-1271](./eip-1271.md): `isValidSignature(tokenId, hash, data)`.

## Motivation

With billions of ETH in trading volume, the **N**on-**F**ungible **T**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 [ERC-721](./eip-721.md) &amp; [ERC-1155](./eip-1155.md) token standards, we reckon more can be done to aid the community in discovering alternative uses for NFTs.

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&apos;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.

## Specification

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.

```
pragma solidity ^0.8.0;

interface IERC6066 {
    /**
     * @dev MUST return if the signature provided is valid for the provided tokenId and hash
     * @param tokenId   Token ID of the signing NFT
     * @param hash      Hash of the data to be signed
     * @param data      OPTIONAL arbitrary data that may aid verification
     *
     * MUST return the bytes4 magic value 0x12edb34f when function passes.
     * MUST NOT modify state (using STATICCALL for solc &lt; 0.5, view modifier for solc &gt; 0.5)
     * MUST allow external calls
     *
     */
    function isValidSignature(
        uint256 tokenId,
        bytes32 hash,
        bytes calldata data
    ) external view returns (bytes4 magicValue);
}
```

`isValidSignature` can call arbitrary methods to validate a given signature.

This function MAY be implemented by [ERC-721](./eip-721.md) or [ERC-1155](./eip-1155.md) 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 ([ERC-721](./eip-721.md) or [ERC-1155](./eip-1155.md)).

## Rationale

We have purposefully decided to not include a signature generation standard in this proposal as it would restrict flexibility of such mechanism, just as [ERC-1271](./eip-1271.md) does not enforce a signing standard for smart contracts. We also decided to reference Gnosis Safe&apos;s contract signing approach as it is both simplistic and proven to be adequate. The `bytes calldata data` parameter is considered optional if extra data is needed for signature verification, also conforming this EIP to [ERC-5750](./eip-5750.md) for future-proofing purposes.

## Backwards Compatibility

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&apos;s contract signature implementation.

## Reference Implementation

Example implementation of an [ERC-721](./eip-721.md) compliant contract that conforms to [ERC-6066](./eip-6066.md) with a custom signing function:

```
pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;./interfaces/IERC6066.sol&quot;;

contract ERC6066Reference is ERC721, IERC6066 {
    // type(IERC6066).interfaceId
    bytes4 public constant MAGICVALUE = 0x12edb34f;
    bytes4 public constant BADVALUE = 0xffffffff;

    mapping(uint256 =&gt; mapping(bytes32 =&gt; bool)) internal _signatures;

    error ENotTokenOwner();

    /**
     * @dev Checks if the sender owns NFT with ID tokenId
     * @param tokenId   Token ID of the signing NFT
     */
    modifier onlyTokenOwner(uint256 tokenId) {
        if (ownerOf(tokenId) != _msgSender()) revert ENotTokenOwner();
        _;
    }

    constructor(string memory name_, string memory symbol_)
        ERC721(name_, symbol_)
    {}

    /**
     * @dev SHOULD sign the provided hash with NFT of tokenId given sender owns said NFT
     * @param tokenId   Token ID of the signing NFT
     * @param hash      Hash of the data to be signed
     */
    function sign(uint256 tokenId, bytes32 hash)
        external
        onlyTokenOwner(tokenId)
    {
        _signatures[tokenId][hash] = true;
    }

    /**
     * @dev MUST return if the signature provided is valid for the provided tokenId, hash, and optionally data
     */
    function isValidSignature(uint256 tokenId, bytes32 hash, bytes calldata data)
        external
        view
        override
        returns (bytes4 magicValue)
    {
        // The data parameter is unused in this example
        return _signatures[tokenId][hash] ? MAGICVALUE : BADVALUE;
    }

    /**
     * @dev ERC-165 support
     */
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override returns (bool) {
        return
            interfaceId == type(IERC6066).interfaceId ||
            super.supportsInterface(interfaceId);
    }
}
```

## Security Considerations

The revokable nature of contract-based signatures carries over to this EIP. Developers and users alike should take it into consideration.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6066</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6066</guid>
      </item>
    
      <item>
        <title>Custom errors for commonly-used tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6093-custom-errors-for-erc-tokens/12043</comments>
        
        <description>## Abstract

This EIP defines a standard set of custom errors for commonly-used tokens, which are defined as [ERC-20](./eip-20.md), [ERC-721](./eip-721.md), and [ERC-1155](./eip-1155.md) tokens.

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.

## Motivation

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.

However, [ERC-20](./eip-20.md), [ERC-721](./eip-721.md), [ERC-1155](./eip-1155.md) were already finalized when custom errors were released, so no errors are included in their specification.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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 following errors were designed according to the criteria described in [Rationale](#rationale).

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.

The names of the error arguments are defined in the [Parameter Glossary](#parameter-glossary) and MUST be used according to those definitions.

### [ERC-20](./eip-20.md)

#### `ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed)`

Indicates an error related to the current `balance` of a `sender`.
Used in transfers.

Usage guidelines:

- `balance` MUST be less than `needed`.

#### `ERC20InvalidSender(address sender)`

Indicates a failure with the token `sender`.
Used in transfers.

Usage guidelines:

- RECOMMENDED for disallowed transfers from the zero address.
- MUST NOT be used for approval operations.
- MUST NOT be used for balance or allowance requirements.
  - Use `ERC20InsufficientBalance` or `ERC20InsufficientAllowance` instead.

#### `ERC20InvalidReceiver(address receiver)`

Indicates a failure with the token `receiver`.
Used in transfers.

Usage guidelines:

- RECOMMENDED for disallowed transfers to the zero address.
- RECOMMENDED for disallowed transfers to non-compatible addresses (eg. contract addresses).
- MUST NOT be used for approval operations.

#### `ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed)`

Indicates a failure with the `spender`&apos;s `allowance`.
Used in transfers.

Usage guidelines:

- `allowance` MUST be less than `needed`.

#### `ERC20InvalidApprover(address approver)`

Indicates a failure with the `approver` of a token to be approved.
Used in approvals.

Usage guidelines:

- RECOMMENDED for disallowed approvals from the zero address.
- MUST NOT be used for transfer operations.

#### `ERC20InvalidSpender(address spender)`

Indicates a failure with the `spender` to be approved.
Used in approvals.

Usage guidelines:

- RECOMMENDED for disallowed approvals to the zero address.
- RECOMMENDED for disallowed approvals to the owner itself.
- MUST NOT be used for transfer operations.
  - Use `ERC20InsufficientAllowance` instead.

### [ERC-721](./eip-721.md)

#### `ERC721InvalidOwner(address owner)`

Indicates that an address can&apos;t be an owner.
Used in balance queries.

Usage guidelines:

- RECOMMENDED for addresses whose ownership is disallowed (eg. ERC-721 explicitly disallows `address(0)` to be an owner).
- MUST NOT be used for transfers.
  - Use `ERC721IncorrectOwner` instead.

#### `ERC721NonexistentToken(uint256 tokenId)`

Indicates a `tokenId` whose `owner` is the zero address.

Usage guidelines:

- The `tokenId` MUST BE a non-minted or burned token.

#### `ERC721IncorrectOwner(address sender, uint256 tokenId, address owner)`

Indicates an error related to the ownership over a particular token.
Used in transfers.

Usage guidelines:

- `sender` MUST NOT be `owner`.
- MUST NOT be used for approval operations.

#### `ERC721InvalidSender(address sender)`

Indicates a failure with the token `sender`.
Used in transfers.

Usage guidelines:

- RECOMMENDED for disallowed transfers from the zero address.
- MUST NOT be used for approval operations.
- MUST NOT be used for ownership or approval requirements.
  - Use `ERC721IncorrectOwner` or `ERC721InsufficientApproval` instead.

#### `ERC721InvalidReceiver(address receiver)`

Indicates a failure with the token `receiver`.
Used in transfers.

Usage guidelines:

- RECOMMENDED for disallowed transfers to the zero address.
- RECOMMENDED for disallowed transfers to non-`ERC721TokenReceiver` contracts or those that reject a transfer. (eg. returning an invalid response in `onERC721Received`).
- MUST NOT be used for approval operations.

#### `ERC721InsufficientApproval(address operator, uint256 tokenId)`

Indicates a failure with the `operator`&apos;s approval.
Used in transfers.

Usage guidelines:

- `isApprovedForAll(owner, operator)` MUST be false for the `tokenId`&apos;s owner and `operator`.
- `getApproved(tokenId)` MUST not be `operator`.

#### `ERC721InvalidApprover(address approver)`

Indicates a failure with the `owner` of a token to be approved.
Used in approvals.

Usage guidelines:

- RECOMMENDED for disallowed approvals from the zero address.
- MUST NOT be used for transfer operations.

#### `ERC721InvalidOperator(address operator)`

Indicates a failure with the `operator` to be approved.
Used in approvals.

Usage guidelines:

- RECOMMENDED for disallowed approvals to the zero address.
- The `operator` MUST NOT be the owner of the approved token.
- MUST NOT be used for transfer operations.
  - Use `ERC721InsufficientApproval` instead.

### [ERC-1155](./eip-1155.md)

#### `ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId)`

Indicates an error related to the current `balance` of a `sender`.
Used in transfers.

Usage guidelines:

- `balance` MUST be less than `needed` for a `tokenId`.

#### `ERC1155InvalidSender(address sender)`

Indicates a failure with the token `sender`.
Used in transfers.

Usage guidelines:

- RECOMMENDED for disallowed transfers from the zero address.
- MUST NOT be used for approval operations.
- MUST NOT be used for balance or allowance requirements.
  - Use `ERC1155InsufficientBalance` or `ERC1155MissingApprovalForAll` instead.

#### `ERC1155InvalidReceiver(address receiver)`

Indicates a failure with the token `receiver`.
Used in transfers.

Usage guidelines:

- RECOMMENDED for disallowed transfers to the zero address.
- RECOMMENDED for disallowed transfers to non-`ERC1155TokenReceiver` contracts or those that reject a transfer. (eg. returning an invalid response in `onERC1155Received`).
- MUST NOT be used for approval operations.

#### `ERC1155MissingApprovalForAll(address operator, address owner)`

Indicates a failure with the `operator`&apos;s approval in a transfer.
Used in transfers.

Usage guidelines:

- `isApprovedForAll(owner, operator)` MUST be false for the `tokenId`&apos;s owner and `operator`.

#### `ERC1155InvalidApprover(address approver)`

Indicates a failure with the `approver` of a token to be approved.
Used in approvals.

Usage guidelines:

- RECOMMENDED for disallowed approvals from the zero address.
- MUST NOT be used for transfer operations.

#### `ERC1155InvalidOperator(address operator)`

Indicates a failure with the `operator` to be approved.
Used in approvals.

Usage guidelines:

- RECOMMENDED for disallowed approvals to the zero address.
- MUST be used for disallowed approvals to the owner itself.
- MUST NOT be used for transfer operations.
  - Use `ERC1155InsufficientApproval` instead.

#### `ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength)`

Indicates an array length mismatch between `ids` and `values` in a `safeBatchTransferFrom` operation.
Used in batch transfers.

Usage guidelines:

- `idsLength` MUST NOT be `valuesLength`.

### Parameter Glossary

| Name        | Description                                                                 |
| ----------- | --------------------------------------------------------------------------- |
| `sender`    | Address whose tokens are being transferred.                                 |
| `balance`   | Current balance for the interacting account.                                |
| `needed`    | Minimum amount required to perform an action.                               |
| `receiver`  | Address to which tokens are being transferred.                              |
| `spender`   | Address that may be allowed to operate on tokens without being their owner. |
| `allowance` | Amount of tokens a `spender` is allowed to operate with.                    |
| `approver`  | Address initiating an approval operation.                                   |
| `tokenId`   | Identifier number of a token.                                               |
| `owner`     | Address of the current owner of a token.                                    |
| `operator`  | Same as `spender`.                                                          |
| `*Length`   | Array length for the prefixed parameter.                                    |

### Error additions

Any addition to this EIP or implementation-specific errors (such as extensions) SHOULD follow the guidelines presented in the [rationale](#rationale) section to keep consistency.

## Rationale

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).

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 [subjects](#actions-and-subjects) involved.

### Actions and subjects

An error is defined based on the following **actions** that can be performed on a token and its involved _subjects_:

- **Transfer**: An operation in which a _sender_ moves to a _receiver_ any number of tokens (fungible _balance_ and/or non-fungible _token ids_).
- **Approval**: An operation in which an _approver_ grants any form of _approval_ to an _operator_.

These attempt to exhaustively represent what can go wrong in a token operation. Therefore, the errors can be constructed by specifying which _subject_ failed during an **action** execution, and prefixing with an [error prefix](#error-prefixes).

Note that the action is never seen as the subject of an error.

If a subject is called different on a particular token standard, the error should be consistent with the standard&apos;s naming convention.

### Error prefixes

An error prefix is added to a subject to derive a concrete error condition.
Developers can think about an error prefix as the _why_ an error happened.

A prefix can be `Invalid` for general incorrectness, or more specific like `Insufficient` for amounts.

### Domain

Each error&apos;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 `DeclarationError`.

An example of this is:

```solidity
InsufficientApproval(address spender, uint256 allowance, uint256 needed);
InsufficientApproval(address operator, uint256 tokenId);
```

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.

Example:

```solidity
ERC20InsufficientApproval(address spender, uint256 allowance, uint256 needed);
ERC721InsufficientApproval(address operator, uint256 tokenId);
```

### Arguments

The selection of arguments depends on the subject involved, and it should follow the order presented below:

1. _Who_ is involved with the error (eg. `address sender`)
2. _What_ failed (eg. `uint256 allowance`)
3. _Why_ it failed, expressed in additional arguments (eg. `uint256 needed`)

A particular argument may fall into overlapping categories (eg. _Who_ may also be _What_), so not all of these will be present but the order shouldn&apos;t be broken.

Some tokens may need a `tokenId`. This is suggested to include at the end as additional information instead of as a subject.

### Error grammar rules

Given the above, we can summarize the construction of error names with a grammar that errors will follow:

```
&lt;Domain&gt;&lt;ErrorPrefix&gt;&lt;Subject&gt;(&lt;Arguments&gt;);
```

Where:

- _Domain_: `ERC20`, `ERC721` or `ERC1155`. Although other token standards may be suggested if not considered in this EIP.
- _ErrorPrefix_: `Invalid`, `Insufficient`, or another if it&apos;s more appropriate.
- _Subject_: `Sender`, `Receiver`, `Balance`, `Approver`, `Operator`, `Approval` or another if it&apos;s more appropriate, and must make adjustments based on the domain&apos;s naming convention.
- _Arguments_: Follow the [_who_, _what_ and _why_ order](#arguments).

## Backwards Compatibility

Tokens already deployed rely mostly on revert strings and make use of `require` instead of custom errors. Even most of the newly deployed tokens since Solidity&apos;s v0.8.4 release inherit from implementations using revert strings.

This EIP can not be enforced on non-upgradeable already deployed tokens, however, these tokens generally use similar conventions with small variations such as:

- including/removing the [domain](#domain).
- using different [error prefixes](#error-prefixes).
- including similar [subjects](#actions-and-subjects).
- changing the grammar order.

Upgradeable contracts MAY be upgraded to implement this EIP.

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.

## Reference Implementation

### Solidity

```solidity
pragma solidity ^0.8.4;

/// @title Standard ERC20 Errors
/// @dev See https://eips.ethereum.org/EIPS/eip-20
///  https://eips.ethereum.org/EIPS/eip-6093
interface ERC20Errors {
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
    error ERC20InvalidSender(address sender);
    error ERC20InvalidReceiver(address receiver);
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
    error ERC20InvalidApprover(address approver);
    error ERC20InvalidSpender(address spender);
}

/// @title Standard ERC721 Errors
/// @dev See https://eips.ethereum.org/EIPS/eip-721
///  https://eips.ethereum.org/EIPS/eip-6093
interface ERC721Errors {
    error ERC721InvalidOwner(address owner);
    error ERC721NonexistentToken(uint256 tokenId);
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
    error ERC721InvalidSender(address sender);
    error ERC721InvalidReceiver(address receiver);
    error ERC721InsufficientApproval(address operator, uint256 tokenId);
    error ERC721InvalidApprover(address approver);
    error ERC721InvalidOperator(address operator);
}

/// @title Standard ERC1155 Errors
/// @dev See https://eips.ethereum.org/EIPS/eip-1155
///  https://eips.ethereum.org/EIPS/eip-6093
interface ERC1155Errors {
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
    error ERC1155InvalidSender(address sender);
    error ERC1155InvalidReceiver(address receiver);
    error ERC1155MissingApprovalForAll(address operator, address owner)
    error ERC1155InvalidApprover(address approver);
    error ERC1155InvalidOperator(address operator);
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
```

## Security Considerations

There are no known signature hash collisions for the specified errors.

Tokens upgraded to implement this EIP may break assumptions in other systems relying on revert strings.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 06 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6093</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6093</guid>
      </item>
    
      <item>
        <title>No Intermediary NFT Trading Protocol</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip6105-no-intermediary-nft-trading-protocol/12171</comments>
        
        <description>## Abstract

This ERC adds a marketplace functionality to [ERC-721](./eip-721.md) to enable non-fungible token trading without relying on an intermediary trading platform. At the same time, creators may implement more diverse royalty schemes.

## Motivation

Most current NFT trading relies on an NFT trading platform acting as an intermediary, which has the following problems:

1. Security concerns arise from authorization via the `setApprovalForAll` 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.
2. 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 `setApprovalForAll` 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.
3. 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&apos;s efficiency in obtaining data is affected by the frequency of the trading platform&apos;s API and, at times, trading platforms may suspend the distribution of APIs and limit their frequency.
4. The project parties&apos; 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.
5. 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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

Compliant contracts MUST implement the following interface:

```solidity
interface IERC6105 {

  /// @notice Emitted when a token is listed for sale or delisted
  /// @dev The zero `salePrice` indicates that the token is not for sale
  ///      The zero `expires` indicates that the token is not for sale
  /// @param tokenId - identifier of the token being listed
  /// @param from - address of who is selling the token
  /// @param salePrice - the price the token is being sold for
  /// @param expires - UNIX timestamp, the buyer could buy the token before expires
  /// @param supportedToken - contract addresses of supported token or zero address
  ///                         The zero address indicates that the supported token is ETH
  ///                         Buyer needs to purchase item with supported token
  /// @param benchmarkPrice - Additional price parameter, may be used when calculating royalties
  event UpdateListing(
    uint256 indexed tokenId,
    address indexed from,
    uint256 salePrice,
    uint64 expires,
    address supportedToken,
    uint256 benchmarkPrice
    );

  /// @notice Emitted when a token is being purchased
  /// @param tokenId - identifier of the token being purchased
  /// @param from - address of who is selling the token
  /// @param to - address of who is buying the token 
  /// @param salePrice - the price the token is being sold for
  /// @param supportedToken - contract addresses of supported token or zero address
  ///                         The zero address indicates that the supported token is ETH
  ///                         Buyer needs to purchase item with supported token
  /// @param royalties - The amount of royalties paid on this purchase
  event Purchased(
    uint256 indexed tokenId,
    address indexed from,
    address indexed to,
    uint256 salePrice,
    address supportedToken,
    uint256 royalties
    );

  /// @notice Create or update a listing for `tokenId`
  /// @dev `salePrice` MUST NOT be set to zero
  /// @param tokenId - identifier of the token being listed
  /// @param salePrice - the price the token is being sold for
  /// @param expires - UNIX timestamp, the buyer could buy the token before expires
  /// @param supportedToken - contract addresses of supported token or zero address
  ///                         The zero address indicates that the supported token is ETH
  ///                         Buyer needs to purchase item with supported token
  /// Requirements:
  /// - `tokenId` must exist
  /// - Caller must be owner, authorised operators or approved address of the token
  /// - `salePrice` must not be zero
  /// - `expires` must be valid
  /// - Must emit an {UpdateListing} event.
  function listItem(
    uint256 tokenId,
    uint256 salePrice,
    uint64 expires,
    address supportedToken
    ) external;

  /// @notice Create or update a listing for `tokenId` with `benchmarkPrice`
  /// @dev `salePrice` MUST NOT be set to zero
  /// @param tokenId - identifier of the token being listed
  /// @param salePrice - the price the token is being sold for
  /// @param expires - UNIX timestamp, the buyer could buy the token before expires
  /// @param supportedToken - contract addresses of supported token or zero address
  ///                         The zero address indicates that the supported token is ETH
  ///                         Buyer needs to purchase item with supported token
  /// @param benchmarkPrice - Additional price parameter, may be used when calculating royalties
  /// Requirements:
  /// - `tokenId` must exist
  /// - Caller must be owner, authorised operators or approved address of the token
  /// - `salePrice` must not be zero
  /// - `expires` must be valid
  /// - Must emit an {UpdateListing} event.
  function listItem(
    uint256 tokenId,
    uint256 salePrice,
    uint64 expires,
    address supportedToken,
    uint256 benchmarkPrice
    ) external;
 
  /// @notice Remove the listing for `tokenId`
  /// @param tokenId - identifier of the token being delisted
  /// Requirements:
  /// - `tokenId` must exist and be listed for sale
  /// - Caller must be owner, authorised operators or approved address of the token
  /// - Must emit an {UpdateListing} event
  function delistItem(uint256 tokenId) external;
 
  /// @notice Buy a token and transfer it to the caller
  /// @dev `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks
  /// @param tokenId - identifier of the token being purchased
  /// @param salePrice - the price the token is being sold for
  /// @param supportedToken - contract addresses of supported token or zero address
  /// Requirements:
  /// - `tokenId` must exist and be listed for sale
  /// - `salePrice` must matches the expected purchase price to prevent front-running attacks
  /// - `supportedToken` must matches the expected purchase token to prevent front-running attacks
  /// - Caller must be able to pay the listed price for `tokenId`
  /// - Must emit a {Purchased} event
  function buyItem(uint256 tokenId, uint256 salePrice, address supportedToken) external payable;

  /// @notice Return the listing for `tokenId`
  /// @dev The zero sale price indicates that the token is not for sale
  ///      The zero expires indicates that the token is not for sale
  ///      The zero supported token address indicates that the supported token is ETH
  /// @param tokenId identifier of the token being queried
  /// @return the specified listing (sale price, expires, supported token, benchmark price)
  function getListing(uint256 tokenId) external view returns (uint256, uint64, address, uint256);
}
```

### Optional collection offer extension

```solidity
/// The collection offer extension is OPTIONAL for ERC-6105 smart contracts. This allows smart contract to support collection offer functionality.
interface IERC6105CollectionOffer {

  /// @notice Emitted when the collection receives an offer or an offer is canceled
  /// @dev The zero `salePrice` indicates that the collection offer of the token is canceled
  ///      The zero `expires` indicates that the collection offer of the token is canceled
  /// @param from - address of who make collection offer
  /// @param amount - the amount the offerer wants to buy at `salePrice` per token
  /// @param salePrice - the price of each token is being offered for the collection
  /// @param expires - UNIX timestamp, the offer could be accepted before expires
  /// @param supportedToken - contract addresses of supported ERC20 token
  ///                          Buyer wants to purchase items with supported token
  event UpdateCollectionOffer(address indexed from, uint256 amount, uint256 salePrice ,uint64 expires, address supportedToken);

  /// @notice Create or update an offer for the collection
  /// @dev `salePrice` MUST NOT be set to zero
  /// @param amount - the amount the offerer wants to buy at `salePrice` per token
  /// @param salePrice - the price of each token is being offered for the collection
  /// @param expires - UNIX timestamp, the offer could be accepted before expires
  /// @param supportedToken - contract addresses of supported token
  ///                         Buyer wants to purchase items with supported token
  /// Requirements:
  /// - The caller must have enough supported tokens, and has approved the contract a sufficient amount
  /// - `salePrice` must not be zero
  /// - `amount` must not be zero
  /// - `expires` must be valid
  /// - Must emit an {UpdateCollectionOffer} event
  function makeCollectionOffer(uint256 amount, uint256 salePrice, uint64 expires, address supportedToken) external;

  /// @notice Accepts collection offer and transfers the token to the buyer
  /// @dev `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks
  ///      When the trading is completed, the `amount` of NFTs the buyer wants to purchase needs to be reduced by 1
  /// @param tokenId - identifier of the token being offered
  /// @param salePrice - the price the token is being offered for
  /// @param supportedToken - contract addresses of supported token
  /// @param buyer - address of who wants to buy the token
  /// Requirements:
  /// - `tokenId` must exist and be offered for
  /// - Caller must be owner, authorised operators or approved address of the token
  /// - Must emit a {Purchased} event
  function acceptCollectionOffer(uint256 tokenId, uint256 salePrice, address supportedToken, address buyer) external;

  /// @notice Accepts collection offer and transfers the token to the buyer
  /// @dev `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks
  ///      When the trading is completed, the `amount` of NFTs the buyer wants to purchase needs to be reduced by 1
  /// @param tokenId - identifier of the token being offered
  /// @param salePrice - the price the token is being offered for
  /// @param supportedToken - contract addresses of supported token
  /// @param buyer - address of who wants to buy the token
  /// @param benchmarkPrice - additional price parameter, may be used when calculating royalties
  /// Requirements:
  /// - `tokenId` must exist and be offered for
  /// - Caller must be owner, authorised operators or approved address of the token
  /// - Must emit a {Purchased} event
  function acceptCollectionOffer(uint256 tokenId, uint256 salePrice, address supportedToken, address buyer, uint256 benchmarkPrice) external;

  /// @notice Removes the offer for the collection
  /// Requirements:
  /// - Caller must be the offerer
  /// - Must emit an {UpdateCollectionOffer} event
  function cancelCollectionOffer() external;

  /// @notice Returns the offer for `tokenId` maked by `buyer`
  /// @dev The zero amount indicates there is no offer
  ///      The zero sale price indicates there is no offer
  ///      The zero expires indicates that there is no offer
  /// @param buyer address of who wants to buy the token
  /// @return the specified offer (amount, sale price, expires, supported token)
  function getCollectionOffer(address buyer) external view returns (uint256, uint256, uint64, address);
}
```

### Optional item offer extension

```solidity
/// The item offer extension is OPTIONAL for ERC-6105 smart contracts. This allows smart contract to support item offer functionality.
interface IERC6105ItemOffer {

  /// @notice Emitted when a token receives an offer or an offer is canceled
  /// @dev The zero `salePrice` indicates that the offer of the token is canceled
  ///      The zero `expires` indicates that the offer of the token is canceled
  /// @param tokenId - identifier of the token being offered
  /// @param from - address of who wants to buy the token
  /// @param salePrice - the price the token is being offered for
  /// @param expires - UNIX timestamp, the offer could be accepted before expires
  /// @param supportedToken - contract addresses of supported token
  ///                          Buyer wants to purchase item with supported token
  event UpdateItemOffer(
    uint256 indexed tokenId,
    address indexed from,
    uint256 salePrice,
    uint64 expires,
    address supportedToken
    );

  /// @notice Create or update an offer for `tokenId`
  /// @dev `salePrice` MUST NOT be set to zero
  /// @param tokenId - identifier of the token being offered
  /// @param salePrice - the price the token is being offered for
  /// @param expires - UNIX timestamp, the offer could be accepted before expires
  /// @param supportedToken - contract addresses of supported token
  ///                         Buyer wants to purchase item with supported token
  /// Requirements:
  /// - `tokenId` must exist
  /// - The caller must have enough supported tokens, and has approved the contract a sufficient amount
  /// - `salePrice` must not be zero
  /// - `expires` must be valid
  /// - Must emit an {UpdateItemOffer} event.
  function makeItemOffer(uint256 tokenId, uint256 salePrice, uint64 expires, address supportedToken) external;

  /// @notice Remove the offer for `tokenId`
  /// @param tokenId - identifier of the token being canceled offer
  /// Requirements:
  /// - `tokenId` must exist and be offered for
  /// - Caller must be the offerer
  /// - Must emit an {UpdateItemOffer} event
  function cancelItemOffer(uint256 tokenId) external;

  /// @notice Accept offer and transfer the token to the buyer
  /// @dev `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks
  ///      When the trading is completed, the offer infomation needs to be removed
  /// @param tokenId - identifier of the token being offered
  /// @param salePrice - the price the token is being offered for
  /// @param supportedToken - contract addresses of supported token
  /// @param buyer - address of who wants to buy the token
  /// Requirements:
  /// - `tokenId` must exist and be offered for
  /// - Caller must be owner, authorised operators or approved address of the token
  /// - Must emit a {Purchased} event
  function acceptItemOffer(uint256 tokenId, uint256 salePrice, address supportedToken, address buyer) external;

  /// @notice Accepts offer and transfers the token to the buyer
  /// @dev `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks
  ///      When the trading is completed, the offer infomation needs to be removed
  /// @param tokenId - identifier of the token being offered
  /// @param salePrice - the price the token is being offered for
  /// @param supportedToken - contract addresses of supported token
  /// @param buyer - address of who wants to buy the token
  /// @param benchmarkPrice - additional price parameter, may be used when calculating royalties
  /// Requirements:
  /// - `tokenId` must exist and be offered for
  /// - Caller must be owner, authorised operators or approved address of the token
  /// - Must emit a {Purchased} event
  function acceptItemOffer(uint256 tokenId, uint256 salePrice, address supportedToken, address buyer, uint256 benchmarkPrice) external;

  /// @notice Return the offer for `tokenId` maked by `buyer`
  /// @dev The zero sale price indicates there is no offer
  ///      The zero expires indicates that there is no offer
  /// @param tokenId identifier of the token being queried
  /// @param buyer address of who wants to buy the token
  /// @return the specified offer (sale price, expires, supported token)
  function getItemOffer(uint256 tokenId, address buyer) external view returns (uint256, uint64, address);
}
```

## Rationale

### Considerations for some local variables

The `salePrice` in the `listItem` 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 &apos;economic man&apos; in economics. Additionally, a token price of 0 indicates that the item is not for sale, making the reference implementation more concise.

Setting `expires` in the `listItem` function allows callers to better manage their listings. If a listing expires automatically, the token owner will no longer need to manually `delistItem`, thus saving gas.

Setting `supportedToken` in the `listItem` function allows the caller or contract owner to choose which tokens they want to accept, rather than being limited to a single token.

The rationales of variable setting in the `acceptCollectionOffer` and `acceptItemOffer` functions are the same as described above.

### More diverse royalty schemes

By introducing the parameter `benchmarkPrice` in the `listItem`, `acceptCollectionOffer` and `acceptItemOffer` functions, the `_salePrice` in the `royaltyInfo(uint256 _tokenId, uint256 _salePrice)` function in the [ERC-2981](./eip-2981.md) interface can be changed to `taxablePrice`, making the ERC-2981 royalty scheme more diverse. Here are several examples of royalty schemes:

`(address royaltyRecipient, uint256 royalties) = royaltyInfo(tokenId, taxablePrice)`

1. Value-added Royalty (VAR, royalties are only charged on the part of the seller&apos;s profit）: `taxablePrice=max(salePrice- historicalPrice, 0)`
2. Sale Royalty (SR): `taxablePrice=salePrice`
3. Capped Royalty(CR): `taxablePrice=min(salePrice, constant)`
4. Quantitative Royalty(QR, each token trading pays a fixed royalties): `taxablePrice= constant`

### Optional Blocklist

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.

## Backwards Compatibility

This standard is compatible with [ERC-721](./eip-721.md) and [ERC-2981](./eip-2981.md).

## Reference Implementation

```solidity
 // SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.8;
import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;@openzeppelin/contracts/token/common/ERC2981.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC20/IERC20.sol&quot;;
import &quot;@openzeppelin/contracts/security/ReentrancyGuard.sol&quot;;
import &quot;./IERC6105.sol&quot;;

/// @title No Intermediary NFT Trading Protocol with Value-added Royalty
/// @dev The royalty scheme used by this reference implementation is Value-Added Royalty
contract ERC6105 is ERC721, ERC2981, IERC6105, ReentrancyGuard{

  /// @dev A structure representing a listed token
  ///      The zero `salePrice` indicates that the token is not for sale
  ///      The zero `expires` indicates that the token is not for sale
  /// @param salePrice - the price the token is being sold for
  /// @param expires - UNIX timestamp, the buyer could buy the token before expires
  /// @param supportedToken - contract addresses of supported ERC20 token or zero address
  ///                         The zero address indicates that the supported token is ETH
  ///                         Buyer needs to purchase item with supported token
  /// @param historicalPrice - The price at which the seller last bought this token
  struct Listing {
    uint256 salePrice;
    uint64 expires;
    address supportedToken;
    uint256 historicalPrice;
  }

  // Mapping from token Id to listing index
  mapping(uint256 =&gt; Listing) private _listings;

  constructor(string memory name_, string memory symbol_)
    ERC721(name_, symbol_)
    {
    }

  /// @notice Create or update a listing for `tokenId`
  /// @dev `salePrice` MUST NOT be set to zero
  /// @param tokenId - identifier of the token being listed
  /// @param salePrice - the price the token is being sold for
  /// @param expires - UNIX timestamp, the buyer could buy the token before expires
  /// @param supportedToken - contract addresses of supported ERC20 token or zero address
  ///                         The zero address indicates that the supported token is ETH
  ///                         Buyer needs to purchase item with supported token
  function listItem (
    uint256 tokenId,
    uint256 salePrice,
    uint64 expires,
    address supportedToken
    ) external virtual{
        listItem(tokenId, salePrice, expires, supportedToken, 0);
    }

  /// @notice Create or update a listing for `tokenId` with `historicalPrice`
  /// @dev `price` MUST NOT be set to zero
  /// @param tokenId - identifier of the token being listed
  /// @param salePrice - the price the token is being sold for
  /// @param expires - UNIX timestamp, the buyer could buy the token before expires
  /// @param supportedToken - contract addresses of supported ERC20 token or zero address
  ///                         The zero address indicates that the supported token is ETH
  ///                         Buyer needs to purchase item with supported token
  /// @param historicalPrice - The price at which the seller last bought this token
  function listItem (
    uint256 tokenId,
    uint256 salePrice,
    uint64 expires,
    address supportedToken,
    uint256 historicalPrice
    ) public virtual{

    address tokenOwner = ownerOf(tokenId);
    require(salePrice &gt; 0, &quot;ERC6105: token sale price MUST NOT be set to zero&quot;);
    require(expires &gt; block.timestamp, &quot;ERC6105: invalid expires&quot;);
    require(_isApprovedOrOwner(_msgSender(), tokenId), &quot;ERC6105: caller is not owner nor approved&quot;);

    _listings[tokenId] = Listing(salePrice, expires, supportedToken, historicalPrice);
    emit UpdateListing(tokenId, tokenOwner, salePrice, expires, supportedToken, historicalPrice);
  }

  /// @notice Remove the listing for `tokenId`
  /// @param tokenId - identifier of the token being listed
  function delistItem(uint256 tokenId) external virtual{
    require(_isApprovedOrOwner(_msgSender(), tokenId), &quot;ERC6105: caller is not owner nor approved&quot;);
    require(_isForSale(tokenId), &quot;ERC6105: invalid listing&quot; );

    _removeListing(tokenId);
  }

  /// @notice Buy a token and transfers it to the caller
  /// @dev `salePrice` and `supportedToken` must match the expected purchase price and token to prevent front-running attacks
  /// @param tokenId - identifier of the token being purchased
  /// @param salePrice - the price the token is being sold for
  /// @param supportedToken - contract addresses of supported token or zero address
  function buyItem(uint256 tokenId, uint256 salePrice, address supportedToken) external nonReentrant payable virtual{
    address tokenOwner = ownerOf(tokenId);
    address buyer = msg.sender;
    uint256 historicalPrice = _listings[tokenId].historicalPrice;

    require(salePrice == _listings[tokenId].salePrice, &quot;ERC6105: inconsistent prices&quot;);
    require(supportedToken ==  _listings[tokenId].supportedToken,&quot;ERC6105: inconsistent tokens&quot;);
    require(_isForSale(tokenId), &quot;ERC6105: invalid listing&quot;);

    /// @dev Handle royalties
    (address royaltyRecipient, uint256 royalties) = _calculateRoyalties(tokenId, salePrice, historicalPrice);

    uint256 payment = salePrice - royalties;
    if(supportedToken == address(0)){
        require(msg.value == salePrice, &quot;ERC6105: incorrect value&quot;);
        _processSupportedTokenPayment(royalties, buyer, royaltyRecipient, address(0));
        _processSupportedTokenPayment(payment, buyer, tokenOwner, address(0));
    }
    else{
        uint256 num = IERC20(supportedToken).allowance(buyer, address(this));
        require (num &gt;= salePrice, &quot;ERC6105: insufficient allowance&quot;);
        _processSupportedTokenPayment(royalties, buyer, royaltyRecipient, supportedToken);
        _processSupportedTokenPayment(payment, buyer, tokenOwner, supportedToken);
    }

    _transfer(tokenOwner, buyer, tokenId);
    emit Purchased(tokenId, tokenOwner, buyer, salePrice, supportedToken, royalties);
  }

  /// @notice Return the listing for `tokenId`
  /// @dev The zero sale price indicates that the token is not for sale
  ///      The zero expires indicates that the token is not for sale
  ///      The zero supported token address indicates that the supported token is ETH
  /// @param tokenId identifier of the token being queried
  /// @return the specified listing (sale price, expires, supported token, benchmark price)
  function getListing(uint256 tokenId) external view virtual returns (uint256, uint64, address, uint256) {
    if(_listings[tokenId].salePrice &gt; 0 &amp;&amp; _listings[tokenId].expires &gt;=  block.timestamp){
    uint256 salePrice = _listings[tokenId].salePrice;
    uint64 expires = _listings[tokenId].expires;
    address supportedToken =  _listings[tokenId].supportedToken;
    uint256 historicalPrice = _listings[tokenId].historicalPrice;
    return (salePrice, expires, supportedToken, historicalPrice);
    }
    else{
      return (0, 0, address(0), 0);
    }
  }

  /// @dev Remove the listing for `tokenId`
  /// @param tokenId - identifier of the token being delisted
  function _removeListing(uint256 tokenId) internal virtual{
    address tokenOwner = ownerOf(tokenId);
    delete _listings[tokenId];
    emit UpdateListing(tokenId, tokenOwner, 0, 0, address(0), 0);
  }

  /// @dev Check if the token is for sale
  function _isForSale(uint256 tokenId) internal virtual returns(bool){
    if(_listings[tokenId].salePrice &gt; 0 &amp;&amp; _listings[tokenId].expires &gt;= block.timestamp){
        return true;
    }
    else{
        return false;
    }    
  }
  
  /// @dev Handle Value Added Royalty
  function _calculateRoyalties(
    uint256 tokenId,
    uint256 price,
    uint256 historicalPrice
    ) internal virtual returns(address, uint256){
    uint256 taxablePrice;
    if(price &gt; historicalPrice){
      taxablePrice = price - historicalPrice;
    }
    else{
      taxablePrice = 0 ;
    }

    (address royaltyRecipient, uint256 royalties) = royaltyInfo(tokenId, taxablePrice);
    return(royaltyRecipient, royalties);
  }

  /// @dev Process a `supportedToken` of `amount` payment to `recipient`.
  /// @param amount - the amount to send
  /// @param from - the payment payer
  /// @param recipient - the payment recipient
  /// @param supportedToken - contract addresses of supported ERC20 token or zero address
  ///                         The zero address indicates that the supported token is ETH
  function _processSupportedTokenPayment(
    uint256 amount,
    address from,
    address recipient,
    address supportedToken
    ) internal virtual{
    if(supportedToken == address(0))
    {
      (bool success,) = payable(recipient).call{value: amount}(&quot;&quot;);
      require(success, &quot;Ether Transfer Fail&quot;); 
    }
    else{
    (bool success) = IERC20(supportedToken).transferFrom(from, recipient, amount);
    require(success, &quot;Supported Token Transfer Fail&quot;);
    }
  }
  
  /// @dev See {IERC165-supportsInterface}.
  function supportsInterface(bytes4 interfaceId) public view virtual override (ERC721, ERC2981) returns (bool) {
     return interfaceId == type(IERC6105).interfaceId || super.supportsInterface(interfaceId);
  }

  /// @dev Before transferring the NFT, need to delete listing
  function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize) internal virtual override{
      super._beforeTokenTransfer(from, to, tokenId, batchSize);
      if(_isForSale(tokenId)){
          _removeListing(tokenId);
      }
  }
}
```

## Security Considerations

The `buyItem` function, as well as the `acceptCollectionOffer` and `acceptItemOffer` functions, has a potential front-running risk.  Must check that `salePrice` and `supportedToken` match the expected price and token to prevent front-running attacks

There is a potential re-entrancy risk with the `acceptCollectionOffer` and `acceptItemOffer` functions. Make sure to obey the checks, effects, interactions pattern or use a reentrancy guard.

If a buyer uses [ERC-20](./eip-20.md) tokens to purchase an NFT, the buyer needs to first call the `approve(address spender, uint256 amount)` function of the ERC-20 token to grant the NFT contract access to a certain `amount` of tokens. Please make sure to authorize an appropriate `amount`. Furthermore, caution is advised when dealing with non-audited contracts.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 02 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6105</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6105</guid>
      </item>
    
      <item>
        <title>Universal Token Router</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6120-universal-token-router/12142</comments>
        
        <description>## Abstract

The default transaction behavior of ETH is *transfer-and-call*, but the widely used [ERC-20](./eip-20.md) standard isn&apos;t compatible with this pattern. This incompatibility forces applications to use an inefficient and risky two-step *approve-then-call* 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.

The **Universal Token Router** (**UTR**) 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 **UTR**, they can only be spent in transactions signed directly by the token owner. The **UTR**&apos;s transaction data clearly shows key details like token types, amounts, and the recipient.

The **UTR** promotes the **security-by-result** model over the **security-by-process** model. By allowing applications to verify the output of a transaction (e.g., checking token balance changes), users&apos; funds can be secure even when interacting with potentially flawed or malicious contracts.

The **UTR** contract is deployed at `0x69c4620b62D99f524c5B4dE45442FE2D7dD59576` on all EVM-compatible networks using the [EIP-1014](./eip-1014.md) 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.

## Motivation

When users approve their tokens to a contract, they expect that:

* it only spends the tokens with their permission (from `msg.sender` or `ecrecover`)
* it does not use `delegatecall` (e.g. upgradable proxies)

The **UTR** 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 **all** approval transactions for new ones.

Before the **UTR**, users had to blindly trust the front-end code of applications to construct transactions honestly. This made them highly vulnerable to phishing. The **UTR**&apos;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.

Most existing application contracts are already compatible with the **UTR** and can integrate it to gain several benefits:

* Securely share a user&apos;s token allowance across all applications.
* Update their own peripheral contracts as often as needed without requiring new user approvals.
* Save development and security audit costs on their own router contracts.


## Specification

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.

The main interface of the UTR contract:

```solidity
interface IUniversalTokenRouter {
    function exec(
        Output[] memory outputs,
        Action[] memory actions
    ) payable;
}
```

### Output Verification

`Output` defines the expected token balance change for verification.

```solidity
struct Output {
    address recipient;
    uint eip;           // token standard: 0 for ETH or EIP number
    address token;      // token contract address
    uint id;            // token id for ERC-721 and ERC-1155
    uint amountOutMin;
}
```

Token balances of the `recipient` address are recorded at the beginning and the end of the `exec` function for each item in `outputs`. Transaction will revert with `INSUFFICIENT_OUTPUT_AMOUNT` if any of the balance changes are less than its `amountOutMin`.

A special id `ERC_721_BALANCE` is reserved for [ERC-721](./eip-721.md), which can be used in output actions to verify the total amount of all ids owned by the `recipient` address.

```solidity
ERC_721_BALANCE = keccak256(&apos;UniversalTokenRouter.ERC_721_BALANCE&apos;)
```

### Action

`Action` defines the token inputs and the contract call.

```solidity
struct Action {
    Input[] inputs;
    address code;       // contract code address
    bytes data;         // contract input data
}
```

The action code contract MUST implement the `NotToken` contract or the [ERC-165](./eip-165.md) interface with the ID `0x61206120` in order to be called by the UTR. This interface check prevents the direct invocation of token *allowance-spending* functions (e.g., `transferFrom`) by the UTR. Therefore, new token contracts MUST NOT implement this interface ID.

```solidity
/**
 * This contract will conflict with the ERC20, ERC721, and ERC1155 standards,
 * preventing token contracts from accidentally implementing it.
 */
abstract contract NotToken  {
    function allowance(address, address) external pure returns (string memory) {
        return &quot;THIS IS NOT A TOKEN&quot;;
    }
    function isApprovedForAll(address, address) external pure returns (string memory) {
        return &quot;THIS IS NOT A TOKEN&quot;;
    }
}

contract Application is NotToken {
    // this contract can be used with the UTR
}
```

### Input

`Input` defines the input token to transfer or prepare before the action contract is executed.

```solidity
struct Input {
    uint mode;
    address recipient;
    uint eip;           // token standard: 0 for ETH or EIP number
    address token;      // token contract address
    uint id;            // token id for ERC-721 and ERC-1155
    uint amountIn;
}
```

`mode` takes one of the following values:

* `PAYMENT = 0`: pend a payment for the token to be transferred from `msg.sender` to the `recipient` by calling `UTR.pay` from anywhere in the same transaction.
* `TRANSFER = 1`: transfer the token directly from `msg.sender` to the `recipient`.
* `CALL_VALUE = 2`: record the `ETH` amount to pass to the action as the call `value`.

Each input in the `inputs` argument is processed sequentially. For simplicity, duplicated `PAYMENT` and `CALL_VALUE` inputs are valid, but only the last `amountIn` value is used.

#### Payment Input

`PAYMENT` is the recommended mode for application contracts that use the *transfer-in-callback* pattern. E.g., flashloan contracts, Uniswap/v3-core, Derion, etc.

For each `Input` with `PAYMENT` mode, at most `amountIn` of the token can be transferred from `msg.sender` to the `recipient` by calling `UTR.pay` from anywhere in the same transaction.

```
UTR
 |
 | PAYMENT
 | (payments pended for UTR.pay)
 |
 |                                  Application Contracts
action.code.call ---------------------&gt; |
                                        |
UTR.pay &lt;----------------------- (call) |
                                        |
 | &lt;-------------------------- (return) |
 |
 | (clear all pending payments)
 |
END
```

Token&apos;s allowance and `PAYMENT` are essentially different as:

* allowance: allow a specific `spender` to transfer the token to anyone at any time.
* `PAYMENT`: allow anyone to transfer the token to a specific `recipient` only in that transaction.

##### Spend Payment

```solidity
interface IUniversalTokenRouter {
    function pay(bytes memory payment, uint amount);
}
```

To call `pay`, the `payment` param must be encoded as follows:

```solidity
payment = abi.encode(
    payer,      // address
    recipient,  // address
    eip,        // uint256
    token,      // address
    id          // uint256
);
```

The `payment` bytes can also be used by adapter UTR contracts to pass contexts and payloads for performing custom payment logic.

##### Discard Payment

Sometimes, it&apos;s useful to discard the payment instead of performing the transfer, for example, when the application contract wants to burn its own token from `payment.payer`. The following function can be used to verify the payment to the caller&apos;s address and discard a portion of it.

```solidity
interface IUniversalTokenRouter {
    function discard(bytes memory payment, uint amount);
}
```

Please refer to the [Discard Payment](#discard-payment-1) section in the **Security Considerations** for an important security note.

##### Sender Authentication

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&apos;s address for authentication, along with normal token transfers and payments.

```solidity
contract AuthChecker is NotToken {
    // must be trusted with a proper implementation of discard function
    address immutable UTR;

    function actionMustSentBySender(address sender) external {
        bytes memory payment = abi.encode(sender, address(this), 0, address(0), 0);
        IUniversalTokenRouter(UTR).discard(payment, 1);
    }
}
```

```javascript
await utr.exec([], [{
    inputs: [{
        mode: PAYMENT,
        eip: 0,
        token: AddressZero,
        id: 0,
        amountIn: 1,
        recipient: paymentTest.address,
    }],
    code: authChecker.address,
    data: (await authChecker.populateTransaction.actionMustSentBySender(owner.address)).data,
}])
```

Please refer to the [Discard Payment](#discard-payment-1) section in the **Security Considerations** for an important security note.

##### Payment Lifetime

Payments are recorded in the UTR storage and intended to be spent by `input.action` external calls only within that transaction. All payment storages will be cleared before the `UTR.exec` ends.

### Native Token Tranfer

The `UTR` SHOULD have a `receive()` function for user execution logic that requires transferring ETH in. The `msg.value` transferred into the router can be spent in multiple inputs across different actions. While the caller takes full responsibility for the movement of `ETH` in and out of the router, the `exec` function SHOULD refund any remaining `ETH` before the function ends.

Please refer to the [Reentrancy](#reentrancy) section in the **Security Considerations** for information on reentrancy risks and mitigation.

### Usage Examples

#### Uniswap V2 Router

Legacy function:

```solidity
UniswapV2Router01.swapExactTokensForTokens(
    uint amountIn,
    uint amountOutMin,
    address[] calldata path,
    address to,
    uint deadline
)
```

`UniswapV2Helper01.swapExactTokensForTokens` is a modified version of it without the token transfer part.

This transaction is signed by users to execute the swap instead of the legacy function:

```javascript
UniversalTokenRouter.exec([{
    recipient: to,
    eip: 20,
    token: path[path.length-1],
    id: 0,
    amountOutMin,
}], [{
    inputs: [{
        mode: TRANSFER,
        recipient: UniswapV2Library.pairFor(factory, path[0], path[1]),
        eip: 20,
        token: path[0],
        id: 0,
        amountIn: amountIn,
    }],
    code: UniswapV2Helper01.address,
    data: encodeFunctionData(&quot;swapExactTokensForTokens&quot;, [
        amountIn,
        amountOutMin,
        path,
        to,
        deadline,
    ]),
}])
```

#### Uniswap V3 Router

Legacy router contract:

```solidity
contract SwapRouter {
    // this function is called by pool to pay the input tokens
    function pay(
        address token,
        address payer,
        address recipient,
        uint256 value
    ) internal {
        ...
        // pull payment
        TransferHelper.safeTransferFrom(token, payer, recipient, value);
    }
}
```

The helper contract to use with the `UTR`:

```solidity
contract SwapHelper {
    // this function is called by pool to pay the input tokens
    function pay(
        address token,
        address payer,
        address recipient,
        uint256 value
    ) internal {
        ...
        // pull payment
        bytes memory payment = abi.encode(payer, recipient, 20, token, 0);
        UTR.pay(payment, value);
    }
}
```

This transaction is signed by users to execute the `exactInput` functionality using `PAYMENT` mode:

```javascript
UniversalTokenRouter.exec([{
    eip: 20,
    token: tokenOut,
    id: 0,
    amountOutMin: 1,
    recipient: to,
}], [{
    inputs: [{
        mode: PAYMENT,
        eip: 20,
        token: tokenIn,
        id: 0,
        amountIn: amountIn,
        recipient: pool.address,
    }],
    code: SwapHelper.address,
    data: encodeFunctionData(&quot;exactInput&quot;, [...]),
}])
```

#### Allowance Adapter

A simple non-reentrancy ERC-20 adapter for aplication and router contracts that use direct allowance.

```solidity
contract AllowanceAdapter is ReentrancyGuard {
    struct Input {
        address token;
        uint amountIn;
    }

    function approveAndCall(
        Input[] memory inputs,
        address spender,
        bytes memory data,
        address leftOverRecipient
    ) external payable nonReentrant {
        for (uint i = 0; i &lt; inputs.length; ++i) {
            Input memory input = inputs[i];
            IERC20(input.token).approve(spender, input.amountIn);
        }

        (bool success, bytes memory result) = spender.call{value: msg.value}(data);
        if (!success) {
            assembly {
                revert(add(result, 32), mload(result))
            }
        }

        for (uint i = 0; i &lt; inputs.length; ++i) {
            Input memory input = inputs[i];
            // clear all allowance
            IERC20(input.token).approve(spender, 0);
            uint leftOver = IERC20(input.token).balanceOf(address(this));
            if (leftOver &gt; 0) {
                TransferHelper.safeTransfer(input.token, leftOverRecipient, leftOver);
            }
        }
    }
}
```

This transaction is constructed to utilize the `UTR` to interact with Uniswap V2 Router without approving any token to it:

```javascript
const { data: routerData } = await uniswapRouter.populateTransaction.swapExactTokensForTokens(
    amountIn,
    amountOutMin,
    path,
    to,
    deadline,
)

const { data: adapterData } = await adapter.populateTransaction.approveAndCall(
    [{
        token: path[0],
        amountIn,
    }],
    uniswapRouter.address,
    routerData,
    leftOverRecipient,
)

await utr.exec([], [{
    inputs: [{
        mode: TRANSFER,
        recipient: adapter.address,
        eip: 20,
        token: path[0],
        id: 0,
        amountIn,
    }],
    code: adapter.address,
    data: adapterData,
}])
```

## Rationale

The `Permit` type signature is not supported since the purpose of the Universal Token Router is to eliminate all interactive `approve` signatures for new tokens, and *most* for old tokens.

## Backwards Compatibility

### Tokens

Old token contracts (ERC-20, ERC-721 and [ERC-1155](./eip-1155.md)) require approval for the Universal Token Router once for each account.

New token contracts can pre-configure the Universal Token Router as a trusted spender, and no approval transaction is required for interactive usage.

```solidity
import &quot;@openzeppelin/contracts/token/ERC20/ERC20.sol&quot;;

/**
 * @dev Implementation of the {ERC20} token standard that support a trusted ERC6120 contract as an unlimited spender.
 */
contract ERC20WithUTR is ERC20 {
    address immutable UTR;

    /**
     * @dev Sets the values for {name}, {symbol} and ERC6120&apos;s {utr} address.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     *
     * @param utr can be zero to disable trusted ERC6120 support.
     */
    constructor(string memory name, string memory symbol, address utr) ERC20(name, symbol) {
        UTR = utr;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        if (spender == UTR &amp;&amp; spender != address(0)) {
            return type(uint256).max;
        }
        return super.allowance(owner, spender);
    }

    /**
     * Does not check or update the allowance if `spender` is the UTR.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual override {
        if (spender == UTR &amp;&amp; spender != address(0)) {
            return;
        }
        super._spendAllowance(owner, spender, amount);
    }
}
```

### Applications

The only application contracts **INCOMPATIBLE** with the UTR are contracts that use `msg.sender` as the beneficiary address in their internal storage without any function for ownership transfer.

All application contracts that accept `recipient` (or `to`) argument as the beneficiary address are compatible with the UTR out of the box.

Application contracts that transfer tokens (ERC-20, ERC-721, and ERC-1155) to `msg.sender` need additional adapters to add a `recipient` to their functions.

```solidity
// sample adapter contract for WETH
contract WethAdapter {
    function deposit(address recipient) external payable {
        IWETH(WETH).deposit(){value: msg.value};
        TransferHelper.safeTransfer(WETH, recipient, msg.value);
    }
}
```

Additional helper and adapter contracts might be needed, but they&apos;re mostly peripheral and non-intrusive. They don&apos;t hold any tokens or allowances, so they can be frequently updated and have little to no security impact on the core application contracts.

## Reference Implementation

A reference implementation by Derion Labs and audited by Hacken.

```solidity
/// @title The implementation of the EIP-6120.
/// @author Derion Labs
contract UniversalTokenRouter is ERC165, IUniversalTokenRouter {
    uint256 constant PAYMENT       = 0;
    uint256 constant TRANSFER      = 1;
    uint256 constant CALL_VALUE    = 2;

    uint256 constant EIP_ETH       = 0;

    uint256 constant ERC_721_BALANCE = uint256(keccak256(&apos;UniversalTokenRouter.ERC_721_BALANCE&apos;));

    /// The main entry point of the router
    /// @param outputs token behavior for output verification
    /// @param actions router actions and inputs for execution
    function exec(
        Output[] memory outputs,
        Action[] memory actions
    ) external payable virtual override {
    unchecked {
        // track the expected balances before any action is executed
        for (uint256 i = 0; i &lt; outputs.length; ++i) {
            Output memory output = outputs[i];
            uint256 balance = _balanceOf(output);
            uint256 expected = output.amountOutMin + balance;
            require(expected &gt;= balance, &apos;UTR: OUTPUT_BALANCE_OVERFLOW&apos;);
            output.amountOutMin = expected;
        }

        for (uint256 i = 0; i &lt; actions.length; ++i) {
            Action memory action = actions[i];
            uint256 value;
            for (uint256 j = 0; j &lt; action.inputs.length; ++j) {
                Input memory input = action.inputs[j];
                uint256 mode = input.mode;
                if (mode == CALL_VALUE) {
                    // eip and id are ignored
                    value = input.amountIn;
                } else {
                    if (mode == PAYMENT) {
                        bytes32 key = keccak256(abi.encode(
                            msg.sender, input.recipient, input.eip, input.token, input.id
                        ));
                        uint amountIn = input.amountIn;
                        assembly {
                            tstore(key, amountIn)
                        }
                    } else if (mode == TRANSFER) {
                        _transferToken(msg.sender, input.recipient, input.eip, input.token, input.id, input.amountIn);
                    } else {
                        revert(&apos;UTR: INVALID_MODE&apos;);
                    }
                }
            }
            if (action.code != address(0) || action.data.length &gt; 0 || value &gt; 0) {
                require(
                    TokenChecker.isNotToken(action.code) ||
                    ERC165Checker.supportsInterface(action.code, 0x61206120),
                    &quot;UTR: NOT_CALLABLE&quot;
                );
                (bool success, bytes memory result) = action.code.call{value: value}(action.data);
                if (!success) {
                    assembly {
                        revert(add(result,32),mload(result))
                    }
                }
            }
            // clear all transient storages
            for (uint256 j = 0; j &lt; action.inputs.length; ++j) {
                Input memory input = action.inputs[j];
                if (input.mode == PAYMENT) {
                    // transient storages
                    bytes32 key = keccak256(abi.encode(
                        msg.sender, input.recipient, input.eip, input.token, input.id
                    ));
                    assembly {
                        tstore(key, 0)
                    }
                }
            }
        }

        // refund any left-over ETH
        uint256 leftOver = address(this).balance;
        if (leftOver &gt; 0) {
            TransferHelper.safeTransferETH(msg.sender, leftOver);
        }

        // verify balance changes
        for (uint256 i = 0; i &lt; outputs.length; ++i) {
            Output memory output = outputs[i];
            uint256 balance = _balanceOf(output);
            // NOTE: output.amountOutMin is reused as `expected`
            require(balance &gt;= output.amountOutMin, &apos;UTR: INSUFFICIENT_OUTPUT_AMOUNT&apos;);
        }
    } }
    
    /// Spend the pending payment. Intended to be called from the input.action.
    /// @param payment encoded payment data
    /// @param amount token amount to pay with payment
    function pay(bytes memory payment, uint256 amount) external virtual override {
        discard(payment, amount);
        (
            address sender,
            address recipient,
            uint256 eip,
            address token,
            uint256 id
        ) = abi.decode(payment, (address, address, uint256, address, uint256));
        _transferToken(sender, recipient, eip, token, id, amount);
    }

    /// Discard a part of a pending payment. Can be called from the input.action
    /// to verify the payment without transferring any token.
    /// @param payment encoded payment data
    /// @param amount token amount to pay with payment
    function discard(bytes memory payment, uint256 amount) public virtual override {
        bytes32 key = keccak256(payment);
        uint256 remain;
        assembly {
            remain := tload(key)
        }
        require(remain &gt;= amount, &apos;UTR: INSUFFICIENT_PAYMENT&apos;);
        assembly {
            tstore(key, sub(remain, amount))
        }
    }

    // IERC165-supportsInterface
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return
            interfaceId == type(IUniversalTokenRouter).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    function _transferToken(
        address sender,
        address recipient,
        uint256 eip,
        address token,
        uint256 id,
        uint256 amount
    ) internal virtual {
        if (eip == 20) {
            TransferHelper.safeTransferFrom(token, sender, recipient, amount);
        } else if (eip == 1155) {
            IERC1155(token).safeTransferFrom(sender, recipient, id, amount, &quot;&quot;);
        } else if (eip == 721) {
            IERC721(token).safeTransferFrom(sender, recipient, id);
        } else {
            revert(&quot;UTR: INVALID_EIP&quot;);
        }
    }

    function _balanceOf(
        Output memory output
    ) internal view virtual returns (uint256 balance) {
        uint256 eip = output.eip;
        if (eip == 20) {
            return IERC20(output.token).balanceOf(output.recipient);
        }
        if (eip == 1155) {
            return IERC1155(output.token).balanceOf(output.recipient, output.id);
        }
        if (eip == 721) {
            if (output.id == ERC_721_BALANCE) {
                return IERC721(output.token).balanceOf(output.recipient);
            }
            try IERC721(output.token).ownerOf(output.id) returns (address currentOwner) {
                return currentOwner == output.recipient ? 1 : 0;
            } catch {
                return 0;
            }
        }
        if (eip == EIP_ETH) {
            return output.recipient.balance;
        }
        revert(&quot;UTR: INVALID_EIP&quot;);
    }
}
```

## Security Considerations

### ERC-165 Tokens

Token contracts must **NEVER** support the ERC-165 interface with the ID `0x61206120`, as it is reserved for non-token contracts to be called with the UTR. Any token with the interface ID `0x61206120` approved to the UTR can be spent by anyone, without any restrictions.

### Reentrancy

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.

ETH must be transferred to the UTR contracts before the value is spent in an action call (using `CALL_VALUE`). 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&apos;t transfer more ETH than they will spend in that transaction.

```solidity
// transfer 100 in, but spend only 60,
// so at most 40 wei can be exploited in this transaction
UniversalTokenRouter.exec([
    ...
], [{
    inputs: [{
        mode: CALL_VALUE,
        eip: 20,
        token: 0,
        id: 0,
        amountIn: 60,   // spend 60
        recipient: AddressZero,
    }],
    ...
}], {
    value: 100,   // transfer 100 in
})
```

### Discard Payment

The result of the `pay` 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 `discard` function, it should only be used with a trusted UTR contract.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 12 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6120</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6120</guid>
      </item>
    
      <item>
        <title>Smart Derivative Contract</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6123-smart-derivative-contract-frictionless-processing-of-financial-derivatives/12134</comments>
        
        <description>## Abstract

The Smart Derivative Contract (SDC) allows fully automizing and securing a financial product&apos;s - e.g. a financial derivative or bond - complete trade life cycle.[^1]
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 [ERC-20](./eip-20.md) token.
Proof of concepts in terms of two legally binding digital Interest Rate Swaps were conducted in 2021 and 2022.

## Motivation

### Rethinking Financial Derivatives

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.

### Concept of a Smart Derivative Contract

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&apos;s life cycle. An [ERC-20](./eip-20.md) 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 [ERC-20](./eip-20.md).
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.

### Applications

The interface&apos;s life cycle functionality applies to several use cases.

#### Settle-to-Market OTC Derivative

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.

#### Callateralized OTC Derivative

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.

#### Defaultable OTC Derivative

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 &apos;Failure to Pay&apos; if a settlement cannot be conducted.

#### Smart Bond Contract

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.

## Specification

The methods and event are separated into different interfaces:

- `ISDCTrade` - events and functions related to trade inception, confirmation and termination.
- `ISDCSettlement` - events and functions related to the settlement life-cycle of a trade.
- `IAsyncTransferCallback` - events and the callback function `afterTransfer` for settlements that utilize and external payment system.
- `IAsyncTransfer` - events and functions related to async transfer (e.g., for external payment systems).

The `ISDC` interface is the aggregation of `ISDCTrade`, `ISDCSettlement` and `IAsyncTransferCallback`.

### Methods of `ISDCTrade`

The following methods specify a Smart Derivative Contract&apos;s trade initiation, trade termination and settlement life cycle. For further information, please also look at the interface documentation `ISDC.sol`.

#### Trade Initiation Phase: `inceptTrade`

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.

```solidity
function inceptTrade(address withParty, string memory tradeData, int position, int256 paymentAmount, string memory initialSettlementData) external returns (string memory);
```

The position and the paymentAmount are viewed from the incepter.
The function will return a generated unique `tradeId`. The trade id will also be emitted by an event.

#### Trade Initiation Phase: `confirmTrade`

A counterparty can confirm a trade by providing its trade specification data, which then gets matched against the data stored from `inceptTrade` call.

```solidity
function confirmTrade(address withParty, string memory tradeData, int position, int256 paymentAmount, string memory initialSettlementData) external;
```

Here, the position and the paymentAmount is viewed from the confimer (opposite sign compared to the call to `inceptTrade`).

#### Trade Initiation Phase: `cancelTrade`

The counterparty that called `inceptTrade` has the option to cancel the trade, e.g., in the case where the trade is not confirmed in a timely manner.

```solidity
function cancelTrade(address withParty, string memory tradeData, int position, int256 paymentAmount, string memory initialSettlementData) external;
```

#### Trade Termination: `requestTermination`

Allows an eligible party to request a mutual termination of the trade with the corresponding `tradeId` with a termination amount she is willing to pay and provide further termination terms (e.g. an XML)

```solidity
function requestTradeTermination(string memory tradeId, int256 terminationPayment, string memory terminationTerms) external;
```

#### Trade Termination: `confirmTradeTermination`

Allows an eligible party to confirm a previously requested (mutual) trade termination, including termination payment value and termination terms

```solidity
function confirmTradeTermination(string memory tradeId, int256 terminationPayment, string memory terminationTerms) external;
```

#### Trade Termination: `cancelTradeTermination`

The party that initiated `requestTradeTermination` has the option to withdraw the request, e.g., in the case where the termination is not confirmed in a timely manner.

```solidity
function cancelTradeTermination(string memory tradeId, int256 terminationPayment, string memory terminationTerms) external;
```

### Methods of `ISDCSettlement`

#### Settlement Phase: `initiateSettlement`

Allows eligible participants (such as counterparties or a delegated agent) to trigger a settlement phase.

```solidity
function initiateSettlement() external;
```

#### Settlement Phase: `performSettlement`

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.

The method may perform a synchonous transfer of the settlement or make use of an `IAsyncTransfer`, which will finalize the
transfer though the callback `afterTransfer`.

The transactionData is emitted as part of the corresponding event: `SettlementTransferred` or `SettlementFailed`
This might result in a termination or start of the next settlement phase, depending on the provided success flag.

The parameter `settlementData` will be ussed as `lastSettlementData` as part of the `SettlementRequested` 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.

```solidity
function performSettlement(int256 settlementAmount, string memory settlementData) external;
```

#### Settlement Phase: `afterSettlement`

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).

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).

- An implementation that uses adjusting of pre-funding can check the pre-funding within this method.
- An implementation that checked a static pre-funding upon confirmation of the trade might not require this step. 

In any case, the method may trigger termination if the settlement failed.

Emits a `SettlementTransferred` or a `SettlementFailed` event. May emit a `TradeTerminated` event.

```solidity
function afterSettlement() external;
```

### Methods of `IAsyncTransferCallback`

#### Settlement Phase: `afterTransfer`

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: `SettlementTransferred` or `SettlementFailed`
This might result in a termination or start of the next settlement phase, depending on the provided success flag.

```solidity
function afterTransfer(bool success, uint256 transactionID, string memory transactionData) external;
```

### Trade Events

The following events are emitted during an SDC Trade life-cycle.

#### TradeIncepted

Emitted on trade inception - method &apos;inceptTrade&apos;

```solidity
event TradeIncepted(address initiator, string tradeId, string tradeData);
```

#### TradeConfirmed

Emitted on trade confirmation - method &apos;confirmTrade&apos;

```solidity
event TradeConfirmed(address confirmer, string tradeId);
```

#### TradeCanceled

Emitted on trade cancellation - method &apos;cancelTrade&apos;

```solidity
event TradeCanceled(address initiator, string tradeId);
```

#### TradeActivated

Emitted when a Trade is activated

```solidity
event TradeActivated(string tradeId);
```

#### TradeTerminationRequest

Emitted when termination request is initiated by a counterparty

```solidity
event TradeTerminationRequest(address initiator, string tradeId, int256 terminationPayment, string terminationTerms);
```

#### TradeTerminationConfirmed

Emitted when termination request is confirmed by a counterparty

```solidity
event TradeTerminationConfirmed(address confirmer, string tradeId, int256 terminationPayment, string terminationTerms);
```

#### TradeTerminationCanceled

Emitted when termination request is canceled by the requesting counterparty

```solidity
event TradeTerminationCanceled(address initiator, string tradeId, string terminationTerms);
```

#### TradeTerminated

Emitted when trade is terminated

```solidity
event TradeTerminated(string cause);
```


### Settlement Events

The following events are emitted during the settlement phases.

#### SettlementRequested

Emitted when a settlement is requested (via `initiateSettlement`). May trigger the settlement phase.

The argument `lastSettlementData` is the one that was passed upon a previous settlement
in `performSettlement` (under the name `settlementData`). 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 `settlementData` via `performSettlement`
and pick it up in the `SettlementRequested` event (allows for stateless external oracles).

```solidity
event SettlementRequested(address initiator, string tradeData, string lastSettlementData);
```

#### SettlementDetermined

Emitted when the settlement phase is started (via `performSettlement`).

```solidity
event SettlementDetermined(address initiator, int256 settlementAmount, string settlementData);
```

#### SettlementTransferred

Emitted when the settlement succeeded.

```solidity
event SettlementTransferred(string transactionData);
```

#### SettlementFailed

Emitted when the settlement failed.

```solidity
event SettlementFailed(string transactionData);
```


## Rationale

The interface design and reference implementation are based on the following considerations:

- 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.
- The provided interface specification is supposed to completely reflect the entire trade life cycle.
- The interface specification is generic enough to handle the case that parties process one or even multiple financial transactions (on a netted base)
- 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
- A pull-based valuation-based oracle pattern can be implemented by using the provided callback pattern (methods: `initiateSettlement`, `performSettlement`)
- The reference implementation `SDCSingleTrade.sol` 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
- The interface allows the extension to multiple trades with common (netted) settlement.

### State diagram of trade and process states

![image info](../assets/eip-6123/doc/sdc_trade_states.svg)

The diagram shows the trade states of a single trade SDC as in `SDCSingleTrade.sol`.

### Sequence diagram of reference implementation &apos;SDCPledgedBalance.sol&apos;

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

- utilizes an asynchronous settlement through a settlement token (see the interface `IAsyncTransfer`, `IAsyncTransferCallback`)
- receives the trigger `afterSettlement` to perfrom checks of settlement pre-conditions (see the corresponding method description `afterSettlement`)

![image info](../assets/eip-6123/doc/sequence.svg)

### Sequence diagram of an implementation variant with a separate collateral account

The following sequence diagram shows the implementation variant with a separate collateral account.
This diagram show the settlement phase.

![image info](../assets/eip-6123/doc/sequence-sdc-collateral-settlement.svg)

## Test Cases

Life-cycle unit tests based on the sample implementation and usage of [ERC-20](./eip-20.md) token is provided. See file [test/SDCTests.js](../assets/eip-6123/test/SDCTests.js)
).

## Reference Implementation

An abstract contract class `SDCSingleTrade.sol` for single trade SDCs as well as a full reference implementation SDCPledgedBalance.sol for an OTC-Derivative is provided and is based on the [ERC-20](./eip-20.md) token standard.
See folder `/assets/contracts`, more explanation on the implementation is provided inline.

### Trade Data Specification (suggestion)

Please take a look at the provided xml file as a suggestion on how trade parameters could be stored.

## Security Considerations

No known security issues up to now.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

[^1]:
```csl-json
    {
        &quot;type&quot;: &quot;article-journal&quot;,
        &quot;id&quot;: &quot;ssrn-3163074&quot;,
        &quot;title&quot;: &quot;Smart Derivative Contracts (Detaching Transactions from Counterparty Credit Risk: Specification, Parametrisation, Valuation)&quot;,
        &quot;author&quot;: [
        { &quot;family&quot;: &quot;Fries&quot;, &quot;given&quot;: &quot;Christian P.&quot; },
        { &quot;family&quot;: &quot;Kohl-Landgraf&quot;, &quot;given&quot;: &quot;Peter&quot; }
        ],
        &quot;container-title&quot;: &quot;SSRN Electronic Journal&quot;,
        &quot;DOI&quot;: &quot;10.2139/ssrn.3163074&quot;,
        &quot;ISSN&quot;: &quot;1556-5068&quot;,
        &quot;URL&quot;: &quot;https://ssrn.com/abstract=3163074&quot;,
        &quot;issued&quot;: { &quot;date-parts&quot;: [[2018, 4, 24]] },
        &quot;original-date&quot;: { &quot;date-parts&quot;: [[2018, 4, 15]] },
        &quot;note&quot;: &quot;Last revised: 2019-01-09&quot;,
        &quot;number-of-pages&quot;: &quot;22&quot;,
        &quot;keyword&quot;: &quot;Collateralization, CCP, Initial Margin, Smart Contract, Settlement Risk, Gap Risk&quot;,
        &quot;language&quot;: &quot;en&quot;,
        &quot;source&quot;: &quot;SSRN&quot;
    }
```

[^2]:
```csl-json
    {
        &quot;type&quot;: &quot;article-journal&quot;,
        &quot;id&quot;: &quot;ssrn-5454714&quot;,
        &quot;title&quot;: &quot;A Smart Derivative Contract with Collateral&quot;,
        &quot;author&quot;: [
        { &quot;family&quot;: &quot;Fries&quot;, &quot;given&quot;: &quot;Christian P.&quot; },
        { &quot;family&quot;: &quot;Kohl-Landgraf&quot;, &quot;given&quot;: &quot;Peter&quot; },
        { &quot;family&quot;: &quot;Prandtl&quot;, &quot;given&quot;: &quot;Raphael&quot; },
        { &quot;family&quot;: &quot;Schütte&quot;, &quot;given&quot;: &quot;Wilfried&quot; }
        ],
        &quot;container-title&quot;: &quot;SSRN Electronic Journal&quot;,
        &quot;DOI&quot;: &quot;10.2139/ssrn.5454714&quot;,
        &quot;ISSN&quot;: &quot;1556-5068&quot;,
        &quot;URL&quot;: &quot;https://ssrn.com/abstract=5454714&quot;,
        &quot;issued&quot;: { &quot;date-parts&quot;: [[2025, 9, 8]] },
        &quot;original-date&quot;: { &quot;date-parts&quot;: [[2025, 8, 24]] },
        &quot;note&quot;: &quot;Last revised: 2025-09-25&quot;,
        &quot;number-of-pages&quot;: &quot;19&quot;,
        &quot;keyword&quot;: &quot;Smart Contract, Settlement, Collateralisation, ERC-6123, Counterparty Credit Risk, Repo&quot;,
        &quot;language&quot;: &quot;en&quot;,
        &quot;source&quot;: &quot;SSRN&quot;
    }
```
</description>
        <pubDate>Tue, 13 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6123</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6123</guid>
      </item>
    
      <item>
        <title>Guard of NFT/SBT, an Extension of ERC-721</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/guard-of-nft-sbt-an-extension-of-eip-721/12052</comments>
        
        <description>## Abstract

This standard is an extension of [ERC-721](./eip-721.md). It separates the holding right and transfer right of non-fungible tokens (NFTs) and Soulbound Tokens (SBTs) and defines a new role, `guard` with `expires`. The flexibility of the `guard` setting enables the design of NFT anti-theft, NFT lending, NFT leasing, SBT, etc.

## Motivation

NFTs are assets that possess both use and financial value.

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.

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.

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. 

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.

## Specification

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.

ERC-721 compliant contracts MAY implement this EIP.

A guard Must be valid only before expires.

When a token has no guard or the guard is expired, `guardInfo` MUST return `(address(0), 0)`.

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.
  
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.
  
When a token has a valid guard, `guardInfo` MUST return the address and expires of the guard.
  
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.

When a token has a valid guard, if the token burns, the guard MUST be deleted.

If issuing or minting SBTs, the guard MAY be uniformly set to the designated address to facilitate management. 

### Contract Interface
  
```solidity
 interface IERC6147 {

    /// Logged when the guard of an NFT is changed or expires is changed
    /// @notice Emitted when the `guard` is changed or the `expires` is changed
    ///         The zero address for `newGuard` indicates that there currently is no guard address
    event UpdateGuardLog(uint256 indexed tokenId, address indexed newGuard, address oldGuard, uint64 expires);
    
    /// @notice Owner, authorised operators and approved address of the NFT can set guard and expires of the NFT and
    ///         valid guard can modifiy guard and expires of the NFT
    ///         If the NFT has a valid guard role, the owner, authorised operators and approved address of the NFT
    ///         cannot modify guard and expires
    /// @dev The `newGuard` can not be zero address
    ///      The `expires` need to be valid
    ///      Throws if `tokenId` is not valid NFT
    /// @param tokenId The NFT to get the guard address for
    /// @param newGuard The new guard address of the NFT
    /// @param expires UNIX timestamp, the guard could manage the token before expires
    function changeGuard(uint256 tokenId, address newGuard, uint64 expires) external;

    /// @notice Remove the guard and expires of the NFT
    ///         Only guard can remove its own guard role and expires
    /// @dev The guard address is set to 0 address
    ///      The expires is set to 0
    ///      Throws if `tokenId` is not valid NFT
    /// @param tokenId The NFT to remove the guard and expires for
    function removeGuard(uint256 tokenId) external;
    
    /// @notice Transfer the NFT and remove its guard and expires
    /// @dev The NFT is transferred to `to` and the guard address is set to 0 address
    ///      Throws if `tokenId` is not valid NFT
    /// @param from The address of the previous owner of the NFT
    /// @param to The address of NFT recipient 
    /// @param tokenId The NFT to get transferred for
    function transferAndRemove(address from, address to, uint256 tokenId) external;

    /// @notice Get the guard address and expires of the NFT
    /// @dev The zero address indicates that there is no guard
    /// @param tokenId The NFT to get the guard address and expires for
    /// @return The guard address and expires for the NFT
   function guardInfo(uint256 tokenId) external view returns (address, uint64);   
}
  ```

The `changeGuard(uint256 tokenId, address newGuard, uint64 expires)` function MAY be implemented as `public` or `external`.

The `removeGuard(uint256 tokenId)` function MAY be implemented as `public` or `external`.

The `transferAndRemove(address from,address to,uint256 tokenId)` function MAY be implemented as `public` or `external`.

The `guardInfo(uint256 tokenId)` function MAY be implemented as `pure` or `view`.

The `UpdateGuardLog` event MUST be emitted when a guard is changed.

The `supportsInterface` method MUST return `true` when called with `0xb61d1057`.

## Rationale 

### Universality

There are many application scenarios for NFT/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/SBT into holding right and transfer right making the standard more universal.

For example, the standard has more than the following use cases:

SBTs. The SBTs issuer can assign a uniform role of `guard` 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 `guard`.

NFT anti-theft. If an NFT holder sets a `guard` 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.

NFT lending. The borrower sets the `guard` of his or her own NFT as the lender&apos;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.

Additionally, by setting an `expires` for the `guard`, the scalability of the protocol is further enhanced, as demonstrated in the following examples:

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&apos; usability.

More secure NFT management. Even if the `guard` address becomes inaccessible due to lost private keys, the `owner` can still retrieve the NFT after the `guard` has expired.

Valid SBTs. Some SBTs have a period of use. More effective management can be achieved through `guard` and `expires`.

### Extensibility
  
This standard only defines a `guard` and its `expires`. For complex functions needed by NFTs and SBTs, such as social recovery and multi-signature, the `guard` 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. 

### Naming

The alternative names are `guardian` and `guard`, both of which basically match the permissions corresponding to the role: protection of NFT or necessary management according to its application scenarios. The `guard` has fewer characters than the `guardian` and is more concise.

## Backwards Compatibility

This standard can be fully ERC-721 compatible by adding an extension function set.

If an NFT issued based on the above standard does not set a `guard`, then it is no different in the existing functions from the current NFT issued based on the ERC-721 standard.

## Reference Implementation
  
```solidity

// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.8;

import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;./IERC6147.sol&quot;;

abstract contract ERC6147 is ERC721, IERC6147 {

    /// @dev A structure representing a token of guard address and expires
    /// @param guard address of guard role
    /// @param expirs UNIX timestamp, the guard could manage the token before expires
    struct GuardInfo{
        address guard;
        uint64 expires;
    }
    
    mapping(uint256 =&gt; GuardInfo) internal _guardInfo;

    /// @notice Owner, authorised operators and approved address of the NFT can set guard and expires of the NFT and
    ///         valid guard can modifiy guard and expires of the NFT
    ///         If the NFT has a valid guard role, the owner, authorised operators and approved address of the NFT
    ///         cannot modify guard and expires
    /// @dev The `newGuard` can not be zero address
    ///      The `expires` need to be valid
    ///      Throws if `tokenId` is not valid NFT
    /// @param tokenId The NFT to get the guard address for
    /// @param newGuard The new guard address of the NFT
    /// @param expires UNIX timestamp, the guard could manage the token before expires
    function changeGuard(uint256 tokenId, address newGuard, uint64 expires) public virtual{
        require(expires &gt; block.timestamp, &quot;ERC6147: invalid expires&quot;);
        _updateGuard(tokenId, newGuard, expires, false);
    }

    /// @notice Remove the guard and expires of the NFT
    ///         Only guard can remove its own guard role and expires
    /// @dev The guard address is set to 0 address
    ///      The expires is set to 0
    ///      Throws if `tokenId` is not valid NFT
    /// @param tokenId The NFT to remove the guard and expires for
    function removeGuard(uint256 tokenId) public virtual  {
        _updateGuard(tokenId, address(0), 0, true);
    }
    
    /// @notice Transfer the NFT and remove its guard and expires
    /// @dev The NFT is transferred to `to` and the guard address is set to 0 address
    ///      Throws if `tokenId` is not valid NFT
    /// @param from The address of the previous owner of the NFT
    /// @param to The address of NFT recipient 
    /// @param tokenId The NFT to get transferred for
    function transferAndRemove(address from, address to, uint256 tokenId) public virtual {
        safeTransferFrom(from, to, tokenId);
        removeGuard(tokenId);
    }
    
    /// @notice Get the guard address and expires of the NFT
    /// @dev The zero address indicates that there is no guard
    /// @param tokenId The NFT to get the guard address and expires for
    /// @return The guard address and expires for the NFT
    function guardInfo(uint256 tokenId) public view virtual returns (address, uint64) {
        if(_guardInfo[tokenId].expires &gt;= block.timestamp){
            return (_guardInfo[tokenId].guard, _guardInfo[tokenId].expires);
        }
        else{
            return (address(0), 0);
        }
    }

    /// @notice Update the guard of the NFT
    /// @dev Delete function: set guard to 0 address and set expires to 0; 
    ///      and update function: set guard to new address and set expires
    ///      Throws if `tokenId` is not valid NFT
    /// @param tokenId The NFT to update the guard address for
    /// @param newGuard The newGuard address
    /// @param expires UNIX timestamp, the guard could manage the token before expires
    /// @param allowNull Allow 0 address
    function _updateGuard(uint256 tokenId, address newGuard, uint64 expires, bool allowNull) internal {
        (address guard,) = guardInfo(tokenId);
        if (!allowNull) {
            require(newGuard != address(0), &quot;ERC6147: new guard can not be null&quot;);
        }
        if (guard != address(0)) { 
            require(guard == _msgSender(), &quot;ERC6147: only guard can change it self&quot;); 
        } else { 
            require(_isApprovedOrOwner(_msgSender(), tokenId), &quot;ERC6147: caller is not owner nor approved&quot;);
        } 

        if (guard != address(0) || newGuard != address(0)) {
            _guardInfo[tokenId] = GuardInfo(newGuard,expires);
            emit UpdateGuardLog(tokenId, newGuard, guard, expires);
        }
    }
    
    /// @notice Check the guard address
    /// @dev The zero address indicates there is no guard
    /// @param tokenId The NFT to check the guard address for
    /// @return The guard address
    function _checkGuard(uint256 tokenId) internal view returns (address) {
        (address guard, ) = guardInfo(tokenId);
        address sender = _msgSender();
        if (guard != address(0)) {
            require(guard == sender, &quot;ERC6147: sender is not guard of the token&quot;);
            return guard;
        }else{
            return address(0);
        }
    }
 
    /// @dev Before transferring the NFT, need to check the gurard address
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        address guard;
        address new_from = from;
        if (from != address(0)) {
            guard = _checkGuard(tokenId);
            new_from = ownerOf(tokenId);
        }
        if (guard == address(0)) {
            require(
                _isApprovedOrOwner(_msgSender(), tokenId),
                &quot;ERC721: transfer caller is not owner nor approved&quot;
            );
        }
        _transfer(new_from, to, tokenId);
    }

    /// @dev Before safe transferring the NFT, need to check the gurard address
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
        address guard;
        address new_from = from;
        if (from != address(0)) {
            guard = _checkGuard(tokenId);
            new_from = ownerOf(tokenId);
        }
        if (guard == address(0)) {
            require(
                _isApprovedOrOwner(_msgSender(), tokenId),
                &quot;ERC721: transfer caller is not owner nor approved&quot;
            );
        }
        _safeTransfer(from, to, tokenId, _data);
    }

    /// @dev When burning, delete `token_guard_map[tokenId]`
    /// This is an internal function that does not check if the sender is authorized to operate on the token.
    function _burn(uint256 tokenId) internal virtual override {
        (address guard, )=guardInfo(tokenId);
        super._burn(tokenId);
        delete _guardInfo[tokenId];
        emit UpdateGuardLog(tokenId, address(0), guard, 0);
    }

    /// @dev See {IERC165-supportsInterface}.
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC6147).interfaceId || super.supportsInterface(interfaceId);
    }
}

```

## Security Considerations

Make sure to set an appropriate `expires` for the `guard`, based on the specific application scenario.

When an NFT has a valid guard, even if an address is authorized as an operator through `approve` or `setApprovalForAll`, the operator still has no right to transfer the NFT.

When an NFT has a valid guard, the `owner` cannot sell the NFT. Some trading platforms list NFTs through `setApprovalForAll` and owners&apos; signature. It is recommended to prevent listing these NFTs by checking `guardInfo`.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 07 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6147</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6147</guid>
      </item>
    
      <item>
        <title>Hierarchical NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6150-hierarchical-nfts-an-extension-to-erc-721/12173</comments>
        
        <description>## Abstract

This standard is an extension to [EIP-721](./eip-721.md). 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.

## Motivation

This EIP standardizes the interface of filesystem-like hierarchical NFTs and provides a reference implementation.

Hierarchy structure is commonly implemented for file systems by operating systems such as Linux Filesystem Hierarchy (FHS).

![Linux Hierarchical File Structure](../assets/eip-6150/linux-hierarchy.png)

Websites often use a directory and category hierarchy structure, such as eBay (Home -&gt; Electronics -&gt; Video Games -&gt; Xbox -&gt; Products), and Twitter (Home -&gt; Lists -&gt; List -&gt; Tweets), and Reddit (Home -&gt; r/ethereum -&gt; Posts -&gt; Hot).

![Website Hierarchical Structure](../assets/eip-6150/website-hierarchy.png)

A single smart contract can be the `root`, managing every directory/category as individual NFT and hierarchy relations of NFTs. Each NFT&apos;s `tokenURI` may be another contract address, a website link, or any form of metadata.

The advantages and the advancement of the Ethereum ecosystem of using this standard include:

- Complete on-chain storage of hierarchy, which can also be governed on-chain by additional DAO contract
- Only need a single contract to manage and operate the hierarchical relations
- Transferrable directory/category ownership as NFT, which is great for use cases such as on-chain forums
- Easy and permissionless data access to the hierarchical structure by front-end
- Ideal structure for traditional applications such as e-commerce, or forums
- Easy-to-understand interfaces for developers, which are similar to Linux filesystem commands in concept

The use cases can include:

- On-chain forum, like Reddit
- On-chain social media, like Twitter
- On-chain corporation, for managing organizational structures
- On-chain e-commerce platforms, like eBay or individual stores
- Any application with tree-like structures

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

Every compliant contract must implement this proposal, [EIP-721](./eip-721.md) and [EIP-165](./eip-165.md) interfaces.

```solidity
pragma solidity ^0.8.0;

// Note: the ERC-165 identifier for this interface is 0x897e2c73.
interface IERC6150 /* is IERC721, IERC165 */ {
    /**
     * @notice Emitted when `tokenId` token under `parentId` is minted.
     * @param minter The address of minter
     * @param to The address received token
     * @param parentId The id of parent token, if it&apos;s zero, it means minted `tokenId` is a root token.
     * @param tokenId The id of minted token, required to be greater than zero
     */
    event Minted(
        address indexed minter,
        address indexed to,
        uint256 parentId,
        uint256 tokenId
    );

    /**
     * @notice Get the parent token of `tokenId` token.
     * @param tokenId The child token
     * @return parentId The Parent token found
     */
    function parentOf(uint256 tokenId) external view returns (uint256 parentId);

    /**
     * @notice Get the children tokens of `tokenId` token.
     * @param tokenId The parent token
     * @return childrenIds The array of children tokens
     */
    function childrenOf(
        uint256 tokenId
    ) external view returns (uint256[] memory childrenIds);

    /**
     * @notice Check the `tokenId` token if it is a root token.
     * @param tokenId The token want to be checked
     * @return Return `true` if it is a root token; if not, return `false`
     */
    function isRoot(uint256 tokenId) external view returns (bool);

    /**
     * @notice Check the `tokenId` token if it is a leaf token.
     * @param tokenId The token want to be checked
     * @return Return `true` if it is a leaf token; if not, return `false`
     */
    function isLeaf(uint256 tokenId) external view returns (bool);
}
```

Optional Extension: Enumerable

```solidity
// Note: the ERC-165 identifier for this interface is 0xba541a2e.
interface IERC6150Enumerable is IERC6150 /* IERC721Enumerable */ {
    /**
     * @notice Get total amount of children tokens under `parentId` token.
     * @dev If `parentId` is zero, it means get total amount of root tokens.
     * @return The total amount of children tokens under `parentId` token.
     */
    function childrenCountOf(uint256 parentId) external view returns (uint256);

    /**
     * @notice Get the token at the specified index of all children tokens under `parentId` token.
     * @dev If `parentId` is zero, it means get root token.
     * @return The token ID at `index` of all chlidren tokens under `parentId` token.
     */
    function childOfParentByIndex(
        uint256 parentId,
        uint256 index
    ) external view returns (uint256);

    /**
     * @notice Get the index position of specified token in the children enumeration under specified parent token.
     * @dev Throws if the `tokenId` is not found in the children enumeration.
     * If `parentId` is zero, means get root token index.
     * @param parentId The parent token
     * @param tokenId The specified token to be found
     * @return The index position of `tokenId` found in the children enumeration
     */
    function indexInChildrenEnumeration(
        uint256 parentId,
        uint256 tokenId
    ) external view returns (uint256);
}
```

Optional Extension: Burnable

```solidity
// Note: the ERC-165 identifier for this interface is 0x4ac0aa46.
interface IERC6150Burnable is IERC6150 {
    /**
     * @notice Burn the `tokenId` token.
     * @dev Throws if `tokenId` is not a leaf token.
     * Throws if `tokenId` is not a valid NFT.
     * Throws if `owner` is not the owner of `tokenId` token.
     * Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this token.
     * @param tokenId The token to be burnt
     */
    function safeBurn(uint256 tokenId) external;

    /**
     * @notice Batch burn tokens.
     * @dev Throws if one of `tokenIds` is not a leaf token.
     * Throws if one of `tokenIds` is not a valid NFT.
     * Throws if `owner` is not the owner of all `tokenIds` tokens.
     * Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for all `tokenIds`.
     * @param tokenIds The tokens to be burnt
     */
    function safeBatchBurn(uint256[] memory tokenIds) external;
}
```

Optional Extension: ParentTransferable

```solidity
// Note: the ERC-165 identifier for this interface is 0xfa574808.
interface IERC6150ParentTransferable is IERC6150 {
    /**
     * @notice Emitted when the parent of `tokenId` token changed.
     * @param tokenId The token changed
     * @param oldParentId Previous parent token
     * @param newParentId New parent token
     */
    event ParentTransferred(
        uint256 tokenId,
        uint256 oldParentId,
        uint256 newParentId
    );

    /**
     * @notice Transfer parentship of `tokenId` token to a new parent token
     * @param newParentId New parent token id
     * @param tokenId The token to be changed
     */
    function transferParent(uint256 newParentId, uint256 tokenId) external;

    /**
     * @notice Batch transfer parentship of `tokenIds` to a new parent token
     * @param newParentId New parent token id
     * @param tokenIds Array of token ids to be changed
     */
    function batchTransferParent(
        uint256 newParentId,
        uint256[] memory tokenIds
    ) external;
}
```

Optional Extension: Access Control

```solidity
// Note: the ERC-165 identifier for this interface is 0x1d04f0b3.
interface IERC6150AccessControl is IERC6150 {
    /**
     * @notice Check the account whether a admin of `tokenId` token.
     * @dev Each token can be set more than one admin. Admin have permission to do something to the token, like mint child token,
     * or burn token, or transfer parentship.
     * @param tokenId The specified token
     * @param account The account to be checked
     * @return If the account has admin permission, return true; otherwise, return false.
     */
    function isAdminOf(uint256 tokenId, address account)
        external
        view
        returns (bool);

    /**
     * @notice Check whether the specified parent token and account can mint children tokens
     * @dev If the `parentId` is zero, check whether account can mint root nodes
     * @param parentId The specified parent token to be checked
     * @param account The specified account to be checked
     * @return If the token and account has mint permission, return true; otherwise, return false.
     */
    function canMintChildren(
        uint256 parentId,
        address account
    ) external view returns (bool);

    /**
     * @notice Check whether the specified token can be burnt by specified account
     * @param tokenId The specified token to be checked
     * @param account The specified account to be checked
     * @return If the tokenId can be burnt by account, return true; otherwise, return false.
     */
    function canBurnTokenByAccount(uint256 tokenId, address account)
        external
        view
        returns (bool);
}
```

## Rationale

As mentioned in the abstract, this EIP&apos;s goal is to have a simple interface for supporting Hierarchical NFTs. Here are a few design decisions and why they were made:

### Relationship between NFTs

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.

This proposal standardizes the event `Minted` 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.

In a hierarchical tree, it&apos;s common to query upper and lower nodes. So this proposal standardizes function `parentOf` to get the parent node of the specified node and standardizes function `childrenOf` to get all children nodes.

Functions `isRoot` and `isLeaf` can check if one node is a root node or a leaf node, which would be very useful for many cases.

### Enumerable Extension

This proposal standardizes three functions as an extension to support enumerable queries involving children nodes. Each function all have param `parentId`, for compatibility, when the `parentId` specified zero means query root nodes.

### ParentTransferable Extension

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.

### Access Control

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.

## Backwards Compatibility

This proposal is fully backward compatible with [EIP-721](./eip-721.md).

## Reference Implementation

Implementation: [EIP-6150](../assets/eip-6150/contracts/ERC6150.sol)

## Security Considerations

No security considerations were found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 15 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6150</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6150</guid>
      </item>
    
      <item>
        <title>Cross-Chain Messaging Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/cross-chain-messaging-standard/12197</comments>
        
        <description>## Abstract

This EIP introduces a common interface for cross-chain arbitrary message bridges (AMBs) to send and receive a cross-chain message (state).

## Motivation

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:

- **Ease Of Development:** A common standard interface would help developers build scalable cross-chain applications with ease.

- **Improved Scalability:** Cross-chain applications can efficiently use multiple message bridges.

- **Improved Security:** 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. 

- **Improved Robustness:** 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).

## Specification

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.

Every compliant cross-chain arbitrary message bridge must implement the following interface.

``` solidity
// SPDX-License-Identifier: Apache-3.0

pragma solidity &gt;=0.8.0;

/// @title Cross-Chain Messaging interface
/// @dev Allows seamless interchain messaging.
/// @author Sujith Somraaj
/// Note: Bytes are used throughout the implementation to support non-evm chains.

interface IEIP6170 {
    /// @dev This emits when a cross-chain message is sent.
    /// Note: MessageSent MUST trigger when a message is sent, including zero bytes transfers.
    event MessageSent(
        bytes to,
        bytes toChainId,
        bytes message,
        bytes extraData
    );

    /// @dev This emits when a cross-chain message is received.
    /// MessageReceived MUST trigger on any successful call to receiveMessage(bytes chainId, bytes sender, bytes message) function.
    event MessageReceived(bytes from, bytes fromChainId, bytes message);

    /// @dev Sends a message to a receiving address on a different blockchain.
    /// @param chainId_ is the unique identifier of receiving blockchain.
    /// @param receiver_ is the address of the receiver.
    /// @param message_ is the arbitrary message to be delivered.
    /// @param data_ is a bridge-specific encoded data for off-chain relayer infrastructure.
    /// @return the status of the process on the sending chain.
    /// Note: this function is designed to support both evm and non-evm chains
    /// Note: proposing chain-ids be the bytes encoding their native token name string. For eg., abi.encode(&quot;ETH&quot;), abi.encode(&quot;SOL&quot;) imagining they cannot override.
    function sendMessage(
        bytes memory chainId_,
        bytes memory receiver_,
        bytes memory message_,
        bytes memory data_
    ) external payable returns (bool);

    /// @dev Receives a message from a sender on a different blockchain.
    /// @param chainId_ is the unique identifier of the sending blockchain.
    /// @param sender_ is the address of the sender.
    /// @param message_ is the arbitrary message sent by the sender.
    /// @param data_ is an additional parameter to be used for security purposes. E.g, can send nonce in layerzero.
    /// @return the status of message processing/storage.
    /// Note: sender validation (or) message validation should happen before processing the message.
    function receiveMessage(
        bytes memory chainId_,
        bytes memory sender_,
        bytes memory message_,
        bytes memory data_
    ) external payable returns (bool);
}
```

## Rationale

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.

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.

The interface also aims to reduce the risks of a single point of failure (SPOF) for applications/protocols, as they can continue operating by updating their AMB address.

## Security Considerations

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.

Without sender authentication, anyone could write arbitrary messages into the receiving smart contract.

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 `data_` parameter.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE)
</description>
        <pubDate>Mon, 19 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6170</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6170</guid>
      </item>
    
      <item>
        <title>Composable NFTs utilizing Equippable Parts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6220-composable-nfts-utilizing-equippable-parts/12289</comments>
        
        <description>## Abstract

The Composable NFTs utilizing equippable parts standard extends [ERC-721](./eip-721.md) by allowing the NFTs to selectively add parts to themselves via equipping.

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.

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.

Equipping a part into an NFT doesn&apos;t generate a new token, but rather adds another component to be rendered when retrieving the token.

## Motivation

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.

In the four years since [ERC-721](./eip-721.md) was published, the need for additional functionality has resulted in countless extensions. This EIP improves upon ERC-721 in the following areas:

- [Composing](#composing)
- [Token progression](#token-progression)
- [Merit tracking](#merit-tracking)
- [Provable Digital Scarcity](#provable-digital-scarcity)

### Composing

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.

### Token progression

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.

### Merit tracking

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.

### Provable Digital Scarcity

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. 

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.

## Specification

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.

### Equippable tokens

The interface of the core smart contract of the equippable tokens.

```solidity
/// @title EIP-6220 Composable NFTs utilizing Equippable Parts
/// @dev See https://eips.ethereum.org/EIPS/eip-6220
/// @dev Note: the ERC-165 identifier for this interface is 0x28bc9ae4.

pragma solidity ^0.8.16;

import &quot;./IERC5773.sol&quot;;

interface IERC6220 is IERC5773 /*, ERC165 */ {
    /**
     * @notice Used to store the core structure of the `Equippable` component.
     * @return assetId The ID of the asset equipping a child
     * @return childAssetId The ID of the asset used as equipment
     * @return childId The ID of token that is equipped
     * @return childEquippableAddress Address of the collection to which the child asset belongs to
     */
    struct Equipment {
        uint64 assetId;
        uint64 childAssetId;
        uint256 childId;
        address childEquippableAddress;
    }

    /**
     * @notice Used to provide a struct for inputing equip data.
     * @dev Only used for input and not storage of data.
     * @return tokenId ID of the token we are managing
     * @return childIndex Index of a child in the list of token&apos;s active children
     * @return assetId ID of the asset that we are equipping into
     * @return slotPartId ID of the slot part that we are using to equip
     * @return childAssetId ID of the asset that we are equipping
     */
    struct IntakeEquip {
        uint256 tokenId;
        uint256 childIndex;
        uint64 assetId;
        uint64 slotPartId;
        uint64 childAssetId;
    }

    /**
     * @notice Used to notify listeners that a child&apos;s asset has been equipped into one of its parent assets.
     * @param tokenId ID of the token that had an asset equipped
     * @param assetId ID of the asset associated with the token we are equipping into
     * @param slotPartId ID of the slot we are using to equip
     * @param childId ID of the child token we are equipping into the slot
     * @param childAddress Address of the child token&apos;s collection
     * @param childAssetId ID of the asset associated with the token we are equipping
     */
    event ChildAssetEquipped(
        uint256 indexed tokenId,
        uint64 indexed assetId,
        uint64 indexed slotPartId,
        uint256 childId,
        address childAddress,
        uint64 childAssetId
    );

    /**
     * @notice Used to notify listeners that a child&apos;s asset has been unequipped from one of its parent assets.
     * @param tokenId ID of the token that had an asset unequipped
     * @param assetId ID of the asset associated with the token we are unequipping out of
     * @param slotPartId ID of the slot we are unequipping from
     * @param childId ID of the token being unequipped
     * @param childAddress Address of the collection that a token that is being unequipped belongs to
     * @param childAssetId ID of the asset associated with the token we are unequipping
     */
    event ChildAssetUnequipped(
        uint256 indexed tokenId,
        uint64 indexed assetId,
        uint64 indexed slotPartId,
        uint256 childId,
        address childAddress,
        uint64 childAssetId
    );

    /**
     * @notice Used to notify listeners that the assets belonging to a `equippableGroupId` have been marked as
     *  equippable into a given slot and parent
     * @param equippableGroupId ID of the equippable group being marked as equippable into the slot associated with
     *  `slotPartId` of the `parentAddress` collection
     * @param slotPartId ID of the slot part of the catalog into which the parts belonging to the equippable group
     *  associated with `equippableGroupId` can be equipped
     * @param parentAddress Address of the collection into which the parts belonging to `equippableGroupId` can be
     *  equipped
     */
    event ValidParentEquippableGroupIdSet(
        uint64 indexed equippableGroupId,
        uint64 indexed slotPartId,
        address parentAddress
    );

    /**
     * @notice Used to equip a child into a token.
     * @dev The `IntakeEquip` struct contains the following data:
     *  [
     *      tokenId,
     *      childIndex,
     *      assetId,
     *      slotPartId,
     *      childAssetId
     *  ]
     * @param data An `IntakeEquip` struct specifying the equip data
     */
    function equip(
        IntakeEquip memory data
    ) external;

    /**
     * @notice Used to unequip child from parent token.
     * @dev This can only be called by the owner of the token or by an account that has been granted permission to
     *  manage the given token by the current owner.
     * @param tokenId ID of the parent from which the child is being unequipped
     * @param assetId ID of the parent&apos;s asset that contains the `Slot` into which the child is equipped
     * @param slotPartId ID of the `Slot` from which to unequip the child
     */
    function unequip(
        uint256 tokenId,
        uint64 assetId,
        uint64 slotPartId
    ) external;

    /**
     * @notice Used to check whether the token has a given child equipped.
     * @dev This is used to prevent from transferring a child that is equipped.
     * @param tokenId ID of the parent token for which we are querying for
     * @param childAddress Address of the child token&apos;s smart contract
     * @param childId ID of the child token
     * @return bool The boolean value indicating whether the child token is equipped into the given token or not
     */
    function isChildEquipped(
        uint256 tokenId,
        address childAddress,
        uint256 childId
    ) external view returns (bool);

    /**
     * @notice Used to verify whether a token can be equipped into a given parent&apos;s slot.
     * @param parent Address of the parent token&apos;s smart contract
     * @param tokenId ID of the token we want to equip
     * @param assetId ID of the asset associated with the token we want to equip
     * @param slotId ID of the slot that we want to equip the token into
     * @return bool The boolean indicating whether the token with the given asset can be equipped into the desired
     *  slot
     */
    function canTokenBeEquippedWithAssetIntoSlot(
        address parent,
        uint256 tokenId,
        uint64 assetId,
        uint64 slotId
    ) external view returns (bool);

    /**
     * @notice Used to get the Equipment object equipped into the specified slot of the desired token.
     * @dev The `Equipment` struct consists of the following data:
     *  [
     *      assetId,
     *      childAssetId,
     *      childId,
     *      childEquippableAddress
     *  ]
     * @param tokenId ID of the token for which we are retrieving the equipped object
     * @param targetCatalogAddress Address of the `Catalog` associated with the `Slot` part of the token
     * @param slotPartId ID of the `Slot` part that we are checking for equipped objects
     * @return struct The `Equipment` struct containing data about the equipped object
     */
    function getEquipment(
        uint256 tokenId,
        address targetCatalogAddress,
        uint64 slotPartId
    ) external view returns (Equipment memory);

    /**
     * @notice Used to get the asset and equippable data associated with given `assetId`.
     * @param tokenId ID of the token for which to retrieve the asset
     * @param assetId ID of the asset of which we are retrieving
     * @return metadataURI The metadata URI of the asset
     * @return equippableGroupId ID of the equippable group this asset belongs to
     * @return catalogAddress The address of the catalog the part belongs to
     * @return partIds An array of IDs of parts included in the asset
     */
    function getAssetAndEquippableData(uint256 tokenId, uint64 assetId)
        external
        view
        returns (
            string memory metadataURI,
            uint64 equippableGroupId,
            address catalogAddress,
            uint64[] calldata partIds
        );
}
```

### Catalog

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.

```solidity
/**
 * @title ICatalog
 * @notice An interface Catalog for equippable module.
 * @dev Note: the ERC-165 identifier for this interface is 0xd912401f.
 */

pragma solidity ^0.8.16;

interface ICatalog /* is IERC165 */ {
    /**
     * @notice Event to announce addition of a new part.
     * @dev It is emitted when a new part is added.
     * @param partId ID of the part that was added
     * @param itemType Enum value specifying whether the part is `None`, `Slot` and `Fixed`
     * @param zIndex An uint specifying the z value of the part. It is used to specify the depth which the part should
     *  be rendered at
     * @param equippableAddresses An array of addresses that can equip this part
     * @param metadataURI The metadata URI of the part
     */
    event AddedPart(
        uint64 indexed partId,
        ItemType indexed itemType,
        uint8 zIndex,
        address[] equippableAddresses,
        string metadataURI
    );

    /**
     * @notice Event to announce new equippables to the part.
     * @dev It is emitted when new addresses are marked as equippable for `partId`.
     * @param partId ID of the part that had new equippable addresses added
     * @param equippableAddresses An array of the new addresses that can equip this part
     */
    event AddedEquippables(
        uint64 indexed partId,
        address[] equippableAddresses
    );

    /**
     * @notice Event to announce the overriding of equippable addresses of the part.
     * @dev It is emitted when the existing list of addresses marked as equippable for `partId` is overwritten by a new
     *  one.
     * @param partId ID of the part whose list of equippable addresses was overwritten
     * @param equippableAddresses The new, full, list of addresses that can equip this part
     */
    event SetEquippables(uint64 indexed partId, address[] equippableAddresses);

    /**
     * @notice Event to announce that a given part can be equipped by any address.
     * @dev It is emitted when a given part is marked as equippable by any.
     * @param partId ID of the part marked as equippable by any address
     */
    event SetEquippableToAll(uint64 indexed partId);

    /**
     * @notice Used to define a type of the item. Possible values are `None`, `Slot` or `Fixed`.
     * @dev Used for fixed and slot parts.
     */
    enum ItemType {
        None,
        Slot,
        Fixed
    }

    /**
     * @notice The integral structure of a standard RMRK catalog item defining it.
     * @dev Requires a minimum of 3 storage slots per catalog item, equivalent to roughly 60,000 gas as of Berlin hard fork
     *  (April 14, 2021), though 5-7 storage slots is more realistic, given the standard length of an IPFS URI. This
     *  will result in between 25,000,000 and 35,000,000 gas per 250 assets--the maximum block size of Ethereum
     *  mainnet is 30M at peak usage.
     * @return itemType The item type of the part
     * @return z The z value of the part defining how it should be rendered when presenting the full NFT
     * @return equippable The array of addresses allowed to be equipped in this part
     * @return metadataURI The metadata URI of the part
     */
    struct Part {
        ItemType itemType; //1 byte
        uint8 z; //1 byte
        address[] equippable; //n Collections that can be equipped into this slot
        string metadataURI; //n bytes 32+
    }

    /**
     * @notice The structure used to add a new `Part`.
     * @dev The part is added with specified ID, so you have to make sure that you are using an unused `partId`,
     *  otherwise the addition of the part vill be reverted.
     * @dev The full `IntakeStruct` looks like this:
     *  [
     *          partID,
     *      [
     *          itemType,
     *          z,
     *          [
     *               permittedCollectionAddress0,
     *               permittedCollectionAddress1,
     *               permittedCollectionAddress2
     *           ],
     *           metadataURI
     *       ]
     *   ]
     * @return partId ID to be assigned to the `Part`
     * @return part A `Part` to be added
     */
    struct IntakeStruct {
        uint64 partId;
        Part part;
    }

    /**
     * @notice Used to return the metadata URI of the associated catalog.
     * @return string Base metadata URI
     */
    function getMetadataURI() external view returns (string memory);

    /**
     * @notice Used to return the `itemType` of the associated catalog
     * @return string `itemType` of the associated catalog
     */
    function getType() external view returns (string memory);

    /**
     * @notice Used to check whether the given address is allowed to equip the desired `Part`.
     * @dev Returns true if a collection may equip asset with `partId`.
     * @param partId The ID of the part that we are checking
     * @param targetAddress The address that we are checking for whether the part can be equipped into it or not
     * @return bool The status indicating whether the `targetAddress` can be equipped into `Part` with `partId` or not
     */
    function checkIsEquippable(uint64 partId, address targetAddress)
        external
        view
        returns (bool);

    /**
     * @notice Used to check if the part is equippable by all addresses.
     * @dev Returns true if part is equippable to all.
     * @param partId ID of the part that we are checking
     * @return bool The status indicating whether the part with `partId` can be equipped by any address or not
     */
    function checkIsEquippableToAll(uint64 partId) external view returns (bool);

    /**
     * @notice Used to retrieve a `Part` with id `partId`
     * @param partId ID of the part that we are retrieving
     * @return struct The `Part` struct associated with given `partId`
     */
    function getPart(uint64 partId) external view returns (Part memory);

    /**
     * @notice Used to retrieve multiple parts at the same time.
     * @param partIds An array of part IDs that we want to retrieve
     * @return struct An array of `Part` structs associated with given `partIds`
     */
    function getParts(uint64[] calldata partIds)
        external
        view
        returns (Part[] memory);
}
```

## Rationale

Designing the proposal, we considered the following questions:

1. **Why are we using a Catalog in stead of supporting direct NFT equipping?**\
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.
2. **Why do we propose two types of parts?**\
Some parts, that are the same for all of the tokens, don&apos;t make sense to be represented by individual NFTs, so they can be represented by fixed parts. This reduces the clutter of the owner&apos;s wallet as well as introduces an efficient way of disseminating repetitive assets tied to NFTs.\
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.\
Having two parts allows for support of numerous use cases and, since the proposal doesn&apos;t enforce the use of both it can be applied in any configuration needed.
3. **Why is a method to get all of the equipped parts not included?**\
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.
4. **Should Catalog be limited to support one NFT collection at a time or be able to support any nunmber of collections?**\
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.

### Fixed parts

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. 

A fixed part cannot be replaced.

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.

### Slot parts

Slot parts are defined and contained in the Catalog. They don&apos;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.

## Backwards Compatibility

The Equippable token standard has been made compatible with [ERC-721](./eip-721.md) in order to take advantage of the robust tooling available for implementations of ERC-721 and to ensure compatibility with existing ERC-721 infrastructure.

## Test Cases

Tests are included in [`equippableFixedParts.ts`](../assets/eip-6220/test/equippableFixedParts.ts) and [`equippableSlotParts.ts`](../assets/eip-6220/test/equippableSlotParts.ts).

To run them in terminal, you can use the following commands:

```
cd ../assets/eip-6220
npm install
npx hardhat test
```

## Reference Implementation

See [`EquippableToken.sol`](../assets/eip-6220/contracts/EquippableToken.sol).


## Security Considerations

The same security considerations as with [ERC-721](./eip-721.md) apply: hidden logic may be present in any of the functions, including burn, add resource, accept resource, and more.

Caution is advised when dealing with non-audited contracts.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6220</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6220</guid>
      </item>
    
      <item>
        <title>Contracts Dependencies Registry</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6224-contracts-dependencies-registry/12316</comments>
        
        <description>## Abstract

This EIP introduces an on-chain registry system that a decentralized protocol may use to manage its smart contracts.

The proposed system consists of two components: `ContractsRegistry` and `Dependant`. The `ContractsRegistry` 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 `Dependant` contracts query to fetch their required dependencies from.

## Motivation

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.

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 `ContractsRegistry` and the `Dependant`.

The advantages of using the provided system might be:

- Structured smart contracts management via specialized contracts.
- Ad-hoc upgradeability provision of a protocol.
- Runtime addition, removal, and substitution of smart contracts.
- Dependency injection mechanism to keep smart contracts&apos; dependencies under control.
- Ability to specify custom access control rules to maintain the protocol.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Overview

The system consists of two smart contracts:

- `ContractsRegistry` that is a singleton registry to manage and upgrade a protocol&apos;s smart contracts.
- `Dependant` that is a mix-in which enables a dependency injection mechanism.

The following diagram depicts the relationship between the registry and its dependants:

![](../assets/eip-6224/diagram.svg)

### ContractsRegistry

The `ContractsRegistry` is the main contract of the proposed system. It MUST store the references to every standalone contract used within a protocol. The `ContractRegistry` MAY be configured to deploy a proxy contract of choice on top of the registered contracts. 

Additionally, the `ContractsRegistry` MUST reject the registration of zero addresses.

The `ContractsRegistry` MUST implement the following interface:

```solidity
pragma solidity ^0.8.0;

interface IContractsRegistry {
    /**
     * @notice The event that is emitted when the contract gets added to the registry
     * @param name the name of the contract
     * @param contractAddress the address of the added contract
     */
    event ContractAdded(string name, address contractAddress);
 
    /**
     * @notice The event that is emitted when the proxy contract gets added to the registry
     * @param name the name of the contract
     * @param contractAddress the address of the proxy contract
     * @param implementation the address of the implementation contract
     */
    event ProxyContractAdded(string name, address contractAddress, address implementation);
 
    /**
     * @notice The event that is emitted when the proxy contract gets upgraded through the registry
     * @param name the name of the contract
     * @param newImplementation the address of the new implementation contract
     */
    event ProxyContractUpgraded(string name, address newImplementation);
 
    /**
     * @notice The event that is emitted when the contract gets removed from the registry
     * @param name the name of the removed contract
     */
    event ContractRemoved(string name);
 
    /**
     * @notice The function that returns an associated contract by the name. 
     *
     * MUST revert if the requested contract is `address(0)`
     *
     * @param name the name of the contract
     * @return the address of the contract
     */
    function getContract(string memory name) external view returns (address);
 
    /**
     * @notice The function that checks if a contract with a given name has been added
     * @param name the name of the contract
     * @return true if the contract is present in the registry
     */
    function hasContract(string memory name) external view returns (bool);
 
    /**
     * @notice The function that injects dependencies into the given contract.
     *
     * MUST call the `setDependencies()` with `address(this)` and `bytes(&quot;&quot;)` as arguments on the provided contract
     *
     * @param name the name of the contract
     */
    function injectDependencies(string memory name) external;
 
    /**
     * @notice The function that injects dependencies into the given contract with extra data.
     *
     * MUST call the `setDependencies()` with `address(this)` and `data` as arguments on the provided contract
     *
     * @param name the name of the contract
     * @param data the extra context data that will be passed to the dependant contract
     */
    function injectDependenciesWithData(
        string memory name,
        bytes memory data
    ) external;
 
    /**
     * @notice The function that upgrades added proxy contract with a new implementation.
     *
     * It is the Owner&apos;s responsibility to ensure the compatibility between implementations.
     *
     * MUST emit `ProxyContractUpgraded` event
     *
     * @param name the name of the proxy contract
     * @param newImplementation the new implementation the proxy will be upgraded to
     */
    function upgradeContract(string memory name, address newImplementation) external;
 
    /**
     * @notice The function that upgrades added proxy contract with a new implementation, providing data
     *
     * It is the Owner&apos;s responsibility to ensure the compatibility between implementations.
     *
     * MUST emit `ProxyContractUpgraded` event
     *
     * @param name the name of the proxy contract
     * @param newImplementation the new implementation the proxy will be upgraded to
     * @param data the data that the proxy will be called with after upgrade. This can be an ABI encoded function call
     */
    function upgradeContractAndCall(
        string memory name,
        address newImplementation,
        bytes memory data
    ) external;
 
    /**
     * @notice The function that adds pure (non-proxy) contracts to the `ContractsRegistry`. The contracts MAY either be
     * the ones the system does not have direct upgradeability control over or those that are not upgradeable by design.
     *
     * MUST emit `ContractAdded` event. Reverts if the provided address is `address(0)`
     *
     * @param name the name to associate the contract with
     * @param contractAddress the address of the contract to be added
     */
    function addContract(string memory name, address contractAddress) external;
 
    /**
     * @notice The function that adds the proxy contracts to the registry by deploying them above the provided implementation.
     *
     * The function may be used to add a contract that the `ContractsRegistry` has to be able to upgrade.
     *
     * MUST emit `ProxyContractAdded` event. Reverts if implementation address is `address(0)`
     *
     * @param name the name to associate the contract with
     * @param contractAddress the address of the implementation to point the proxy to
     */
    function addProxyContract(string memory name, address contractAddress) external;
 
    /**
     * @notice The function that adds the proxy contracts to the registry by deploying them above the provided implementation,
     * providing data.
     *
     * The function may be used to add a contract that the `ContractsRegistry` has to be able to upgrade.
     *
     * MUST emit `ProxyContractAdded` event. Reverts if implementation address is `address(0)`
     *
     * @param name the name to associate the contract with
     * @param contractAddress the address of the implementation
     * @param data the data that the proxy will be called with. This can be an ABI encoded initialization call
     */
    function addProxyContractAndCall(
        string memory name,
        address contractAddress,
        bytes memory data
    ) external;
 
    /**
     * @notice The function that adds an already deployed proxy to the `ContractsRegistry`. It MAY be used
     * when the system migrates to the new `ContractRegistry`. In that case, the new registry MUST have the
     * credentials to upgrade the newly added proxies.
     *
     * MUST emit `ProxyContractAdded` event. Reverts if implementation address is `address(0)`
     *
     * @param name the name to associate the contract with
     * @param contractAddress the address of the proxy
     */
    function justAddProxyContract(string memory name, address contractAddress) external;
 
    /**
     * @notice The function to remove contracts from the ContractsRegistry.
     *
     * MUST emit `ContractRemoved` event. Reverts if the contract is already removed
     *
     * @param name the associated name with the contract
     */
    function removeContract(string memory name) external;
}
```

### Dependant

The `ContractsRegistry` works together with the `Dependant` contract. Every standalone contract of a protocol MUST inherit `Dependant` in order to support the dependency injection mechanism. 

The required dependencies MUST be set in the overridden `setDependencies` method, not in the `constructor` or `initializer` methods.

Only the injector MUST be able to call the `setDependencies` and `setInjector` methods. The initial injector will be a zero address, in that case, the call MUST NOT revert on access control checks.

The `Dependant` contract MUST implement the following interface:

```solidity
pragma solidity ^0.8.0;

interface IDependant {
    /**
     * @notice The function that is called from the `ContractsRegistry` to inject dependencies.
     *
     * The contract MUST perform a proper access check of `msg.sender`. The calls should only be possible from `ContractsRegistry`
     *
     * @param contractsRegistry the registry to pull dependencies from
     * @param data the extra data that might provide additional application-specific context
     */
    function setDependencies(address contractsRegistry, bytes memory data) external;
 
    /**
     * @notice The function that sets the new dependency injector.
     *
     * The contract MUST perform a proper access check of `msg.sender`
     *
     * @param injector the new dependency injector
     */
    function setInjector(address injector) external;
 
    /**
     * @notice The function that gets the current dependency injector
     * @return the current dependency injector
     */
    function getInjector() external view returns (address);
}
```

- The `Dependant` contract MAY store the dependency injector (usually `ContractsRegistry`) address in the special slot `0x3d1f25f1ac447e55e7fec744471c4dab1c6a2b6ffb897825f9ea3d2e8c9be583` (obtained as `bytes32(uint256(keccak256(&quot;eip6224.dependant.slot&quot;)) - 1)`).

## Rationale

There are a few design decisions that have to be explicitly specified:

### ContractsRegistry Rationale

#### Contracts Identifier

The `string` contracts identifier is chosen over the `uint256` and `bytes32` to maintain code readability and reduce the human error chances when interacting with the `ContractsRegistry`. 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.

Due to the `string` identifier, the event parameters are not indexed. The `string indexed` parameter will become the `keccak256` hash of the contract name if it is larger than 32 bytes. This fact reduces readability, which was prioritized.

#### Reverts

The `getContract` view function reverts if the requested contract is `address(0)`. 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.

The `addContract`, `addProxyContract`, `addProxyContractAndCall`, and `justAddProxyContract` methods revert if the provided address is `address(0)` for the same risk minimization reason.

### Dependant Rationale

#### Dependencies

The `data` parameter is provided to carry additional application-specific context. It MAY be used to extend the method&apos;s behavior.

#### Injector

The `setInjector` function is made `external` to support the dependency injection mechanism for factory-made contracts. However, the method SHOULD be used with extra care.

## Reference Implementation

&gt; Note that the reference implementation depends on OpenZeppelin contracts `4.9.2`.

### ContractsRegistry Implementation

```solidity
pragma solidity ^0.8.0;

import {Address} from &quot;@openzeppelin/contracts/utils/Address.sol&quot;;
import {TransparentUpgradeableProxy} from &quot;@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol&quot;;
import {OwnableUpgradeable} from &quot;@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol&quot;;

import {Dependant} from &quot;./Dependant.sol&quot;;

interface IContractsRegistry {
    event ContractAdded(string name, address contractAddress);
    event ProxyContractAdded(
        string name,
        address contractAddress,
        address implementation
    );
    event ProxyContractUpgraded(string name, address newImplementation);
    event ContractRemoved(string name);

    function getContract(string memory name) external view returns (address);

    function hasContract(string memory name) external view returns (bool);

    function injectDependencies(string memory name) external;

    function injectDependenciesWithData(string memory name, bytes memory data)
        external;

    function upgradeContract(string memory name, address newImplementation)
        external;

    function upgradeContractAndCall(
        string memory name,
        address newImplementation,
        bytes memory data
    ) external;

    function addContract(string memory name, address contractAddress) external;

    function addProxyContract(string memory name, address contractAddress)
        external;

    function addProxyContractAndCall(
        string memory name,
        address contractAddress,
        bytes memory data
    ) external;

    function justAddProxyContract(string memory name, address contractAddress)
        external;

    function removeContract(string memory name) external;
}

contract ProxyUpgrader {
    using Address for address;

    address private immutable _OWNER;

    modifier onlyOwner() {
        _onlyOwner();
        _;
    }

    constructor() {
        _OWNER = msg.sender;
    }

    function upgrade(address what_, address to_, bytes calldata data_) external onlyOwner {
        if (data_.length &gt; 0) {
            TransparentUpgradeableProxy(payable(what_)).upgradeToAndCall(to_, data_);
        } else {
            TransparentUpgradeableProxy(payable(what_)).upgradeTo(to_);
        }
    }

    function getImplementation(address what_) external view onlyOwner returns (address) {
        // bytes4(keccak256(&quot;implementation()&quot;)) == 0x5c60da1b
        (bool success_, bytes memory returndata_) = address(what_).staticcall(hex&quot;5c60da1b&quot;);

        require(success_, &quot;ProxyUpgrader: not a proxy&quot;);

        return abi.decode(returndata_, (address));
    }

    function _onlyOwner() internal view {
        require(_OWNER == msg.sender, &quot;ProxyUpgrader: not an owner&quot;);
    }
}

contract ContractsRegistry is IContractsRegistry, OwnableUpgradeable {
    ProxyUpgrader private _proxyUpgrader;

    mapping(string =&gt; address) private _contracts;
    mapping(address =&gt; bool) private _isProxy;

    function __ContractsRegistry_init() public initializer {
        _proxyUpgrader = new ProxyUpgrader();

        __Ownable_init();
    }

    function getContract(string memory name_) public view returns (address) {
        address contractAddress_ = _contracts[name_];

        require(
            contractAddress_ != address(0),
            &quot;ContractsRegistry: this mapping doesn&apos;t exist&quot;
        );

        return contractAddress_;
    }

    function hasContract(string memory name_) public view returns (bool) {
        return _contracts[name_] != address(0);
    }

    function getProxyUpgrader() external view returns (address) {
        return address(_proxyUpgrader);
    }

    function injectDependencies(string memory name_) public virtual onlyOwner {
        injectDependenciesWithData(name_, bytes(&quot;&quot;));
    }

    function injectDependenciesWithData(string memory name_, bytes memory data_)
        public
        virtual
        onlyOwner
    {
        address contractAddress_ = _contracts[name_];

        require(
            contractAddress_ != address(0),
            &quot;ContractsRegistry: this mapping doesn&apos;t exist&quot;
        );

        Dependant dependant_ = Dependant(contractAddress_);
        dependant_.setDependencies(address(this), data_);
    }

    function upgradeContract(string memory name_, address newImplementation_)
        public
        virtual
        onlyOwner
    {
        upgradeContractAndCall(name_, newImplementation_, bytes(&quot;&quot;));
    }

    function upgradeContractAndCall(
        string memory name_,
        address newImplementation_,
        bytes memory data_
    ) public virtual onlyOwner {
        address contractToUpgrade_ = _contracts[name_];

        require(
            contractToUpgrade_ != address(0),
            &quot;ContractsRegistry: this mapping doesn&apos;t exist&quot;
        );
        require(
            _isProxy[contractToUpgrade_],
            &quot;ContractsRegistry: not a proxy contract&quot;
        );

        _proxyUpgrader.upgrade(contractToUpgrade_, newImplementation_, data_);

        emit ProxyContractUpgraded(name_, newImplementation_);
    }

    function addContract(string memory name_, address contractAddress_)
        public
        virtual
        onlyOwner
    {
        require(
            contractAddress_ != address(0),
            &quot;ContractsRegistry: zero address is forbidden&quot;
        );

        _contracts[name_] = contractAddress_;

        emit ContractAdded(name_, contractAddress_);
    }

    function addProxyContract(string memory name_, address contractAddress_)
        public
        virtual
        onlyOwner
    {
        addProxyContractAndCall(name_, contractAddress_, bytes(&quot;&quot;));
    }

    function addProxyContractAndCall(
        string memory name_,
        address contractAddress_,
        bytes memory data_
    ) public virtual onlyOwner {
        require(
            contractAddress_ != address(0),
            &quot;ContractsRegistry: zero address is forbidden&quot;
        );

        address proxyAddr_ = _deployProxy(
            contractAddress_,
            address(_proxyUpgrader),
            data_
        );

        _contracts[name_] = proxyAddr_;
        _isProxy[proxyAddr_] = true;

        emit ProxyContractAdded(name_, proxyAddr_, contractAddress_);
    }

    function justAddProxyContract(string memory name_, address contractAddress_)
        public
        virtual
        onlyOwner
    {
        require(
            contractAddress_ != address(0),
            &quot;ContractsRegistry: zero address is forbidden&quot;
        );

        _contracts[name_] = contractAddress_;
        _isProxy[contractAddress_] = true;

        emit ProxyContractAdded(
            name_,
            contractAddress_,
            _proxyUpgrader.getImplementation(contractAddress_)
        );
    }

    function removeContract(string memory name_) public virtual onlyOwner {
        address contractAddress_ = _contracts[name_];

        require(
            contractAddress_ != address(0),
            &quot;ContractsRegistry: this mapping doesn&apos;t exist&quot;
        );

        delete _isProxy[contractAddress_];
        delete _contracts[name_];

        emit ContractRemoved(name_);
    }

    function _deployProxy(
        address contractAddress_,
        address admin_,
        bytes memory data_
    ) internal virtual returns (address) {
        return
            address(
                new TransparentUpgradeableProxy(contractAddress_, admin_, data_)
            );
    }
}
```

### Dependant Implementation

```solidity
pragma solidity ^0.8.0;

interface IDependant {
    function setDependencies(address contractsRegistry, bytes memory data) external;
 
    function setInjector(address injector) external;
 
    function getInjector() external view returns (address);
}

abstract contract Dependant is IDependant {
    /**
     * @dev bytes32(uint256(keccak256(&quot;eip6224.dependant.slot&quot;)) - 1)
     */
    bytes32 private constant _INJECTOR_SLOT =
        0x3d1f25f1ac447e55e7fec744471c4dab1c6a2b6ffb897825f9ea3d2e8c9be583;

    modifier dependant() {
        _checkInjector();
        _;
        _setInjector(msg.sender);
    }

    function setDependencies(address contractsRegistry_, bytes memory data_) public virtual;

    function setInjector(address injector_) external {
        _checkInjector();
        _setInjector(injector_);
    }

    function getInjector() public view returns (address injector_) {
        bytes32 slot_ = _INJECTOR_SLOT;

        assembly {
            injector_ := sload(slot_)
        }
    }

    function _setInjector(address injector_) internal {
        bytes32 slot_ = _INJECTOR_SLOT;

        assembly {
            sstore(slot_, injector_)
        }
    }

    function _checkInjector() internal view {
        address injector_ = getInjector();

        require(injector_ == address(0) || injector_ == msg.sender, &quot;Dependant: not an injector&quot;);
    }
}
```

## Security Considerations

It is crucial for the owner of `ContractsRegistry` to keep their keys in a safe place. The loss/leakage of credentials to the `ContractsRegistry` will lead to the application&apos;s point of no return. The `ContractRegistry` is a cornerstone of a protocol, access must be granted to the trusted parties only.

### ContractsRegistry Security

- The `ContractsRegistry` does not perform any upgradeability checks between the proxy upgrades. It is the user&apos;s responsibility to make sure that the new implementation is compatible with the old one.

### Dependant Security

- The `Dependant` contract MUST set its dependency injector no later than the first call to the `setDependencies` function is made. That being said, it is possible to front-run the first dependency injection.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 27 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6224</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6224</guid>
      </item>
    
      <item>
        <title>Tokenized Vaults with Lock-in Period</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-tokenized-vaults-with-lock-in-period/12298</comments>
        
        <description>## Abstract

This standard extends [EIP-4626](./eip-4626.md) to support lock-in periods.

## Motivation

The [EIP-4626](./eip-4626.md) 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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

All vaults that follow this EIP MUST implement [EIP-4626](./eip-4626.md) to provide basic vault functions and [EIP-20](./eip-20.md) to represent shares.

### Definitions

- asset: The underlying [EIP-20](./eip-20.md) token that the vault accepts and manages.
- share: The EIP-20 token that the vault issued.
- locked: A status of the vault. When the vault is locked, user can’t withdraw or deposit assets from the vault.
- unlocked: A status of the vault. When the vault is unlocked, user can withdraw or deposit assets from the vault.
- round: The period that the vault is locked.

### View Methods

#### isLocked

The current state of the vault.

`true` represents a vault is in the locked state, and `false` represents a vault is in the unlocked state.

```yaml
- name: isLocked
  type: bool
  stateMutability: view

  inputs: []

  outputs:
    - name: isLocked
      type: bool

```

#### vaultRound

The current round of the vault.

MUST start with `0`.

MUST add `1` each time a new round starts, that is, when the `isLocked` becomes true. MUST NOT be modified in any other circumstances.

```yaml
- name: vaultRound
  type: uint256
  stateMutability: view

  inputs: []

  outputs:
    - name: vaultRound
      type: uint256
```

### Methods

#### scheduleDeposit

Schedule the intent to deposit `assets` when the `isLocked` is true.

MUST only be callable when the `isLocked` is true.

MUST transfer the `assets` from the caller to the vault. MUST not issue new shares.

MUST revert if `assets` cannot be deposited.

MUST revert if the `isLocked` is false.

```yaml
- name: scheduleDeposit
  type: function
  stateMutability: nonpayable

  inputs:
    - name: assets
      type: uint256
```

#### scheduleRedeem

Schedule the intent to redeem `shares` from the vault when the `isLocked` is true.

MUST only be callable when the `isLocked` is true.

MUST transfer the `shares` from the caller to the vault. MUST not transfer assets to caller.

MUST revert if `shares` cannot be redeemed.

MUST revert if the `isLocked` is false.

```yaml
- name: scheduleRedeem
  type: function
  stateMutability: nonpayable

  inputs:
    - name: shares
      type: uint256
```

#### settleDeposits

Process all scheduled deposits for `depositor` and minting `newShares`.

MUST only be callable when the `isLocked` is false.

MUST issue `newShares` according to the current share price for the scheduled `depositor`.

MUST revert if there is no scheduled deposit for `depositor`.

```yaml
- name: settleDeposits
  type: function
  stateMutability: nonpayable

  inputs:
    - name: depositor
    - type: address

  outputs:
    - name: newShares
    - type: uint256
```

#### settleRedemptions

Process all scheduled redemptions for `redeemer` by burning `burnShares` and transferring `redeemAssets` to the `redeemer`.

MUST only be callable when the `isLocked` is false.

MUST burn the `burnShares` and transfer `redeemAssets` back to the `redeemer` according to the current share price.

MUST revert if no scheduled redemption for `redeemer`.

```yaml
- name: settleRedemptions
  type: function
  stateMutability: nonpayable

  inputs:
    - name: redeemer
    - type: address

  outputs:
    - name: burnShares
    - type: uint256
    - name: redeemAssets
    - type: uint256
```

#### getScheduledDeposits

Get the `totalAssets` of scheduled deposits for `depositor`.

MUST NOT revert.

```yaml
- name: getScheduledDeposits
  type: function
  stateMutability: view

  inputs:
    - name: depositor
    - type: address

  outputs:
    - name: totalAssets
    - type: uint256
```

#### getScheduledRedemptions

Get the `totalShares` of scheduled redemptions for `redeemer`.

MUST NOT revert.

```yaml
- name: getScheduledRedemptions
  type: function
  stateMutability: view

  inputs:
    - name: redeemer
    - type: address

  outputs:
    - name: totalShares
    - type: uint256
```

### Events

#### ScheduleDeposit

`sender` schedules a deposit with `assets` in this `round`.

MUST be emitted via `scheduleDeposit` method.

```yaml
- name: ScheduleDeposit
  type: event

  inputs:
    - name: sender
      indexed: true
      type: address
    - name: assets
      indexed: false
      type: uint256
    - name: round
      indexed: false
      type: uint256
```

#### ScheduleRedeem

`sender` schedules a redemption with `shares` in this `round`.

MUST be emitted via `scheduleRedeem` method.

```yaml
- name: ScheduleRedeem
  type: event

  inputs:
    - name: sender
      indexed: true
      type: address
    - name: shares
      indexed: false
      type: uint256
    - name: round
      indexed: false
      type: uint2
```

#### SettleDeposits

Settle scheduled deposits for `depositor` in this `round`. Issue `newShares` and transfer them to the `depositor`.

MUST be emitted via `settleDeposits` method.

```yaml
- name: SettleDeposits
  type: event

  inputs:
    - name: depositor
      indexed: true
      type: address
    - name: newShares
      type: uint256
    - name: round
      type: uint256
```

#### SettleRedemptions

Settle scheduled redemptions for `redeemer` in this `round`. Burn `burnShares` and transfer `redeemAssets` back to the `redeemer`.

MUST be emitted via `settleRedemptions` method.

```yaml
- name: SettleRedemptions
  type: event

  inputs:
    - name: redeemer
      indexed: true
      type: address
    - name: burnShares
      type: uint256
    - name: redeemAssets
      type: uint256
    - name: round
      type: uint256
```

## Rationale

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.

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.

## Backwards Compatibility

The `deposit`, `mint`, `withdraw`, `redeem` methods for [EIP-4626](./eip-4626.md) should revert when the `isLocked` is true to prevent issuing or burning shares with an undefined share price.

## Security Considerations

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 `isLocked` 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:

- Not allow the `isLocked` to become true if there is any unsettled scheduled deposit or redemption
- Force settling the scheduled deposits or redemptions when the `isLocked` becomes true
- Memorize the ending share price for each round and let the users settle according to the share prices

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 21 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6229</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6229</guid>
      </item>
    
      <item>
        <title>Semantic Soulbound Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6239-semantic-soulbound-tokens/12334</comments>
        
        <description>## Abstract

This proposal extends [ERC-721](./eip-721.md) and [ERC-5192](./eip-5192.md) by introducing Resource Description Framework (RDF) triples to Soulbound Tokens&apos; (‘SBTs‘) metadata.



## Motivation

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 [ERC-721](./eip-721.md) and [ERC-5192](./eip-5192.md) standards to include RDF triples in metadata to capture and store the meaning of social metadata as a network of accounts and attributes.

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.

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.

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.

### Connectedness

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.

### Linked Data

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.

### Social Identity

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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

- The token **MUST** implement the following interfaces:
    1. [ERC-165](./eip-165.md)’s `ERC165` (`0x01ffc9a7`)
    1. [ERC-721](./eip-721.md)’s `ERC721` (`0x80ac58cd`)
    1. [ERC-721](./eip-721.md)’s `ERC721Metadata` (`0x5b5e139f`)
    1. [ERC-5192](./eip-5192.md)’s `ERC5192` (`0xb45a3c0e`)

### RDF Statement

RDF statements come in various formats, we have selected the six most commonly used formats: `nt(N-Triples)`,`ttl(Turtle)`,`rdf(RDF/XML)`,`rj(RDF/JSON)`,`nq(N-Quads)` and `trig(TriG)`.

The complete format of an RDF statement:

```text
rdfStatements = {[format]}&lt;statements&gt;
```

In the following section, fragments surrounded by `{}` characters are OPTIONAL.

In the following section, fragments surrounded by `&lt;&gt;` characters are REQUIRED.

format: nt/ttl/rdf/rj/nq/trig

When no format is selected: statements = [ttl]statements

- `nt(n-triples)`

`nt` uses space to separate the subject, predicate, object of a triple, and a period . to indicate the end of a triple.

The basic structure is:

```text
subject predicate object .
```

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.

For example:

```text
&lt;http://example.org/entity/user1&gt; &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://example.org/entity/User&gt; .
&lt;http://example.org/entity/user1&gt; &lt;http://example.org/property/name&gt; &quot;Alice&quot; .
```

- `ttl(Turtle)`

Compared to `nt`, `ttl` 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;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt;`.


For example:

```text
@prefix : &lt;http://example.org/entity/&gt; .
@prefix p: &lt;http://example.org/property/&gt; .

:user1 a :User;
       p:name ”Alice” .
```

- `rdf(RDF/XML)`

`rdf` 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.

The basic structure is:

```xml
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/ 02/22-rdf-syntax-ns#&quot;&gt;

 &lt;rdf:Description rdf:about=&quot;subject&quot; &gt;
  &lt;predicate rdf:resource=&quot;object&quot;/&gt;
   &lt;predicate &gt;object&lt;/predicate&gt;
 &lt;/rdf:Description&gt;
&lt;/rdf:RDF&gt;
```

For example:

```xml
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/ 02/22-rdf-syntax-ns#&quot;
           xmlns:p=&quot;http://example.org/property/&quot;&gt;

 &lt;rdf:Description rdf:about=&quot;http://example.org/entity/user1&quot; &gt;
   &lt;rdf:type rdf:resource=&quot;http://example.org/entity/&quot;/&gt;
  &lt;p:name &gt;Alice&lt;/p:name&gt;
 &lt;/rdf:Description&gt;
&lt;/rdf:RDF&gt;
```

- `rj(RDF/JSON)`


`rj` describes RDF in JSON format. A triple is described as:


```text
  {&quot;subject&quot;:{&quot;predicate&quot;:[object]}}
```

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.

For example:

```json
   {
 &quot;http://example.org/entity/user1&quot;: {
   &quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&quot;: [
     &quot;http://example.org/entity/User&quot;
   ],
   &quot;http://example.org/property/name&quot;: [
     &quot;Alice&quot;
   ]
 }
}

```

- `nq(N-Quads)`

`nq` is based on `nt` 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.

The basic structure is:

```text
subject predicate object graphLabel.
```

For example:

```text
&lt;http://example.org/entity/user1&gt; &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://example.org/entity/User&gt; &lt;http://example.org/graphs/example&gt; .
&lt;http://example.org/entity/user1&gt; &lt;http://example.org/property/name&gt; &quot;Alice&quot; &lt;http://example.org/graphs/example&gt; .
```

- `trig(TriG)`


`trig` is an extension of `ttl` that includes a graph label to describe the dataset to which an RDF triple belongs. The triple statements are enclosed in curly braces {}.

For example:

```text
@prefix : &lt;http://example.org/entity/&gt; .
@prefix p: &lt;http://example.org/property/&gt; .

&lt;http://example.org/graphs/example&gt;
  {
       :user1 a :User;
              p:name ”Alice” .

   }
```

In the contract events: `CreateRDF`, `UpdateRDF`, `RemoveRDF`, and the `rdfOf method`, the  `rdfStatements` is used in `ttl` format by default. If other formats listed above are used, a format identifier needs to be added for identification.

The format identifier starts with `[` and ends with `]` with the format in the middle, i.e., `[format]`.

For example, the `rdfStatements` in `nt` format should include the prefix `[nt]`.

```text
[nt]subject predicate object .
```


### Contract Interface

```solidity
/**
 * @title Semantic Soulbound Token
 * Note: the ERC-165 identifier for this interface is 0xfbafb698
 */
interface ISemanticSBT{
    /**
     * @dev This emits when minting a Semantic Soulbound Token.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the Semantic Soulbound Token. 
     */
    event CreateRDF (
        uint256 indexed tokenId,
        string  rdfStatements
    );
    /**
     * @dev 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.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the semantic soulbound token. 
     */
    event UpdateRDF (
        uint256 indexed tokenId,
        string  rdfStatements
    );
    /**
     * @dev This emits when burning or revoking Semantic Soulbound Token.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the Semantic Soulbound Token. 
     */
    event RemoveRDF (
        uint256 indexed tokenId,
        string  rdfStatements
    );
    /**
     * @dev Returns the RDF statements of the Semantic Soulbound Token. 
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @return rdfStatements The RDF statements for the Semantic Soulbound Token. 
     */
    function rdfOf(uint256 tokenId) external view returns (string memory rdfStatements);
}
```

`ISemanticRDFSchema`, an extension of ERC-721 Metadata, is **OPTIONAL** for this standard, it is used to get the Schema URI for the RDF data.

```solidity
interface ISemanticRDFSchema{
    /**
     * @notice Get the URI of schema for this contract.
     * @return The URI of the contract which point to a configuration profile.
     */
    function schemaURI() external view returns (string memory);
}
```


### Method Specification

`rdfOf (uint256 tokenId)`: Query the RDF data for the Semantic Soulbound Token by `tokenId`. 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.

`schemaURI()`: This **OPTIONAL** 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 **RECOMMENDED** 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.

### Event Specification

`CreateRDF`: When minting a Semantic Soulbound Token, this event **MUST** be triggered to notify the listener to perform operations with the created RDF data. When calling the event, the input RDF data **MUST** be RDF statements, which are units of information consisting of three parts: a subject, a predicate, and an object.

`UpdateRDF`: When updating RDF data for a Semantic Soulbound Token, this event **MUST** be triggered to notify the listener to perform update operations accordingly with the updated RDF data. When calling the event, the input RDF data **MUST** be RDF statements, which are units of information consisting of three parts: a subject, a predicate, and an object.

`RemoveRDF`: When burning or revoking a Semantic Soulbound Token, this event **MUST** 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 **MUST** be RDF statements, which are units of information consisting of three parts: a subject, a predicate, and an object.

## Rationale


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.


There are multiple formats for RDF statements. We list six most widely adopted RDF statement formats in the EIP: `Turtle`, `N-Triples`, `RDF/XML`, `RDF/JSON`,`N-Quads`, and `TriG`. These formats have different advantages and applicability in expressing, storing, and parsing RDF statements. Among these, `Turtle` 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.


## Backwards Compatibility

This proposal is fully backward compatible with [ERC-721](./eip-721.md) and [ERC-5192](./eip-5192.md).

## Security Considerations

There are no security considerations related directly to the implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE). 
</description>
        <pubDate>Fri, 30 Dec 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6239</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6239</guid>
      </item>
    
      <item>
        <title>Untransferability Indicator for EIP-1155</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/sbt-implemented-in-erc1155/12182</comments>
        
        <description>## Abstract

This EIP standardizes an interface indicating [EIP-1155](./eip-1155.md)-compatible token non-transferability using [EIP-165](./eip-165.md) feature detection.

## Motivation

Soulbound Tokens (SBT) are non-transferable tokens. While [EIP-5192](./eip-5192.md) 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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

Smart contracts implementing this standard MUST comform to the [EIP-1155](./eip-1155.md) specification.

Smart contracts implementing this standard MUST implement all of the functions in the `IERC6268` interface.

Smart contracts implementing this standard MUST implement the [EIP-165](./eip-165.md) supportsInterface function and MUST return the constant value true if `0xd87116f3` is passed through the interfaceID argument.

For the token identifier `_id` that is marked as `locked`, `locked(_id)` MUST return the constant value true and any functions that try transferring the token, including `safeTransferFrom` and `safeBatchTransferFrom` function MUST throw.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IERC6268 {
  /// @notice Either `LockedSingle` or `LockedBatch` MUST emit when the locking status is changed to locked.
  /// @dev If a token is minted and the status is locked, this event should be emitted.
  /// @param _id The identifier for a token.
  event LockedSingle(uint256 _id);

  /// @notice Either `LockedSingle` or `LockedBatch` MUST emit when the locking status is changed to locked.
  /// @dev If a token is minted and the status is locked, this event should be emitted.
  /// @param _ids The list of identifiers for tokens.
  event LockedBatch(uint256[] _ids);

  /// @notice Either `UnlockedSingle` or `UnlockedBatch` MUST emit when the locking status is changed to unlocked.
  /// @dev If a token is minted and the status is unlocked, this event should be emitted.
  /// @param _id The identifier for a token.
  event UnlockedSingle(uint256 _id);

  /// @notice Either `UnlockedSingle` or `UnlockedBatch` MUST emit when the locking status is changed to unlocked.
  /// @dev If a token is minted and the status is unlocked, this event should be emitted.
  /// @param _ids The list of identifiers for tokens.
  event UnlockedBatch(uint256[] _ids);


  /// @notice Returns the locking status of the token.
  /// @dev SBTs assigned to zero address are considered invalid, and queries
  /// about them do throw.
  /// @param _id The identifier for a token.
  function locked(uint256 _id) external view returns (bool);

  /// @notice Returns the locking statuses of the multiple tokens.
  /// @dev SBTs assigned to zero address are considered invalid, and queries
  /// about them do throw.
  /// @param _ids The list of identifiers for tokens
  function lockedBatch(uint256[] _ids) external view returns (bool);
}
```

## Rationale

Needs discussion.

## Backwards Compatibility

This proposal is fully backward compatible with [EIP-1155](./eip-1155.md).

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 06 Jan 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6268</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6268</guid>
      </item>
    
      <item>
        <title>ERC-2771 Namespaced Account Abstraction</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/trustless-eip-2771/12497</comments>
        
        <description>## Abstract

[ERC-2771](./eip-2771.md) is a prevalent standard for handling meta-transactions via trusted forwarders. This EIP proposes an extension to [ERC-2771](./eip-2771.md) to introduce a namespacing mechanism, facilitating trustless account abstraction through per-forwarder namespaced addresses.

## Specification

The key words &quot;MUST&quot;, &quot;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 key words &quot;Forwarder&quot; and &quot;Recipient&quot; in this document are to be interpreted as described in [ERC-2771](./eip-2771.md).

### Namespaced Forwarder Interface

```solidity
pragma solidity ^0.8.0;

interface INamespacedForwarder {
    function isNamespacedTransaction() external view returns (bool);
}
```

### Determining the Sender and Forwarder

Upon function invocation on a Recipient, the Recipient MUST execute a `STATICCALL` to the `isNamespacedTransaction()` method of the caller. If this operation reverts or returns the boolean value `false`, the transaction MUST proceed normally, identifying the caller as the sender, and the Forwarder as the zero address. However, if the boolean value `true` is returned, the transaction is acknowledged as a namespaced transaction, with the sender identified using the procedure outlined in [ERC-2771](./eip-2771.md#extracting-the-transaction-signer-address), and the Forwarder identified as the caller.

### Recipient Extensions

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 `Namespaced` 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., [ERC-20](./eip-20.md)&apos;s `transferFrom`), 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.

For instance, [ERC-20](./eip-20.md) would be extended with these functions:

```solidity
function transferNamespaced(address toForwarder, address toAddress, uint256 amount);
function approveNamespaced(address spenderForwarder, address spenderAddress, uint256 amount);
function transferFromNamespaced(address fromForwarder, address fromAddress, address toForwarder, address toAddress, uint256 amount);
```

#### [ERC-165](./eip-165.md)

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.

## Rationale

The approach of simply augmenting existing EIP functions with new `address` parameters, rather than crafting new interfaces for the most commonly used EIPs, is employed to ensure broader applicability of this namespacing proposal.

## Backwards Compatibility

Contracts already deployed cannot not benefit from this namespacing proposal. This limitation also extends to ERC-2771.

### Using this EIP in standards

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.

## Security Considerations

This proposal alters trust dynamics: Forwarders no longer require Recipient trust, but instead require the trust of their users.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 11 Jan 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6315</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6315</guid>
      </item>
    
      <item>
        <title>Elastic Signature</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6327-elastic-signature-es/12554</comments>
        
        <description>## Abstract

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.


## Motivation

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. 

### Use case

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.

- 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.
- ES can also be used as a plugin to a smart contract wallet, like Account Abstraction [ERC-4337](./eip-4337.md). A decentralized password is picked instead of the private key. This could lead to a smooth onboarding experiences for new Ethereum Dapp users.


## Specification

Let:

- `pwdhash` represents the hash of the private secret (password).
- `datahash` represents the hash of an intended transaction data.
- `fullhash` represents the hash of `datahash` and all the well-known variables.
- `expiration` is the timestamp after which the intended transaction expires. 
- `allhash` represents the hash of `fullhash` and `pwdhash`.


There are three parties involved, Verifier, Requester and Prover.

- A verifier, 
  - SHOULD compute `fullhash` from a `datahash`, which is provided by the requester.
  - SHOULD derive `pwdhash` for a given address. The address can be an EOA or a smart contract wallet.
  - SHOULD verify the proof with the derived `pwdhash`, the computed `fullhash` and a `allhash`, which is submitted by the requester.
- A requester
  - SHOULD generate `datahash` and decide an `expiration`.
  - SHALL request a verification from the verifier with, 
    - `proof` and `allhash` which are provided by the prover;
    - `datahash`;
    - `expiration`.
- A prover
  - SHOULD generate the `proof` and `allhash` from, 
    - `datahash` and `expiration` which are agreed with the requester;
    - `nonce` and other well-known variables. 

There are also some requirements.

- well-known variable SHOULD be available to all parties.
  - SHOULD include a `nonce`.
  - SHOULD include a `chainid`.
  - MAY include any variable that is specific to the verifier.
- public statements SHOULD include, 
  - one reflecting the `pwdhash`;
  - one reflecting the `fullhash`;
  - one reflecting the `allhash`.
- The computation of `fullhash` SHOULD be agreed by both the verifier and the prover.
- The computation of `datahash`

### `IElasticSignature` Interface 

This is the verifier interface.

```solidity
pragma solidity ^0.8.0;

interface IElasticSignature {
    /**
     * Event emitted after user set/reset their password
     * @param user - an user&apos;s address, for whom the password hash is set. It could be a smart contract wallet address
     *  or an EOA wallet address.
     * @param pwdhash - a password hash
     */
    event SetPassword(address indexed user, uint indexed pwdhash);

    /**
     * Event emitted after a successful verification performed for an user
     * @param user - an user&apos;s address, for whom the submitted `proof` is verified. It could be a smart contract wallet
     *  address or an EOA wallet address.
     * @param nonce - a new nonce, which is newly generated to replace the last used nonce. 
     */
    event Verified(address indexed user, uint indexed nonce);

    /**
     * Get `pwdhash` for a user
     * @param user - a user&apos;s address 
     * @return - the `pwdhash` for the given address
     */
    function pwdhashOf(address user) external view returns (uint);

    /**
     * Update an user&apos;s `pwdhash`
     * @param proof1 - proof generated by the old password
     * @param expiration1 - old password signing expiry seconds
     * @param allhash1 - allhash generated with the old password
     * @param proof2 - proof generated by the new password
     * @param pwdhash2 - hash of the new password
     * @param expiration2 - new password signing expiry seconds
     * @param allhash2 - allhash generated with the new password
     */
    function resetPassword(
        uint[8] memory proof1,
        uint expiration1,
        uint allhash1,
        uint[8] memory proof2,
        uint pwdhash2,
        uint expiration2,
        uint allhash2
    ) external;

    /**
     * Verify a proof for a given user
     * It should be invoked by other contracts. The other contracts provide the `datahash`. The `proof` is generated by
     *  the user. 
     * @param user -  a user&apos;s address, for whom the verification will be carried out.
     * @param proof - a proof generated by the password
     * @param datahash - the data what user signing, this is the hash of the data
     * @param expiration - number of seconds from now, after which the proof is expired 
     * @param allhash - public statement, generated along with the `proof`
     */
    function verify(
        address user,
        uint[8] memory proof,
        uint datahash,
        uint expiration,
        uint allhash
    ) external;
}
```

`verify` function SHOULD be called by another contract. The other contract SHOULD generate the `datahash` to call this. The function SHOULD verify if the `allhash` is computed correctly and honestly with the password.


## Rationale

The contract will store everyone&apos;s `pwdhash`.

![verifier-contract](../assets/eip-6327/zkpass-1.png)

The chart below shows ZK circuit logic.

![circuit-logic](../assets/eip-6327/zkpass-2.png)

To verify the signature, it needs `proof`, `allhash`, `pwdhash` and `fullhash`.

![workflow](../assets/eip-6327/zkpass-3.png)

The prover generates `proof` along with the public outputs. They will send all of them to a third-party requester contract. The requester will generate the `datahash`. It sends `datahash`, `proof`, `allhash`, `expiration` and prover&apos;s address to the verifier contract. The contract verifies that the `datahash` is from the prover, which means the withdrawal operation is signed by the prover&apos;s password.


## Backwards Compatibility

This EIP is backward compatible with previous work on signature validation since this method is specific to password based signatures and not EOA signatures. 


## Reference Implementation

Example implementation of a signing contract:

```solidity
pragma solidity ^0.8.0;

import &quot;../interfaces/IElasticSignature.sol&quot;;
import &quot;./verifier.sol&quot;;

contract ZKPass is IElasticSignature {
    Verifier verifier = new Verifier();

    mapping(address =&gt; uint) public pwdhashOf;

    mapping(address =&gt; uint) public nonceOf;

    constructor() {
    }

    function resetPassword(
        uint[8] memory proof1,
        uint expiration1,
        uint allhash1,
        uint[8] memory proof2,
        uint pwdhash2,
        uint expiration2,
        uint allhash2
    ) public override {
        uint nonce = nonceOf[msg.sender];

        if (nonce == 0) {
            //init password

            pwdhashOf[msg.sender] = pwdhash2;
            nonceOf[msg.sender] = 1;
            verify(msg.sender, proof2, 0, expiration2, allhash2);
        } else {
            //reset password

            // check old pwdhash
            verify(msg.sender, proof1, 0, expiration1, allhash1);

            // check new pwdhash
            pwdhashOf[msg.sender] = pwdhash2;
            verify(msg.sender, proof2, 0, expiration2, allhash2);
        }

        emit SetPassword(msg.sender, pwdhash2);
    }

    function verify(
        address user,
        uint[8] memory proof,
        uint datahash,
        uint expiration,
        uint allhash
    ) public override {
        require(
            block.timestamp &lt; expiration,
            &quot;ZKPass::verify: expired&quot;
        );

        uint pwdhash = pwdhashOf[user];
        require(
            pwdhash != 0,
            &quot;ZKPass::verify: user not exist&quot;
        );

        uint nonce = nonceOf[user];
        uint fullhash = uint(keccak256(abi.encodePacked(expiration, block.chainid, nonce, datahash))) / 8; // 256b-&gt;254b
        require(
            verifyProof(proof, pwdhash, fullhash, allhash),
            &quot;ZKPass::verify: verify proof fail&quot;
        );

        nonceOf[user] = nonce + 1;

        emit Verified(user, nonce);
    }

    /////////// util ////////////

    function verifyProof(
        uint[8] memory proof,
        uint pwdhash,
        uint fullhash, //254b
        uint allhash
    ) internal view returns (bool) {
        return
            verifier.verifyProof(
                [proof[0], proof[1]],
                [[proof[2], proof[3]], [proof[4], proof[5]]],
                [proof[6], proof[7]],
                [pwdhash, fullhash, allhash]
            );
    }
}
```

verifier.sol is auto generated by snarkjs, the source code circuit.circom is below

```javascript
pragma circom 2.0.0;

include &quot;../../node_modules/circomlib/circuits/poseidon.circom&quot;;

template Main() {
    signal input in[3];
    signal output out[3];

    component poseidon1 = Poseidon(2);
    component poseidon2 = Poseidon(2);

    poseidon1.inputs[0] &lt;== in[0];  //pwd
    poseidon1.inputs[1] &lt;== in[1];  //address
    out[0] &lt;== poseidon1.out; //pwdhash

    poseidon2.inputs[0] &lt;== poseidon1.out;
    poseidon2.inputs[1] &lt;== in[2]; //fullhash
    out[1] &lt;== in[2]; //fullhash
    out[2] &lt;== poseidon2.out; //allhash
}

component main = Main();
```


## Security Considerations

Since the pwdhash is public, it is possible to be crack the password. We estimate the Poseidon hash rate of RTX3090 would be 100Mhash/s, this is the estimate of crack time:

8 chars (number) : 1 secs

8 chars (number + english) : 25 days

8 chars (number + english + symbol) : 594 days

12 chars (number) : 10000 secs

12 chars (number + english) : 1023042 years

12 chars (number + english + symbol) : 116586246 years

The crack difficulty of private key is 2^256, the crack difficulty of 40 chars (number + english + symbol) is 92^40, 92^40 &gt; 2^256, so when password is 40 chars , it is more difficult to be crack than private key.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 13 Jan 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6327</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6327</guid>
      </item>
    
      <item>
        <title>Charity token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc20-charity-token/12617</comments>
        
        <description>## Abstract

An extension to [EIP-20](./eip-20.md) 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.

## Motivation

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 [EIP-20](./eip-20.md) 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.

## Specification

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.

Owner of the contract **MAY**, after review, register charity address in `whitelistedRate` and set globally a default rate of donation. To register the address, the rate **MUST** not be null.

Token holders **MAY** choose and specify a default charity address from `_defaultAddress`, this address **SHOULD** be different from the null address for the donation to be activated.

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 `charityInfo()` , which specifies an assigned rate for a given address.

This standard provides functionality that allows token holders to donate easily. The donation when activated is done directly in the overridden `transfer`, `transferFrom`, and `approve` functions.

When `transfer`, `transferFrom` are called the sender&apos;s balance is reduced by the initial amount and a donation amount is deduced. The initial transferred amount is transferred to the recipient&apos;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 `Transfer` events.
Also, if the account has an insufficient balance to cover the transfer and the donation the whole transfer would revert.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.4;

///
/// @dev Required interface of an ERC20 Charity compliant contract.
///
interface IERC20charity is IERC165 {
    /// The EIP-165 identifier for this interface is 0x557512b6

    
    /**
     * @dev Emitted when `toAdd` charity address is added to `whitelistedRate`.
     */
    event AddedToWhitelist (address toAdd);

    /**
     * @dev Emitted when `toRemove` charity address is deleted from `whitelistedRate`.
     */
    event RemovedFromWhitelist (address toRemove);

    /**
     * @dev Emitted when `_defaultAddress` charity address is modified and set to `whitelistedAddr`.
     */
    event DonnationAddressChanged (address whitelistedAddr);

    /**
     * @dev Emitted when `_defaultAddress` charity address is modified and set to `whitelistedAddr` 
    * and _donation is set to `rate`.
     */
    event DonnationAddressAndRateChanged (address whitelistedAddr,uint256 rate);

    /**
     * @dev Emitted when `whitelistedRate` for `whitelistedAddr` is modified and set to `rate`.
     */
    event ModifiedCharityRate(address whitelistedAddr,uint256 rate);
    
    /**
    *@notice Called with the charity address to determine if the contract whitelisted the address
    *and if it is the rate assigned.
    *@param addr - the Charity address queried for donnation information.
    *@return whitelisted - true if the contract whitelisted the address to receive donnation
    *@return defaultRate - the rate defined by the contract owner by default , the minimum rate allowed different from 0
    */
    function charityInfo(
        address addr
    ) external view returns (
        bool whitelisted,
        uint256 defaultRate
    );

    /**
    *@notice Add address to whitelist and set rate to the default rate.
    * @dev Requirements:
     *
     * - `toAdd` cannot be the zero address.
     *
     * @param toAdd The address to whitelist.
     */
    function addToWhitelist(address toAdd) external;

    /**
    *@notice Remove the address from the whitelist and set rate to the default rate.
    * @dev Requirements:
     *
     * - `toRemove` cannot be the zero address.
     *
     * @param toRemove The address to remove from whitelist.
     */
    function deleteFromWhitelist(address toRemove) external;

    /**
    *@notice Get all registered charity addresses.
     */
    function getAllWhitelistedAddresses() external ;

    /**
    *@notice Display for a user the rate of the default charity address that will receive donation.
     */
    function getRate() external view returns (uint256);

    /**
    *@notice Set personlised rate for charity address in {whitelistedRate}.
    * @dev Requirements:
     *
     * - `whitelistedAddr` cannot be the zero address.
     * - `rate` cannot be inferior to the default rate.
     *
     * @param whitelistedAddr The address to set as default.
     * @param rate The personalised rate for donation.
     */
    function setSpecificRate(address whitelistedAddr , uint256 rate) external;

    /**
    *@notice Set for a user a default charity address that will receive donation. 
    * The default rate specified in {whitelistedRate} will be applied.
    * @dev Requirements:
     *
     * - `whitelistedAddr` cannot be the zero address.
     *
     * @param whitelistedAddr The address to set as default.
     */
    function setSpecificDefaultAddress(address whitelistedAddr) external;

    /**
    *@notice Set for a user a default charity address that will receive donation. 
    * The rate is specified by the user.
    * @dev Requirements:
     *
     * - `whitelistedAddr` cannot be the zero address.
     * - `rate` cannot be less than to the default rate 
     * or to the rate specified by the owner of this contract in {whitelistedRate}.
     *
     * @param whitelistedAddr The address to set as default.
     * @param rate The personalised rate for donation.
     */
    function setSpecificDefaultAddressAndRate(address whitelistedAddr , uint256 rate) external;

    /**
    *@notice Display for a user the default charity address that will receive donation. 
    * The default rate specified in {whitelistedRate} will be applied.
     */
    function specificDefaultAddress() external view returns (
        address defaultAddress
    );

    /**
    *@notice Delete The Default Address and so deactivate donnations .
     */
    function deleteDefaultAddress() external;
}

```

### Functions

#### **addToWhitelist**

Add address to whitelist and set the rate to the default rate.

| Parameter | Description |
| ---------|-------------|
| toAdd | The address to the whitelist.

#### **deleteFromWhitelist**

Remove the address from the whitelist and set rate to the default rate.

| Parameter | Description |
| ---------|-------------|
| toRemove | The address to remove from whitelist.

#### **getAllWhitelistedAddresses**

Get all registered charity addresses.

#### **getRate**

Display for a user the rate of the default charity address that will receive donation.

#### **setSpecificRate**

Set personalized rate for charity address in {whitelistedRate}.

| Parameter | Description |
| ---------|-------------|
| whitelistedAddr | The address to set as default. |
| rate  | The personalised rate for donation. |

#### **setSpecificDefaultAddress**

Set for a user a default charity address that will receive donations. The default rate specified in {whitelistedRate} will be applied.

| Parameter | Description |
| ---------|-------------|
| whitelistedAddr | The address to set as default.

#### **setSpecificDefaultAddressAndRate**

Set for a user a default charity address that will receive donations. The rate is specified by the user.

| Parameter | Description |
| ---------|-------------|
| whitelistedAddr | The address to set as default. |
| rate  | The personalized rate for donation.

#### **specificDefaultAddress**

Display for a user the default charity address that will receive donations. The default rate specified in {whitelistedRate} will be applied.

#### **deleteDefaultAddress**

Delete The Default Address and so deactivate donations.

#### **charityInfo**

Called with the charity address to determine if the contract whitelisted the address and if it is, the rate assigned.

| Parameter | Description |
| ---------|-------------|
| addr | The Charity address queried for donnation information.

## Rationale

 This EIP chooses to whitelist charity addresses by using an array and keeping track of the &quot;active&quot; status with a mapping `whitelistedRate` 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.

 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 `transfer` 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.

 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.

## Backwards Compatibility

This implementation is an extension of the functionality of [EIP-20](./eip-20.md), it introduces new functionality retaining the core interfaces and functionality of the [EIP-20](./eip-20.md) standard. There is a small backwards compatibility issue, indeed if an account has insufficient balance, it&apos;s possible for the transfer to fail.

## Test Cases

Tests can be found in [`charity.js`](../assets/eip-6353/test/charity.js).

## Reference Implementation

The reference implementation of the standard can be found under [`contracts/`](../assets/eip-6353/contracts/ERC20Charity.sol) folder.

## Security Considerations

There are no additional security considerations compared to EIP-20.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 13 May 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6353</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6353</guid>
      </item>
    
      <item>
        <title>Single-contract Multi-delegatecall</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6357-single-contract-multicall/12621</comments>
        
        <description>## Abstract

This EIP standardizes an interface containing a single function, `multicall`, allowing EOAs to call multiple functions of a smart contract in a single transaction, and revert all calls if any call fails. 

## Motivation

Currently, in order to transfer several [ERC-721](./eip-721.md) NFTs, one needs to submit a number of transactions equal to the number of NFTs being tranferred. This wastes users&apos; funds by requiring them to pay 21000 gas fee for every NFT they transfer.

## Specification

The key words &quot;MUST&quot;, &quot;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.

Contracts implementing this EIP must implement the following interface:
  
```solidity
pragma solidity ^0.8.0;

interface IMulticall {
    /// @notice           Takes an array of abi-encoded call data, delegatecalls itself with each calldata, and returns the abi-encoded result
    /// @dev              Reverts if any delegatecall reverts
    /// @param    data    The abi-encoded data
    /// @returns  results The abi-encoded return values
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results);

    /// @notice           OPTIONAL. Takes an array of abi-encoded call data, delegatecalls itself with each calldata, and returns the abi-encoded result
    /// @dev              Reverts if any delegatecall reverts
    /// @param    data    The abi-encoded data
    /// @param    values  The effective msg.values. These must add up to at most msg.value
    /// @returns  results The abi-encoded return values
    function multicallPayable(bytes[] calldata data, uint256[] values) external payable virtual returns (bytes[] memory results);
}
```

## Rationale

`multicallPayable` is optional because it isn&apos;t always feasible to implement, due to the `msg.value` splitting.

## Backwards Compatibility

This is compatible with most existing multicall functions.

## Test Cases

The following JavaScript code, using the Ethers library, should atomically transfer `amt` units of an [ERC-20](./eip-20.md) token to both `addressA` and `addressB`.

```js
await token.multicall(await Promise.all([
    token.interface.encodeFunctionData(&apos;transfer&apos;, [ addressA, amt ]),
    token.interface.encodeFunctionData(&apos;transfer&apos;, [ addressB, amt ]),
]));
```

## Reference Implementation

```solidity
pragma solidity ^0.8.0;

/// Derived from OpenZeppelin&apos;s implementation
abstract contract Multicall is IMulticall {
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i &lt; data.length; i++) {
            (bool success, bytes memory returndata) = address(this).delegatecall(data);
            require(success);
            results[i] = returndata;
        }
        return results;
    }
}
```

## Security Considerations

`multicallPayable` 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 18 Jan 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6357</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6357</guid>
      </item>
    
      <item>
        <title>Cross-Chain Token States Synchronization</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/add-eip-6358-omniverse-distributed-ledger-technology/12625</comments>
        
        <description>## Abstract

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 [ERC-20](./eip-20.md)/[ERC-721](./eip-721.md) over multi-chains.  

### Figure.1 Architecture

![img](../assets/eip-6358/img/o-dlt.png)    

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.

## Motivation

- The current paradigm of token bridges makes assets fragment.  
- If ETH was transferred to another chain through the current token bridge, if the chain broke down, ETH will be lost for users.  

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. 

- The fragment problem will be solved.
- The security of users&apos; multi-chain assets can be greatly enhanced.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Omniverse Account

There SHOULD be a global user identifier of this ERC, which is RECOMMENDED to be referred to as Omniverse Account (`o-account` for short) in this article.  
The `o-account` is RECOMMENDED to be expressed as a public key created by the elliptic curve `secp256k1`. A [mapping mechanism](#mapping-mechanism-for-different-environments) is RECOMMENDED for different environments.  

### Data Structure

An Omniverse Transaction (`o-transaction` for short) MUST be described with the following data structure:

```solidity
/**
 * @notice Omniverse transaction data structure
 * @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`. 
 * @member chainId: The chain where the o-transaction is initiated
 * @member initiateSC: The contract address from which the o-transaction is first initiated
 * @member from: The Omniverse account which signs the o-transaction
 * @member payload: The encoded business logic data, which is maintained by the developer
 * @member signature: The signature of the above informations. 
 */
struct ERC6358TransactionData {
    uint128 nonce;
    uint32 chainId;
    bytes initiateSC;
    bytes from;
    bytes payload;
    bytes signature;
}
```

- The data structure `ERC6358TransactionData` MUST be defined as above.
- The member `nonce` MUST be defined as `uint128` due to better compatibility for more tech stacks of blockchains.
- The member `chainId` MUST be defined as `uint32`.
- The member `initiateSC` MUST be defined as `bytes`.
- The member `from` MUST be defined as `bytes`.
- The member `payload` MUST be defined as `bytes`. It is encoded from a user-defined data related to the o-transaction. For example:  
    - For fungible tokens it is RECOMMENDED as follows:  

        ```solidity
        /**
        * @notice Fungible token data structure, from which the field `payload` in `ERC6358TransactionData` will be encoded
        *
        * @member op: The operation type
        * NOTE op: 0-31 are reserved values, 32-255 are custom values
        *           op: 0 - omniverse account `from` transfers `amount` tokens to omniverse account `exData`, `from` have at least `amount` tokens
        *           op: 1 - omniverse account `from` mints `amount` tokens to omniverse account `exData`
        *           op: 2 - omniverse account `from` burns `amount` tokens from his own, `from` have at least `amount` tokens
        * @member exData: The operation data. This sector could be empty and is determined by `op`. For example: 
                    when `op` is 0 and 1, `exData` stores the omniverse account that receives.
                    when `op` is 2, `exData` is empty.
        * @member amount: The amount of tokens being operated
        */
        struct Fungible {
            uint8 op;
            bytes exData;
            uint256 amount;
        }
        ```

        - The related raw data for `signature` in `o-transaction` is RECOMMENDED to be the concatenation of the raw bytes of `op`, `exData`, and `amount`.  

    - For non-fungible tokens it is RECOMMENDED as follows:  

        ```solidity
        /**
        * @notice Non-Fungible token data structure, from which the field `payload` in `ERC6358TransactionData` will be encoded
        *
        * @member op: The operation type
        * NOTE op: 0-31 are reserved values, 32-255 are custom values
        *           op: 0 omniverse account `from` transfers token `tokenId` to omniverse account `exData`, `from` have the token with `tokenId`
        *           op: 1 omniverse account `from` mints token `tokenId` to omniverse account `exData`
        *           op: 2 omniverse account `from` burns token `tokenId`, `from` have the token with `tokenId`
        * @member exData: The operation data. This sector could be empty and is determined by `op`
        *           when `op` is 0 and 1, `exData` stores the omniverse account that receives.
                    when `op` is 2, `exData` is empty.
        * @member tokenId: The tokenId of the non-fungible token being operated
        */
        struct NonFungible {
            uint8 op;
            bytes exData;
            uint256 tokenId;
        }
        ```

        - The related raw data for `signature` in `o-transaction` is RECOMMENDED to be the concatenation of the raw bytes of `op`, `exData`, and `tokenId`. 

- The member `signature` MUST be defined as `bytes`. It is RECOMMENDED to be created as follows.  
    - It is OPTIONAL that concating the sectors in `ERC6358TransactionData` as below (take Fungible token for example) and calculate the hash with `keccak256`: 

        ```solidity
        /**
        * @notice Decode `_data` from bytes to Fungible
        * @return A `Fungible` instance
        */
        function decodeData(bytes memory _data) internal pure returns (Fungible memory) {
            (uint8 op, bytes memory exData, uint256 amount) = abi.decode(_data, (uint8, bytes, uint256));
            return Fungible(op, exData, amount);
        }
        
        /**
        * @notice Get the hash of a transaction
        * @return Hash value of the raw data of an `ERC6358TransactionData` instance
        */
        function getTransactionHash(ERC6358TransactionData memory _data) public pure returns (bytes32) {
            Fungible memory fungible = decodeData(_data.payload);
            bytes memory payload = abi.encodePacked(fungible.op, fungible.exData, fungible.amount);
            bytes memory rawData = abi.encodePacked(_data.nonce, _data.chainId, _data.initiateSC, _data.from, payload);
            return keccak256(rawData);
        }
        ```

    - It is OPTIONAL that encapsulating the sectors in `ERC6358TransactionData` according to `EIP-712`.
    - Sign the hash value.

### Smart Contract Interface

- Every [ERC-6358](./eip-6358.md) compliant contract MUST implement the `IERC6358`  

    ```solidity
    /**
    * @notice Interface of the ERC-6358
    */
    interface IERC6358 {
        /**
        * @notice Emitted when a o-transaction which has nonce `nonce` and was signed by user `pk` is sent by calling {sendOmniverseTransaction}
        */
        event TransactionSent(bytes pk, uint256 nonce);

        /**
        * @notice Sends an `o-transaction` 
        * @dev 
        * Note: MUST implement the validation of the `_data.signature`
        * Note: A map maintaining the  `o-account` and the related transaction nonce is RECOMMENDED  
        * Note: MUST implement the validation of the `_data.nonce` according to the current account nonce
        * Note: MUST implement the validation of the `_data. payload`
        * Note: This interface is just for sending an `o-transaction`, and the execution MUST NOT be within this interface 
        * Note: The actual execution of an `o-transaction` is RECOMMENDED to be in another function and MAY be delayed for a time
        * @param _data: the `o-transaction` data with type {ERC6358TransactionData}
        * See more information in the definition of {ERC6358TransactionData}
        *
        * Emit a {TransactionSent} event
        */
        function sendOmniverseTransaction(ERC6358TransactionData calldata _data) external;

        /**
        * @notice Get the number of omniverse transactions sent by user `_pk`, 
        * which is also the valid `nonce` of a new omniverse transactions of user `_pk` 
        * @param _pk: Omniverse account to be queried
        * @return The number of omniverse transactions sent by user `_pk`
        */
        function getTransactionCount(bytes memory _pk) external view returns (uint256);

        /**
        * @notice Get the transaction data `txData` and timestamp `timestamp` of the user `_use` at a specified nonce `_nonce`
        * @param _user Omniverse account to be queried
        * @param _nonce The nonce to be queried
        * @return Returns the transaction data `txData` and timestamp `timestamp` of the user `_use` at a specified nonce `_nonce`
        */
        function getTransactionData(bytes calldata _user, uint256 _nonce) external view returns (ERC6358TransactionData memory, uint256);

        /**
        * @notice Get the chain ID
        * @return Returns the chain ID
        */
        function getChainId() external view returns (uint32);
    }
    ```

    - The `sendOmniverseTransaction` function MAY be implemented as `public` or `external`
    - The `getTransactionCount` function MAY be implemented as `public` or `external`
    - The `getTransactionData` function MAY be implemented as `public` or `external`
    - The `getChainId` function MAY be implemented as `pure` or `view`
    - The `TransactionSent` event MUST be emitted when `sendOmniverseTransaction` function is called
- Optional Extension: Fungible Token  

    ```solidity
    // import &quot;{IERC6358.sol}&quot;;

    /**
    * @notice Interface of the ERC-6358 fungible token, which inherits {IERC6358}
    */
    interface IERC6358Fungible is IERC6358 {
        /**
        * @notice Get the omniverse balance of a user `_pk`
        * @param _pk `o-account` to be queried
        * @return Returns the omniverse balance of a user `_pk`
        */
        function omniverseBalanceOf(bytes calldata _pk) external view returns (uint256);
    }
    ```

    - The `omniverseBalanceOf` function MAY be implemented as `public` or `external`

- Optional Extension: NonFungible Token  

    ```solidity
    import &quot;{IERC6358.sol}&quot;;

    /**
    * @notice Interface of the ERC-6358 non fungible token, which inherits {IERC6358}
    */
    interface IERC6358NonFungible is IERC6358 {
        /**
        * @notice Get the number of omniverse NFTs in account `_pk`
        * @param _pk `o-account` to be queried
        * @return Returns the number of omniverse NFTs in account `_pk`
        */
        function omniverseBalanceOf(bytes calldata _pk) external view returns (uint256);

        /**
        * @notice Get the owner of an omniverse NFT with `tokenId`
        * @param _tokenId Omniverse NFT id to be queried
        * @return Returns the owner of an omniverse NFT with `tokenId`
        */
        function omniverseOwnerOf(uint256 _tokenId) external view returns (bytes memory);
    }
    ```

    - The `omniverseBalanceOf` function MAY be implemented as `public` or `external`
    - The `omniverseOwnerOf` function MAY be implemented as `public` or `external`

## Rationale

### Architecture

As shown in [Figure.1](#figure1-architecture), smart contracts deployed on multi-chains execute `o-transactions` of ERC-6358 tokens synchronously through the trustless off-chain synchronizers.   

- The ERC-6358 smart contracts are referred to as **Abstract Nodes**. 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.  
- **Synchronizer** is an off-chain execution program responsible for carrying published  `o-transactions` from the ERC-6358 smart contracts on one blockchain to the others. The synchronizers work trustless as they just deliver `o-transactions` with others&apos; signatures, and details could be found in the [workflow](#workflow).

### Principle

- The `o-account` has been mentioned [above](#omniverse-account).
- The synchronization of the `o-transactions` guarantees the ultimate consistency of token states across all chains. The related data structure is [here](#data-structure).

    - A `nonce` mechanism is brought in to make the states consistent globally.
    - The `nonce` appears in two places, the one is `nonce in o-transaction` data structure, and the other is `account nonce` maintained by on-chain ERC-6358 smart contracts. 
    - When synchronizing, the `nonce in o-transaction` data will be checked by comparing it to the `account nonce`.

#### Workflow

- Suppose a common user `A` and her related operation `account nonce` is $k$.
- `A` initiates an `o-transaction` on Ethereum by calling `IERC6358::sendOmniverseTransaction`. The current `account nonce` of `A` in the ERC-6358 smart contracts deployed on Ethereum is $k$ so the valid value of `nonce in o-transaction` needs to be $k+1$.  
- The ERC-6358 smart contracts on Ethereum verify the signature of the `o-transaction` data. If the verification succeeds, the `o-transaction` data will be published by the smart contracts on the Ethereum side. The verification includes:
    - whether the balance (FT) or the ownership (NFT) is valid
    - and whether the `nonce in o-transaction` is $k+1$
- The `o-transaction` SHOULD NOT be executed on Ethereum immediately, but wait for a time.  
- Now, `A`&apos;s latest submitted `nonce in o-transaction` on Ethereum is $k+1$, but still $k$ on other chains.
- The off-chain synchronizers will find a newly published `o-transaction` on Ethereum but not on other chains.  
- 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.) 
- Finally, the ERC-6358 smart contracts deployed on other chains will all receive the `o-transaction` data, verify the signature and execute it when the **waiting time is up**. 
- After execution, the `account nonce` on all chains will add 1. Now all the `account nonce` of account `A` will be $k+1$, and the state of the balances of the related account will be the same too.  

## Reference Implementation

### Omniverse Account

- An Omniverse Account example: `3092860212ceb90a13e4a288e444b685ae86c63232bcb50a064cb3d25aa2c88a24cd710ea2d553a20b4f2f18d2706b8cc5a9d4ae4a50d475980c2ba83414a796`
    - The Omniverse Account is a public key of the elliptic curve `secp256k1`
    - The related private key of the example is:  `cdfa0e50d672eb73bc5de00cc0799c70f15c5be6b6fca4a1c82c35c7471125b6`

#### Mapping Mechanism for Different Environments

In the simplest implementation, we can just build two mappings to get it. One is like `pk based on sece256k1 =&gt; account address in the special environment`, and the other is the reverse mapping. 

The `Account System` on `Flow` is a typical example.  

- `Flow` has a built-in mechanism for `account address =&gt; pk`. The public key can be bound to an account (a special built-in data structure) and the public key can be got from the `account address` directly.  
- A mapping from `pk` to the `account address` on Flow can be built by creating a mapping `{String: Address}`, in which `String` denotes the data type to express the public key and the `Address` is the data type of the `account address` on Flow.  

### ERC-6358 Token

The ERC-6358 Token could be implemented with the [interfaces mentioned above](#smart-contract-interface). It can also be used with the combination of [ERC-20](./eip-20.md)/[ERC-721](./eip-721.md).  

- The implementation examples of the interfaces can be found at:

    - [Interface `IERC6358`](../assets/eip-6358/src/contracts/interfaces/IERC6358.sol), the basic ERC-6358 interface mentioned [above](#smart-contract-interface)
    - [Interface `IERC6358Fungible`](../assets/eip-6358/src/contracts/interfaces/IERC6358Fungible.sol), the interface for ERC-6358 fungible token
    - [Interface `IERC6358NonFungible`](../assets/eip-6358/src/contracts/interfaces/IERC6358NonFungible.sol), the interface for ERC-6358 non-fungible token

- The implementation example of some common tools to operate ERC-6358 can be found at:

    - [Common Tools](../assets/eip-6358/src/contracts/libraries/OmniverseProtocolHelper.sol).  

- The implementation examples of ERC-6358 Fungible Token and ERC-6358 Non-Fungible Token can be found at:  

    - [ERC-6358 Fungible Token Example](../assets/eip-6358/src/contracts/ERC6358FungibleExample.sol)
    - [ERC-6358 Non-Fungible Token Example](../assets/eip-6358/src/contracts/ERC6358NonFungibleExample.sol)  

## Security Considerations

### Attack Vector Analysis

According to the above, there are two roles:

- **common users** are who initiate an `o-transaction`
- **synchronizers** are who just carry the `o-transaction` data if they find differences between different chains.  

The two roles might be where the attack happens:  

#### **Will the *synchronizers* cheat?**  

- Simply speaking, it&apos;s none of the **synchronizer**&apos;s business as **they cannot create other users&apos; signatures** unless some **common users** tell him, but at this point, we think it&apos;s a problem with the role **common user**.  
- The **synchronizer** has no will and cannot do evil because the `o-transaction` data that they deliver is verified by the related **signature** of other **common users**.  
- The **synchronizers** would be rewarded as long as they submit valid `o-transaction` data, and *valid* only means that the signature and the amount are both valid. This will be detailed and explained later when analyzing the role of **common user**.  
- The **synchronizers** will do the delivery once they find differences between different chains:
    - If the current `account nonce` on one chain is smaller than a published `nonce in o-transaction` on another chain
    - If the transaction data related to a specific `nonce in o-transaction` on one chain is different from another published `o-transaction` data with the same `nonce in o-transaction` on another chain

- **Conclusion: The *synchronizers* won&apos;t cheat because there are no benefits and no way for them to do so.**

#### **Will the *common user* cheat?**

- Simply speaking, **maybe they will**, but fortunately, **they can&apos;t succeed**.    
- Suppose the current `account nonce` of a **common user** `A` is $k$ on all chains. `A` has 100 token `X`, which is an instance of the ERC-6358 token.    
- Common user `A` initiates an `o-transaction` on a Parachain of Polkadot first, in which `A` transfers `10` `X`s to an `o-account` of a **common user** `B`. The `nonce in o-transaction` needs to be $k+1$. After signature and data verification, the `o-transaction` data(`ot-P-ab` for short) will be published on Polkadot.
- At the same time, `A` initiates an `o-transaction` with the **same nonce** $k+1$ but **different data**(transfer `10` `X`s to another `o-account` `C` for example) on Ethereum. This `o-transaction` (named `ot-E-ac` for short) will pass the verification on Ethereum first, and be published.  
- At this point, it seems `A` finished a ***double spend attack*** and the states on Polkadot and Ethereum are different.  
- **Response strategy**:
    - As we mentioned above, the synchronizers will deliver `ot-P-ab` to Ethereum and deliver `ot-E-ac` to Polkadot because they are different although with the same nonce. The synchronizer who submits the `o-transaction` first will be rewarded as the signature is valid.
    - Both the ERC-6358 smart contracts or similar mechanisms on Polkadot and Ethereum will find that `A` did cheating after they received both `ot-E-ac` and `ot-P-ab` respectively as the signature of `A` is non-deniable.  
    - We have mentioned that the execution of an `o-transaction` will not be done immediately and instead there needs to be a fixed waiting time. So the `double spend attack` caused by `A` won&apos;t succeed.
    - There will be many synchronizers waiting for delivering o-transactions to get rewards. So although it&apos;s almost impossible that a **common user** can submit two `o-transactions` to two chains, but none of the synchronizers deliver the `o-transactions` successfully because of a network problem or something else, we still provide a solution:  
        - The synchronizers will connect to several native nodes of every public chain to avoid the malicious native nodes.
        - If it indeed happened that all synchronizers&apos; network break, the `o-transactions` will be synchronized when the network recovered. If the waiting time is up and the cheating `o-transaction` has been executed, we are still able to revert it from where the cheating happens according to the `nonce in o-transaction` and `account nonce`.
- `A` couldn&apos;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).  

- **Conclusion: The *common user* maybe cheat but won&apos;t succeed.**

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 17 Jan 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6358</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6358</guid>
      </item>
    
      <item>
        <title>Permission Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6366-a-standard-for-permission-token/9105</comments>
        
        <description>## Abstract

This EIP offers an alternative to Access Control Lists (ACLs) for granting authorization and enhancing security. A `uint256` is used to store permission of given address in a ecosystem. Each permission is represented by a single bit in a `uint256` as described in [ERC-6617](./eip-6617.md). Bitwise operators and bitmasks are used to determine the access right which is much more efficient and flexible than `string` or `keccak256` comparison.

## Motivation

Special roles like `Owner`, `Operator`, `Manager`, `Validator` 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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

_Note_ The following specifications use syntax from Solidity `0.8.7` (or above)

### Core Interface

Compliant contracts MUST implement `IEIP6366Core`.

It is RECOMMENDED to define each permission as a power of `2` so that we can check for the relationship between sets of permissions using [ERC-6617](./eip-6617.md).

```solidity
interface IEIP6366Core {
  /**
   * MUST trigger when `_permission` are transferred, including `zero` permission transfers.
   * @param _from           Permission owner
   * @param _to             Permission receiver
   * @param _permission     Transferred subset permission of permission owner
   */
  event Transfer(address indexed _from, address indexed _to, uint256 indexed _permission);

  /**
   * MUST trigger on any successful call to `approve(address _delegatee, uint256 _permission)`.
   * @param _owner          Permission owner
   * @param _delegatee      Delegatee
   * @param _permission     Approved subset permission of permission owner
   */
  event Approval(address indexed _owner, address indexed _delegatee, uint256 indexed _permission);

  /**
   * Transfers a subset `_permission` of permission to address `_to`.
   * The function SHOULD revert if the message caller’s account permission does not have the subset
   * of the transferring permissions. The function SHOULD revert if any of transferring permissions are
   * existing on target `_to` address.
   * @param _to             Permission receiver
   * @param _permission     Subset permission of permission owner
   */
  function transfer(address _to, uint256 _permission) external returns (bool success);

  /**
   * Allows `_delegatee` to act for the permission owner&apos;s behalf, up to the `_permission`.
   * If this function is called again it overwrites the current granted with `_permission`.
   * `approve()` method SHOULD `revert` if granting `_permission` permission is not
   * a subset of all available permissions of permission owner.
   * @param _delegatee      Delegatee
   * @param _permission     Subset permission of permission owner
   */
  function approve(address _delegatee, uint256 _permission) external returns (bool success);

  /**
   * Returns the permissions of the given `_owner` address.
   */
  function permissionOf(address _owner) external view returns (uint256 permission);

  /**
   * Returns `true` if `_required` is a subset of `_permission` otherwise return `false`.
   * @param _permission     Checking permission set
   * @param _required       Required set of permission
   */
  function permissionRequire(uint256 _permission, uint256 _required) external view returns (bool isPermissioned);

  /**
   * Returns `true` if `_required` permission is a subset of `_actor`&apos;s permissions or a subset of his delegated
   * permission granted by the `_owner`.
   * @param _owner          Permission owner
   * @param _actor          Actor who acts on behalf of the owner
   * @param _required       Required set of permission
   */
  function hasPermission(address _owner, address _actor, uint256 _required) external view returns (bool isPermissioned);

  /**
   * Returns the subset permission of the `_owner` address were granted to `_delegatee` address.
   * @param _owner          Permission owner
   * @param _delegatee      Delegatee
   */
  function delegated(address _owner, address _delegatee) external view returns (uint256 permission);
}
```

### Metadata Interface

It is RECOMMENDED for compliant contracts to implement the optional extension `IEIP6617Meta`.

SHOULD define a description for the base permissions and main combinaison.

SHOULD NOT define a description for every subcombinaison of permissions possible.

### Error Interface

Compatible tokens MAY implement `IEIP6366Error` as defined below:

```solidity
interface IEIP6366Error {
  /**
   * The owner or actor does not have the required permission
   */
  error AccessDenied(address _owner, address _actor, uint256 _permission);

  /**
   * Conflict between permission set
   */
  error DuplicatedPermission(uint256 _permission);

  /**
   * Data out of range
   */
  error OutOfRange();
}
```

## Rationale

Needs discussion.

## Reference Implementation

First implementation could be found here:

- [ERC-6366 Core implementation](../assets/eip-6366/contracts/EIP6366Core.sol)

## Security Considerations

Need more discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 19 Jan 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6366</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6366</guid>
      </item>
    
      <item>
        <title>Contract clock</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6372-contract-clock/12689</comments>
        
        <description>## Abstract

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.

## Motivation

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.

Some contracts do time tracking using timestamps while others use block numbers. In some cases, more exotic functions might be used to track time.

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.

## Specification

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.

Compliant contracts MUST implement the `clock` and `CLOCK_MODE` functions as specified below.

```solidity
interface IERC6372 {
  function clock() external view returns (uint48);
  function CLOCK_MODE() external view returns (string);
}
```

### Methods

#### clock

This function returns the current timepoint according to the mode the contract is operating on. It MUST be a **non-decreasing** function of the chain, such as `block.timestamp` or `block.number`.

```yaml
- name: clock
  type: function
  stateMutability: view
  inputs: []
  outputs:
    - name: timepoint
      type: uint48
```

#### CLOCK_MODE

This function returns a machine-readable string description of the clock the contract is operating on.

This string MUST be formatted like a URL query string (a.k.a. `application/x-www-form-urlencoded`), decodable in standard JavaScript with `new URLSearchParams(CLOCK_MODE)`.

- If operating using **block number**:
  - If the block number is that of the `NUMBER` opcode (`0x43`), then this function MUST return `mode=blocknumber&amp;from=default`.
  - If it is any other block number, then this function MUST return `mode=blocknumber&amp;from=&lt;CAIP-2-ID&gt;`, where `&lt;CAIP-2-ID&gt;` is a CAIP-2 Blockchain ID such as `eip155:1`.
- If operating using **timestamp**, then this function MUST return `mode=timestamp`.
- If operating using any other mode, then this function SHOULD return a unique identifier for the encoded `mode` field.

```yaml
- name: CLOCK_MODE
  type: function
  stateMutability: view
  inputs: []
  outputs:
    - name: descriptor
      type: string
```

### Expected properties

- The `clock()` function MUST be non-decreasing.

## Rationale

`clock` returns `uint48` as it is largely sufficient for storing realistic values. In timestamp mode, `uint48` 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 `uint256` allows storage packing of timepoints with other associated values, greatly reducing the cost of writing and reading from storage.

Depending on the evolution of the blockchain (particularly layer twos), using a smaller type, such as `uint32` might cause issues fairly quickly. On the other hand, anything bigger than `uint48` appears wasteful.

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 (`uint48`). However, we believe that in most cases `uint32` is a good alternative, as it represents over 136 years if the clock operates using seconds. In most cases, we recommend using `uint48` for storing timepoints and using `uint32` 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.

## Security Considerations

No known security issues.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 25 Jan 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6372</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6372</guid>
      </item>
    
      <item>
        <title>Public Non-Fungible Token Emote Repository</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6381-emotable-extension-for-non-fungible-tokens/12710</comments>
        
        <description>## Abstract

The Public Non-Fungible Token Emote Repository standard provides an enhanced interactive utility for [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md) by allowing NFTs to be emoted at.

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.

## Motivation

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.

This ERC introduces new utilities for [ERC-721](./eip-721.md) based tokens in the following areas:

- [Interactivity](#interactivity)
- [Feedback based evolution](#feedback-based-evolution)
- [Valuation](#valuation)

### Interactivity

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&apos;s owner. Accumulating emotes on a token can increase its uniqueness and/or value.

### Feedback based evolution

Standardized on-chain reactions to NFTs allow for feedback based evolution.

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.

### Valuation

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.

## Specification

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.

```solidity
/// @title ERC-6381 Emotable Extension for Non-Fungible Tokens
/// @dev See https://eips.ethereum.org/EIPS/eip-6381
/// @dev Note: the ERC-165 identifier for this interface is 0xd9fac55a.

pragma solidity ^0.8.16;

interface IERC6381 /*is IERC165*/ {
    /**
     * @notice Used to notify listeners that the token with the specified ID has been emoted to or that the reaction has been revoked.
     * @dev The event MUST only be emitted if the state of the emote is changed.
     * @param emoter Address of the account that emoted or revoked the reaction to the token
     * @param collection Address of the collection smart contract containing the token being emoted to or having the reaction revoked
     * @param tokenId ID of the token
     * @param emoji Unicode identifier of the emoji
     * @param on Boolean value signifying whether the token was emoted to (`true`) or if the reaction has been revoked (`false`)
     */
    event Emoted(
        address indexed emoter,
        address indexed collection,
        uint256 indexed tokenId,
        bytes4 emoji,
        bool on
    );

    /**
     * @notice Used to get the number of emotes for a specific emoji on a token.
     * @param collection Address of the collection containing the token being checked for emoji count
     * @param tokenId ID of the token to check for emoji count
     * @param emoji Unicode identifier of the emoji
     * @return Number of emotes with the emoji on the token
     */
    function emoteCountOf(
        address collection,
        uint256 tokenId,
        bytes4 emoji
    ) external view returns (uint256);

    /**
     * @notice Used to get the number of emotes for a specific emoji on a set of tokens.
     * @param collections An array of addresses of the collections containing the tokens being checked for emoji count
     * @param tokenIds An array of IDs of the tokens to check for emoji count
     * @param emojis An array of unicode identifiers of the emojis
     * @return An array of numbers of emotes with the emoji on the tokens
     */
    function bulkEmoteCountOf(
        address[] memory collections,
        uint256[] memory tokenIds,
        bytes4[] memory emojis
    ) external view returns (uint256[] memory);

    /**
     * @notice Used to get the information on whether the specified address has used a specific emoji on a specific
     *  token.
     * @param emoter Address of the account we are checking for a reaction to a token
     * @param collection Address of the collection smart contract containing the token being checked for emoji reaction
     * @param tokenId ID of the token being checked for emoji reaction
     * @param emoji The ASCII emoji code being checked for reaction
     * @return A boolean value indicating whether the `emoter` has used the `emoji` on the token (`true`) or not
     *  (`false`)
     */
    function hasEmoterUsedEmote(
        address emoter,
        address collection,
        uint256 tokenId,
        bytes4 emoji
    ) external view returns (bool);

    /**
     * @notice Used to get the information on whether the specified addresses have used specific emojis on specific
     *  tokens.
     * @param emoters An array of addresses of the accounts we are checking for reactions to tokens
     * @param collections An array of addresses of the collection smart contracts containing the tokens being checked
     *  for emoji reactions
     * @param tokenIds An array of IDs of the tokens being checked for emoji reactions
     * @param emojis An array of the ASCII emoji codes being checked for reactions
     * @return An array of boolean values indicating whether the `emoter`s has used the `emoji`s on the tokens (`true`)
     *  or not (`false`)
     */
    function haveEmotersUsedEmotes(
        address[] memory emoters,
        address[] memory collections,
        uint256[] memory tokenIds,
        bytes4[] memory emojis
    ) external view returns (bool[] memory);

    /**
     * @notice Used to get the message to be signed by the `emoter` in order for the reaction to be submitted by someone
     *  else.
     * @param collection The address of the collection smart contract containing the token being emoted at
     * @param tokenId ID of the token being emoted
     * @param emoji Unicode identifier of the emoji
     * @param state Boolean value signifying whether to emote (`true`) or undo (`false`) emote
     * @param deadline UNIX timestamp of the deadline for the signature to be submitted
     * @return The message to be signed by the `emoter` in order for the reaction to be submitted by someone else
     */
    function prepareMessageToPresignEmote(
        address collection,
        uint256 tokenId,
        bytes4 emoji,
        bool state,
        uint256 deadline
    ) external view returns (bytes32);

    /**
     * @notice Used to get multiple messages to be signed by the `emoter` in order for the reaction to be submitted by someone
     *  else.
     * @param collections An array of addresses of the collection smart contracts containing the tokens being emoted at
     * @param tokenIds An array of IDs of the tokens being emoted
     * @param emojis An arrau of unicode identifiers of the emojis
     * @param states An array of boolean values signifying whether to emote (`true`) or undo (`false`) emote
     * @param deadlines An array of UNIX timestamps of the deadlines for the signatures to be submitted
     * @return The array of messages to be signed by the `emoter` in order for the reaction to be submitted by someone else
     */
    function bulkPrepareMessagesToPresignEmote(
        address[] memory collections,
        uint256[] memory tokenIds,
        bytes4[] memory emojis,
        bool[] memory states,
        uint256[] memory deadlines
    ) external view returns (bytes32[] memory);

    /**
     * @notice Used to emote or undo an emote on a token.
     * @dev Does nothing if attempting to set a pre-existent state.
     * @dev MUST emit the `Emoted` event is the state of the emote is changed.
     * @param collection Address of the collection containing the token being emoted at
     * @param tokenId ID of the token being emoted
     * @param emoji Unicode identifier of the emoji
     * @param state Boolean value signifying whether to emote (`true`) or undo (`false`) emote
     */
    function emote(
        address collection,
        uint256 tokenId,
        bytes4 emoji,
        bool state
    ) external;

    /**
     * @notice Used to emote or undo an emote on multiple tokens.
     * @dev Does nothing if attempting to set a pre-existent state.
     * @dev MUST emit the `Emoted` event is the state of the emote is changed.
     * @dev MUST revert if the lengths of the `collections`, `tokenIds`, `emojis` and `states` arrays are not equal.
     * @param collections An array of addresses of the collections containing the tokens being emoted at
     * @param tokenIds An array of IDs of the tokens being emoted
     * @param emojis An array of unicode identifiers of the emojis
     * @param states An array of boolean values signifying whether to emote (`true`) or undo (`false`) emote
     */
    function bulkEmote(
        address[] memory collections,
        uint256[] memory tokenIds,
        bytes4[] memory emojis,
        bool[] memory states
    ) external;

    /**
     * @notice Used to emote or undo an emote on someone else&apos;s behalf.
     * @dev Does nothing if attempting to set a pre-existent state.
     * @dev MUST emit the `Emoted` event is the state of the emote is changed.
     * @dev MUST revert if the lengths of the `collections`, `tokenIds`, `emojis` and `states` arrays are not equal.
     * @dev MUST revert if the `deadline` has passed.
     * @dev MUST revert if the recovered address is the zero address.
     * @param emoter The address that presigned the emote
     * @param collection The address of the collection smart contract containing the token being emoted at
     * @param tokenId IDs of the token being emoted
     * @param emoji Unicode identifier of the emoji
     * @param state Boolean value signifying whether to emote (`true`) or undo (`false`) emote
     * @param deadline UNIX timestamp of the deadline for the signature to be submitted
     * @param v `v` value of an ECDSA signature of the message obtained via `prepareMessageToPresignEmote`
     * @param r `r` value of an ECDSA signature of the message obtained via `prepareMessageToPresignEmote`
     * @param s `s` value of an ECDSA signature of the message obtained via `prepareMessageToPresignEmote`
     */
    function presignedEmote(
        address emoter,
        address collection,
        uint256 tokenId,
        bytes4 emoji,
        bool state,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @notice Used to bulk emote or undo an emote on someone else&apos;s behalf.
     * @dev Does nothing if attempting to set a pre-existent state.
     * @dev MUST emit the `Emoted` event is the state of the emote is changed.
     * @dev MUST revert if the lengths of the `collections`, `tokenIds`, `emojis` and `states` arrays are not equal.
     * @dev MUST revert if the `deadline` has passed.
     * @dev MUST revert if the recovered address is the zero address.
     * @param emoters An array of addresses of the accounts that presigned the emotes
     * @param collections An array of addresses of the collections containing the tokens being emoted at
     * @param tokenIds An array of IDs of the tokens being emoted
     * @param emojis An array of unicode identifiers of the emojis
     * @param states An array of boolean values signifying whether to emote (`true`) or undo (`false`) emote
     * @param deadlines UNIX timestamp of the deadline for the signature to be submitted
     * @param v An array of `v` values of an ECDSA signatures of the messages obtained via `prepareMessageToPresignEmote`
     * @param r An array of `r` values of an ECDSA signatures of the messages obtained via `prepareMessageToPresignEmote`
     * @param s An array of `s` values of an ECDSA signatures of the messages obtained via `prepareMessageToPresignEmote`
     */
    function bulkPresignedEmote(
        address[] memory emoters,
        address[] memory collections,
        uint256[] memory tokenIds,
        bytes4[] memory emojis,
        bool[] memory states,
        uint256[] memory deadlines,
        uint8[] memory v,
        bytes32[] memory r,
        bytes32[] memory s
    ) external;
}
```

### Message format for presigned emotes

The message to be signed by the `emoter` in order for the reaction to be submitted by someone else is formatted as follows:

```solidity
keccak256(
        abi.encode(
            DOMAIN_SEPARATOR,
            collection,
            tokenId,
            emoji,
            state,
            deadline
        )
    );
```

The values passed when generating the message to be signed are:

- `DOMAIN_SEPARATOR` - The domain separator of the Emotable repository smart contract
- `collection` - Address of the collection containing the token being emoted at
- `tokenId` - ID of the token being emoted
- `emoji` - Unicode identifier of the emoji
- `state` - Boolean value signifying whether to emote (`true`) or undo (`false`) emote
- `deadline` - UNIX timestamp of the deadline for the signature to be submitted

The `DOMAIN_SEPARATOR` is generated as follows:

```solidity
keccak256(
        abi.encode(
            &quot;ERC-6381: Public Non-Fungible Token Emote Repository&quot;,
            &quot;1&quot;,
            block.chainid,
            address(this)
        )
    );
```

Each chain, that the Emotable repository smart contract is deployed on, will have a different `DOMAIN_SEPARATOR` value due to chain IDs being different.

### Pre-determined address of the Emotable repository

The address of the Emotable repository smart contract is designed to resemble the function it serves. It starts with `0x311073` which is the abstract representation of `EMOTE`. The address is:

```
0x31107354b61A0412E722455A771bC462901668eA
```

## Rationale

Designing the proposal, we considered the following questions:

1. **Does the proposal support custom emotes or only the Unicode specified ones?**\
The proposal only accepts the Unicode identifier which is a `bytes4` 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.
2. **Should the proposal use emojis to relay the impressions of NFTs or some other method?**\
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.
3. **Should the proposal establish an emotable extension or a common-good repository?**\
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.\
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.
4. **Should we include only single-action operations, only multi-action operations, or both?**\
We&apos;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.\
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.
5. **Should we add the ability to emote on someone else&apos;s behalf?**\
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.
6. **How do we ensure that emoting on someone else&apos;s behalf is legitimate?**\
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.\
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.
7. **Should we add chain ID as a parameter when reacting to a token?**\
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.\
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.\
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&apos;s address on another chain and it is very unlikely that they will unintentionally react to another collection&apos;s token.

## Backwards Compatibility

The Emote repository standard is fully compatible with [ERC-721](./eip-721.md) and with the robust tooling available for implementations of ERC-721 as well as with the existing ERC-721 infrastructure.

## Test Cases

Tests are included in [`emotableRepository.ts`](../assets/eip-6381/test/emotableRepository.ts).

To run them in terminal, you can use the following commands:

```
cd ../assets/eip-6381
npm install
npx hardhat test
```

## Reference Implementation

See [`EmotableRepository.sol`](../assets/eip-6381/contracts/EmotableRepository.sol).

## Security Considerations

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.

The ability to use ECDSA signatures to emote on someone else&apos;s behalf introduces the risk of a replay attack, which the format of the message to be signed guards against. The `DOMAIN_SEPARATOR` 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.

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.

Caution is advised when dealing with non-audited contracts.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6381</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6381</guid>
      </item>
    
      <item>
        <title>Human-readable offline signatures</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6384-readable-eip-712-signatures/12752</comments>
        
        <description>## Abstract

This EIP introduces the `evalEIP712Buffer` function, which takes an [EIP-712](./eip-712.md) buffer and returns a human-readable text description.

## Motivation

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 [EIP-2612](./eip-2612.md), 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 [EIP-712](./eip-712.md) 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.

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.

The user interface for some popular wallet implementations is not conveying the actual meaning of signing such transactions.

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:

![](../assets/eip-6384/media/MiceyMask-non-compliant.png)

to a much clearer user experience:

![](../assets/eip-6384/media/ZenGo-EIP-compliant-warning.png)

The proposed solution solves the readability issues by allowing the wallet to query the `verifyingContract`. 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:

- Knows the message meaning exactly (and probably can reuse the code that handles this message when received on chain)
- Natively incentivized to provide the best explanation to prevent a possible fraud
- Not involving a third party that needs to be trusted
- Maintains the fee-less customer experience as the added function is in “view” mode and does not require an on-chain execution and fees.
- Maintains Web3’s composability property

## Specification

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.

EIP-712 already formally binds an off-chain signature to a contract, with the `verifyingContract` parameter. We suggest adding a “view” function (`&quot;stateMutability&quot;:&quot;view&quot;`) to such contracts, that returns a human readable description of the meaning of this specific off-chain buffer.

```solidity
/**
 * @dev Returns the expected result of the offchain message.
*/

     function evalEIP712Buffer(bytes32 domainHash, string memory primaryType, bytes memory typedDataBuffer)
     external
     view
     returns (string[] memory) {
   ...

}
```

**Every compliant contract MUST implement this function.**

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.

This function will have a well known name and signature, such that there is no need for updates in the EIP-712 structure.

### Function&apos;s inputs

The inputs of the function:

- `domainHash` is the EIP-712&apos;s domainSeparator, a hashed `eip712Domain` struct.
- `primaryType`is the EIP-712&apos;s `primaryType`.
- `typedDataBuffer` is an ABI encoded message part of the EIP-712 full message.

### Function&apos;s output(s)

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)

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.

### Support for EIP-712 messages that are not meant to be used on-chain

If `verifyingContract` 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.

## Rationale

- We chose to implement the `typeDataBuffer` parameter as abi encoded as it is a generic way to pass the data to the contract. The alternative was to pass the `typedData` struct, which is not generic as it requires the contract to specify the message data.
- 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 `typedDataBuffer`, the contract is advised to describe each transfer in a separate string to allow the wallet to display each transfer separately.

### Alternative solutions

#### Third party services:

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:

- Not scalable: 3rd party provider needs to learn all such proprietary messages
- Not necessarily correct: the explanation is based on 3rd party interpretation of the original message author
- Introduces an unnecessary dependency of a third party which may have some operational, security, and privacy implications.

#### Domain name binding

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 `name` as defined by EIP-712 is included in `eip712Domain`. However this approach has the following disadvantages:

- It breaks Web3’s composability, as now other dapps cannot interact with such messages
- Does not protect against bad messages coming from the specified web2 domain, e.g. when web2 domain is hacked
- Some current connector, such as WalletConnect do not allow wallets to verify the web2 domain authenticity

## Backwards Compatibility

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.

## Reference Implementation

A reference implementation can be found [here](../assets/eip-6384/implementation/src/MyToken/MyToken.sol).
This toy example shows how an [EIP-20](./eip-20.md) 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&apos;s SeaPort EIP-712 is implemented too in [here](../assets/eip-6384/implementation/src/SeaPort/SeaPort712ParserHelper.sol).

## Security Considerations

### The threat model:

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.

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.

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.

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.

### Analysis of the proposed solution

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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 08 Jan 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6384</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6384</guid>
      </item>
    
      <item>
        <title>Minimal Transferable NFT detection interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/minimalistic-transferable-interface/12517</comments>
        
        <description>## Abstract

The Minimalistic Transferable interface for Non-Fungible Tokens standard extends [ERC-721](./eip-721.md) by introducing the ability to identify whether an NFT can be transferred or not.

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.

## Motivation

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.

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.

This EIP introduces new utilities for [ERC-721](./eip-721.md) based tokens in the following areas:

- [Verifiable attribution](#verifiable-attribution)
- [Immutable properties](#immutable-properties)

### Verifiable attribution

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&apos;s accomplishments.

### Immutable properties

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.

By tying NFTs to specific properties, the original owner is ensured that the NFT will always retain these properties and its uniqueness.

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.

## Specification

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.

```solidity
/// @title EIP-6454 Minimalistic Non-Transferable interface for NFTs
/// @dev See https://eips.ethereum.org/EIPS/eip-6454
/// @dev Note: the ERC-165 identifier for this interface is 0x91a6262f.

pragma solidity ^0.8.16;

interface IERC6454 /* is IERC165 */ {
    /**
     * @notice Used to check whether the given token is transferable or not.
     * @dev If this function returns `false`, the transfer of the token MUST revert execution.
     * @dev If the tokenId does not exist, this method MUST revert execution, unless the token is being checked for
     *  minting.
     * @dev The `from` parameter MAY be used to also validate the approval of the token for transfer, but anyone
     *  interacting with this function SHOULD NOT rely on it as it is not mandated by the proposal.
     * @param tokenId ID of the token being checked
     * @param from Address from which the token is being transferred
     * @param to Address to which the token is being transferred
     * @return Boolean value indicating whether the given token is transferable
     */
    function isTransferable(uint256 tokenId, address from, address to) external view returns (bool);
}
```

In order to determine whether a token is transferable or not in general, the function SHOULD return the appropriate boolean value when passing the `0x0000000000000000000000000000000000000000` address as the `to` and `from` parameter.

The general transferability of a token should not be affected by the ability to mint the token (value of `from` parameter is `0x0000000000000000000000000000000000000000`) and the ability to burn the token (value of `to` parameter is `0x0000000000000000000000000000000000000000`).

If the general transferability of token is `false`, any kind of transfer of the token, save minting and burning, MUST revert execution.

In order to determine whether a token is mintable, the exception SHOULD be made to allow the `tokenId` parameter for a token that does not exist. Additionally the `from` parameter SHOULD be `0x0000000000000000000000000000000000000000` and the `to` parameter SHOULD NOT be `0x0000000000000000000000000000000000000000`.

In order to determine whether a token is burnable, the `from` parameter SHOULD NOT be `0x0000000000000000000000000000000000000000` and the `to` parameter SHOULD be `0x0000000000000000000000000000000000000000`.

Implementers MAY choose to validate the approval of the token for transfer by the `from` parameter, but anyone interacting with this function SHOULD NOT rely on it as it is not mandated by the proposal. This means that the `from` 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).

## Rationale

Designing the proposal, we considered the following questions:

1. **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?**\
   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.
2. **Why is there no event marking the token as Non-Transferable in this interface?**\
   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.
3. **Should the transferability state management function be included in this proposal?**\
   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.
4. **Why should this be an EIP if it only contains one method?**\
   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.\
   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.
5. **Should we include the most straightforward method possible that only accepts a `tokenId` parameter?**\
   The initial version of the proposal contained a method that only accepted a `tokenId` 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 `0x0000000000000000000000000000000000000000` address as the `to` and `from` parameters).
6. **What is the best user experience for frontend?**\
   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.\
   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.
7. **Should we mandate that the `isTransferable` validates approvals as well?**\
   We considered specifying that the `from` parameter represents the initiator of the token transfer. This would mean that the `from` 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.\
   As this proposal aims to be the minimal possible implementation and the approvals are already standardized, we feel that `isTransferable` can be used in conjunction with the approvals to validate whether the given address can initiate the transfer or not.\
   Additionally, mandating the validation of approvals would incur higher gas consumption as additional checks would be required to validate the transferability.

## Backwards Compatibility

The Minimalistic Non-Transferable token standard is fully compatible with [ERC-721](./eip-721.md) and with the robust tooling available for implementations of ERC-721 as well as with the existing ERC-721 infrastructure.

## Test Cases

Tests are included in [`transferable.ts`](../assets/eip-6454/test/transferable.ts).

To run them in terminal, you can use the following commands:

```
cd ../assets/eip-6454
npm install
npx hardhat test
```

## Reference Implementation

See [`ERC721TransferableMock.sol`](../assets/eip-6454/contracts/mocks/ERC721TransferableMock.sol).

## Security Considerations

The same security considerations as with [ERC-721](./eip-721.md) apply: hidden logic may be present in any of the functions, including burn, add asset, accept asset, and more.

A smart contract can implement the proposal interface but returns fraudulent values, i.e., returning `false` for `isTransferable` 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 [ERC-20](./eip-20.md) or [ERC-721](./eip-721.md) 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.

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.

Caution is advised when dealing with non-audited contracts.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 31 Jan 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6454</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6454</guid>
      </item>
    
      <item>
        <title>Multi-operator, per-token ERC-721 approvals.</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/fine-grained-erc721-approval-for-multiple-operators/12796</comments>
        
        <description>## Abstract

[ERC-721](./eip-721.md) did not foresee the approval of multiple operators to manage a specific token on behalf of its owner. This lead to the establishment of `setApprovalForAll()` 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.

## Motivation

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:

1. `approve(address,uint256)` provides a mechanism for only a single operator to be approved for a given `tokenId`; and
2. `setApprovalForAll(address,bool)` toggles whether an operator is approved for *every* token owned by `msg.sender`.

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 `setApprovalForAll()`. 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.

This EIP therefore defines a fine-grained approach for approving multiple operators but scoped to specific token(s).

### Goals

1. Ease of adoption for marketplaces; requires minimal changes to existing workflows.
2. Ease of adoption for off-chain approval-indexing services.
3. Simple revocation of approvals; i.e. not requiring one per grant.

### Non-goals

1. Security measures for protecting NFTs other than through limiting the scope of operator approvals.
2. Compatibility with [ERC-1155](./eip-1155.md) semi-fungible tokens. However we note that the mechanisms described herein are also applicable to ERC-1155 token *types* without requiring approval for all other types.

## Specification

The key words &quot;MUST&quot;, &quot;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.

To comply with this EIP, a contract MUST implement `IERC6464` (defined herein) and the `ERC165` and `ERC721` interfaces; see [ERC-165](./eip-165.md) and ERC-721 respectively.

```solidity
/**
 * @notice Extends ERC-721 to include per-token approval for multiple operators.
 * @dev Off-chain indexers of approvals SHOULD assume that an operator is approved if either of `ERC721.Approval(…)` or
 * `ERC721.ApprovalForAll(…, true)` events are witnessed without the corresponding revocation(s), even if an
 * `ExplicitApprovalFor(…, false)` is emitted.
 * @dev TODO: the ERC-165 identifier for this interface is TBD.
 */
interface IERC6464 is ERC721 {
    /**
     * @notice Emitted when approval is explicitly granted or revoked for a token.
     */
    event ExplicitApprovalFor(
        address indexed operator,
        uint256 indexed tokenId,
        bool approved
    );

    /**
     * @notice Emitted when all explicit approvals, as granted by either `setExplicitApprovalFor()` function, are
     * revoked for all tokens.
     * @dev MUST be emitted upon calls to `revokeAllExplicitApprovals()`.
     */
    event AllExplicitApprovalsRevoked(address indexed owner);

    /**
     * @notice Emitted when all explicit approvals, as granted by either `setExplicitApprovalFor()` function, are
     * revoked for the specific token.
     * @param owner MUST be `ownerOf(tokenId)` as per ERC721; in the case of revocation due to transfer, this MUST be
     * the `from` address expected to be emitted in the respective `ERC721.Transfer()` event.
     */
    event AllExplicitApprovalsRevoked(
        address indexed owner,
        uint256 indexed tokenId
    );

    /**
     * @notice Approves the operator to manage the asset on behalf of its owner.
     * @dev Throws if `msg.sender` is not the current NFT owner, or an authorised operator of the current owner.
     * @dev Approvals set via this method MUST be revoked upon transfer of the token to a new owner; equivalent to
     * calling `revokeAllExplicitApprovals(tokenId)`, including associated events.
     * @dev MUST emit `ApprovalFor(operator, tokenId, approved)`.
     * @dev MUST NOT have an effect on any standard ERC721 approval setters / getters.
     */
    function setExplicitApproval(
        address operator,
        uint256 tokenId,
        bool approved
    ) external;

    /**
     * @notice Approves the operator to manage the token(s) on behalf of their owner.
     * @dev MUST be equivalent to calling `setExplicitApprovalFor(operator, tokenId, approved)` for each `tokenId` in
     * the array.
     */
    function setExplicitApproval(
        address operator,
        uint256[] memory tokenIds,
        bool approved
    ) external;

    /**
     * @notice Revokes all explicit approvals granted by `msg.sender`.
     * @dev MUST emit `AllExplicitApprovalsRevoked(msg.sender)`.
     */
    function revokeAllExplicitApprovals() external;

    /**
     * @notice Revokes all excplicit approvals granted for the specified token.
     * @dev Throws if `msg.sender` is not the current NFT owner, or an authorised operator of the current owner.
     * @dev MUST emit `AllExplicitApprovalsRevoked(msg.sender, tokenId)`.
     */
    function revokeAllExplicitApprovals(uint256 tokenId) external;

    /**
     * @notice Query whether an address is an approved operator for a token.
     */
    function isExplicitlyApprovedFor(address operator, uint256 tokenId)
        external
        view
        returns (bool);
}

interface IERC6464AnyApproval is ERC721 {
    /**
     * @notice Returns true if any of the following criteria are met:
     * 1. `isExplicitlyApprovedFor(operator, tokenId) == true`; OR
     * 2. `isApprovedForAll(ownerOf(tokenId), operator) == true`; OR
     * 3. `getApproved(tokenId) == operator`.
     * @dev The criteria MUST be extended if other mechanism(s) for approving operators are introduced. The criteria
     * MUST include all approval approaches.
     */
    function isApprovedFor(address operator, uint256 tokenId)
        external
        view
        returns (bool);
}
```

## Rationale

### Draft notes to be expanded upon

1. Approvals granted via the newly introduced methods are called *explicit* as a means of easily distinguishing them from those granted via the standard `ERC721.approve()` and `ERC721.setApprovalForAll()` functions. However they follow the same intent: authorising operators to act on the owner&apos;s behalf.
2. Abstracting `isApprovedFor()` into `IERC6464AnyApproval` interface, as against keeping it in `IERC6464` allows for modularity of plain `IERC6464` implementations while also standardising the interface for checking approvals when interfacing with specific implementations and any future approval EIPs.
3. Inclusion of an indexed owner address in `AllExplicitApprovalsRevoked(address,uint256)` assists off-chain indexing of existing approvals.
4. Re `IERC6464AnyApproval`: 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;!--
  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;

## Backwards Compatibility

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.

Extended contracts remain fully compatible with all existing platforms.

**Note** the `Security Considerations` sub-section on `Other risks` regarding interplay of approval types.

## Reference Implementation

TODO: add internal link to assets directory when the implementation is in place.

An efficient mechanism for broad revocation of approvals via incrementing nonces is included.

## Security Considerations

### Threat model

### Mitigations

### Other risks

TODO: Interplay with `setApprovalForAll()`.

&lt;!--
  All EIPs must contain a section that discusses the security implications/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;

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 02 Feb 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6464</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6464</guid>
      </item>
    
      <item>
        <title>Signature Validation for Predeploy Contracts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6492-signature-validation-for-pre-deploy-contracts/12903</comments>
        
        <description>## Abstract

Contracts can sign verifiable messages via [ERC-1271](./eip-1271.md).

However, if the contract is not deployed yet, [ERC-1271](./eip-1271.md) verification is impossible, as you can&apos;t call the `isValidSignature` function on said contract.

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 [ERC-1271](./eip-1271.md).

## Motivation

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.

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.

Furthermore, not being able to sign messages from counterfactual contracts has always been a limitation of [ERC-1271](./eip-1271.md).

## Specification

The key words &quot;MUST&quot;, &quot;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.

The words &quot;validation&quot; and &quot;verification&quot; are used interchangeably.

Quoting [ERC-1271](./eip-1271.md),
&gt; `isValidSignature` 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. 
&gt;
&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.


We use the same `isValidSignature` function, but we add a new wrapper signature format, that signing contracts MAY use before they&apos;re deployed, in order to allow support for verification.

The signature verifier MUST perform a contract deployment before attempting to call `isValidSignature` if the wrapper signature format is detected.

The wrapper format is detected by checking if the signature ends in `magicBytes`, which MUST be defined as `0x6492649264926492649264926492649264926492649264926492649264926492`.

It is RECOMMENDED to use this ERC with CREATE2 contracts, as their deploy address is always predictable.

### Signer side

The signing contract will normally be a contract wallet, but it could be any contract that implements [ERC-1271](./eip-1271.md) and is deployed counterfactually.

- If the contract is deployed, produce a normal [ERC-1271](./eip-1271.md) signature
- If the contract is not deployed yet, wrap the signature as follows: `concat(abi.encode((create2Factory, factoryCalldata, originalERC1271Signature), (address, bytes, bytes)), magicBytes)`
- If the contract is deployed but not ready to verify using [ERC-1271](./eip-1271.md), wrap the signature as follows: `concat(abi.encode((prepareTo, prepareData, originalERC1271Signature), (address, bytes, bytes)), magicBytes)`; `prepareTo` and `prepareData` must contain the necessary transaction that will make the contract ready to verify using [ERC-1271](./eip-1271.md) (e.g. a call to `migrate` or `update`)

Note that we&apos;re passing `factoryCalldata` instead of `salt` and `bytecode`. We do this in order to make verification compliant with any factory interface. We do not need to calculate the address based on  `create2Factory`/`salt`/`bytecode`, because [ERC-1271](./eip-1271.md) verification presumes we already know the account address we&apos;re verifying the signature for.

### Verifier side

Full signature verification MUST be performed in the following order:

- check if the signature ends with magic bytes, in which case do an `eth_call` to a multicall contract that will call the factory first with the `factoryCalldata` and deploy the contract if it isn&apos;t already deployed; Then, call `contract.isValidSignature` as usual with the unwrapped signature
- check if there&apos;s contract code at the address. If so perform [ERC-1271](./eip-1271.md) verification as usual by invoking `isValidSignature`
- if the [ERC-1271](./eip-1271.md) verification fails, and the deploy call to the `factory` was skipped due to the wallet already having code, execute the `factoryCalldata` transaction and try `isValidSignature` again
- if there is no contract code at the address, try `ecrecover` verification

## Rationale

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&apos;s completely contract agnostic, but also easy to verify.

The wrapper format ends in `magicBytes`, which ends with a `0x92`, which makes it is impossible for it to collide with a valid `ecrecover` signature if packed in the `r,s,v` format, as `0x92` is not a valid value for `v`. To avoid collisions with normal [ERC-1271](./eip-1271.md), `magicBytes` itself is also quite long (`bytes32`).

The order to ensure correct verification is based on the following rules:

- checking for `magicBytes` MUST happen before the usual [ERC-1271](./eip-1271.md) check in order to allow counterfactual signatures to be valid even after contract deployment
- checking for `magicBytes` MUST happen before `ecrecover` in order to avoid trying to verify a counterfactual contract signature via `ecrecover` if such is clearly identifiable
- checking `ecrecover` MUST NOT happen before [ERC-1271](./eip-1271.md) verification, because a contract may use a signature format that also happens to be a valid `ecrecover` signature for an EOA with a different address. One such example is a contract that&apos;s a wallet controlled by said EOA.

We can&apos;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.

## Backwards Compatibility

This ERC is backward compatible with previous work on signature validation, including [ERC-1271](./eip-1271.md) and allows for easy verification of all signature types, including EOA signatures and typed data ([EIP-712](./eip-712.md)). 

### Using [ERC-6492](./eip-6492.md) for regular contract signatures

The wrapper format described in this ERC can be used for all contract signatures, instead of plain [ERC-1271](./eip-1271.md). This provides several advantages:

- 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
- allows recovery of address: you can get the address only from the signature using `create2Factory` and `factoryCalldata`, just like `ecrecover`

## Reference Implementation

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, [ERC-1271](./eip-1271.md) and traditional `ecrecover`. [EIP-712](./eip-712.md) is also supported by extension, as we validate the final digest (`_hash`).

```solidity
// As per ERC-1271
interface IERC1271Wallet {
  function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4 magicValue);
}

error ERC1271Revert(bytes error);
error ERC6492DeployFailed(bytes error);

contract UniversalSigValidator {
  bytes32 private constant ERC6492_DETECTION_SUFFIX = 0x6492649264926492649264926492649264926492649264926492649264926492;
  bytes4 private constant ERC1271_SUCCESS = 0x1626ba7e;

  function isValidSigImpl(
    address _signer,
    bytes32 _hash,
    bytes calldata _signature,
    bool allowSideEffects,
    bool tryPrepare
  ) public returns (bool) {
    uint contractCodeLen = address(_signer).code.length;
    bytes memory sigToValidate;
    // The order here is strictly defined in https://eips.ethereum.org/EIPS/eip-6492
    // - 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
    // - ERC-1271 verification if there&apos;s contract code
    // - finally, ecrecover
    bool isCounterfactual = bytes32(_signature[_signature.length-32:_signature.length]) == ERC6492_DETECTION_SUFFIX;
    if (isCounterfactual) {
      address create2Factory;
      bytes memory factoryCalldata;
      (create2Factory, factoryCalldata, sigToValidate) = abi.decode(_signature[0:_signature.length-32], (address, bytes, bytes));

      if (contractCodeLen == 0 || tryPrepare) {
        (bool success, bytes memory err) = create2Factory.call(factoryCalldata);
        if (!success) revert ERC6492DeployFailed(err);
      }
    } else {
      sigToValidate = _signature;
    }

    // Try ERC-1271 verification
    if (isCounterfactual || contractCodeLen &gt; 0) {
      try IERC1271Wallet(_signer).isValidSignature(_hash, sigToValidate) returns (bytes4 magicValue) {
        bool isValid = magicValue == ERC1271_SUCCESS;

        // retry, but this time assume the prefix is a prepare call
        if (!isValid &amp;&amp; !tryPrepare &amp;&amp; contractCodeLen &gt; 0) {
          return isValidSigImpl(_signer, _hash, _signature, allowSideEffects, true);
        }

        if (contractCodeLen == 0 &amp;&amp; isCounterfactual &amp;&amp; !allowSideEffects) {
          // if the call had side effects we need to return the
          // result using a `revert` (to undo the state changes)
          assembly {
           mstore(0, isValid)
           revert(31, 1)
          }
        }

        return isValid;
      } catch (bytes memory err) {
        // retry, but this time assume the prefix is a prepare call
        if (!tryPrepare &amp;&amp; contractCodeLen &gt; 0) {
          return isValidSigImpl(_signer, _hash, _signature, allowSideEffects, true);
        }

        revert ERC1271Revert(err);
      }
    }

    // ecrecover verification
    require(_signature.length == 65, &apos;SignatureValidator#recoverSigner: invalid signature length&apos;);
    bytes32 r = bytes32(_signature[0:32]);
    bytes32 s = bytes32(_signature[32:64]);
    uint8 v = uint8(_signature[64]);
    if (v != 27 &amp;&amp; v != 28) {
      revert(&apos;SignatureValidator: invalid signature v value&apos;);
    }
    return ecrecover(_hash, v, r, s) == _signer;
  }

  function isValidSigWithSideEffects(address _signer, bytes32 _hash, bytes calldata _signature)
    external returns (bool)
  {
    return this.isValidSigImpl(_signer, _hash, _signature, true, false);
  }

  function isValidSig(address _signer, bytes32 _hash, bytes calldata _signature)
    external returns (bool)
  {
    try this.isValidSigImpl(_signer, _hash, _signature, false, false) returns (bool isValid) { return isValid; }
    catch (bytes memory error) {
      // in order to avoid side effects from the contract getting deployed, the entire call will revert with a single byte result
      uint len = error.length;
      if (len == 1) return error[0] == 0x01;
      // all other errors are simply forwarded, but in custom formats so that nothing else can revert with a single byte in the call
      else assembly { revert(error, len) }
    }
  }
}

// this is a helper so we can perform validation in a single eth_call without pre-deploying a singleton
contract ValidateSigOffchain {
  constructor (address _signer, bytes32 _hash, bytes memory _signature) {
    UniversalSigValidator validator = new UniversalSigValidator();
    bool isValidSig = validator.isValidSigWithSideEffects(_signer, _hash, _signature);
    assembly {
      mstore(0, isValidSig)
      return(31, 1)
    }
  }
}
```

### On-chain validation

For on-chain validation, you could use two separate methods:

- `UniversalSigValidator.isValidSig(_signer, _hash, _signature)`: returns a bool of whether the signature is valid or not; this is reentrancy-safe
- `UniversalSigValidator.isValidSigWithSideEffects(_signer, _hash, _signature)`: this is equivalent to the former - it is not reentrancy-safe but it is more gas-efficient in certain cases

Both methods may revert if the underlying calls revert.

### Off-chain validation

The `ValidateSigOffchain` helper allows you to perform the universal validation in one `eth_call`, without any pre-deployed contracts.

Here&apos;s example of how to do this with the `ethers` library:

```javascript
const isValidSignature = &apos;0x01&apos; === await provider.call({
  data: ethers.utils.concat([
    validateSigOffchainBytecode,
    (new ethers.utils.AbiCoder()).encode([&apos;address&apos;, &apos;bytes32&apos;, &apos;bytes&apos;], [signer, hash, signature])
  ])
})
```

You may also use a library to perform the universal signature validation, such as Ambire&apos;s `signature-validator`.

## Security Considerations

The same considerations as [ERC-1271](./eip-1271.md) apply.

However, deploying a contract requires a `CALL` rather than a `STATICCALL`, 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 `isValidSigWithSideEffects` method.

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.

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&apos;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.

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.

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/bytecode on this different network.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 10 Feb 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6492</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6492</guid>
      </item>
    
      <item>
        <title>P2P Escrowed Governance Incentives</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/escrowed-and-private-bribes-for-generalized-dao-voting/12694</comments>
        
        <description>## Abstract

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. 

## Motivation

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:

1. 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.

2. 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.

3. 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.

4. For actors that wish to solicit incentives for their vote, this may require either active management, or the doxxing of their identity/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.

5. Bribe Revenue as subsidies. As Vitalik wrote in a 2019 article, *On Collusion*, 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&apos;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.

## Specification

The key words &quot;MUST&quot;, &quot;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 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. 

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.

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.

Contracts wishing to implement such a standard must implement the following interface

```solidity
interface IEscrowedGovIncentive {

  struct incentive {
    address incentiveToken;
    address incentivizer;
    address recipient;
    uint amount;
    uint256 proposalId;
    bytes32 direction; //the keccak256 of the vote direction
    uint96 deadline;
    uint96 timestamp;
    bool claimed;
  }

  event incentiveSent(address indexed incentivizer, address indexed token, uint256 indexed amount, address recipient, bytes data);

  event incentiveReclaimed(address incentivizer, address indexed recipient, address indexed token, uint256 indexed amount, bytes data);

  event modifiedClaimer(address recipient, address claimer, bool direction);

  event incentiveClaimed(address indexed incentivizer, address voter, bytes32 incentiveId, bytes proofData);

  event disputeInitiated(bytes32 indexed incentiveId, address indexed plaintiff, address indexed defendant);

  event disputeResolved(bytes32 indexed incentive, address indexed plaintiff, address indexed defendant, bool dismissed);


  //Core mechanism
  function incentivize(bytes32 incentiveId, bytes memory incentiveInfo) external payable;

  function claimIncentive(bytes32 incentiveId, bytes memory reveal, address payable recipient) external;
  
  function reclaimIncentive(bytes32 incentiveId, bytes memory reveal) external;
  
  function verifyVote(bytes32 incentive, bytes memory voteInfo) external view returns (bool isVerifiable, bytes proofData);

  function modifyClaimer(address claimer, bool designation) external;

  //Dispute Mechanism
  function beginDispute(bytes32 incentiveId, bytes memory disputeInfo) external payable;

  function resolveDispute(bytes32 incentiveId, bytes memory disputeResolutionInfo) external returns (bool isDismissed);

}
```

### Optional Implementation Details

Below are three potential implementation examples of the above system for different aspects.

#### *Complete Transparency*

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/emitted as such.

#### *Opacity until Completion (OUC)*

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&apos;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.

Upon the claiming of the bribe the recipient would simply open the commitment, which would then be checked on-chain and funds released.

#### *Compatibility with Off-Chain Voting*

Many DAO&apos;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

1. User A commits an incentive to user B to vote on snapshot. User B votes.
2. 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. 
3. 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.
4. 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  


### Methods

While this EIP defines a struct *incentive*, `bytes memory` 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 `abi.decode()` and interpreted according to those known specifications.

#### `incentivize`

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 `incentiveInfo` and create store a new `incentive` 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.

Function should account for fees taken from user at deposit. If fees are present, then `incentivize` should take them up front. This is to ensure that the amount quoted to a recipient is *at least* as much as they would receive.

MUST emit the `incentiveSent` event

```yaml
- name: incentivize
  type: function
  stateMutability: payable

  inputs:
    - name: incentiveId
      type: bytes32
    - name: incentiveInfo
      type: bytes memory
```

#### `claimIncentive`

Should be used by the intended recipient of a previously-committed incentive. 

MUST revert if `msg.sender != original_recipient` and `!allowedClaimer[original_recipient][msg.sender]`

MUST revert if the data provided in `reveal` does not match the data committed to by `incentiveId`.

MUST revert if all funds committed to cannot be properly sent to `recipient` at conclusion of the function. If fees are present, then additional funds should be present at deposit to ensure that *at least* the amount committed to is sent to the user. This however, **DOES NOT** apply to any fees which may be taken by an approved claimer.

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 `&gt;=100 USDC` but **NOT** that Bob himself receives `&gt;=100 USDC` 

MUST revert if the voting direction of the original recipient cannot be verified as being in line with the intended direction of `incentiveId`, and no dispute resolution process is defined.

MUST revert if the specified incentive has a pending dispute.

If verification is successful then funds should be sent to `recipient`.

MUST emit the `incentiveClaimed` event if function does not revert.

```yaml
- name: claimIncentive
  type: function
  stateMutability: nonpayable

  inputs:
    - name: incentiveId
      type: bytes32
    - name: reveal
      type: bytes memory
    - name: recipient
      type: address payable
```

#### `reclaimIncentive`

  Function that should be invoked by the initial sender of `incentiveId` in the event that `recipient` did not vote in accordance with the incentive&apos;s `direction`. Function should return the funds initially committed to by `incentiveId` to `incentivizer`

  MUST revert if all of the funds committed to cannot be returned to the incentivizer. 

  MUST revert if the function cannot successfully verify the validity of `msg.sender` claim of non-compliance.

  MUST emit the event `incentiveReclaimed` if verification is successful. If proof can be retrieved on-chain, then the `proof` parameter may be left empty.

  MUST revert if the specified incentive has a pending dispute.

  If fees are taken, then all funds including any prepaid fees committed to should be returned to the `incentivizer`.
  
  ```yaml
- name: reclaimIncentive
    type: function
    stateMutability: nonpayable
  
    inputs:
      - name: incentiveId
        type: bytes32
      - name: reveal
        type: bytes memory
  ```

#### `verifyVote`

 `function verifyVote(bytes32 incentive, bytes memory voteInfo) public view returns (bool isVerifiable);`

 Function used to determine if the voter for `incentive` should receive the incentive originally committed to. 

 Functions may use whatever scheme they like to determine this information. Necessary data should be encoded and passed through `voteInfo`. 

 MUST return `false` if `voteInfo` indicates that `recipient` did not vote in the direction committed to by `incentive`, and true otherwise.

```yaml
- name: verifyVote
  type: function
  stateMutability: view

  inputs:
    - name: incentiveId
      type: bytes32
    - name: voteInfo
      type: bytes memory

  outputs: 
    - name: isVerified
      type: bool
    - name: proofData
      type: bytes memory
```

#### `modifyClaimer`

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. 

```yaml
- name: modifyClaimer
  type: function
  stateMutability: nonpayable

  inputs:
    - name: claimer
      type: address
    - name: designation
      type: bool

```

#### `beginDispute`

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 `recipient` or return them to the `incentivizer`

Potential Examples requiring additional dispute mechanisms:

  1. Requiring a trusted third-party to resolve disputes.
  2. The recipient did not vote in an off-chain proposal, and additional off-chain information is needed to confirm.
  3. An additional unlocking mechanism is required to access previously deposited funds.


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.

Must emit the event `disputeInitiated`

Once a dispute for a given incentive has been filed, neither the `incentivizer` nor `recipient` should be able to withdraw funds until completed.


```yaml
- name: beginDispute
  type: function
  stateMutability: payable

  inputs:
    - name: incentiveId
      type: bytes32
    - name: disputeInfo
      type: bytes memory
```

#### `resolveDispute`

A function which is used to resolve pending disputes over `incentiveId`. The exact mechanism shall be specified by the developers.

MUST return false, and be *&quot;dismissed&quot;*, if the mechanisms resolves the dispute in favor of the defendant `(recipient)`, by showing they did honor the incentive of `incentiveId`. If the dispute is *&quot;confirmed&quot;*, then the function should return true. 

MUST transfer funds committed to by `incentivizer` to `recipient` if dispute is `dismissed` and return `funds + fee + bond` to the `plaintiff`. 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.

MUST emit the event `disputeResolved` on successful resolution.

```yaml
- name: resolveDispute
  type: function
  stateMutability: nonPayable

  inputs:
    - name: incentiveId
      type: bytes32
    - name: disputeResolutionInfo
      type: bytes memory
  
  outputs: 
    - name isDismissed
      type: bool
```

### Events

#### `incentiveSent`

`incentivizer` has bribed `recipient` `amount` of `token` for some information. 

If system is private then recipient, amount, and `token` may be left as zero.

```yaml
- name: incentiveSent
  type: event

  inputs: 
    - name incentivizer
      indexed: true
      type: address
    - name: token
      indexed: true
      type: address
    - name: amount
      indexed: true
      type: uint256
    - name: recipient
      indexed: true
      type: address
```


#### `incentiveClaimed`

  `recipient` claimed an incentive `amount` of `token` and any other data relevant.
  
```yaml
- name: incentiveClaimed
  - type: event

  inputs:
    - name: recipient
      indexed: true
      type: address
    - name: token
      indexed: true
      type: address
    - name: amount
      indexed: true
      type: uint256
    - name: data
      indexed: false
      type: bytes
```

#### `modifiedClaimer`

  A new `claimer` was either whitelisted by `recipient` or blacklisted.

```yaml
- name: modifiedClaimer
  type: event

  inputs:
    - name: recipient
      indexed: false
      type: address
    - name: claimer
      indexed: false
      type: address
    - name: direction
      indexed: false
      type: bool
```

#### `incentiveReclaimed`

  An `incentivizer` is reclaiming `incentiveId`, and outing the noncompliance of `voter`

```yaml
- name: incentiveReclaimed
  type: event

  inputs: 
    - name: incentivizer
      indexed: true
      type: address
    - name: voter
      indexed: true
      type: address
    - name: incentiveId
      indexed: false
      type: bytes32
    - name: proofData
      indexed: false
      type: bytes
```

#### `disputeInitiated`

  `incentivizer` has initiated a dispute with `plaintiff` over `incentiveId`

```yaml
- name: disputeInitiated
  type: event

  inputs: 
    - name: incentiveId
      indexed: true
      type: bytes32
    - name: plaintiff
      indexed: true
      type: address
    - name: defendant
      indexed: true
      type: address
```

#### `disputeResolved`

  The dispute over `incentiveId` has been resolved, either `dismissed` in favor of `defendant` or resolved in favor of the `plaintiff`

```yaml
- name: disputeResolved
  type: event

  inputs:
    - name: incentiveId
      indexed: false
      type: bytes32
    - name: plaintiff
      indexed: true
      type: address
    - name: defendant
      indexed: true
      type: address
    - name: dismissed
      indexed: true
      type: bool
      
```

## Rationale

This design was motivated by a few factors:

1. 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&apos;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. 

2. 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.

**Implementations should operate similar to the following example:**

1. 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

2. 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.

3. 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.


**Factors to consider**

1. 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.

2. 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.


### Potential Ethical Issues

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/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. 

If nothing is done, the following outcomes are possible:

1. 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. 

2. 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.

## Backwards Compatibility

No backward compatibility issues found.

## Security Considerations

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.

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 **non-trivial** and thus require special care to ensure they are implemented and configured securely, otherwise features like confidentiality may be violated. 


## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 15 Feb 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6506</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6506</guid>
      </item>
    
      <item>
        <title>Stealth Meta-Address Registry</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/stealth-meta-address-registry/12888</comments>
        
        <description>## Abstract

This specification defines a standardized way of storing and retrieving an entity&apos;s stealth meta-address, by extending [ERC-5564](./eip-5564.md). An entity may register their stealth meta-address directly. A third party can also register on behalf of an entity using a valid [EIP-712](./eip-712.md) or [EIP-1271](./eip-1271.md) 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 `generateStealthAddress` specified in [ERC-5564](./eip-5564.md) to send assets to the generated stealth address without revealing the entity&apos;s address.

## Motivation

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.

## Specification

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.

This contract defines an `ERC6538Registry` 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.

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 `1` as the SECP256k1 curve cryptographic scheme with view tags, as specified in [ERC-5564](./eip-5564.md).

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.23;

/// @notice `ERC6538Registry` contract to map accounts to their stealth meta-address. See
/// [ERC-6538](https://eips.ethereum.org/EIPS/eip-6538) to learn more.
contract ERC6538Registry {
  /// @notice Emitted when an invalid signature is provided to `registerKeysOnBehalf`.
  error ERC6538Registry__InvalidSignature();

  /// @notice Next nonce expected from `user` to use when signing for `registerKeysOnBehalf`.
  /// @dev `registrant` may be a standard 160-bit address or any other identifier.
  /// @dev `schemeId` is an integer identifier for the stealth address scheme.
  mapping(address registrant =&gt; mapping(uint256 schemeId =&gt; bytes)) public stealthMetaAddressOf;

  /// @notice A nonce used to ensure a signature can only be used once.
  /// @dev `registrant` is the user address.
  /// @dev `nonce` will be incremented after each valid `registerKeysOnBehalf` call.
  mapping(address registrant =&gt; uint256) public nonceOf;

  /// @notice The EIP-712 type hash used in `registerKeysOnBehalf`.
  bytes32 public constant ERC6538REGISTRY_ENTRY_TYPE_HASH =
    keccak256(&quot;Erc6538RegistryEntry(uint256 schemeId,bytes stealthMetaAddress,uint256 nonce)&quot;);

  /// @notice The chain ID where this contract is initially deployed.
  uint256 internal immutable INITIAL_CHAIN_ID;

  /// @notice The domain separator used in this contract.
  bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

  /// @notice Emitted when a registrant updates their stealth meta-address.
  /// @param registrant The account that registered the stealth meta-address.
  /// @param schemeId Identifier corresponding to the applied stealth address scheme, e.g. 1 for
  /// secp256k1, as specified in ERC-5564.
  /// @param stealthMetaAddress The stealth meta-address.
  /// [ERC-5564](https://eips.ethereum.org/EIPS/eip-5564) bases the format for stealth
  /// meta-addresses on [ERC-3770](https://eips.ethereum.org/EIPS/eip-3770) and specifies them as:
  ///   st:&lt;shortName&gt;:0x&lt;spendingPubKey&gt;:&lt;viewingPubKey&gt;
  /// The chain (`shortName`) is implicit based on the chain the `ERC6538Registry` is deployed on,
  /// therefore this `stealthMetaAddress` is just the compressed `spendingPubKey` and
  /// `viewingPubKey` concatenated.
  event StealthMetaAddressSet(
    address indexed registrant, uint256 indexed schemeId, bytes stealthMetaAddress
  );

  /// @notice Emitted when a registrant increments their nonce.
  /// @param registrant The account that incremented the nonce.
  /// @param newNonce The new nonce value.
  event NonceIncremented(address indexed registrant, uint256 newNonce);

  constructor() {
    INITIAL_CHAIN_ID = block.chainid;
    INITIAL_DOMAIN_SEPARATOR = _computeDomainSeparator();
  }

  /// @notice Sets the caller&apos;s stealth meta-address for the given scheme ID.
  /// @param schemeId Identifier corresponding to the applied stealth address scheme, e.g. 1 for
  /// secp256k1, as specified in ERC-5564.
  /// @param stealthMetaAddress The stealth meta-address to register.
  function registerKeys(uint256 schemeId, bytes calldata stealthMetaAddress) external {
    stealthMetaAddressOf[msg.sender][schemeId] = stealthMetaAddress;
    emit StealthMetaAddressSet(msg.sender, schemeId, stealthMetaAddress);
  }

  /// @notice Sets the `registrant`&apos;s stealth meta-address for the given scheme ID.
  /// @param registrant Address of the registrant.
  /// @param schemeId Identifier corresponding to the applied stealth address scheme, e.g. 1 for
  /// secp256k1, as specified in ERC-5564.
  /// @param signature A signature from the `registrant` authorizing the registration.
  /// @param stealthMetaAddress The stealth meta-address to register.
  /// @dev Supports both EOA signatures and EIP-1271 signatures.
  /// @dev Reverts if the signature is invalid.
  function registerKeysOnBehalf(
    address registrant,
    uint256 schemeId,
    bytes memory signature,
    bytes calldata stealthMetaAddress
  ) external {
    bytes32 dataHash;
    address recoveredAddress;

    unchecked {
      dataHash = keccak256(
        abi.encodePacked(
          &quot;\x19\x01&quot;,
          DOMAIN_SEPARATOR(),
          keccak256(
            abi.encode(
              ERC6538REGISTRY_ENTRY_TYPE_HASH,
              schemeId,
              keccak256(stealthMetaAddress),
              nonceOf[registrant]++
            )
          )
        )
      );
    }

    if (signature.length == 65) {
      bytes32 r;
      bytes32 s;
      uint8 v;
      assembly (&quot;memory-safe&quot;) {
        r := mload(add(signature, 0x20))
        s := mload(add(signature, 0x40))
        v := byte(0, mload(add(signature, 0x60)))
      }
      recoveredAddress = ecrecover(dataHash, v, r, s);
    }

    if (
      (
        (recoveredAddress == address(0) || recoveredAddress != registrant)
          &amp;&amp; (
            IERC1271(registrant).isValidSignature(dataHash, signature)
              != IERC1271.isValidSignature.selector
          )
      )
    ) revert ERC6538Registry__InvalidSignature();

    stealthMetaAddressOf[registrant][schemeId] = stealthMetaAddress;
    emit StealthMetaAddressSet(registrant, schemeId, stealthMetaAddress);
  }

  /// @notice Increments the nonce of the sender to invalidate existing signatures.
  function incrementNonce() external {
    unchecked {
      nonceOf[msg.sender]++;
    }
    emit NonceIncremented(msg.sender, nonceOf[msg.sender]);
  }

  /// @notice Returns the domain separator used in this contract.
  /// @dev The domain separator is re-computed if there&apos;s a chain fork.
  function DOMAIN_SEPARATOR() public view returns (bytes32) {
    return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : _computeDomainSeparator();
  }

  /// @notice Computes the domain separator for this contract.
  function _computeDomainSeparator() internal view returns (bytes32) {
    return keccak256(
      abi.encode(
        keccak256(
          &quot;EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)&quot;
        ),
        keccak256(&quot;ERC6538Registry&quot;),
        keccak256(&quot;1.0&quot;),
        block.chainid,
        address(this)
      )
    );
  }
}

/// @notice Interface of the ERC1271 standard signature validation method for contracts as defined
/// in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
interface IERC1271 {
  /// @notice Should return whether the signature provided is valid for the provided data
  /// @param hash Hash of the data to be signed
  /// @param signature Signature byte array associated with _data
  function isValidSignature(bytes32 hash, bytes memory signature)
    external
    view
    returns (bytes4 magicValue);
}

```

The interface for this contract is defined below:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.23;

/// @dev Interface for calling the `ERC6538Registry` contract to map accounts to their stealth
/// meta-address. See [ERC-6538](https://eips.ethereum.org/EIPS/eip-6538) to learn more.
interface IERC6538Registry {
  /// @notice Emitted when an invalid signature is provided to `registerKeysOnBehalf`.
  error ERC6538Registry__InvalidSignature();

  /// @dev Emitted when a registrant updates their stealth meta-address.
  /// @param registrant The account that registered the stealth meta-address.
  /// @param schemeId Identifier corresponding to the applied stealth address scheme, e.g. 1 for
  /// secp256k1, as specified in ERC-5564.
  /// @param stealthMetaAddress The stealth meta-address.
  /// [ERC-5564](https://eips.ethereum.org/EIPS/eip-5564) bases the format for stealth
  /// meta-addresses on [ERC-3770](https://eips.ethereum.org/EIPS/eip-3770) and specifies them as:
  ///   st:&lt;shortName&gt;:0x&lt;spendingPubKey&gt;:&lt;viewingPubKey&gt;
  /// The chain (`shortName`) is implicit based on the chain the `ERC6538Registry` is deployed on,
  /// therefore this `stealthMetaAddress` is just the `spendingPubKey` and `viewingPubKey`
  /// concatenated.
  event StealthMetaAddressSet(
    address indexed registrant, uint256 indexed schemeId, bytes stealthMetaAddress
  );

  /// @notice Emitted when a registrant increments their nonce.
  /// @param registrant The account that incremented the nonce.
  /// @param newNonce The new nonce value.
  event NonceIncremented(address indexed registrant, uint256 newNonce);

  /// @notice Sets the caller&apos;s stealth meta-address for the given scheme ID.
  /// @param schemeId Identifier corresponding to the applied stealth address scheme, e.g. 1 for
  /// secp256k1, as specified in ERC-5564.
  /// @param stealthMetaAddress The stealth meta-address to register.
  function registerKeys(uint256 schemeId, bytes calldata stealthMetaAddress) external;

  /// @notice Sets the `registrant`&apos;s stealth meta-address for the given scheme ID.
  /// @param registrant Address of the registrant.
  /// @param schemeId Identifier corresponding to the applied stealth address scheme, e.g. 1 for
  /// secp256k1, as specified in ERC-5564.
  /// @param signature A signature from the `registrant` authorizing the registration.
  /// @param stealthMetaAddress The stealth meta-address to register.
  /// @dev Supports both EOA signatures and EIP-1271 signatures.
  /// @dev Reverts if the signature is invalid.
  function registerKeysOnBehalf(
    address registrant,
    uint256 schemeId,
    bytes memory signature,
    bytes calldata stealthMetaAddress
  ) external;

  /// @notice Increments the nonce of the sender to invalidate existing signatures.
  function incrementNonce() external;

  /// @notice Returns the domain separator used in this contract.
  function DOMAIN_SEPARATOR() external view returns (bytes32);

  /// @notice Returns the stealth meta-address for the given `registrant` and `schemeId`.
  function stealthMetaAddressOf(address registrant, uint256 schemeId)
    external
    view
    returns (bytes memory);

  /// @notice Returns the EIP-712 type hash used in `registerKeysOnBehalf`.
  function ERC6538REGISTRY_ENTRY_TYPE_HASH() external view returns (bytes32);

  /// @notice Returns the nonce of the given `registrant`.
  function nonceOf(address registrant) external view returns (uint256);
}

```

### Deployment Method

The `ERC6538Registry` contract is deployed at `0x6538E6bf4B0eBd30A8Ea093027Ac2422ce5d6538` using `CREATE2` via the deterministic deployer at `0x4e59b44847b379578588920ca78fbf26c0b4956c` with a salt of `0x7cac4e512b1768c627c9e711c7a013f1ad0766ef5125c59fb7161dade58da078`.

## Rationale

Having a central smart contract for registering stealth meta-addresses has several benefits:

1. 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.

2. It ensures that users are not dependent on off-chain sources to retrieve a user&apos;s stealth meta-address.

3. Registration of a stealth meta-address in this contract provides a standard way for users to communicate that they&apos;re ready to participate in stealth interactions.

4. By deploying the registry as a singleton contract, multiple projects can access the same set of stealth meta-addresses, contributing to improved standardization.

## Backwards Compatibility

This EIP is fully backward compatible.

## Reference Implementation

You can find an implementation of the `ERC6538Registry` contract [here](../assets/eip-6538/contracts/ERC6538Registry.sol) and the interface `IERC6538Registry.sol` [here](../assets/eip-6538/contracts/interfaces/IERC6538Registry.sol).

## Security Considerations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 24 Jan 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6538</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6538</guid>
      </item>
    
      <item>
        <title>Non-fungible Token Bound Accounts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/non-fungible-token-bound-accounts/13030</comments>
        
        <description>## Abstract

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.

## Motivation

The [ERC-721](./eip-721.md) standard enabled an explosion of non-fungible token applications. Some notable use cases have included breedable cats, generative artwork, and exchange liquidity positions.

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:

- A character in a role-playing game that accumulates assets and abilities over time based on actions they have taken
- An automobile composed of many fungible and non-fungible components
- An investment portfolio composed of multiple fungible assets
- A punch pass membership card granting access to an establishment and recording a history of past interactions

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&apos;s existing ownership model.

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.

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.

By giving every NFT the full capabilities of an Ethereum account, this proposal enables many novel use cases for existing and future NFTs.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Overview

The system outlined in this proposal has two main components:

- A singleton registry for token bound accounts
- A common interface for token bound account implementations

The following diagram illustrates the relationship between NFTs, NFT holders, token bound accounts, and the Registry:
![](../assets/eip-6551/diagram.png)

### Registry

The registry is a singleton contract that serves as the entry point for all token bound account address queries. It has two functions:

- `createAccount` - creates the token bound account for an NFT given an `implementation` address
- `account` - computes the token bound account address for an NFT given an `implementation` address

The registry is permissionless, immutable, and has no owner. The complete source code for the registry can be found in the [Registry Implementation](#registry-implementation) section. The registry MUST be deployed at address `0x000000006551c19487814612e58FE06813775758` using Nick&apos;s Factory (`0x4e59b44847b379578588920cA78FbF26c0B4956C`) with salt `0x0000000000000000000000000000000000000000fd8eb4e1dca713016c518e31`.

The registry can be deployed to any EVM-compatible chain using the following transaction:

```
{
        &quot;to&quot;: &quot;0x4e59b44847b379578588920ca78fbf26c0b4956c&quot;,
        &quot;value&quot;: &quot;0x0&quot;,
        &quot;data&quot;: &quot;0x0000000000000000000000000000000000000000fd8eb4e1dca713016c518e31608060405234801561001057600080fd5b5061023b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063246a00211461003b5780638a54c52f1461006a575b600080fd5b61004e6100493660046101b7565b61007d565b6040516001600160a01b03909116815260200160405180910390f35b61004e6100783660046101b7565b6100e1565b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b60015284601552605560002060601b60601c60005260206000f35b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b600152846015526055600020803b61018b578560b760556000f580610157576320188a596000526004601cfd5b80606c52508284887f79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf887226060606ca46020606cf35b8060601b60601c60005260206000f35b80356001600160a01b03811681146101b257600080fd5b919050565b600080600080600060a086880312156101cf57600080fd5b6101d88661019b565b945060208601359350604086013592506101f46060870161019b565b94979396509194608001359291505056fea2646970667358221220ea2fe53af507453c64dd7c1db05549fa47a298dfb825d6d11e1689856135f16764736f6c63430008110033&quot;,
}
```

The registry MUST deploy each token bound account as an [ERC-1167](./eip-1167.md) minimal proxy with immutable constant data appended to the bytecode.

The deployed bytecode of each token bound account MUST have the following structure:

```
ERC-1167 Header               (10 bytes)
&lt;implementation (address)&gt;    (20 bytes)
ERC-1167 Footer               (15 bytes)
&lt;salt (bytes32)&gt;              (32 bytes)
&lt;chainId (uint256)&gt;           (32 bytes)
&lt;tokenContract (address)&gt;     (32 bytes)
&lt;tokenId (uint256)&gt;           (32 bytes)
```

For example, the token bound account with implementation address `0xbebebebebebebebebebebebebebebebebebebebe`, salt `0`, chain ID `1`, token contract `0xcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcf` and token ID `123` would have the following deployed bytecode:

```
363d3d373d3d3d363d73bebebebebebebebebebebebebebebebebebebebe5af43d82803e903d91602b57fd5bf300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000cfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcfcf000000000000000000000000000000000000000000000000000000000000007b
```

Each token bound account proxy MUST delegate execution to a contract that implements the `IERC6551Account` interface.

The registry MUST deploy all token bound accounts using the `create2` 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.

The registry MUST implement the following interface:

```solidity
interface IERC6551Registry {
    /**
     * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.
     */
    event ERC6551AccountCreated(
        address account,
        address indexed implementation,
        bytes32 salt,
        uint256 chainId,
        address indexed tokenContract,
        uint256 indexed tokenId
    );

    /**
     * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.
     */
    error AccountCreationFailed();

    /**
     * @dev Creates a token bound account for a non-fungible token.
     *
     * If account has already been created, returns the account address without calling create2.
     *
     * Emits ERC6551AccountCreated event.
     *
     * @return account The address of the token bound account
     */
    function createAccount(
        address implementation,
        bytes32 salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) external returns (address account);

    /**
     * @dev Returns the computed token bound account address for a non-fungible token.
     *
     * @return account The address of the token bound account
     */
    function account(
        address implementation,
        bytes32 salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) external view returns (address account);
}
```

### Account Interface

All token bound accounts SHOULD be created via the singleton registry.

All token bound account implementations MUST implement [ERC-165](./eip-165.md) interface detection.

All token bound account implementations MUST implement [ERC-1271](./eip-1271.md) signature validation.

All token bound account implementations MUST implement the following interface:

```solidity
/// @dev the ERC-165 identifier for this interface is `0x6faff5f1`
interface IERC6551Account {
    /**
     * @dev Allows the account to receive Ether.
     *
     * Accounts MUST implement a `receive` function.
     *
     * Accounts MAY perform arbitrary logic to restrict conditions
     * under which Ether can be received.
     */
    receive() external payable;

    /**
     * @dev Returns the identifier of the non-fungible token which owns the account.
     *
     * The return value of this function MUST be constant - it MUST NOT change over time.
     *
     * @return chainId       The chain ID of the chain the token exists on
     * @return tokenContract The contract address of the token
     * @return tokenId       The ID of the token
     */
    function token()
        external
        view
        returns (uint256 chainId, address tokenContract, uint256 tokenId);

    /**
     * @dev Returns a value that SHOULD be modified each time the account changes state.
     *
     * @return The current account state
     */
    function state() external view returns (uint256);

    /**
     * @dev Returns a magic value indicating whether a given signer is authorized to act on behalf
     * of the account.
     *
     * MUST return the bytes4 magic value 0x523e3260 if the given signer is valid.
     *
     * By default, the holder of the non-fungible token the account is bound to MUST be considered
     * a valid signer.
     *
     * Accounts MAY implement additional authorization logic which invalidates the holder as a
     * signer or grants signing permissions to other non-holder accounts.
     *
     * @param  signer     The address to check signing authorization for
     * @param  context    Additional data used to determine whether the signer is valid
     * @return magicValue Magic value indicating whether the signer is valid
     */
    function isValidSigner(address signer, bytes calldata context)
        external
        view
        returns (bytes4 magicValue);
}

```

### Execution Interface

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.

Token bound accounts MAY support the following execution interface:

```solidity
/// @dev the ERC-165 identifier for this interface is `0x51945447`
interface IERC6551Executable {
    /**
     * @dev Executes a low-level operation if the caller is a valid signer on the account.
     *
     * Reverts and bubbles up error if operation fails.
     *
     * Accounts implementing this interface MUST accept the following operation parameter values:
     * - 0 = CALL
     * - 1 = DELEGATECALL
     * - 2 = CREATE
     * - 3 = CREATE2
     *
     * Accounts implementing this interface MAY support additional operations or restrict a signer&apos;s
     * ability to execute certain operations.
     *
     * @param to        The target address of the operation
     * @param value     The Ether value to be sent to the target
     * @param data      The encoded operation calldata
     * @param operation A value indicating the type of operation to perform
     * @return The result of the operation
     */
    function execute(address to, uint256 value, bytes calldata data, uint8 operation)
        external
        payable
        returns (bytes memory);
}
```

## Rationale

### Singleton Registry

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.

#### Counterfactual Accounts

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.

#### Trustless Deployments

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.

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.

#### Cross-chain Compatibility

A singleton registry with a known address enables each token bound account to exist on multiple chains. The inclusion of `chainId` as a parameter to `createAccount` 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.

#### Single Entry Point

A single entry point for querying account addresses and `AccountCreated` events simplifies the complex task of indexing token bound accounts in applications which support this proposal.

#### Implementation Diversity

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.

### Registry vs Factory

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).

### Variable Execution Interface

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.

### Account Ambiguity

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.

However, these alternatives present several trade offs.

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.

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&apos; opinion that defining a canonical and constrained implementation in this proposal is premature.

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.

### Proxy Implementation

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.

### Chain Identifier

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.

## Backwards Compatibility

This proposal seeks to be maximally backwards compatible with existing non-fungible token contracts. As such, it does not extend the ERC-721 standard.

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.

Smart contract authors may optionally choose to enforce interface detection for ERC-721 in their account implementations.

## Reference Implementation

### Example Account Implementation

```solidity
pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/utils/introspection/IERC165.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/IERC721.sol&quot;;
import &quot;@openzeppelin/contracts/interfaces/IERC1271.sol&quot;;
import &quot;@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol&quot;;

interface IERC6551Account {
    receive() external payable;

    function token()
        external
        view
        returns (uint256 chainId, address tokenContract, uint256 tokenId);

    function state() external view returns (uint256);

    function isValidSigner(address signer, bytes calldata context)
        external
        view
        returns (bytes4 magicValue);
}

interface IERC6551Executable {
    function execute(address to, uint256 value, bytes calldata data, uint8 operation)
        external
        payable
        returns (bytes memory);
}

contract ERC6551Account is IERC165, IERC1271, IERC6551Account, IERC6551Executable {
    uint256 immutable deploymentChainId = block.chainid;

    uint256 public state;

    receive() external payable {}

    function execute(address to, uint256 value, bytes calldata data, uint8 operation)
        external
        payable
        virtual
        returns (bytes memory result)
    {
        require(_isValidSigner(msg.sender), &quot;Invalid signer&quot;);
        require(operation == 0, &quot;Only call operations are supported&quot;);

        ++state;

        bool success;
        (success, result) = to.call{value: value}(data);

        if (!success) {
            assembly {
                revert(add(result, 32), mload(result))
            }
        }
    }

    function isValidSigner(address signer, bytes calldata) external view virtual returns (bytes4) {
        if (_isValidSigner(signer)) {
            return IERC6551Account.isValidSigner.selector;
        }

        return bytes4(0);
    }

    function isValidSignature(bytes32 hash, bytes memory signature)
        external
        view
        virtual
        returns (bytes4 magicValue)
    {
        bool isValid = SignatureChecker.isValidSignatureNow(owner(), hash, signature);

        if (isValid) {
            return IERC1271.isValidSignature.selector;
        }

        return bytes4(0);
    }

    function supportsInterface(bytes4 interfaceId) external pure virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId
            || interfaceId == type(IERC6551Account).interfaceId
            || interfaceId == type(IERC6551Executable).interfaceId;
    }

    function token() public view virtual returns (uint256, address, uint256) {
        bytes memory footer = new bytes(0x60);

        assembly {
            extcodecopy(address(), add(footer, 0x20), 0x4d, 0x60)
        }

        return abi.decode(footer, (uint256, address, uint256));
    }

    function owner() public view virtual returns (address) {
        (uint256 chainId, address tokenContract, uint256 tokenId) = token();
        if (chainId != deploymentChainId) return address(0);

        return IERC721(tokenContract).ownerOf(tokenId);
    }

    function _isValidSigner(address signer) internal view virtual returns (bool) {
        return signer == owner();
    }
}
```

### Registry Implementation

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IERC6551Registry {
    /**
     * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.
     */
    event ERC6551AccountCreated(
        address account,
        address indexed implementation,
        bytes32 salt,
        uint256 chainId,
        address indexed tokenContract,
        uint256 indexed tokenId
    );

    /**
     * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.
     */
    error AccountCreationFailed();

    /**
     * @dev Creates a token bound account for a non-fungible token.
     *
     * If account has already been created, returns the account address without calling create2.
     *
     * Emits ERC6551AccountCreated event.
     *
     * @return account The address of the token bound account
     */
    function createAccount(
        address implementation,
        bytes32 salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) external returns (address account);

    /**
     * @dev Returns the computed token bound account address for a non-fungible token.
     *
     * @return account The address of the token bound account
     */
    function account(
        address implementation,
        bytes32 salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) external view returns (address account);
}

contract ERC6551Registry is IERC6551Registry {
    function createAccount(
        address implementation,
        bytes32 salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) external returns (address) {
        assembly {
            // Memory Layout:
            // ----
            // 0x00   0xff                           (1 byte)
            // 0x01   registry (address)             (20 bytes)
            // 0x15   salt (bytes32)                 (32 bytes)
            // 0x35   Bytecode Hash (bytes32)        (32 bytes)
            // ----
            // 0x55   ERC-1167 Constructor + Header  (20 bytes)
            // 0x69   implementation (address)       (20 bytes)
            // 0x5D   ERC-1167 Footer                (15 bytes)
            // 0x8C   salt (uint256)                 (32 bytes)
            // 0xAC   chainId (uint256)              (32 bytes)
            // 0xCC   tokenContract (address)        (32 bytes)
            // 0xEC   tokenId (uint256)              (32 bytes)

            // Silence unused variable warnings
            pop(chainId)

            // Copy bytecode + constant data to memory
            calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId
            mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer
            mstore(0x5d, implementation) // implementation
            mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header

            // Copy create2 computation data to memory
            mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)
            mstore(0x15, salt) // salt
            mstore(0x01, shl(96, address())) // registry address
            mstore8(0x00, 0xff) // 0xFF

            // Compute account address
            let computed := keccak256(0x00, 0x55)

            // If the account has not yet been deployed
            if iszero(extcodesize(computed)) {
                // Deploy account contract
                let deployed := create2(0, 0x55, 0xb7, salt)

                // Revert if the deployment fails
                if iszero(deployed) {
                    mstore(0x00, 0x20188a59) // `AccountCreationFailed()`
                    revert(0x1c, 0x04)
                }

                // Store account address in memory before salt and chainId
                mstore(0x6c, deployed)

                // Emit the ERC6551AccountCreated event
                log4(
                    0x6c,
                    0x60,
                    // `ERC6551AccountCreated(address,address,bytes32,uint256,address,uint256)`
                    0x79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf88722,
                    implementation,
                    tokenContract,
                    tokenId
                )

                // Return the account address
                return(0x6c, 0x20)
            }

            // Otherwise, return the computed account address
            mstore(0x00, shr(96, shl(96, computed)))
            return(0x00, 0x20)
        }
    }

    function account(
        address implementation,
        bytes32 salt,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId
    ) external view returns (address) {
        assembly {
            // Silence unused variable warnings
            pop(chainId)
            pop(tokenContract)
            pop(tokenId)

            // Copy bytecode + constant data to memory
            calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId
            mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer
            mstore(0x5d, implementation) // implementation
            mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header

            // Copy create2 computation data to memory
            mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)
            mstore(0x15, salt) // salt
            mstore(0x01, shl(96, address())) // registry address
            mstore8(0x00, 0xff) // 0xFF

            // Store computed account address in memory
            mstore(0x00, shr(96, shl(96, keccak256(0x00, 0x55))))

            // Return computed account address
            return(0x00, 0x20)
        }
    }
}
```

## Security Considerations

### Fraud Prevention

In order to enable trustless sales of token bound accounts, decentralized marketplaces will need to implement safeguards against fraudulent behavior by malicious account owners.

Consider the following potential scam:

- Alice owns an ERC-721 token X, which owns token bound account Y.
- Alice deposits 10ETH into account Y
- 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
- Alice withdraws 10ETH from the token bound account, and immediately accepts Bob&apos;s offer
- Bob receives token X, but account Y is empty

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.

Here are a few mitigations strategies to be considered:

- 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.
- 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.
- 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.
- Implement a locking mechanism on the token bound account implementation that prevents malicious owners from extracting assets from the account while locked

Preventing fraud is outside the scope of this proposal.

### Ownership Cycles

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.

Ownership cycles can be introduced in any graph of n&gt;0 token bound accounts. On-chain prevention of cycles with depth&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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 23 Feb 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6551</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6551</guid>
      </item>
    
      <item>
        <title>Cultural and Historical Asset Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6596-historical-asset-metadata-json-schema/13090</comments>
        
        <description>## Abstract

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.

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.

## Motivation

**Preserving context and significance** - 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.

**Proof-based preservation** - 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.

**Interoperability** - 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).

**Search and Discovery** - 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.

Currently, the [ERC-721](./eip-721.md) 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&apos; 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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

This EIP extends [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md) with 48 additional properties to capture the
cultural and historical significance of the underlying asset.

Compatible contracts, besides implementing the relevant metadata schemas (&quot;Metadata JSON Schema&quot; for
[ERC-721](./eip-721.md) contracts or &quot;Metadata URI JSON Schema&quot; for [ERC-1155](./eip-1155.md) contracts), must implement
the following metadata interface.

### Cultural and Historical Asset Metadata Extension TypeScript Interface

The following TypeScript interface defines the Metadata JSON Schema compatible tokens must conform to:

```typescript
interface HistoricalAssetMetadata {
    name?: string;                              // Name of the CHAT
    description?: string;                       // Full description of the CHAT to provide the cultural and historical
                                                // context
    image?: string;                             // A URI pointing to a resource with mime type image/* to serve as the
                                                // cover image of the CHAT
    attributes?: CHATAttribute[];               // A list of attributes to describe the CHAT. Attribute object may be
                                                // repeated if a field has multiple values
    attributesExt?: ExtendedCHATAttribute[];    // A list of extended attributes to describe the CHAT, not to be
                                                // displayed. Attribute object may be repeated if a field has
                                                // multiple values
}

type CHATAttribute =
    { trait_type: &quot;Catalogue Level&quot;, value: string }
    | { trait_type: &quot;Publication / Creation Date&quot;, value: string }
    | { trait_type: &quot;Creator Name&quot;, value: string }
    | { trait_type: &quot;Creator Bio&quot;, value: string }
    | { trait_type: &quot;Asset Type&quot;, value: string }
    | { trait_type: &quot;Classification&quot;, value: string }
    | { trait_type: &quot;Materials and Technology&quot;, value: string }
    | { trait_type: &quot;Subject Matter&quot;, value: string }
    | { trait_type: &quot;Edition&quot;, value: string }
    | { trait_type: &quot;Series name&quot;, value: string }
    | { trait_type: &quot;Dimensions Unit&quot;, value: string }
    | { trait_type: &quot;Dimensions (height)&quot;, value: number }
    | { trait_type: &quot;Dimensions (width)&quot;, value: number }
    | { trait_type: &quot;Dimensions (depth)&quot;, value: number }
    | { trait_type: &quot;Inscriptions / Marks&quot;, value: string }
    | { trait_type: &quot;Credit Line&quot;, value: string }
    | { trait_type: &quot;Current Owner&quot;, value: string }
    | { trait_type: &quot;Provenance&quot;, value: string }
    | { trait_type: &quot;Acquisition Date&quot;, value: string }
    | { trait_type: &quot;Citation&quot;, value: string }
    | { trait_type: &quot;Keyword&quot;, value: string }
    | { trait_type: &quot;Copyright Holder&quot;, value: string }
    | { trait_type: &quot;Bibliography&quot;, value: string }
    | { trait_type: &quot;Issuer&quot;, value: string }
    | { trait_type: &quot;Issue Timestamp&quot;, value: string }
    | { trait_type: &quot;Issuer Description&quot;, value: string }
    | { trait_type: &quot;Asset File Size&quot;, value: number }
    | { trait_type: &quot;Asset File Format&quot;, value: string }
    | { trait_type: &quot;Copyright / Restrictions&quot;, value: string }
    | { trait_type: &quot;Asset Creation Geo&quot;, value: string }
    | { trait_type: &quot;Asset Creation Location&quot;, value: string }
    | { trait_type: &quot;Asset Creation Coordinates&quot;, value: string }
    | { trait_type: &quot;Relevant Date&quot;, value: string }
    | { trait_type: &quot;Relevant Geo&quot;, value: string }
    | { trait_type: &quot;Relevant Location&quot;, value: string }
    | { trait_type: &quot;Relevant Person&quot;, value: string }
    | { trait_type: &quot;Relevant Entity&quot;, value: string }
    | { trait_type: &quot;Asset Language&quot;, value: string }
    | { trait_type: &quot;Is Physical Asset&quot;, value: boolean }

type ExtendedCHATAttribute =
    { trait_type: &quot;Asset Full Text&quot;, value: string }
    | { trait_type: &quot;Exhibition / Loan History&quot;, value: string }
    | { trait_type: &quot;Copyright Document&quot;, value: string }
    | { trait_type: &quot;Provenance Document&quot;, value: string }
    | { trait_type: &quot;Asset URL&quot;, value: string }
    | { trait_type: &quot;Copyright Document of Underlying Asset&quot;, value: string }
```

#### CHATAttribute Description

| trait_type                  | description                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|-----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Catalogue Level             | An indication of the level of cataloging represented by the record, based on the physical form or intellectual content of the material                                                                                                                                                                                                                                                                                                                              |
| Publication / Creation Date | Earliest possible creation date of the underlying asset in ISO 8601 date format                                                                                                                                                                                                                                                                                                                                                                                     |
| Creator Name                | 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 |
| Creator Bio                 | The brief biography or description of creator                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Asset Type                  | The type of the underlying asset                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Classification              | 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                                                              |
| Materials and Technology    | The materials and/or techniques used to create the physical underlying asset                                                                                                                                                                                                                                                                                                                                                                                        |
| Subject Matter              | 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                                                                                                                                                                                                                                                     |
| Edition                     | Edition of the original work                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Series Name                 | The name of the series the asset is a part of                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Dimensions Unit             | Unit of the measurement of the dimension of the asset                                                                                                                                                                                                                                                                                                                                                                                                               |
| Dimensions (height)         | Height of the underlying asset                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Dimensions (width)          | Width of the underlying asset                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Dimensions (depth)          | Depth of the underlying asset                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Credit Line                 | 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&apos;s name (if applicable), the date of creation, and any other relevant information that helps identify and contextualize the work                                                                                            |
| Inscriptions / Marks        | 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)                                                                                                                                                |
| Current Owner               | Name of the current owner                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Provenance                  | Provenance provides crucial information about the artwork&apos;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                                                                                                                                             |
| Acquisition Date            | The date on which the acquirer obtained the asset                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Citation                    | Citations of the asset in publications, journals, and any other medium                                                                                                                                                                                                                                                                                                                                                                                              |
| Keyword                     | Keywords that are relevant for researchers                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Copyright Holder            | Copyright holder of the underlying asset                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Bibliography                | Information on where this asset has been referenced, cited, consulted, and for what purpose                                                                                                                                                                                                                                                                                                                                                                         |
| Issuer                      | Issuer of the token                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Issue Timestamp             | Date of token creation                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Issuer Description          | Brief description of the issuing party                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Asset File Size             | Size of the digital file of the underlying asset in bytes                                                                                                                                                                                                                                                                                                                                                                                                           |
| Asset File Format           | The physical form or the digital format of the underlying asset. For digital format, a MIME type should be specified                                                                                                                                                                                                                                                                                                                                                |
| Copyright / Restrictions    | The copyright status the work is under                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Asset Creation Geo          | 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                                                                                                                                                                                                                       |
| Asset Creation Location     | Specific cities and named locations where the underlying asset was created                                                                                                                                                                                                                                                                                                                                                                                          |
| Asset Creation Coordinates  | Coordinates of the location where the underlying asset was created                                                                                                                                                                                                                                                                                                                                                                                                  |
| Relevant Date               | Dates, in ISO 8601 date format, referenced in, and important to the significance of the CHAT                                                                                                                                                                                                                                                                                                                                                                        |
| Relevant Geo                | 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                                                                                                                                                                                           |
| Relevant Location           | Specific cities and named locations referenced in, and important to the significance of the CHAT                                                                                                                                                                                                                                                                                                                                                                    |
| Relevant Person             | Individuals referenced in, and important to the significance of the CHAT                                                                                                                                                                                                                                                                                                                                                                                            |
| Relevant Entity             | Entities referenced in, and important to the significance of the CHAT                                                                                                                                                                                                                                                                                                                                                                                               |
| Asset Language              | Languages used in the underlying asset. Reference to ISO 639 for code or macrolanguage names                                                                                                                                                                                                                                                                                                                                                                        |
| Is Physical Asset           | Flags whether the asset is tied to a physical asset                                                                                                                                                                                                                                                                                                                                                                                                                 |

#### ExtendedCHATAttribute Description

| trait_type                             | description                                                                                                                                                                                                                                                                                |
|----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Asset Full Text                        | The full text in the underlying asset of the CHAT                                                                                                                                                                                                                                          |
| Exhibition / Loan History              | Including exhibition/loan description, dates, title, type, curator, organizer, sponsor, venue                                                                                                                                                                                              |
| Copyright Document                     | A URI pointing to the legal contract CHATs outlines the copyright of the underlying asset                                                                                                                                                                                                  |
| Provenance Document                    | A URI pointing to the existing provenance record documents of the underlying asset                                                                                                                                                                                                         |
| Asset URL                              | A URI pointing to a high-quality file of the underlying asset                                                                                                                                                                                                                              |
| Copyright Document of Underlying Asset | 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 |

#### Example

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.

The metadata format is compatible with the [ERC-721](./eip-721.md) and OpenSea style metadata format.

```json
{
  &quot;name&quot;: &quot;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)&quot;,
  &quot;description&quot;: &quot;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.\n\nThe 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.&quot;,
  &quot;image&quot;: &quot;ipfs://bafybeiav6sqcgzxk5h5afnmb3iisgma2kpnyj5fa5gnhozwaqwzlayx6se&quot;,
  &quot;attributes&quot;: [
    { &quot;trait_type&quot;: &quot;Publication / Creation Date&quot;, &quot;value&quot;: &quot;1826/1836&quot; },
    { &quot;trait_type&quot;: &quot;Creator Name&quot;, &quot;value&quot;: &quot;Katsushika Hokusai&quot; },
    { &quot;trait_type&quot;: &quot;Creator Bio&quot;, &quot;value&quot;: &quot;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.&quot; },
    { &quot;trait_type&quot;: &quot;Asset Type&quot;, &quot;value&quot;: &quot;Painting&quot; },
    { &quot;trait_type&quot;: &quot;Classification&quot;, &quot;value&quot;: &quot;Arts of Asia&quot; },
    { &quot;trait_type&quot;: &quot;Materials and Technology&quot;, &quot;value&quot;: &quot;Color woodblock print, oban&quot; },
    { &quot;trait_type&quot;: &quot;Subject Matter&quot;, &quot;value&quot;: &quot;Asian Art&quot; },
    { &quot;trait_type&quot;: &quot;Subject Matter&quot;, &quot;value&quot;: &quot;Edo Period (1615-1868)&quot; },
    { &quot;trait_type&quot;: &quot;Subject Matter&quot;, &quot;value&quot;: &quot;Ukiyo-e Style&quot; },
    { &quot;trait_type&quot;: &quot;Subject Matter&quot;, &quot;value&quot;: &quot;Woodblock Prints&quot; },
    { &quot;trait_type&quot;: &quot;Subject Matter&quot;, &quot;value&quot;: &quot;Japan 1800-1900 A.D.&quot; },
    { &quot;trait_type&quot;: &quot;Edition&quot;, &quot;value&quot;: &quot;1&quot; },
    { &quot;trait_type&quot;: &quot;Series name&quot;, &quot;value&quot;: &quot;Thirty-Six Views of Mount Fuji (Fugaku sanjûrokkei)&quot; },
    { &quot;trait_type&quot;: &quot;Dimensions Unit&quot;, &quot;value&quot;: &quot;cm&quot; },
    { &quot;trait_type&quot;: &quot;Dimensions (height)&quot;, &quot;value&quot;: 25.4 },
    { &quot;trait_type&quot;: &quot;Dimensions (width)&quot;, &quot;value&quot;: 37.6 },
    { &quot;trait_type&quot;: &quot;Inscriptions / Marks&quot;, &quot;value&quot;: &quot;Signature: Hokusai aratame Iitsu fude&quot; },
    { &quot;trait_type&quot;: &quot;Inscriptions / Marks&quot;, &quot;value&quot;: &quot;Publisher: Nishimura-ya Yohachi&quot; },
    { &quot;trait_type&quot;: &quot;Credit Line&quot;, &quot;value&quot;: &quot;Clarence Buckingham Collection&quot; },
    { &quot;trait_type&quot;: &quot;Current Owner&quot;, &quot;value&quot;: &quot;Art Institute of Chicago&quot; },
    { &quot;trait_type&quot;: &quot;Provenance&quot;, &quot;value&quot;: &quot;Yamanaka, New York by 1905&quot; },
    { &quot;trait_type&quot;: &quot;Provenance&quot;, &quot;value&quot;: &quot;Sold to Clarence Buckingham, Chicago by 1925&quot; },
    { &quot;trait_type&quot;: &quot;Provenance&quot;, &quot;value&quot;: &quot;Kate S. Buckingham, Chicago, given to the Art Institute of Chicago, 1925.&quot; },
    { &quot;trait_type&quot;: &quot;Acquisition Date&quot;, &quot;value&quot;: &quot;1925&quot; },
    { &quot;trait_type&quot;: &quot;Citation&quot;, &quot;value&quot;: &quot;James Cuno, The Art Institute of Chicago: The Essential Guide, rev. ed. (Art Institute of Chicago, 2009) p. 100.&quot; },
    { &quot;trait_type&quot;: &quot;Citation&quot;, &quot;value&quot;: &quot;James N. Wood, The Art Institute of Chicago: The Essential Guide, rev. ed. (Art Institute of Chicago, 2003), p. 86.&quot; },
    { &quot;trait_type&quot;: &quot;Citation&quot;, &quot;value&quot;: &quot;Jim Ulak, Japanese Prints (Art Institute of Chicago, 1995), p. 268.&quot; },
    { &quot;trait_type&quot;: &quot;Citation&quot;, &quot;value&quot;: &quot;Ukiyo-e Taikei (Tokyo, 1975), vol. 8, 29; XIII, I.&quot; },
    { &quot;trait_type&quot;: &quot;Citation&quot;, &quot;value&quot;: &quot;Matthi Forrer, Hokusai (Royal Academy of Arts, London 1988), p. 264.&quot; },
    { &quot;trait_type&quot;: &quot;Citation&quot;, &quot;value&quot;: &quot;Richard Lane, Hokusai: Life and Work (London, 1989), pp. 189, 192.&quot; },
    { &quot;trait_type&quot;: &quot;Copyright Holder&quot;, &quot;value&quot;: &quot;Public domain&quot; },
    { &quot;trait_type&quot;: &quot;Copyright / Restrictions&quot;, &quot;value&quot;: &quot;CC0&quot; },
    { &quot;trait_type&quot;: &quot;Asset Creation Geo&quot;, &quot;value&quot;: &quot;Japan&quot; },
    { &quot;trait_type&quot;: &quot;Asset Creation Location&quot;, &quot;value&quot;: &quot;Tokyo (Edo)&quot; },
    { &quot;trait_type&quot;: &quot;Asset Creation Coordinates&quot;, &quot;value&quot;: &quot;36.2048° N, 138.2529° E&quot; },
    { &quot;trait_type&quot;: &quot;Relevant Date&quot;, &quot;value&quot;: &quot;18th Century&quot; },
    { &quot;trait_type&quot;: &quot;Relevant Geo&quot;, &quot;value&quot;: &quot;Japan, Chicago&quot; },
    { &quot;trait_type&quot;: &quot;Relevant Location&quot;, &quot;value&quot;: &quot;Art Institute of Chicago&quot; },
    { &quot;trait_type&quot;: &quot;Relevant Person&quot;, &quot;value&quot;: &quot;Katsushika Hokusai&quot; },
    { &quot;trait_type&quot;: &quot;Relevant Person&quot;, &quot;value&quot;: &quot;Yamanaka&quot; },
    { &quot;trait_type&quot;: &quot;Relevant Person&quot;, &quot;value&quot;: &quot;Clarence Buckingham&quot; },
    { &quot;trait_type&quot;: &quot;Relevant Person&quot;, &quot;value&quot;: &quot;Kate S. Buckingham&quot; },
    { &quot;trait_type&quot;: &quot;Relevant Entity&quot;, &quot;value&quot;: &quot;Art Institute of Chicago, Clarence Buckingham Collection&quot; },
    { &quot;trait_type&quot;: &quot;Asset Language&quot;, &quot;value&quot;: &quot;Japanese&quot; },
    { &quot;trait_type&quot;: &quot;Is Physical Asset&quot;, &quot;value&quot;: true }
  ]
}
```

## Rationale

### Choosing to Extend Off-Chain Metadata JSON Schema over On-Chain Interface

Both the [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md) provide natural extension points in the metadata JSON
file associated with NFTs to supply enriched datasets about the underlying assets.

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.

### Capturing Attributes Extensions in `attributes` and `attributesExt` properties

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: `attributes` and `attributesExt`. This division serves
two distinct purposes while ensuring maximum compatibility with existing NFT galleries and marketplaces.

**1. `attributes` Property**

The `attributes` 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&apos;s name, description, image, and other key characteristics
in `attributes`, 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.

**2. `attributesExt` Property**

The `attributesExt` 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 `attributesExt`, 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.

This division of attributes into `attributes` and `attributesExt` 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.

## Backwards Compatibility

This EIP is fully backward compatible with [ERC-721](./eip-721.md) and [ERC-1155](./eip-1155.md).

## Security Considerations

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.

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).

Frontend or client-side systems are recommended to escape all control characters that may be exploited to perform
Cross-Site Scripting (XSS).

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.

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.

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 28 Feb 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6596</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6596</guid>
      </item>
    
      <item>
        <title>Abstract Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/draft-eip-abstract-token-standard/13152</comments>
        
        <description>## Abstract

Abstract tokens provide a standard interface to:

* Mint tokens off-chain as messages
* Reify tokens on-chain via smart contract
* Dereify tokens back into messages

Abstract tokens can comply with existing standards like [ERC-20](./eip-20.md), [ERC-721](./eip-721.md), and [ERC-1155](./eip-1155.md). The standard allows wallets and other applications to better handle *potential* tokens before any consensus-dependent events occur on-chain.

## Motivation

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:

* airdrops
* POAPs / receipts
* identity / access credentials

Merkle trees are often used for large token distributions to spread mint/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:

* Generic: compatible with merkle trees, digital signatures, or other eligibility proofs
* Legible: users can query an abstract token contract to understand their potential tokens (e.g. token id, quantity, or uri)
* Contained: users do not need to understand the proof mechanism used by the particular token implementation contract

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Data Types

#### Token Messages

A token message defines one or more tokens along with the context needed to reify the token(s) using a smart contract.

`chainId` &amp; `implementation`: set the domain of the token message to a specific chain and contract: this is where the token can be reified
`owner`: the address that owns the tokens defined in the messages when reified
`meta`: implementation-specific context necessary to reify the defined token(s), such as id, amount, or uri.
`proof`: implementation-specific authorization to reify the defined token(s).
`nonce`: counter that may be incremented when multiple otherwise-identical abstract token messages are needed

```solidity
struct AbstractTokenMessage {
  uint256 chainId;
  address implementation;
  address owner;
  bytes meta;
  uint256 nonce;
  bytes proof;
}
```

#### Message Status

A message status may be defined for every (abstract token contract, abstract token message) pair.
`invalid`: the contract cannot interact with the message
`valid`: the contract can interact with the message
`used`: the contract has already interacted with the message

```solidity
enum AbstractTokenMessageStatus {
  invalid,
  valid,
  used
}
```

### Methods

#### reify

Moves token(s) from a message to a contract
`function reify(AbstractTokenMessage calldata message) external;`

The token contract MUST reify a valid token message.

Reification MUST be idempotent: a particular token message may be used to reify tokens at most once. Calling `reify` with an already used token message MAY succeed or revert.

#### status

Returns the status of a particular message
`function status(AbstractTokenMessage calldata message) external view returns (AbstractTokenMessageStatus status);`

#### dereify

Moves token(s) from a contract to a message intended for another contract and/or chain.
`function dereify(AbstractTokenMessage calldata message) external;`

OPTIONAL - allows tokens to be moved between contracts and/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.

If implemented, dereification:

* MUST burn the exact tokens from the holder as defined in the token message
* MUST NOT dereify token messages scoped to the same contract and chain.
* MAY succeed or revert if the token message is already used.
* MUST emit the `Reify` event on only the first `reify` call with a specific token message

#### id

Return the id of token(s) defined in a token message.
`function id(AbstractTokenMessage calldata message) external view returns (uint256);`

OPTIONAL - abstract token contracts without a well-defined token ID (e.g. ERC-20) MAY return `0` or not implement this method.

#### amount

Return the amount of token(s) defined in a token message.
`function amount(AbstractTokenMessage calldata message) external view returns (uint256);`

OPTIONAL - abstract token contracts without a well-defined token amount (e.g. ERC-721) MAY return `0` or not implement this method.

#### uri

Return the amount of token(s) defined in a token message.
`function uri(AbstractTokenMessage calldata message) external view returns (string memory);`

OPTIONAL - abstract token contracts without a well-defined uri (e.g. ERC-20) MAY return `&quot;&quot;` or not implement this method.

#### supportsInterface

All abstract token contracts must support [ERC-165](./eip-165.md) and include the Abstract Token interface ID in their supported interfaces.

### Events

#### Reify

The Reify event MUST be emitted when a token message is reified into tokens
`event Reify(AbstractTokenMessage);`

#### Dereify

The Dereify event MUST be emitted when tokens are dereified into a message
`event Dereify(AbstractTokenMessage);`

### Application to existing token standards

Abstract tokens compatible with existing token standards MUST overload existing token transfer functions to allow transfers from abstract token messages.

### Abstract ERC-20

```solidity
interface IAbstractERC20 is IAbstractToken, IERC20, IERC165 {
  // reify the message and then transfer tokens
  function transfer(
    address to,
    uint256 amount,
    AbstractTokenMessage calldata message
  ) external returns (bool);

  // reify the message and then transferFrom tokens
  function transferFrom(
    address from,
    address to,
    uint256 amount,
    AbstractTokenMessage calldata message
  ) external returns (bool);
}
```

### Abstract ERC-721

```solidity
interface IAbstractERC721 is IAbstractToken, IERC721 {
  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes calldata _data,
    AbstractTokenMessage calldata message
  ) external;

  function transferFrom(
    address from,
    address to,
    uint256 tokenId,
    AbstractTokenMessage calldata message
  ) external;
}
```

### Abstract ERC-1155

```
interface IAbstractERC1155 is IAbstractToken, IERC1155 {
  function safeTransferFrom(
    address from,
    address to,
    uint256 id,
    uint256 amount,
    bytes calldata data,
    AbstractTokenMessage calldata message
  ) external;

  function safeBatchTransferFrom(
    address from,
    address to,
    uint256[] calldata ids,
    uint256[] calldata amounts,
    bytes calldata data,
    AbstractTokenMessage[] calldata messages
  ) external;
}
```

## Rationale

### Meta format

The abstract token message `meta` field is simply a byte array to preserve the widest possible accesibility.

* Applications handling abstract tokens can interact with the implementation contract for token metadata rather than parsing this field, so legibility is of secondary importance
* A byte array can be decoded as a struct and checked for errors within the implementation contract
* Future token standards will include unpredictable metadata

### Proof format

Similar considerations went into defining the `proof` field as a plain byte array:

* The contents of this field may vary, e.g. an array of `bytes32` merkle tree nodes or a 65 byte signature.
* a byte array handles all potential use cases at the expense of increased message size.

## Backwards Compatibility

No backward compatibility issues found.

## Reference Implementation

See [here](../assets/eip-6604/README.md).

## Security Considerations

Several concerns are highlighted.

### Message Loss

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.

### Authorizing Reification

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:

* Does total supply need to audited on-chain and/or off-chain?
* Does the mechanism require ongoing access to a secret (e.g. digital signature) or is it immutable (e.g. merkle proof)?
* Is there any way for an attacker to prevent the reification of an otherwise valid token message?

### Non-owner (De)Reification

Can non-owners (de)reify a token message on behalf of the owner?

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

### Abstract Token Bridge Double Spend

Abstract tokens could be used for a token-specific bridge:

* Dereify the token from chain A to with message M
* Reify the token on chain B with message M

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.

A naive bridge would be subject to double spend attacks:

* An attacker requests bridging tokens they hold on chain A to chain B
* A bridging mechanism creates an abstract token message M
* The attacker reifies message M on chain B but *does not* dereify message M on chain A
* The attacker continues to use tokens

Some oracle mechanism is necessary to prevent the reification of message M on chain B until the corresponding tokens on chain A are dereified.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 03 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6604</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6604</guid>
      </item>
    
      <item>
        <title>Bit Based Permission</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/bit-based-permission/13065</comments>
        
        <description>## Abstract

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 `uint256`, 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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

_Note_ The following specifications use syntax from Solidity `0.8.7` (or above)

Interface of reference is described as followed:

```solidity
pragma solidity ^0.8.7;

/**
    @title EIP-6617 Bit Based Permission
    @dev See https://eips.ethereum.org/EIPS/eip-6617
*/
interface IEIP6617 {

    /**
        MUST trigger when a permission is granted.
        @param _grantor        Grantor of the permission
        @param _permission     Permission that is granted
        @param _user           User who received the permission
    */
    event PermissionGranted(address indexed _grantor, uint256 indexed _permission, address indexed _user);

    /**
        MUST trigger when a permission is revoked.
        @param _revoker        Revoker of the permission
        @param _permission     Permission that is revoked
        @param _user           User who lost the permission
    */
    event PermissionRevoked(address indexed _revoker, uint256 indexed _permission, address indexed _user);

    /**
        @notice Check if user has permission
        @param _user                Address of the user whose permission we need to check
        @param _requiredPermission  The required permission
        @return                     True if the _permission is a superset of the _requiredPermission else False
    */
    function hasPermission(address _user, uint256 _requiredPermission)
        external
        view
        returns (bool);

    /**
        @notice Add permission to user
        @param _user                Address of the user to whom we are going to add a permission
        @param _permissionToAdd     The permission that will be added
        @return                     The new permission with the _permissionToAdd
    */
    function grantPermission(address _user, uint256 _permissionToAdd)
        external
        returns (bool);

    /**
        @notice Revoke permission from user
        @param _user                Address of the user to whom we are going to revoke a permission
        @param _permissionToRevoke  The permission that will be revoked
        @return                     The new permission without the _permissionToRevoke
    */
    function revokePermission(address _user, uint256 _permissionToRevoke)
        external
        returns (bool);
}
```

- Compliant contracts MUST implement `IEIP6617`
- A permission in a compliant contract is represented as an `uint256`. A permission MUST take only one bit of an `uint256` and therefore MUST be a power of 2. Each permission MUST be unique and the `0` MUST be used for none permission.

### Metadata Interface

It is RECOMMENDED for compliant contracts to implement the optional extension `IEIP6617Meta`.

- They SHOULD define a name and description for the base permissions and main combinaison.

- They SHOULD NOT define a description for every subcombinaison of permissions possible.

```solidity
/**
 * @dev Defined the interface of the metadata of EIP6617, MAY NOT be implemented
 */
interface IEIP6617Meta {
    
    /**
        Structure of permission description
        @param _permission     Permission
        @param _name           Name of the permission
        @param _description    Description of the permission
    */
    struct PermissionDescription {
        uint256 permission;
        string name;
        string description;
    }

    /**
        MUST trigger when the description is updated.
        @param _permission     Permission
        @param _name           Name of the permission
        @param _description    Description of the permission
    */
    event UpdatePermissionDescription(uint256 indexed _permission, string indexed _name, string indexed _description);

    /**
        Returns the description of a given `_permission`.
        @param _permission     Permission
    */
    function getPermissionDescription(uint256 _permission) external view returns (PermissionDescription memory description);

    /**
        Return `true` if the description was set otherwise return `false`. It MUST emit `UpdatePermissionDescription` event.
        @param _permission     Permission
        @param _name           Name of the permission
        @param _description    Description of the permission
    */
    function setPermissionDescription(uint256 _permission, string memory _name, string memory _description)
        external
        returns (bool success);
}
```

## Rationale

Currently permission and access control is performed using a single owner ([ERC-173](./eip-173.md)) or with `bytes32` roles ([ERC-5982](./eip-5982.md)).
However, using bitwise and bitmask operations allows for greater gas-efficiency and flexibility.

### Gas cost efficiency

Bitwise operations are very cheap and fast. For example, doing an `AND` bitwise operation on a permission bitmask is significantly cheaper than calling any number of `LOAD` opcodes.

### Flexibility

With the 256 bits of the `uint256`, we can create up to 256 different permissions which leads to $2^{256}$ unique combinations (a.k.a. roles).
_(A role is a combination of multiple permissions)._ Not all roles have to be predefined.

Since permissions are defined as unsigned integers, we can use the binary OR operator to create new role based on multiple permissions.

### Ordering permissions by importance

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 `uint256`s.

### Associate a meaning

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.

To deal with this problem, you can set up the metadata interface, which associates a name and description to each permission or role. 

## Reference Implementation

First implementation could be found here:

- [Basic ERC-6617 implementation](../assets/eip-6617/contracts/EIP6617.sol)

## Security Considerations

No security considerations.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 27 Feb 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6617</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6617</guid>
      </item>
    
      <item>
        <title>AA Account Metadata For Authentication</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6662-account-metadata-for-aa-account-authentication/13232</comments>
        
        <description>## Abstract

This ERC proposes a new **IAccountMetadata** interface as an extension for [ERC-4337](./eip-4337.md) to store authentication data on-chain to support a more user-friendly authentication model.

## Motivation

In this proposal, we propose a new **IAccountMetadata** interface as an extension for ERC-4337 **IAccount** 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.

## Specification

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.

### Authentication Flow

![Authentication Flow](../assets/eip-6662/auth-flow.png)

In the new authentication workflow, users use AA compatible smart contract accounts as their wallet addresses. **Authenticator** could be anything but holding the private key to sign users&apos; operations. For example, it can be an offline authenticator mobile app or an online cloud service. **Relay** 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.

### Interface

To support the new authentication workflow, this ERC proposes a new **IAccountMetadata** interface as an extension of **IAccount** interface defined by ERC-4337.

```
interface IAccountMetadata {
  struct AuthenticatorInfo {
    // a list of service URIs to relay message from dApps to authenticators
    string[] relayURI;
    // a JSON string or URI pointing to a JSON file describing the
    // schema of AuthenticationRequest. The URI should follow ERC-4804
    // if the schema file is stored on-chain
    string schema;
  }

  function getAuthenticationInfo() external view returns(AuthenticatorInfo[] memory);
}
```

The relay endpoint should accept an AuthenticationRequest object as input. The format of the AuthenticationRequest object is defined by the schema field at AuthenticationInfo.

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.

```json
{
    &quot;title&quot;: &quot;AuthenticationRequest&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;entrypoint&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;the entrypoint contract address&quot;,
        },
        &quot;chainId&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;the chain id represented as hex string, e.g. 0x5 for goerli testnet&quot;,
        },
        &quot;userOp&quot;: {
            &quot;type&quot;: &quot;object&quot;,
            &quot;description&quot;: &quot;UserOp struct defined by ERC-4337 without signature&quot;,
        },
        &quot;encryptedData&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;contains all encrypted fields&quot;
        },
    }
}
```

## Rationale

To enable the new authentication workflow we described above, dApp needs to know two things:

1. **Where is the authenticator?** This is solved by the **relayURI** field in struct **AuthenticationInfo**. Users can publish the uri as the account metadata which will be pulled by dApp to do service discovery.

2. **What’s the format of AuthenticationRequest?** This is solved by the **schema** field in struct **AuthenticationInfo**. 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.

### Relay Service Selection

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.

### Signature Aggregation

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.

### Future Extension

The **IAccountMetadata** interface could be extended per different requirements. For example, a new alias or avatar field could be defined for profile displaying.

## Backwards Compatibility

The new interface is fully backward compatible with ERC-4337.

## Security Considerations

### End to End Encryption

To protect the user’s privacy and prevent front-running attacks, it&apos;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&apos;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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 09 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6662</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6662</guid>
      </item>
    
      <item>
        <title>Multi-redeemable NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6672-multi-redeemable-nfts/13276</comments>
        
        <description>## Abstract

This EIP proposes an extension to the [ERC-721](./eip-721.md) 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.

## Motivation

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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Redeem and Cancel Functions

An operator SHALL only make an update to the redemption created by itself. Therefore, the `redeem()` and `cancel()` functions do not have an `_operator` parameter, and the `msg.sender` address MUST be used as the `_operator`.

### Redemption Flag Key-Value Pairs

The combination of `_operator`, `_tokenId`, and `_redemptionId` MUST be used as the key in the redemption flag key-value pairs, whose value can be accessed from the `isRedeemed()` function.

**Every contract compliant with this EIP MUST implement `ERC6672` and `ERC721` interfaces.**

```solidity
pragma solidity ^0.8.16;

/// @title ERC-6672 Multi-Redeemable NFT Standard
/// @dev See https://eips.ethereum.org/EIPS/eip-6672
/// Note: the ERC-165 identifier for this interface is 0x4dddf83f.
interface IERC6672 /* is IERC721 */ {
    /// @dev This event emits when an NFT is redeemed.
    event Redeem(
        address indexed _operator,
        uint256 indexed _tokenId,
        address redeemer,
        bytes32 _redemptionId,
        string _memo
    );

    /// @dev This event emits when a redemption is canceled.
    event Cancel(
      address indexed _operator,
      uint256 indexed _tokenId,
      bytes32 _redemptionId,
      string _memo
    );

    /// @notice Check whether an NFT is already used for redemption or not.
    /// @dev 
    /// @param _operator The address of the operator of the redemption platform.
    /// @param _redemptionId The identifier for a redemption.
    /// @param _tokenId The identifier for an NFT.
    /// @return Whether an NFT is already redeemed or not.
    function isRedeemed(address _operator, bytes32 _redemptionId, uint256 _tokenId) external view returns (bool);

    /// @notice List the redemptions created by the given operator for the given NFT.
    /// @dev
    /// @param _operator The address of the operator of the redemption platform.
    /// @param _tokenId The identifier for an NFT.
    /// @return List of redemptions of speficic `_operator` and `_tokenId`.
    function getRedemptionIds(address _operator, uint256 _tokenId) external view returns (bytes32[]);
    
    /// @notice Redeem an NFT
    /// @dev
    /// @param _redemptionId The identifier created by the operator for a redemption.
    /// @param _tokenId The NFT to redeem.
    /// @param _memo
    function redeem(bytes32 _redemptionId, uint256 _tokenId, string _memo) external;

    /// @notice Cancel a redemption
    /// @dev
    /// @param _redemptionId The redemption to cancel.
    /// @param _tokenId The NFT to cancel the redemption.
    /// @param _memo
    function cancel(bytes32 _redemptionId, uint256 _tokenId, string _memo) external;
}
```

### Metadata Extension

The key format for the `redemptions` key-value pairs MUST be standardized as `operator-tokenId-redemptionId`, where `operator` is the operator wallet address, `tokenId` is  the identifier of the token that has been redeemed, and `redemptionId` is the redemption identifier. The value of the key `operator-tokenId-redemptionId` is an object that contains the `status` and `description` of the redemption.

- Redemption status, i.e. `status`

    The redemption status can have a more granular level, rather than just being a flag with a `true` or `false` value. For instance, in cases of physical goods redemption, we may require the redemption status to be either `redeemed`, `paid`, or `shipping`. 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.

- Description of the redemption, i.e. `description`

    The `description` 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.
    
The **metadata extension** is OPTIONAL for [ERC-6672](./eip-6672.md) 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.

```solidity
/// @title ERC-6672 Multi-Redeemable Token Standard, optional metadata extension
/// @dev See https://eips.ethereum.org/EIPS/eip-6672
interface IERC6672Metadata /* is IERC721Metadata */ {
    /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
    /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC
    ///  3986. The URI may point to a JSON file that conforms to the &quot;ERC-6672
    ///  Metadata JSON Schema&quot;.
    function tokenURI(uint256 _tokenId) external view returns (string);
}
```

This is the &quot;[ERC-6672](./eip-6672.md) Metadata JSON Schema&quot; referenced above.

```json
{
    &quot;title&quot;: &quot;Asset Metadata&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;properties&quot;: {
        &quot;name&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Identifies the asset to which this NFT represents&quot;
        },
        &quot;description&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;Describes the asset to which this NFT represents&quot;
        },
        &quot;image&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
        }
    },
    &quot;redemptions&quot;: {
        &quot;operator-tokenId-redemptionId&quot;: {
            &quot;status&quot;: {
                &quot;type&quot;: &quot;string&quot;,
                &quot;description&quot;: &quot;The status of a redemption. Enum type can be used to represent the redemption status, such as redeemed, shipping, paid.&quot;
            },
            &quot;description&quot;: {
                &quot;type&quot;: &quot;string&quot;,
                &quot;description&quot;: &quot;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.&quot;
            }
        }
    }
}
```

## Rationale

### Key Choices for Redemption Flag and Status

The combination of `_operator`, `_tokenId`, and `_redemptionId` is chosen as the key because it provides a clear and unique identifier for each redemption transaction.

- Operator wallet address, i.e. `_operator`

    It&apos;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&apos;s ticket redemption is handled by a different operator.

- Token identifier, i.e. `_tokenId`

    Each NFT holder will have different redemption records created by the same operator. Therefore, it&apos;s important to use token identifier as one of the keys.

- Redemption identifier, i.e. `_redemptionId`

    Using `_redemptionId` 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 `_operator` and `_tokenId`, but with different `_redemptionId`.

## Backwards Compatibility

This standard is compatible with [ERC-721](./eip-721.md).

## Reference Implementation

The reference implementation of Multi-Redeemable NFT can be found [here](../assets/eip-6672/contracts/ERC6672.sol).


## Security Considerations

An incorrect implementation of [ERC-6672](./eip-6672.md) 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 [ERC-6672](./eip-6672.md) implementations to ensure that only the operator who created the redemption, identified using `msg.sender`, can update the redemption flag using the `redeem()` and `cancel()` functions. It is also recommended to isolate the `redeem()` and `cancel()` functions from [ERC-721](./eip-721.md) approval models.

This [ERC-6672](./eip-6672.md) token is compatible with [ERC-721](./eip-721.md), so wallets and smart contracts capable of storing and handling standard [ERC-721](./eip-721.md) tokens will not face the risk of asset loss caused by incompatible standard implementations.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 21 Feb 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6672</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6672</guid>
      </item>
    
      <item>
        <title>NFT Flashloans</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6682-nft-flashloans/13294</comments>
        
        <description>## Abstract

This standard is an extension of the existing flashloan standard ([ERC-3156](./eip-3156.md)) to support [ERC-721](./eip-721.md) 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.

## Motivation

The current flashloan standard, [ERC-3156](./eip-3156.md), only supports [ERC-20](./eip-20.md) tokens. ERC-721 tokens are sufficiently different from ERC-20 tokens that they require an extension of this existing standard to support them. 

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Contract Interface

```solidity
pragma solidity ^0.8.19;

interface IERC6682 {
    /// @dev The address of the token used to pay flash loan fees.
    function flashFeeToken() external view returns (address);

    /// @dev Whether or not the NFT is available for a flash loan.
    /// @param token The address of the NFT contract.
    /// @param tokenId The ID of the NFT.
    function availableForFlashLoan(address token, uint256 tokenId) external view returns (bool);
}
```

The `flashFeeToken` function MUST return the address of the token used to pay flash loan fees.

If the token used to pay the flash loan fees is ETH then `flashFeeToken` MUST return `address(0)`.

The `availableForFlashLoan` function MUST return whether or not the `tokenId` of `token` is available for a flashloan. If the `tokenId` is not currently available for a flashloan `availableForFlashLoan` MUST return `false` instead of reverting.

Implementers `MUST` also implement `IERC3156FlashLender`.

## Rationale

The above modifications are the simplest possible additions to the existing flashloan standard to support NFTs.

We choose to extend as much of the existing flashloan standard ([ERC-3156](./eip-3156.md)) 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.

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.

## Backwards Compatibility

This EIP is fully backwards compatible with [ERC-3156](./eip-3156.md) with the exception of the `maxFlashLoan` 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 `1` from `maxFlashLoan`. The `1` reflects the fact that only one NFT can be flashloaned per `flashLoan` call. For example:

```solidity
function maxFlashLoan(address token) public pure override returns (uint256) {
    // if a contract also supports flash loans for ERC20 tokens then it can
    // return some value here instead of 1
    return 1;
}
```

## Reference Implementation

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.19;

import &quot;../interfaces/IERC20.sol&quot;;
import &quot;../interfaces/IERC721.sol&quot;;
import &quot;../interfaces/IERC3156FlashBorrower.sol&quot;;
import &quot;../interfaces/IERC3156FlashLender.sol&quot;;
import &quot;../interfaces/IERC6682.sol&quot;;

contract ExampleFlashLender is IERC6682, IERC3156FlashLender {
    uint256 internal _feePerNFT;
    address internal _flashFeeToken;

    constructor(uint256 feePerNFT_, address flashFeeToken_) {
        _feePerNFT = feePerNFT_;
        _flashFeeToken = flashFeeToken_;
    }

    function flashFeeToken() public view returns (address) {
        return _flashFeeToken;
    }

    function availableForFlashLoan(address token, uint256 tokenId) public view returns (bool) {
        // return if the NFT is owned by this contract
        try IERC721(token).ownerOf(tokenId) returns (address result) {
            return result == address(this);
        } catch {
            return false;
        }
    }

    function flashFee(address token, uint256 tokenId) public view returns (uint256) {
        return _feePerNFT;
    }

    function flashLoan(IERC3156FlashBorrower receiver, address token, uint256 tokenId, bytes calldata data)
        public
        returns (bool)
    {
        // check that the NFT is available for a flash loan
        require(availableForFlashLoan(token, tokenId), &quot;IERC6682: NFT not available for flash loan&quot;);

        // transfer the NFT to the borrower
        IERC721(token).safeTransferFrom(address(this), address(receiver), tokenId);

        // calculate the fee
        uint256 fee = flashFee(token, tokenId);

        // call the borrower
        bool success =
            receiver.onFlashLoan(msg.sender, token, tokenId, fee, data) == keccak256(&quot;ERC3156FlashBorrower.onFlashLoan&quot;);

        // check that flashloan was successful
        require(success, &quot;IERC6682: Flash loan failed&quot;);
        
        // check that the NFT was returned by the borrower
        require(IERC721(token).ownerOf(tokenId) == address(this), &quot;IERC6682: NFT not returned by borrower&quot;);

        // transfer the fee from the borrower
        IERC20(flashFeeToken()).transferFrom(msg.sender, address(this), fee);

        return success;
    }

    function maxFlashLoan(address token) public pure override returns (uint256) {
        // if a contract also supports flash loans for ERC20 tokens then it can
        // return some value here instead of 1
        return 1;
    }

    function onERC721Received(address, address, uint256, bytes memory) public returns (bytes4) {
        return this.onERC721Received.selector;
    }
}
```

## Security Considerations

It&apos;s possible that the `flashFeeToken` method could return a malicious contract. Borrowers who intend to call the address that is returned from the `flashFeeToken` 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 `flashFeeToken` matches that of a user input.

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 12 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6682</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6682</guid>
      </item>
    
      <item>
        <title>L2 Token List</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/canonical-token-list-standard-from-the-eea-oasis-community-projects-l2-standards-working-group/13091</comments>
        
        <description>## Abstract

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.

## Motivation

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:

* 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.

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. 

Note that both of these issues are fundamental problems for the current multi-chain world.

Therefore, the goal of this document is to help token users to operationalize and disambiguate the usage of a token in their systems.

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.

An example of an Arbitrum token entry is given below:

```
{
logoURI: &quot;https://assets.coingecko.com/coins/images/13469/thumb/1inch-token.png?1608803028&quot;,
chainId: 42161,
address: &quot;0x6314C31A7a1652cE482cffe247E9CB7c3f4BB9aF&quot;,
name: &quot;1INCH Token&quot;,
symbol: &quot;1INCH&quot;,
decimals: 18,
extensions: {
  bridgeInfo: {
    1: {
    tokenAddress: &quot;0x111111111117dc0aa78b770fa6a738034120c302&quot;,
    originBridgeAddress: &quot;0x09e9222e96e7b4ae2a407b98d48e330053351eee&quot;,
    destBridgeAddress: &quot;0xa3A7B6F88361F48403514059F1F16C8E78d60EeC&quot;
     }
   }
  }
}
```

This standard will build upon the current framework and augment it with concepts from [Decentralized Identifiers (DIDs)](https://www.w3.org/TR/2022/REC-did-core-20220719/) based on the JSON linked data model [JSON-LD](https://www.w3.org/TR/2020/REC-json-ld11-20200716/) such as resolvable unique resource identifiers (URIs) and JSON-LD schemas which enable easier schema verification using existing tools.

Note that a standard for defining tokens is beyond the scope of this document.

## Specification

### Keywords:

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 [[RFC2119](https://www.rfc-editor.org/rfc/rfc2119)] when, and only when, they appear in all capitals, as shown here.

### Typographical Convention: Requirement Ids

A requirement is uniquely identified by a unique ID composed of its requirement level followed by a requirement number, as per convention **[RequirementLevelRequirementNumber]**. 
There are four requirement levels that are coded in requirement ids as per below convention: 

**[R]** - The requirement level for requirements which IDs start with the letter _R_ is to be interpreted as **MUST** as described in [RFC2119](https://www.rfc-editor.org/rfc/rfc2119). \
**[D]** - The requirement level for requirements which IDs start with the letter _D_ is to be interpreted as **SHOULD** as described in [RFC2119](https://www.rfc-editor.org/rfc/rfc2119). \
**[O]** - The requirement level for requirements which IDs start with the letter _O_ is to be interpreted as **MAY** as described in [RFC2119](https://www.rfc-editor.org/rfc/rfc2119). 

Note that requirements are uniquely numbered in ascending order within each requirement level.

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;a name=&quot;r1&quot;&gt; **[R1]** &lt;/a&gt;
The following data elements MUST be present in a canonical token list:

* type
* tokenListId
* name
* createdAt
* updatedAt
* versions
* tokens

Note, that the detailed definition of the data elements in [[R1]](#r1) along with descriptions and examples are given in the schema itself below.

[[R1]](#r1) testability: See suggested test fixtures for the data schema below. 

&lt;a name=&quot;r2&quot;&gt; **[R2]** &lt;/a&gt;
The tokens data element is a composite which MUST minimally contain the following data elements:

* chainId
* chainURI
* tokenId
* tokenType
* address
* name
* symbol
* decimals
* createdAt
* updatedAt

Note, that the detailed definition of the data elements in [[R2]](#r2) along with descriptions and examples are given in the schema itself below.

[[R2]](#r2) testability: See suggested test fixtures for this documents&apos; data schema below.

&lt;a name=&quot;d1&quot;&gt; **[D1]** &lt;/a&gt;
All other data elements of the schema SHOULD be included in a representation of a canonical token list.

[[D1]](#d1) testability: See suggested test fixtures for this documents&apos; data schema below.

&lt;a name=&quot;cr1d1&quot;&gt; **[CR1]&gt;[D1]** &lt;/a&gt; 
If the extension data elements is used, the following data elements MUST be present in the schema representation:

* rootChainId
* rootChainURI
* rootAddress

Note, that the detailed definition of the data elements in [[D1]](#d1) and [[CR1]&gt;[D1]](#cr1d1) along with descriptions and examples are given in the schema itself below.

[[CR1]&gt;[D1]](#cr1d1) testability: See suggested test fixtures for this documents&apos; data schema below.

&lt;a name=&quot;r3&quot;&gt; **[R3]** &lt;/a&gt;
All properties in the schema identified in the description to be a Universal Resource Identifier (URI) MUST follow in their semantics [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986).

[[R3]](#r3) testability: All requirements for [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) are testable.

&lt;a name=&quot;r4&quot;&gt; **[R4]** &lt;/a&gt;
The chainId property utilized MUST allow for the requirements of the [EIP-155](./eip-155.md) standard to be met.

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.

[[R4]](#r4) testability: EIP-155 requires that a transaction hash is derived from the keccak256 hash of the following nine RLP encoded elements `(nonce, gasprice, startgas, to, value, data, chainid, 0, 0)` which can be tested easily with existing cryptographic libraries. EIP-155 further requires that the `v` value of the secp256k1 signature must be set to `{0,1} + CHAIN_ID * 2 + 35` where `{0,1}` is the parity of the `y` value of the curve point for which the signature `r`-value is the `x`-value in the secp256k1 signing process. This requirement is testable with available open-source secp256k1 digital signature suites. Therefore, [[R4]](#r4) is testable.

&lt;a name=&quot;o1&quot;&gt; **[O1]** &lt;/a&gt;
The `humanReadableTokenSymbol` property MAY be used.

[[O1]](#o1) testability: A data property is always implementable in a schema.

&lt;a name=&quot;cr2o1&quot;&gt; **[CR2]&gt;[O1]** &lt;/a&gt;
The `humanReadableTokenSymbol` property MUST be constructed as the hyphenated concatenation of first the `tokenSymbol` and then the `chainId`.

An example would be:

```
&quot;tokenSymbol&quot; = ETH;
&quot;chainId&quot; = 1;
&quot;humanReadableTokenSymbol&quot; = ETH-1;
```

[[CR2]&gt;[O1]](#cr2o1) testability: `humanReadableTokenSymbol` can be parsed and split based on existing open source packages and the result compared to the `tokenSymbol` and `chainId` used in the data schema.


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 [[W3C-DID]](https://www.w3.org/TR/2022/REC-did-core-20220719/) for a concrete example in the context of a standard):

```
{
    &quot;$id&quot;: &quot;https://github.com/eea-oasis/l2/schemas/CanonicalTokenList.json&quot;,
    &quot;$schema&quot;: &quot;https://json-schema.org/draft-07/schema#&quot;,
    &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;CanonicalTokenList\&quot;, \&quot;@id\&quot;: \&quot;https://github.com/eea-oasis/l2#CanonicalTokenList\&quot;}&quot;,
    &quot;title&quot;: &quot;CanonicalTokenList&quot;,
    &quot;description&quot;: &quot;Canonical Token List&quot;,
    &quot;type&quot;: &quot;object&quot;,
    &quot;required&quot;: [
        &quot;type&quot;,
        &quot;tokenListId&quot;,
        &quot;name&quot;,
        &quot;createdAt&quot;,
        &quot;updatedAt&quot;,
        &quot;versions&quot;,
        &quot;tokens&quot;
        ],
        &quot;properties&quot;: {
            &quot;@context&quot;: {
                &quot;type&quot;: &quot;array&quot;
            },
            &quot;type&quot;: {
                &quot;oneOf&quot;: [
                    {
                        &quot;type&quot;: &quot;string&quot;
                    },
                    {
                        &quot;type&quot;: &quot;array&quot;
                    }
                ],
                &quot;examples&quot;: [&quot;CanonicalTokenList&quot;]
            },
            &quot;tokenListId&quot;: {
                &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;tokenListId\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                &quot;title&quot;: &quot;tokenListId&quot;,
                &quot;description&quot;: &quot;A resolvable URI to the publicly accessible place where this list can be found following the RFC 3986 standard.&quot;,
                &quot;type&quot;: &quot;string&quot;,
                &quot;examples&quot;: [&quot;https://ipfs.io/ipns/k51qzi5uqu5dkkciu33khkzbcmxtyhn376i1e83tya8kuy7z9euedzyr5nhoew&quot;]
            },
            &quot;name&quot;: {
                &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;name\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/name\&quot;}&quot;,
                &quot;title&quot;: &quot;name&quot;,
                &quot;description&quot;: &quot;Token List name&quot;,
                &quot;type&quot;: &quot;string&quot;,
                &quot;examples&quot;: [&quot;Aggregate Canonical Token List&quot;]
            },
            &quot;logoURI&quot;: {
                &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;logoURI\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                &quot;title&quot;: &quot;logoURI&quot;,
                &quot;description&quot;: &quot;URI or URL of the token list logo following the RFC 3986 standard&quot;,
                &quot;type&quot;: &quot;string&quot;,
                &quot;examples&quot;: [&quot;https://ipfs.io/ipns/k51qzi5uqu5dh5kbbff1ucw3ksphpy3vxx4en4dbtfh90pvw4mzd8nfm5r5fnl&quot;]
            },
            &quot;keywords&quot;: {
                &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;keywords\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/DefinedTerm\&quot;}&quot;,
                &quot;title&quot;: &quot;keywords&quot;,
                &quot;description&quot;: &quot;List of key words for the token list&quot;,
                &quot;type&quot;: &quot;array&quot;,
                &quot;examples&quot;: [Aggregate Token List]
            },
            &quot;createdAt&quot;: {
                &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;createdAt\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/datePublished\&quot;}&quot;,
                &quot;title&quot;: &quot;createdAt&quot;,
                &quot;description&quot;: &quot;Date and time token list was created&quot;,
                &quot;type&quot;: &quot;string&quot;,
                &quot;examples&quot;: [&quot;2022-05-08&quot;]
            },
            &quot;updatedAt&quot;: {
                &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;updatedAt\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/dateModified\&quot;}&quot;,
                &quot;title&quot;: &quot;updatedAt&quot;,
                &quot;description&quot;: &quot;Date and time token list was updated&quot;,
                &quot;type&quot;: &quot;string&quot;,
                 &quot;examples&quot;: [&quot;2022-05-09&quot;]
            },
            &quot;versions&quot;: {
                &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;versions\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/version\&quot;}&quot;,
                &quot;title&quot;: &quot;versions&quot;,
                &quot;description&quot;: &quot;Versions of the canonical token list&quot;,
                &quot;type&quot;: &quot;array&quot;,
                 &quot;items&quot;: {
                    &quot;type&quot;:&quot;object&quot;,
                    &quot;required&quot;:[
                        &quot;major&quot;,
                        &quot;minor&quot;,
                        &quot;patch&quot;
                    ],
                    &quot;properties&quot;: {
                        &quot;major&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;major\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/Number\&quot;}&quot;,
                            &quot;title&quot;: &quot;major&quot;,
                            &quot;description&quot;: &quot;Major Version Number of the Token List&quot;,
                            &quot;type&quot;: &quot;integer&quot;,
                             &quot;examples&quot;: [1]
                        },
                        &quot;minor&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;minor\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/Number\&quot;}&quot;,
                            &quot;title&quot;: &quot;minor&quot;,
                            &quot;description&quot;: &quot;Minor Version Number of the Token List&quot;,
                            &quot;type&quot;: &quot;integer&quot;,
                             &quot;examples&quot;: [1]
                        },
                        &quot;patch&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;patch\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/Number\&quot;}&quot;,
                            &quot;title&quot;: &quot;patch&quot;,
                            &quot;description&quot;: &quot;Patch Number of the Token List&quot;,
                            &quot;type&quot;: &quot;integer&quot;,
                             &quot;examples&quot;: [1]
                        },
                    }
                }
            },
            &quot;tokens&quot;: {
                &quot;title&quot;: &quot;Listed Token Entry&quot;,
                &quot;description&quot;: &quot;Listed Token Entry&quot;,
                &quot;type&quot;: &quot;array&quot;,
                 &quot;items&quot;: {
                    &quot;type&quot;:&quot;object&quot;,
                    &quot;required&quot;: [
                        &quot;chainId&quot;,
                        &quot;chainURI&quot;,
                        &quot;tokenId&quot;,
                        &quot;tokenType&quot;,
                        &quot;address&quot;,
                        &quot;name&quot;,
                        &quot;symbol&quot;,
                        &quot;decimals&quot;,
                        &quot;createdAt&quot;,
                        &quot;updatedAt&quot;
                    ],
                    &quot;properties&quot;: {
                        &quot;chainId&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;chainId\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                            &quot;title&quot;: &quot;chainId&quot;,
                            &quot;description&quot;: &quot;The typically used number identifier for the chain on which the token was issued.&quot;,
                            &quot;type&quot;: &quot;number&quot;,
                            &quot;examples&quot;: [137]
                        },
                        &quot;chainURI&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;chainURI\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                            &quot;title&quot;: &quot;chainURI&quot;,
                            &quot;description&quot;: &quot;A resolvable URI to the genesis block of the chain on which the token was issued following the RFC 3986 standard.&quot;,
                            &quot;type&quot;: &quot;string&quot;
                             &quot;examples&quot;: [&quot;https://polygonscan.com/block/0&quot;]
                        },
                        &quot;genesisBlockHash&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;genesisBlockHash\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/sha256\&quot;}&quot;,
                            &quot;title&quot;: &quot;genesisBlockHash&quot;,
                            &quot;description&quot;: &quot;The hash of the genesis block of the chain on which the token was issued.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;0xa9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b&quot;]
                        },
                        &quot;tokenIssuerId&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;tokenIssuerId\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                            &quot;title&quot;: &quot;tokenIssuerId&quot;,
                            &quot;description&quot;: &quot;A resolvable URI identifying the token issuer following the RFC 3986 standard.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;https://polygonscan.com/address/0xa9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b&quot;]
                        },
                        &quot;tokenIssuerName&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;tokenIssuerName\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/name\&quot;}&quot;,
                            &quot;title&quot;: &quot;tokenIssuerName&quot;,
                            &quot;description&quot;: &quot;The name oof the token issuer.&quot;,
                            &quot;type&quot;: &quot;string&quot;
                            &quot;examples&quot;: [&quot;Matic&quot;]
                        },
                        &quot;tokenId&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;tokenId\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                            &quot;title&quot;: &quot;tokenId&quot;,
                            &quot;description&quot;: &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.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;example&quot;: [&quot;https://polygonscan.com/address/0x0000000000000000000000000000000000001010&quot;]
                        },
                        &quot;tokenType&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;tokenType\&quot;, \&quot;@id\&quot;: \https://schema.org/StructuredValue\&quot;}&quot;,
                            &quot;title&quot;: &quot;tokenType&quot;,
                            &quot;description&quot;: &quot;Describes the type of token.&quot;,
                            &quot;type&quot;: &quot;array&quot;
                            &quot;examples&quot;[[&quot;fungible&quot;,&quot;transferable&quot;]]
                        },
                        &quot;tokenDesc&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;tokenDesc\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/description\&quot;}&quot;,
                            &quot;title&quot;: &quot;tokenDesc&quot;,
                            &quot;description&quot;: &quot;Brief description of the token and its functionality.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;Protocol Token for the Matic Network&quot;]
                        },
                        &quot;standard&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;standard\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/citation\&quot;}&quot;,
                            &quot;title&quot;: &quot;standard&quot;,
                            &quot;description&quot;: &quot;A resolvable URI to the description of the token standard.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md&quot;]
                        },
                        &quot;address&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;address\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                            &quot;title&quot;: &quot;address&quot;,
                            &quot;description&quot;: &quot;Address of the token smart contract.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;0x0000000000000000000000000000000000001010&quot;]
                        },
                        &quot;addressType&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;address\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/Intangible\&quot;}&quot;,
                            &quot;title&quot;: &quot;addressType&quot;,
                            &quot;description&quot;: &quot;AddressType of the token smart contract.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;MaticNameSpace&quot;]
                        },
                        &quot;addressAlg&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;addressAlg\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/algorithm\&quot;}&quot;,
                            &quot;title&quot;: &quot;addressAlg&quot;,
                            &quot;description&quot;: &quot;Algorithm used to create the address e.g. CREATE2 or the standard ethereum address construction which is the last 40 characters/20 bytes of the Keccak-256 hash of a secp256k1 public key.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;CREATE2&quot;]
                        },
                        &quot;name&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;name\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/name\&quot;}&quot;,
                            &quot;title&quot;: &quot;name&quot;,
                            &quot;description&quot;: &quot;Token name.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;Matic&quot;]
                        },
                        &quot;symbol&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;symbol\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/currency\&quot;}&quot;,
                            &quot;title&quot;: &quot;symbol&quot;,
                            &quot;description&quot;: &quot;Token symbol e.g. ETH.&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;MATIC&quot;]
                        },
                        &quot;humanReadableTokenSymbol&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;humanReadableTokenSymbol\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/currency\&quot;}&quot;,
                            &quot;title&quot;: &quot;humanReadableTokenSymbol&quot;,
                            &quot;description&quot;: &quot;A Token symbol e.g. ETH, concatenated with the `chainId` the token was issued on or bridged to, e.g. ETH-1&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;MATIC-137&quot;]
                        },
                        &quot;decimals&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;decimals\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/Number\&quot;}&quot;,
                            &quot;title&quot;: &quot;decimals&quot;,
                            &quot;description&quot;: &quot;Allowed number of decimals for the listed token. This property may be named differently by token standards e.g. granularity for ERC-777&quot;,
                            &quot;type&quot;: &quot;integer&quot;,
                            &quot;examples&quot;: [18]
                        },
                        &quot;logoURI&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;logoURI\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                            &quot;title&quot;: &quot;logoURI&quot;,
                            &quot;description&quot;: &quot;URI or URL of the token logo following the RFC 3986 standard.&quot;,
                            &quot;type&quot;: &quot;string&quot;
                            &quot;examples&quot;: [&quot;https://polygonscan.com/token/images/matic_32.png&quot;]
                        },
                        &quot;createdAt&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;createdAt\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/datePublished\&quot;}&quot;,
                            &quot;title&quot;: &quot;createdAt&quot;,
                            &quot;description&quot;: &quot;Date and time token was created&quot;,
                            &quot;type&quot;: &quot;string&quot;,
                            &quot;examples&quot;: [&quot;2020-05-31&quot;]
                        },
                        &quot;updatedAt&quot;: {
                            &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;updatedAt\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/dateModified\&quot;}&quot;,
                            &quot;title&quot;: &quot;updatedAt&quot;,
                            &quot;description&quot;: &quot;Date and time token was updated&quot;,
                            &quot;type&quot;: &quot;string&quot;
                            &quot;examples&quot;: [&quot;2020-05-31&quot;]
                        },
                        &quot;extensions&quot;: {
                            &quot;title&quot;: &quot;extensions&quot;,
                            &quot;description&quot;: &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&quot;,
                            &quot;type&quot;: &quot;array&quot;,
                            &quot;items&quot;: {
                                &quot;type&quot;:&quot;object&quot;,
                                &quot;required&quot;: [
                                    &quot;rootChainId&quot;,
                                    &quot;rootChainURI&quot;,
                                    &quot;rootAddress&quot;,
                                ],
                                &quot;properties&quot;: {
                                    &quot;rootChainId&quot;: {
                                        &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;rootChainId\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                                        &quot;title&quot;: &quot;rootChainId&quot;,
                                        &quot;description&quot;: &quot;The typically used number identifier for the root chain on which the token was originally issued.&quot;,
                                        &quot;type&quot;: &quot;number&quot;,
                                        &quot;examples&quot;: [137]
                                    },
                                    &quot;rootChainURI&quot;: {
                                        &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;rootChainURI\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                                        &quot;title&quot;: &quot;rootChainURI&quot;,
                                        &quot;description&quot;: &quot;A resolvable URI to the genesis block of the root chain on which the token was originally issued following the RFC 3986 standard.&quot;,
                                        &quot;type&quot;: &quot;string&quot;,
                                        &quot;examples&quot;: [&quot;https://polygonscan.com/block/0&quot;]
                                    },
                                    &quot;rootAddress&quot;: {
                                        &quot;$comment&quot;: &quot;{\&quot;term\&quot;: \&quot;rootAddress\&quot;, \&quot;@id\&quot;: \&quot;https://schema.org/identifier\&quot;}&quot;,
                                        &quot;title&quot;: &quot;rootAddress&quot;,
                                        &quot;description&quot;: &quot;Root address of the token smart contract.&quot;,
                                        &quot;type&quot;: &quot;string&quot;,
                                        &quot;examples&quot;: [&quot;0x0000000000000000000000000000000000001010&quot;]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
    &quot;additionalProperties&quot;: false,
}
```

Data Schema Testability: As the above data schema follows a JSON/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.


### Conformance

This section describes the conformance clauses and tests required to achieve an implementation that is provably conformant with the requirements in this document.

#### Conformance Targets

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. 

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.

#### Conformance Levels

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.

This document defines the conformance levels of a canonical token list as follows:

* **Level 1:** All MUST requirements are fulfilled by a specific implementation as proven by a test report that proves in an easily understandable manner the implementation&apos;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.
* **Level 2:** 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&apos;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.
* **Level 3:** 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&apos;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.

&lt;a name=&quot;d2&quot;&gt; **[D2]** &lt;/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.

[[D2]](#d2) 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 [[D2]](#d2).

&lt;a name=&quot;r5&quot;&gt; **[R5]** &lt;/a&gt; 
A claim that a canonical token list implementation conforms to this specification at **Level 2** or higher MUST describe the testing procedure carried out for each requirement at **Level 2** or higher, that justifies the claim to that requirement.

[[R5]](#r5) 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 [[R5]](#r5).


## Rationale

This specification is extending and clarifying current custom lists such as from Arbitrum and Optimism as referenced in the [Motivation](#motivation) or the Uniswap Tokenlist Project to improve clarity, security and encourage adoption by non-Web3 native entities.

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.

## Security Considerations

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 [CVE-2021-42574 (2021-10-25T12:38:28)](https://nvd.nist.gov/vuln/detail/CVE-2021-42574)).

### Security Considerations: Data Privacy

The standard does not set any requirements for compliance to jurisdiction legislation/regulations. It is the responsibility of the implementer to comply with applicable data privacy laws.

### Security Considerations: Production Readiness 

The standard does not set any requirements for the use of specific applications/tools/libraries etc. The implementer should perform due diligence when selecting specific applications/tools/libraries.

### Security Considerations: Internationalization and Localization

The standard encourages implementers to follow the [W3C &quot;Strings on the Web: Language and Direction Metadata&quot; best practices guide](https://www.w3.org/TR/2022/DNOTE-string-meta-20220804/) for identifying language and base direction for strings used on the Web wherever appropriate.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 20 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6734</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6734</guid>
      </item>
    
      <item>
        <title>L2 Aliasing of EVM-based Addresses</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/l2-aliasing-of-evm-based-addresses-from-the-eea-oasis-community-projects-l2-standards-working-group/13093</comments>
        
        <description>## Abstract

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.

## Motivation

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: 

 * 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. 
 * 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.

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.

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 &amp;rarr; 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.

See Figure 1 for the conceptual root &amp;rarr; leaf design with offset.

![Fig1](../assets/eip-6735/address-aliasing-root-leaf-design.png)

Figure 1: Root &amp;rarr; Leaf address aliasing concept using an chain immanent characteristics from L1 to L2 and L3 and back.

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.

To further clarify the connections between the different possible paths an asset can take from an L1 to different L2/L3s and the `relativeAddress` 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.

![Fig2](../assets/eip-6735/visual-Highlight-Path-Red-evm-based-aliasing..png)

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.

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.

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.

## Specification

### Typographical Convention: Requirement Ids

A requirement is uniquely identified by a unique ID composed of its requirement level followed by a requirement number, as per convention **[RequirementLevelRequirementNumber]**. 
There are four requirement levels that are coded in requirement ids as per below convention: 

**[R]** - The requirement level for requirements which IDs start with the letter _R_ is to be interpreted as **MUST** as described in [RFC2119](https://www.rfc-editor.org/rfc/rfc2119). \
**[D]** - The requirement level for requirements which IDs start with the letter _D_ is to be interpreted as **SHOULD** as described in [RFC2119](https://www.rfc-editor.org/rfc/rfc2119). \
**[O]** - The requirement level for requirements which IDs start with the letter _O_ is to be interpreted as **MAY** as described in [RFC2119](https://www.rfc-editor.org/rfc/rfc2119). 

Note that requirements are uniquely numbered in ascending order within each requirement level.

Example : It should be read that [R1] is an absolute requirement of the specification whereas [D1] is a recommendation and [O1] is truly optional.

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;a name=&quot;r1&quot;&gt; **[R1]** &lt;/a&gt;
An address alias -- `addressAlias` -- to be used between Chain A and Chain B MUST be constructed as follows:
`addressAlias (Chain A) = offsetAlias (for Chain A) relativeAddress (on Chain A) offsetAlias (for Chain A)`

[[R1]](#r1) testability: `addressAlias` can be parsed and split using existing open source packages and the result compared to known `addressAlias` and `relativeAddress` used in the construction.

&lt;a name=&quot;r2&quot;&gt; **[R2]** &lt;/a&gt;
The `offsetAlias` of a chain MUST be `0xchainId00000000000000000000000000000000chainId`

[[R2]](#r2) testability: `offsetAlias` can be parsed and split using existing open source packages and the result compared to known `chainId` used in the construction.

&lt;a name=&quot;r3&quot;&gt; **[R3]** &lt;/a&gt;
The `chainId` used in the `offsetAlias` MUST NOT be zero (0)

[[R3]](#r3) testability: A `chainId` is a numerical value and can be compared to `0`.

&lt;a name=&quot;r4&quot;&gt; **[R4]** &lt;/a&gt;
The `chainId` used in the `offsetAlias` MUST be 8 bytes.

[[R4]](#r4) testability: The length of the `chainId` string can be converted to bytes and then compared to `8`.

&lt;a name=&quot;r5&quot;&gt; **[R5]** &lt;/a&gt;
In case the `chainId` has less than 16 digits the `chainId` MUST be padded with zeros to 16 digits.

For example the `chainId` of Polygon PoS is `137`, with the current list of EVM based `chainId`s to be found at chainlist.org, and its `offsetAlias` is `0x0000000000000137000000000000000000000000000000000000000000000137`.

[[R5]](#r5) testability: `chainId` can be parsed and split using existing open source packages and the result compared to known `chainId` 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;a name=&quot;r6&quot;&gt; **[R6]** &lt;/a&gt;
The `offsetAlias`for Ethereum Mainnet as the primary anchor of EVM based chains MUST be `0x1111000000000000000000000000000000001111` due to current adoption of this offset by existing L2 solutions.

An example of address alias for the USDC asset would be `addressAlias = 0x1111A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB481111` 

[[R6]](#r6) testability: This requirement is a special case of [[R1]](#r1). Hence, it is testable. 

&lt;a name=&quot;r7&quot;&gt; **[R7]** &lt;/a&gt;
The `relativeAddress` 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 `relativeAddress` of an EOA or Smart Contract from another chain.  

An example of the former instance would be the relative address of wrapped USDC, `relativeAddress = 0x1111A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB481111`, and an example of the latter would be the relative address of wrapped USDC on Polygon, `relativeAddress = 0x00000000000001371111A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB4811110000000000000137`.

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:

```
addressAlias = 0x00000000000421611111A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB4811110000000000042161
```

[[R7]](#r7) 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;a name=&quot;r8&quot;&gt; **[R8]** &lt;/a&gt;
The order of the `offsetAlias`es in an `addressAlias` MUST be ordered from the `offSetAlias` of the root chain bracketing the `relativeAddress` on the root chain through the ordered sequence of `offsetAlias`es of the chains on which the digital asset exists.

For example, a valid `addressAlias` 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:

```
addressAlias = chainId(C) chainId(B) chainId(A) relativeAddress chainId(A) chainId(B) chainId(C)
```   

However, the reverse order is invalid:

```
addressAlias = chainId(A) chainId(B) chainId(C) relativeAddress chainId(C) chainId(B) chainId(A)
```  

[[R8]](#r8) testability: Since [[R1]](#r1) is testable and since [[R8]](#r8) is an order rule for the construction in [[R1]](#r1), which can be tested by applying logic operations on the output of [[R1]](#r1) tests, [[R8]](#r8) is testable. 

Note, that a proof that a given order is provably correct is beyond the scope of this document.

### Conformance

This section describes the conformance clauses and tests required to achieve an implementation that is provably conformant with the requirements in this document.

#### Conformance Targets

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. 

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.

#### Conformance Levels

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.

This document defines the conformance levels of EVM based Address Aliasing as follows:

* **Level 1:** All MUST requirements are fulfilled by a specific implementation as proven by a test report that proves in an easily understandable manner the implementation&apos;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.
* **Level 2:** 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&apos;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.
* **Level 3:** 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&apos;s conformance with each requirement based on implementation-specific test-fixtures with implementation-specific test-fixture inputs.

&lt;a name=&quot;d1&quot;&gt; **[D1]** &lt;/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.

[[D1]](#d1) 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 [[D1]](#d1).

&lt;a name=&quot;r9&quot;&gt; **[R9]** &lt;/a&gt;
A claim that a canonical token list implementation conforms to this specification at **Level 2** or higher MUST describe the testing procedure carried out for each requirement at **Level 2** or higher, that justifies the claim to that requirement.

[[R9]](#r9) 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 [[R9]](#r9).

## Rationale

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.

## Security Considerations

### Data Privacy

The standard does not set any requirements for compliance to jurisdiction legislation/regulations. It is the responsibility of the implementer to comply with applicable data privacy laws.

### Production Readiness 

The standard does not set any requirements for the use of specific applications/tools/libraries etc. The implementer should perform due diligence when selecting specific applications/tools/libraries.

There are security considerations as to the Ethereum-type addresses used in the construction of the `relativeAddress`.

If the Ethereum-type address used in the `relativeAddress` is supposed to be an EOA, the target system/recipient should validate that the `codehash` of the source account is `NULL` such that no malicious code can be executed surreptitiously in an asset transfer.

If the Ethereum-type address used in the `relativeAddress` is supposed to be a smart contract account representing an asset, the target system/recipient should validate that the `codehash` of the source account matches the `codehash` of the published smart contract solidity code to ensure that the source smart contract behaves as expected.

Lastly, it is recommended that as part of the `relativeAddress` validation the target system performs an address checksum validation as defined in [ERC-55](./eip-55.md).

### Internationalization and Localization

Given the non-language specific features of EVM-based address aliasing, there are no internationalization/localization considerations.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 20 Mar 2022 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6735</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6735</guid>
      </item>
    
      <item>
        <title>ERC-721 Utilities Information Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6785-erc-721-utilities-extension/13568</comments>
        
        <description>## Abstract

This specification defines standard functions and an extension of the metadata schema that outlines what a 
token&apos;s utility entails and how the utility may be used and/or accessed.
This specification is an optional extension of [ERC-721](./eip-721.md).

## Motivation

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.

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.

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.

## Specification

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.

Every contract compliant with [ERC-6785](./eip-6785.md) MUST implement the interface defined as follows:

### Contract Interface

```solidity
// @title NFT Utility description
///  Note: the EIP-165 identifier for this interface is ed231d73

interface IERC6785 {

    // Logged when the utility description URL of an NFT is changed
    /// @notice Emitted when the utilityURL of an NFT is changed
    /// The empty string for `utilityUri` indicates that there is no utility associated
    event UpdateUtility(uint256 indexed tokenId, string utilityUri);

    /// @notice set the new utilityUri - remember the date it was set on
    /// @dev The empty string indicates there is no utility
    /// Throws if `tokenId` is not valid NFT
    /// @param utilityUri  The new utility description of the NFT
    /// 4a048176
    function setUtilityUri(uint256 tokenId, string utilityUri) external;

    /// @notice Get the utilityUri of an NFT
    /// @dev The empty string for `utilityUri` indicates that there is no utility associated
    /// @param tokenId The NFT to get the user address for
    /// @return The utility uri for this NFT
    /// 5e470cbc
    function utilityUriOf(uint256 tokenId) external view returns (string memory);

    /// @notice Get the changes made to utilityUri
    /// @param tokenId The NFT to get the user address for
    /// @return The history of changes to `utilityUri` for this NFT
    /// f96090b9
    function utilityHistoryOf(uint256 tokenId) external view returns (string[] memory);
}
```

All functions defined as view MAY be implemented as pure or view

Function `setUtilityUri` MAY be implemented as public or external. Also, the ability to set the `utilityUri` SHOULD be
restricted to the one who&apos;s offering the utility, whether that&apos;s the NFT creator or someone else.

The event `UpdateUtility` MUST be emitted when the `setUtilityUri` function is called or any other time that the utility
of the token is changed, like in batch updates. 

The method `utilityHistoryOf` MUST reflect all changes made to the `utilityUri` of a tokenId, whether that&apos;s done 
through `setUtilityUri` or by any other means, such as bulk updates

The `supportsInterface` method MUST return true when called with `ed231d73`

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.

“ERC-6785 Metadata with utilities JSON Schema” :

```json
{
  &quot;title&quot;: &quot;Asset Metadata&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Identifies the asset to which this NFT represents&quot;
    },
    &quot;description&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Describes the asset to which this NFT represents&quot;
    },
    &quot;image&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;A URI pointing to a resource with mime type image/* 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.&quot;
    },
    &quot;utilities&quot;: {
      &quot;type&quot;: &quot;object&quot;,
      &quot;required&quot;: [
        &quot;type&quot;,
        &quot;description&quot;,
        &quot;t&amp;c&quot;
      ],
      &quot;properties&quot;: {
        &quot;type&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;description&quot;: &quot;Describes what type of utility this is&quot;
        },
        &quot;description&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;description&quot;: &quot;A brief description of the utility&quot;
        },
        &quot;properties&quot;: {
          &quot;type&quot;: &quot;array&quot;,
          &quot;description&quot;: &quot;An array of possible properties describing the utility, defined as key-value pairs&quot;,
          &quot;items&quot;: {
            &quot;type&quot;: &quot;object&quot;
          }
        },
        &quot;expiry&quot;: {
          &quot;type&quot;: &quot;number&quot;,
          &quot;description&quot;: &quot;The period of time for the validity of the utility, since the minting of the NFT. Expressed in seconds&quot;
        },
        &quot;t&amp;c&quot;: {
          &quot;type&quot;: &quot;string&quot;,
          &quot;description&quot;: &quot;&quot;
        }
      }
    }
  }
}
```

## Rationale

Since the `utilityUri` 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. 

For transparency purposes, having a `utilityHistoryOf` method will make it clear how the `utilityUri` has changed over 
time.

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:

```json
{
  &quot;name&quot;: &quot;...&quot;,
  &quot;description&quot;: &quot;...&quot;,
  &quot;image&quot;: &quot;...&quot;,
  &quot;utilities&quot;: {
    &quot;type&quot;: &quot;Video call&quot;,
    &quot;description&quot;: &quot;I will enter a private video call with whoever owns the NFT&quot;,
    &quot;properties&quot;: [
      {
        &quot;sessions&quot;: 2
      },
      {
        &quot;duration&quot;: 30
      },
      {
        &quot;time_unit&quot;: &quot;minutes&quot;
      }
    ],
    &quot;expiry&quot;: 1.577e+7,
    &quot;t&amp;c&quot;: &quot;https://....&quot;
  }
}
```

In order to get access to the details needed to enter the video call, the owner would access the URI returned by
the `getUtilityUri` 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.

The current status of the utility would also be included in the URI (eg: how many sessions are still available, etc.)

## Backwards Compatibility

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.

## Test Cases

Test cases are available [here](../assets/eip-6785/test/ERC6785.test.js)

## Reference Implementation

The reference implementation can be found [here](../assets/eip-6785/contracts/ERC6785.sol).

## Security Considerations

There are no security considerations related directly to the implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0-1.0](/LICENSE).
</description>
        <pubDate>Mon, 27 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6785</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6785</guid>
      </item>
    
      <item>
        <title>Registry for royalties payment for NFTs</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6786-royalty-debt-registry/13569</comments>
        
        <description>## Abstract

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.

## Motivation

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/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.

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.

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.

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.

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.

## Specification

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.

Every contract compliant with [ERC-6786](./eip-6786.md) MUST implement the interface defined as follows:

### Contract Interface

```solidity
// @title Royalty Debt Registry
/// Note: the ERC-165 identifier for this interface is 0x253b27b0

interface IERC6786 {

    // Logged when royalties were paid for a NFT
    /// @notice Emitted when royalties are paid for the NFT with address tokenAddress and id tokenId
    event RoyaltiesPaid(address indexed tokenAddress, uint256 indexed tokenId, uint256 amount);

    /// @notice sends msg.value to the creator of a NFT
    /// @dev Reverts if there are no on-chain informations about the creator
    /// @param tokenAddress The address of NFT contract
    /// @param tokenId The NFT id
    function payRoyalties(address tokenAddress, uint256 tokenId) external payable;

    /// @notice Get the amount of royalties which was paid for a NFT
    /// @dev 
    /// @param tokenAddress The address of NFT contract
    /// @param tokenId The NFT id
    /// @return The amount of royalties paid for the NFT
    function getPaidRoyalties(address tokenAddress, uint256 tokenId) external view returns (uint256);
}
```

All functions defined as view MAY be implemented as pure or view

Function `payRoyalties`  MAY be implemented as public or external

The event `RoyaltiesPaid` MUST be emitted when the payRoyalties function is called

The `supportsInterface` function MUST return true when called with `0x253b27b0`

## Rationale

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.

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.

For fetching creator on-chain data we will use [ERC-2981](./eip-2981.md), but any other on-chain method of getting the creator address is accepted.

## Backwards Compatibility

This ERC is not introducing any backward incompatibilities.

## Test Cases

Tests are included in [`ERC6786.test.js`](../assets/eip-6786/test/ERC6786.test.js).

To run them in terminal, you can use the following commands:

```
cd ../assets/eip-6786
npm install
npx hardhat test
```

## Reference Implementation

See [`ERC6786.sol`](../assets/eip-6786/contracts/ERC6786.sol).

## Security Considerations

There are no security considerations related directly to the implementation of this standard.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 27 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6786</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6786</guid>
      </item>
    
      <item>
        <title>Order Book DEX with Two Phase Withdrawal</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/order-book-dex-standard/13573</comments>
        
        <description>## Abstract

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&apos; trust issues with the exchange.

## Motivation

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.

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.

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&apos; funds.

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.

By introducing the two phase forced withdrawal function, we can protect users&apos; financial security while ensuring the security of the exchange&apos;s assets. In the first phase, the system will conduct a preliminary review of the user&apos;s withdrawal request to confirm the user&apos;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.

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.

## Specification

### Interfaces

The Order Book DEX Standard defines the following Interfaces:

#### `deposit`

`function deposit(address token, uint256 amount) external;`

The **deposit** function allows a user to deposit a specified amount of a particular token to the exchange. The *token* parameter specifies the address of the token contract, and the *amount* parameter specifies the amount of the token to be deposited.

#### `withdraw`

`function withdraw(address token, uint256 amount) external;`

The **withdraw** function allows a user to withdraw a specified amount of a particular token from the exchange. The *token* parameter specifies the address of the token contract, and the *amount* parameter specifies the amount of the token to be withdrawn.

#### `prepareForceWithdraw`

`function prepareForceWithdraw(address token, uint256 amount) external returns (uint256 requestID);`

The assets deposited by users will be stored in the exchange contract&apos;s account, and the exchange can achieve real-time 1:1 reserve proof. The **prepareForceWithdraw** 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&apos;s order status meets the expected criteria, and forcibly cancel the user&apos;s order and settle the trade to avoid malicious attacks by the user. This function takes the following parameters:

1. *token*: the address of the token to be withdrawn
2. *amount*: the amount of the token to be withdrawn

Since an account may initiate multiple two phase forced withdrawals in parallel, each forced withdrawal needs to return a unique *requestID*. The function returns a unique *requestID* that can be used to submit the forced withdrawal using the commitForceWithdraw function.

#### `commitForceWithdraw`

`function commitForceWithdraw(uint256 requestID) external;`

1. *requestID*: the request ID of the two phase Withdraw

The **commitForceWithdraw** function is used to execute a forced withdrawal operation after the conditions are met. The function takes a *requestID* parameter, which specifies the ID of the forced withdrawal request to be executed. The request must have been previously initiated using the prepareForceWithdraw function.

### Events

#### `PrepareForceWithdraw`

MUST trigger when user successful call to PrepareForceWithdraw.

`event PrepareForceWithdraw(address indexed user, address indexed tokenAddress, uint256 amount);`

## Rationale

The flow charts for two-phase withdrawal are shown below:

![](../assets/eip-6787/image1.png)

## Backwards Compatibility

No backward compatibility issues found.

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 27 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6787</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6787</guid>
      </item>
    
      <item>
        <title>ERC-721 Holding Time Tracking</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/draft-eip-erc721-holding-time-tracking/13605</comments>
        
        <description>## Abstract

This standard is an extension of [ERC-721](./eip-721.md). It adds an interface that tracks and describes the holding time of a Non-Fungible Token (NFT) by an account. 

## Motivation

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.

This proposal aims to address these limitations by extending the ERC-721 standard to include holding time tracking functionality.

## Specification

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.

**Interface**

The following interface extends the existing ERC-721 standard:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0

interface IERC6806 {
    function getHoldingInfo(
        uint256 tokenId
    ) external view returns (address holder, uint256 holdingTime);
}
```

**Functions**

### getHoldingInfo

```
function getHoldingInfo(uint256 tokenId) external view returns (address holder, uint256 holdingTime);
```

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.

* `tokenId`: The unique identifier of the NFT.
* Returns: A tuple containing the current holder&apos;s address and the holding time (in seconds).

## Rationale

The addition of the `getHoldingInfo` 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.

The `getHoldingInfo` 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.

`getHoldingInfo` returns both `holder` and `holdingTime` 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&apos;s holding time increases properly.

## Backwards Compatibility

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.

## Reference Implementation 

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

import &quot;@openzeppelin/contracts/access/Ownable.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;
import &quot;./IERC6806.sol&quot;;

contract ERC6806 is ERC721, Ownable, IERC6806 {
    mapping(uint256 =&gt; address) private _holder;
    mapping(uint256 =&gt; uint256) private _holdStart;
    mapping(address =&gt; bool) private _holdingTimeWhitelist;

    constructor(
        string memory name_,
        string memory symbol_
    ) ERC721(name_, symbol_) {}

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstotTokenId,
        uint256
    ) internal override {
        if (_holdingTimeWhitelist[from] || _holdingTimeWhitelist[to]) {
            return;
        }

        if (_holder[firstotTokenId] != to) {
            _holder[firstotTokenId] = to;
            _holdStart[firstotTokenId] = block.timestamp;
        }
    }

    function getHoldingInfo(
        uint256 tokenId
    ) public view returns (address holder, uint256 holdingTime) {
        return (_holder[tokenId], block.timestamp - _holdStart[tokenId]);
    }

    function setHoldingTimeWhitelistedAddress(
        address account,
        bool ignoreReset
    ) public onlyOwner {
        _holdingTimeWhitelist[account] = ignoreReset;
        emit HoldingTimeWhitelistSet(account, ignoreReset);
    }
}
```

## Security Considerations

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.

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.

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.

It is also important to note that the accuracy of holding time information depends on the accuracy of the underlying blockchain&apos;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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 30 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6806</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6806</guid>
      </item>
    
      <item>
        <title>Fungible Key Bound Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/fungible-key-bound-token-kbt/13624</comments>
        
        <description>## Abstract

A standard interface for Fungible Key Bound Tokens (**FKBT/s**), a subset of the more general Key Bound Tokens (**KBT/s**).

The following standardizes an API for tokens within smart contracts and provides basic functionality to the [addBindings](#addbindings-function) function. This function designates **Key Wallets**[^1], which are responsible for conducting a **Safe Transfer**[^2]. During this process, **FKBT&apos;s** are safely approved so they can be spent by the user or an on-chain third-party entity.

The premise of **FKBT&apos;s** is to provide fully optional security features built directly into the fungible asset, via the concept of _allow_ found in the [allowTransfer](#allowtransfer-function) and [allowApproval](#allowapproval-function) functions. These functions are called by one of the **Key Wallets**[^1] and _allow_ the **Holding Wallet**[^3] to either call the already familiar `transfer` and `approve` function found in [ERC-20](./eip-20.md). Responsibility for the **FKBT** is therefore split. The **Holding Wallet** contains the asset and **Key Wallets** have authority over how the assets can be spent or approved. **Default Behaviors**[^4] of a traditional fungible ERC-20 can be achieved by simply never using the [addBindings](#addbindings-function) function.

We considered **FKBTs** being used by every individual who wishes to add additional security to their fungible assets, as well as consignment to third-party wallets/brokers/banks/insurers. **FKBTs** are resilient to attacks/thefts, by providing additional protection to the asset itself on a self-custodial level.

## Motivation

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.

From January 2021 through March 2022, the United States Federal Trade Commission received more than 46,000[^5] crypto scam reports. This directly impacted crypto users and resulted in a net consumer loss exceeding $1 Billion[^6]. 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.

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 **KBT&apos;s**. 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.

**FKBTs** 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. **FKBTs** provide a scalable decentralized security solution that takes security one step beyond wallet security, focusing on the token&apos;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, **FKBTs** inherit all the characteristics of an ERC-20. This was done so **FKBTs** could be used on every dApp that is configured to use traditional fungible tokens.

During the development process, the potential advantages **KBT&apos;s** explored were the main motivation factors leading to their creation;

1. **Completely Decentralized:** 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.

2. **Limitless Scalability:** Centralized solutions require the creation of an account and their availability may be restricted based on location. **FKBT&apos;s** 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. **FKBT&apos;s** can be used anywhere around the world by anyone who so wishes, provided they have access to the internet.

3. **Fully Optional Security:** 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 **FKBT&apos;s**.

4. **Default Functionality:** If the user would like to use **FKBT&apos;s** 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 **Default Behaviors**[^4]. 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 **Default Values**[^7] manually or through a dApp.

5. **Unmatched Security:** By calling the [addBindings](#addbindings-function) function a **Key Wallet**[^1] is now required for the [allowTransfer](#allowtransfer-function) or [allowApproval](#allowapproval-function) function. The [allowTransfer](#allowtransfer-function) function requires 4 parameters, `_amount`[^8], `_time`[^9], `_address`[^10], and `_allFunds`[^11], where as the [allowApproval](#allowapproval-function) function has 2 parameters, `_time`[^12] and `_numberOfTransfers`[^13]. In addition to this, **FKBT&apos;s** have a [safeFallback](#safefallback-function) and [resetBindings](#resetbindings-function) 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.

6. **Security Fail-Safes:** With **FKBTs**, users can be confident that their tokens are safe and secure, even if the **Holding Wallet**[^3] or one of the **Key Wallets**[^1] has been compromised. If the owner suspects that the **Holding Wallet** has been compromised or lost access, they can call the [safeFallback](#safefallback-function) function from one of the **Key Wallets**. This moves the assets to the other **Key Wallet** preventing a single point of failure. If the owner suspects that one of the **Key Wallets** has been comprised or lost access, the owner can call the [resetBindings](#resetbindings-function) function from `_keyWallet1`[^15] or `_keyWallet2`[^16]. This resets the **FKBT&apos;s** security feature and allows the **Holding Wallet** to call the [addBindings](#addbindings-function) function again. New **Key Wallets** can therefore be added and a single point of failure can be prevented.

7. **Anonymous Security:** 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. **FKBT&apos;s** ensure user confidentially as everything can be done remotely under a pseudonym on the blockchain.

8. **Low-Cost Security:** The cost of using **FKBT&apos;s** security features correlate to on-chain fees, the current _GWEI_ at the given time. As a standalone solution, they are a viable cost-effective security measure feasible to the majority of the population.

9. **Environmentally Friendly:** Since the security features are coded into the **FKBT**, there is no need for centralized servers, shipping, or the production of physical object/s. Thus leading to a minimal carbon footprint by the use of **FKBT&apos;s**, working hand in hand with Ethereum’s change to a _PoS_[^14] network.

10. **User Experience:** The security feature can be activated by a simple call to the [addBindings](#addbindings-function) function. The user will only need two other wallets, which will act as `_keyWallet1`[^15] and `_keyWallet2`[^16], to gain access to all of the benefits **FKBT&apos;s** 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.

## Specification

### `IKBT20` (Token Contract)

**NOTES**:

- The following specifications use syntax from Solidity `0.8.0` (or above)
- Callers MUST handle `false` from `returns (bool success)`. Callers MUST NOT assume that `false` is never returned!

```solidity
interface IKBT20 {
    event AccountSecured(address _account, uint256 _amount);
    event AccountResetBinding(address _account);
    event SafeFallbackActivated(address _account);
    event AccountEnabledTransfer(
        address _account,
        uint256 _amount,
        uint256 _time,
        address _to,
        bool _allFunds
    );
    event AccountEnabledApproval(
        address _account,
        uint256 _time,
        uint256 _numberOfTransfers
    );
    event Ingress(address _account, uint256 _amount);
    event Egress(address _account, uint256 _amount);

    struct AccountHolderBindings {
        address firstWallet;
        address secondWallet;
    }

    struct FirstAccountBindings {
        address accountHolderWallet;
        address secondWallet;
    }

    struct SecondAccountBindings {
        address accountHolderWallet;
        address firstWallet;
    }

    struct TransferConditions {
        uint256 amount;
        uint256 time;
        address to;
        bool allFunds;
    }

    struct ApprovalConditions {
        uint256 time;
        uint256 numberOfTransfers;
    }

    function addBindings(
        address _keyWallet1,
        address _keyWallet2
    ) external returns (bool);

    function getBindings(
        address _account
    ) external view returns (AccountHolderBindings memory);

    function resetBindings() external returns (bool);

    function safeFallback() external returns (bool);

    function allowTransfer(
        uint256 _amount,
        uint256 _time,
        address _to,
        bool _allFunds
    ) external returns (bool);

    function getTransferableFunds(
        address _account
    ) external view returns (TransferConditions memory);

    function allowApproval(
        uint256 _time,
        uint256 _numberOfTransfers
    ) external returns (bool);

    function getApprovalConditions(
        address account
    ) external view returns (ApprovalConditions memory);

    function getNumberOfTransfersAllowed(
        address _account,
        address _spender
    ) external view returns (uint256);

    function isSecureWallet(address _account) external view returns (bool);
}
```


### Events

#### `AccountSecured` event

Emitted when the `_account` is securing his account by calling the `addBindings` function.

`_amount` is the current balance of the `_account`.

```solidity
event AccountSecured(address _account, uint256 _amount)
```

#### `AccountResetBinding` event

Emitted when the holder is resetting his `keyWallets` by calling the `resetBindings` function.

```solidity
event AccountResetBinding(address _account)
```

#### `SafeFallbackActivated` event

Emitted when the holder is choosing to move all the funds to one of the `keyWallets` by calling the `safeFallback` function.

```solidity
event SafeFallbackActivated(address _account)
```

#### `AccountEnabledTransfer` event

Emitted when the `_account` has allowed for transfer an `_amount` of tokens for the `_time` amount of `block` seconds for `_to` address (or if
the `_account` has allowed for transfer all funds though `_allFunds` set to `true`) by calling the `allowTransfer` function.

```solidity
event AccountEnabledTransfer(address _account, uint256 _amount, uint256 _time, address _to, bool _allFunds)
```

#### `AccountEnabledApproval` event

Emitted when `_account` has allowed approval, for the `_time` amount of `block` seconds and set a `_numberOfTransfers` allowed, by calling the `allowApproval` function.

```solidity
event AccountEnabledApproval(address _account, uint256 _time, uint256 _numberOfTransfers)
```

#### `Ingress` event

Emitted when `_account` becomes a holder. `_amount` is the current balance of the `_account`.

```solidity
event Ingress(address _account, uint256 _amount)
```

#### `Egress` event

Emitted when `_account` transfers all his tokens and is no longer a holder. `_amount` is the previous balance of the `_account`.

```solidity
event Egress(address _account, uint256 _amount)
```


### **Interface functions**

The functions detailed below MUST be implemented.

#### `addBindings` function

Secures the sender account with other two wallets called `_keyWallet1` and `_keyWallet2` and MUST fire the `AccountSecured` event.

The function SHOULD `revert` if:

- the sender account is not a holder
- or the sender is already secured
- or the keyWallets are the same
- or one of the keyWallets is the same as the sender
- or one or both keyWallets are zero address (`0x0`)
- or one or both keyWallets are already keyWallets to another holder account

```solidity
function addBindings (address _keyWallet1, address _keyWallet2) external returns (bool)
```

#### `getBindings` function

The function returns the `keyWallets` for the `_account` in a `struct` format.

```solidity
struct AccountHolderBindings {
    address firstWallet;
    address secondWallet;
}
```

```solidity
function getBindings(address _account) external view returns (AccountHolderBindings memory)
```

#### `resetBindings` function

**Note:** This function is helpful when one of the two `keyWallets` is compromised.

Called from a `keyWallet`, the function resets the `keyWallets` for the `holder` account. MUST fire the `AccountResetBinding` event.

The function SHOULD `revert` if the sender is not a `keyWallet`.

```solidity
function resetBindings() external returns (bool)
```

#### `safeFallback` function

**Note:** This function is helpful when the `holder` account is compromised.

Called from a `keyWallet`, this function transfers all the tokens from the `holder` account to the other `keyWallet` and MUST fire the `SafeFallbackActivated` event.

The function SHOULD `revert` if the sender is not a `keyWallet`.

```solidity
function safeFallback() external returns (bool);
```

#### `allowTransfer` function

Called from a `keyWallet`, this function is called before a `transfer` function is called.

It allows to transfer a maximum amount, for a specific time frame, to a specific address.

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 `_allFunds` is `true`, regardless of the other params, it allows all funds, whenever, to anyone to be transferred.

The function MUST fire `AccountEnabledTransfer` event.

The function SHOULD `revert` if the sender is not a `keyWallet` or if the `_amount` is greater than the `holder` account balance.

```solidity
function allowTransfer(uint256 _amount, uint256 _time, address _to, bool _allFunds) external returns (bool);
```

#### `getTransferableFunds` function

The function returns the transfer conditions for the `_account` in a `struct` format.

```solidity
struct TransferConditions {
    uint256 amount;
    uint256 time;
    address to;
    bool allFunds;
}
```

```solidity
function getTransferableFunds(address _account) external view returns (TransferConditions memory);
```

#### `allowApproval` function

Called from a `keyWallet`, this function is called before one of the `approve`, `increaseAllowance` or `decreaseAllowance` function are called.

It allows the `holder` for a specific amount of `_time` to do an `approve`, `increaseAllowance` or `decreaseAllowance` and limit the number of transfers the spender is allowed to do through `_numberOfTransfers` (0 - unlimited number of transfers in the allowance limit).

The function MUST fire `AccountEnabledApproval` event.

The function SHOULD `revert` if the sender is not a `keyWallet`.

```solidity
function allowApproval(uint256 _time, uint256 _numberOfTransfers) external returns (bool)
```

#### `getApprovalConditions` function

The function returns the approval conditions in a struct format. Where `time` is the `block.timestamp` until the `approve`, `increaseAllowance` or `decreaseAllowance` functions can be called, and `numberOfTransfers` is the number of transfers the spender will be allowed.

```solidity
struct ApprovalConditions {
    uint256 time;
    uint256 numberOfTransfers;
}
```

```solidity
function getApprovalConditions(address _account) external view returns (ApprovalConditions memory);
```

#### `transfer` function

The function transfers `_amount` of tokens to address `_to`.

The function MUST fire the `Transfer` event.

The function SHOULD `revert` 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 `allowTransfer` function.

**Note:** Transfers of `0` values MUST be treated as normal transfers and fire the `Transfer` event.

```solidity
function transfer(address _to, uint256 _amount) external returns (bool)
```

#### `approve` function

The function allows `_spender` to transfer from the `holder` account multiple times, up to the `_value` amount.

The function also limits the `_spender` to the specific number of transfers set in the `ApprovalConditions` for that `holder` account. If the value is `0` then the `_spender` can transfer multiple times, up to the `_value` amount.

The function MUST fire an `Approval` event.

If this function is called again it overrides the current allowance with `_value` and also overrides the number of transfers allowed with `_numberOfTransfers`, set in `allowApproval` function.

The function SHOULD `revert` if:

- the sender account is secured and has not called `allowApproval` function
- or if the `_time`, set in the `allowApproval` function, has elapsed.

```solidity
function approve(address _spender, uint256 _amount) external returns (bool)
```

#### `increaseAllowance` function

The function increases the allowance granted to `_spender` to withdraw from your account.

The function Emits an `Approval` event indicating the updated allowance.

The function SHOULD `revert` if:

- the sender account is secured and has not called `allowApproval` function
- or if the `_spender` is a zero address (`0x0`)
- or if the `_time`, set in the `allowApproval` function, has elapsed.

```solidity
function increaseAllowance(address _spender, uint256 _addedValue) external returns (bool)
```

#### `decreaseAllowance` function

The function decreases the allowance granted to `_spender` to withdraw from your account.

The function Emits an `Approval` event indicating the updated allowance.

The function SHOULD `revert` if:

- the sender account is secured and has not called `allowApproval` function
- or if the `_spender` is a zero address (`0x0`)
- or if the `_time`, set in the `allowApproval` function, has elapsed.
- or if the `_subtractedValue` is greater than the current allowance

```solidity
function decreaseAllowance(address _spender, uint256 _subtractedValue) external returns (bool)
```

#### `transferFrom` function

The function transfers `_amount` of tokens from address `_from` to address `_to`.

The function MUST fire the `Transfer` event.

The `transferFrom` method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf.
The function SHOULD `revert` unless the `_from` 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.

**Note:** Transfers of 0 values MUST be treated as normal transfers and fire the `Transfer` event.

```solidity
function transferFrom(address _from, address _to, uint256 _amount) external returns (bool)
```

## Rationale

The intent from individual technical decisions made during the development of **FKBTs** 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 **FKBT&apos;s** 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 **FKBTs** to act with **Default Behaviors**[^4]. We wanted to ensure that wide-scale implementation and adoption of **FKBTs** could take place immediately, without the greater collective needing to adapt and make changes to the already flourishing decentralized ecosystem.

For developers and users alike, the [allowTransfer](#allowtransfer-function) and [allowApproval](#allowapproval-function) 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 [Security Considerations](#security-considerations) section.

## Backwards Compatibility

**KBT&apos;s** 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 **FKBT&apos;s**.

## Test Cases

The [assets](../assets/eip-6808/README.md) directory has all the [tests](../assets/eip-6808/test/kbt20.js).

Average Gas used (_GWEI_):

- `addBindings` - 154,991
- `resetBindings` - 30,534
- `safeFallback` - 51,013
- `allowTransfer` - 49,887
- `allowApproval` - 44,971

## Reference Implementation

The implementation is located in the [assets](../assets/eip-6808/README.md) directory. There&apos;s also a [diagram](../assets/eip-6808/Contract%20Interactions%20diagram.svg) with the contract interactions.

## Security Considerations

**FKBT&apos;s** 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.

**Key Wallets**[^1]: When calling the [addBindings](#addbindings-function) function for an **FKBT**, the user must input 2 wallets that will then act as `_keyWallet1`[^15] and `_keyWallet2`[^16]. 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 [safeFallback](#safefallback-function) situation to occur. For this reason, all **KBT&apos;s** work under a 3-wallet system when security features are activated.

Typically if a wallet is compromised, the fungible assets within are at risk. With **FKBT&apos;s** there are two different functions that can be called from a **Key Wallet**[^1] depending on which wallet has been compromised.

Scenario: **Holding Wallet**[^3] has been compromised, call [safeFallback](#safefallback-function).

[safeFallback](#safefallback-function): This function was created in the event that the owner believes the **Holding Wallet**[^3] has been compromised. It can also be used if the owner losses access to the **Holding Wallet**. In this scenario, the user has the ability to call [safeFallback](#safefallback-function) from one of the **Key Wallets**[^1]. **FKBT&apos;s** are then redirected from the **Holding Wallet** to the other **Key Wallet**.

By redirecting the **FKBT&apos;s** it prevents a single point of failure. If an attacker were to call [safeFallback](#safefallback-function) and the **FKBT&apos;s** redirected to the **Key Wallet**[^1] that called the function, they would gain access to all the **FKBT&apos;s**.

Scenario: **Key Wallet**[^1] has been compromised, call [resetBindings](#resetbindings-function).

[resetBindings](#resetbindings-function): This function was created in the event that the owner believes `_keyWallet1`[^15] or `_keyWallet2`[^16] has been compromised. It can also be used if the owner losses access to one of the **Key Wallets**[^1]. In this instance, the user has the ability to call [resetBindings](#resetbindings-function), removing the bound **Key Wallets** and resetting the security features. The **FKBT&apos;s** will now function as a traditional ERC-20 until [addBindings](#addbindings-function) is called again and a new set of **Key Wallets** are added.

The reason why `_keyWallet1`[^15] or `_keyWallet2`[^16] are required to call the [resetBindings](#resetbindings-function) function is because a **Holding Wallet**[^3] having the ability to call [resetBindings](#resetbindings-function) could result in an immediate loss of **FKBT&apos;s**. The attacker would only need to gain access to the **Holding Wallet** and call [resetBindings](#resetbindings-function).

In the scenario that 2 of the 3 wallets have been compromised, there is nothing the owner of the **FKBT&apos;s** can do if the attack is malicious. However, by allowing 1 wallet to be compromised, holders of fungible tokens built using the **FKBT** standard are given a second chance, unlike other current standards.

The [allowTransfer](#allowtransfer-function) function is in place to guarantee a **Safe Transfer**[^2], but can also have **Default Values**[^7] set by a dApp to emulate **Default Behaviors**[^3] 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 **FKBT&apos;s** to anyone for an unlimited amount of time. The desired security is completely up to the user.

This function requires 4 parameters to be filled and different combinations of these result in different levels of security;

Parameter 1 `_amount`[^8]: This is the number of **FKBT&apos;s** that will be spent on a transfer.

Parameter 2 `_time`[^9]: The number of blocks the **FKBT&apos;s** can be transferred starting from the current block timestamp.

Parameter 3 `_address`[^10]: The destination the **FKBT&apos;s** will be sent to.

Parameter 4 `_allFunds`[^11]: This is a boolean value. When false, the `transfer` function takes into consideration Parameters 1, 2 and 3. If the value is true, the `transfer` function will revert to a **Default Behavior**[^4], the same as a traditional ERC-20.

The [allowTransfer](#allowtransfer-function) function requires `_keyWallet1`[^15] or `_keyWallet2`[^16] and enables the **Holding Wallet**[^3] to conduct a `transfer` within the previously specified parameters. These parameters were added in order to provide additional security by limiting the **Holding Wallet** in case it was compromised without the user&apos;s knowledge.

The [allowApproval](#allowapproval-function) function provides extra security when allowing on-chain third parties to use your **FKBT&apos;s** on your behalf. This is especially useful when a user is met with common malicious attacks e.g. draining dApp.

This function requires 2 parameters to be filled and different combinations of these result in different levels of security;

Parameter 1 `_time`[^12]: The number of blocks that the approval of a third-party service can take place, starting from the current block timestamp.

Parameter 2 `_numberOfTransfers_`[^13]: The number of transactions a third-party service can conduct on the user&apos;s behalf.

The [allowApproval](#allowapproval-function) function requires `_keyWallet1`[^15] or `_keyWallet2`[^16] and enables the **Holding Wallet**[^3] to allow a third-party service by using the `approve` function. These parameters were added to provide extra security when granting permission to a third-party that uses assets on the user&apos;s behalf. Parameter 1, `_time`[^12], is a limitation to when the **Holding Wallet** can `approve` a third-party service. Parameter 2, `_numberOfTransfers`[^13], is a limitation to the number of transactions the approved third-party service can conduct on the user&apos;s behalf before revoking approval.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).


[^1]: The **Key Wallet/s** refers to `_keyWallet1` or `_keyWallet2` which can call the `safeFallback`, `resetBindings`, `allowTransfer` and `allowApproval` functions.
[^2]: A **Safe Transfer** is when 1 of the **Key Wallets** safely approved the use of the **FKBT&apos;s**.
[^3]: The **Holding Wallet** refers to the wallet containing the **FKBT&apos;s**.
[^4]: A **Default Behavior/s** refers to behavior/s present in the preexisting non-fungible ERC-20 standard.
[^5]: The number of crypto scam reports the United States Federal Trade Commission received, from January 2021 through March 2022.
[^6]: The amount stolen via crypto scams according to the United States Federal Trade Commission, from January 2021 through March 2022.
[^7]: A **Default Value/s** refer to a value/s that emulates the non-fungible ERC-20 **Default Behavior/s**.
[^8]: The `_amount` represents the amount of the **FKBT&apos;s** intended to be spent.
[^9]: The `_time` in `allowTransfer` represents the number of blocks a `transfer` can take place in.
[^10]: The `_address` represents the address that the **FKBT&apos;s** will be sent to.
[^11]: The `_allFunds` is a bool that can be set to true or false.
[^12]: The `_time` in `allowApproval` represents the number of blocks an `approve` can take place in.
[^13]: The `_numberOfTransfers` is the number of transfers a third-party entity can conduct via `transfer` on the user&apos;s behalf.
[^14]: A _PoS_ protocol, Proof-of-Stake protocol, is a cryptocurrency consensus mechanism for processing transactions and creating new blocks in a blockchain.
[^15]: The `_keyWallet1` is 1 of the 2 **Key Wallets** set when calling the `addBindings` function.
[^16]: The `_keyWallet2` is 1 of the 2 **Key Wallets** set when calling the `addBindings` function.
</description>
        <pubDate>Fri, 31 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6808</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6808</guid>
      </item>
    
      <item>
        <title>Non-Fungible Key Bound Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/non-fungible-key-bound-token-kbt/13625</comments>
        
        <description>## Abstract

A standard interface for Non-Fungible Key Bound Tokens (**NFKBT/s**), a subset of the more general Key Bound Tokens (**KBT/s**).

The following standardizes an API for tokens within smart contracts and provides basic functionality to the [addBindings](#addbindings-function) function. This function designates **Key Wallets**[^1], which are responsible for conducting a **Safe Transfer**[^2]. During this process, **NFKBT&apos;s** are safely approved so they can be spent by the user or an on-chain third-party entity.

The premise of **NFKBT&apos;s** is to provide fully optional security features built directly into the non-fungible asset, via the concept of _allow_ found in the [allowTransfer](#allowtransfer-function) and [allowApproval](#allowapproval-function) functions. These functions are called by one of the **Key Wallets**[^1] and _allow_ the **Holding Wallet**[^3] to either call the already familiar `transferFrom` and `approve` function found in [ERC-721](./eip-721.md). Responsibility for the **NFKBT** is therefore split. The **Holding Wallet** contains the asset and **Key Wallets** have authority over how the assets can be spent or approved. **Default Behaviors**[^4] of a traditional non-fungible ERC-721 can be achieved by simply never using the [addBindings](#addbindings-function) function.

We considered **NFKBTs** being used by every individual who wishes to add additional security to their non-fungible assets, as well as consignment to third-party wallets/brokers/banks/insurers/galleries. **NFKBTs** are resilient to attacks/thefts, by providing additional protection to the asset itself on a self-custodial level.

## Motivation

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.

From January 2021 through March 2022, the United States Federal Trade Commission received more than 46,000[^5] crypto scam reports. This directly impacted crypto users and resulted in a net consumer loss exceeding $1 Billion[^6]. 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.

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 **KBT&apos;s**. 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.

**NFKBTs** 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. **NFKBTs** provide a scalable decentralized security solution that takes security one step beyond wallet security, focusing on the token&apos;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, **NFKBTs** inherit all the characteristics of an ERC-721. This was done so **NFKBTs** could be used on every dApp that is configured to use traditional non-fungible tokens.

During the development process, the potential advantages **KBT&apos;s** explored were the main motivation factors leading to their creation;

1. **Completely Decentralized:** 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.

2. **Limitless Scalability:** Centralized solutions require the creation of an account and their availability may be restricted based on location. **NFKBT&apos;s** 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. **NFKBT&apos;s** can be used anywhere around the world by anyone who so wishes, provided they have access to the internet.

3. **Fully Optional Security:** 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 **NFKBT&apos;s**.

4. **Default Functionality:** If the user would like to use **NFKBT&apos;s** 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 **Default Behaviors**[^4]. 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 **Default Values**[^7] manually or through a dApp.

5. **Unmatched Security:** By calling the [addBindings](#addbindings-function) function a **Key Wallet**[^1] is now required for the [allowTransfer](#allowtransfer-function) or [allowApproval](#allowapproval-function) function. The [allowTransfer](#allowtransfer-function) function requires 4 parameters, `_tokenId`[^8], `_time`[^9], `_address`[^10], and `_anyToken`[^11], where as the [allowApproval](#allowapproval-function) function has 2 parameters, `_time`[^12] and `_numberOfTransfers`[^13]. In addition to this, **NFKBT&apos;s** have a [safeFallback](#safefallback-function) and [resetBindings](#resetbindings-function) 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.

6. **Security Fail-Safes:** With **NFKBTs**, users can be confident that their tokens are safe and secure, even if the **Holding Wallet**[^3] or one of the **Key Wallets**[^1] has been compromised. If the owner suspects that the **Holding Wallet** has been compromised or lost access, they can call the [safeFallback](#safefallback-function) function from one of the **Key Wallets**. This moves the assets to the other **Key Wallet** preventing a single point of failure. If the owner suspects that one of the **Key Wallets** has been comprised or lost access, the owner can call the [resetBindings](#resetbindings-function) function from `_keyWallet1`[^15] or `_keyWallet2`[^16]. This resets the **NFKBT&apos;s** security feature and allows the **Holding Wallet** to call the [addBindings](#addbindings-function) function again. New **Key Wallets** can therefore be added and a single point of failure can be prevented.

7. **Anonymous Security:** 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. **NFKBT&apos;s** ensure user confidentially as everything can be done remotely under a pseudonym on the blockchain.

8. **Low-Cost Security:** The cost of using **NFKBT&apos;s** security features correlate to on-chain fees, the current _GWEI_ at the given time. As a standalone solution, they are a viable cost-effective security measure feasible to the majority of the population.

9. **Environmentally Friendly:** Since the security features are coded into the **NFKBT**, there is no need for centralized servers, shipping, or the production of physical object/s. Thus leading to a minimal carbon footprint by the use of **NFKBT&apos;s**, working hand in hand with Ethereum’s change to a _PoS_[^14] network.

10. **User Experience:** The security feature can be activated by a simple call to the [addBindings](#addbindings-function) function. The user will only need two other wallets, which will act as `_keyWallet1`[^15] and `_keyWallet2`[^16], to gain access to all of the benefits **NFKBT&apos;s** 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.

## Specification

### `IKBT721` (Token Contract)

**NOTES**:

- The following specifications use syntax from Solidity `0.8.17` (or above)
- Callers MUST handle `false` from `returns (bool success)`. Callers MUST NOT assume that `false` is never returned!

```solidity
interface IKBT721 {
    event AccountSecured(address indexed _account, uint256 _noOfTokens);
    event AccountResetBinding(address indexed _account);
    event SafeFallbackActivated(address indexed _account);
    event AccountEnabledTransfer(
        address _account,
        uint256 _tokenId,
        uint256 _time,
        address _to,
        bool _anyToken
    );
    event AccountEnabledApproval(
        address _account,
        uint256 _time,
        uint256 _numberOfTransfers
    );
    event Ingress(address _account, uint256 _tokenId);
    event Egress(address _account, uint256 _tokenId);

    struct AccountHolderBindings {
        address firstWallet;
        address secondWallet;
    }

    struct FirstAccountBindings {
        address accountHolderWallet;
        address secondWallet;
    }

    struct SecondAccountBindings {
        address accountHolderWallet;
        address firstWallet;
    }

    struct TransferConditions {
        uint256 tokenId;
        uint256 time;
        address to;
        bool anyToken;
    }

    struct ApprovalConditions {
        uint256 time;
        uint256 numberOfTransfers;
    }

    function addBindings(
        address _keyWallet1,
        address _keyWallet2
    ) external returns (bool);

    function getBindings(
        address _account
    ) external view returns (AccountHolderBindings memory);

    function resetBindings() external returns (bool);

    function safeFallback() external returns (bool);

    function allowTransfer(
        uint256 _tokenId,
        uint256 _time,
        address _to,
        bool _allTokens
    ) external returns (bool);

    function getTransferableFunds(
        address _account
    ) external view returns (TransferConditions memory);

    function allowApproval(
        uint256 _time,
        uint256 _numberOfTransfers
    ) external returns (bool);

    function getApprovalConditions(
        address account
    ) external view returns (ApprovalConditions memory);

    function getNumberOfTransfersAllowed(
        address _account,
        address _spender
    ) external view returns (uint256);

    function isSecureWallet(address _account) external returns (bool);

    function isSecureToken(uint256 _tokenId) external returns (bool);
}
```


### Events

#### `AccountSecured` event

Emitted when the `_account` is securing his account by calling the `addBindings` function.

`_amount` is the current balance of the `_account`.

```solidity
event AccountSecured(address _account, uint256 _amount)
```

#### `AccountResetBinding` event

Emitted when the holder is resetting his `keyWallets` by calling the `resetBindings` function.

```solidity
event AccountResetBinding(address _account)
```

#### `SafeFallbackActivated` event

Emitted when the holder is choosing to move all the funds to one of the `keyWallets` by calling the `safeFallback` function.

```solidity
event SafeFallbackActivated(address _account)
```

#### `AccountEnabledTransfer` event

Emitted when the `_account` has allowed for transfer `_amount` of tokens for the `_time` amount of `block` seconds for `_to` address (or if
the `_account` has allowed for transfer all funds though `_anyToken` set to `true`) by calling the `allowTransfer` function.

```solidity
event AccountEnabledTransfer(address _account, uint256 _amount, uint256 _time, address _to, bool _allFunds)
```

#### `AccountEnabledApproval` event

Emitted when `_account` has allowed approval for the `_time` amount of `block` seconds by calling the `allowApproval` function.

```solidity
event AccountEnabledApproval(address _account, uint256 _time)
```

#### `Ingress` event

Emitted when `_account` becomes a holder. `_amount` is the current balance of the `_account`.

```solidity
event Ingress(address _account, uint256 _amount)
```

#### `Egress` event

Emitted when `_account` transfers all his tokens and is no longer a holder. `_amount` is the previous balance of the `_account`.

```solidity
event Egress(address _account, uint256 _amount)
```

### **Interface functions**

The functions detailed below MUST be implemented.

#### `addBindings` function

Secures the sender account with other two wallets called `_keyWallet1` and `_keyWallet2` and MUST fire the `AccountSecured` event.

The function SHOULD `revert` if:

- the sender account is not a holder
- or the sender is already secured
- or the keyWallets are the same
- or one of the keyWallets is the same as the sender
- or one or both keyWallets are zero address (`0x0`)
- or one or both keyWallets are already keyWallets to another holder account

```solidity
function addBindings (address _keyWallet1, address _keyWallet2) external returns (bool)
```

#### `getBindings` function

The function returns the `keyWallets` for the `_account` in a `struct` format.

```solidity
struct AccountHolderBindings {
    address firstWallet;
    address secondWallet;
}
```

```solidity
function getBindings(address _account) external view returns (AccountHolderBindings memory)
```

#### `resetBindings` function

**Note:** This function is helpful when one of the two `keyWallets` is compromised.

Called from a `keyWallet`, the function resets the `keyWallets` for the `holder` account. MUST fire the `AccountResetBinding` event.

The function SHOULD `revert` if the sender is not a `keyWallet`.

```solidity
function resetBindings() external returns (bool)
```

#### `safeFallback` function

**Note:** This function is helpful when the `holder` account is compromised.

Called from a `keyWallet`, this function transfers all the tokens from the `holder` account to the other `keyWallet` and MUST fire the `SafeFallbackActivated` event.

The function SHOULD `revert` if the sender is not a `keyWallet`.

```solidity
function safeFallback() external returns (bool);
```

#### `allowTransfer` function

Called from a `keyWallet`, this function is called before a `transferFrom` or `safeTransferFrom` functions are called.

It allows to transfer a tokenId, for a specific time frame, to a specific address.

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 `_anyToken` is `true`, regardless of the other params, it allows any token, whenever, to anyone to be transferred of the holder.

The function MUST fire `AccountEnabledTransfer` event.

The function SHOULD `revert` if the sender is not a `keyWallet` for a holder or if the owner of the `_tokenId` is different than the `holder`.

```solidity
function allowTransfer(uint256 _tokenId, uint256 _time, address _to, bool _anyToken) external returns (bool);
```

#### `getTransferableFunds` function

The function returns the transfer conditions for the `_account` in a `struct` format.

```solidity
struct TransferConditions {
    uint256 tokenId;
    uint256 time;
    address to;
    bool anyToken;
}
```

```solidity
function getTransferableFunds(address _account) external view returns (TransferConditions memory);
```

#### `allowApproval` function

Called from a `keyWallet`, this function is called before `approve` or `setApprovalForAll` functions are called.

It allows the `holder` for a specific amount of `_time` to do an `approve` or `setApprovalForAll` and limit the number of transfers the spender is allowed to do through `_numberOfTransfers` (0 - unlimited number of transfers in the allowance limit).

The function MUST fire `AccountEnabledApproval` event.

The function SHOULD `revert` if the sender is not a `keyWallet`.

```solidity
function allowApproval(uint256 _time) external returns (bool)
```

#### `getApprovalConditions` function

The function returns the approval conditions in a struct format. Where `time` is the `block.timestamp` until the `approve` or `setApprovalForAll` functions can be called, and `numberOfTransfers` is the number of transfers the spender will be allowed.

```solidity
struct ApprovalConditions {
    uint256 time;
    uint256 numberOfTransfers;
}
```

```solidity
function getApprovalConditions(address _account) external view returns (ApprovalConditions memory);
```

#### `transferFrom` function

The function transfers from `_from` address to `_to` address the `_tokenId` token.

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 `false`.

The function MUST fire the `Transfer` event.

The function SHOULD `revert` if:

- the sender is not the owner or is not approved to transfer the `_tokenId`
- or if the `_from` address is not the owner of the `_tokenId`
- or if the sender is a secure account and it has not allowed for transfer this `_tokenId` through `allowTransfer` function.

```solidity
function transferFrom(address _from, address _to, uint256 _tokenId) external returns (bool)
```

#### `safeTransferFrom` function

The function transfers from `_from` address to `_to` address the `_tokenId` token.

The function MUST fire the `Transfer` event.

The function SHOULD `revert` if:

- the sender is not the owner or is not approved to transfer the `_tokenId`
- or if the `_from` address is not the owner of the `_tokenId`
- or if the sender is a secure account and it has not allowed for transfer this `_tokenId` through `allowTransfer` function.

```solidity
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory data) external returns (bool)
```

#### `safeTransferFrom` function, with data parameter

This works identically to the other function with an extra data parameter, except this function just sets data to &quot;&quot;.

```solidity
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external returns (bool)
```

#### `approve` function

The function allows `_to` account to transfer the `_tokenId` from the sender account.

The function also limits the `_to` account to the specific number of transfers set in the `ApprovalConditions` for that `holder` account. If the value is `0` then the `_spender` can transfer multiple times.

The function MUST fire an `Approval` event.

If the function is called again it overrides the number of transfers allowed with `_numberOfTransfers`, set in `allowApproval` function.

The function SHOULD `revert` if:

- the sender is not the current NFT owner, or an authorized operator of the current owner
- the NFT owner is secured and has not called `allowApproval` function
- or if the `_time`, set in the `allowApproval` function, has elapsed.

```solidity
function approve(address _to, uint256 _tokenId) public virtual override(ERC721, IERC721)
```

#### `setApprovalForAll` function

The function enables or disables approval for another account `_operator` to manage all of sender assets.

The function also limits the `_to` account to the specific number of transfers set in the `ApprovalConditions` for that `holder` account. If the value is `0` then the `_spender` can transfer multiple times.

The function Emits an `Approval` event indicating the updated allowance.

If the function is called again it overrides the number of transfers allowed with `_numberOfTransfers`, set in `allowApproval` function.

The function SHOULD `revert` if:

- the sender account is secured and has not called `allowApproval` function
- or if the `_spender` is a zero address (`0x0`)
- or if the `_time`, set in the `allowApproval` function, has elapsed.

```solidity
function setApprovalForAll(address _operator, bool _approved) public virtual override(ERC721, IERC721)
```

## Rationale

The intent from individual technical decisions made during the development of **NFKBTs** 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 **NFKBT&apos;s** 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 **NFKBTs** to act with **Default Behaviors**[^4]. We wanted to ensure that wide-scale implementation and adoption of **NFKBTs** could take place immediately, without the greater collective needing to adapt and make changes to the already flourishing decentralized ecosystem.

For developers and users alike, the [allowTransfer](#allowtransfer-function) and [allowApproval](#allowapproval-function) 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 [Security Considerations](#security-considerations) section.

## Backwards Compatibility

**KBT&apos;s** 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 **NFKBT&apos;s**.

## Test Cases

The [assets](../assets/eip-6809/README.md) directory has all the [tests](../assets/eip-6809/test/kbt721.js).

Average Gas used (_GWEI_):

- `addBindings` - 155,096
- `resetBindings` - 30,588
- `safeFallback` - 72,221 (depending on how many NFTs the holder has)
- `allowTransfer` - 50,025
- `allowApproval` - 44,983

## Reference Implementation

The implementation is located in the [assets](../assets/eip-6809/README.md) directory. There&apos;s also a [diagram](../assets/eip-6809/Contract%20Interactions%20diagram.svg) with the contract interactions.

## Security Considerations

**NFKBT&apos;s** 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.

**Key Wallets**[^1]: When calling the [addBindings](#addbindings-function) function for an **NFKBT**, the user must input 2 wallets that will then act as `_keyWallet1`[^15] and `_keyWallet2`[^16]. 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 [safeFallback](#safefallback-function) situation to occur. For this reason, all **KBT&apos;s** work under a 3-wallet system when security features are activated.

Typically if a wallet is compromised, the non-fungible assets within are at risk. With **NFKBT&apos;s** there are two different functions that can be called from a **Key Wallet**[^1] depending on which wallet has been compromised.

Scenario: **Holding Wallet**[^3] has been compromised, call [safeFallback](#safefallback-function).

[safeFallback](#safefallback-function): This function was created in the event that the owner believes the **Holding Wallet**[^3] has been compromised. It can also be used if the owner losses access to the **Holding Wallet**. In this scenario, the user has the ability to call [safeFallback](#safefallback-function) from one of the **Key Wallets**[^1]. **NFKBT&apos;s** are then redirected from the **Holding Wallet** to the other **Key Wallet**.

By redirecting the **NFKBT&apos;s** it prevents a single point of failure. If an attacker were to call [safeFallback](#safefallback-function) and the **NFKBT&apos;s** redirected to the **Key Wallet**[^1] that called the function, they would gain access to all the **NFKBT&apos;s**.

Scenario: **Key Wallet**[^1] has been compromised, call [resetBindings](#resetbindings-function).

[resetBindings](#resetbindings-function): This function was created in the event that the owner believes `_keyWallet1`[^15] or `_keyWallet2`[^16] has been compromised. It can also be used if the owner losses access to one of the **Key Wallets**[^1]. In this instance, the user has the ability to call [resetBindings](#resetbindings-function), removing the bound **Key Wallets** and resetting the security features. The **NFKBT&apos;s** will now function as a traditional ERC-721 until [addBindings](#addbindings-function) is called again and a new set of **Key Wallets** are added.

The reason why `_keyWallet1`[^15] or `_keyWallet2`[^16] are required to call the [resetBindings](#resetbindings-function) function is because a **Holding Wallet**[^3] having the ability to call [resetBindings](#resetbindings-function) could result in an immediate loss of **NFKBT&apos;s**. The attacker would only need to gain access to the **Holding Wallet** and call [resetBindings](#resetbindings-function).

In the scenario that 2 of the 3 wallets have been compromised, there is nothing the owner of the **NFKBT&apos;s** can do if the attack is malicious. However, by allowing 1 wallet to be compromised, holders of non-fungible tokens built using the **NFKBT** standard are given a second chance, unlike other current standards.

The [allowTransfer](#allowtransfer-function) function is in place to guarantee a **Safe Transfer**[^2], but can also have **Default Values**[^7] set by a dApp to emulate **Default Behaviors**[^3] 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 **NFKBT&apos;s** to anyone for an unlimited amount of time. The desired security is completely up to the user.

This function requires 4 parameters to be filled and different combinations of these result in different levels of security;

Parameter 1 `_tokenId`[^8]: This is the ID of the **NFKBT** that will be spent on a transfer.

Parameter 2 `_time`[^9]: The number of blocks the **NFKBT** can be transferred starting from the current block timestamp.

Parameter 3 `_address`[^10]: The destination the **NFKBT** will be sent to.

Parameter 4 `_anyToken`[^11]: This is a boolean value. When false, the `transferFrom` function takes into consideration Parameters 1, 2 and 3. If the value is true, the `transferFrom` function will revert to a **Default Behavior**[^4], the same as a traditional ERC-721.

The [allowTransfer](#allowtransfer-function) function requires `_keyWallet1`[^15] or `_keyWallet2`[^16] and enables the **Holding Wallet**[^3] to conduct a `transferFrom` within the previously specified parameters. These parameters were added in order to provide additional security by limiting the **Holding Wallet** in case it was compromised without the user&apos;s knowledge.

The [allowApproval](#allowapproval-function) function provides extra security when allowing on-chain third parties to use your **NFKBT&apos;s** on your behalf. This is especially useful when a user is met with common malicious attacks e.g. draining dApp.

This function requires 2 parameters to be filled and different combinations of these result in different levels of security;

Parameter 1 `_time`[^12]: The number of blocks that the approval of a third-party service can take place, starting from the current block timestamp.

Parameter 2 `_numberOfTransfers_`[^13]: The number of transactions a third-party service can conduct on the user&apos;s behalf.

The [allowApproval](#allowapproval-function) function requires `_keyWallet1`[^15] or `_keyWallet2`[^16] and enables the **Holding Wallet**[^3] to allow a third-party service by using the `approve` function. These parameters were added to provide extra security when granting permission to a third-party that uses assets on the user&apos;s behalf. Parameter 1, `_time`[^12], is a limitation to when the **Holding Wallet** can `approve` a third-party service. Parameter 2, `_numberOfTransfers`[^13], is a limitation to the number of transactions the approved third-party service can conduct on the user&apos;s behalf before revoking approval.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).

[^1]: The **Key Wallet/s** refers to `_keyWallet1` or `_keyWallet2` which can call the `safeFallback`, `resetBindings`, `allowTransfer` and `allowApproval` functions.
[^2]: A **Safe Transfer** is when 1 of the **Key Wallets** safely approved the use of the **NFKBT&apos;s**.
[^3]: The **Holding Wallet** refers to the wallet containing the **NFKBT&apos;s**.
[^4]: A **Default Behavior/s** refers to behavior/s present in the preexisting non-fungible ERC-721 standard.
[^5]: The number of crypto scam reports the United States Federal Trade Commission received, from January 2021 through March 2022.
[^6]: The amount stolen via crypto scams according to the United States Federal Trade Commission, from January 2021 through March 2022.
[^7]: A **Default Value/s** refer to a value/s that emulates the non-fungible ERC-721 **Default Behavior/s**.
[^8]: The `_tokenId` represents the ID of the **NFKBT** intended to be spent.
[^9]: The `_time` in `allowTransfer` represents the number of blocks a `transferFrom` can take place in.
[^10]: The `_address` represents the address that the **NFKBT** will be sent to.
[^11]: The `_anyToken` is a bool that can be set to true or false.
[^12]: The `_time` in `allowApproval` represents the number of blocks an `approve` can take place in.
[^13]: The `_numberOfTransfers` is the number of transfers a third-party entity can conduct via `transferFrom` on the user&apos;s behalf.
[^14]: A _PoS_ protocol, Proof-of-Stake protocol, is a cryptocurrency consensus mechanism for processing transactions and creating new blocks in a blockchain.
[^15]: The `_keyWallet1` is 1 of the 2 **Key Wallets** set when calling the `addBindings` function.
[^16]: The `_keyWallet2` is 1 of the 2 **Key Wallets** set when calling the `addBindings` function.
</description>
        <pubDate>Fri, 31 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6809</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6809</guid>
      </item>
    
      <item>
        <title>Support ENS Name for Web3 URL</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6821-support-ens-name-for-web3-url/13654</comments>
        
        <description>## Abstract

This standard defines the mapping from an Ethereum name service (ENS) name to an Ethereum address for [ERC-4804](./eip-4804.md).

## Motivation

ERC-4804 defines a `web3://`-scheme RFC 2396 URI to call a smart contract either by its address or a **name** from name service.  If a **name** is specified, the standard specifies a way to resolve the contract address from the name.

## Specification

Given **contractName** and **chainid** from a `web3://` URI defined in ERC-4804, the protocol will find the address of the contract using the following steps:

1. Find the `contentcontract` text record on ENS resolver on chain **chainid**.  Return an error if the chain does not have ENS or the record is an invalid ETH address.
2. If the `contentcontract` text record does not exist, the protocol will use the resolved address of **name** from [ERC-137](./eip-137.md#contract-address-interface).
3. If the resolved address of **name** is the zero address, then return an &quot;address not found&quot; error.

Note that `contentcontract` text record may return an Ethereum address in hexadecimal with a `0x` prefix or an [ERC-3770](./eip-3770.md) chain-specific address.  If the address is an ERC-3770 chain-specific address, then the **chainid** to call the message will be overridden by the **chainid** specified by the ERC-3770 address.

## Rationale

The standard uses `contentcontract` text record with ERC-3770 chain-specific address instead of `contenthash` 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).

## Security Considerations

No security considerations were found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 02 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6821</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6821</guid>
      </item>
    
      <item>
        <title>Token Mapping Slot Retrieval Extension</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6823-token-mapping-slot-retrieval-extension/13666</comments>
        
        <description>## Abstract

The aim of this proposal is to enhance the precision of off-chain simulations for transactions that involve contracts complying with the [ERC-20](./eip-20.md), [ERC-721](./eip-721.md), or [ERC-1155](./eip-1155.md) 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.

## Motivation

To understand the rationale behind this proposal, it&apos;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.

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&apos;s position in the contract&apos;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.

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 `k` is determined by concatenating `h(k)` and `p` and performing a keccak-256 hash. The value of `p` 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&apos;t be determined in a universal way as you have to know how the implementation of the contract is done.

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.

This hurdle prevents external platforms and tools from capturing/validating changes made to the contract&apos;s state with certainty.

That&apos;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.

## Specification

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.

The proposal suggests an extension to the ERC-20/ERC-721/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.

The proposed extension is a single function that returns the reserved storage slot for the mapping type in any ERC-20/ERC-721/ERC-1155 compliant smart-contract implementation. The function is named `getTokenLocationRoot` and is declared as follows:

```solidity
abstract contract ERC20Extension is ERC20 {
    function getTokenLocationRoot() external pure virtual returns (bytes32 slot) {
        assembly {
            slot := &lt;mapping_name&gt;.slot
        }
    }
}

abstract contract ERC721Extension is ERC721 {
    function getTokenLocationRoot() external pure virtual returns (bytes32 slot) {
        assembly {
            slot := &lt;mapping_name&gt;.slot
        }
    }
}

abstract contract ERC1155Extension is ERC1155 {
    function getTokenLocationRoot() external pure virtual returns (bytes32 slot) {
        assembly {
            slot := &lt;mapping_name&gt;.slot
        }
    }
}
```

For these contracts, off-chain callers can use the `getTokenLocationRoot()` 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&apos;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&apos;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&apos;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.

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.

Contract implementers MUST implement the `getTokenLocationRoot()` 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 `external pure`.

## Rationale

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.

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.

## Backwards Compatibility

No backward compatibility issues have been found.

## Reference Implementation

```solidity
abstract contract ERC20Extension is ERC20 {
    function getTokenLocationRoot() external pure virtual returns (bytes32 slot) {
        assembly {
            slot := &lt;mapping_name&gt;.slot
        }
    }
}

abstract contract ERC721Extension is ERC721 {
    function getTokenLocationRoot() external pure virtual returns (bytes32 slot) {
        assembly {
            slot := &lt;mapping_name&gt;.slot
        }
    }
}

abstract contract ERC1155Extension is ERC1155 {
    function getTokenLocationRoot() external pure virtual returns (bytes32 slot) {
        assembly {
            slot := &lt;mapping_name&gt;.slot
        }
    }
```

## Security Considerations

No security issues are raised by the implementation of this extension.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 29 Mar 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6823</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6823</guid>
      </item>
    
      <item>
        <title>Web3 URL to EVM Call Message Translation</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-4804-web3-url-to-evm-call-message-translation/8300</comments>
        
        <description>## Abstract

This standard translates an [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) URI like `web3://uniswap.eth/` to an EVM message such as:

```
EVMMessage {
   To: 0xaabbccddee.... // where uniswap.eth&apos;s address registered at ENS
   Calldata: 0x
   ...
}
```

⚠️ This proposal updates [ERC-4804](./eip-4804.md) with minor corrections, clarifications and modifications.

## Motivation

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/node service provider/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/HTML.  Moreover, this standard enables interoperability with other standards already compatible with URIs, like SVG/HTML.

## Specification

This specification only defines read-only (i.e. Solidity&apos;s `view` functions) semantics. State modifying functions may be defined as a future extension.

This specification uses the Augmented Backus-Naur Form (ABNF) notation of [RFC 2234](https://www.rfc-editor.org/rfc/rfc2234). The complete URI syntax is listed in Appendix A.

A Web3 URL is an ASCII string in the following form :

```
web3URL         = schema &quot;://&quot; [ userinfo &quot;@&quot; ] contractName [ &quot;:&quot; chainid ] pathQuery [ &quot;#&quot; fragment ]
schema          = &quot;w3&quot; / &quot;web3&quot;
userinfo        = address
```

**userinfo** 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.

```
contractName    = address 
                / domainName
address         = &quot;0x&quot; 20( HEXDIG HEXDIG )
domainName      = *( unreserved / pct-encoded / sub-delims ) ; As in RFC 3986
```

**contractName** indicates the contract to be called, i.e., the &quot;To&quot; field in the EVM call message. If the **contractName** is an address then it will be used for the &quot;To&quot; field. Otherwise, **contractName** 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.

The way to resolve the domain name from a domain name service to an address is specified in [ERC-6821](./eip-6821.md) for the Ethereum Name service, and will be discussed in later ERCs for other name services. 

```
chainid         = %x31-39 *DIGIT
```

**chainid** indicates which chain to resolve **contractName** 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.

```
pathQuery       = mPathQuery ; path+query for manual mode
                / aPathQuery ; path+query for auto mode
```

**pathQuery**, made of the path and optional query, will have a different structure whether the resolve mode is &quot;manual&quot; or &quot;auto&quot;.

```
fragment        = *VCHAR
```

**fragment**, like in HTTP URLs, is a string of characters meant to refer to a resource, and is not transmitted to the smart contract.

```
web3UrlRef      = web3URL 
                / relativeWeb3URL
relativeWeb3URL = relPathQuery
relPathQuery    = relMPathQuery ; Relative URL path+query for manual mode
                / relAPathQuery ; Relative URL path+query for auto mode
```

Relative URLs are supported, but the support differs based on the resolve mode.


### Resolve Mode

Once the &quot;To&quot; address and chainid are determined, the protocol will check the resolver mode of contract by calling the `resolveMode` method of the &quot;To&quot; address. The Solidity signature of `resolveMode` is:

```solidity
function resolveMode() external returns (bytes32);
```

The protocol currently supports two resolve modes: auto and manual.

- The manual mode will be used if the `resolveMode` return value is `0x6d616e75616c0000000000000000000000000000000000000000000000000000`, i.e., &quot;manual&quot; in bytes32
- The auto mode will be used if :
    - the `resolveMode` return value is `0x6175746f00000000000000000000000000000000000000000000000000000000`, i.e, &quot;auto&quot; in bytes32, or
    - the `resolveMode` return value is `0x0000000000000000000000000000000000000000000000000000000000000000`, or
    - the call to `resolveMode` throws an error (method not implemented or error thrown from the method)
- Otherwise, the protocol will fail the request with the error &quot;unsupported resolve mode&quot;.

#### Manual Mode

```
mPathQuery      = mPath [ &quot;?&quot; mQuery ]

mPath           = mPathAbempty ; begins with &quot;/&quot; or is empty
mPathAbempty    = [ *( &quot;/&quot; segment ) &quot;/&quot; segment [ &quot;.&quot; fileExtension ] ]
segment         = *pchar ; as in RFC 3986
fileExtension   = 1*( ALPHA / DIGIT )

mQuery = *( pchar / &quot;/&quot; / &quot;?&quot; ) ; as in RFC 3986
```

The manual mode will use the raw **mPathQuery** as calldata of the message directly (no percent-encoding decoding will be done). If **mPathQuery** is empty, the sent calldata will be ``/`` (0x2f).

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 is ``text/html`` by default, but will be overridden if a **fileExtension**  is present. In this case, the MIME type will be deduced from the filename extension.

```
relMPathQuery   = relMPath [ &quot;?&quot; mQuery ]
relMPath        = mPathAbsolute ; begins with &quot;/&quot; but not &quot;//&quot;
                / mPathNoscheme ; begins with a non-colon segment
                / mPathEmpty    ; zero characters

mPathAbsolute   = &quot;/&quot; [ segmentNz *( &quot;/&quot; segment ) ] [ &quot;.&quot; fileExtension ]
mPathNoscheme   = segmentNzNc *( &quot;/&quot; segment ) [ &quot;.&quot; fileExtension ]
mPathEmpty      = 0&lt;pchar&gt;

segmentNz       = 1*pchar ; as in RFC 3986
segmentNzNc     = 1*( unreserved / pct-encoded / sub-delims / &quot;@&quot; )
                ; as in RFC 3986: non-zero-length segment without any colon &quot;:&quot;
```

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.

#### Auto Mode

```
aPathQuery      = aPath [ &quot;?&quot; aQuery ]
aPath           = [ &quot;/&quot; [ method *( &quot;/&quot; argument ) ] ]
```

In the auto mode, if **aPath** is empty or &quot;/&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.

```
method          = ( ALPHA / &quot;$&quot; / &quot;_&quot; ) *( ALPHA / DIGIT / &quot;$&quot; / &quot;_&quot; )
```

**method** is a string of the function method to be called

```
argument        = boolArg
                / uintArg
                / intArg
                / addressArg
                / bytesArg
                / stringArg
boolArg         = [ &quot;bool!&quot; ] ( &quot;true&quot; / &quot;false&quot; )
uintArg         = [ &quot;uint&quot; [ intSizes ] &quot;!&quot; ] 1*DIGIT
intArg          = &quot;int&quot; [ intSizes ] &quot;!&quot; 1*DIGIT
intSizes        = &quot;8&quot; / &quot;16&quot; / &quot;24&quot; / &quot;32&quot; / &quot;40&quot; / &quot;48&quot; / &quot;56&quot; / &quot;64&quot; / &quot;72&quot; / &quot;80&quot; / &quot;88&quot; / &quot;96&quot; / &quot;104&quot; / &quot;112&quot; / &quot;120&quot; / &quot;128&quot; / &quot;136&quot; / &quot;144&quot; / &quot;152&quot; / &quot;160&quot; / &quot;168&quot; / &quot;176&quot; / &quot;184&quot; / &quot;192&quot; / &quot;200&quot; / &quot;208&quot; / &quot;216&quot; / &quot;224&quot; / &quot;232&quot; / &quot;240&quot; / &quot;248&quot; / &quot;256&quot;
addressArg      = [ &quot;address!&quot; ] ( address / domainName )
bytesArg        = [ &quot;bytes!&quot; ] bytes
                / &quot;bytes1!0x&quot; 1( HEXDIG HEXDIG )
                / &quot;bytes2!0x&quot; 2( HEXDIG HEXDIG )
                ...
                / &quot;bytes32!0x&quot; 32( HEXDIG HEXDIG )
stringArg       = &quot;string!&quot; *pchar [ &quot;.&quot; fileExtension ]
```

**argument** is an argument of the method with a type-agnostic syntax of ``[ type &quot;!&quot; ] value``. If **type** 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 **type** is not specified, then the type will be automatically detected using the following rule in a sequential way:

  1. **type**=&quot;uint256&quot;, if **value** is digits; or
  2. **type**=&quot;bytes32&quot;, if **value** is in the form of 0x+32-byte-data hex; or
  3. **type**=&quot;address&quot;, if **value** is in the form of 0x+20-byte-data hex; or
  4. **type**=&quot;bytes&quot;, if **value** is in the form of 0x followed by any number of bytes besides 20 or 32; or
  5. **type**=&quot;bool&quot;, if **value** is either ``true`` or ``false``; or
  6. else **type**=&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. 


```
aQuery          = attribute *( &quot;&amp;&quot; attribute )
attribute       = attrName &quot;=&quot; attrValue
attrName        = &quot;returns&quot;
                / &quot;returnTypes&quot;
attrValue       = [ &quot;(&quot; [ retTypes ] &quot;)&quot; ]
retTypes        = retType *( &quot;,&quot; retType )
retType         = retRawType *( &quot;[&quot; [ %x31-39 *DIGIT ] &quot;]&quot; )
retRawType      = &quot;(&quot; retTypes &quot;)&quot;
                / retBaseType
retBaseType      = &quot;bool&quot; / &quot;uint&quot; [ intSizes ] / &quot;int&quot; [ intSize ] / &quot;address&quot; / &quot;bytes&quot; [ bytesSizes ] / &quot;string&quot;
bytesSizes      = %x31-39              ; 1-9
                / ( &quot;1&quot; / &quot;2&quot; ) DIGIT  ; 10-29
                / &quot;31&quot; / &quot;32&quot;          ; 31-32
```

The &quot;returns&quot; attribute in **aQuery** tells the format of the returned data. It follows the syntax of the arguments part of the ethereum ABI function signature (``uint`` and ``int`` aliases are authorized).

- 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 **fileExtension**, in which case the MIME type will be deduced from the filename extension. (Note that **fileExtension** is not excluded from the string argument given to the smartcontract)
- 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: ``[&quot;0xXXXXX&quot;]``
- Otherwise, the returned message data will be ABI-decoded in the data types specified in the **returns** value and encoded in JSON format. The encoding of the data will follow the Ethereum JSON-RPC format:
  - Unformatted data (bytes, address) will be encoded as hex, prefixed with &quot;0x&quot;, two hex digits per byte
  - 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;)
  - Boolean and strings will be native JSON boolean and strings
    
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 [ERC-4804](./eip-4804.md) backward-compatible purpose.

```
relAPathQuery   = aPath [ &quot;?&quot; aQuery ]
```

Support for auto mode relative URLs is limited : URLs relative to the current contract are allowed and will either reference itself (empty), the ``/`` path or a full method and its arguments.

### Examples

#### Example 1a

```
web3://w3url.eth/
```

where the contract of **w3url.eth** is in manual mode.

The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with &quot;Calldata&quot; = `keccak(&quot;resolveMode()&quot;)[0:4]` = &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; = **contractAddress** 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 ``text/html``.

#### Example 1b

```
web3://w3url.eth/
```

where the contract of **w3url.eth** is in auto mode.

The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with &quot;Calldata&quot; = `keccak(&quot;resolveMode()&quot;)[0:4]` = &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; = **contractAddress** 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.

#### Example 2

```
web3://cyberbrokers-meta.eth/renderBroker/9999
```

where the contract of **cyberbrokers-meta.eth** is in auto mode.

The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chainid 1 (Mainnet). Then the protocol will call the address with &quot;Calldata&quot; = `keccak(&quot;resolveMode()&quot;)[0:4]` = &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; = **contractAddress** and &quot;Calldata&quot; = &quot;0x&quot; + `keccak(&quot;renderBroker(uint256)&quot;)[0:4] + abi.encode(uint256(9999))`. 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.

#### Example 3

```
web3://vitalikblog.eth:5/
```

where the contract of **vitalikblog.eth:5** is in manual mode.

The protocol will find the address of **vitalikblog.eth** 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; = **contractAddress** 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 ``text/html``.

#### Example 4

```
web3://0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170/
```

where the contract &quot;0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170&quot; is in manual mode.

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 ``text/html``.

#### Example 5

```
web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=(uint256)
```

where the contract &quot;0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&quot; is in auto mode.

The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method &quot;balanceOf(address)&quot; of the contract with the **vitalik.eth**&apos;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 `[ &quot;0x9184e72a000&quot; ]`, with the information that the MIME type is ``application/json``.

#### Example 6

```
web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=()
```

where the contract ”0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48“ is in auto mode.

The protocol will find the address of **vitalik.eth** 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 `[&quot;0x000000000000000000000000000000000000000000000000000009184e72a000&quot;]` and returned to the frontend, with the information that the MIME type is ``application/json``.

### Appendix A: Complete ABNF for Web3 URLs

```
web3URL         = schema &quot;://&quot; [ userinfo &quot;@&quot; ] contractName [ &quot;:&quot; chainid ] pathQuery [ &quot;#&quot; fragment ]
schema          = &quot;w3&quot; / &quot;web3&quot;
userinfo        = address
contractName    = address 
                / domainName
chainid         = %x31-39 *DIGIT

pathQuery       = mPathQuery ; path+query for manual mode
                / aPathQuery ; path+query for auto mode
fragment        = *VCHAR

web3UrlRef      = web3URL 
                / relativeWeb3URL
relativeWeb3URL = relPathQuery
relPathQuery    = relMPathQuery ; Relative URL path+query for manual mode
                / relAPathQuery ; Relative URL path+query for auto mode

mPathQuery      = mPath [ &quot;?&quot; mQuery ]
mPath           = mPathAbempty ; begins with &quot;/&quot; or is empty

relMPathQuery   = relMPath [ &quot;?&quot; mQuery ]
relMPath        = mPathAbsolute ; begins with &quot;/&quot; but not &quot;//&quot;
                / mPathNoscheme ; begins with a non-colon segment
                / mPathEmpty    ; zero characters

mPathAbempty    = [ *( &quot;/&quot; segment ) &quot;/&quot; segment [ &quot;.&quot; fileExtension ] ]
mPathAbsolute   = &quot;/&quot; [ segmentNz *( &quot;/&quot; segment ) ] [ &quot;.&quot; fileExtension ]
mPathNoscheme   = segmentNzNc *( &quot;/&quot; segment ) [ &quot;.&quot; fileExtension ]
mPathEmpty      = 0&lt;pchar&gt;

segment         = *pchar ; as in RFC 3986
segmentNz       = 1*pchar ; as in RFC 3986
segmentNzNc     = 1*( unreserved / pct-encoded / sub-delims / &quot;@&quot; )
                ; as in RFC 3986: non-zero-length segment without any colon &quot;:&quot;

mQuery          = *( pchar / &quot;/&quot; / &quot;?&quot; ) ; as in RFC 3986

aPathQuery      = aPath [ &quot;?&quot; aQuery ]
aPath           = [ &quot;/&quot; [ method *( &quot;/&quot; argument ) ] ]
relAPathQuery   = aPath [ &quot;?&quot; aQuery ]
method          = ( ALPHA / &quot;$&quot; / &quot;_&quot; ) *( ALPHA / DIGIT / &quot;$&quot; / &quot;_&quot; )
argument        = boolArg
                / uintArg
                / intArg
                / addressArg
                / bytesArg
                / stringArg
boolArg         = [ &quot;bool!&quot; ] ( &quot;true&quot; / &quot;false&quot; )
uintArg         = [ &quot;uint&quot; [ intSizes ] &quot;!&quot; ] 1*DIGIT
intArg          = &quot;int&quot; [ intSizes ] &quot;!&quot; 1*DIGIT
intSizes        = &quot;8&quot; / &quot;16&quot; / &quot;24&quot; / &quot;32&quot; / &quot;40&quot; / &quot;48&quot; / &quot;56&quot; / &quot;64&quot; / &quot;72&quot; / &quot;80&quot; / &quot;88&quot; / &quot;96&quot; / &quot;104&quot; / &quot;112&quot; / &quot;120&quot; / &quot;128&quot; / &quot;136&quot; / &quot;144&quot; / &quot;152&quot; / &quot;160&quot; / &quot;168&quot; / &quot;176&quot; / &quot;184&quot; / &quot;192&quot; / &quot;200&quot; / &quot;208&quot; / &quot;216&quot; / &quot;224&quot; / &quot;232&quot; / &quot;240&quot; / &quot;248&quot; / &quot;256&quot;
addressArg      = [ &quot;address!&quot; ] ( address / domainName )
bytesArg        = [ &quot;bytes!&quot; ] bytes
                / &quot;bytes1!0x&quot; 1( HEXDIG HEXDIG )
                / &quot;bytes2!0x&quot; 2( HEXDIG HEXDIG )
                / &quot;bytes3!0x&quot; 3( HEXDIG HEXDIG )
                / &quot;bytes4!0x&quot; 4( HEXDIG HEXDIG )
                / &quot;bytes5!0x&quot; 5( HEXDIG HEXDIG )
                / &quot;bytes6!0x&quot; 6( HEXDIG HEXDIG )
                / &quot;bytes7!0x&quot; 7( HEXDIG HEXDIG )
                / &quot;bytes8!0x&quot; 8( HEXDIG HEXDIG )
                / &quot;bytes9!0x&quot; 9( HEXDIG HEXDIG )
                / &quot;bytes10!0x&quot; 10( HEXDIG HEXDIG )
                / &quot;bytes11!0x&quot; 11( HEXDIG HEXDIG )
                / &quot;bytes12!0x&quot; 12( HEXDIG HEXDIG )
                / &quot;bytes13!0x&quot; 13( HEXDIG HEXDIG )
                / &quot;bytes14!0x&quot; 14( HEXDIG HEXDIG )
                / &quot;bytes15!0x&quot; 15( HEXDIG HEXDIG )
                / &quot;bytes16!0x&quot; 16( HEXDIG HEXDIG )
                / &quot;bytes17!0x&quot; 17( HEXDIG HEXDIG )
                / &quot;bytes18!0x&quot; 18( HEXDIG HEXDIG )
                / &quot;bytes19!0x&quot; 19( HEXDIG HEXDIG )
                / &quot;bytes20!0x&quot; 20( HEXDIG HEXDIG )
                / &quot;bytes21!0x&quot; 21( HEXDIG HEXDIG )
                / &quot;bytes22!0x&quot; 22( HEXDIG HEXDIG )
                / &quot;bytes23!0x&quot; 23( HEXDIG HEXDIG )
                / &quot;bytes24!0x&quot; 24( HEXDIG HEXDIG )
                / &quot;bytes25!0x&quot; 25( HEXDIG HEXDIG )
                / &quot;bytes26!0x&quot; 26( HEXDIG HEXDIG )
                / &quot;bytes27!0x&quot; 27( HEXDIG HEXDIG )
                / &quot;bytes28!0x&quot; 28( HEXDIG HEXDIG )
                / &quot;bytes29!0x&quot; 29( HEXDIG HEXDIG )
                / &quot;bytes30!0x&quot; 30( HEXDIG HEXDIG )
                / &quot;bytes31!0x&quot; 31( HEXDIG HEXDIG )
                / &quot;bytes32!0x&quot; 32( HEXDIG HEXDIG )
stringArg       = &quot;string!&quot; *pchar [ &quot;.&quot; fileExtension ]

aQuery          = attribute *( &quot;&amp;&quot; attribute )
attribute       = attrName &quot;=&quot; attrValue
attrName        = &quot;returns&quot;
                / &quot;returnTypes&quot;
attrValue       = [ &quot;(&quot; [ retTypes ] &quot;)&quot; ]
retTypes        = retType *( &quot;,&quot; retType )
retType         = retRawType *( &quot;[&quot; [ %x31-39 *DIGIT ] &quot;]&quot; )
retRawType      = &quot;(&quot; retTypes &quot;)&quot;
                / retBaseType
retBaseType      = &quot;bool&quot; / &quot;uint&quot; [ intSizes ] / &quot;int&quot; [ intSize ] / &quot;address&quot; / &quot;bytes&quot; [ bytesSizes ] / &quot;string&quot;
bytesSizes      = %x31-39              ; 1-9
                / ( &quot;1&quot; / &quot;2&quot; ) DIGIT  ; 10-29
                / &quot;31&quot; / &quot;32&quot;          ; 31-32

domainName      = *( unreserved / pct-encoded / sub-delims ) ; As in RFC 3986

fileExtension   = 1*( ALPHA / DIGIT )

address         = &quot;0x&quot; 20( HEXDIG HEXDIG )
bytes           = &quot;0x&quot; *( HEXDIG HEXDIG )

pchar           = unreserved / pct-encoded / sub-delims / &quot;:&quot; / &quot;@&quot; ; As in RFC 3986

pct-encoded     = &quot;%&quot; HEXDIG HEXDIG ; As in RFC 3986

unreserved      = ALPHA / DIGIT / &quot;-&quot; / &quot;.&quot; / &quot;_&quot; / &quot;~&quot; ; As in RFC 3986
sub-delims    = &quot;!&quot; / &quot;$&quot; / &quot;&amp;&quot; / &quot;&apos;&quot; / &quot;(&quot; / &quot;)&quot;
                / &quot;*&quot; / &quot;+&quot; / &quot;,&quot; / &quot;;&quot; / &quot;=&quot; ; As in RFC 3986

```

### Appendix B: Changes versus [ERC-4804](./eip-4804.md)

#### Corrections

- Manual mode : [ERC-4804](./eip-4804.md) 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.
- Auto mode : If there is no **returns** attribute in **query**, [ERC-4804](./eip-4804.md) 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.

#### Clarifications

- Formal specification: This ERC add a ABNF definition of the URL format.
- Resolve mode: This ERC indicates more details on how the resolve mode is determined.
- Manual mode : This ERC indicates how to deal with URI-percent-encoding, the return data, and how the MIME type is determined.
- Auto mode : This ERC indicates in more details the encoding of the argument values, as well as the format and handling of the **returns** value.
- Examples : This ERC add more details to the examples.

#### Modifications

- Protocol name: [ERC-4804](./eip-4804.md) mentionned ``ethereum-web3://`` and ``eth-web3://``, these are removed.
- Auto mode: Supported types: [ERC-4804](./eip-4804.md) supported only uint256, bytes32, address, bytes, and string. This ERC add more types.
- Auto mode: Encoding of returned integers when a **returns** attribute is specified: [ERC-4804](./eip-4804.md) 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;.

## Rationale

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/CSS/JPG/PNG/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:

- **Human-readable**.  The Web3 URL should be easily recognized by human similar to Web2 URL (`http://`).  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.

- **Maximum-Compatible with HTTP-URL standard**.  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.

- **Simple**.  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.

- **Flexible**.  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.

## Security Considerations

No security considerations were found.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Fri, 29 Sep 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6860</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6860</guid>
      </item>
    
      <item>
        <title>Upgradable Fungible Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6864-upgradable-fungible-token-a-simple-extension-to-erc-20/13781</comments>
        
        <description>## Abstract

This proposal outlines a smart contract interface for upgrading/downgrading existing [ERC-20](./eip-20.md) 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.

## Motivation

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:

- to address bugs and remove limitations
- to adopt new features and standards
- to comply w/ changing regulations

Proxy pattern using `delegatecall` opcode offers a reasonable, generalized solution to reconcile the immutability and upgradability features but has its own shortcomings:

- 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
- upgrades are silent and irreversible, i.e. users do not have the option to opt-out

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.

[ERC-4931](./eip-4931.md) attepts to address the same problem by introducing a third &quot;bridge&quot; contract to help facilitate the upgrade/downgrade operations. While this design decouples upgrade/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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

```solidity
pragma solidity ^0.8.0;

/**
    @title Upgradable Fungible Token
    @dev See https://eips.ethereum.org/EIPS/eip-6864
 */
interface IERC6864 is IERC20 {
    /**
      @dev MUST be emitted when tokens are upgraded
      @param from Previous owner of base ERC-20 tokens
      @param to New owner of ERC-6864 tokens
      @param amount The amount that is upgraded
    */
    event Upgrade(address indexed from, address indexed to, uint256 amount);

    /**
      @dev MUST be emitted when tokens are downgraded
      @param from Previous owner of ERC-6864 tokens
      @param to New owner of base ERC-20 tokens
      @param amount The amount that is downgraded
    */
    event Downgrade(address indexed from, address indexed to, uint256 amount);

    /**
      @notice Upgrade `amount` of base ERC-20 tokens owned by `msg.sender` to ERC-6864 tokens under `to`
      @dev `msg.sender` must directly own sufficient base ERC-20 tokens
      MUST revert if `to` is the zero address
      MUST revert if `msg.sender` does not directly own `amount` or more of base ERC-20 tokens
      @param to The address to receive ERC-6864 tokens
      @param amount The amount of base ERC-20 tokens to upgrade
    */
    function upgrade(address to, uint256 amount) external;

    /**
      @notice Downgrade `amount` of ERC-6864 tokens owned by `from` to base ERC-20 tokens under `to`
      @dev `msg.sender` must either directly own or be approved to spend sufficient ERC-6864 tokens for `from`
      MUST revert if `to` is the zero address
      MUST revert if `from` does not directly own `amount` or more of ERC-6864 tokens
      MUST revret if `msg.sender` is not `from` and is not approved to spend `amount` or more of ERC-6864 tokens for `from`
      @param from The address to release ERC-6864 tokens
      @param to The address to receive base ERC-20 tokens
      @param amount The amount of ERC-6864 tokens to downgrade
    */
    function downgrade(address from, address to, uint256 amount) external;

    /**
      @notice Get the base ERC-20 smart contract address
      @return The address of the base ERC-20 smart contract
    */
    function baseToken() external view returns (address);
}
```

### See-through Extension

The **see-through extension** is OPTIONAL. It allows for easy viewing of combined states between this [ERC-6864](./eip-6864.md) and base ERC-20 smart contracts.

```solidity
pragma solidity ^0.8.0;

interface IERC6864SeeThrough is IERC6864 {
  /**
    @notice Get the combined total token supply between this ERC-6864 and base ERC-20 smart contracts
    @return The combined total token supply
  */
  function combinedTotalSupply() external view returns (uint256);

  /**
    @notice Get the combined token balance of `account` between this ERC-6864 and base ERC-20 smart contracts
    @param account The address that owns the tokens
    @return The combined token balance
  */
  function combinedBalanceOf(address account) external view returns (uint256);

  /**
    @notice Get the combined allowance that `spender` is allowed to spend for `owner` between this ERC-6864 and base ERC-20 smart contracts
    @param owner The address that owns the tokens
    @param spender The address that is approve to spend the tokens
    @return The combined spending allowance
  */
  function combinedAllowance(address owner, address spender) external view returns (uint256);
}

```

## Rationale

### Extending ERC-20 standard

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.

### Supporting downgrade

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.

### Optional see-through extension

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.

## Backwards Compatibility

ERC-6864 is generally compatible with the ERC-20 standard. The only caveat is that some smart contracts may opt to implement `transfer` to work with the entire combined balance (this reduces user friction, see reference implementation) rather than the standard `balanceOf` amount. In this case it is RECOMMENDED that such contract to implement `totalSupply` and `balanceOf` to return combined amount between this ERC-6864 and base ERC-20 smart contracts

## Reference Implementation

```solidity
import {IERC20, ERC20} from &quot;@openzeppelin-contracts/token/ERC20/ERC20.sol&quot;;

contract ERC6864 is IERC6864, ERC20 {
  IERC20 private immutable s_baseToken;

    constructor(string memory name, string memory symbol, address baseToken_) ERC20(name, symbol) {
        s_baseToken = IERC20(baseToken_);
    }

    function baseToken() public view virtual override returns (address) {
        return address(s_baseToken);
    }

    function upgrade(address to, uint256 amount) public virtual override {
        address from = _msgSender();

        s_baseToken.transferFrom(from, address(this), amount);
        _mint(to, amount);

        emit Upgrade(from, to, amount);
    }

    function downgrade(address from, address to, uint256 amount) public virtual override {
        address spender = _msgSender();

        if (from != spender) {
            _spendAllowance(from, spender, amount);
        }
        _burn(from, amount);
        s_baseToken.transfer(to, amount);

        emit Downgrade(from, to, amount);
    }

    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address from = _msgSender();
        uint256 balance = balanceOf(from);

        if (balance &lt; amount) {
            upgrade(from, amount - balance);
        }

        _transfer(from, to, amount);
        return true;
    }

    function totalSupply() public view virtual override returns (uint256) {
        return return super.totalSupply() + s_baseToken.totalSupply() - s_baseToken.balanceOf(address(this));
    }

    function balanceOf(address account) public view virtual override returns (uint256) {
        return super.balanceOf(account) + s_baseToken.balanceOf(account);
    }
}
```

## Security Considerations

- User who opts to upgrade base ERC-20 tokens must first `approve` the ERC-6864 smart contract to spend them. Therefore it&apos;s the user&apos;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 `approve` operation.
- The ERC-6864 smart contract may implement any conversion function for upgrade/downgrade as approperiate: 1-to-1, linear, non-linear. In the case of a non-linear conversion function, `upgrade` and `downgrade` may be vulnerable for front running or sandwich attacks (whether or not to the attacker&apos;s benefit). This represents the same security considerations as with any automated market maker (AMM) that uses a similar non-linear curve for conversion.
- The ERC-6864 smart contract may ask user to approve unlimited allowance and/or attempt to automatically upgrade during `transfer` (see reference implementation). This removes the chance for user to triple confirm his or her intension to upgrade (`approve` being the double confirmation).
- 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 05 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6864</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6864</guid>
      </item>
    
      <item>
        <title>On-Chain EIP-712 Visualization</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6865-on-chain-eip-712-visualization/13800</comments>
        
        <description>## Abstract

Numerous protocols employ distinct [EIP-712](./eip-712.md) 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 `visualizeEIP712Message`. 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&apos; 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.

## Motivation

The rapid expansion of the web3.0 ecosystem has unlocked numerous opportunities and innovations. However, this growth has also heightened users&apos; 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.

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:

- 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.
- Reliability: Grasping each protocol&apos;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.
- 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.

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.

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&apos;re signing, leading to increased security and an improved overall user experience within the crypto space.

Currently, most of the wallets display something similar to image below

![](../assets/eip-6865/current-EIP-712-signature-wallet-interface.png)

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

![](../assets/eip-6865/vision-EIP-712-signature-wallet-interface.png)

## Specification

The key words &quot;MUST&quot;, &quot;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.

Contracts implementing this proposal MUST include the `visualizeEIP712Message` function in the  `verifyingContract` implementation so that wallets upon receiving a request to sign an EIP-712 message(`eth_signTypedData`) MAY call the function `visualizeEIP712Message` at the smart contract and chain specified in the EIP-712 message domain separator `verifyingContract` and `chainId` fields, respectively. 

Wallets SHOULD ignore this proposal if the domain separator does not include the `verifyingContract` and `chainId` fields.

```solidity
/**
* @notice This function processes an EIP-712 payload message and returns a structured data format emphasizing the potential impact on users&apos; assets.
* @dev The function returns assetsOut (assets the user is offering), assetsIn (assets the user would receive), and liveness (validity duration of the EIP-712 message).
* @param encodedMessage The ABI-encoded EIP-712 message (abi.encode(types, params)).
* @param domainHash The hash of the EIP-712 domain separator as defined in the EIP-712 proposal; see https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator.
* @return Result struct containing the user&apos;s assets impact and message liveness.
*/
function visualizeEIP712Message(
    bytes memory encodedMessage,
    bytes32 domainHash
) external view returns (Result memory);
```

### Params

`encodedMessage` is bytes that represents the encoded EIP-712  message with `abi.encode` and it can be decoded using `abi.decode`

`domainHash` is the bytes32 hash of the EIP-712 domain separator as defined in the EIP-712 proposal

### Outputs

The function MUST return `Result`, a struct that contains information&apos;s about user’s assets impact and the liveness of such a message if it gets signed.

```solidity
struct Liveness {
  uint256 from;
  uint256 to;
}

struct UserAssetMovement {
  address assetTokenAddress;
  uint256 id;
  uint256[] amounts;
}

struct Result {
  UserAssetMovement[] assetsIn;
  UserAssetMovement[] assetsOut;
  Liveness liveness;
}
```

#### `Liveness`

`Liveness` is a struct that defines the timestamps which the message is valid where:

- `from` is the starting timestamp.
- `to` is the expiry timestamp
- `from` MUST be less than `to`

#### `UserAssetMovement`

`UserAssetMovement` defines the user’s asset where:

- `assetTokenAddress` is the token ([ERC-20](./eip-20.md), [ERC-721](./eip-721.md), [ERC-1155](./eip-1155.md)) smart contract address where the zero address MUST represents the Native coin (Native ETH in the case of Ethereum network).
- `id` is the NFT ID, this item MUST ignored if the asset is not an NFT
    - if token with `id` doesn’t exist in an NFT collection, this SHOULD be considered as any token within that collection
- `amounts` is an Array of `uint256` where items MUST define the amount per time curve, with time defined within liveness boundaries
    - the first amount in `amounts` Array (amounts[0]) MUST be the amount of the asset at `liveness.from` timestamp
    - the last amount in `amounts` Array (amounts[amounts.length-1]) MUST be the amount of the asset at `liveness.to` timestamp
    - in most of the cases, `amounts` will be an Array with a single item which is MUST be the minimum amount of the asset.

#### `assetsIn`

`assetsIn` are the minimum assets which the user MUST get if the message is signed and fulfilled

#### `assetsOut`

`assetsOut` are the maximum assets which the user MUST offer if the message is signed and fulfilled

## Rationale

### on-chain

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:

- Reliability: Protocols developers are the ones responsible for developing the protocol itself, thus crafting the visualization is much more accurate when done by them.
- 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.
- 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.

### `DomainHash`

The `domainHash` 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 (`name`) or to revert if the `domainHash` belongs to a different protocol.

In the future, if there is a registry that reroutes this EIP implementation for already deployed protocols that can&apos;t upgrade the existing deployed smart contract, `domainHash` can be used to identify protocols.

### Amounts Array

We suggest using an array of amounts (uint256[]) instead of a single uint256 to cover auctions, which are common in NFT protocols.

## Backwards Compatibility

No backward compatibility issues found.

## Reference Implementation

openSea Seaport NFT marketplace implementation example is available [here](../assets/eip-6865/contracts/SeaPortEIP712Visualizer.sol)

## Security Considerations

`visualizeEIP712Message` function should be reliable and accurately represent the potential impact of the EIP-712 message on users&apos; assets. Wallet providers and users must trust the protocol&apos;s implementation of this function to provide accurate and up-to-date information.

`visualizeEIP712Message` function results should be treated based on the reputation of its `verifyingContract`, if the `verifyingContract` is trusted it means the `visualizeEIP712Message` function results are trusted as the this proposal implementation lives at the same address of `verifyingContract`.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Mon, 10 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6865</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6865</guid>
      </item>
    
      <item>
        <title>Modular Smart Contract Accounts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-modular-smart-contract-accounts-and-plugins/13885</comments>
        
        <description>## Abstract

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 [ERC-4337](./eip-4337.md). This standard emphasizes secure permissioning of modules, and maximal interoperability between all spec-compliant accounts and modules.

This modular approach splits account functionality into three categories, implements them in external contracts, and defines an expected execution flow from accounts.

## Motivation

One of the goals that ERC-4337 accomplishes is abstracting the logic for execution and validation to each smart contract account.

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.

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.

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.

![diagram showing relationship between accounts and modules with modular functions](../assets/eip-6900/MSCA_Shared_Components_Diagram.svg)

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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Terms

- An **account** (or **smart contract account, SCA**) is a smart contract that can be used to send transactions and hold digital assets. It implements the `IAccount` interface from ERC-4337.
- A **modular account** (or **modular smart contract account, MSCA**) is an account that supports modular functions. There are three types of modular functions:
  - **Validation functions** validate authorization on behalf of the account.
  - **Execution functions** execute custom logic allowed by the account.
  - **Hooks** execute custom logic and checks before and/or after an execution function or validation function. There are two types of hooks:
    - **Validation hooks** run before a validation function. These can enforce permissions on actions authorized by a validation function.
    - **Execution hooks** can run before and/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.
- A **native function** refers to a function implemented by the modular account, as opposed to a function added by a module.
- A **module** is a deployed smart contract that hosts any amount of the above three kinds of modular functions.
- A module&apos;s **manifest** describes the execution functions, interface IDs, and hooks that should be installed on the account.

### Overview

A modular account handles two kinds of calls: either from the `EntryPoint` through ERC-4337, or through direct calls from externally owned accounts (EOAs) and other smart contracts. This standard supports both use cases.

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.

![diagram showing call flow within a modular account](../assets/eip-6900/Modular_Account_Call_Flow.svg)

Each step is modular, supporting different implementations, which allows for open-ended programmable accounts.

### Interfaces

Modular accounts MUST implement:

- `IAccount.sol` and `IAccountExecute.sol` from [ERC-4337](./eip-4337.md).
- `IERC6900Account.sol` to support module management and usage, and account identification.
- The function `isValidSignature` from [ERC-1271](./eip-1271.md)

Modular accounts MAY implement:

- `IERC6900AccountView.sol` to support visibility in account states on-chain.
- [ERC-165](./eip-165.md) for interfaces installed from modules.

Modules MUST implement:

- `IERC6900Module.sol` described below and implement ERC-165 for `IERC6900Module`.

Modules MAY implement any of the following module types:

- `IERC6900ValidationModule` to support validation functions for the account.
- `IERC6900ValidationHookModule` to support hooks for validation functions.
- `IERC6900ExecutionModule` to support execution functions and their installations on the account.
- `IERC6900ExecutionHookModule` to support pre &amp; post execution hooks for execution functions.

#### `IERC6900Account.sol`

Module execution and management interface. Modular accounts MUST implement this interface to support installing and uninstalling modules, and open-ended execution.

```solidity
/// @dev A packed representation of a module function.
/// Consists of the following, left-aligned:
/// Module address: 20 bytes
/// Entity ID:      4 bytes
type ModuleEntity is bytes24;

/// @dev A packed representation of a validation function and its associated flags.
/// Consists of the following, left-aligned:
/// Module address:     20 bytes
/// Entity ID:          4 bytes
/// ValidationFlags:    1 byte
type ValidationConfig is bytes25;

// ValidationFlags layout:
// 0b00000___ // unused
// 0b_____A__ // isGlobal
// 0b______B_ // isSignatureValidation
// 0b_______C // isUserOpValidation
type ValidationFlags is uint8;

/// @dev A packed representation of a hook function and its associated flags.
/// Consists of the following, left-aligned:
/// Module address: 20 bytes
/// Entity ID:      4 bytes
/// Flags:          1 byte
///
/// Hook flags layout:
/// 0b00000___ // unused
/// 0b_____A__ // hasPre (exec only)
/// 0b______B_ // hasPost (exec only)
/// 0b_______C // hook type (0 for exec, 1 for validation)
type HookConfig is bytes25;

struct Call {
    // The target address for the account to call.
    address target;
    // The value to send with the call.
    uint256 value;
    // The calldata for the call.
    bytes data;
}

interface IERC6900Account {
    event ExecutionInstalled(address indexed module, ExecutionManifest manifest);
    event ExecutionUninstalled(address indexed module, bool onUninstallSucceeded, ExecutionManifest manifest);
    event ValidationInstalled(address indexed module, uint32 indexed entityId);
    event ValidationUninstalled(address indexed module, uint32 indexed entityId, bool onUninstallSucceeded);

    /// @notice Standard execute method.
    /// @param target The target address for the account to call.
    /// @param value The value to send with the call.
    /// @param data The calldata for the call.
    /// @return The return data from the call.
    function execute(address target, uint256 value, bytes calldata data) external payable returns (bytes memory);

    /// @notice Standard executeBatch method.
    /// @dev If the target is a module, the call SHOULD revert. If any of the calls revert, the entire batch MUST
    /// revert.
    /// @param calls The array of calls.
    /// @return An array containing the return data from the calls.
    function executeBatch(Call[] calldata calls) external payable returns (bytes[] memory);

    /// @notice Execute a call using the specified runtime validation.
    /// @param data The calldata to send to the account.
    /// @param authorization The authorization data to use for the call. The first 24 bytes is a ModuleEntity which
    /// specifies which runtime validation to use, and the rest is sent as a parameter to runtime validation.
    function executeWithRuntimeValidation(bytes calldata data, bytes calldata authorization)
        external
        payable
        returns (bytes memory);

    /// @notice Install a module to the modular account.
    /// @param module The module to install.
    /// @param manifest the manifest describing functions to install.
    /// @param installData Optional data to be used by the account to handle the initial execution setup. Data encoding
    /// is implementation-specific.
    function installExecution(
        address module,
        ExecutionManifest calldata manifest,
        bytes calldata installData
    ) external;

    /// @notice Uninstall a module from the modular account.
    /// @param module The module to uninstall.
    /// @param manifest The manifest describing functions to uninstall.
    /// @param uninstallData Optional data to be used by the account to handle the execution uninstallation. Data
    /// encoding is implementation-specific.
    function uninstallExecution(
        address module,
        ExecutionManifest calldata manifest,
        bytes calldata uninstallData
    ) external;

    /// @notice Installs a validation function across a set of execution selectors, and optionally mark it as a
    /// global validation function.
    /// @param validationConfig The validation function to install, along with configuration flags.
    /// @param selectors The selectors to install the validation function for.
    /// @param installData Optional data to be used by the account to handle the initial validation setup. Data
    /// encoding is implementation-specific.
    /// @param hooks Optional hooks to install and associate with the validation function. Data encoding is
    /// implementation-specific.
    function installValidation(
        ValidationConfig validationConfig,
        bytes4[] calldata selectors,
        bytes calldata installData,
        bytes[] calldata hooks
    ) external;

    /// @notice Uninstall a validation function from a set of execution selectors.
    /// @param validationFunction The validation function to uninstall.
    /// @param uninstallData Optional data to be used by the account to handle the validation uninstallation. Data
    /// encoding is implementation-specific.
    /// @param hookUninstallData Optional data to be used by the account to handle hook uninstallation. Data encoding
    /// is implementation-specific.
    function uninstallValidation(
        ModuleEntity validationFunction,
        bytes calldata uninstallData,
        bytes[] calldata hookUninstallData
    ) external;

    /// @notice Return a unique identifier for the account implementation.
    /// @dev This function MUST return a string in the format &quot;vendor.account.semver&quot;. The vendor and account
    /// names MUST NOT contain a period character.
    /// @return The account ID.
    function accountId() external view returns (string memory);
}
```

#### `IERC6900AccountView.sol`

Module inspection interface. Modular accounts MAY implement this interface to support visibility in module configuration.

```solidity
/// @dev Represents data associated with a specific function selector.
struct ExecutionDataView {
    // The module that implements this execution function.
    // If this is a native function, the address must be the address of the account.
    address module;
    // Whether or not the function needs runtime validation, or can be called by anyone. The function can still be
    // state changing if this flag is set to true.
    // Note that even if this is set to true, user op validation will still be required, otherwise anyone could
    // drain the account of native tokens by wasting gas.
    bool skipRuntimeValidation;
    // Whether or not a global validation function may be used to validate this function.
    bool allowGlobalValidation;
    // The execution hooks for this function selector.
    HookConfig[] executionHooks;
}

struct ValidationDataView {
    // ValidationFlags layout:
    // 0b00000___ // unused
    // 0b_____A__ // isGlobal
    // 0b______B_ // isSignatureValidation
    // 0b_______C // isUserOpValidation
    ValidationFlags validationFlags;
    // The validation hooks for this validation function.
    HookConfig[] validationHooks;
    // Execution hooks to run with this validation function.
    HookConfig[] executionHooks;
    // The set of selectors that may be validated by this validation function.
    bytes4[] selectors;
}

interface IERC6900AccountView {
    /// @notice Get the execution data for a selector.
    /// @dev If the selector is a native function, the module address will be the address of the account.
    /// @param selector The selector to get the data for.
    /// @return The execution data for this selector.
    function getExecutionData(bytes4 selector) external view returns (ExecutionDataView memory);

    /// @notice Get the validation data for a validation function.
    /// @dev If the selector is a native function, the module address will be the address of the account.
    /// @param validationFunction The validation function to get the data for.
    /// @return The validation data for this validation function.
    function getValidationData(ModuleEntity validationFunction)
        external
        view
        returns (ValidationDataView memory);
}
```

#### `IERC6900Module.sol`

Module interface. Modules MUST implement this interface to support module management and interactions with [ERC-6900](./eip-6900.md) modular accounts.

```solidity
interface IERC6900Module is IERC165 {
    /// @notice Initialize module data for the modular account.
    /// @dev Called by the modular account during `installExecution`.
    /// @param data Optional bytes array to be decoded and used by the module to setup initial module data for the
    /// modular account.
    function onInstall(bytes calldata data) external;

    /// @notice Clear module data for the modular account.
    /// @dev Called by the modular account during `uninstallExecution`.
    /// @param data Optional bytes array to be decoded and used by the module to clear module data for the modular
    /// account.
    function onUninstall(bytes calldata data) external;

    /// @notice Return a unique identifier for the module.
    /// @dev This function MUST return a string in the format &quot;vendor.module.semver&quot;. The vendor and module
    /// names MUST NOT contain a period character.
    /// @return The module ID.
    function moduleId() external view returns (string memory);
}
```

#### `IERC6900ValidationModule.sol`

Validation module interface. Modules MAY implement this interface to provide validation functions for the account.

```solidity
interface IERC6900ValidationModule is IERC6900Module {
    /// @notice Run the user operation validation function specified by the `entityId`.
    /// @param entityId An identifier that routes the call to different internal implementations, should there
    /// be more than one.
    /// @param userOp The user operation.
    /// @param userOpHash The user operation hash.
    /// @return Packed validation data for validAfter (6 bytes), validUntil (6 bytes), and authorizer (20 bytes).
    function validateUserOp(uint32 entityId, PackedUserOperation calldata userOp, bytes32 userOpHash)
        external
        returns (uint256);

    /// @notice Run the runtime validation function specified by the `entityId`.
    /// @dev To indicate the entire call should revert, the function MUST revert.
    /// @param account The account to validate for.
    /// @param entityId An identifier that routes the call to different internal implementations, should there
    /// be more than one.
    /// @param sender The caller address.
    /// @param value The call value.
    /// @param data The calldata sent.
    /// @param authorization Additional data for the validation function to use.
    function validateRuntime(
        address account,
        uint32 entityId,
        address sender,
        uint256 value,
        bytes calldata data,
        bytes calldata authorization
    ) external;

    /// @notice Validates a signature using ERC-1271.
    /// @dev To indicate the entire call should revert, the function MUST revert.
    /// @param account The account to validate for.
    /// @param entityId An identifier that routes the call to different internal implementations, should there
    /// be more than one.
    /// @param sender The address that sent the ERC-1271 request to the smart account.
    /// @param hash The hash of the ERC-1271 request.
    /// @param signature The signature of the ERC-1271 request.
    /// @return The ERC-1271 `MAGIC_VALUE` if the signature is valid, or 0xFFFFFFFF if invalid.
    function validateSignature(
        address account,
        uint32 entityId,
        address sender,
        bytes32 hash,
        bytes calldata signature
    ) external view returns (bytes4);
}
```

#### `IERC6900ValidationHookModule.sol`

Validation hook module interface. Modules MAY implement this interface to provide hooks for validation functions for the account.

```solidity
interface IERC6900ValidationHookModule is IERC6900Module {
    /// @notice Run the pre user operation validation hook specified by the `entityId`.
    /// @dev Pre user operation validation hooks MUST NOT return an authorizer value other than 0 or 1.
    /// @param entityId An identifier that routes the call to different internal implementations, should there
    /// be more than one.
    /// @param userOp The user operation.
    /// @param userOpHash The user operation hash.
    /// @return Packed validation data for validAfter (6 bytes), validUntil (6 bytes), and authorizer (20 bytes).
    function preUserOpValidationHook(uint32 entityId, PackedUserOperation calldata userOp, bytes32 userOpHash)
        external
        returns (uint256);

    /// @notice Run the pre runtime validation hook specified by the `entityId`.
    /// @dev To indicate the entire call should revert, the function MUST revert.
    /// @param entityId An identifier that routes the call to different internal implementations, should there
    /// be more than one.
    /// @param sender The caller address.
    /// @param value The call value.
    /// @param data The calldata sent.
    /// @param authorization Additional data for the hook to use.
    function preRuntimeValidationHook(
        uint32 entityId,
        address sender,
        uint256 value,
        bytes calldata data,
        bytes calldata authorization
    ) external;

    /// @notice Run the pre signature validation hook specified by the `entityId`.
    /// @dev To indicate the call should revert, the function MUST revert.
    /// @param entityId An identifier that routes the call to different internal implementations, should there
    /// be more than one.
    /// @param sender The caller address.
    /// @param hash The hash of the message being signed.
    /// @param signature The signature of the message.
    function preSignatureValidationHook(uint32 entityId, address sender, bytes32 hash, bytes calldata signature)
        external
        view;
}
```

#### `IERC6900ExecutionModule.sol`

Execution module interface. Modules MAY implement this interface to provide execution functions for the account.

```solidity
struct ManifestExecutionFunction {
    // The selector to install.
    bytes4 executionSelector;
    // If true, the function won&apos;t need runtime validation, and can be called by anyone.
    bool skipRuntimeValidation;
    // If true, the function can be validated by a global validation function.
    bool allowGlobalValidation;
}

struct ManifestExecutionHook {
    bytes4 executionSelector;
    uint32 entityId;
    bool isPreHook;
    bool isPostHook;
}

/// @dev A struct describing how the module should be installed on a modular account.
struct ExecutionManifest {
    // Execution functions defined in this module to be installed on the MSCA.
    ManifestExecutionFunction[] executionFunctions;
    ManifestExecutionHook[] executionHooks;
    // List of ERC-165 interface IDs to add to account to support introspection checks. This MUST NOT include
    // IERC6900Module&apos;s interface ID.
    bytes4[] interfaceIds;
}

interface IERC6900ExecutionModule is IERC6900Module {
    /// @notice Describe the contents and intended configuration of the module.
    /// @dev This manifest MUST stay constant over time.
    /// @return A manifest describing the contents and intended configuration of the module.
    function executionManifest() external pure returns (ExecutionManifest memory);
}
```

#### `IERC6900ExecutionHookModule.sol`

Execution hook module interface. Modules MAY implement this interface to provide hooks for execution functions for the account.

```solidity
interface IERC6900ExecutionHookModule is IERC6900Module {
    /// @notice Run the pre execution hook specified by the `entityId`.
    /// @dev To indicate the entire call should revert, the function MUST revert.
    /// @param entityId An identifier that routes the call to different internal implementations, should there
    /// be more than one.
    /// @param sender The caller address.
    /// @param value The call value.
    /// @param data The calldata sent. For `executeUserOp` calls of validation-associated hooks, hook modules
    /// should receive the full calldata.
    /// @return Context to pass to a post execution hook, if present. An empty bytes array MAY be returned.
    function preExecutionHook(uint32 entityId, address sender, uint256 value, bytes calldata data)
        external
        returns (bytes memory);

    /// @notice Run the post execution hook specified by the `entityId`.
    /// @dev To indicate the entire call should revert, the function MUST revert.
    /// @param entityId An identifier that routes the call to different internal implementations, should there
    /// be more than one.
    /// @param preExecHookData The context returned by its associated pre execution hook.
    function postExecutionHook(uint32 entityId, bytes calldata preExecHookData) external;
}
```

### Validation Functions

#### Installation

- The account MUST install all validation hooks specified by the user and SHOULD call `onInstall` with the user-provided data on the hook module to initialize state if specified by the user.
- The account MUST install all execution hooks specified by the user and SHOULD call `onInstall` with the user-provided data on the hook module to initialize state if specified by the user.
- The account MUST configure the validation function to validate all of the selectors specified by the user.
- The account MUST set all flags as specified, like `isGlobal`, `isSignatureValidation`, and `isUserOpValidation`.
- The account SHOULD call `onInstall` on the validation module to initialize state if specified by the user.
- The account MUST emit `ValidationInstalled` as defined in the interface for all installed validation functions.

#### Uninstallation

During validation uninstallation, the account MUST correctly clear flags and other fields based on the incoming data provided by the user.

- The account MUST clear all flags for the validation function, like `isGlobal`, `isSignatureValidation`, and `isUserOpValidation`.
- The account MUST remove all hooks and SHOULD clear hook module states by calling `onUninstall` with the user-provided data for each hook, including both validation hooks and execution hooks, if specified by the user.
  - The account MAY ignore the revert from `onUninstall` with try/catch depending on the design principle of the account.
- The account MUST clear the configuration for the selectors that the validation function can validate.
- The account SHOULD call `onUninstall` on the validation module to clean up state if specified by the user.
- The account MUST emit `ValidationUninstalled` as defined in the interface for all uninstalled validation functions.

### Execution Functions

#### Installation

- The account MUST install all execution functions and set flags and fields as specified in the manifest.
    - An execution function selector MUST be unique in the account.
    - An execution function selector MUST not conflict with native ERC-4337 and ERC-6900 functions.
- The account MUST add all execution hooks as specified in the manifest.
- The account SHOULD add all supported interfaces as specified in the manifest.
- The account SHOULD call `onInstall` on the execution module to initialize state if specified by the user.
- The account MUST emit `ExecutionInstalled` as defined in the interface for all installed executions.

#### Uninstallation

During execution uninstallation, the account MUST correctly clear flags and other fields based on the incoming data and module manifest provided by the user.

- The account MUST remove all execution functions and clear flags and fields as specified in the manifest.
- The account MUST remove all execution hooks as specified in the manifest.
- The account SHOULD remove all supported interfaces as specified in the manifest.
- The account SHOULD call `onUninstall` on the execution module to clean up state and track call success if specified by the user.
- The account MUST emit `ExecutionUninstalled` as defined in the interface for all uninstalled executions.

### Hooks

#### Execution Hooks Data Format

For accounts that implement execution hooks, accounts MUST conform to these execution hook formats:

1. For `executeUserOp` calls, for execution hooks associated with a validation function, accounts MUST send the full calldata (`msg.data` in solidity), including the `executeUserOp` selector.
2. For `executeUserOp` calls, for execution hooks associated with a selector, accounts MUST send `PackedUserOperation.callData` for `executeUserOp` calls, excluding `executeUserOp.selector` and the rest of the `PackedUserOperation`.
3. For `executeWithRuntimeValidation` calls, for all execution hooks, accounts MUST send the inner `data` field.
4. For all other calls, for execution hooks associated with a selector, accounts MUST send over the full calldata (`msg.data` in solidity).

#### Hook Execution Order

It is RECOMMENDED that an account implementer runs hooks in first installed first executed order. However, an account MAY implement a different execution order.

### Validation Call Flow

Modular accounts support three different calls flows for validation: user op validation, runtime validation, and signature validation. User op validation happens within the account&apos;s implementation of the function `validateUserOp`, defined in the ERC-4337 interface `IAccount`. Runtime validation happens through the dispatcher function `executeWithRuntimeValidation`, or when using [direct call validation](#direct-call-validation). Signature validation happens within the account&apos;s implementation of the function `isValidSignature`, defined in ERC-1271.

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.

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 [Checking Validation Applicability](#checking-validation-applicability)). 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&apos;s revert data within its revert data.

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 `userOp.signature` field for user op validation, the `authorization` field for runtime validation, and the `signature` field for signature validation.

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 `1` for the authorizer field, indicating a signature verification failure by the ERC-4337 standard, the account MUST return a value of `1` for the authorizer portion of the validation data.

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.

#### Checking Validation Applicability

To enforce module permission isolation, the modular account MUST check validation function applicability as part of each validation function implementation.

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 `isGlobal` flag as true, which means the account MUST consider it applicable to any module execution function with the `allowGlobalValidation` flag set to true, or for any account native function that the account MAY allow for global validation.

If the selector being checked is `execute` or `executeBatch`, the modular account MUST perform additional checking. If the target of `execute` is the modular account&apos;s own address, or if the target of any `Call` within `executeBatch` is the account, validation MUST either revert or check that validation applies to the selector(s) being called.

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 `isUserOpValidation` is set to false, validation MUST revert. If the validation function is attempted to be used for signature validation and the flag `isSignatureValidation` is set to false, validation MUST revert.

#### Direct Call Validation

If a validation function is installed with the entity ID of `0xffffffff`, 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 `executeWithRuntimeValidation` to use as a selection mechanism for a runtime validation function.

To implement direct call validation, the modular account MUST treat direct function calls that are not from the modular account itself or the `EntryPoint` as an attempt to validate using the caller&apos;s address and the entity ID of `0xffffffff`. 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.

### Execution Call Flow

For all non-view functions within `IERC6900Account` except `executeWithRuntimeValidation`, 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:

If the caller is not the `EntryPoint` or the account, the account MUST check access control for direct call validation.

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.

Next, the modular account MUST run the target function, either an account native function or a module-defined execution function.

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 `bytes` value to the account, the account MUST pass that data to the post execution hook.

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.

Module execution functions where the field `skipRuntimeValidation` 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.

### Extension

#### Semi-Modular Account

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.

## Rationale

ERC-4337 compatible accounts must implement the `IAccount` interface, which consists of only one method that bundles validation with execution: `validateUserOp`. 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.

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&apos;s methods for exposing its modular functions and desired configuration, and the modular account&apos;s methods for installing and removing modules and allowing execution across modules and external addresses.

### ERC-4337 Dependency

ERC-6900&apos;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 [modular account call flows](#overview). 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.

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&apos;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.

### Community Consensus

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:

- Gerard Persoon (@gpersoon)
- Harry Jeon (@sm-stack)
- Zhiyu Zhang (@ZhiyuCircle)
- Danilo Neves Cruz (@cruzdanilo)
- Iván Alberquilla (@ialberquilla)

We host community calls and working groups to discuss standard improvements and invite anyone with questions or contributions into our discussion.

## Backwards Compatibility

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.

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.

## Reference Implementation

See `https://github.com/erc6900/reference-implementation`

## Security Considerations

### Wallet/SDK Developers

From the wallet side, there are certain checks that the wallet/SDK should perform on the UI/UX side.

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 `installExecution()`, the SDK creates an `executionManifest` parameter that will specify the actions of the execution module being installed. SDKs will process the provided `executionManifest()` function of the underlying module, but the finished parameter will not necessarily be identical to the module’s return value of `executionManifest()`. Furthermore, this parameter is only going through very limited checks on-chain as part of the installation process. Therefore, the `executionManifest` parameter needs to be carefully constructed and verified before being used for installations. Furthermore, the `executionManifest` parameter of uninstallation should ideally be the same used in installation to not leave residual data.

The standard supports a `isGlobalValidation` 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 `allowGlobalValidation` 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/execution functions. In a sense, these global validation functions could gain root access to the exposed native execution functions and potentially the whole account.

### Module Developers

The standard does not enforce any rules surrounding what data needs to be installed or uninstalled when a module is added/deleted from the account. Hence the `onUninstall()` 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 `entityId`. 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.

### Users

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 18 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6900</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6900</guid>
      </item>
    
      <item>
        <title>Minimal Multi-Token Interface</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-6909-multi-token-standard/13891</comments>
        
        <description>## Abstract

The following specifies a multi-token contract as a simplified alternative to the [ERC-1155](./eip-1155.md) 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.

## Motivation

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.

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 [ERC-721](./eip-721.md) having both `transferFrom` and `safeTransferFrom`. 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.

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.

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&apos;s behalf w by their ID while operators are granted full transfer permission for all token IDs for the user.

## Specification

The key words &quot;MUST&quot;, &quot;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.

Every [ERC-6909](./eip-6909.md) compliant contract must implement the [ERC-165](./eip-165.md) interface in addition to the following interface.

### Definitions

- infinite: The maximum value for a uint256 (`2 ** 256 - 1`).
- caller: The caller of the current context (`msg.sender`).
- spender: An account that transfers tokens on behalf of another account.
- operator: An account that has unlimited transfer permissions on all token ids for another account.
- mint: The creation of an amount of tokens. This MAY happen in a mint method or as a transfer from the zero address.
- burn: The removal an amount of tokens. This MAY happen in a burn method or as a transfer to the zero address.

### Methods

#### `balanceOf`

The total `amount` of a token `id` that an `owner` owns.

```yaml
- name: balanceOf
  type: function
  stateMutability: view

  inputs:
    - name: owner
      type: address
    - name: id
      type: uint256

  outputs:
    - name: amount
      type: uint256
```

#### `allowance`

The total `amount` of a token `id` that a `spender` is permitted to transfer on behalf of an `owner`.

```yaml
- name: allowance
  type: function
  stateMutability: view

  inputs:
    - name: owner
      type: address
    - name: spender
      type: address
    - name: id
      type: uint256

  outputs:
    - name: amount
      type: uint256
```

#### `isOperator`

Returns `true` if the `spender` is approved as an operator for an `owner`.

```yaml
- name: isOperator
  type: function
  stateMutability: view

  inputs:
    - name: owner
      type: address
    - name: spender
      type: address

  outputs:
    - name: status
      type: bool
```

#### `transfer`

Transfers an `amount` of a token `id` from the caller to the `receiver`.

MUST revert when the caller&apos;s balance for the token `id` is insufficient.

MUST log the `Transfer` event.

MUST return True.

```yaml
- name: transfer
  type: function
  stateMutability: nonpayable

  inputs:
    - name: receiver
      type: address
    - name: id
      type: uint256
    - name: amount
      type: uint256

  outputs:
    - name: success
      type: bool
```

#### `transferFrom`

Transfers an `amount` of a token `id` from a `sender` to a `receiver` by the caller.

MUST revert when the caller is neither the `sender` nor an operator for the `sender` and the caller&apos;s allowance for the token `id` for the `sender` is insufficient.

MUST revert when the `sender`&apos;s balance for the token id is insufficient.

MUST log the `Transfer` event.

MUST decrease the caller&apos;s `allowance` by the same `amount` of the `sender`&apos;s balance decrease if the caller is not an operator for the `sender` and the caller&apos;s `allowance` is not infinite.

SHOULD NOT decrease the caller&apos;s `allowance` for the token `id` for the `sender` if the `allowance` is infinite.

SHOULD NOT decrease the caller&apos;s `allowance` for the token `id` for the `sender` if the caller is an operator or the `sender`.

MUST return True.

```yaml
- name: transferFrom
  type: function
  stateMutability: nonpayable

  inputs:
    - name: sender
      type: address
    - name: receiver
      type: address
    - name: id
      type: uint256
    - name: amount
      type: uint256

  outputs:
    - name: success
      type: bool
```

#### `approve`

Approves an `amount` of a token `id` that a `spender` is permitted to transfer on behalf of the caller.

MUST set the `allowance` of the `spender` of the token `id` for the caller to the `amount`.

MUST log the `Approval` event.

MUST return True.

```yaml
- name: approve
  type: function
  stateMutability: nonpayable

  inputs:
    - name: spender
      type: address
    - name: id
      type: uint256
    - name: amount
      type: uint256

  outputs:
    - name: success
      type: bool
```

#### `setOperator`

Grants or revokes unlimited transfer permissions for a `spender` for any token `id` on behalf of the caller.

MUST set the operator status to the `approved` value.

MUST log the `OperatorSet` event.

MUST return True.

```yaml
- name: setOperator
  type: function
  stateMutability: nonpayable

  inputs:
    - name: spender
      type: address
    - name: approved
      type: bool

  outputs:
    - name: success
      type: bool
```

### Events

#### `Transfer`

The `caller` initiates a transfer of an `amount` of a token `id` from a `sender` to a `receiver`.

MUST be logged when an `amount` of a token `id` is transferred from one account to another.

MUST be logged with the `sender` address as the zero address when an `amount` of a token `id` is minted.

MUST be logged with the `receiver` address as the zero address when an `amount` of a token `id` is burned.

```yaml
- name: Transfer
  type: event

  inputs:
    - name: caller
      indexed: false
      type: address
    - name: sender
      indexed: true
      type: address
    - name: receiver
      indexed: true
      type: address
    - name: id
      indexed: true
      type: uint256
    - name: amount
      indexed: false
      type: uint256
```

#### `OperatorSet`

The `owner` has set the `approved` status to a `spender`.

MUST be logged when the operator status is set.

MAY be logged when the operator status is set to the same status it was before the current call.

```yaml
- name: OperatorSet
  type: event

  inputs:
    - name: owner
      indexed: true
      type: address
    - name: spender
      indexed: true
      type: address
    - name: approved
      indexed: false
      type: bool
```

#### `Approval`

The `owner` has approved a `spender` to transfer an `amount` of a token `id` to be transferred on the owner&apos;s behalf.

MUST be logged when the `allowance` is set by an `owner`.

```yaml
- name: Approval
  type: event

  inputs:
    - name: owner
      indexed: true
      type: address
    - name: spender
      indexed: true
      type: address
    - name: id
      indexed: true
      type: uint256
    - name: amount
      indexed: false
      type: uint256
```

### Interface ID

The interface ID is `0x0f632fb3`.

### Metadata Extension

#### Methods

##### name

The `name` for a token `id`.

```yaml
- name: name
  type: function
  stateMutability: view

  inputs:
    - name: id
      type: uint256

  outputs:
    - name: name
      type: string
```

##### symbol

The ticker `symbol` for a token `id`.

```yaml
- name: symbol
  type: function
  stateMutability: view

  inputs:
    - name: id
      type: uint256

  outputs:
    - name: symbol
      type: string
```

##### decimals

The `amount` of decimals for a token `id`.

```yaml
- name: decimals
  type: function
  stateMutability: view

  inputs:
    - name: id
      type: uint256

  outputs:
  - name: amount
    type: uint8
```

### Content URI Extension

#### Methods

##### contractURI

The `URI` for the contract.

```yaml
- name: contractURI
  type: function
  stateMutability: view

  inputs: []

  outputs:
    - name: uri
      type: string
```

##### tokenURI

The `URI` for a token `id`.

MAY revert if the token `id` does not exist.

MUST replace occurrences of `{id}` in the returned URI string by the client.

```yaml
- name: tokenURI
  type: function
  stateMutability: view

  inputs:
    - name: id
      type: uint256

  outputs:
    - name: uri
      type: string
```

#### Metadata Structure

##### Contract URI

JSON Schema:

```json
{
  &quot;title&quot;: &quot;Contract Metadata&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;The name of the contract.&quot;
    },
    &quot;description&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;The description of the contract.&quot;
    },
    &quot;image_url&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;format&quot;: &quot;uri&quot;,
      &quot;description&quot;: &quot;The URL of the image representing the contract.&quot;
    },
    &quot;banner_image_url&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;format&quot;: &quot;uri&quot;,
      &quot;description&quot;: &quot;The URL of the banner image of the contract.&quot;
    },
    &quot;external_link&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;format&quot;: &quot;uri&quot;,
      &quot;description&quot;: &quot;The external link of the contract.&quot;
    },
    &quot;editors&quot;: {
      &quot;type&quot;: &quot;array&quot;,
      &quot;items&quot;: {
        &quot;type&quot;: &quot;string&quot;,
        &quot;description&quot;: &quot;An Ethereum address representing an authorized editor of the contract.&quot;
      },
      &quot;description&quot;: &quot;An array of Ethereum addresses representing editors (authorized editors) of the contract.&quot;
    },
    &quot;animation_url&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;An animation URL for the contract.&quot;
    }
  },
  &quot;required&quot;: [&quot;name&quot;]
}
```

JSON Example (Minimal):

```json
{
  &quot;name&quot;: &quot;Example Contract Name&quot;,
}
```

##### Token URI

MUST replace occurrences of `{id}` in the returned URI string by the client.

JSON Schema:

```json
{
  &quot;title&quot;: &quot;Asset Metadata&quot;,
  &quot;type&quot;: &quot;object&quot;,
  &quot;properties&quot;: {
    &quot;name&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Identifies the token&quot;
    },
    &quot;description&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;Describes the token&quot;
    },
    &quot;image&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;A URI pointing to an image resource.&quot;
    },
    &quot;animation_url&quot;: {
      &quot;type&quot;: &quot;string&quot;,
      &quot;description&quot;: &quot;An animation URL for the token.&quot;
    }
  },
  &quot;required&quot;: [&quot;name&quot;, &quot;description&quot;, &quot;image&quot;]
}
```

JSON Example (Minimal):

```json
{
  &quot;name&quot;: &quot;Example Token Name&quot;,
  &quot;description&quot;: &quot;Example Token Description&quot;,
  &quot;image&quot;: &quot;exampleurl/{id}&quot;
}
```

### Token Supply Extension

#### Methods

##### totalSupply

The `totalSupply` for a token `id`.

```yaml
- name: totalSupply
  type: function
  stateMutability: view

  inputs:
    - name: id
      type: uint256

  outputs:
    - name: supply
      type: uint256
```

## Rationale

### Granular Approvals

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 [ERC-20](./eip-20.md) allows an account to set an explicit amount of the token that another account can spend on the owner&apos;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.

### Removal of Batching

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.

### Removal of Required Callbacks

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.

### Removal of &quot;Safe&quot; Naming

The `safeTransfer` and `safeTransferFrom` 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.

## Backwards Compatibility

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.

## Reference Implementation

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.19;

/// @title ERC6909 Multi-Token Reference Implementation
/// @author jtriley.eth
contract ERC6909 {
    /// @dev Thrown when owner balance for id is insufficient.
    /// @param owner The address of the owner.
    /// @param id The id of the token.
    error InsufficientBalance(address owner, uint256 id);

    /// @dev Thrown when spender allowance for id is insufficient.
    /// @param spender The address of the spender.
    /// @param id The id of the token.
    error InsufficientPermission(address spender, uint256 id);

    /// @notice The event emitted when a transfer occurs.
    /// @param sender The address of the sender.
    /// @param receiver The address of the receiver.
    /// @param id The id of the token.
    /// @param amount The amount of the token.
    event Transfer(address caller, address indexed sender, address indexed receiver, uint256 indexed id, uint256 amount);

    /// @notice The event emitted when an operator is set.
    /// @param owner The address of the owner.
    /// @param spender The address of the spender.
    /// @param approved The approval status.
    event OperatorSet(address indexed owner, address indexed spender, bool approved);

    /// @notice The event emitted when an approval occurs.
    /// @param owner The address of the owner.
    /// @param spender The address of the spender.
    /// @param id The id of the token.
    /// @param amount The amount of the token.
    event Approval(address indexed owner, address indexed spender, uint256 indexed id, uint256 amount);

    /// @notice Owner balance of an id.
    mapping(address owner =&gt; mapping(uint256 id =&gt; uint256 amount)) public balanceOf;

    /// @notice Spender allowance of an id.
    mapping(address owner =&gt; mapping(address spender =&gt; mapping(uint256 id =&gt; uint256 amount))) public allowance;

    /// @notice Checks if a spender is approved by an owner as an operator.
    mapping(address owner =&gt; mapping(address spender =&gt; bool)) public isOperator;

    /// @notice Transfers an amount of an id from the caller to a receiver.
    /// @param receiver The address of the receiver.
    /// @param id The id of the token.
    /// @param amount The amount of the token.
    function transfer(address receiver, uint256 id, uint256 amount) public returns (bool) {
        if (balanceOf[msg.sender][id] &lt; amount) revert InsufficientBalance(msg.sender, id);
        balanceOf[msg.sender][id] -= amount;
        balanceOf[receiver][id] += amount;
        emit Transfer(msg.sender, msg.sender, receiver, id, amount);
        return true;
    }

    /// @notice Transfers an amount of an id from a sender to a receiver.
    /// @param sender The address of the sender.
    /// @param receiver The address of the receiver.
    /// @param id The id of the token.
    /// @param amount The amount of the token.
    function transferFrom(address sender, address receiver, uint256 id, uint256 amount) public returns (bool) {
        if (sender != msg.sender &amp;&amp; !isOperator[sender][msg.sender]) {
            uint256 senderAllowance = allowance[sender][msg.sender][id];
            if (senderAllowance &lt; amount) revert InsufficientPermission(msg.sender, id);
            if (senderAllowance != type(uint256).max) {
                allowance[sender][msg.sender][id] = senderAllowance - amount;
            }
        }
        if (balanceOf[sender][id] &lt; amount) revert InsufficientBalance(sender, id);
        balanceOf[sender][id] -= amount;
        balanceOf[receiver][id] += amount;
        emit Transfer(msg.sender, sender, receiver, id, amount);
        return true;
    }

    /// @notice Approves an amount of an id to a spender.
    /// @param spender The address of the spender.
    /// @param id The id of the token.
    /// @param amount The amount of the token.
    function approve(address spender, uint256 id, uint256 amount) public returns (bool) {
        allowance[msg.sender][spender][id] = amount;
        emit Approval(msg.sender, spender, id, amount);
        return true;
    }


    /// @notice Sets or removes a spender as an operator for the caller.
    /// @param spender The address of the spender.
    /// @param approved The approval status.
    function setOperator(address spender, bool approved) public returns (bool) {
        isOperator[msg.sender][spender] = approved;
        emit OperatorSet(msg.sender, spender, approved);
        return true;
    }

    /// @notice Checks if a contract implements an interface.
    /// @param interfaceId The interface identifier, as specified in ERC-165.
    /// @return supported True if the contract implements `interfaceId`.
    function supportsInterface(bytes4 interfaceId) public pure returns (bool supported) {
        return interfaceId == 0x0f632fb3 || interfaceId == 0x01ffc9a7;
    }

    function _mint(address receiver, uint256 id, uint256 amount) internal {
      // WARNING: important safety checks should precede calls to this method.
      balanceOf[receiver][id] += amount;
      emit Transfer(msg.sender, address(0), receiver, id, amount);
    }

    function _burn(address sender, uint256 id, uint256 amount) internal {
      // WARNING: important safety checks should precede calls to this method.
      balanceOf[sender][id] -= amount;
      emit Transfer(msg.sender, sender, address(0), id, amount);
    }
}
```

## Security Considerations

### Approvals and Operators

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.

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.

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.

```solidity
contract ERC6909OperatorPrecedence {
  // -- snip --

  function transferFrom(address sender, address receiver, uint256 id, uint256 amount) public {
    // check if `isOperator` first
    if (msg.sender != sender &amp;&amp; !isOperator[sender][msg.sender]) {
      require(allowance[sender][msg.sender][id] &gt;= amount, &quot;insufficient allowance&quot;);
      allowance[sender][msg.sender][id] -= amount;
    }
  
    // -- snip --
  }
}

contract ERC6909AllowancePrecedence {
  // -- snip --

  function transferFrom(address sender, address receiver, uint256 id, uint256 amount) public {
    // check if allowance is sufficient first
    if (msg.sender != sender &amp;&amp; allowance[sender][msg.sender][id] &lt; amount) {
      require(isOperator[sender][msg.sender], &quot;insufficient allowance&quot;);
    }

    // ERROR: when allowance is insufficient, this panics due to arithmetic underflow, regardless of
    // whether the caller has operator permissions.
    allowance[sender][msg.sender][id] -= amount;

    // -- snip
  }
}
```

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Wed, 19 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6909</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6909</guid>
      </item>
    
      <item>
        <title>Subscription-Based Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-subscription-based-erc20-token/13964</comments>
        
        <description>## Abstract

This subscription-based [ERC-20](./eip-20.md) token extends the basic [ERC-20](./eip-20.md) token standard with a `subscribe` and `unsubscribe` function, which allow users to subscribe or unsubscribe from the subscription service. The `subscriptionFee` and `subscriptionFrequency` variables define the cost and frequency of the subscription. The `nextPaymentDate` mapping keeps track of the next payment date for each subscriber.

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.

A `renewSubscription` 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.

## Motivation

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.

The subscription-based [ERC-20](./eip-20.md) 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.

The Subscription Token ensures consistency and interoperability across different implementations. Key features include:

- 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.

- 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.

- 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/downgrade plans, and cancellation policies, providing a versatile foundation for a wide range of subscription-based businesses.

- 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.

## Specification

Below are the implementations required by the standard:


### `SubscriptionToken`

#### `subscribers`

Returns the list of `addresses` subscribed to the subscription token contract.

#### `subscriptionInfo`

Metadata information of the subscription, like - `subscriptionID`, `subscriptionName`, `subscriptionDesc` and `subscriptionTandC`.

#### `subscriptionFee`

The subscription amount specified that will be deducted in `subscriptionFrequency` interval, when an address subscribes to the subscription token contract.

#### `subscriptionFrequency`

Frequency of subscription, interval at which the `subscriptionFee` will be charged. for example, every 1 day, 1 week or 1 month, denoted in seconds.

#### `subscribe`

Method for subscribing an address to the subscription token contract.

#### `unsubscribe`

Revoke subscription from the subscription token contract, by the subscribed address.

```solidity
interface ISubscriptionERC20 {
  /// @dev map subscribers address, returns address(0) if `idx` is not found
  /// @param idx: the key of the map values
  /// @return the address at key `idx` of subscribers map
  function subscribers(uint idx) external view returns (address);

  /// @dev information of the subscription token contract
  /// @return subscriptionID, subscriptionName, subscriptionDesc, subscriptionTandC
  function subscriptionInfo() external view returns ( uint, string memory, string memory, string memory );

  /// @dev subscribes to the subscription, can be payable
  function subscribe() external;

  /// @dev unsubscribe the subscription
  function unsubscribe() external;

  /// @dev view or pure can be used
  /// @return the subscription fee
  function subscriptionFee() external view returns (uint256);

  /// @dev view or pure can be used
  /// @return get the subscription frequency
  function subscriptionFrequency() external view returns (uint);
}
```

## Rationale

The subscription token contract inherits the fundamentals of subscription by deducting payments from subscribed addresses on a regular interval using mathematical formulas.

```
uint256 intervals = ( block.timestamp - info.start ) / info.frequency;
uint256 amount = info.amount * intervals;

uint256 localEffectiveBalance = effectiveBalance[account];

if ( (totalAmount + amount) &gt; localEffectiveBalance ) {
    amount = localEffectiveBalance;
}

totalAmount += ( localEffectiveBalance - amount );
```

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).

## Backwards Compatibility

No backward compatibility issues found.

## Security Considerations

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&apos; private keys and prevent unauthorized access. Encouraging the use of hardware wallets or secure key storage solutions can mitigate the risk of key compromise.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 25 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6932</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6932</guid>
      </item>
    
      <item>
        <title>ERC-5219 Resolve Mode</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-5219-resolve-mode/14088</comments>
        
        <description>## Abstract

This EIP adds a new [ERC-4804](./eip-4804.md) `resolveMode` to resolve [ERC-5219](./eip-5219.md) contract resource requests.

## Specification

The key words &quot;MUST&quot;, &quot;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.

Contracts wishing to use ERC-5219 as their ERC-4804 resolve mode must implement the following interface:

```solidity
/// @dev IDecentralizedApp is the ERC-5219 interface
interface IERC5219Resolver is IDecentralizedApp {
    // @notice The ERC-4804 resolve mode
    // @dev    This MUST return &quot;5219&quot; (0x3532313900000000000000000000000000000000000000000000000000000000) for ERC-5219 resolution (case-insensitive). The other options, as of writing this, are &quot;auto&quot; for automatic resolution, or &quot;manual&quot; for manual resolution.
    function resolveMode() external pure returns (bytes32 mode);
}
```

## Rationale

[ERC-165](./eip-165.md) was not used because interoperability can be checked by calling `resolveMode`.

## Backwards Compatibility

No backward compatibility issues found.


## Reference Implementation

```solidity
abstract contract ERC5219Resolver is IDecentralizedApp {
    function resolveMode() public pure returns (bytes32 mode) {
      return &quot;5219&quot;;
    }
}
```


## Security Considerations

The security considerations of [ERC-4804](./eip-4804.md#security-considerations) and [ERC-5219](./eip-5219.md#security-considerations) apply.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Thu, 27 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6944</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6944</guid>
      </item>
    
      <item>
        <title>Asset-bound Non-Fungible Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-6956-asset-bound-non-fungible-tokens/14056</comments>
        
        <description>## Abstract

This standard allows integrating physical and digital ASSETS without signing capabilities into dApps/web3 by extending [ERC-721](eip-721.md).

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. 

Through an ATTESTATION, an ORACLE testifies that a particular ASSET associated with an ANCHOR has been CONTROLLED when defining the `to`-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.

The proposed ATTESTATION-authorized operations such as `transferAnchor(attestation)` are permissionless, meaning neither the current owner (`from`-address) nor the receiver (`to`-address) need to sign. 

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 `to`-address.

![Figure 1: Sample system](../assets/eip-6956/img/erc6956_concept.svg)

## Motivation

The well-known [ERC-721](eip-721.md) 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.

### The Problem

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&apos;s metadata. Today, people commonly treat an NFT&apos;s metadata (images, traits, ...) as asset-class, with their rarity often directly defining the value of an individual NFT. 

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&apos;s lifecycle, the ASSET&apos;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 *without* enforcably anchoring the ASSET&apos;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&apos;s metadata. 

**NFT-ASSET integrity:** 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.

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, ...)

**Off-chain-on-chain-integrity:** 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.

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.

### ASSET-BOUND NON-FUNGIBLE TOKENS

In this standard we propose to

1. Elevate the concept of representing physical or digital off-chain ASSETS by on-chain ANCHORING the ASSET inseperably into an NFT.
1. Being off-chain in control over the ASSET must mean being on-chain in control over the anchored NFT.
1. (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.

As 2. and 3. indicate, the control/ownership/possession of the ASSET should be the single source of truth, *not* 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;.

We propose to complement the existing transfer control mechanisms of a token according to [ERC-721](eip-721.md) 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 `to` address or beneficiary address has simultaneously been in control over the ASSET. The `to` address of an attestation may be used for Transfers as well as for approvals and other authorizations.

Transactions authorized via ATTESTATION shall not require signature or approval from neither the `from` (donor, owner, sender) nor `to` (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.

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;

- New users, e.g `0xaa...aa` (Fig.1), can use gasless wallets, hence participate in Web3/dApps/DeFi and mint+transfer tokens without ever owning crypto currency. Gas-fees may be paid through a third-party account `0x..gasPayer` (Fig.1). The gas is typically covered by the ASSET issuer, who signs `transferAnchor()` transactions
- 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 `transferAnchor()` transaction based on proofing control over the ASSET, namely the physical object.

### Related work

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Definitions (alphabetical)

- **ANCHOR** uniquely identifies the off-chain ASSET, whether it is physical or digital.
- **ANCHOR-TECHNOLOGY** MUST ensure that
  - the ANCHOR is inseparable from the ASSET (physically or otherwise)
  - an ORACLE can establish PROOF-OF-CONTROL over the ASSET beyond reasonable doubt
  - For physical ASSETS, additional [Security considerations for Physical Assets](#security-considerations-for-physical-assets) MUST be taken into account 

- **ASSET** 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.

- **ATTESTATION** is the confirmation that PROOF OF CONTROL was established when specifying the `to` (receiver, beneficiary) address.

- **PROOF-OF-CONTROL** 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 `to` address.

- An **ORACLE** has signing capabilities. MUST be able to sign ATTESTATIONS off-chain in a way such that signatures can be verified on-chain.


### Base Interface

Every contract compliant to this standard MUST implement the [the proposed standard interface](../assets/eip-6956/contracts/IERC6956.sol), [ERC-721](eip-721.md) and [ERC-165](eip-165.md) interfaces and is subject to [Caveats](#caveats-for-base-interface) below:

```solidity
// SPDX-License-Identifier: MIT OR CC0-1.0
pragma solidity ^0.8.18;

/**
 * @title IERC6956 Asset-Bound Non-Fungible Tokens 
 * @notice 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
 * @dev See https://eips.ethereum.org/EIPS/eip-6956
 *      Note: The ERC-165 identifier for this interface is 0xa9cf7635
 */
interface IERC6956 {
   
    /** @dev Authorization, typically mapped to authorizationMaps, where each bit indicates whether a particular ERC6956Role is authorized 
     *      Typically used in constructor (hardcoded or params) to set burnAuthorization and approveAuthorization
     *      Also used in optional updateBurnAuthorization, updateApproveAuthorization, I
     */ 
    enum Authorization {
        NONE,               // = 0,      // None of the above
        OWNER,              // = (1&lt;&lt;OWNER), // The owner of the token, i.e. the digital representation
        ISSUER,             // = (1&lt;&lt;ISSUER), // The issuer of the tokens, i.e. this smart contract
        ASSET,              // = (1&lt;&lt;ASSET), // The asset, i.e. via attestation
        OWNER_AND_ISSUER,   // = (1&lt;&lt;OWNER) | (1&lt;&lt;ISSUER),
        OWNER_AND_ASSET,    // = (1&lt;&lt;OWNER) | (1&lt;&lt;ASSET),
        ASSET_AND_ISSUER,   // = (1&lt;&lt;ASSET) | (1&lt;&lt;ISSUER),
        ALL                 // = (1&lt;&lt;OWNER) | (1&lt;&lt;ISSUER) | (1&lt;&lt;ASSET) // Owner + Issuer + Asset
    }
    
    /**
     * @notice This emits when approved address for an anchored tokenId is changed or reaffirmed via attestation
     * @dev This emits when approveAnchor() is called and corresponds to ERC-721 behavior
     * @param owner The owner of the anchored tokenId
     * @param approved The approved address, address(0) indicates there is no approved address
     * @param anchor The anchor, for which approval has been changed
     * @param tokenId ID (&gt;0) of the anchored token
     */
    event AnchorApproval(address indexed owner, address approved, bytes32 indexed anchor, uint256 tokenId);

    /**
     * @notice This emits when the ownership of any anchored NFT changes by any mechanism
     * @dev This emits together with tokenId-based ERC-721.Transfer and provides an anchor-perspective on transfers
     * @param from The previous owner, address(0) indicate there was none.
     * @param to The new owner, address(0) indicates the token is burned
     * @param anchor The anchor which is bound to tokenId
     * @param tokenId ID (&gt;0) of the anchored token
     */
    event AnchorTransfer(address indexed from, address indexed to, bytes32 indexed anchor, uint256 tokenId);
    /**
     * @notice This emits when an attestation has been used indicating no second attestation with the same attestationHash will be accepted
     * @param to The to address specified in the attestation
     * @param anchor The anchor specified in the attestation
     * @param attestationHash The hash of the attestation, see ERC-6956 for details
     * @param totalUsedAttestationsForAnchor The total number of attestations already used for the particular anchor
     */
    event AttestationUse(address indexed to, bytes32 indexed anchor, bytes32 indexed attestationHash, uint256 totalUsedAttestationsForAnchor);

    /**
     * @notice This emits when the trust-status of an oracle changes. 
     * @dev Trusted oracles must explicitly be specified. 
     *      If the last event for a particular oracle-address indicates it&apos;s trusted, attestations from this oracle are valid.
     * @param oracle Address of the oracle signing attestations
     * @param trusted indicating whether this address is trusted (true). Use (false) to no longer trust from an oracle.
     */
    event OracleUpdate(address indexed oracle, bool indexed trusted);

    /**
     * @notice Returns the 1:1 mapped anchor for a tokenId
     * @param tokenId ID (&gt;0) of the anchored token
     * @return anchor The anchor bound to tokenId, 0x0 if tokenId does not represent an anchor
     */
    function anchorByToken(uint256 tokenId) external view returns (bytes32 anchor);
    /**
     * @notice Returns the ID of the 1:1 mapped token of an anchor.
     * @param anchor The anchor (&gt;0x0)
     * @return tokenId ID of the anchored token, 0 if no anchored token exists
     */
    function tokenByAnchor(bytes32 anchor) external view returns (uint256 tokenId);

    /**
     * @notice The number of attestations already used to modify the state of an anchor or its bound tokens
     * @param anchor The anchor(&gt;0)
     * @return attestationUses The number of attestation uses for a particular anchor, 0 if anchor is invalid.
     */
    function attestationsUsedByAnchor(bytes32 anchor) view external returns (uint256 attestationUses);
    /**
     * @notice Decodes and returns to-address, anchor and the attestation hash, if the attestation is valid
     * @dev MUST throw when
     *  - Attestation has already been used (an AttestationUse-Event with matching attestationHash was emitted)
     *  - Attestation is not signed by trusted oracle (the last OracleUpdate-Event for the signer-address does not indicate trust)
     *  - Attestation is not valid yet or expired
     *  - [if IERC6956AttestationLimited is implemented] attestationUsagesLeft(attestation.anchor) &lt;= 0
     *  - [if IERC6956ValidAnchors is implemented] validAnchors(data) does not return true. 
     * @param attestation The attestation subject to the format specified in ERC-6956
     * @param data Optional additional data, may contain proof as the first abi-encoded argument when IERC6956ValidAnchors is implemented
     * @return to Address where the ownership of an anchored token or approval shall be changed to
     * @return anchor The anchor (&gt;0)
     * @return attestationHash The attestation hash computed on-chain as `keccak256(attestation)`
     */
    function decodeAttestationIfValid(bytes memory attestation, bytes memory data) external view returns (address to, bytes32 anchor, bytes32 attestationHash);

    /**
     * @notice Indicates whether any of ASSET, OWNER, ISSUER is authorized to burn
     */
    function burnAuthorization() external view returns(Authorization burnAuth);

    /**
     * @notice Indicates whether any of ASSET, OWNER, ISSUER is authorized to approve
     */
    function approveAuthorization() external view returns(Authorization approveAuth);

    /**
     * @notice Corresponds to transferAnchor(bytes,bytes) without additional data
     * @param attestation Attestation, refer ERC-6956 for details
     */
    function transferAnchor(bytes memory attestation) external;

    /**
     * @notice Changes the ownership of an NFT mapped to attestation.anchor to attestation.to address.
     * @dev Permissionless, i.e. anybody invoke and sign a transaction. The transfer is authorized through the oracle-signed attestation.
     *  - Uses decodeAttestationIfValid()
     *  - When using a centralized &quot;gas-payer&quot; recommended to implement IERC6956AttestationLimited.
     *  - Matches the behavior of ERC-721.safeTransferFrom(ownerOf[tokenByAnchor(attestation.anchor)], attestation.to, tokenByAnchor(attestation.anchor), ..) and mint an NFT if `tokenByAnchor(anchor)==0`.
     *  - Throws when attestation.to == ownerOf(tokenByAnchor(attestation.anchor))
     *  - Emits AnchorTransfer  
     *  
     * @param attestation Attestation, refer ERC-6956 for details
     * @param data Additional data, may be used for additional transfer-conditions, may be sent partly or in full in a call to safeTransferFrom
     * 
     */
    function transferAnchor(bytes memory attestation, bytes memory data) external;

     /**
     * @notice Corresponds to approveAnchor(bytes,bytes) without additional data
     * @param attestation Attestation, refer ERC-6956 for details
     */
    function approveAnchor(bytes memory attestation) external;

     /**
     * @notice Approves attestation.to the token bound to attestation.anchor. .
     * @dev Permissionless, i.e. anybody invoke and sign a transaction. The transfer is authorized through the oracle-signed attestation.
     *  - Uses decodeAttestationIfValid()
     *  - When using a centralized &quot;gas-payer&quot; recommended to implement IERC6956AttestationLimited.
     *  - Matches the behavior of ERC-721.approve(attestation.to, tokenByAnchor(attestation.anchor)).
     *  - Throws when ASSET is not authorized to approve.
     * 
     * @param attestation Attestation, refer ERC-6956 for details 
     */
    function approveAnchor(bytes memory attestation, bytes memory data) external;

    /**
     * @notice Corresponds to burnAnchor(bytes,bytes) without additional data
     * @param attestation Attestation, refer ERC-6956 for details
     */
    function burnAnchor(bytes memory attestation) external;
   
    /**
     * @notice Burns the token mapped to attestation.anchor. Uses ERC-721._burn.
     * @dev Permissionless, i.e. anybody invoke and sign a transaction. The transfer is authorized through the oracle-signed attestation.
     *  - Uses decodeAttestationIfValid()
     *  - When using a centralized &quot;gas-payer&quot; recommended to implement IERC6956AttestationLimited.
     *  - Throws when ASSET is not authorized to burn
     * 
     * @param attestation Attestation, refer ERC-6956 for details
     */
    function burnAnchor(bytes memory attestation, bytes memory data) external;
}
```

#### Caveats for Base Interface

- MUST implement ERC-721 and ERC-165
- MUST have bidirectional mapping `tokenByAnchor(anchor)` and `anchorByToken(tokenId)`. This implies that a maximum of one token per ANCHOR exists.
- MUST have a mechanism to determine whether an ANCHOR is valid for the contract. RECOMMENDED to implement the proposed [ValidAnchors-Interface](#validanchors-interface)
- MUST implement `decodeAttestationIfValid(attestation, data)` to validate and decode ATTESTATIONS as specified in the [ORACLE-Section](#oracle)
  - MUST return `attestation.to`, `attestation.anchor`, `attestation.attestationHash`.
  - MUST not modify state, as this function can be used to check an ATTESTATION&apos;s validity without redeeming it.
  - MUST throw when
    - ATTESTATION is not signed from a trusted ORACLE.
    - ATTESTATION has expired or is not valid yet
    - ATTESTATION has not been redeemed. &quot;Redeemed&quot; being defined in at least one state-changing operation has been authorized through a particular ATTESTATION.
    - If [AttestationLimited-Interface](#attestationlimited-interface) implemented: When `attestationUsagesLeft(attestation.to) &lt;= 0`  
    - If [ValidAnchors-Interface](#validanchors-interface) implemented: When `validAnchor() != true`.
  - If [ValidAnchors-Interface](#validanchors-interface) implemented: MUST call `validAnchor(attestation.to, abi.decode(&apos;bytes32[]&apos;,data))`, meaning the first abi-encoded value in the `data` parameter corresponds to `proof`.
- MUST have a ANCHOR-RELEASED mechanism, indicating whether the anchored NFT is released/transferable. 
  - Any ANCHOR MUST NOT be released by default.
- MUST extend any ERC-721 token transfer mechanism by:
  - MUST throw when `ANCHOR` is not released.
  - MUST throw when batchSize &gt; 1, namely no batch transfers are supported with this contract.
  - MUST emit `AnchorTransfer(from, to, anchorByToken[tokenId], tokenId)`

- MUST implement `attestationsUsedByAnchor(anchor)`, returning how many attestations have already been used for a specific anchor.

- MUST implement the state-changing `transferAnchor(..)`, `burnAnchor(..)`, `approveAnchor(..)` and OPTIONAL MAY implement additional state-changing operations which
  - MUST use the `decodeAttestationIfValid()` to determine `to`, `anchor` and `attestationHash`
  - MUST redeem each ATTESTATION in the same transaction as any authorized state-changing operation. RECOMMENDED by storing each used `attestationHash`
  - MUST increment `attestationsUsedByAnchor[anchor]`
  - MUST emit `AttestationUsed`
  - `transferAnchor(attestation)` MUST behave and emit events like `ERC-721.safeTransferFrom(ownerOf[tokenByAnchor(attestation.anchor)], attestation.to, tokenByAnchor(attestation.anchor), ..)` and mint an NFT if `tokenByAnchor(anchor)==0`.
 
- RECOMMENDED to implement `tokenURI(tokenId)` to return an anchorBased-URI, namely `baseURI/anchor`. This anchoring metadata to ASSET. Before an anchor is not used for the first time, the ANCHOR&apos;s mapping to tokenId is unknown. Hence, using the anchor in instead of the tokenId is preferred.


### ORACLE

- MUST provide an ATTESTATION. Below we define the format how an ORACLE testifies that the `to` address of a transfer has been specified under the pre-condition of PROOF-OF-CONTROL associated with the particular ANCHOR being transferred to `to`.
- The ATTESTATION MUST abi-encode the following:
  - `to`, MUST be address, specifying the beneficiary, for example the to-address, approved account etc.
  - ANCHOR, aka the ASSET identifier, MUST have a 1:1 relation to the ASSET
  - `attestationTime`, UTC seconds, time when attestation was signed by ORACLE,
  - `validStartTime` UTC seconds, start time of the ATTESTATION&apos;s validity timespan
  - `validEndTime`, UTC seconds, end time of the ATTESTATION&apos;s validity timespan
  - `signature`, ETH-signature (65 bytes). Output of an ORACLE signing the `attestationHash = keccak256([to, anchor, attestationTime, validStartTime, validEndTime])`.
- 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 [Security considerations for Physical Assets](#security-considerations-for-physical-assets).

A Minimal Typescript sample to generate an ATTESTATION is available in the [Reference Implementation section](#reference-implementation) of this proposal.

### AttestationLimited-Interface

Every contract compliant to this standard MAY implement the [proposed AttestationLimited interface](../assets/eip-6956/contracts/IERC6956AttestationLimited.sol) and is subject to [Caveats](#caveats-for-attestationlimited-interface) below:

```solidity
// SPDX-License-Identifier: MIT OR CC0-1.0
pragma solidity ^0.8.18;
import &quot;./IERC6956.sol&quot;;

/**
 * @title Attestation-limited Asset-Bound NFT
 * @dev See https://eips.ethereum.org/EIPS/eip-6956
 *      Note: The ERC-165 identifier for this interface is 0x75a2e933
 */
interface IERC6956AttestationLimited is IERC6956 {
  enum AttestationLimitPolicy {
    IMMUTABLE,
    INCREASE_ONLY,
    DECREASE_ONLY,
    FLEXIBLE
  }
      
  /// @notice Returns the attestation limit for a particular anchor
  /// @dev MUST return the global attestation limit per default
  ///      and override the global attestation limit in case an anchor-based limit is set
  function attestationLimit(bytes32 anchor) external view returns (uint256 limit);

  /// @notice Returns number of attestations left for a particular anchor
  /// @dev Is computed by comparing the attestationsUsedByAnchor(anchor) and the current attestation limit 
  ///      (current limited emitted via GlobalAttestationLimitUpdate or AttestationLimit events)
  function attestationUsagesLeft(bytes32 anchor) external view returns (uint256 nrTransfersLeft);

  /// @notice Indicates the policy, in which direction attestation limits can be updated (globally or per anchor)
  function attestationLimitPolicy() external view returns (AttestationLimitPolicy policy);

  /// @notice This emits when the global attestation limit is updated
  event GlobalAttestationLimitUpdate(uint256 indexed transferLimit, address updatedBy);

  /// @notice This emits when an anchor-specific attestation limit is updated
  event AttestationLimitUpdate(bytes32 indexed anchor, uint256 indexed tokenId, uint256 indexed transferLimit, address updatedBy);

  /// @dev This emits in the transaction, where attestationUsagesLeft becomes 0
  event AttestationLimitReached(bytes32 indexed anchor, uint256 indexed tokenId, uint256 indexed transferLimit);
}
```

#### Caveats for AttestationLimited-Interface

- MUST extend the proposed standard interface
- MUST define one of the above listed AttestationLimit update policies and expose it via `attestationLimitPolicy()`
  - MUST support different update modes, namely FIXED, INCREASE_ONLY, DECREASE_ONLY, FLEXIBLE (= INCREASABLE and DECREASABLE)
  - RECOMMENDED to have a global transfer limit, which can be overwritten on a token-basis (when `attestationLimitPolicy() != FIXED`)
- MUST implement `attestationLimit(anchor)`, specifying how often an ANCHOR can be transferred in total. Changes in the return value MUST reflect the AttestationLimit-Policy.
- MUST implement `attestationUsagesLeft(anchor)`, returning the number of usages left (namely `attestationLimit(anchor)-attestationsUsedByAnchor[anchor]`) for a particular anchor


### Floatable-Interface

Every contract compliant to this extension MAY implement the proposed [Floatable interface](../assets/eip-6956/contracts/IERC6956Floatable.sol) and is subject to [Caveats](#caveats-for-floatable-interface) below:

```solidity
// SPDX-License-Identifier: MIT OR CC0-1.0
pragma solidity ^0.8.18;
import &quot;./IERC6956.sol&quot;;

/**
 * @title Floatable Asset-Bound NFT
 * @notice A floatable Asset-Bound NFT can (temporarily) be transferred without attestation
 * @dev See https://eips.ethereum.org/EIPS/eip-6956
 *      Note: The ERC-165 identifier for this interface is 0xf82773f7
 */
interface IERC6956Floatable is IERC6956 {
  enum FloatState {
    Default, // 0, inherits from floatAll
    Floating, // 1
    Anchored // 2
  }

  /// @notice Indicates that an anchor-specific floating state changed
  event FloatingStateChange(bytes32 indexed anchor, uint256 indexed tokenId, FloatState isFloating, address operator);
  /// @notice Emits when FloatingAuthorization is changed.
  event FloatingAuthorizationChange(Authorization startAuthorization, Authorization stopAuthorization, address maintainer);
  /// @notice Emits, when the default floating state is changed
  event FloatingAllStateChange(bool areFloating, address operator);

  /// @notice Indicates whether an anchored token is floating, namely can be transferred without attestation
  function floating(bytes32 anchor) external view returns (bool);
  
  /// @notice Indicates whether any of OWNER, ISSUER, (ASSET) is allowed to start floating
  function floatStartAuthorization() external view returns (Authorization canStartFloating);
  
  /// @notice Indicates whether any of OWNER, ISSUER, (ASSET) is allowed to stop floating
  function floatStopAuthorization() external view returns (Authorization canStartFloating);

  /**
    * @notice Allows to override or reset to floatAll-behavior per anchor
    * @dev Must throw when newState == Floating and floatStartAuthorization does not authorize msg.sender
    * @dev Must throw when newState == Anchored and floatStopAuthorization does not authorize msg.sender
    * @param anchor The anchor, whose anchored token shall override default behavior
    * @param newState Override-State. If set to Default, the anchor will behave like floatAll
    */
  function float(bytes32 anchor, FloatState newState) external;    
}
```


#### Caveats for Floatable-Interface

If `floating(anchor)` returns true, the token identified by `tokenByAnchor(anchor)` MUST be transferable without attestation, typically authorized via `ERC721.isApprovedOrOwner(msg.sender, tokenId)` 

### ValidAnchors-Interface

Every contract compliant to this extension MAY implement the proposed [ValidAnchors interface](../assets/eip-6956/contracts/IERC6956ValidAnchors.sol) and is subject to [Caveats](#caveats-for-validanchors-interface) below:

```solidity
// SPDX-License-Identifier: MIT OR CC0-1.0
pragma solidity ^0.8.18;
import &quot;./IERC6956.sol&quot;;

/**
 * @title Anchor-validating Asset-Bound NFT
 * @dev See https://eips.ethereum.org/EIPS/eip-6956
 *      Note: The ERC-165 identifier for this interface is 0x051c9bd8
 */
interface IERC6956ValidAnchors is IERC6956 {
    /**
     * @notice Emits when the valid anchors for the contract are updated.
     * @param validAnchorHash Hash representing all valid anchors. Typically Root of Merkle-Tree
     * @param maintainer msg.sender when updating the hash
     */
    event ValidAnchorsUpdate(bytes32 indexed validAnchorHash, address indexed maintainer);

    /**
     * @notice Indicates whether an anchor is valid in the present contract
     * @dev Typically implemented via MerkleTrees, where proof is used to verify anchor is part of the MerkleTree 
     *      MUST return false when no ValidAnchorsUpdate-event has been emitted yet
     * @param anchor The anchor in question
     * @param proof Proof that the anchor is valid, typically MerkleProof
     * @return isValid True, when anchor and proof can be verified against validAnchorHash (emitted via ValidAnchorsUpdate-event)
     */
    function anchorValid(bytes32 anchor, bytes32[] memory proof) external view returns (bool isValid);        
}
```

#### Caveats for ValidAnchors-Interface

- MUST implement `validAnchor(anchor, proof)` which returns true when anchor is valid, namely MerkleProof is correct, false otherwise.


## Rationale

**Why do you use an anchor&lt;&gt;tokenId mapping and not simply use tokenIds directly?**
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 [Security considerations](#security-considerations) on why sequential anchors shall be avoided.

**Why is tokenId=0 and anchor=0x0 invalid?**
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.

**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?**
Even if a (physical) ASSET is mass produced with fungible characteristics, each ASSET has an individual property/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.

**Why is there a burnAnchor() and approveAnchor()?**
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.

**Implementation alternatives considered** Soulbound burn+mint combination, for example through Consensual Soulbound Tokens ([ERC-5484](eip-5484.md)). 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 `0xd04c443913f9ddcfea72c38fed2d128a3ecd719e`.

**When should I implement AttestationLimited-Interface**
Naturally, when your use-case requires each ASSET being transferable only a limited number of times. But also for security reasons, see [Security Considerations](#security-considerations)

**Why is there the `IERC6956Floatable.FloatState` enum?** 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).

**Why is there no `floating(tokenId)` function?**
This would behave identically to an `isTransferable(tokenId,...)` mechanism proposed in many other EIPs (refer e.g. [ERC-6454](eip-6454.md)). Further, the proposed `floating(anchorByToken(tokenId))` can be used.

**Why are there different FloatingAuthorizations for start and stop?**
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.


### Example Use Cases and recommended combination of interfaces

Possession based use cases are covered by the standard interface `IERC6956`: 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

- **Possession based token gating:** Club guest in possession of limited T-Shirt (ASSET) gets a token which allows him to open the door to the VIP lounge.

- **Possession based digital twin:** A gamer is in possession of a pair of physical sneakers (ASSET), and gets a digital twin (NFT) to wear them in metaverse.

- **Scarce possession based digital twin:** The producer of the sneakers (ASSET) decided that the product includes a limit of 5 digital twins (NFTs), to create scarcity.

- **Lendable digital twin:** The gamer can lend his sneaker-tokens (NFT) to a friend in the metaverse, so that the friend can run faster.

- **Securing ownership from theft:** 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.

- **Selling a house with a mortgage:** 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&apos;s no longer possible to finance the house.

- **Selling a house with a lease:** A lease contract puts a lien on an ASSET&apos;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.

- **Buying a brand new car with downpayment:** 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.

- **Buying a barrel of oil by forward transaction:** 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.

The use case matrix below shows which extensions and settings must (additionally to `IERC6956`!) be implemented for the example use-cases together with relevant configurations.

Note that for `Lockable` 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 [ERC-5192](eip-5192.md) or [ERC-6982](eip-6982.md). We recommend to verify whether a token is locked in the `_beforeTokenTransfer()`-hook, as this is called from `safeTransferFrom()` as well as `transferAnchor()`, hence suitable to block &quot;standard&quot; ERC-721 transfers as well as the proposed attestation-based transfers.

| Use Case | approveAuthorization | burnAuthorization | `IERC6956Floatable` | `IERC6956AttestationLimited` | Lockable |
|---------------|---|---|---|---|---|
| **Managing Possession** |
| Token gating  | ASSET | ANY | incompatible | - | - |
| Digital twin  | ASSET | ANY | incompatible | - | - |
| Scarce digital twin | ASSET | ANY | incompatible | required | - |
| Lendable digital twin         | OWNER_AND_ASSET | ASSET | required | - | - |
| **Managing Ownership** |
| Securing ownership from theft   | OWNER or OWNER_AND_ASSET | ANY | optional | - | required |
| Selling an house with a mortgage  | ASSET  or OWNER_AND_ASSET | ANY | optional | optional | required |
| Selling a house with a lease | ASSET or OWNER_AND_ASSET | ANY | optional | optional | required |
| Buying a brand new car with downpayment | ASSET or OWNER_AND_ASSET | ANY | optional | optional | required |
| Buying a barrel of oil by forward transaction | ASSET or OWNER_AND_ASSET | ANY | optional | optional | required |

Legend:

- required ... we don&apos;t see a way how to implement the use-case without it
- incompatible ... this MUSTN&apos;T be implemented, as it is a security risk for the use-case
- optional ... this MAY optionally be implemented

## Backwards Compatibility

No backward compatibility issues found. 

This EIP is fully compatible with ERC-721 and (when extended with the `IERC6956Floatable`-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.

However, it is RECOMMENDED to extend implementations of the proposed standard with an interface indicating transferability of NFTs for market places. Examples include [ERC-6454](eip-6454.md) and [ERC-5484](eip-5484.md).

Many ERC-721 extensions suggest to add additional throw-conditions to transfer methods. This standard is fully compatible, as

- The often-used ERC-721 `_beforeTokenTransfer()` hook must be called for all transfers including attestation-authorized transfers.
- A `_beforeAnchorUse()` hook is suggested in the reference implementation, which only is called when using attestation as authorization.

## Test Cases

Test cases are available:

- For only implementing [the proposed standard interface](../assets/eip-6956/contracts/IERC6956.sol) can be found [here](../assets/eip-6956/test/ERC6956.ts)
- For implementing [the proposed standard interface](../assets/eip-6956/contracts/IERC6956.sol), [the Floatable extension](../assets/eip-6956/contracts/IERC6956Floatable.sol), [the ValidAnchors extension](../assets/eip-6956/contracts/IERC6956ValidAnchors.sol) and [the AttestationLimited extension](../assets/eip-6956/contracts/IERC6956AttestationLimited.sol) can be found [here](../assets/eip-6956/test/ERC6956Full.ts)

## Reference Implementation

- Minimal implementation, only supporting [the proposed standard interface](../assets/eip-6956/contracts/IERC6956.sol) can be found [here](../assets/eip-6956/contracts/ERC6956.sol)
- Full implementation, with support for [the proposed standard interface](../assets/eip-6956/contracts/IERC6956.sol), [the Floatable extension](../assets/eip-6956/contracts/IERC6956Floatable.sol), [the ValidAnchors extension](../assets/eip-6956/contracts/IERC6956ValidAnchors.sol) and [the AttestationLimited extension](../assets/eip-6956/contracts/IERC6956AttestationLimited.sol) can be found [here](../assets/eip-6956/contracts/ERC6956Full.sol)
- A Minimal Typescript sample to generate an ATTESTATION using ethers library is available [here](../assets/eip-6956/minimalAttestationSample.ts)

## Security Considerations

**If the asset is stolen, does this mean the thief has control over the NFT?**
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).

**How to use AttestationLimits to avoid fund-draining**
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.

**Why do you recommend hashing serial numbers over using them plain?**
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/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/encryption of the serial number.

**Why is anchor-validation needed, why not simply trust the oracle to attest only valid anchors?**
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. 

**Why do you use merkle-trees for anchor-validation?**
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. 

**Assume you have N anchors. If all anchored NFTs are minted, what use is a merkle-tree?**
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 

### Security Considerations for PHYSICAL ASSETS

In case the ASSET is a physical object, good or property, the following ADDITIONAL specifications MUST be satisfied:

#### ORACLE for Physical Anchors

- Issuing an ATTESTATION requires that the ORACLE
  - MUST proof physical proximity between an input device (for example smartphone) specifying the `to` address and a particular physical ANCHOR and it&apos;s associated physical object. Typical acceptable proximity is ranges between some millimeters to several meters.
  - The physical presence MUST be verified beyond reasonable doubt, in particular the employed method
    - MUST be robust against duplication or reproduction attempts of the physical ANCHOR,
    - MUST be robust against spoofing (for example presentation attacks) etc.
  - MUST be implemented under the assumption that the party defining the `to` address has malicious intent and to acquire false ATTESTATION, without currently or ever having access to the physical object comprising the physical ANCHOR.

#### Physical ASSET

- MUST comprise an ANCHOR, acting as the unique physical object identifier, typically a serial number (plain (NOT RECOMMENDED) or hashed (RECOMMENDED))
- MUST comprise a physical security device, marking or any other feature that enables proofing physical presence for ATTESTATION through the ORACLE
- Is RECOMMENDED to employ ANCHOR-TECHNOLOGIES featuring irreproducible security features.
- 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sat, 29 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6956</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6956</guid>
      </item>
    
      <item>
        <title>Dual Layer Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-6960-dual-layer-token/14070</comments>
        
        <description>## Abstract

The dual-layer token combines the functionalities of [ERC-20](./eip-20.md), [ERC-721](./eip-721.md), and [ERC-1155](./eip-1155.md) while adding a classification layer that uses `mainId` as the main asset type identifier and `subId` as the unique attributes or variations of the main asset.
![Dual Layer Token](../assets/eip-6960/eip-6960-dual-layer-token-dlt.png)

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.

The following are examples of assets that the DLT standard can represent fractional ownership of:

- Invoices
- Company stocks
- Digital collectibles
- Real estate

## Motivation

The [ERC-1155](./eip-1155.md) 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.

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### DLT Interface

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.17;

/**
 * @title DLT token standard interface
 * @dev Interface for any contract that wants to implement the DLT standard
 */
interface IDLT {

    /**
     * @dev MUST emit when `subId` token is transferred from `sender` to `recipient`
     * @param sender is the address of the previous holder whose balance is decreased
     * @param recipient is the address of the new holder whose balance is increased
     * @param mainId is the main token type ID to be transferred
     * @param subId is the token subtype ID to be transferred
     * @param amount is the amount to be transferred of the token subtype
     */
    event Transfer(
        address indexed sender,
        address indexed recipient,
        uint256 indexed mainId,
        uint256 subId,
        uint256 amount
    );

    /**
     * @dev MUST emit when `subIds` token array is transferred from `sender` to `recipient`
     * @param sender is the address of the previous holder whose balance is decreased
     * @param recipient is the address of the new holder whose balance is increased
     * @param mainIds is the main token type ID array to be transferred
     * @param subIds is the token subtype ID array to be transferred
     * @param amounts is the amount array to be transferred of the token subtype                
    */
    event TransferBatch(
        address indexed sender,
        address indexed recipient,
        uint256[] mainIds,
        uint256[] subIds,
        uint256[] amounts
    );

    /**
     * @dev MUST emit when `owner` enables `operator` to manage the `subId` token
     * @param owner is the address of the token owner
     * @param operator is the authorized address to manage the allocated amount for an owner address 
     * @param mainId is the main token type ID to be approved
     * @param subId is the token subtype ID to be approved
     * @param amount is the amount to be approved of the token subtype
     */
    event Approval(
        address indexed owner,
        address indexed operator,
        uint256 mainId,
        uint256 subId,
        uint256 amount
    );

    /**
     * @dev MUST emit when `owner` enables or disables (`approved`) `operator` to manage all of its assets
     * @param owner is the address of the token owner
     * @param operator is the authorized address to manage all tokens for an owner address
     * @param approved true if the operator is approved, false to revoke approval
     */
    event ApprovalForAll(
        address indexed owner,
        address indexed operator,
        bool approved
    );
    
    /**
     * @dev MUST emit when the URI is updated for a main token type ID.
     * URIs are defined in RFC 3986.
     * The URI MUST point to a JSON file that conforms to the &quot;DLT Metadata URI JSON Schema&quot;.
     * @param oldValue is the old URI value
     * @param newValue is the new URI value
     * @param mainId is the main token type ID
     */
    event URI(string oldValue, string newValue, uint256 indexed mainId);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any subId owned by the caller.
     * The `operator` MUST NOT be the caller.
     * MUST emit an {ApprovalForAll} event.     
     * @param operator is the authorized address to manage all tokens for an owner address
     * @param approved true if the operator is approved, false to revoke approval
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller&apos;s
     * allowance.
     * MUST revert if `sender` or `recipient` is the zero address.
     * MUST revert if balance of holder for token `subId` is lower than the `amount` sent.
     * MUST emit a {Transfer} event.
     * @param sender is the address of the previous holder whose balance is decreased
     * @param recipient is the address of the new holder whose balance is increased
     * @param mainId is the main token type ID to be transferred
     * @param subId is the token subtype ID to be transferred
     * @param amount is the amount to be transferred of the token subtype
     * @param data is additional data with no specified format
     * @return True if the operation succeeded, false if operation failed
     */
    function safeTransferFrom(
        address sender,
        address recipient,
        uint256 mainId,
        uint256 subId,
        uint256 amount,
        bytes calldata data
    ) external returns (bool);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller&apos;s tokens.
     * The `operator` MUST NOT be the caller.
     * MUST revert if `operator` is the zero address.
     * MUST emit an {Approval} event.
     * @param operator is the authorized address to manage tokens for an owner address
     * @param mainId is the main token type ID to be approved
     * @param subId is the token subtype ID to be approved
     * @param amount is the amount to be approved of the token subtype
     * @return True if the operation succeeded, false if operation failed
     */
    function approve(
        address operator,
        uint256 mainId,
        uint256 subId,
        uint256 amount
    ) external returns (bool);

    /**
     * @notice Get the token with a particular subId balance of an `account`
     * @param account is the address of the token holder
     * @param mainId is the main token type ID
     * @param subId is the token subtype ID
     * @return The amount of tokens owned by `account` in subId
     */
    function subBalanceOf(
        address account,
        uint256 mainId,
        uint256 subId
    ) external view returns (uint256);

    /**
     * @notice Get the tokens with a particular subIds balance of an `accounts` array
     * @param accounts is the address array of the token holder
     * @param mainIds is the main token type ID array
     * @param subIds is the token subtype ID array
     * @return The amount of tokens owned by `accounts` in subIds
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata mainIds,
        uint256[] calldata subIds
    ) external view returns (uint256[] calldata);

    /** 
     * @notice Get the allowance allocated to an `operator`
     * @dev This value changes when {approve} or {transferFrom} are called
     * @param owner is the address of the token owner
     * @param operator is the authorized address to manage assets for an owner address
     * @param mainId is the main token type ID
     * @param subId is the token subtype ID
     * @return The remaining number of tokens that `operator` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     */
    function allowance(
        address owner,
        address operator,
        uint256 mainId,
        uint256 subId
    ) external view returns (uint256);

    /**
     * @notice Get the approval status of an `operator` to manage assets
     * @param owner is the address of the token owner
     * @param operator is the authorized address to manage assets for an owner address
     * @return True if the `operator` is allowed to manage all of the assets of `owner`, false if approval is revoked
     * See {setApprovalForAll}
     */
    function isApprovedForAll(
        address owner,
        address operator
    ) external view returns (bool);
}
```

### `DLTReceiver` Interface

Smart contracts MUST implement all the functions in the `DLTReceiver` interface to accept transfers.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity 0.8.17;

/**
 * @title DLT token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from DLT asset contracts.
 */
interface IDLTReceiver {
    /**
     * @notice Handle the receipt of a single DLT token type.
     * @dev Whenever an {DLT} `subId` token is transferred to this contract via {IDLT-safeTransferFrom}
     * by `operator` from `sender`, this function is called.
     * MUST return its Solidity selector to confirm the token transfer.
     * MUST revert if any other value is returned or the interface is not implemented by the recipient.
     * The selector can be obtained in Solidity with `IDLTReceiver.onDLTReceived.selector`.
     * @param operator is the address which initiated the transfer
     * @param from is the address which previously owned the token
     * @param mainId is the main token type ID being transferred
     * @param subId subId is the token subtype ID being transferred
     * @param amount is the amount of tokens being transferred
     * @param data is additional data with no specified format
     * @return `IDLTReceiver.onDLTReceived.selector`
     */
    function onDLTReceived(
        address operator,
        address from,
        uint256 mainId,
        uint256 subId,
        uint256 amount,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @notice Handle the receipts of a DLT token type array.
     * @dev Whenever an {DLT} `subIds` token is transferred to this contract via {IDLT-safeTransferFrom}
     * by `operator` from `sender`, this function is called.
     * MUST return its Solidity selector to confirm the token transfers.
     * MUST revert if any other value is returned or the interface is not implemented by the recipient.
     * The selector can be obtained in Solidity with `IDLTReceiver.onDLTReceived.selector`.
     * @param operator is the address which initiated the transfer
     * @param from is the address which previously owned the token
     * @param mainIds is the main token type ID being transferred
     * @param subIds subId is the token subtype ID being transferred
     * @param amounts is the amount of tokens being transferred
     * @param data is additional data with no specified format
     * @return `IDLTReceiver.onDLTReceived.selector`
     */
    function onDLTBatchReceived(
        address operator,
        address from,
        uint256[] calldata mainIds,
        uint256[] calldata subIds,
        uint256[] calldata amounts,
        bytes calldata data
    ) external returns (bytes4);
}
```

## Rationale

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.

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.

The contract can be extended to support the use of subIds in two ways:

- Shared SubIds: where all mainIds share the same set of subIds.
- Mixed SubIds: where mainIds have unique sets of subIds.

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.

The following are questions that we considered during the design process:

- 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.
- 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.
- 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.

## Backwards Compatibility

No backward compatibility issues found.

## Test Cases

The test suite covers:

- Minting tokens with specific `mainId` and `subId` combinations and verifying `subBalanceOf` reflects correct amounts
- Batch balance queries via `balanceOfBatch` with array parity validation
- `safeTransferFrom` between EOAs with balance and allowance checks
- `safeTransferFrom` to contract recipients implementing `IDLTReceiver`, verifying `onDLTReceived` callback
- Rejection of transfers to non-receiver contracts and to revertable receiver contracts
- Approval flows: `approve` for specific `(mainId, subId)` pairs and `setApprovalForAll` for operator-level access
- Allowance spending and the `type(uint256).max` infinite approval pattern
- Batch transfers via `safeBatchTransferFrom` with array length validation
- Burning tokens and verifying supply reduction
- Zero address validation on mints, transfers, and approvals

## Reference Implementation

A reference implementation is provided in [DLT.sol](../assets/eip-6960/DLT.sol).

The implementation includes:

- `DLT.sol`: Core token contract implementing the `IDLT` interface with dual-layer balance tracking, approval management, safe transfers with receiver callbacks, and batch operations.
- `IDLT.sol`: The interface as specified above.
- `IDLTReceiver.sol`: Receiver interface for safe transfer callbacks.

The reference implementation uses a nested mapping `mapping(uint256 mainId =&gt; mapping(address =&gt; mapping(uint256 subId =&gt; uint256)))` for balance storage, enabling O(1) lookups for any `(account, mainId, subId)` tuple. Allowances follow the same pattern with an additional spender dimension.

## Security Considerations

### Allowance Race Condition

The dual-layer allowance system inherits the same approve/transferFrom race condition present in [ERC-20](./eip-20.md). If an owner changes an allowance from N to M, the spender may be able to spend both N and M. Implementers SHOULD provide `increaseAllowance` and `decreaseAllowance` helper functions or use the check-set pattern where the owner first sets allowance to zero before setting the new value.

### Receiver Callback Reentrancy

The `safeTransferFrom` function calls `onDLTReceived` on the recipient contract after updating balances. This follows the checks-effects-interactions pattern, but implementers extending the base contract SHOULD be aware that the recipient callback executes with updated state. Contracts that override `_beforeTokenTransfer` or `_afterTokenTransfer` hooks must not introduce external calls that could create reentrancy paths.

### Batch Operation Gas Limits

`safeBatchTransferFrom` and `balanceOfBatch` iterate over unbounded arrays. Callers MUST ensure the array lengths do not exceed block gas limits. Implementations MAY impose an upper bound on array length to prevent out-of-gas failures in on-chain contexts.

### Integer Overflow in Balance Aggregation

While individual `subBalance` values are tracked per `(mainId, subId)` pair, any aggregation of balances across sub-IDs (e.g., computing a total `mainBalance`) must account for potential overflow when summing multiple `uint256` values. The reference implementation tracks main balances separately to avoid this.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 30 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6960</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6960</guid>
      </item>
    
      <item>
        <title>Reserved Ownership Accounts</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc-6981-reserved-ownership-accounts/14118</comments>
        
        <description>## Abstract

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 `create2` opcode.

## Motivation

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

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.

## Specification

The key words &quot;MUST&quot;, &quot;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.

### Overview

The system for creating reserved ownership accounts consists of:

1. An Account Registry which provides deterministic addresses based on the service users&apos; identifying salts, and implements a signature verified function that enables claiming of Account Instances by the service&apos;s end users.
2. 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.

External services wishing to provide their users with reserved ownership accounts MUST maintain a relationship between a user&apos;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&apos;s Account Registry Instance in a call to `claimAccount` to deploy and claim an Account Instance at the deterministic address.

### Account Registry

The Account Registry MUST implement the following interface:

```solidity
interface IAccountRegistry {
    /**
     * @dev Registry instances emit the AccountCreated event upon successful account creation
     */
    event AccountCreated(address account, address accountImplementation, uint256 salt);

    /**
     * @dev Registry instances emit the AccountClaimed event upon successful claim of account by owner
     */
    event AccountClaimed(address account, address owner);

    /**
     * @dev Creates a smart contract account.
     *
     * If account has already been created, returns the account address without calling create2.
     *
     * @param salt       - The identifying salt for which the user wishes to deploy an Account Instance
     *
     * Emits AccountCreated event
     * @return the address for which the Account Instance was created
     */
    function createAccount(uint256 salt) external returns (address);

    /**
     * @dev Allows an owner to claim a smart contract account created by this registry.
     *
     * If the account has not already been created, the account will be created first using `createAccount`
     *
     * @param owner      - The initial owner of the new Account Instance
     * @param salt       - The identifying salt for which the user wishes to deploy an Account Instance
     * @param expiration - If expiration &gt; 0, represents expiration time for the signature.  Otherwise
     *                     signature does not expire.
     * @param message    - The keccak256 message which validates the owner, salt, expiration
     * @param signature  - The signature which validates the owner, salt, expiration
     *
     * Emits AccountClaimed event
     * @return the address of the claimed Account Instance
     */
    function claimAccount(
        address owner,
        uint256 salt,
        uint256 expiration,
        bytes32 message,
        bytes calldata signature
    ) external returns (address);

    /**
     * @dev Returns the computed address of a smart contract account for a given identifying salt
     *
     * @return the computed address of the account
     */
    function account(uint256 salt) external view returns (address);

    /**
     * @dev Fallback signature verification for unclaimed accounts
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4);
}
```

#### createAccount

`createAccount` is used to deploy the Account Instance for a given salt.

- This function MUST deploy a new Account Instance as a [ERC-1167](./eip-1167.md) proxy pointing to the account implementation.
- This function SHOULD set the initial owner of the Account Instance to the Account Registry Instance.
- The account implementation address MUST be immutable, as it is used to compute the deterministic address for the Account Instance.
- Upon successful deployment of the Account Instance, the registry SHOULD emit an `AccountCreated` event.

#### claimAccount

`claimAccount` is used to claim ownership of the Account Instance for a given salt.

- This function MUST create a new Account Instance if one does not already exist for the given salt.
- 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 [ERC-1271](./eip-1271.md) for smart contract signers.
- This function SHOULD verify that the block.timestamp &lt; expiration or that expiration == 0.
- Upon successful signature verification on calls to `claimAccount`, the registry MUST completely relinquish control over the Account Instance, and assign ownership to the initial owner by calling `setOwner` on the Account Instance.
- Upon successful claim of the Account Instance, the registry SHOULD emit an `AccountClaimed` event.

#### isValidSignature

`isValidSignature` 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. `bytes32 compositeHash = keccak256(abi.encodePacked(originalHash, accountAddress))`). The function MUST reconstruct the composite hash, where `originalHash` is the hash passed to the function, and `accountAddress` is `msg.sender` (the unclaimed Account Instance). The function MUST verify the signature against the composite hash and registry signer.

### Account Instance

The Account Instance MUST implement the following interface:

```solidity
interface IAccount is IERC1271 {
    /**
     * @dev Sets the owner of the Account Instance.
     *
     * Only callable by the current owner of the instance, or by the registry if the Account
     * Instance has not yet been claimed.
     *
     * @param owner      - The new owner of the Account Instance
     */
    function setOwner(address owner) external;
}
```

- All Account Instances MUST be created using an Account Registry Instance.
- Account Instances SHOULD provide access to assets previously sent to the address at which the Account Instance is deployed to.
- `setOwner` SHOULD update the owner and SHOULD be callable by the current owner of the Account Instance.
- If an Account Instance is deployed, but not claimed, the owner of the Account Instance MUST be initialized to the Account Registry Instance.
- An Account Instance SHALL determine if it has been claimed by checking if the owner is the Account Registry Instance.

#### Account Instance Signatures

Account Instances MUST support [ERC-1271](./eip-1271.md) by implementing an `isValidSignature` 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:

1. If the Account instance is deployed and claimed, the owner should generate the signature, and `isValidSignature` SHOULD verify that the message hash and signature are valid for the current owner of the Account Instance.
2. 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 [above](#isvalidsignature), and `isValidSignature` SHOULD forward the message hash and signature to the Account Registry Instance&apos;s `isValidSignature` function.
3. 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 [ERC-6492](./eip-6492.md#signer-side) (e.g. `concat(abi.encode((registryAddress, createAccountCalldata, compositeHashSignature), (address, bytes, bytes)), magicBytes)`).

Signature validation for Account Instances should be done according to [ERC-6492](./eip-6492.md#verifier-side).

## Rationale

### Service-Owned Registry Instances

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.

We are providing a reference Registry Factory which can deploy Account Registries for an external service, which comes with:

- Immutable Account Instance implementation
- Validation for the `claimAccount` method via ECDSA for EOA signers, or [ERC-1271](./eip-1271.md) validation for smart contract signers
- Ability for the Account Registry deployer to change the signing addressed used for `claimAccount` validation

### Account Registry and Account Implementation Coupling

Since Account Instances are deployed as [ERC-1167](./eip-1167.md) 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&apos;s salt and linked address on a given Account Registry Instance.

This also allows services to gain the trust of users by deploying their registries with a reference to a trusted account implementation address.

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.

### Separate `createAccount` and `claimAccount` Operations

Operations to create and claim Account Instances are intentionally separate. This allows services to provide users with valid [ERC-6492](./eip-6492.md) signatures before their Account Instance has been deployed.

## Reference Implementation

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.

### Account Registry Factory

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.13;

/// @author: manifold.xyz

import {Create2} from &quot;openzeppelin/utils/Create2.sol&quot;;

import {Address} from &quot;../../lib/Address.sol&quot;;
import {ERC1167ProxyBytecode} from &quot;../../lib/ERC1167ProxyBytecode.sol&quot;;
import {IAccountRegistryFactory} from &quot;./IAccountRegistryFactory.sol&quot;;

contract AccountRegistryFactory is IAccountRegistryFactory {
    using Address for address;

    error InitializationFailed();

    address private immutable registryImplementation = 0x076B08EDE2B28fab0c1886F029cD6d02C8fF0E94;

    function createRegistry(
        uint96 index,
        address accountImplementation,
        bytes calldata accountInitData
    ) external returns (address) {
        bytes32 salt = _getSalt(msg.sender, index);
        bytes memory code = ERC1167ProxyBytecode.createCode(registryImplementation);
        address _registry = Create2.computeAddress(salt, keccak256(code));

        if (_registry.isDeployed()) return _registry;

        _registry = Create2.deploy(0, salt, code);

        (bool success, ) = _registry.call(
            abi.encodeWithSignature(
                &quot;initialize(address,address,bytes)&quot;,
                msg.sender,
                accountImplementation,
                accountInitData
            )
        );
        if (!success) revert InitializationFailed();

        emit AccountRegistryCreated(_registry, accountImplementation, index);

        return _registry;
    }

    function registry(address deployer, uint96 index) external view override returns (address) {
        bytes32 salt = _getSalt(deployer, index);
        bytes memory code = ERC1167ProxyBytecode.createCode(registryImplementation);
        return Create2.computeAddress(salt, keccak256(code));
    }

    function _getSalt(address deployer, uint96 index) private pure returns (bytes32) {
        return bytes32(abi.encodePacked(deployer, index));
    }
}
```

### Account Registry

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.13;

/// @author: manifold.xyz

import {Create2} from &quot;openzeppelin/utils/Create2.sol&quot;;
import {ECDSA} from &quot;openzeppelin/utils/cryptography/ECDSA.sol&quot;;
import {Ownable} from &quot;openzeppelin/access/Ownable.sol&quot;;
import {Initializable} from &quot;openzeppelin/proxy/utils/Initializable.sol&quot;;
import {IERC1271} from &quot;openzeppelin/interfaces/IERC1271.sol&quot;;
import {SignatureChecker} from &quot;openzeppelin/utils/cryptography/SignatureChecker.sol&quot;;

import {Address} from &quot;../../lib/Address.sol&quot;;
import {IAccountRegistry} from &quot;../../interfaces/IAccountRegistry.sol&quot;;
import {ERC1167ProxyBytecode} from &quot;../../lib/ERC1167ProxyBytecode.sol&quot;;

contract AccountRegistryImplementation is Ownable, Initializable, IAccountRegistry {
    using Address for address;
    using ECDSA for bytes32;

    struct Signer {
        address account;
        bool isContract;
    }

    error InitializationFailed();
    error ClaimFailed();
    error Unauthorized();

    address public accountImplementation;
    bytes public accountInitData;
    Signer public signer;

    constructor() {
        _disableInitializers();
    }

    function initialize(
        address owner,
        address accountImplementation_,
        bytes calldata accountInitData_
    ) external initializer {
        _transferOwnership(owner);
        accountImplementation = accountImplementation_;
        accountInitData = accountInitData_;
    }

    /**
     * @dev See {IAccountRegistry-createAccount}
     */
    function createAccount(uint256 salt) external override returns (address) {
        bytes memory code = ERC1167ProxyBytecode.createCode(accountImplementation);
        address _account = Create2.computeAddress(bytes32(salt), keccak256(code));

        if (_account.isDeployed()) return _account;

        _account = Create2.deploy(0, bytes32(salt), code);

        (bool success, ) = _account.call(accountInitData);
        if (!success) revert InitializationFailed();

        emit AccountCreated(_account, accountImplementation, salt);

        return _account;
    }

    /**
     * @dev See {IAccountRegistry-claimAccount}
     */
    function claimAccount(
        address owner,
        uint256 salt,
        uint256 expiration,
        bytes32 message,
        bytes calldata signature
    ) external override returns (address) {
        _verify(owner, salt, expiration, message, signature);
        address _account = this.createAccount(salt);

        (bool success, ) = _account.call(
            abi.encodeWithSignature(&quot;transferOwnership(address)&quot;, owner)
        );
        if (!success) revert ClaimFailed();

        emit AccountClaimed(_account, owner);
        return _account;
    }

    /**
     * @dev See {IAccountRegistry-account}
     */
    function account(uint256 salt) external view override returns (address) {
        bytes memory code = ERC1167ProxyBytecode.createCode(accountImplementation);
        return Create2.computeAddress(bytes32(salt), keccak256(code));
    }

    /**
     * @dev See {IAccountRegistry-isValidSignature}
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4) {
        bytes32 expectedHash = keccak256(abi.encodePacked(hash, msg.sender));
        bool isValid = SignatureChecker.isValidSignatureNow(
            signer.account,
            expectedHash,
            signature
        );
        if (isValid) {
            return IERC1271.isValidSignature.selector;
        }

        return &quot;&quot;;
    }

    function updateSigner(address newSigner) external onlyOwner {
        uint32 signerSize;
        assembly {
            signerSize := extcodesize(newSigner)
        }
        signer.account = newSigner;
        signer.isContract = signerSize &gt; 0;
    }

    function _verify(
        address owner,
        uint256 salt,
        uint256 expiration,
        bytes32 message,
        bytes calldata signature
    ) internal view {
        address signatureAccount;

        if (signer.isContract) {
            if (!SignatureChecker.isValidSignatureNow(signer.account, message, signature))
                revert Unauthorized();
        } else {
            signatureAccount = message.recover(signature);
        }

        bytes32 expectedMessage = keccak256(
            abi.encodePacked(&quot;\x19Ethereum Signed Message:\n84&quot;, owner, salt, expiration)
        );

        if (
            message != expectedMessage ||
            (!signer.isContract &amp;&amp; signatureAccount != signer.account) ||
            (expiration != 0 &amp;&amp; expiration &lt; block.timestamp)
        ) revert Unauthorized();
    }
}
```

### Example Account Implementation

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.13;

/// @author: manifold.xyz

import {IERC1271} from &quot;openzeppelin/interfaces/IERC1271.sol&quot;;
import {SignatureChecker} from &quot;openzeppelin/utils/cryptography/SignatureChecker.sol&quot;;
import {IERC165} from &quot;openzeppelin/utils/introspection/IERC165.sol&quot;;
import {ERC165Checker} from &quot;openzeppelin/utils/introspection/ERC165Checker.sol&quot;;
import {IERC721} from &quot;openzeppelin/token/ERC721/IERC721.sol&quot;;
import {IERC721Receiver} from &quot;openzeppelin/token/ERC721/IERC721Receiver.sol&quot;;
import {IERC1155Receiver} from &quot;openzeppelin/token/ERC1155/IERC1155Receiver.sol&quot;;
import {Initializable} from &quot;openzeppelin/proxy/utils/Initializable.sol&quot;;
import {Ownable} from &quot;openzeppelin/access/Ownable.sol&quot;;
import {IERC1967Account} from &quot;./IERC1967Account.sol&quot;;

import {IAccount} from &quot;../../interfaces/IAccount.sol&quot;;

/**
 * @title ERC1967AccountImplementation
 * @notice A lightweight, upgradeable smart contract wallet implementation
 */
contract ERC1967AccountImplementation is
    IAccount,
    IERC165,
    IERC721Receiver,
    IERC1155Receiver,
    IERC1967Account,
    Initializable,
    Ownable
{
    address public registry;

    constructor() {
        _disableInitializers();
    }

    function initialize() external initializer {
        registry = msg.sender;
        _transferOwnership(registry);
    }

    function supportsInterface(bytes4 interfaceId) external pure returns (bool) {
        return (interfaceId == type(IAccount).interfaceId ||
            interfaceId == type(IERC1967Account).interfaceId ||
            interfaceId == type(IERC1155Receiver).interfaceId ||
            interfaceId == type(IERC721Receiver).interfaceId ||
            interfaceId == type(IERC165).interfaceId);
    }

    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public pure returns (bytes4) {
        return this.onERC721Received.selector;
    }

    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public pure returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public pure returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }

    /**
     * @dev {See IERC1967Account-executeCall}
     */
    function executeCall(
        address _target,
        uint256 _value,
        bytes calldata _data
    ) external payable override onlyOwner returns (bytes memory _result) {
        bool success;
        // solhint-disable-next-line avoid-low-level-calls
        (success, _result) = _target.call{value: _value}(_data);
        require(success, string(_result));
        emit TransactionExecuted(_target, _value, _data);
        return _result;
    }

    /**
     * @dev {See IAccount-setOwner}
     */
    function setOwner(address _owner) external override onlyOwner {
        _transferOwnership(_owner);
    }

    receive() external payable {}

    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4) {
        if (owner() == registry) {
            return IERC1271(registry).isValidSignature(hash, signature);
        }

        bool isValid = SignatureChecker.isValidSignatureNow(owner(), hash, signature);
        if (isValid) {
            return IERC1271.isValidSignature.selector;
        }

        return &quot;&quot;;
    }
}
```

## Security Considerations

### Front-running

Deployment of reserved ownership accounts through an Account Registry Instance through calls to `createAccount` could be front-run by a malicious actor. However, if the malicious actor attempted to alter the `owner` 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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 25 Apr 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6981</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6981</guid>
      </item>
    
      <item>
        <title>Efficient Default Lockable Tokens</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc721-default-lockable-proposal/13366</comments>
        
        <description>## Abstract

This proposal introduces a lockable interface for [ERC-721](./eip-721.md) tokens that optimizes gas usage by eliminating unnecessary events. This interface forms the foundation for the creation and management of lockable [ERC-721](./eip-721.md) tokens. It provides a gas-efficient approach by emitting a `DefaultLocked(bool locked)` event upon deployment, setting the initial lock status for all tokens, while individual `Locked(uint256 indexed tokenId, bool locked)` events handle subsequent status changes for specific tokens. The interface also includes a view function `locked(uint256 tokenId)` to return the current lock status of a token, and a view function `defaultLocked()` to query the default status of a newly minted token.

## Motivation

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.

## Specification

The key words &quot;MUST&quot;, &quot;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 interface is defined as follows:

```solidity
// ERC165 interfaceId 0x6b61a747
interface IERC6982 {
  /**
   * @dev MUST be emitted when the contract is deployed to establish the default lock status 
   *      for all tokens. Also, MUST be emitted again if the default lock status changes, 
   *      to ensure the default status for all tokens (without a specific `Locked` event) is updated.
   */
  event DefaultLocked(bool locked);

  /**
   * @dev MUST be emitted when the lock status of a specific token changes.
   *      This status overrides the default lock status for that specific token.
   */
  event Locked(uint256 indexed tokenId, bool locked);

  /**
   * @dev Returns the current default lock status for tokens. 
   *      The returned value MUST reflect the status indicated by the most recent `DefaultLocked` event.
   */
  function defaultLocked() external view returns (bool);

  /**
   * @dev Returns the lock status of a specific token. 
   *      If no `Locked` event has been emitted for the token, it MUST return the current default lock status. 
   *      The function MUST revert if the token does not exist.
   */
  function locked(uint256 tokenId) external view returns (bool);
}
```

The [ERC-165](./eip-165.md) interfaceId is `0x6b61a747`.

## Rationale

This standard seeks to optimize gas consumption by minimizing the frequency of event emission. The `DefaultLocked` 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&apos;s crucial to note that the `DefaultLocked` event can be emitted at any point in time, and is not restricted to only before the `Locked` events are emitted.

Tokens may alter their behavior under certain circumstances (such as after a reveal), prompting the re-emission of the `DefaultLocked` event to reflect the new default status. The primary objective here is to economize on gas usage by avoiding the need to emit a `Locked` event for each token when the default status changes.

The `Locked` event is utilized to document changes in the lock status of individual tokens.

The `defaultLocked` 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 [ERC-5192](./eip-5192), which is in its final stage.

The `locked` 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 `defaultLocked` function.

Bear in mind that a token being designated as &quot;locked&quot; doesn&apos;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&apos;s transferability on marketplaces and external exchanges.

To illustrate, let&apos;s consider the Cruna protocol. In this system, an NFT owner has the ability to activate what is termed an &apos;protector&apos;. This is essentially a secondary wallet with the unique privilege of initiating key transactions. Upon setting an initiator, the token&apos;s status is rendered &apos;locked&apos;. However, this does not impede the token&apos;s transferability if the initiation for the transfer comes from the designated protector. 

## Backwards Compatibility

This standard is fully backwards compatible with existing [ERC-721](./eip-721.md) contracts. It can be easily integrated into existing contracts and will not cause any conflicts or disruptions.

## Reference Implementation

An example implementation is located in the [assets](../assets/eip-6982) directory.

It solves a specific use case: token&apos;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 [README](../assets/eip-6982/README.md) you can find more details about how to compile and test the contracts.

## Security Considerations

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.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Tue, 02 May 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6982</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6982</guid>
      </item>
    
      <item>
        <title>ERC-721 with transaction validation step.</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/erc721-with-a-validation-step/14071</comments>
        
        <description>## Abstract

This standard is an extension of [ERC-721](./eip-721.md). It defines new validation functionality to avoid wallet draining: every `transfer` or `approve` will be locked waiting for validation.

## Motivation

The power of the blockchain is at the same time its weakness: giving the user full responsibility for their data.

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.

Having a validation step before every `transfer` and `approve` would give Smart Contract developers the opportunity to create secure NFT anti-theft schemes.

An implementation example would be a system where a validator address is responsible for validating all Smart Contract transactions.

This address would be connected to a dApp where the user could see the validation requests of his NFTs and accept the correct ones.

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&apos;s address and the validator address simultaneously.

## Specification

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.

[ERC-721](./eip-721.md) compliant contracts MAY implement this EIP.

All the operations that change the ownership of an NFT, like a `transferFrom`/`safeTransferFrom`, SHALL create a `TransferValidation` pending to be validated and emit a `ValidateTransfer`, and SHALL NOT transfer the ownership of an NFT.

All the operations that enable an approval to manage an NFT, like an `approve`/`setApprovalForAll`, SHALL create an `ApprovalValidation` pending to be validated and emit a `ValidateApproval`, and SHALL NOT enable an approval.

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.

When validating a `TransferValidation` or `ApprovalValidation` the valid field MUST be set to true and MUST NOT be validated again.

The operations that validate a `TransferValidation` SHALL change the ownership of the NFT or enable the approval.

The operations that validate an `ApprovalValidation` SHALL enable the approval.

### Contract Interface

```solidity
 interface IERC6997 {

    struct TransferValidation {
        // The address of the owner.
        address from;
        // The address of the receiver.
        address to;
        // The token Id.
        uint256 tokenId;
        // Whether is a valid transfer.
        bool valid;
    }

    struct ApprovalValidation {
        // The address of the owner.
        address owner;
        // The approved address.
        address approve;
        // The token Id.
        uint256 tokenId;
        // Whether it is a total approval.
        bool approveAll;
        // Whether it is a valid approval.
        bool valid;
    }

    /**
     * @dev Emitted when a new transfer validation has been requested.
     */
    event ValidateTransfer(address indexed from, address to, uint256 indexed tokenId, uint256 indexed transferValidationId);

    /**
    * @dev Emitted when a new approval validation has been requested.
    */
    event ValidateApproval(address indexed owner, address approve, uint256 tokenId, bool indexed approveAll, uint256 indexed approvalValidationId);

    /**
     * @dev Returns true if this contract is a validator ERC721.
     */
    function isValidatorContract() external view returns (bool);

    /**
     * @dev Returns the transfer validation struct using the transfer ID.
     *
     */
    function transferValidation(uint256 transferId) external view returns (TransferValidation memory);

    /**
    * @dev Returns the approval validation struct using the approval ID.
    *
    */
    function approvalValidation(uint256 approvalId) external view returns (ApprovalValidation memory);

    /**
     * @dev Return the total amount of transfer validations created.
     *
     */
    function totalTransferValidations() external view returns (uint256);

    /**
     * @dev Return the total amount of transfer validations created.
     *
     */
    function totalApprovalValidations() external view returns (uint256);
}
  ```

The `isValidatorContract()` function MUST be implemented as `public`.

The `transferValidation(uint256 transferId)` function MAY be implemented as `public` or `external`.

The `approvalValidation(uint256 approveId)` function MAY be implemented as `public` or `external`.

The `totalTransferValidations()` function MAY be implemented as `pure` or `view`.

The `totalApprovalValidations()` function MAY be implemented as `pure` or `view`.

## Rationale

### Universality

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.

An example could be to have an address validator connected to a dApp so that users could manage their validations.

This validator could be used for all NFTs or only for some users.

It could also be used as a wrapped Smart Contract for existing ERC-721, allowing 1/1 conversion with existing NFTs.

### Extensibility

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.

## Backwards Compatibility

This standard is an extension of [ERC-721](./eip-721.md), compatible with all the operations except `transferFrom`/`safeTransferFrom`/`approve`/`setApprovalForAll`.

This operations will be overridden to create a validation petition instead of transfer ownership of an NFT or enable an approval.

## Reference Implementation

```solidity
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.0;

import &quot;./IERC6997.sol&quot;;
import &quot;@openzeppelin/contracts/token/ERC721/ERC721.sol&quot;;

/**
 * @dev Implementation of ERC6997
 */
contract ERC6997 is IERC6997, ERC721 {

    // Mapping from transfer ID to transfer validation
    mapping(uint256 =&gt; TransferValidation) private _transferValidations;

    // Mapping from approval ID to approval validation
    mapping(uint256 =&gt; ApprovalValidation) private _approvalValidations;

    // Total number of transfer validations
    uint256 private _totalTransferValidations;

    // Total number of approval validations
    uint256 private _totalApprovalValidations;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) ERC721(name_, symbol_){
    }

    /**
    * @dev Returns true if this contract is a validator ERC721.
    */
    function isValidatorContract() public pure returns (bool) {
        return true;
    }

    /**
     * @dev Returns the transfer validation struct using the transfer ID.
     *
     */
    function transferValidation(uint256 transferId) public view override returns (TransferValidation memory) {
        require(transferId &lt; _totalTransferValidations, &quot;ERC6997: invalid transfer ID&quot;);
        TransferValidation memory v = _transferValidation(transferId);

        return v;
    }

    /**
     * @dev Returns the approval validation struct using the approval ID.
     *
     */
    function approvalValidation(uint256 approvalId) public view override returns (ApprovalValidation memory) {
        require(approvalId &lt; _totalApprovalValidations, &quot;ERC6997: invalid approval ID&quot;);
        ApprovalValidation memory v = _approvalValidation(approvalId);

        return v;
    }

    /**
     * @dev Return the total amount of transfer validations created.
     *
     */
    function totalTransferValidations() public view override returns (uint256) {
        return _totalTransferValidations;
    }

    /**
     * @dev Return the total amount of approval validations created.
     *
     */
    function totalApprovalValidations() public view override returns (uint256) {
        return _totalApprovalValidations;
    }

    /**
     * @dev Returns the transfer validation of the `transferId`. Does NOT revert if transfer doesn&apos;t exist
     */
    function _transferValidation(uint256 transferId) internal view virtual returns (TransferValidation memory) {
        return _transferValidations[transferId];
    }

    /**
     * @dev Returns the approval validation of the `approvalId`. Does NOT revert if transfer doesn&apos;t exist
     */
    function _approvalValidation(uint256 approvalId) internal view virtual returns (ApprovalValidation memory) {
        return _approvalValidations[approvalId];
    }

    /**
     * @dev Validate the transfer using the transfer ID.
     *
     */
    function _validateTransfer(uint256 transferId) internal virtual {
        TransferValidation memory v = transferValidation(transferId);
        require(!v.valid, &quot;ERC6997: the transfer is already validated&quot;);

        address from = v.from;
        address to = v.to;
        uint256 tokenId = v.tokenId;

        super._transfer(from, to, tokenId);

        _transferValidations[transferId].valid = true;
    }

    /**
     * @dev Validate the approval using the approval ID.
     *
     */
    function _validateApproval(uint256 approvalId) internal virtual {
        ApprovalValidation memory v = approvalValidation(approvalId);
        require(!v.valid, &quot;ERC6997: the approval is already validated&quot;);

        if(!v.approveAll) {
            require(v.owner == ownerOf(v.tokenId), &quot;ERC6997: The token have a new owner&quot;);
            super._approve(v.approve, v.tokenId);
        }
        else {
            super._setApprovalForAll(v.owner, v.approve, true);
        }

        _approvalValidations[approvalId].valid = true;
    }

    /**
     * @dev Create a transfer petition of `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {TransferValidate} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        require(ERC721.ownerOf(tokenId) == from, &quot;ERC6997: transfer from incorrect owner&quot;);
        require(to != address(0), &quot;ERC6997: transfer to the zero address&quot;);

        if(_msgSender() == from) {
            TransferValidation memory v;

            v.from = from;
            v.to = to;
            v.tokenId = tokenId;

            _transferValidations[_totalTransferValidations] = v;

            emit ValidateTransfer(from, to, tokenId, _totalTransferValidations);

            _totalTransferValidations++;
        } else {
            super._transfer(from, to, tokenId);
        }
    }

    /**
     * @dev Create an approval petition from `to` to operate on `tokenId`
     *
     * Emits an {ValidateApproval} event.
     */
    function _approve(address to, uint256 tokenId) internal override virtual {
        ApprovalValidation memory v;

        v.owner = ownerOf(tokenId);
        v.approve = to;
        v.tokenId = tokenId;

        _approvalValidations[_totalApprovalValidations] = v;

        emit ValidateApproval(v.owner, to, tokenId, false, _totalApprovalValidations);

        _totalApprovalValidations++;
    }

    /**
     * @dev If approved is true create an approval petition from `operator` to operate on
     * all of `owner` tokens, if not remove `operator` from operate on all of `owner` tokens
     *
     * Emits an {ValidateApproval} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal override virtual {
        require(owner != operator, &quot;ERC6997: approve to caller&quot;);

        if(approved) {
            ApprovalValidation memory v;

            v.owner = owner;
            v.approve = operator;
            v.approveAll = true;

            _approvalValidations[_totalApprovalValidations] = v;

            emit ValidateApproval(v.owner, operator, 0, true, _totalApprovalValidations);

            _totalApprovalValidations++;
        }
        else {
            super._setApprovalForAll(owner, operator, approved);
        }
    }
}
```

## Security Considerations

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 `TransferValidation` or an `ApprovalValidation` pending to be validated and SHALL NOT transfer the ownership of an NFT or enable an approval.

With this premise in mind, the operations in charge of validating a `TransferValidation` or an `ApprovalValidation` must be protected with the maximum security required by the applied system.

For example, a valid system would be one where there is a validator address in charge of validating the transactions.

To give another example, a system where each user could choose his validator address would also be correct.

In any case, the importance of security resides in the fact that no address can validate a `TransferValidation` or an `ApprovalValidation` without the permission of the chosen system.

## Copyright

Copyright and related rights waived via [CC0](/LICENSE).
</description>
        <pubDate>Sun, 07 May 2023 00:00:00 +0000</pubDate>
        <link>https://ercs.ethereum.org/ERCS/erc-6997</link>
        <guid isPermaLink="true">https://ercs.ethereum.org/ERCS/erc-6997</guid>
      </item>
    
      <item>
        <title>Verifiable AI-Generated Content Token</title>
        <category>Standards Track/ERC</category>
        
          <comments>https://ethereum-magicians.org/t/eip-7007-zkml-aigc-nfts-an-erc-721-extension-interface-for-zkml-based-aigc-nfts/14216</comments>
        
        <description>## Abstract

The verifiable AI-generated content (AIGC) non-fungible token (NFT) standard is an extension of the [ERC-721](./eip-721.md) token standard for AIGC. It proposes a set of interfaces for basic interactions and enumerable interactions for AIGC-NFTs. The standard includes an `addAigcData` and `verify` function interface, a new `AigcData` event, optional `Enumerable` and `Updatable` 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 `tokenId` is indexed by the `prompt`.

## Motivation

The verifiable AIGC-NFT standard aims to extend the existing [ERC-721](./eip-721.md) 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.

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.

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).

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.

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.

An example workflow of a zkML AIGC NFT project compliant with this proposal is as follows:

![zkML Suggested Workflow](../assets/eip-7007/workflow.png)

There are 4 components in this workflow:

- ML model - contains weights of a pre-trained model; given an inference input, generates the output
- zkML prover - given an inference task with input and output, generates a ZK proof
- AIGC-NFT smart contract - contract compliant with this proposal, with full [ERC-721](./eip-721.md) functionalities
- Verifier smart contract - implements a `verify` function, given an inference task and its ZK proof, returns the verification result as a boolean

## Specification

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.

**Every compliant contract must implement the `IERC7007`, [`ERC721`](./eip-721.md), and [`ERC165`](./eip-165.md) interfaces.**

The verifiable AIGC-NFT standard includes the following interfaces:

`IERC7007`: Defines an `addAigcData` function and an `AigcData` event for adding AIGC data to AIGC-NFTs. Defines a `verify` function to check the validity of the combination of prompt and aigcData using zkML/opML techniques.

```solidity
pragma solidity ^0.8.18;

/**
 * @dev Required interface of an ERC7007 compliant contract.
 * Note: the ERC-165 identifier for this interface is 0x702c55a6.
 */
interface IERC7007 is IERC165, IERC721 {
    /**
     * @dev Emitted when `tokenId` token&apos;s AIGC data is added.
     */
    event AigcData(
        uint256 indexed tokenId,
        bytes indexed prompt,
        bytes indexed aigcData,
        bytes proof
    );

    /**
     * @dev Add AIGC data to token at `tokenId` given `prompt`, `aigcData`, and `proof`.
     */
    function addAigcData(
        uint256 tokenId,
        bytes calldata prompt,
        bytes calldata aigcData,
        bytes calldata proof
    ) external;

    /**
     * @dev Verify the `prompt`, `aigcData`, and `proof`.
     */
    function verify(
        bytes calldata prompt,
        bytes calldata aigcData,
        bytes calldata proof
    ) external view r