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
0
votes
1answer
19 views

What is the "bytes memory" in (bool success, bytes memory) = some_address.call{value: some_amount}("")

I understand that the success tells if the receive/fallback methods returned successfully but what does the memory give?
0
votes
0answers
11 views

Function call reverted when it is called two times in another function

I try to write a contract where you can swap different assets at once using 1inch DEX. Everything is working fine (getting data from 1inch api, call the contract, ...) except when I swap more than one ...
1
vote
1answer
39 views

Why do you have to specify calldata or memory for complex types?

Why do you have to specify calldata or memory for complex types like (string, array, struct etc)?
0
votes
1answer
14 views

default storage location

This post (When should I use calldata and when should I use memory?) explains the differences between calldata and memory. However where are function arguments or variables within functions stored if ...
0
votes
0answers
36 views

Constructing hex data payload for contract interaction

I am trying to construct the data payload as described here and quoted below for interacting with a contract: https://github.com/ethereumbook/ethereumbook/blob/develop/06transactions.asciidoc#...
2
votes
2answers
68 views

How can I decode calls to the songbird network?

for example: I am a multisig signer. And I want to decode the call data that is used to call a specific smart contract. example on smart contract : 0x02f0826ef6aD107Cfc861152B32B52fD11BaB9ED (WNat) I ...
1
vote
1answer
98 views

HALF of a transaction reverted

I am reading an interesting honeypot posted years ago. But I was confused by how the honeypot contract is implemented. More specifically, take this transaction as an example. As we can see, during ...
0
votes
0answers
31 views

please help me How do you pass a struct type defined value into a function call?

I am trying to call this function that takes in a Struct as an argument. My question is how does this look like on the bytecode level? And how does solidity know when a struct begins/ends? I'm looking ...
1
vote
1answer
43 views

web3.exceptions.ValidationError: with tuple[], address, bytes

