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

eth_sendTransaction is not supported. Use eth_sendRawTransaction to send a signed transaction

I'll go straight to the point. I have a React App, I want to integrate this web with a very simple smart contract, which receives a hash and then saves with an event the timestamp of when it was ...
JETIX's user avatar
  • 11
0 votes
2 answers
29 views

Is there a way to test whether an external contract implements (or does not implement) a given interface method?

How would you determine whether a given contract implements a particular interface method without reverting? interface IRandomMethod { function getUint() external view returns (uint); function ...
Ashraile's user avatar
  • 125
4 votes
1 answer
47 views

How transaction fee is calculated in case of L2?

In case of L1, the transaction fee is typically calculated as the product of gas price and gas usage, i.e., txFee = gasPrice * gasUsage One such example can be seen in this transaction. In which the ...
SYED ASAD KAZMI's user avatar
0 votes
0 answers
31 views

How to make a smart contract/ a third party pay for transaction fees?

I'm trying to create a LiquidStacking smart contract where it would be possible to deposit any amount of ETH. Every time the smart contract's balance reach 32 ETH, it creates a BeaconChainDepositor ...
ASANSON's user avatar
  • 11
0 votes
0 answers
48 views

Verifying eth_call Results with Cryptographic Proofs for L1s and L2s

I'm interested in enhancing the reliability of static call requests (eth_call) to Ethereum smart contracts. Currently, the returned data is only as trustworthy as the node or service providing it. ...
MShakeG's user avatar
  • 1,613
0 votes
0 answers
11 views

On-chain or Off-chain: Optimal Calculation for Arbitraging Two v2 Pairs?

I'm currently exploring arbitrage opportunities involving two v2 pairs and I'm wondering whether it's more advisable to compute the optimal amount to trade on-chain or off-chain. What are the key ...
adam mr's user avatar
  • 99
0 votes
0 answers
29 views

Can my ETH be frozen by Metamask's Validator Staking Contract?

Does MetaMask have the power to freeze my assets? I'm not an expert but Validator Staking looks to me like a contract interacting with the beacon chain contract. Does me investing/interacting into ...
user23507422's user avatar
0 votes
1 answer
44 views

Transaction Hijacking?

So I created a wallet and sent it some funds then I submitted a few invalid transactions. I approved the correct address for transferring wrapped eth. After the approval my script immediately sent the ...
Samuel Wagner's user avatar
1 vote
1 answer
47 views

gasLimit argument in ethers.js confuses me

Assume the following: // Tx1 const realCall = await contract.callMain(secondAddress, num); const waited = await realCall.wait(); console.log(waited.gasUsed.toString(), ' gas used') it prints: "...
Neo's user avatar
  • 93
0 votes
1 answer
28 views

Does contract logic get executed with a SimulatedBackend?

I am trying to write a test, but I am surprised by an unexpected behavior with the SimulatedBackend. I am able to deploy the contract, and then call a function. The function runs an internal check, in ...
unsafe_where_true's user avatar
1 vote
1 answer
84 views

I need help with changing the owner of a contract

I'm trying to assist a client in changing the owner of a contract, but the situation is as follows: He has two contracts, A and B. Contract A is the owner of contract B. He only has access to the ...
Rafael Oliveira's user avatar
0 votes
0 answers
59 views

PancakeSwapV2 router "getAmountsOut" function returns wrong value

I'm struggling with "getAmountsOut" function, which works kinda fine for BNB/CAKE or CAKE/BNB. But it in some cases it just returns straight wrong values. Code: public async Task<decimal&...
Danik Logan's user avatar
0 votes
0 answers
99 views

ERC20 Multisend works on Sepolia Testnet but Fails on Mainnet

I've got a smart contract function that takes an erc20 contract address, an array of addresses and an array of amounts and then sends the each amount to each address of the specified token. I've got ...
nultinator's user avatar
0 votes
1 answer
28 views

Can require() be used to revert low level call() that were made before it?

CODE: (success, ) = contract.call(); // low level call if (success) { // do something } // instead of below check, can I just use require(condition)? if (!condition) { revert(); } Instead of ...
aste123's user avatar
  • 233
0 votes
1 answer
36 views

tokens transfered out after swap in

I am learning ethers.js and try swap tokens via ethers.js, and my transaction succeed buy my wallet had 0 tokens. Then i checked on bscscan and found that after my 'swap' transaction succeed, the ...
Roy Fong's user avatar
0 votes
0 answers
157 views

Generating input data with Ethers for low level call to Uniswap Router

I'm trying to generate the input data necessary to execute a low level contract call to the Uniswap SwapRouter.exactInput method. I've done the same for the exactInputSingle successfully but can't get ...
TommyF's user avatar
  • 152
0 votes
2 answers
45 views

Call a function from another contract, entirely determined by initial contract's function arguments

I would like to have a contract MainContract that can call any other contract functions depending on arguments given a MainContract function. It would look like this: pragma solidity 0.8.16; contract ...
Pacdac's user avatar
  • 80
0 votes
1 answer
35 views

How do I add my address to a deployed contract public address using a security exploit? (coding challenge)

I'm working on a coding challenge for smart contract security exploits. I need to add my address to public address (browerr) in the contract. Do I need to create another contract that inherits the ...
johnTg's user avatar
  • 1
0 votes
1 answer
264 views

error: "Transaction has been reverted by EVM"

I'm fairly new to Solidity and coding overall. I'm going through a Udemy course and I ran into an error which I can't find the solution for. I deployed a contract on the Sepolia test network from ...
Arad11222's user avatar
1 vote
0 answers
16 views

Why did my contract read method call get turned into a transaction using gas fees? [closed]

I called a contract read method from my React app using ethersjs but it turned into a tx with gas fees. See the below tx hash on etherscan: https://etherscan.io/tx/...
jiamijiang's user avatar
0 votes
1 answer
36 views

Using the Freeze functionality as a user in the BNB contract

In the BNB contract there is the Freeze and UnFreeze functionality. As I have understood, this doesn't allow Binance to freeze users’ balances. Instead, it allows any user to freeze and unfreeze their ...
Bart DV's user avatar
1 vote
1 answer
62 views

is this how delegatecall works? what other ways are there keep msg.sender the same when a contract is interacting with a different contract? [duplicate]

I recently started development on a personal project, and one of the suggested methods to achieve what i want was using delegatecall. Essentially I have a main contract that the user interacts with ...
pierre96's user avatar
0 votes
1 answer
205 views

simulate a transaction considering another pending transaction

I have the following problem and have hard time to simulate it to get the answer. Let say I have a 5 WETH tokens. I sent transaction X with nonce 1 to transfer 5 tokens from Account A to Account B. ...
Majd TL's user avatar
  • 3,217
0 votes
1 answer
36 views

Facing errors with contract invocation ( Unable to access a function stating only owner can access it , even tho I am the owner)

(sorry for structuring the question in a wrong way as I am not sure what term to use precisely) I am facing issue while trying to call the function flip in the program below , I am using chainlinks ...
kaushik choudhury's user avatar
0 votes
1 answer
111 views

Detect honey pots / rugpulls

I was wondering if there was a way to detect honey pots and rugpulls tokens in python. I'd like to do some sniping, so using api and waiting for their response would make me lose time. I'd like a way ...
Newly Sama's user avatar
0 votes
1 answer
69 views

Receiving no events in contract receipt web3js

In my contract interaction with web3js I have a .once("receipt", async (receipt) => { console.log("receipt:", receipt); I run this with a firebase function. ...
ctseer seer's user avatar
0 votes
0 answers
502 views

Wagmi throws "Cannot Decode Zero Data" Error when using useContractRead

I am using wagmi with next 13, and trying to call "view" function in my contract. The function in my contract: function getAllGrids() public view returns (address[] memory) { return ...
Arham S C's user avatar
2 votes
1 answer
151 views

Tool to re-create state of smart contract locally

I would like to be able to simulate transactions with smart contracts based on their solidity source code. The process should be entirely automated. While I am aware that some tools allow forking the ...
davidsawyer's user avatar
0 votes
0 answers
23 views

Token Rewards Calculation and Distribution

I'm doing a script to calculate rewards for a handful of addresses (from sensors). The script runs weekly where it takes a bunch of addresses from our DB, cleans the data and calculates the associated ...
gritty's user avatar
  • 1
0 votes
1 answer
53 views

Calling a safeTransferFrom of a contract that implements an ERC721Upgradeable interface

I have a contract A that inherits the following contracts: contract NftTemplate is Initializable, ERC721Upgradeable, ERC721URIStorageUpgradeable, AccessControlUpgradeable, ...
Allennick's user avatar
  • 243
0 votes
0 answers
44 views

How would look like calldata for bytes[] calldata argument?

Imagine I have a function with such signature in Solidity: function doThing(bytes[] calldata arr) external; how are elements of arr are packed in bytes? I would say that first 4 bytes is bytes4(...
gabbi's user avatar
  • 1
2 votes
1 answer
85 views

How to access funds if the Gnosis Safe website is shutdown?

Imagine that the Gnosis Safe website and services is shutdown, how can users access their funds?
usama's user avatar
  • 21
1 vote
2 answers
77 views

Malicious smart contract that transfers tokens forth and back

Sorry if my question was already discussed. Is it possible to implement such a smart contract or contracts that in result can transfer eth or ERC20 tokens forth from ANY to B account and back from B ...
Oleg's user avatar
  • 11
0 votes
1 answer
146 views

Unable to call functions on a deployed contract through web3py

I have a working private network in which i have successfully deployed a contract using python. I have its address and i can see the deployment in the node log, but i cant call any functions and it ...
Javi Gómez's user avatar
0 votes
1 answer
331 views

How to encode arbitrary amount of parameters for encodeWithSignature without adding them to function definition?

Lets says we have Contract A that needs to call Contract B at a certain address which the requirements that Contract A doesn't know the exact parameter structure the function in that Contract B needs &...
CoderMan's user avatar
1 vote
1 answer
37 views

Why doesn't this try/catch block catch the revert in `asset.symbol`?

I wrote this Solidity function: function getAssetSymbol(IERC20Metadata asset) internal view returns (string memory) { try asset.symbol() returns (string memory symbol) { return symbol; ...
Paul Razvan Berg's user avatar
1 vote
1 answer
172 views

Wrapping ETH into WETH via ethers -- WETH coins on my balance won't appear

I'm attempting to wrap ETH on Goerli into WETH by calling deposit function using ethers. Even though several TX already have been confirmed and successfully mined, nothing will appear on my WETH ...
Camila326's user avatar
  • 115
1 vote
1 answer
1k views

WEBSOCKETS Provider url for binance smart chain

I have a contract deployed in Binance smart chain. I have written a script that will help me read the events logs from the Blockchain. currently, I tested that with the local hardhat network itself, ...
Bappa Banerjee's user avatar
0 votes
1 answer
41 views

Why is MyCrypto is disabling the Sign Transaction button?

I'm using MyCrypto to execute a function of a smart contract but the sign Transaction button is disabled. I'm using the setting to auto calculate the Gas Limit and its suggesting a limit of 68908 with ...
TheLogicMan's user avatar
1 vote
1 answer
49 views

@openzeppelin/contracts import failed

The issue I am having is when I am trying to compile my contract, I am getting multiple errors for ERC721. As imported ERC721 is importing more contracts, as seen from the errors, the issue is that it ...
Hasbik645's user avatar
1 vote
1 answer
29 views

calldata usage, difference between the method calling function with calldata

I recently studied optimism, and found that appendSequencerBatch() of CanonicalTransactionChain contract called with calldata. I assumed that this function was called using 0x(functionSelector)+(data.....
gun bos's user avatar
  • 25
0 votes
1 answer
56 views

Emit is not working on simple Token Factory

I'm using Hardhat 2.12.7, here's my Factory contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "./SimpleToken.sol"; contract SimpleFactory { event Deployed(string ...
deb0rian's user avatar
  • 121
2 votes
1 answer
62 views

What should the input parameter structure look like in validate(touple) function of Seaport contract?

I'm trying to call the validate() method of Seaport but can't find the correct form of inputs, as it always returns the error types/value length mismatch when calling on Etherscan. I'm calling the ...
Nal Luksic's user avatar
  • 1,127
2 votes
1 answer
296 views

How does a sweep contract works?

I received an invoice from one of my clients and they gave me a payment address to: https://etherscan.io/address/0x4b05e01a0a2dd41071172d0c6325349921deaf2a I'm curious to how this works as I am ...
Patoshi パトシ's user avatar
1 vote
2 answers
150 views

How can I add consumers to a Chainlink VRF2 subscription with an external smart contract?

When I try to add a consumer to my VRF2 subscription via the Subscription Manager, the transaction completes successfully. This also works when interacting with the chainlink contract directly on ...
0xheartcode's user avatar
5 votes
4 answers
5k views

Call smart contract method with ethers.js version 6

I was successfully using the version 5 of ethers.js so far and I'm now migrating my code base to version 6. I tried the following code to call a method on my smart contract that is supposed to return ...
Platus's user avatar
  • 151
1 vote
1 answer
19 views

My payout function to lottery winners is failing. I'm storing the winners in an array and attempting to payout but getting reverts

the code: function payoutWinners() public payable { require(msg.value >= payoutOwed, "send more than what is owed"); for (uint i = 0; i < winningAddresses.length; ...
snejad123's user avatar
0 votes
2 answers
314 views

How to interact with a contract that requires a uint256 value? The input I want to give is "5"

I have the following contract function. I want to input 5, but it requires it in the format uint256. How do I represent this in uint256? And is there a way to interact with this contract function ...
Patoshi パトシ's user avatar
0 votes
2 answers
1k views

Can you fetch the whole transaction history of specific contracts somewhere?

I know you can validate the data of specific tx hashes using web3js or the etherscan api. But is there a service which allows to query all transactions performed by or connected to a specific smart ...
rajohs's user avatar
  • 179
0 votes
1 answer
34 views

Retrive data from chainlink node

in APIConsumer contract on chainlink docs (Any API) // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol"; import "@...
noro meb's user avatar
  • 338

1
2 3 4 5
24