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
vote
0answers
8 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
13 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
7 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
13 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
26 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
42 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
24 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
44 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
37 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
29 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
43 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
26 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
9 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
16 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
87 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
26 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
20 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
312 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.
3
votes
1answer
190 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
30 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
26 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
15 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
2k 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
28 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
26 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
114 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
25 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
47 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 ...

1
2 3 4 5
18