Skip to content

Commit

Permalink
Add ERC-2771 support
Browse files Browse the repository at this point in the history
  • Loading branch information
rya-sge committed Sep 9, 2024
1 parent 272c97e commit f6fb806
Show file tree
Hide file tree
Showing 29 changed files with 590 additions and 1,137 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Please follow https://changelog.md/ conventions.

## v0.2.0

- Add ERC-2771 support

## v0.1.0

- 🎉 first release!
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ interface IDebtEngine is IDebtGlobal {
| 🛑 | Function can modify state |
| 💵 | Function is payable |



## Gasless support (ERC-2771)

The DebtEngine supports client-side gasless transactions using the [Gas Station Network](https://docs.opengsn.org/#the-problem) (GSN) pattern, the main open standard for transfering fee payment to another account than that of the transaction issuer. The contract uses the OpenZeppelin contract `ERC2771ContextUpgradeable`, which allows a contract to get the original client with `_msgSender()` instead of the fee payer given by `msg.sender` while allowing upgrades on the main contract (see *Deployment via a proxy* above).

At deployment, the parameter `forwarder` inside the constructor has to be set with the defined address of the forwarder. Please note that the forwarder can not be changed after deployment.

Please see the OpenGSN [documentation](https://docs.opengsn.org/contracts/#receiving-a-relayed-call) for more details on what is done to support GSN in the contract.



## Dependencies

The toolchain includes the following components, where the versions are the latest ones that we tested:
Expand Down
36 changes: 12 additions & 24 deletions doc/coverage/coverage/index-sort-b.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@
<td class="headerValue">lcov.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">19</td>
<td class="headerCovTableEntry">20</td>
<td class="headerCovTableEntryHi">95.0 %</td>
<td class="headerCovTableEntry">21</td>
<td class="headerCovTableEntry">22</td>
<td class="headerCovTableEntryHi">95.5 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2024-09-03 10:05:10</td>
<td class="headerValue">2024-09-09 14:59:40</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">6</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntryLo">66.7 %</td>
<td class="headerCovTableEntry">8</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntryMed">80.0 %</td>
</tr>
<tr>
<td></td>
Expand Down Expand Up @@ -81,27 +81,15 @@
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><a href="index-sort-f.html"><img src="updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><img src="glass.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></span></td>
</tr>
<tr>
<td class="coverFile"><a href="script/index.html">script</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="snow.png" width=100 height=10 alt="0.0%"></td></tr></table>
</td>
<td class="coverPerLo">0.0&nbsp;%</td>
<td class="coverNumLo">0 / 1</td>
<td class="coverPerLo">0.0&nbsp;%</td>
<td class="coverNumLo">0 / 2</td>
<td class="coverPerHi">-</td>
<td class="coverNumHi">0 / 0</td>
</tr>
<tr>
<td class="coverFile"><a href="src/index.html">src</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=95 height=10 alt="95.5%"><img src="snow.png" width=5 height=10 alt="95.5%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">19 / 19</td>
<td class="coverPerMed">85.7&nbsp;%</td>
<td class="coverNumMed">6 / 7</td>
<td class="coverPerHi">95.5&nbsp;%</td>
<td class="coverNumHi">21 / 22</td>
<td class="coverPerMed">80.0&nbsp;%</td>
<td class="coverNumMed">8 / 10</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">6 / 6</td>
</tr>
Expand Down
36 changes: 12 additions & 24 deletions doc/coverage/coverage/index-sort-f.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@
<td class="headerValue">lcov.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">19</td>
<td class="headerCovTableEntry">20</td>
<td class="headerCovTableEntryHi">95.0 %</td>
<td class="headerCovTableEntry">21</td>
<td class="headerCovTableEntry">22</td>
<td class="headerCovTableEntryHi">95.5 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2024-09-03 10:05:10</td>
<td class="headerValue">2024-09-09 14:59:40</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">6</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntryLo">66.7 %</td>
<td class="headerCovTableEntry">8</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntryMed">80.0 %</td>
</tr>
<tr>
<td></td>
Expand Down Expand Up @@ -81,27 +81,15 @@
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><img src="glass.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><a href="index-sort-b.html"><img src="updown.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></a></span></td>
</tr>
<tr>
<td class="coverFile"><a href="script/index.html">script</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="snow.png" width=100 height=10 alt="0.0%"></td></tr></table>
</td>
<td class="coverPerLo">0.0&nbsp;%</td>
<td class="coverNumLo">0 / 1</td>
<td class="coverPerLo">0.0&nbsp;%</td>
<td class="coverNumLo">0 / 2</td>
<td class="coverPerHi">-</td>
<td class="coverNumHi">0 / 0</td>
</tr>
<tr>
<td class="coverFile"><a href="src/index.html">src</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=95 height=10 alt="95.5%"><img src="snow.png" width=5 height=10 alt="95.5%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">19 / 19</td>
<td class="coverPerMed">85.7&nbsp;%</td>
<td class="coverNumMed">6 / 7</td>
<td class="coverPerHi">95.5&nbsp;%</td>
<td class="coverNumHi">21 / 22</td>
<td class="coverPerMed">80.0&nbsp;%</td>
<td class="coverNumMed">8 / 10</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">6 / 6</td>
</tr>
Expand Down
36 changes: 12 additions & 24 deletions doc/coverage/coverage/index-sort-l.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@
<td class="headerValue">lcov.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">19</td>
<td class="headerCovTableEntry">20</td>
<td class="headerCovTableEntryHi">95.0 %</td>
<td class="headerCovTableEntry">21</td>
<td class="headerCovTableEntry">22</td>
<td class="headerCovTableEntryHi">95.5 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2024-09-03 10:05:10</td>
<td class="headerValue">2024-09-09 14:59:40</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">6</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntryLo">66.7 %</td>
<td class="headerCovTableEntry">8</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntryMed">80.0 %</td>
</tr>
<tr>
<td></td>
Expand Down Expand Up @@ -81,27 +81,15 @@
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><a href="index-sort-f.html"><img src="updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><a href="index-sort-b.html"><img src="updown.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></a></span></td>
</tr>
<tr>
<td class="coverFile"><a href="script/index.html">script</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="snow.png" width=100 height=10 alt="0.0%"></td></tr></table>
</td>
<td class="coverPerLo">0.0&nbsp;%</td>
<td class="coverNumLo">0 / 1</td>
<td class="coverPerLo">0.0&nbsp;%</td>
<td class="coverNumLo">0 / 2</td>
<td class="coverPerHi">-</td>
<td class="coverNumHi">0 / 0</td>
</tr>
<tr>
<td class="coverFile"><a href="src/index.html">src</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=95 height=10 alt="95.5%"><img src="snow.png" width=5 height=10 alt="95.5%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">19 / 19</td>
<td class="coverPerMed">85.7&nbsp;%</td>
<td class="coverNumMed">6 / 7</td>
<td class="coverPerHi">95.5&nbsp;%</td>
<td class="coverNumHi">21 / 22</td>
<td class="coverPerMed">80.0&nbsp;%</td>
<td class="coverNumMed">8 / 10</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">6 / 6</td>
</tr>
Expand Down
36 changes: 12 additions & 24 deletions doc/coverage/coverage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@
<td class="headerValue">lcov.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">19</td>
<td class="headerCovTableEntry">20</td>
<td class="headerCovTableEntryHi">95.0 %</td>
<td class="headerCovTableEntry">21</td>
<td class="headerCovTableEntry">22</td>
<td class="headerCovTableEntryHi">95.5 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2024-09-03 10:05:10</td>
<td class="headerValue">2024-09-09 14:59:40</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">6</td>
<td class="headerCovTableEntry">9</td>
<td class="headerCovTableEntryLo">66.7 %</td>
<td class="headerCovTableEntry">8</td>
<td class="headerCovTableEntry">10</td>
<td class="headerCovTableEntryMed">80.0 %</td>
</tr>
<tr>
<td></td>
Expand Down Expand Up @@ -81,27 +81,15 @@
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><a href="index-sort-f.html"><img src="updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><a href="index-sort-b.html"><img src="updown.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></a></span></td>
</tr>
<tr>
<td class="coverFile"><a href="script/index.html">script</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="snow.png" width=100 height=10 alt="0.0%"></td></tr></table>
</td>
<td class="coverPerLo">0.0&nbsp;%</td>
<td class="coverNumLo">0 / 1</td>
<td class="coverPerLo">0.0&nbsp;%</td>
<td class="coverNumLo">0 / 2</td>
<td class="coverPerHi">-</td>
<td class="coverNumHi">0 / 0</td>
</tr>
<tr>
<td class="coverFile"><a href="src/index.html">src</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=95 height=10 alt="95.5%"><img src="snow.png" width=5 height=10 alt="95.5%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">19 / 19</td>
<td class="coverPerMed">85.7&nbsp;%</td>
<td class="coverNumMed">6 / 7</td>
<td class="coverPerHi">95.5&nbsp;%</td>
<td class="coverNumHi">21 / 22</td>
<td class="coverPerMed">80.0&nbsp;%</td>
<td class="coverNumMed">8 / 10</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">6 / 6</td>
</tr>
Expand Down
89 changes: 0 additions & 89 deletions doc/coverage/coverage/script/Counter.s.sol.func-sort-c.html

This file was deleted.

Loading

0 comments on commit f6fb806

Please sign in to comment.