Questions tagged [contract-invocation]

Questions regarding the act of calling or interacting with (a.k.a. invoking) a contract on the Ethereum blockchain by a user or another contract on the blockchain. Includes both local invocation by call and global invocation by transaction.

Filter by
Sorted by
Tagged with
0
votes
1answer
6 views

What is the ethersjs equivalent of `web3.eth.call` in web3js?

web3.js has the ability to call a transaction and get return data without sending a transaction: web3.eth.call(callObject [, defaultBlock] [, callback]) ethersjs apparently does not have this ...
0
votes
0answers
9 views

How does specifying job parameters on Chainlink work?

I am trying to understand Chainlink, and I am running into a wall. I found this tutorial, which explains how I can create a job spec using JSON. The tutorial explains that you can specify the url, ...
1
vote
0answers
22 views

How to check current status of state variables

I have deployed my contract locally into Ganache (GUI) and then send/call lot of transactions. After these transactions, now I want to check the current status of all state variables. Is there any way/...
0
votes
0answers
18 views

Did I get this right that with delegatecall the msg.sender is the last entity that calls delegatecall (example below)?

In other words: If contract B is called by contract A: B: function externalcall() public { //msg.sender is contract A... msg.sender.call.value(0); } Then assuming msg.sender.call above calls back ...
0
votes
0answers
13 views

Cannot use delegatecalls in Remix since either the addresses aren't displayed correcly or I cannot access the memory address?

For instance delegatecall to the same address works: function callTheOtherContract() public { require(address(this).delegatecall(bytes4(keccak256("callMe()")))); } event CallMe(...
0
votes
0answers
21 views

Is there a way for a function to perform some code to a point and then revert without conditions (more details below…)?

I want to create a payable function that acts similarly to onlyowner modifier, or: function owner() public payable{ if(msg.sender != owner) { balances[owner] += msg.value; revert(); } } What ...
0
votes
1answer
14 views

How to call a write function of contract from Dapp?

I have created a smart contract in which a "stop()" function should be called once a deadline is reached. Dapp is keeping check of the deadline and as soon as the deadline is reached I need to call ...
0
votes
1answer
12 views

So can I simply send ether to a contract as if it's a regular wallet, even without payable function?

Are contracts really that different? I guess in theory every contract should have a private key somewhere + it should be possible to send ether to it? Unless geth/parity and other parts of the evm don'...
0
votes
1answer
17 views

REMIX debugger invalid opcode before JUMP

I am testing simple ERC20 token creation with the following in remix: pragma solidity ^0.5.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.4.0/contracts/token/ERC20/ERC20....
2
votes
2answers
36 views

Calling function on ERC20 contract through staticcall gives wrong result

I've made two functions to interact with a local ERC20 token. Here they are: pragma solidity ^0.5.0; contract GardenTestContract { function getBalanceOf(address _address) public view returns (...
0
votes
0answers
14 views

Dataset of simple contracts with getter setters

Are there any repositories/datasets which provide smart contract with simple logic like having some getters and setter functions. So, that I could give some values to getter and setter functions, ...
0
votes
1answer
39 views

Calling contract functions using only ABI without source code

I have MyContract.json file of some contract(assume i haven't its source code). In .json file, there is abi and bytecode. If i want to deploy such contract (through web3js), I am facing following ...
0
votes
1answer
26 views

How to call external payable contract function from app.js (DApp)?

The contract has a function: function purchaseTokens() external payable { require(msg.value>0); ...etceteras... } What I need is an app.js part, something that would look like this (lets ...
0
votes
1answer
16 views

How to know the execution time of transaction when miner execute it

When i send three consecutive transactions to my contract (deployed on ethereum testnet), how can i know the exact time (at milli/micro/nano level) which transaction executed (on miner side) first and ...
0
votes
1answer
27 views

State Variable of solidity Contract could not be updated through JavaScript

I have following contract and just want to update its state variable values i.e. totalSupply. But when I try to attempt this task through JavaScript code (given below) by calling its function i.e. ...
0
votes
3answers
32 views

Could not assign contract state variable value to javascript variable

I want to retrieve and assign the value of my contract state variable to my javascript variable.I am doing as per guidlines provided on this community, but failed to assigned. my javascript code is ...
0
votes
1answer
26 views

Get Contract Address by It's ByteCode

I have some bytecode and would like to find the contract address that it belongs to. Is there an easy way to do this?
1
vote
1answer
17 views

Two calls to a contract: input of the first can only be revealed after the second call

I see that there are no parallel execution in EVM. The problem I am trying to solve is the following: I have a contract which takes the input of two parties -- say users A and B. The result of the ...
0
votes
1answer
15 views

AttributeError while trying to call a contract using web3py and Infura

I am trying to call a function from an already-deployed contract on the Ropsten network: from web3 import Web3 infura_url = "https://ropsten.infura.io/v3/XXXXXXXXXXXXXX" w3 = Web3(Web3.HTTPProvider(...
1
vote
1answer
26 views

Call Smart Contract Function in Python Script

My situation is reverse to most. I am relatively experienced in coding in Solidity, but have absolutely no experience in using Python. What I would ideally like to do is have a script that will, in ...
1
vote
1answer
21 views

Creating a contract instance

Is it generally better to define a contract instance once, then pass it through your components like... class Parent extends React.Component{ constructor(props){ super(props); ...
2
votes
0answers
15 views

Why is it required to know the function selector in a smart contract to call the function? [duplicate]

I understand what a function selector is and how it is computed: The first four bytes of the call data for a function call specifies the function to be called. It is the first (left, high-order ...
1
vote
2answers
30 views

How do i use .send() to fire methods of my smartcontract?

I have looked alot for information about this and lastly i turn myself to here. I've written a smartcontract and deployed it to Ropsten . I am then using web3.js to interact with my smartcontract, i ...
0
votes
1answer
76 views

Linked contracts not running on go-ethereum

A very simple linked contracts example where A contract has a variable and B contract queries the A contract's variable is running ok on Ropsten+myetherwallet and Remix sandbox, but it fails when ...
0
votes
1answer
46 views

Need a guide to access my ropsten test network contracts through my command line and not remix

I have written and published a contract on the ropsten test network using remix. Now I want to access the functions of the smart contract from my command line (My PC) and not the remix IDE. Is there a ...
0
votes
1answer
17 views

What are the ways to call a smart contract function during development?

What are the ways to call a smart contract function during development using Truffle simulated VM with a GUI interface (like Remix or EtherScan offer)? I know I could use CLI options like Truffle ...
0
votes
0answers
39 views

Smart contract function not returning value (decoded output) in Remix

I am completely new to Solidity and would appreciate any help. I have a supply chain smart contract and it contains a function that is supposed to be called by customers and after the call, the ...
0
votes
0answers
13 views

Pulling EVM Bytecode of Contract Address [duplicate]

Is there a way to pull the EVM bytecode of a given contract address? Using Web3 perhaps? I believe using the web3.eth.Contract command may get access to the contract, but I am specifically looking ...
0
votes
0answers
10 views

Feeding a contract address to echidna

Simple question: Can I use echidna on a contract address? Like in mythril the command I use is myth -v4 analyze -1 -a 0xec410f642db4a2bcc4d7a69bc13b1165ebad3cea. I don't see any supporting ...
2
votes
1answer
50 views

Why Ethereum sets user balance to MaxBig256 whenever a contract query is performed?

There is a strange behaviour on user wallet balances when performing a contract call (that is supposed to have no cost). Balance is right (expected value) until a free call is requested to a contract. ...
0
votes
1answer
44 views

One contract accessing data from another fails

I am trying to get two contracts to interact: pragma solidity ^0.5.10; contract C2 { address public addr; constructor(address per) public { addr = per; } function ...
1
vote
2answers
548 views

Issue with Ganche and Truffle with Metamask. Can't load token balance

I'm testing to create a token in Truffle; it compiles fine, but it won't load the balance of the token in to Metamask. I've set the connection correct: it does load the ETH balances of the Ganache ...
0
votes
0answers
41 views

Geth web3.eth.contract returns null

I understand that the way I'm doing this is a bit backwards, but I cannot install node.js onto our server, and we are using a PHP backend which doesn't have very good Ethereum support. I am trying to ...
0
votes
0answers
19 views

Is there any for a contract A to directly read the value of another contract B , while B doesn't necessarily have any getter functions

The following codes is a function of contract B, how can a contract A get these values such as balance[from], balance[to], balance[msg.sender] as efficiently and directly as possible in contract B ...
0
votes
1answer
28 views

Geth + Web3 | web3.eth.getAccounts() returns undefined

I have follow this SO answer for sending ERC20 tokens from 1 address to another. I am running into an issue where I am receiving an error that my from address is invalid Error: Error: ...
0
votes
1answer
44 views

How big is the Geth Fast Node Currently?

I am trying to embark on getting all the contract addresses pulled from the Ethereum blockchain. From what I read, a fast node is all that is required for this (getting blocks->txns->contractAddress ...
0
votes
1answer
147 views

Filters object not working for web3.eth.contract getPastEvents() method

I have referred, Web3 Events, but filters object is not working for me, I've got the same result for events before and after applying filter object. Here's the code: instance.getPastEvents( "...
0
votes
1answer
31 views

Not getting getPastEvents or once function using contract instance

I have followed Web3 documentation to subscribe an evnet, I have created Instance of web3 using infura url as argument. Created contract object using, const contract = web3.eth.contract(abi, ...
1
vote
2answers
44 views

Get All Contracts from Blockchain

I am developing a large database of exploitable contract addresses and creating a website to host such a database for users to use to see if contracts are safe. Is there a way to get all contract ...
0
votes
1answer
45 views

Truffle: 'func.call()' retrieves the return-value of a non-constant function

I've just learned that one can easily obtain the return-value of a non-constant function, by using myContract.func.call() (instead of myContract.func(), which retrieves a response object). Up until ...
0
votes
1answer
47 views

Is it possible to send erc20 token when I have 0$ ether but $1000 in the token? [duplicate]

Long story short I have $1000 in one erc20 token contract but 0$ in ETH. Can I at least transfer these $1000 from the token to another address without ethereum asking for gas? That is: just change ...
0
votes
1answer
17 views

When calling a contract from an other contract, what happends if the value of callgas argument is above availaible gas?

In such case, the value is replaced with available gas right ? Or Does an out of gas exception is thrown ?
3
votes
0answers
38 views

Process address deposit from contract

Our service handles thousands (currently 10000+) of users and each user has his own Ethereum deposit address. To detect a new deposit we: Scan each block to get a list of transactions Get a list of ...
0
votes
1answer
67 views

How to get the return value of a contract from a contract call?

If a contract does returns something, (whether a string or return true/return false) how to get it’s return value ? I mean where does the return value is stored ? Is necessary to use RETURNDATACOPY or ...
0
votes
1answer
19 views

Get gas limit beforehand with Web3

I know that web3 exposes a function to estimate gas limit, but is it accurate when sending to a contract? AFAIK the amount of gas I'm gonna need if sending to a contract depends on the contract code, ...
0
votes
1answer
221 views

Is it possible to insert some custom data in the DATA field of an Ethereum Transaction?

i am working on trying to get some data encoded/inserted into an ethereum transaction. Let me describe my environment first, i am using Web3py, Ganache and Remix IDE. I am able to successfully ...
1
vote
0answers
25 views

Retrieving a State_object value on go-ethereum

I have a deployed contract address and I need to query a contract storage value, a token account balance that is stored on a mapping variable: mapping (address => uint256) balances; From go-...
3
votes
1answer
90 views

Issue in ERC721 token transfer to contract address

I am using ERC721 implementation for NFT tokens. I am testing the transfer functionalities in ERC721. `transferFrom(address _from, address _to, uint256 _tokenId)` `safeTransferFrom(address ...
1
vote
2answers
40 views

Who is msg.sender in a nested call chain?

I read about who is msg.sender when calling a contract from a contract, but who is msg.sender when calling a contract from a contract that calls another contract and so on and so forth?
2
votes
2answers
233 views

How to create a RawTransaction for contract interaction Web3j

I want to sign a transaction that calls a smart contract function and send it to the Rinkeby network. I found on Web3j documentation the RawTransaction class that supports the methods for the ...