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
0answers
8 views

why can I specify `memory` if function is internal?

In the latest compiler versions, we can do the following: function balanceOf(uint[5] memory data) external view returns (uint256) { Until some version of the compiler, i couldn't specify memory, ...
0
votes
0answers
10 views

how does calldata not work in this case?

pragma solidity ^0.7.4; contract D { function test2(uint[1] calldata good) external { uint c = good[0]; } } This code is perfectly valid. What I do is deploy ...
0
votes
0answers
8 views

what's the difference between assembly part and opcode part in remix?

In the remix, there's compilations details button. When you click, one can see Bytecode and also assembly parts. Bytecode is an object which has object key and opcodes key in it. As far as I can see, ...
0
votes
0answers
13 views

ethereum solidity - gas cost wrong

This is bugging me so much time and spent hours and hours on this, I'd really appreciate your help so much.... // this costs 21394 function test2() external { } // this costs 21507 function ...
0
votes
1answer
17 views

How can I call a function that performs a transfer in web3?

I would like to call a function in smart contract using web3. In the function, I perform few transactions. The first method that I tried is await myContract.methods.endAuction().call();. This reverted ...
0
votes
0answers
12 views

Smart contract for selling log-in subscription service

If not ethereum, which smart contract token would be best suited for fulfilling the sale of a month-long anonaymous subscription for cryptocurrency that enables the buyer to have their own username ...
1
vote
1answer
16 views

Ethereum storage - how does this cost happen?

contract A { uint x = 10; function test2() public { x = 0; } } I can see that: Transaction cost is 13204 Execution cost is 5136 How can this be ? I ...
1
vote
0answers
44 views

Ethereum cost - how does it work in memory

This is really bugging me and doesn't seem any article that can help at all. wiki says further the gas costs for using memory: The fee for expanding memory is determined via a subtract-the-integrals ...
1
vote
1answer
14 views

what is expansion cost?

I am trying to understand what expansion cost is. We can see that there's this formula to count the memory cost - Now, It's also said that this formula doesn't include the expansion cost. Can anyone ...
1
vote
0answers
10 views

how can library change state?

I read the following in the official solidity docs: Library functions can only be called directly (i.e. without the use of DELEGATECALL) if they do not modify the state (i.e. if they are view or pure ...
0
votes
1answer
14 views

how does library end up in contract?

library C { function a() public returns (uint) { return 15; } } contract A { function a() public returns (uint) { return C.a(); } } This is the code I am using. I ...
0
votes
0answers
9 views

how do i call a constructor from another constructor?

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/ERC20.sol"; contract MyToken is ERC20 { constructor(uint supply) public { // ...
0
votes
1answer
14 views

What happens when you send a non-state-changing transaction to the transaction pool

I understand that there are 2 endpoints for smart contracts. Call() for running view/pure function and SendTransaction() for state-changing transactions. Obviously a state-changing transaction sent to ...
0
votes
0answers
10 views

How to obtain the implementation address from an upgradeable proxy smart contract?

Is there any way to externally obtain the current implementation address of a proxy that doesn't involve interacting actively with it (e.g. calling a transfer or approve function, i.e. without using ...
0
votes
0answers
10 views

Stuck ERC20 tokens appearing in a different contract

I have 1000s of token called ERC20 still stuck. I found them when trying to find missing SPANK on MEWconnect which only shows 1% of the SPANK I thought I had. If i select the spank contract on ...
0
votes
0answers
28 views

How to remove/increase execution timeout of the geth's evm?

I am performing some benchmarking with the Ethereum Virtual Machine. I have a contract with just one function that calculates the prime numbers until 100k. However, I am not able to get my results as ...
0
votes
0answers
9 views

Is it possible to execute a smart-contract function at the next (or other block) number?

I simply need a function to be executed not at the block number when the function is initiated but to wait for any of the next block numbers. I can do this with a require, where person executes the ...
0
votes
0answers
15 views

How to find out what happened with a contract transaction

I have a question regarding one transaction which happened at the 17th of January 2018: https://etherscan.io/tx/0xabe5ac6176e1096bf4fbfa983cb8b04262ae1d57daf94ebb1668b5d45e3145f4 It should be ...
0
votes
0answers
22 views

Can someone help me get my funds back in my possession from a contract?

So first off, buyer beware: do not mess around with gameswap.org it appears I made a mistake in doing so. Luckily I never invest more than I can stand to lose unless I really trust the project. So not ...
2
votes
0answers
50 views

Problems calling Smart Contract function in Java using Web3j

I am rather new to writing/using smart contracts in Java and I am currently trying to use my smart contract. I already wrote and tested it, compiled it, deployed it to Ropsten, and built my Java class ...
0
votes
1answer
14 views

Calls Payment Issue

If I understood right, calls (unlike the transactions) are not added to the block thus they are not paid. Why can not I make an SC aka while (true) and paralyze a validator
1
vote
1answer
25 views

What does scope do in the function itself?

Here is one of the functions I am curious about... function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, '...
1
vote
2answers
29 views

what's the difference between call and just using function?

Let's say I have a contract called contractA. It has the function: function bla(address test) { // way 1. test.call(abi.encodeWithSignature("first4bytes", arg1, arg2)) // way 2. ...
1
vote
1answer
48 views

Call contract view method from web3

I am trying to call a function on a smart contract using web3 and web3-eth-contract but I get the error Provider does not have a request or send method to use. Here is the general code I am attempting:...
1
vote
0answers
13 views

Will the tx fees of old contracts be greater or smaller than those of new contracts in ETH 2.0?

Will contracts that currently exist cost more or less to interact with after the ETH 2.0 upgrade? What about old contracts that call a new contract, or new contracts that call an old contract? Will ...
1
vote
1answer
27 views

how to see contract that only has bytecode

I am looking at this contract - https://etherscan.io/address/0xf8681dad1ce4f1f414fb07fc07f81a3a82e91d8f#code but it turns out that there's only ByteCode and if I decompile it, the code it gives me is ...
2
votes
0answers
38 views

events and relationships between smart contracts and oracle smart contracts [closed]

How to subscribe a web3j client node to a smart Oracle contract event? Do I need the Oracle contract address?
1
vote
1answer
12 views

does selfdestruct clear/remove data?

I want to know if calling selfdestruct clears/removes data from blockchain or it still remains there. Looking at this link, CLICK HERE it says that data doesn't get removed. (first answer) Looking at ...
0
votes
0answers
15 views

parity hack - how does this work?

I am looking at the following contract https://eips.ethereum.org/EIPS/eip-1822#erc-20-token Look at the following line : Ensures no one can manipulate the Logic Contract. IMPORTANT: I am going to ...
0
votes
0answers
30 views

store data in any slot

contract test { bytes32 private constant ownerSlot = keccak256("ownerSlot"); constructor(address _implementation) public { bytes32 s = ownerSlot; assembly { ...
0
votes
0answers
10 views

estimateGas - how does it work when there's an internal call?

I've read the following: The catch about gas estimation is that the node will try out your tx with different gas values, and return the lowest one for which your tx doesn't fail. But it only looks at ...
0
votes
2answers
44 views

delegate call - msg.sender wrong value

pragma solidity >=0.4.22 <0.7.0; contract D { uint public n; address public sender; function delegatecallSetN(address _e, uint _n) public { _e.delegatecall(abi.encode(bytes4(keccak256(...
0
votes
1answer
11 views

Interact with smart contract via web3j API for Java application

I'm having some confusion about communication between java application and smart contract. In my scenario, I have 2 geth clients Node1(http://localhost:8545) Node2(http://localhost:8546). A java ...
0
votes
1answer
28 views

ethereum - call and delegatecall not working

pragma solidity >=0.4.22 <0.7.0; contract D { uint public n; address public sender; function callSetN(address _e, uint256 _n) public { _e.call(abi.encode(bytes4(keccak256("setN(...
0
votes
0answers
10 views

erc20 and tokensale how to use interface

I have ERC20 interface copied from here link - zeppelin Now, I have a contract called ERC20 which looks like this: contract ERC20Token is IERC20 { uint8 public decimals = 18; // other ...
0
votes
1answer
17 views

solidity - allowance delegation - what if the owner spent it already

So userA delegates his tokens to be spent by me to whoever I want. That's great. let's say userA's balance was 200Token. and he delegated 150 Token to me.. Now, userA can still transfer 180Token to ...
1
vote
1answer
100 views

Uniswap v2 pair before liquidity add

I have a token contract and I want to add liquidity to Uniswap (mytoken + ETH). Before that, I would like to know the pair address in order to set it in my contract. Is it possible to create a pair on ...
0
votes
0answers
12 views

What is the difference between Denial of Service (DoS) and mishandled Exception?

As per my understanding both the DoS DoS Example and Mishandled exceptions occur when the receving contract uses revoke. In case of mishandled exception we don't handle the exception by checking the ...
0
votes
1answer
28 views

Call function from deployed contract

I have a deployed contract (contract A) which should act as a storage (let's say 0xD7ACd2a9FD159E69Bb102A1ca21C9a3e3A5F771B). Now from my ERC20 Token contract (contract B), I am calling approve to the ...
1
vote
0answers
20 views

Fine graininess of interface collisions between protocols

While working on integrating the Balancer Exchange protocol in my project, I noticed this interface defined in their exchange proxy: interface TokenInterface { function balanceOf(address) external ...
0
votes
1answer
27 views

How to verify that a smart contract was deployed by us?

I would like a method called from Solidity to either verify the hash of an entire smart contract's code, or read some immutable EVM property that contracts expose that say who deployed them, e.g. a ...
0
votes
1answer
21 views

contract interaction error: function should be payable

I apologize if it is a simple question. I tried to create a simple contract interaction. I've tried to follow instructions on https://ethereum.stackexchange.com/questions/51760/contract-interaction, ...
0
votes
1answer
18 views

fee of smart contract deploying as transfer channel

I want to deploy a smart contract for deposit part of an exchange...I know the creator of a smart contract should pay fee(gas fee) to deploy it...my question is as follows: do senders also should pay ...
0
votes
0answers
19 views

Empty Address when using Truffle Debug

I currently have a local chain with Ganache. Say I have two contracts written in Solidity: Foo_v0_0_1.sol Bar_v0_0_1.sol In the code for my smart contract Foo_v0_0_1, I have the following: import &...
1
vote
1answer
106 views

How to disable one owner-only contract function without disabling others?

I have deployed a smart contract with several functions that only one address (called the 'owner') is allowed to call. The transaction will revert if any other address tries to call one of them. Is ...
0
votes
0answers
28 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
21 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
336 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
12 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.
4
votes
1answer
203 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 ...

1
2 3 4 5
19