Questions tagged [calldata]

Questions about the "data" part in a transaction, which can be accessed by "msg.data". web3.eth.getTransaction calls this field "input".

Filter by
Sorted by
Tagged with
1 vote
2 answers
33 views

Is it possible to encode a struct to calldata when calling another function?

Let's say I have the following struct: struct Price { uint value; } Let's say I have the following function: function isPriceOkay(Price calldata price) public pure returns (bool) { return ...
robeng's user avatar
  • 41
0 votes
1 answer
33 views

How to change the offset of calldata value?

Suppose I have a contract below: contract Hack { Switch private target; constructor(address _target) { target = Switch(_target); } function test() external pure returns (...
Shubham's user avatar
  • 25
0 votes
1 answer
51 views

Can't send eth + data into contract with etherjs

I want to send eth + data into this contract: 0x5293Bb897db0B64FFd11E0194984E8c5F1f06178 like this transaction: https://sepolia.etherscan.io/tx/...
Zambaize's user avatar
1 vote
1 answer
39 views

How can a bytes32[] variable have a custom method (i.e., verifyCalldata)?

Code: https://www.contractreader.io/contract/mainnet/0x0C7D4bdA40CF78F9F1BAf6e3D5774f1E22c9CC4B My question is about this verifyCalldata() call: function verifyAddress( uint256 _projectId, ...
Donn Lee's user avatar
  • 113
0 votes
2 answers
151 views

Callback After Dapp Approval

I have had a contract made for me, and a dapp set up by a developer. My question is how can i produce an event on my website when the user has approved spend of a certain token? Can i use a javascript ...
Jim Mike's user avatar
6 votes
3 answers
120 views

Is there a method to prove that data has been fetched from a block on a blockchain?

I'm considering a problem that I havent seen someone else look at yet. The problem statement is how can we prove that some data (e.g., a transaction, a block header) has been fetched from a block of a ...
Mostafa's user avatar
  • 61
1 vote
0 answers
112 views

Decoding Result Struct from tryAggregate3 Multicall3 with web3.py

Hello Ethereum StackExchange community, I'm currently working with the Multicall3 contract's tryAggregate3 function which returns an array of Result structs with the following format: struct Result { ...
Baraa's user avatar
  • 11
1 vote
1 answer
23 views

How can I access the 3rd argument of _safeMint?

I am minting an ERC721 using _safeMint and I am setting the 3rd argument to a string. I want to be able to access this data argument using the transaction hash or whatever I have to access the ...
Falcon Stakepool's user avatar
2 votes
1 answer
107 views

Why can you slice bytes in calldata but not in memory?

If trying to slice bytes in memory one gets the error below. The solidity docs give no explanation just state that array slices are only supported for calldata as of now. TypeError: Index range access ...
FreddyC's user avatar
  • 301
1 vote
1 answer
65 views

Is there MEV in replacing referral code in calldata?

I've been reading AAVE document and saw that user can include a referral code inside deposit calldata, so that the referrer can receive some rewards(source: https://docs.aave.com/developers/v/1.0/...
johnhckuo's user avatar
  • 341
2 votes
2 answers
637 views

How to check state value by using cast in Foundry?

I'm a beginner in develop solidity and using Foundry. I've created a contract which is include some state value as below address[] public owners; mapping(address => bool) public isOwner; ...
Jung's user avatar
  • 31
0 votes
1 answer
69 views

Deploying Contract to Solidity shows only one function called "CALLDATA"

I hope someone can help me as there might be an easy solution. I just started getting into writing smart contracts and thought the best way to learn is by looking at some Contracts, deploying them and ...
magicblade305's user avatar
0 votes
0 answers
44 views

How would look like calldata for bytes[] calldata argument?

Imagine I have a function with such signature in Solidity: function doThing(bytes[] calldata arr) external; how are elements of arr are packed in bytes? I would say that first 4 bytes is bytes4(...
gabbi's user avatar
  • 1
0 votes
1 answer
40 views

using encodePacked vs encodeWithSignature when call function on an external contract

When we call a function on an external contract, we need to put calldata as an argument. // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.10; contract test1 { mapping (address => ...
imelon2's user avatar
  • 528
0 votes
1 answer
43 views

Unintentional extra arguments on calldata

I manually inserted 2 32 bytes arguments to a function flipSwitch(bytes memory someData) whose function identifier happens to be 0x30c13ade. My manual arguments: ...
IBeFrogs's user avatar
0 votes
0 answers
29 views

Get all transactions from a contract in a range of block numbers

I need to get all contract transactions from a range of blocks (startBlock-endBlock). what is the best way to do this? any recommended APIs for this purpose?
Adrin's user avatar
  • 199
1 vote
1 answer
30 views

calldata usage, difference between the method calling function with calldata

I recently studied optimism, and found that appendSequencerBatch() of CanonicalTransactionChain contract called with calldata. I assumed that this function was called using 0x(functionSelector)+(data.....
gun bos's user avatar
  • 25
2 votes
1 answer
244 views

How is the data parameter constructed in the swap function of 1inch AggregationRouterV5

The swap function in AggregationRouterV5 is like this function swap( IAggregationExecutor executor, SwapDescription calldata desc, bytes calldata permit, bytes calldata data ) ...
Joe's user avatar
  • 43
1 vote
1 answer
417 views

Calling function of deployed contract with calldata

Hello I'm trying to call the function fulfillBasicOrder of the Seaport Contract and I keep getting that it has failed without any further informations. Does someone know what I might do wrong ? This ...
MM1's user avatar
  • 213
2 votes
1 answer
200 views

Calling deployed contract with calldata and without interface

I want to call the Seaport contract (SeaportContract), more precisely the fulfillBasicOrder function but I have some problems. First I know that in order to call another function contract we need to ...
MM1's user avatar
  • 213
0 votes
1 answer
798 views

How do I call another contract's function in solidity and also specify amount of ether to send?

I want to call another contract's function when I call a function in my contract and send my msg.value to the other function. Here is an example of what I am trying to achieve: function execute(...
MuellerSachs's user avatar
1 vote
1 answer
56 views

What is Solidity's equivalent of raw_call()?

I'm wondering, does Solidity also have a raw_call() function like Vyper which sends a byte[] array (payload) as calldata to a specific address? If so, what is that function? Is it also raw_call()?
MuellerSachs's user avatar
3 votes
1 answer
282 views

calldata ambiguity - likelihood of hash collision

To call a function in a smart contract, a transaction (or a message call depending on where it originates from) is sent to the contract address with a data field that has the encoded function ...
Adham's user avatar
  • 181
3 votes
2 answers
1k views

What is calldata offset for dynamic calldata arrays?

The Solidity docs say this about dynamic calldata arrays: For dynamic calldata arrays, you can access their calldata offset (in bytes) and length (number of elements) using x.offset and x.length But ...
Paul Razvan Berg's user avatar
0 votes
1 answer
908 views

How to decode the msg.data on a function in plain solidity?

I was wondering how to decode the data payload received on a function At first, I thought it would be enough with knowing the order of the variables and the exact data type of them at the moment of ...
Stalin Macias's user avatar
1 vote
0 answers
70 views

test transaction call brownie

in brownie, i have a function that calls another one in the same contract, and i want to test if it does it properly : The function : function onTokenTransfer( address _sender, uint256 _fee, ...
noro meb's user avatar
  • 338
0 votes
3 answers
180 views

Unable to send `value` with payable function in Solidity

I am unable to specify a value parameter when calling a payable function in Solidity. The function in question has the following signature: function batch(bytes[] calldata calls) external payable ...
Sabnock01's user avatar
1 vote
1 answer
708 views

Maximum calldata size per block

I'm trying to use calldata to store data. It works fine with some smaller datasets (50kb), but for some reason when I try store ~150kb I get the following error code : -32603 message : "[ethjs-...
James's user avatar
  • 125
1 vote
1 answer
205 views

ERC677 transferAndCall

i want to send some LINK to a contract B from a contract A, and in the same function call a function in contract B, im using transferAndCall(address _to, uint _value, bytes _data) function in the ...
noro meb's user avatar
  • 338
0 votes
0 answers
672 views

How to get amount and pair address from signed tx on Uniswap v3

I'm learning to understand call data and trying to decode information what swap should happen from signed tx, which is done on Uniswap V3. It means ideally find out Uniswap pair address and amount in ...
foyertly's user avatar
0 votes
1 answer
140 views

How to understand the difference between transfer and function call using assembly call(g,a,v,in,insize,out,outsize)

I understand that if there is an external function call, it will use all 7 parameters of the call(g,a,v,in,insize,out,outsize). However, I got a question I know low-level transfers like .transfer() ...
Yu.Pan's user avatar
  • 15
1 vote
2 answers
257 views

How to get internal calls Calldata in solidity?

How to get signature of setA() when user is calling setB() for below code snippet ? contract Sig { function setA() public { // How to get function signature of `setA()` at this location while ...
Namit Jain's user avatar
1 vote
1 answer
105 views

How to merge calldata onchain

I'd like to append some data using some generic call in solidity. Lets say I have a function that looks like so: function doWork(uint256 number, string name) { //... } //Pseudo code the tuple is ...
Ritzy Dev's user avatar
  • 271
1 vote
1 answer
110 views

Does it make any sense to specify reference type function input parameters as calldata if the given function is only called contract to contract?

As far as I am aware contract to contract calls store input arguments in memory. Or put more precisely they store them in memory and they can be accessed with CALLDATALOAD within the the new call ...
FreddyC's user avatar
  • 301
1 vote
1 answer
24 views

What are the advantages/disatvantages to specify a struct param in a function as calldata vs. memory?

If I am not modifying the input parameter in the function body are there any reasons a reference type parameter should be labeled as stored in memory? More generally what are the reasons to go for ...
FreddyC's user avatar
  • 301
1 vote
1 answer
697 views

What is the limit in calldata parameters in EVM?

Is it possible to send array of 2^18 or 262144 numbers of elements as a calldata? How much gas would that cost? Does it even make sense to have that large array in terms of gas cost?
Dragan Pilipovic's user avatar
0 votes
1 answer
1k views

how to sign with raw transaction data - EthersJs, Infura

As the below picture display. If I know the raw transaction data, then how can I sign this transaction with the ethers.js? Thanks. Supplement The raw transaction data is display on the metamask. I ...
SylorHuang's user avatar
2 votes
2 answers
707 views

is there a tool for building calldata for calling methods?

I am trying to write a script to call the following method: /// @notice Creates a proposal /// @param _targets The target addresses to call /// @param _values The ETH values of each call ...
Jesse Jacob's user avatar
0 votes
1 answer
75 views

Why isn't calldata used in this function's argument? (OpenZeppelin/OwnableUpgradeable.sol)

Solidity noob here; reading about data locations i've learned that whenever you don't need to store or modify a function's input value it's actually more gas efficient to set its location to calldata (...
user113310's user avatar
2 votes
0 answers
440 views

Solidity assembly code - calldatacopy, delegatecall

I have been trying to understand how assembly code works,spending lots of hours, but I could not. Please help me Basically, I am digging into a proxy contract, and I do not really understand ...
DHC's user avatar
  • 357
0 votes
0 answers
106 views

Solidity assembly function returns false on forked blockchain

I try to simulate submitting transaction to Multisig contract and confirming transaction by other multisig members by impersonating their account on Hardhat with forking. I managed submitting and ...
Sergen's user avatar
  • 1
1 vote
0 answers
306 views

Web3 Generate QR Payment

I am trying to create a method that allows a user to pay their invoice using ETH. I know in Web3 I can send a transaction, which is handy. But for this to work at the start I want to be able to just ...
RussellHarrower's user avatar
1 vote
1 answer
175 views

Why are function signatures in calldata not padded by 0s given the 32 bytes word size of the evm?

the call data below corresponds to the following method call MethodID: 0xa694fc3a [0]: 00000000000000000000000000000000000000000000000021192f2c6946a040 the calldata: ...
FreddyC's user avatar
  • 301
1 vote
1 answer
59 views

Are external contract to contract calls input data also stored in the calldata space?

I am aware that calldata is a read-only byte-addressable space. When calling a contract from an EOA it contains the function signature of the call as well as the input args. However when a contract ...
FreddyC's user avatar
  • 301
2 votes
1 answer
839 views

Multiple matching functions error when doing interface.encodeFunctionData

I have openzeppelin's standard ERC721 contract. Below is the helper function that returns bytes data that will be used for some purpose. async function getErc721SafeTransferFromTransaction(...
Haris Nabeel's user avatar
1 vote
2 answers
287 views

How can I call a function which needs string calldata as input parameter?

I have a function which has an input parameter as string calldata. I don't know how to pass a string to this function. The simple solution gives me a compile error as it cannot convert a ...
Azzurro94's user avatar
  • 123
1 vote
1 answer
1k views

How to decode an ethers.js call?

I have a smartcontract deployed on Goerli at 0x77a286b658191c9A8504D9e8E5c7B6381caA9e72. It uses @openzeppelin/contracts/access/AccessControl.sol, allowing granting roles to some addresses, and ...
Fabien's user avatar
  • 41
0 votes
1 answer
28 views

I want to track how many times a person has waved to me. What do I need to add then?

Hi I am pretty new to coding and am sometimes getting confused in how to do certain things. In my code, I want to track how many times a person has waved to me. What do I need to add then? here is my ...
Michelle's user avatar
2 votes
1 answer
179 views

What does it mean to "send a contract calldata"?

While reading this blog about Connext.Network, I encountered with the following sentence: Connext is an interoperability protocol that allows users to send fast, fully non-custodial transfers or ...
Stav Alfi's user avatar
  • 216
2 votes
1 answer
964 views

How to test a function that has calldata parameters using Foundry?

I am trying to test out a function similar to the one shown below: function add (Complex calldata x, Complex calldata y) pure returns (Complex memory result) { result = Complex(x.a.add(y.a), x.b....
Alex Amarandei's user avatar