Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [huff]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
503 views

Call another contract with huff?

How do I call another contract with huff? And then bonus points... Return the data from the call. Let's say I have a solidity-style contract with a function as such: NumberGetter.sol uint256 myNumber =...
Patrick Collins's user avatar
3 votes
1 answer
647 views

Working with huff contract in foundry (a few questions)

I'm trying to deploy huff contract in foundry to goerli testnet (it is deployed), BUT: Why is so that my runtime code looks like it was written in Solidity ? Is there a way to avoid this and create ...
obsessed's user avatar
2 votes
2 answers
459 views

Solidity immutable equivalent in huff

In the huff language, I am able to specify a constant variable with the constant keyword. (huff docs) #define constant NUM = 0x420 #define constant HELLO_WORLD = 0x48656c6c6f2c20576f726c6421 #define ...
Patrick Collins's user avatar
2 votes
1 answer
96 views

Call external contract with arguments in Huff

I am trying to make an external function call, with arguments, to a contract written in Solidity from a contract written in Huff. I am able to successfully call an external contract when the function ...
JSON_Derulo's user avatar
1 vote
1 answer
225 views

Huff language gas optimization

I am testing out using Huff language for smart contract development. It is my understanding that the benefit of Huff language is the improved gas efficiency. However, in my small test, the contract ...
JSON_Derulo's user avatar
1 vote
1 answer
81 views

How to make submod in evm assembly?

I've been playing with huff language (assembly for EVM) and tried creating a macro for subtraction modulo n. At first, I thought it would be easy since addmod(a,n-b,n) would do the job, but this isn't ...
Dragan Pilipovic's user avatar
1 vote
0 answers
7 views

Trying to get the result of modular exponentiation from 0x05 precompile using huff

I was trying to implement the call to the 0x05 precompile for modular exponentiation in Huff. I'm new to the language so was using this as a way to understand it better. Here's my implementation #...
thatonenerdy's user avatar
0 votes
1 answer
29 views

How do imports work in huff?

In the huff docs we see examples using the include keyword, such as: #include "huffmate/utils/Errors.huff" #define macro ADD_TWO() = takes (2) returns (1) { // Input Stack: [a, b] ...
Patrick Collins's user avatar
0 votes
1 answer
46 views

Calling macro with arguments in Huff

I am working on a contract that makes calls to other contracts, so naturally I wanted to use the Calls.huff from Huffmate. However, I noticed in testing that the calls kept reverting. I started ...
JSON_Derulo's user avatar
0 votes
1 answer
96 views

ABI encode external function call with multiple arguments in Huff

I am trying to make an external function call, with multiple arguments, to a contract written in Solidity from a contract written in Huff. I am able to successfully call an external contract when the ...
JSON_Derulo's user avatar
0 votes
1 answer
52 views

How to identify the calling function from within a modifier?

Two Solidity functions foo and bar both calling modifier m which emits an event Called with a unique identifier for the calling function. It could be any identifier, but it has to be unique per ...
mattes's user avatar
  • 101
0 votes
1 answer
164 views

Append data in a storage array in huff

How would one append data to a storage array in huff? Let's say for example we start off with an array that looks like: [0] And want to end with an array that looks like: [0,1]
Patrick Collins's user avatar
0 votes
1 answer
46 views

Get the return of another macro in huff

Let's say I have two macros: #define macro TOTAL_SUPPLY() = takes (0) returns (0) { [TOTAL_SUPPLY_LOCATION] sload // [supply] 0x00 mstore // [] 0x20 0x00 return ...
Patrick Collins's user avatar
0 votes
1 answer
105 views

How to return a constant variable in huff

Let's say I have a constant variable in huff: #define constant myAddress = 0x0000000000000000000000000000000000000000 How would I make a macro to read it? Since it doesn't have a storage slot, I ...
Patrick Collins's user avatar