Questions tagged [smart-contract]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
1k views

What is block.coinbase in solidity?

I am not able to understand what this keyword exactly does. Can anyone please help?
Shubham Sharma's user avatar
0 votes
1 answer
104 views

Unhandled Runtime Error Error: missing argument: passed to contract (count=0, expectedCount=1, code=MISSING_ARGUMENT, version=contracts/5.5.0)

basically, I am building a nft marketplace and whenever I want to create a nft and publish it I keep getting this error, it definitely has something to do with my smart contract, deploy.js or my front-...
Eyad Ahmed's user avatar
0 votes
1 answer
16 views

Variable Values do not persist in between function calls

I am new to Solidity, and I am experimenting on smart contracts using Remix-IDE connected to a deployed local Geth instance. What I am trying to do is to create a struct containing multiple fields for ...
AAA's user avatar
  • 1
0 votes
1 answer
72 views

Function isn't returning the uint256 value after initializing mapping

I'm facing a problem with the function return type in solidity. Here is my code: // SPDX-License-Identifier: MIT pragma solidity ^0.8.17; contract Birth { mapping(uint256 => bool) public ...
Asir Shahriar Roudra's user avatar
0 votes
1 answer
30 views

Where are the Decentralized File Storage Contracts in Ethereum?

In the ethereum whitepaper Decentralized File Storage are cited as one of the applications, along with others. But looks like that this ideia is not popular, i do not know a single one, in oposition ...
Rafael's user avatar
  • 328
1 vote
3 answers
63 views

Smart Contract Memory Arrays

I see that push and pop methods are not available for memory arrays in solidity. I have a code below where I need to return an array of struct satisfying condition as shown below. How do we do this, ...
Suvam Tamang's user avatar
2 votes
2 answers
1k views

How do i deploy a contract on chain using bytecode

I'd like to deploy a smart contract that can take in bytecode as the argument and deploy that contract. Currently, the only way I see examples of is that they take a specific contract that is already ...
bpop's user avatar
  • 23
0 votes
1 answer
20 views

How do I integrate crypto options into my website?

I'm trying to add crypto options to my website. I've seen the name Ribbon finance a few times as a defi options provider. They don't seem to have the contracts that I'm interested in implementing on ...
Ricky Conn's user avatar
5 votes
1 answer
347 views

What type of eoa can meet the condition : tx.origin != msg.sender

modifier onlyEOA() { require(tx.origin == msg.sender, 'only EOA can call'); _; } I just read about eoa check with the above modifier, if the require true it completely fine, but the document ...
rived's user avatar
  • 160
0 votes
1 answer
34 views

Donated amount not geeing added to contract address

Sorry for asking so basic question. But I can not figure out what to do. As I am new to this topic. I have no idea how to solve this issue. I have a basic contract for crowdfunding. It has some basic ...
BLIND's user avatar
  • 1
0 votes
0 answers
21 views

