Questions tagged [huff]
The huff tag has no usage guidance.
14
questions
1
vote
0
answers
16
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
#...
0
votes
1
answer
38
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]
...
0
votes
1
answer
59
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 ...
0
votes
1
answer
131
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 ...
2
votes
1
answer
118
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 ...
1
vote
1
answer
281
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 ...
0
votes
1
answer
61
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 ...
3
votes
1
answer
695
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 ...
1
vote
1
answer
90
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 ...
0
votes
1
answer
186
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]
0
votes
1
answer
50
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 ...
3
votes
1
answer
540
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 =...
0
votes
1
answer
116
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 ...
2
votes
2
answers
489
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 ...