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
-1
votes
0answers
9 views

Creating contract instance fails because of missing interface definition in ABI. Am I using the wrong ABI? [closed]

I am trying to interact with a smart contract (the HNY token contract in particular https://blockscout.com/poa/xdai/address/0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9/contracts) on the xDai chain. I ...
0
votes
0answers
25 views

Is there any service that sends messages to smart contracts in a pre-determined future time?

Is there any service that sends messages to smart contracts in a pre-determined future time? Need also to re-send the message if the gas was low and it is stalled too long.
0
votes
1answer
17 views

Need to execute several transactions as fast as possible

In the case of an emergency (e.g. theft), it may be necessary to disable several accounts as fast as possible. I am writing the smart contract. Should each of several accounts be disabled in a ...
0
votes
1answer
29 views

How to get ETH contract balance with Ethers.js

I am trying to get the ETH balance of a contract: const balance = await contract.getBalance(); but it fails: TypeError: contract.getBalance is not a function What I do wrong and how to fix the error?...
0
votes
0answers
9 views

How to transform method name and arguments into the “data” for a call? (Ethers)

Having a method name and its parameters (in JavaScript objects format), need to calculate the "DATA" argument for ADDRESS.call(DATA) Solidity construct. Need to do it using Ethers.js.
3
votes
1answer
44 views

I see no way to obtain the return value of a non-view function (ethers.js)

In a Buidler test I have: const { expect } = require("chai"); describe("SumOfTokens", function() { it("Checks correct transfers", async function() { const ...
2
votes
1answer
27 views

the same struct in array and mappings

Let's say I have a struct. struct test { uint x; } test[] all; mappings(uint => test) map; function bla(){ test memory structTest = test(5); all.push(structTest); map[10] = structTest; ...
1
vote
1answer
20 views

how to transfer from contract to another account or contract

I have a function: function sendEther(address payable _to, uint amount) public payable returns (bool) { bool success = _to.send(amount); return success; } Now, how transferring ...
0
votes
0answers
9 views

solidity call function how gas gets forwarded

It's said that: someAddress.call.value(y)() will send the provided ether and trigger code execution. The executed code is given all available gas for execution making this type of value transfer ...
0
votes
1answer
86 views

How to manually approve a token for swap on Uniswap (direct contract interaction)

I want to approve token spending on Uniswap for a token I don't own. Uniswap UI won't let me do that (instead it displays a gray out button "insufficient balance"). Seems the only option ...
1
vote
1answer
21 views

how does memory layout work?

I am trying to understand how https://solidity.readthedocs.io/en/v0.7.2/internals/layout_in_memory.html works. function test(uint a) public { uint test1 = 20; uint[1] testArr; testArr[0] = ...
1
vote
1answer
21 views

How is caller's data related to bytecode?

I know that smart contract is deployed as bytecode. When we call a function from application, we use the encoding with the help of ABI and we get some bytes. let's say 220 bytes. These are the bytes ...
1
vote
1answer
38 views

contract inline assembly - return array parts by using assembly

I've a couple of questions. mload function returns the data that resides on the address we pass to mload. Is this correct ? add function is used to give us the address from 0 to whatever we pass. ...
0
votes
1answer
23 views

why separate assignments are better than single?

I've read that: It is more gas efficient to initialize a tightly packed struct with separate assignments instead of a single assignment. Separate assignments makes it easier for the optimizer to ...
1
vote
1answer
39 views

how does contract cost less gas in structs?

I have a couple of questions. we have int types as uint8, uint16, uint32, etc. I read that : Normally there's no benefit to using these sub-types because Solidity reserves 256 bits of storage ...
0
votes
1answer
17 views

Returning ERC20 tokens accidentally sent to the DAI contract

I don’t know if it’s the right place for it, but I’m taking a chance. Despite several years of daily use of ERC20 tokens, I unfortunately managed to make a mistake and send some ERC20 tokens to the ...
1
vote
2answers
51 views

Multi-signature contract with offline signing

Is it possible to create a multi-signature contract that would not require a transaction for every signature (since this is quite expensive for a higher number of transactions)? Is it possible to ...
1
vote
1answer
24 views

msg.sender.balance showing incorrect amount

I've written a smart contract that should return the balance of the current user using it and for some reason when I call the function it's returning the incorrect amount. I've used Remix and the ...
0
votes
0answers
52 views

Contract call: data out of bounds

I'm working on a nextjs/react project in which i want to fetch the health factor of an address on AAVE. This can be done by calling getUserAcountData(address) on the lending pool contract. I can ...
2
votes
0answers
27 views

ETH same transaction different amount of gas used

The two transactions: a) https://etherscan.io/tx/0x9227f7b00bf2c98a7e16eb5ab90c04df5b49698297ee7f52c765d5218af395ad b) https://etherscan.io/tx/...
1
vote
1answer
14 views

How to find official smart contract addresses

Is there a directory somewhere that references official projects smart contract addresses ? I can't find a reliable way for finding smart contract addresses of public projects. The only solution I ...
0
votes
1answer
40 views

how to read smart contract A's data from other smart contract B in ethereum?

Currently, we can read the contract A data with the help of getters functions defined in contract A. But I want to do something like contract A puts some data in ethereum blockchain but do not define ...
1
vote
1answer
20 views

If gas is refunded, is it required to call? [duplicate]

Suppose a smart contract external function uses very much gas, but refunds (with .transfer()) the used gas to the caller. Question: Can it be called with a small amount of gas despite it uses much? ...
0
votes
1answer
16 views

Do smart contract transactions get signed?

When you send a transaction to a smart contract by using the contract.methods.methodName().send() is it signed by the sender? If not how can I link the sender to that transaction call
0
votes
1answer
18 views

I want my contract to pay for gas [duplicate]

I want to make a contract-to-contract call paying gas not from the user but from the calling contract's balance. Possible? How?
1
vote
0answers
13 views

How to judge whether a reentrancy attack is successful when reproducing the attack in private chain with Remix?

I reproduce the attack using the same codes successfully in Javascript VM of Remix, there are events in logs. But when I reproduce it in private chain, there are nothing. I cannot judge whether the ...
0
votes
1answer
144 views

How do I know if I am connecting to uniswap factory mainnet or testnet if the contract addresses are common for both?

I had thought each contract deployment and contract address was unique on Ethereum, including across mainnet and testnets. But in the Uniswap documentation it says: UniswapV2Factory is deployed at ...
0
votes
0answers
16 views

Can I make a delegatecall to a Solidity contract that is compiled with a higher compiler version?

Lets say that I have the contracts A and B. A needs to make a delegatecall to B. A is (for some reason) compiled with a compiler version that is lower than B's compiler version. Can I safely assume ...
0
votes
1answer
17 views

Why some contract addresses show 0 supply and 0 holders on Etherscan

I have a an old list from December 2019 which showed the holders, supply and transfers in last 24h from Etherscan like here . Howvever while I was revisiting the addresses on Etherscan, there were a ...
0
votes
2answers
101 views

Smart contract multiple functions call

My question is mainly to know if what I want to achieve is possible or not, unfortunately I cannot find (understand?) my answer elsewhere. I have no experience with Solidity, and very little with ...
3
votes
1answer
48 views

call opcode gas consumption on a non EOA address depends if the addres is “new” or not

I have the following contract, reduced to the minimum for testing reasons: pragma solidity ^0.6.11; contract PackedMultiplexer { function multiTransfer(address _address1, uint _amount1, address ...
2
votes
0answers
23 views

Is gas cost of external calls included in gas cost of the main call?

When I call external methods of other contracts from my contract, is the gas fee of these calls included in the gas fee displayed by MetaMask? My transaction reverts (execution reverted) for an ...
0
votes
1answer
28 views

How to call a method of another contract with given value?

How to call a method in another contract with given value? contract A { function f(int256 a, string b) { ... } } How to call A.f from another contract B with say 0.5 ETH value (if B was called with ...
0
votes
0answers
42 views

Move Ethereum from my contract to a new wallet on Ledger S (using MyCrypto?)

A few years ago, I bought 10 ETH and had it set up on a laptop using the standard software at the time, which I think was Mist. I then moved 1 ETH to a new contract that I set up within Mist, not ...
0
votes
1answer
27 views

What is the cost of inter-contract calls?

I have a contract with methods to create items and add them to categories. I want to create a wrapper contract that would combine several calls into one: create an item and add it to several ...
1
vote
1answer
18 views

When a contract calls other contracts, is it an atomic operation?

If a contract calls several external methods of other contract(s), is it as a whole one atomic transaction (reverted as a whole if an exception happens)?
0
votes
2answers
50 views

solidity, how to wait n second function or others solution

I am working on a project for p2p energy trading using blockchain. I am building an experiment on my own to demonstrate the concept for my master thesis. For this project I have two python scripts, ...
0
votes
0answers
41 views

How to know when a transaction is finished? (web3.js)

I make a contract method call using .send() method: contractInstance.methods.pay(itemId).send({from: defaultAccount, value: web3.utils.toWei(String(price*1.0000001)), gas: '1000000'}, ...
0
votes
1answer
98 views

In MetaMask (web3.js 0.20.x) how to get events happened during a transaction?

In MetaMask (web3.js 0.20.7) I send a contract method with .sendTransaction(). Now I need to check the values of arguments of UpdateItem event created by this contract during the call of this method. ...
0
votes
1answer
22 views

Display top referrer number

I am developing an ETH game with a referral structure. Each account that exists in the game has a "Referral Count" associated with it that updates as people sign up using their referral link....
3
votes
1answer
39 views

Web3js shows Contract Address as null after deployment

I am using web3.js to deploy a contract. I am also using Ganache to mock the network and visualise the accounts. When the code below executes, the contract gets created, and Ganache shows a successful ...
0
votes
1answer
51 views

My contract is deployed but instance is undefined

I have deployed a contract on the ganache blockchain successfully using truffle. In the truffle console, I can call the contract fine truffle(development)> MyCoin [Function: TruffleContract] { ...
0
votes
1answer
45 views

How can I make an off-chain call to get the data stored at a specific storage slot on-chain? [duplicate]

I want to get data from on-chain that is not explicitly available through a getter. For example, if I know that there is data at position ...
0
votes
0answers
19 views

Why is Smart Contract call() method returning NULL in Ethereum Private Blockchain

This is where I am calling the contract function certify_find (hash, callback) { contract.methods.findDocHash(hash).call( function (error, result) { if (error) { console.log("Returned ERROR ...
1
vote
1answer
294 views

How do I find the ABI/JSON Interface for an ETH/ERC20 contract?

I sent TUSD to my Bittrex holdings to trade for other coins, but it never went into my account with Bittrex. They claim that I sent it to the wrong address. I am trying to recover these tokens so that ...
0
votes
0answers
7 views

How to list sub calls of conctract methods transferring money?

Assuming I have a contract method which conducts several money transfers, e.g. function payalot(address payable p1, address payable p2, address payable p3) public { p1.transfer(42); p2....
1
vote
1answer
27 views

How to deploy smart contract so that average user can interact with its public functions?

I sucesfully wrote and deployed smart contract using Remix and Metask to generate hashes used as keys. This contract has few payable public functions that set or get some numbers. After deploying ...
1
vote
1answer
37 views

Accessing contract functions from web3 and javascript

I have deployed a contract in a private blockchain using remix and ganache. Now I want to interact with it trough web3 and the console from my browser, but I'm not managing to interact with the ...
3
votes
2answers
66 views

Regular address turns into a contract after receiving a transfer?

To accept payments in ether myself, I first tried how others have implemented it. So I bought an item in a store that uses Coinbase Commerce to accept crypto payments and paid for my item with ether. ...
0
votes
2answers
86 views

Transactions not happening in Ropsten Test Network

I'm learning to set up a simple front-end website that executes smart contract methods in a testing environment, but even though MetaMask confirms the deployment of the contract, the transaction is ...

1
2 3 4 5
18