Questions tagged [abi]

The Application Binary Interface (ABI) is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain and for contract-to-contract interaction. Data is encoded according to its type, as described in this specification. The encoding is not self describing and thus requires a schema in order to decode.

0
votes
0answers
28 views

Why am I getting the error "Expected pragma, import directive or contract/interface/library definition?

I have "pragma solidity ^0.5.9" at the start of the file yet I still get this error. Listing.sol:1:1: ParserError: Expected pragma, import directive or contract/interface/library definition. ...
1
vote
0answers
12 views

Where can i get total list of all existent Etehereum contract ABIs?

We all know that exists https://www.4byte.directory/ where we can get mapping (function selector) -> (function signatures). Is there a dataset where I can get mapping (contract address) -> (JSON ...
0
votes
1answer
23 views

myContract.getPastEvents(“allEvents”) returns empty array

I want to get all past events from a contract I deployed on the Ropsten network. Contract is: pragma solidity ^0.5.1; contract SampleContract { uint storageData; event MamboNumberTwo(uint ...
1
vote
0answers
20 views

How to pass array parameter. Drizzle

Is there have a way to pass array parameter from the drizzle to my contract ? I want to pass an array of uint[] i have read a lot about getData() function and encodeABI but how to use it in Drizzle ?
0
votes
1answer
20 views

Get past events of a contract without ABI using Web3?

I'm building a simple explorer and I would like to list events emitted by contracts. Since I can't know the ABI of each contract, is it possible to get past events from a contract using Web3? If I ...
0
votes
1answer
8 views

How can I pass struct as function parameter with ABIEncoderV2 from outside?

have this code: struct UserScore { address user; uint score; uint time; } function getWithStruct(UserScore _user) public view returns (address, uint, uint) { return (_user.user, _user....
0
votes
1answer
40 views

Deploying contract using byteCode

In that example you can see, how to deploy a new contract having just ABI and ByteCode (uses for copy and deploy contracts from mainnet to your testnet for example). /****** Deploying new contract ...
1
vote
1answer
30 views

Reading events of the inner Solidity contract with Web3

Let's say I've got contract A { event E(); function a() public { emit E(); } } contract B { A private a; function b() public { a(); } } Now my Dapp is ...
1
vote
1answer
22 views

Hashnot matching generated from solidity contract and web3js

I want to make hash same as generating by solidity contract from web3 or ether's js. In solidity contract hash generation by below : sha256(abi.encodePacked(no of parameters)). Kindly help for it. ...
0
votes
1answer
75 views

Using AbiEncoderV2 for encoding data in raw transactions

I've come across a use-case to need to pass a struct into a Solidity function. I know this can be done via tuples. However, I need to sign and send this transaction from my node.js back-end using ...
1
vote
1answer
125 views

Abi encode / decode using strings instead of bytes

For some reason beyond my control, I need to store encoded data in a string variable. I know abi.encode and abi.decode usually work on bytes memory but I also believe that string memory can be casted ...
0
votes
1answer
11 views

Is the encoded ABI of a function guaranteed to be unique?

I assume that two functions of different prototypes will yield two different encoded ABIs. Is that correct? With regards to two functions of the same prototype, I tested a pair of functions which ...
1
vote
1answer
213 views

Solidity 0.5.2 - OpenZeppelin - New SafeERC20 callOptionalReturn(token,data)

i've been trying to mix ERC20 functionality with ERC223 function overloading technique and create a bridge for backwards compatibility using SafeERC20. For relevancy sake i renamed SafeERC20 into ...
-1
votes
1answer
32 views

Fully Decentralized Dapp [duplicate]

How can I build a fully decentralized dapp where the frontend code (.html,.css,.js) and ABI files (build/contracts/json) are stored in ipfs and contracts on test-network. But I am unable to do so ...
1
vote
0answers
24 views

Smart Contract ABI in Remix (Ethereum)

When I deploy smart contract on the Rinkeby network using Remix the ABI of smart contract does not contain its address, so how do I connect it with my frontend application.
2
votes
1answer
29 views

Understanding first evm word of reference types in assembly

Given the following function: function getArrayItems(bytes calldata) external returns ( bytes4 _signature, bytes32 _wutIsThis, bytes32 _length, bytes32 _firstItem ) { assembly { ...
1
vote
1answer
26 views

Where is the position of each paramter in a smart contract function when encoded as inputdata in a transaction

When I reviewed the BEC attack, I found the position of each parameters value in real transaction was not corresponding in to definition of function in smart contract. The exploit transaction is at: ...
0
votes
0answers
37 views

could n't find ABI constructor in my input data

I have developed the solidity code and need to verify the smart contract but I could not find Constructor Arguments ABI-encoded check the screenshots, i have developed in testnet
0
votes
1answer
41 views

Interaction with deployed contract over private blockchain Error: invalid address

I have deployed a smart contract over my private ethereum blockchain using geth. Smart Contract pragma solidity >=0.4.22 <0.6.0; contract GreenPoints { string public name; string ...
1
vote
2answers
66 views

verify and publish when using oraclize?

I'm using oraclize in my contract. import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"; When I go to verify and publish on etherscan I get this error myc:4:1: ParserError: Source "github.com/...
3
votes
3answers
309 views

web3.eth.Contract(abi, address) doesn't return contract instance

i'am trying to make a instance of my contract in js using web3, but when I use the function web3.eth.Contract(abi, address) the result is not the expected(I take the ABI from remix). this is the code:...
1
vote
1answer
51 views

abi.encodeWithSignature did not work

pragma solidity ^0.5.3; contract SimpleFallback{ event FallbackCalledEvent(bytes data); event AddEvent(uint a, uint b, uint result); event DoubleEvent(uint a, uint b); event ...
2
votes
0answers
39 views

Why I can't use two functions with same name, but different parameters

I have a function which returns address but it gives me error if I try to read it. I'll explain by a quick example: Solidity: contract TestOneReturn { mapping(uint => uint) m_Data; ...
1
vote
1answer
42 views

Can abstract contracts in solidity have state variables?

I want to have one deployed contract with my data structure and all data and another separate contract with functions that calls the deployed contract. If i've understood things correctly, one should ...
0
votes
1answer
195 views

abi.decoder in solidity

Im trying to decode a bytes memory _data parameter directly in a smart contract. Im currently running: var data = await abi.encode("120000000000000000000", user2, OCcontract1.address, "...
0
votes
3answers
47 views

ABIs and Solidity programming

This is a practical question. I am developing an application in Solidity with Remix. One thing that takes a lot of time is that when I make changes in the code, I then have to compile it in Remix and ...
0
votes
0answers
80 views

Golang web3.eth.abi.encodeParameters equivalent

I need to encode some data in golang like using the web3.eth.abi.encodeParameters(paramsTypes[], params[]) I tried to use golang's ABI.Pack(functionName string, params) but it's not a good solution ...
1
vote
0answers
112 views

How to decode Tx data? Online tool?

Is there a fast way to decode the data returning from a Smart Contract call? I know there are github projects with JS libraries to decode this kind of data (such as https://github.com/ConsenSys/abi-...
1
vote
2answers
237 views

Passing Struct as an argument in call

I am trying to pass a struct as an argument while calling the function of another contract: pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; library Test { struct TStruct { int x; ...
0
votes
1answer
73 views

Anyone with knowledge in org.web3j.abi.Type Decoder?

I am trying to decode a String with this code that I found but I have not been able to do it. String to = inputdata.substring(10, 74); String value = inputdata.substring(74, 138); Method refMethod = ...
1
vote
2answers
89 views

Encode constructor arguments used when deploying a contract

How can I encode the constructor arguments when deploying a contract? Here is my deployment function: async function deploy(abi, bin, args) { let contract = new this.web3.eth.Contract(JSON.parse(...
0
votes
1answer
57 views

what type of encoding is used by the abi specification in solidity

the abi specification of solidity which provides functions like abi.encodePacked() using a certain type of encoding (eg: for functions, a 4 byte function signature hash followed by encoding of ...
0
votes
0answers
69 views

How to decode transfer log data Node

I am trying to decode transfer log to get the addresses to and from, and potentially the value but most important address from and to. const subscribe = () => { subscription = web3.eth....
0
votes
2answers
49 views

where is the abi stored for a contract?

once a contract is compiled and deployed to the blockchain, it stores the 'runtime bytecode' in the blockchain (as I understand). but to invoke the functions of a contract by an EOA, it requires ABI ...
1
vote
1answer
652 views

How does delegatecall work from Solidity 0.5.0 onwards?

I am trying, for learning purposes only, to make a mutable smart contract, but I couldn't find anything useful on stackexchange because everything I found was using pragma solidity ^0.4.x; So, I have ...
0
votes
0answers
51 views

Can I use an address value in such a hash function

I have a method which updates 3 mappings in my contract. To save data I use some items properties and message sender address, which allows easily to get users data. mapping(bytes32 => uint256) ...
5
votes
3answers
398 views

How is Metamask able to send erc20 tokens without ABI?

When I use web3js and Truffle, I cannot send tokens to another wallet without the Token Contract ABI. But Metamask only requires the token contract address to recognize and send the ERC20 tokens. How ...
2
votes
1answer
89 views

Function selector of function that takes enum as argument

If a function takes an enum as a parameter function foo(MyEnum arg1, uint256 arg2) public returns (bool); how do I properly compute the function selector for that function?
1
vote
1answer
93 views

Error: Invalid number of arguments to Solidity function when calling safeTransferFrom function

I want to call the safeTransferFrom function to transfer ERC721 tokens. I am using the following code: var contract = this.web3.eth.contract(JSON.parse(contractabierc721)).at(contractAddress); // ...
2
votes
1answer
128 views

How to convert string to type defined by an abi.Type for payload construction?

I am writing a CLI in Go that should faciliate users to be able to make contract function calls from it. This entails generating contract ABIs and providing input parameters to the function arguments ...
0
votes
1answer
22 views

Why is it that my first original contract containing the setters and gettters are not showing up when I hit deploy?

pragma solidity ^0.4.24; contract Bank{ uint private value; constructor(uint amount) public{ value = amount; } function deposit(uint amount) public{ value += amount; ...
0
votes
1answer
83 views

Is there a way to get the deployed contract from a contract ABI?

Found an implementation of a dapp that uses a solidity contract but what's only available is the contract ABI from their project and not the solidity file. Just wanna ask if this is possible.
1
vote
1answer
20 views

Dapp SDK - Hardcoded ABIs vs Dynamic ABIs

I am developing a Javascript SDK to allow for integration of external services with our Dapp. The SDK calls the smart contracts' methods and therefore needs to know contracts addresses and ABIs. ...
2
votes
1answer
1k views

Uncaught Error: Returned values aren't valid, did it run Out of Gas?

I'm listening to events of my deployed contract. Whenever a transaction gets completed and event is fired receiving the response causes following error: Uncaught Error: Returned values aren't valid,...
0
votes
1answer
53 views

Are there UI-builders or automated UIs based on an ABI + contract address?

In order to demonstrate a contract, I want to use a generated UI, based on the ABI. The contract runs on local network, or on one of the testnets. Two options that I am aware of, and that work, but ...
0
votes
1answer
578 views

Couldn't decode uint256 from ABI: 0x

I'm trying to get all Transfer events from an account of an ERC721 token, I'm currently struggling with the following error. I googled around but couldn't find much helpful things. I'm definitely on ...
6
votes
1answer
76 views

Why is the returndata of a function returning bytes formatted in a weird way?

Solidity 0.4.25. Consider this code contract A{ function test() public view returns (bytes){ bytes memory output = abi.encodePacked(bytes32(1)); return output; } } The ...
1
vote
2answers
80 views

Can a Contract ABI change?

I am developing an app that is using the etherscan-api package. I use it to get the contract ABI. The problem is that I retrieve it via the API every time the function is called. My question is: ...
3
votes
0answers
50 views

What are function signatures in ABIv2 and how are they enhancing Ethereum?

EIP-712 talks about function signatures being bytes4. I understand that the new version of the ABI format will contain a pre-defined set of keccak256 hashes of function names, as per the work done on ...
1
vote
0answers
205 views

How to encode tuple as input parameter to function using web3j

I am attempting to call a solidity function that looks something like the following: function fillOrder( Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) Using ...