Skip to main content
20 votes
Accepted

What is DSProxy and how does it work?

What DSProxy is a smart wallet built by DappHub that enables developers to execute multiple contract calls in one transaction. This is something that vanilla EOAs can't do; they are limited to ...
Paul Razvan Berg's user avatar
6 votes
Accepted

I want learn smart contract trading

That’s called arbitrage, you swap e.g. ETH for DAI on one exchange and then swap it back from DAI to ETH on another exchange. This works because the so called DEX’s (Decentralized exchanges like ...
Paulus's user avatar
  • 410
6 votes

how to deploy a smart contract on same address in ethereum and binance

If your deployment environment employs the CREATE opcode under the hood, The deployed contract address is going to be a function of the deployer's EOA and the nonce. contractAddress = hash(...
Ahmed Ihsan Tawfeeq's user avatar
6 votes

Error: chainId address mismatch

i found the answer i have been struggling with this for a week! i just changed the Network Id in the ganache to 1337! and it got through!!! Awesome!
mostafa alipour's user avatar
5 votes

Help Please hardhat.config.js * Invalid account: #0 for network: Rinkeby - private key too short, expected 32 bytes

Make sure you are copying your PRIVATE KEY and not your PUBLIC KEY. If you are using metamask, you can get your PRIVATE KEY from the 3 dots menu beside your public key, and then account details ...
Alejandro Morales's user avatar
4 votes
Accepted

How to retrieve multiple values returned from solidity with ether.js?

const result = await contractInstance.yourFunction(); const {0: variable_1, 1: variable_2} = result; Reference: https://blockheroes.dev/js-read-multiple-returned-values-solidity/ Hope it helps.
Human's user avatar
  • 56
4 votes
Accepted

Detect receiving token address in "receive() payable"

The receive function is triggered by a transfer of the native token only, such as ETH on Ethereum or BNB on Binance Smart Chain. Therefore, msg.value is always an amount of the native token and never ...
Undead8's user avatar
  • 3,580
4 votes

Deploying a contract that inherits GnosisSafe from another smart contract

If the goal is to deploy a Safe with custom modules and guards, you don't necessarily need a separate contract to do that. When deploying a Safe, there's a distinct initializer parameter to setup ...
mikheevm's user avatar
  • 1,075
4 votes

Where are the Ethereum smart contracts actually stored?

from the ethereum yellow paper The world state, is a mapping between addresses and account states (a data structure serialised as RLP). Though not stored on the blockchain, it is assumed that the ...
Javier Marchetti's user avatar
4 votes

Lock and unlock in solidity

Here is what you need: I modified your code to include logic to unlock 5 percent of the tokens. I added comments as suggestions and clarification. There are about 2,628,288 seconds on average in a ...
Jeremy Then's user avatar
  • 4,599
4 votes

why I'm I getting this error: Wrong argument count for function call: 6 arguments given but expected 5.solidity(6160)

In your emit you are trying to emit 6 elements . But in your event function you are only accepting 5 elements In emit "amount" is an extra argument
infamousdegen's user avatar
3 votes
Accepted

Transfer ERC20 tokens of a smart contract

There is two different address in Ethereum. The one controlled by a private key (usable for a user). Smart contract that are address controlled by a code (no private key). If you didn't put a function ...
GrindCode's user avatar
  • 365
3 votes

What is the pupose of TokenID increment in OpenZepplin implementation?

What makes a token unique within an ERC-721 NFT contract is that token’s tokenId. The ERC-721 NFT standard doesn’t tell you how to assign tokenIds to tokens, but only requires that different tokens ...
dwardu's user avatar
  • 1,398
3 votes

How to get smart contract information about ABI token balance by web3?

You can find if an address is a contract by fetching its bytecode : web3.eth.get_code(address). If it has any, then it's a smart contract, otherwise it's EOA. (Web3py ref) You cannot retrieve the ABI ...
Xavier59's user avatar
  • 532
3 votes

Stop frontrunner bots by comparing block.number of buy tx versus sell and transfer tx?

I tested this today on BSC network and was successfully able to guard against frontrunner sandwich bots using this method. Honeypot checker did not flag my token. I doubt any bots would implement this:...
Todd Robbins's user avatar
3 votes

Solidity : Error encoding arguments: Error: invalid BigNumber string

I'm also learning from fcc haha. Not sure if you still need it but just in case if others also encounter similar problem. I don't think you're supposed to change "People[0] public people;" ...
shiokempire's user avatar
3 votes
Accepted

Error : Using ".value(...)" is deprecated. Use "{value: ...}" instead

I had faced this on invoking call and had found from Solidity docs that gas and value parameters need to be passed in curly brackets now: address(nameReg).call{gas: 1000000, value: 1 ether}(abi....
TaherBorsadwala's user avatar
3 votes

How to encode initializer in gnosis-safe proxy contract?

As proxies canot use the conventional constructor approach, the common way to compensate for this is to provide an initialization function (see OpenZepplin). To avoid that this can be front-run in a ...
Richard's user avatar
  • 4,964
3 votes

Mint nft on Testnet

For testnets you can use address https://testnets.opensea.io/
Vladimir Goncharov's user avatar
3 votes
Accepted

ERC20 decimals in smart contract

As explained here, the decimals in an ERC20 token are just for representation to the user. The EVM has nothing to do with it. A wallet that recognizes ERC20 tokens and knows how many decimals a token ...
Jeremy Then's user avatar
  • 4,599
3 votes

how to add rinkeby test network to metamask

The Rinkeby and Ropsten testnets have been deprecated as of October 5th, 2022.
Yongjian P.'s user avatar
  • 4,190
3 votes
Accepted

Can I lock an account to a specific smart contract?

Unfortunately, you can't directly "lock" an EOA (External Owned Account) to only interact with a specific smart contract, as it's not a built-in feature of EVM. However, you can design a ...
Adam Boudj's user avatar
  • 2,371
3 votes

Warning! Error encountered during contract execution [invalid opcode: PUSH0

Instead of going back to an older version of Solidity compiler, in hardhat to prevent use of PUSH0 you can try setting evmVersion to a previous version (e.g. paris, which is the one before shanghai) ...
SKYBITDEV3's user avatar
3 votes

Web3 Schema Update

Immutability doesn't mean you can change the data inside, it means you can't change the code. To change the name you need to include a setter function. For example: string name = NaMe; function ...
Zartaj Afser's user avatar
  • 3,864
3 votes
Accepted

How to sign Transactions in smart contract account in erc 4337?

That is the whole point of having smart accounts, to abstract away the need of signing a tx that needs the gas fees in native token. Smart Accounts just need to send the user Operations, and the tx ...
Zartaj Afser's user avatar
  • 3,864
2 votes

Can someone help me figure out how to get my UNI from an old MCD vault?

Here is what I think that you should do (using web3.js v1.2): const Web3 = require("web3"); // enter your node address and private key below, for example: const NODE_ADDRESS = "https://...
goodvibration's user avatar
2 votes
Accepted

what is the cheapest way for sending ethereum from 10 account addresses to 10 account addresses?

10 transactions from an EOA will cost 210,000 gas. The most efficient way to do this would be to deploy a contract that accepts funds in the constructor and subsequently distributes the funds to 10 ...
Shane Fontaine's user avatar
2 votes

How to write a smart contract for access level (read/write)?

This might be done in the same manner as any other programming language: you basically define who will assign/revoke these permissions and create a structure to handle such permissions per user (read, ...
Sergi Juanati's user avatar
2 votes
Accepted

What happens when the owner kills a multisig wallet?

By default there is no such concept as contract owner. Such concept exists only if it has been coded into the contract. So it depends on what kind of functionality the contract has. If by killing you ...
Lauri Peltonen's user avatar
2 votes
Accepted

Don't know how to get money out of smart wallet

I'm not 100% sure what's happened here, but... The smart contract was indeed self-destructed - via the kill() function - in the transaction you've pointed to (this one). During the self-destruct the ...
Richard Horrocks's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible