Questions tagged [abi.encodewithsignature]
The abi.encodewithsignature tag has no usage guidance.
19 questions
0
votes
1
answer
55
views
Abi Encode with Signature - String memory as parameter to function
I'm trying to do
abi.encodeWithSignature(
"mint(address, string **memory**)",
receiverAddress,
tokenURI
)
The function definition ...
0
votes
1
answer
118
views
How to abi.encodeWithSignature the function which contains structure as the parameter in solidity?
I want to call Uniswap's collect function which is in NonFungiblePositionManager contract using delegatecall. But the collect function takes the structure as the parameter.
Here is the collect ...
1
vote
1
answer
115
views
Chainlink CCIP publishing message (encoded function call) to bring USDC from another chain is getting reverted with "Ready for manual execution" error
The encoded function call corresponding to bringUsdcFromAnotherChain when called using publishMessageToBringUsdcFromAnotherChain is getting reverted with "Ready for manual execution" error ...
1
vote
1
answer
33
views
abi.decode() does not accept "address payable" as type
function myStatic() public returns (uint256[] memory, address payable[] memory, bytes32, string memory) {
bytes memory encodedResult;
bool success;
(success, encodedResult) = address(...
1
vote
1
answer
56
views
Low-level function call to other contract is causing revert with correct function selector
I have 2 contracts, FloorInfo and Elevator.
I want to call the goTo(uint) in the Elevator contract from the FloorInfo contract using a low-level call, this happens in the go() function inside the ...
1
vote
1
answer
64
views
How can I execute a call from a contract using another contract?
I own a contract (contract A), which in turn, when deployed, created a secondary contract (Contract B).
I have funds trapped in contract B, contract B, has a function that allows its owner to withdraw ...
1
vote
2
answers
985
views
'Address: low-level call failed'
I'm practicing 'Damn Vulnerable Defi #3.Truster'. I created Attacker contract and tested truster.challenge.js. But I got an 'Address: low-level call failed' error. Is this error related to ...
1
vote
1
answer
475
views
Encoding a bytes array with function signature: "TypeError: This type cannot be encoded."
I have a function in a smart contract I'm trying to call with call.
function doStuff(bytes[] calldata data) external payable {
To call it, I'm running:
bytes[] memory dataArray = new bytes[](1);
(...
1
vote
2
answers
113
views
Call fails when I send 2 params to other contract with abi?
I can send 1 parameter to Contract A (otherContract) and it works well. But when I send 2 parameters, it fails. What do I do wrong?
Contract A:
function sumTwoParams (uint256 _num1, uint256 _num2) ...
1
vote
1
answer
224
views
Able to call swap function with interface, but not with .call(
SwapByInterface works, swapByCall doesn't. Edit: have changed code to require success of internal call, previously both calls succeeding because errors not bubbling up, made the question more ...
0
votes
1
answer
195
views
Signature from array of tokenId's isn't verifying
The domain message is:
struct Offer{
address from;
address to;
uint256 nonce;
uint256[] tokenIds;
uint256 duration;
}
bytes32 constant ...
1
vote
1
answer
1k
views
What is the difference between encodeWithSelector and encode?
I've been messing around with the abi.encode... functions and I think I have a good grasp of the differences, except abi.encode and abi.encodeWithSelector. Because, they give similar but slightly ...
0
votes
1
answer
854
views
How do I pass a struct as an argument in delegatecall to a proxy library?
I am trying to call the buyAssetsForEth function in the OpenSeaMarketV2 library using delegatecall as follows:
pragma solidity 0.8.4;
contract Owned {
address public owner;
constructor(...
0
votes
0
answers
325
views
Revert transaction payable error with abi.encodeWithSignature
I have two contracts:
Validate.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
contract Validate {
function validate(address _verifier, bytes memory _validityData) public view {
...
0
votes
1
answer
3k
views
Encode function data with value
I have Contract A:
import "@openzeppelin/contracts/utils/Address.sol";
contract A {
using Address for address payable;
function proxyCallWithValue(address payable target, bytes memory ...
0
votes
1
answer
776
views
solidity call(abi.encodeWithSignature) not working
I have problems using the "address.call(abi.encodeWithSignature(....))" method.
Below is the code I am testing in Remix:
pragma solidity >=0.7.0 <0.9.0;
library lib {
event ...
3
votes
0
answers
1k
views
abi.encodeWithSignature and abi.encode have inconsistent results with dynamic arrays
pragma solidity 0.8.0;
function isMemberOfArrayEncodedTest(address member, address [] memory memberArray) public returns (string memory){
bytes4 sig = bytes4(keccak256("isMemberOfArray(...
1
vote
1
answer
2k
views
Encode function signature with callback function as parameter in Solidity
I would like to use low-level call to make calls to my contract. The function takes a callback function as an argument and I am not able to encode it.
This is my code:
contract B{
event Foo();
.....
1
vote
1
answer
343
views
setting value using address.call() doesn't works
I am trying to run a setter function (testCallBar) in Caller contract which should run setVal() of Receiver contract using call method. But it does not works. testCallFoo() works as expected but ...