@@ -3,13 +3,61 @@ pragma solidity ^0.8;
3
3
4
4
import {Vm} from "forge-std/Vm.sol " ;
5
5
6
- import {ERC20NoReturn , ERC20ReturningUint } from "../src/NonStandardERC20.sol " ;
7
6
import {Helper} from "./Helper.sol " ;
8
7
import {IERC20 } from "src/contracts/interfaces/IERC20.sol " ;
9
8
10
9
import {GPv2Order, GPv2Signing, SettlementEncoder} from "../libraries/encoders/SettlementEncoder.sol " ;
11
10
import {Registry, TokenRegistry} from "../libraries/encoders/TokenRegistry.sol " ;
12
11
12
+ abstract contract NonStandardERC20 {
13
+ mapping (address => uint256 ) public balanceOf;
14
+ mapping (address => mapping (address => uint256 )) public allowance;
15
+
16
+ function mint (address to , uint256 amount ) external {
17
+ balanceOf[to] += amount;
18
+ }
19
+
20
+ function approve (address spender , uint256 amount ) external {
21
+ allowance[msg .sender ][spender] = amount;
22
+ }
23
+
24
+ function transfer_ (address to , uint256 amount ) internal {
25
+ balanceOf[msg .sender ] -= amount;
26
+ balanceOf[to] += amount;
27
+ }
28
+
29
+ function transferFrom_ (address from , address to , uint256 amount ) internal {
30
+ allowance[from][msg .sender ] -= amount;
31
+ balanceOf[from] -= amount;
32
+ balanceOf[to] += amount;
33
+ }
34
+ }
35
+
36
+ contract ERC20NoReturn is NonStandardERC20 {
37
+ function transfer (address to , uint256 amount ) external {
38
+ transfer_ (to, amount);
39
+ }
40
+
41
+ function transferFrom (address from , address to , uint256 amount ) external {
42
+ transferFrom_ (from, to, amount);
43
+ }
44
+ }
45
+
46
+ contract ERC20ReturningUint is NonStandardERC20 {
47
+ // Largest 256-bit prime :)
48
+ uint256 private constant OK = 115792089237316195423570985008687907853269984665640564039457584007913129639747 ;
49
+
50
+ function transfer (address to , uint256 amount ) external returns (uint256 ) {
51
+ transfer_ (to, amount);
52
+ return OK;
53
+ }
54
+
55
+ function transferFrom (address from , address to , uint256 amount ) external returns (uint256 ) {
56
+ transferFrom_ (from, to, amount);
57
+ return OK;
58
+ }
59
+ }
60
+
13
61
using SettlementEncoder for SettlementEncoder.State;
14
62
using TokenRegistry for TokenRegistry.State;
15
63
using TokenRegistry for Registry;
0 commit comments