Skip to content

Commit c68c15d

Browse files
authored
Merge pull request #148 from huff-language/fix/forge-test-failing
Fix `forge test` failing
2 parents 5c74f6f + 5efe0f3 commit c68c15d

21 files changed

Lines changed: 524 additions & 293 deletions

‎src/math/SafeMath.huff‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
/// @notice Math module over Solidity's arithmetic operations with safety checks
55
/// @notice Adapted from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol)
66

7-
#include "../utils/Errors.huff"
8-
97
// Interface
108
#define function safeAdd(uint256,uint256) pure returns (uint256)
119
#define function safeSub(uint256,uint256) pure returns (uint256)

‎src/proxies/Clones.huff‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
/// @notice Adapted from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/Clones.sol)
1313

1414
#include "./ERC1967Upgrade.huff"
15-
#include "../utils/CommonErrors.huff"
1615

1716
// BEFORE ADDRESS
1817
//--------------------------------------------------------------------------------//

‎src/proxies/ERC1967Upgrade.huff‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/// @dev This abstract contract provides getters and event emitting update functions for https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
66
/// @notice Adapted from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/ERC1967/ERC1967Upgrade.sol)
77

8+
#include "../utils/Errors.huff"
89
#include "../utils/CommonErrors.huff"
910

1011
// Function Definitions

‎src/tokens/ERC20.huff‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
/// @notice Adapted from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
77

88
// Imports
9-
#include "../utils/Errors.huff"
109
#include "../auth/NonPayable.huff"
1110
#include "../data-structures/Hashmap.huff"
1211

@@ -70,7 +69,7 @@
7069
[INITIAL_DOMAIN_SEPARATOR] sstore // []
7170

7271
// Copy the runtime bytecode with constructor argument concatenated.
73-
0x67 // [offset] - constructor code size
72+
__codesize(CONSTRUCTOR) // [offset] - constructor code size
7473
dup1 // [offset, offset]
7574
codesize // [total_size, offset, offset]
7675
sub // [runtime_size, offset]
@@ -243,24 +242,6 @@
243242
[BALANCE_SLOT] STORE_ELEMENT_FROM_KEYS(0x00) // [value, from, to]
244243
}
245244

246-
/// @notice Approve
247-
/// @notice Approves an address to spend an amount of tokens on the caller's behalf
248-
#define macro APPROVE() = takes (0) returns (0) {
249-
0x24 calldataload // [value]
250-
dup1 0x00 mstore // [value]
251-
0x04 calldataload // [to, value]
252-
caller // [from, to, value]
253-
254-
// Emit the approval event.
255-
dup2 dup2 // [from, to, from, to, value]
256-
__EVENT_HASH(APPROVAL_EVENT_SIGNATURE) // [sig, from, to, from, to, value]
257-
0x20 0x00 // [0, 32, sig, from, to, from, to, value]
258-
log3 // [from, to, value]
259-
260-
// Store the value at slot = keccak256(from . to)
261-
STORE_ELEMENT_FROM_KEYS(0x00)
262-
}
263-
264245
/// @notice Domain Separator
265246
/// @notice Returns the EIP-712 domain separator
266247
#define macro DOMAIN_SEPARATOR() = takes (0) returns (0) {

‎src/utils/Bytecode.huff‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/// @notice Low-level bytecode utilities
55
/// @notice Adapted from 0xsequence/sstore2 (https://github.com/0xsequence/sstore2/blob/master/contracts/utils/Bytecode.sol)
66

7+
#include "./Errors.huff"
78
#include "./CommonErrors.huff"
89

910
/// @notice Generate a creation code that results on a contract with `_code` as bytecode

‎src/utils/CREATE3.huff‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/// @notice Deploy to deterministic addresses without an initcode factor
66
/// @notice Adapted from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/CREATE3.sol)
77

8+
#include "./Errors.huff"
89
#include "./CommonErrors.huff"
910

1011

‎src/utils/CommonErrors.huff‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/// @author asnared <https://github.com/abigger87>
44
/// @notice Wrappers for reverting with common error messages
55

6-
#include "./Errors.huff"
76

87
// Error Constants
98
#define constant NOT_AUTHORIZED_ERROR = 0x4e4f545f415554484f52495a4544000000000000000000000000000000000000

‎src/utils/MerkleDistributor.huff‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
// Imports
10+
#include "./Errors.huff"
1011
#include "./CommonErrors.huff"
1112
#include "./MerkleProofLib.huff"
1213
#include "./Address.huff"

‎src/utils/ReentrancyGuard.huff‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/// @notice Gas optimized reentrancy guard for smart contracts.
55
/// @notice Adapted from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ReentrancyGuard.sol)
66

7+
#include "./Errors.huff"
78
#include "./CommonErrors.huff"
89

910
// Interface

‎src/utils/Refunded.huff‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
/// @notice Efficient gas refunds distributed through a modifier
55
/// @notice Adapted from Zolidity (https://github.com/z0r0z/zolidity/blob/main/src/utils/Refunded.sol)
66

7-
#include "./Errors.huff"
87
#include "./ReentrancyGuard.huff"
98

109
/// @notice The base cost of refunding

0 commit comments

Comments
 (0)