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
20 views

Can't seem to withdraw money from contract

I am new with solidity. I've implemented this withdraw function function withdraw() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } And I am calling ...
0
votes
1answer
29 views

Does a view function always have access to msg.sender?

Any transaction happening on the blockchain obviously has an associated sender address, which solidity stores in msg.sender. However, if I have a view function which can be used to read the state from ...
1
vote
0answers
19 views

What happens when you pass more gas than what is available?

When making a contract call in Solidity, the gas stipend can be altered with the following special options: {value: WEI_VALUE, gas: GAS_VALUE} What happens when the GAS_VALUE is bigger than what is ...
0
votes
1answer
15 views

How does Solidity decode a struct returned from a delegate call?

I have a proxy contract that delegate calls to a target contract. The proxy is similar to DSProxy. In it, there is an execute function: function execute(address target, bytes memory data) external ...
0
votes
0answers
11 views

How can a contract receive Ether via a public getter function?

While reading the Solidity docs on Panic via assert and Error via require, the following statement caught my attention: An Error(string) exception (or an exception without data) is generated by the ...
2
votes
0answers
15 views

How to bubble up a custom error in Solidity?

Solidity v0.8.4 introduced custom errors: error Unauthorized(); Say I have contract A which delegate calls to contract B. The latter reverts with the custom error defined above. How can I bubble that ...
0
votes
1answer
25 views

Having trouble figuring out EIP-1599 params for contract transaction in ethers.js

I am following contracts documentation at https://docs.ethers.io/v5/api/contract/contract/#contract-functionsSend And got to the point where my contract call looks something like this (someMethod and ...
0
votes
1answer
18 views

Manually add contract address to an Ethereum wallet

I cannot find any advice on how to manually add a contract address for tokens on the ETH network. All resources point to clicking "add wallet" within their own application. Similar to adding ...
0
votes
0answers
40 views

What does setApprovalForAll do when minting an NFT directly from contracts on Etherscan?

When there is a contract : It says Approve Get access by card Or if it says ————- Whitelist address Set approval Claim free mint Mint _____ And I’m trying to just mint the project In both of these ...
0
votes
0answers
11 views

Web3.js retrieve a boolean from ERC721 Contract

I can't find this anywhere in the docs. I'm trying to retrieve a boolean value from my ERC721 contract. I understand that to call a function, you simply use: contract.methods.MyFunction(param1, param2)...
1
vote
2answers
92 views

does using external over public in a library reduce any gas costs?

I have a library utils.sol library Utils { struct UtilType { unit var1; bool var2; } function addExtra(UtilType storage state, uint extra) public { state.var1 += extra; } } ...
1
vote
2answers
38 views

How to send token instead of eth with web3?

I have a function that sends eth to a function in a contract with web3: await contract.methods.withdraw(i).send({ from: from }); debug("withdraw in battle: "+i); } I would like ...
1
vote
1answer
18 views

What are the best tools or ways to interact with a smart contract from a word-press website?

I am currently working on a WordPress website and I want to interact with a deployed smart contract and need help selecting the right tools or ways to interact.
0
votes
1answer
34 views

Setting the value of AmountOutIn

I have been running this small script to buy through the PCS router contract and as it works, the slippage is set to 0. I need to know how to find the value and what it expects so that i can set ...
0
votes
0answers
17 views

Must I have metamask installed in order to use Web3js

I forked the GitHub repository https://github.com/dappuniversity/price-bot and made some edits to the code. I used my laptop and ran the code using by typing the command npm run start in my terminal ...
0
votes
0answers
56 views

swapExactTokensForTokens "this should not happen"

I can't find any answer about this : I'm calling swapExactTokensForTokens and get this message : "this should not happen" I'm using NodeJs & ethers.utils. const Provider = new ethers....
0
votes
1answer
17 views

How to enter a uint256[] function input in java script?

I'm trying to interact with my smart contract using java script. My function uses an uint256[] input. In python the desired input would be input = [1,2] In java script I tried const arrayindex ...
0
votes
1answer
23 views

Can I interact with a smart-contract that's a variable inside another smart-contract?