Getting the following validation error and could not point to why Could not identify the intended function with name `z`, positional argument(s) of type `(<class 'list'>, <class 'str'>, &...
0
votes
1answer
52 views

How does msg.data is encoded?

I have a call for this function (from here): function setup( address[] calldata _owners, uint256 _threshold, address to, bytes calldata data, address ...
0
votes
0answers
67 views

Who is the msg.sender when a library makes a call()

I have a library that is making a call to an external address like this externalAddress.call(callData) This callData is calling a function of another contract that is utilizing the msg.sender value. ...
0
votes
1answer
148 views

How to convert in-memory static array to calldata static array?

I have a contract called Erc20Recover in which I have the following function: pragma solidity >=0.8.0; contract Erc20Recover { function _setNonRecoverableTokens(IErc20[] calldata tokens) ...
0
votes
0answers
26 views

Getting a specific var of <class 'web3.datastructures.AttributeDict'>

I have this code that is printing out all the vars of the class; however, I am only interested in the "input" var. Is there an easy way to access this this "'input': '...
1
vote
1answer
43 views

Where are value-type function arguments stored in Solidity?

When we define a function, say test(uint256 val). I would presume val would be implicitly defined in memory. But what if we change the funtion visibility modifier, does that change the location of ...
0
votes
1answer
26 views

Data location memory or calldata [duplicate]

Can someone tell me how to solve this problem? I am not advanced and cannot figure it out.
1
vote
0answers
38 views

Function argument sizes and gas usage

Is there any penalty for the amount of data passed to a function? Asking because I see non-linear behavior in gas usage during testing when sending more than 31 items in the array. struct Payment { ...
1
vote
1answer
517 views

How to instantiate a calldata array?

I know how to instantiate a memory array. Looks like this: address[] memory users = new address[](1); users[0] = address(0x0); But I cannot create a calldata array in this same fashion. Any pointers?
1
vote
2answers
523 views

How does Uniswap allow a user to specify which tokens the user wants to swap in this low level function?

I'm looking at the function swap that allows a user to swap token0 for token1 from Uniswaps UniswapV2Pair contract - https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2Pair.sol. ...
0
votes
1answer
122 views

Logic in approveAndCall function for erc20 token deprecated & not working

I am following along with a older tutorial on making an ERC20 token in order to learn Solidity a little better. Since the tutorial is old, I've had to change a lot of things so far to get it up to ...
0
votes
1answer
106 views

How to execute a transaction within a contract given to address, and calldata?

Let's say I've got a contract called MyContract. My contract has a function which receives calldata and an address for another contract, called OtherContract I want to be able to take the calldata and ...
1
vote
1answer
85 views

Data location specification and bytes32

Why is data location not required to be specified for bytes32?
0
votes
1answer
175 views

Incorporate calldata inside smart contract

I'm currently trying to use the 1inch API documented here: https://docs.1inch.io/api/nodejs-web3-example I would be interested in using the 1inch pathfinder api from a solidity smart contract to make ...
0
votes
1answer
45 views

Check if calldata contains string

I have a function that is called with some data - "SOMETHING". function checker(address _from, uint _value, bytes calldata _data) external{ //HOW to check if _data contains "...
1
vote
0answers
147 views

how to pass fix size array via interface in solidity 0.4.25

I used the following code interface test{ function testfunction(uint[20] memory P, uint[20] memory Q) external returns(uint,bool,uint); } It gives the error Location has to be calldata for external ...
1
vote
0answers
44 views

Error in signing a raw transaction javascript -- calling a contract + attaching some msg.value

Here, I am trying to call a function(embrace) on a smart contract on Ropsten that needs two parameters and msg.value of 0.01 ether. But it's showing up the error that the msg.value is not sufficient. ...
0
votes
1answer
16 views

Why did I get an error about using memory keyword in function getname?

// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; contract s12 { uint public age; string public name; bool rollno; constructor() public { rollno= false; } ...
0
votes
1answer
140 views

Why does this call to DSProxy fail?

Take these two contracts, both deployed on Kovan and with the source code verified: DSProxy: 0xa92Bed719071A4d33B0B348513E7e866a6ff6B3F TargetContract: 0xE3CD2e7a628b57d3e50c5f7B921182f676721bDF And ...
0
votes
1answer
535 views

Easiest way to call an implementation function from a proxy contract in Remix

I have the following code in my remix.ethereum.org project: pragma solidity ^0.6.10; // SPDX-License-Identifier: Unlicensed import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/...
1
vote
1answer
890 views

Why does retrieving stored data cost so much compared to using calldata in Solidity?

I have a function that I need to pass an arbitrary length array of addresses to. In remix, just calling a function that has an address[] costs around 30k gas for an array of 5 addresses: function fun(...
0
votes
1answer
214 views

Return multiple values from diferent smart Contracts

I have two contracts. The first contract has a function called get() that returns this values: uint _value1 address _value2 address _value3 string memory _value4 string memory _value5 uint _value6 ...
2
votes
1answer
108 views

Get return value of a low level call

I'd like to get the return value of a low level call. (bool success, ) = address(0x1234...7890).call{value:0}(callData); This post discusses a solution that sounds like it should work, but it doesn'...
0
votes
0answers
116 views

Is there a way to know if a Solidity method will revert?

I have some solidity methods in my contract, and when i make a send in web3.js i would like to know if there is a way to know if the functions are going to revert by using call. Per-example , in ...
0
votes
1answer
288 views

Data location must be "calldata" for parameter in external function,

I'm getting the following error: Data location must be "calldata" for parameter in external function, but "memory" was given. for the following function: function _registerAirline(address ...
0
votes
1answer
83 views

Error with this.balance

pragma solidity 0.5.9; contract Testing{ function participate()public payable{ uint winner = 9; require(msg.value == 0.1 ether); if ( winner==9) { ...
1
vote
2answers
45 views

When i call a function: Error: Returned error: VM Exception while processing transaction: invalid opcode

I work on Truffle. My contract is A and its function is infoRep(). infoRep() returns some data. Whenever i call the function in Truffle console the below error occurs: Error: Returned error: VM ...
1
vote
2answers
190 views

Correct syntax for require required

I am getting following error message with require statement: Error: Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use ""...
3
votes
2answers
1k views

How to generate calldata for a function

I have got as far as generating the method ID for the function: function transfer(address src, address dst, uint256 amount); The method ID would be: bytes4(keccak256("transfer(address,address,...
2
votes
1answer
2k views

Why Remix IDE asks for CallData and what value we have to give? [duplicate]

In my several programs which I ran through remix IDE, I got a CallData text box. I don't know what value I have to give to this Calldata text box. I tried the following: from: address : "...
3
votes
1answer
2k views

Remix IDE: What is the purpose of Calldata and Transact Tab

I am trying to execute the following code on Remix IDE. pragma solidity ^0.5.4; contract GuessTheNumberChallenge { constructor() public payable { require(msg.value == 1 ether); } ...
0
votes
1answer
94 views

How to call function via interface from another contract when calldata type is used

I have declared the following interface: interface Test { function airDropMultiple( address[] calldata recipients, uint[] calldata tokenAmount ) external ...
0
votes
2answers
44 views

Mining with additional data

i'm a beginner in using blockchain. Based on my knowledge, there are two ways blocks are created, mining and sending transactions. As there is an explanation to input additional data while sending a ...
0
votes
0answers
29 views

Call Type Explained [duplicate]

I have yet to come across a well explained definition of all the call types in one place. * One of call * Callcode * Delegatecall * Staticcall Would be very grateful if someone could explain the ...
2
votes
1answer
702 views

What data is in 'calldataload'?

I want to parse event logs that are generated by the contract shown below, which assigns different sections of calldataload to the 4 Topics, and the Data section, of the event logs. Topic 0 receives ...
73
votes
1answer
23k views

When should I use calldata and when should I use memory?

I have seen people use both memory and calldata keywords when writing Solidity. Specifically, they are used when declaring function parameters that take dynamic types like 'structs' or 'arrays'. When ...
0
votes
1answer
53 views

How to get the call graph of a mainchain transaction?

Simple question, but I couldn't find the answer. There are transactions like this one which involve many chained contracts. But as storage modify the functions being called and calldata doesn t ...
10
votes
2answers
3k views

What is a function selector?

I am reading an article, it says: To enable deployment on the Ethereum platform, the contract functions are compiled into EVM bytecode and a piece of code called function selector is added, ...
0
votes
1answer
2k views

member not found or not visible after argument-dependent lookup in mapping

pragma solidity >=0.4.0 <0.7.0; contract New{ mapping(address => string) public users; string name; address[] public userAddress ; //string[] public userNames; ...
0
votes
0answers
67 views

Call Arguments? and Explicit call?

I am trying to understand the arguments of the built-in Solidity's (or EVM's: I am not sure) call function. I know it has 4 arguments. I am trying to understand the call function at: Syntax Error in ...
1
vote
0answers
22 views

Calling private function from external - where are referenced type parameters stored in the end?

Let's assume we have something like: contract C { function externalFunction(uint256[] calldata data) external { privateFunction(data); } function privateFunction(uint256[] memory data)...
1
vote
1answer
208 views

pass storage through interface to library

Here is what am i doing: There is a library, accept storage argument as parameter, then do some math and return the result. And there is a contract to call the function in the library, and an extra ...