ParserError: Expected identifier but got 'payable' --> Contract.sol:18:23: | 18 | address [] public payable senderAddresses;

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract TokenDistributor { using SafeMath for uint; // Contract ...
Lll Cilician's user avatar
1 vote
1 answer
117 views

Warning: This declaration shadows an existing declaration with a Struct

I 'm looking for a way to clean my compile warning, i have a Warning: This declaration shadows an existing declaration. on the function below. The Transaction in the return is a Struct compose with id,...
Hutgin's user avatar
  • 13
1 vote
0 answers
40 views

Library package helps interact with Blockchain on the Ethereum platform (ETH, BSC, Polygon...) more simple and minimized

I am a Blockchain engineer and after 3 years of working with the EVM-platform I used many different libraries such as web3, ethers, ethereumjs-tx,... I realized they are so distributed and complex to ...
Khiem Nguyen's user avatar
1 vote
2 answers
319 views

Is there a foolproof way to determine if an address is a contract address or an EOA?

Is there any foolproof way to determine if an address is a contract address or a wallet address ? I searched across articles and stack exchanges but haven't found a satisfying answer .
Gaurav Pant's user avatar
0 votes
1 answer
15 views

Query on deploying local network

I am following Patrik Collin's solidity course where he is deployed the smart contract first in local network then in testnet. My question is deploying in local network is necessary?
Hacek 's user avatar
  • 665
0 votes
1 answer
113 views

How can I set amount value in address(this).balance

Like i want to Insert the value that how much ethers are transfer from my smart contract. I tried this second day but it's not working so i'm looking for solution any help is highly appriciated here ...
MindCoder's user avatar
0 votes
0 answers
77 views

Identify/ Detect Proxy and upgradeable smart contracts

Is there anyway I can identify Proxy, or Upgradeable smart contracts through either etherscan or an archive node?
Nad3r Verse's user avatar
0 votes
1 answer
50 views

Is testnet offchain?

I am confused on the clear definition of onchain offchain, as far as I know that if a contract is deployed on mainnet this means it is onchain. Here my question is If I deploy a contract on testnet ...
Hacek 's user avatar
  • 665
0 votes
1 answer
25 views

Smart Contracts and Web3

Is it that when I use smart contracts for storing and retrieving data to and from blockchain, the smart contract automatically stores data in the next to be added block as well as runs through the ...
Suvam Tamang's user avatar
0 votes
1 answer
87 views

Why are ERC721's safeTransferFrom(4 params) , safeTransferFrom(3 params) , transferFrom() and approve() payable but setApprovalForAll() not?

Reference : https://eips.ethereum.org/EIPS/eip-721 I was going through the official documentation from eips.ethereum.org for ERC721. I have some doubts from the interface of ERC721 : function ...
Gaurav Pant's user avatar
1 vote
1 answer
194 views

What to choose between memory and calldata for parameter of type bytes?

TypeError: Data location must be "memory" or "calldata" for parameter in external function, but none was given. --> contracts/NFTERC721.sol:51:77: | 51 | function ...
Gaurav Pant's user avatar
4 votes
2 answers
550 views

What is the default visibility of a variable in solidity?

mapping(uint256 => address) owner; What is the default visibility of this variable?
Gaurav Pant's user avatar
2 votes
2 answers
1k views

wagmi useContractWrite response not including event parameters

I am using wagmi useContractWrite hook to execute a smart contract function and would like to capture the response from the function emitted through an event. The event seems to be captured under data....
adeelmahmood's user avatar
2 votes
4 answers
741 views

Unable to use usdt token inside contract

I have a contract that works with usdt. It creates an IERC20 object of the contract address that we pass to it in constructor, but the contract is working abnormally when I try to call usdt....
Farrukh Raza's user avatar
0 votes
0 answers
64 views

getting TypeError: dex.setLiquidity is not a function error in ethers.js

I have got the contract instance using using the provider, signer and abi, but could not able to call the methods of the contract. const { ethers, network, hre } = require("hardhat") const {...
Hacek 's user avatar
  • 665
0 votes
1 answer
23 views

Does data written into blockchain increases with gas usage?

I am writing smart contracts for a private EVM-compatible blockchain. Due to that, the gas cost isn't as relevant as it would otherwise be. Instead, we are more focused on the size of the blockchain ...
Sky's user avatar
  • 2,204
0 votes
1 answer
134 views

NFTs having the same URI

I understand that for instance a picture of an NFT can be saved, and recreated, and the picture itself would be the same as the copy of it. But what if instead of copying the picture, I copy the base ...
curiousTrader's user avatar
0 votes
1 answer
24 views

Should I create my aragonOSx plugin manually or through the aragon SDK?

It is unclear to me whether I should build a plugin using the Aragon SDK or if I should build my own smart contracts plugin manually and publish it to the aragonOSx protocol?
juliette_chevalier's user avatar
0 votes
1 answer
221 views

abi.encode transfer question

If I make a call to an external smart contract that uses a function (transfer) which of the following is safer. using abi.encodeWithSignature (bool success, ) = address(contractInstance).call(abi....
kapitankot's user avatar
0 votes
1 answer
20 views

Is there any method in web3js library to know if a given address is a contract address or an wallet's account address?

I am writing solidity tests . I am using JS for testing . Is there any method in web3js library to know that a certain address is a contract's address or not ?
Gaurav Pant's user avatar
0 votes
1 answer
24 views

Stuck in a loop problem, cannot figure out the solution

I am suppose to write a funciton that takes row,col and values and return a list within a list such that for example, row=3 , col=4 , value=9 , it should give out [ [9,9,9,9] , [9,9,9,9] ,[9,9,9,9] ] ,...
Azhan_Ahmed's user avatar
0 votes
0 answers
20 views

Why do optimistic rollups take 1 week to transfer data between blockchains?

There are 2 types of layer 2 rollups basically: optimistic rollups and zk-rollups. Why do optimistic rollups take 1 week, and zk-rollups take a few minutes. I don't understood that part.
aakash4dev's user avatar
0 votes
0 answers
53 views

Weird behaviour and the error 'TransferHelper: TRANSFER_FROM_FAILED'

I have the following function: function _swap_token(address _token_in, address _token_out,uint _amountIn,uint _amountOutMin) external OnlyOwner { address[] memory path; ERC20(...
Alex's user avatar
  • 3
2 votes
1 answer
100 views

In a smart contract storage layout, Is it 100% beneficial to pack reduced-size variables in one slot?

In the solidity doc, it says it "might be" beneficial to pack multiple reduced-sized state variables into one storage slot. And it gives an exception case that when the packed variables in a ...
bzpassersby's user avatar
1 vote
1 answer
186 views

Is it safe to use ERC 998 now?

I want a functionality in my smart contract where a token ( say an ERC 721 token ) can own other tokens ( ERC 721 , ERC 1155 , ERC 2535 ) . With some research I got to know about ERC 998 . I checked ...
Gaurav Pant's user avatar
0 votes
2 answers
95 views

How can someone verify that the deployer of a smart contract does not hold a matching private key?

Smart contracts don't have private keys. But there exists a private key matching their public key/address in the sense that their public key is derived from a key pair generation mechanism. How can I ...
fallen_angel's user avatar
0 votes
0 answers
16 views

I encountered typer error while linking solidity smart contract with react frontend

I and my team encountered this error below while trying to link the react frontend to communicate with the smart contract. The project is NFT marketplace TypeError: Cannot read properties of undefined ...
Dawveed's user avatar
0 votes
0 answers
92 views

Error :The contract code couldn't be stored, please check your gas limit

I am trying to deploy my contract on sepolia test network .I have 2.1192 sepolia test eth . Everytime I try to deploy the contract I got the same error . saying : The contract code couldn't be stored,...
Shorna's user avatar
  • 13
1 vote
0 answers
127 views

Contract call: MyContract#<unrecognized-selector>

new to solidity and I am trying to make a simple calculator DApp. I keep getting an error when I call my add function from the contract. It still performs the add function but in the console it gives ...
NotToDevy's user avatar
1 vote
1 answer
90 views

What currency msg.value represents on different blockchains?

I'm writing a smart contract and testing on goerli and I want to deploy the smart contract to both mainnet and the polygon chain. In a payable function, when I require msg.value to be greater than say ...
bzpassersby's user avatar
0 votes
1 answer
319 views

error: {'code': -32000, 'message': 'invalid sender'}

I have my smart contract deployed on BSC Testnet: https://testnet.bscscan.com/address/0x01AbBD3c43d447dA73CDee8d138697Df36f785d2 If I connect my Metamask on bscscan, I can use all the write contract ...
Anil Panda's user avatar
0 votes
2 answers
91 views

How to transfer received amount while paying gas from another account?

Here's an example: https://bscscan.com/tx/0xe253f721338acde5c7b29eec16ea121396fc9ccc7d2fd79317db1de54bf7ecaf I have sent 0.00950688 BNB to 0x86a54685774b674c848824b1ba3303418d0c3f80 address and the ...
zfou's user avatar
  • 115
0 votes
1 answer
16 views

Why does uniswap V2 re-read duplicate data? (Gas optimization)

In the transferFrom() function, msg.sender is used to check the allowance and change it three times Wouldn't it be better to set msg.sender once in a variable called _msgSender and then use _msgSender ...
Zig Balthazar's user avatar
0 votes
1 answer
267 views

Getting error "Invalid account" while trying to deploy smart contract to Goerli Testnet

Getting an error while I'm trying to deploy a smart contract to Goerli testnet. The error: Error HH8: There's one or more errors in your config file: * Invalid account: #0 for network: goerli - ...
Asir Shahriar Roudra's user avatar
0 votes
0 answers
8 views

Learning material for implementing a private blockchain

I recently got interested in blockchain and smart contracts. I want to learn through hands on experimentation. Is there any free guide on how to start implementing a private/consortium blockchain ...
Bertelemy's user avatar
1 vote
2 answers
186 views

console.log output on live network

how to read the output of console.log() (it doesn't appear on my hardhat node console ) when i m running a smart contract on goerli (alchemy) via a js script (hardhat) ? import "hardhat/console....
adam mr's user avatar
  • 61
0 votes
1 answer
47 views

Is it possible to simultaneously call a method from the children's smart contract by the parent's smart contract?

I have a smart contract on the BSC network that has created a large number of children and stored the address of each. In the child smart contract, the UUDT token is stored. Also, each child smart ...
softweng's user avatar
  • 129
1 vote
3 answers
1k views

Can the smart contract automatically send the amount received to the owner's address or any fixed address defined in the contract?

Can we have a smart contract that when an amount is deposited into it, it will automatically transfer it to the owner's wallet address? I mean, as soon as the amount is received, the smart contract ...
softweng's user avatar
  • 129
0 votes
1 answer
263 views

console.log output

I'm running a contract on alchemy node, how can I see the output of console.log()? (the console.log() output doesn't appear on the terminal where i'm running js script via hardhat. i'm on goerli via ...
adam mr's user avatar
  • 61
0 votes
3 answers
377 views

cant deploy my contract and getting same error

I am new to solidity . I am trying to learn solidity following a course . I trying to deploy my contract . I am getting same error again and again . I have tried some solution with same title I found ...
Shorna's user avatar
  • 13