I want to interact with a third party contract. I can interact with (third party) Smart Contract A. Inside Smart Contract A's code is import { contractb } from ".../ContractB.sol"; ...
1
vote
1answer
39 views

Which one is better visibility option of solidity method?

I have a external method declared. At some point I realized that I need to call that external method from one of the another method within a contract and which is not possible. There are options to ...
0
votes
0answers
16 views

Using the return value of a contract function in another function

I have a smart contract A with a public function a1 that can be called by anyone and this public function will return a uint value based on another public function named a2 inside the same contract A. ...
3
votes
2answers
173 views

How can I get the hexadecimal equivalent for a method name in an Ethereum contract using Python?

The function to call is called xyz(). My code: web3.sha3("xyz()").substr(0,10) Error: AttributeError: module 'web3' has no attribute 'sha3' In newer versions of web3, the above error ...
2
votes
2answers
61 views

I keep getting nonce is too low when using truffle to call functions on contracts even though this works fine on remix.How can I fix this

I keep getting the nonce is too low when running functions with sub transactions on the kovan test net is there a way I can stop this from happening?these sub transactions are making transactions with ...
1
vote
0answers
57 views

[ Web3.js on BSC ]: Returned error: unknown account

Here's the error: index.js:1 Error: Returned error: unknown account I'm getting this error while running this method: nftMintingContract.methods.mint(account, cid).send({from: account}) The ...
0
votes
1answer
43 views

Dynamically calling any other contract and function from contract

This gives a contract the same ability to interact with other contracts (with its address as msg.sender), as an externally-owned account, right? function call(address _contract, bytes calldata ...
0
votes
1answer
83 views

How to return a storage array from a Solidity function?

I wrote a very simple smart-contract where I want to create an external function which returns as an output a storage array which contains the following items [0,2,4,6,8,10,12,14,16,18]: pragma ...
0
votes
1answer
29 views

Can I automatically forward transactions from a given address?

The challenge is to provably promise to transfer a transaction from address X to address Y. Basically, I need to be able to convince Y that if I get the money from X - it's going straight to Y. X is ...
0
votes
0answers
26 views

How to get the balance of tokens inside my MetaMask wallet?

I am trying to get the balance of the Alpacas I have in my MetaMask wallet. Googling around I found different ways but many didn't work. So this is the most recent code I found but it is returning ...
1
vote
0answers
32 views

Are there multiple 0x order formats?

I am currently writing an arbitrage bot which fills 0x orders but something that is confusing me is that the 0x order format is not consistent within their documentation. The order message format ...
0
votes
0answers
16 views

Calling Functions of a child contract using an owner contract

I had deployed a smart contract (contract #1) that uses another smart contract (#2) for some transaction logic. Contract #2 was imported in the first contract itself and deployed with the help of ...
1
vote
0answers
24 views

Why can I enter an invalid contract address in the Remix IDE and still work with it?

I successfully deployed a contract to a local Ethereum development network: notarisation_1 | Address of deployed contract notarisation_1 | ---------------------------- notarisation_1 ...
1
vote
0answers
9 views

Record called functions during the transaction execution

I am analyzing the flash loan workflow. Notice that PeckShield publishes an analyze report about bzx flash loan. See https://peckshield.medium.com/bzx-hack-full-disclosure-with-detailed-profit-...
1
vote
1answer
179 views

Which method will return the liquidity list provided by user?

I am new to the DEX development. Am using pancakeswap router contract https://testnet.bscscan.com/address/0xd99d1c33f9fc3444f8101754abc46c52416550d1 Using ethers.js to call contracts. addLiquidityETH ...
0
votes
2answers
78 views

Why is transaction reverting with custom smart contract?

I have deployed a smart contract to the Polygon Mumbai Testnet (it shouldn't really matter where I deployed it). When sending a transaction to call a function on this contract, the transaction fails, ...
0
votes
0answers
79 views

How to prevent timeout on Solidity contract (not on tests or deployment config)

Consider the following function which is our current workaround to calculate the power of fractionals without overflowing (if you know a better one please let me know in the comments): function power(...
0
votes
2answers
97 views

How to configure `truffle test` to fork the main/rinkeby chain as its local chain?

The smart contract I want to unit test instantiates IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D). Obviously this contract does not exist on the local chain that is spawned by truffle ...
0
votes
0answers
15 views

Multplier Finance How to get the available reserves on mainnet and testnet

I am trying to conduct tests involving flash loans from multiplier.finance on the BSC testnet chain. I am trying to find out what the tokens with available reserves on the testnet lending pool. ...
0
votes
0answers
11 views

how to get transaction calls depth, it's to get contract call which contract

how can i get transaction call depth? just like this website shows https://explorer.bitquery.io/ethereum/tx/0x67919e359276ecc7de83e50220b6d0e9d0292711f2a8cd6245f8c297cc595185/calls
0
votes
1answer
12 views

Do I need to call the functions in my smart contract?

Lets say I have a contract including the following: uint256 public _burnFee = 3; function setBurnFeePercent(uint256 burnFee) external onlyOwner { _burnFee = burnFee; } I compile and deploy ...
0
votes
0answers
64 views

Is there anyway to extract all Ether Transaction within a Contract call by Web3?

Extracting Token Transfer is trivial which can be done by lookup all logs emitted from the Transaction with Event Signature and Topics. By these assumptions : No ABI is known for the contract No ...
0
votes
1answer
10 views

How does providing gas for a function-in-function call in a contract work?

Looking at this article about contract interactions, I saw this line of code: someAddress.call.gas(1000000).value(1 ether)("register", "MyName"); With the explanation: It’s also ...
0
votes
0answers
6 views

Can/will a Serenity smart contract be able to cover gas fees?

Vitalik Buterin first expressed here the concept that Serenity contracts would cover a contract-pays instead of a user-pays option. There is also this relevant Improvement Proposal, but I have failed ...
1
vote
2answers
7k views

How is OpenSea able to allow sellers to list NFTs for free, and without gas fees?

Besides the usual 2.5% commission, NFTs minted on OpenSea are known to be free to list with a price since OpenSea does not take custody of the NFT anytime during the sale process. Does it though as ...
0
votes
0answers
9 views

calling a method in smart contract using sendRawTransaction and getting result [duplicate]

first of all, i know that this has been asked before or there are similar questions to before, just like this one How to call my contract's function using sendTransaction however, I am confuse on ...
0
votes
1answer
632 views

How to convert WETH back to ETH (solidity)

I am trying to convert back WETH into ETH (actually BNB on BSC). I am doing the following: function allToBNB() public{ WETH.transfer(address(this), WETH.balanceOf(address(this))); }` ...
0
votes
0answers
18 views

Is there a way to charge gas fees to a smart contract that you use to call another smart contract?

If user account A makes a call to smart contract B that then makes a call to smart contract C, is it at all possible to have smart contract B cover the gas fees of this transaction? Essentially what I ...
0
votes
0answers
26 views

How to create a Nested Looping of an array of addresses and addresses' balances

I am writing a Presale contract for a particular number of addresses. it is only the owner of these addresses that can participate in the presale, however, I get fetched these addresses on-chain then ...
1
vote
1answer
29 views

Accidentally deployed two identical contracts on blockchain. How can I pick the one I wish to interact with?

I deployed two identical contracts on the same blockchain. contract V1 address:0x48A2a37fF1Cff6eB1984aCA7fCA4cAa25B1C9287 contract V2 address:0xdfaDE9c110eBD5C00243Ca0b3AdCf5B73A8f0e42 However I ...
5
votes
1answer
789 views

Proxy contract to avoid sniping bot

I am working on a trading bot with ethers.js and I would love if someone could elaborate on the following topic. Many sniping bots try to buy as fast as liquidity is added to the pool. This can be ...
0
votes
1answer
72 views

Obtain transaction hash from event (ethersjs)

My goal is to detect a contract invocation as fast as humanly possible. To do this I am processing all the pending transactions I have access to (via provider.on("pending", async (tx) => {...
1
vote
0answers
47 views

How to design a smart contract that allows people to trade NFTs

Instead of smart contracts that people deposit ETH into as offers to buy NFTs (ETH for NFT), how can a smart contract be designed so that two counterparties can deposit NFTs into the smart contract in ...

1
2 3 4 5
21