Questions tagged [contract-development]

Questions regarding the development of smart contracts

Filter by
Sorted by
Tagged with
0 votes
0 answers
2 views

Architectural issues of using smart contracts

As part of my master's thesis MVP, I am developing a project on the implementation of an accounting system for electronic document management using smart contracts. Now there is a question of ...
user avatar
0 votes
0 answers
7 views

Error: Hydration failed because the initial UI does not match what was rendered on the server, Wagmi and Nextjs

I was trying to implement wagmi in my dapp, after I copied the example in the documentation https://wagmi.sh/examples/connect-wallet, I got this error: Error: Hydration failed because the initial UI ...
user avatar
0 votes
1 answer
11 views

Display Value in Remix

I am a newbie in Solidity. Below is the simple Solidity source code pragma solidity ^0.4.21; contract CAT { event XYZ (uint Z ) ; uint[] x; uint a ; function f(uint[] memoryArray) ...
user avatar
0 votes
1 answer
10 views

Parameter function in Solidity

I am a newbie in Solidity. Below is the snippet of code I came across :- pragma solidity ^0.4.0; contract C { //1 function f(uint len) { //...
user avatar
1 vote
3 answers
26 views
+200

Is it possible for a callee to DOS a function call if the caller ignores the success value?

Consider the following function: uint256 mySpecialNumber = 0; function foo(address callee, uint256 newNumber) public { mySpecialNumber = newNumber; // make a low level call to the bar() function ...
user avatar
0 votes
1 answer
27 views

How to call an undeployed contract from a solidity code that only implements a constructor

I've two contracts, and I want to call a contract from another contract. I've two ways to do it, as described here but, my case is different, the callee contract only implements the constructor inside ...
user avatar
0 votes
0 answers
5 views

Is there any way to get autocomplete for Solidity function definitions in JavaScript?

By autocomplete I mean something akin to how functions that would be declared in JavaScript get prompts/autocomplete in IDEs. (Also, I'm using VS Code)
user avatar
1 vote
1 answer
11 views

Warning when returning no bytes data with checkUpkeep in Chainlink Keeper

From: @chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol"; When using: checkUpkeep(..) .. override returns (bool upkeepNeeded, bytes memory /* performData */) I'm not ...
user avatar
2 votes
2 answers
46 views

How to instantiate contract instances with ethers.js and alchemy-sdk

(Found this from the public Alchemy discord, and wanted to ask the question here so it can get indexed online 💙) I'm trying to instantiate contracts in my javascript code so that I can call ABI ...
user avatar
1 vote
1 answer
39 views

Chainlink Keepers not Upkeeping after i enterLottery. Can you spot issue that would be causing this?

I've spent many weeks on this project trying to figure out why "Chainlink Keepers" is not working. I can successfully deploy and verify the contract on Rinkeby. Then i do the following... 1.)...
user avatar
0 votes
0 answers
5 views

Utilizing and Monetizing existing NFTs using Magazine

I’m working on a side project, A Meta Magazine, featuring NFTs only. This is a collaborative project which utilizes existing NFTs. Entire Mag will be made out using NFTs, including cover pages, ...
user avatar
  • 1
1 vote
1 answer
107 views
+50

Update HashMap within onERC721Received with Vyper

When a contract receives an NFT by calling safeTransferFrom, onERC721Received is automatically called on the receiving contract. I want to be able to update a Hashmap to record the address of the ...
user avatar
  • 35
0 votes
1 answer
26 views

What should I do to mint 2000 items?

When I try to mint 2000 items in remix I get this error: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? ...
user avatar
  • 1
1 vote
1 answer
19 views

After deploying a smart contract, if I have 2,000 items, is it possible to mint all of them at the same time?

If I have 2,000 items, is it possible to mint all of them at the same time, or is there a limit for the number of items that I want to mint at the same time?
user avatar
  • 11
0 votes
1 answer
14 views

i have been trying to deploy mocks for my hardhat-raffle , but i encountered this problem

const { network, ethers } = require("hardhat") const {developmentChains} =require('../helper-hardhat-config') const BASE_FEE=ethers.utils.parseEther("0.25") // 0.25 is the premium ...
user avatar
0 votes
0 answers
16 views

How to split bytes from calldata and convert into memory variables?

Assume calldata for my smart contract being address as bytes, and few amounts as bytes chained together. How can I extract the bytes for address and store it in address memory address_ = and the ...
user avatar
-1 votes
0 answers
14 views

there are different addresses who are making there todo list on solidty, my task is to findout which address is writing which to do list?i [closed]

pragma solidity ^0.8.15; //SPDX-License-Identifier:unlicense contract arrayupdatedeleteadd{ string[] myarray3; address owner = msg.sender; mapping(address => string[]) addressfromarray; ...
user avatar
0 votes
1 answer
22 views

How to get index from Mapping array in Solidity/Remix?

I can push worker address to mapping with manager address. I try to get manager address like this code. contract Test { struct Worker{ address manager_add; address worker_add; }...
user avatar
0 votes
1 answer
20 views

A few simple question about using interfaces vs. standard contracts (IERC721 vs. ERC721)

1.)Is it correct to say..... if i import ERC721.sol into my contract then all the ERC721.sol functions are accessible even if i don't list all the functions in the contract? Meaning... i don't ...
user avatar
0 votes
1 answer
22 views

Solidity interface error

I am trying to connect two different Smart Contracts using interfaces. Here is my contract CRUD.sol: // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; contract CRUD { struct Data { uint id; ...
user avatar
0 votes
0 answers
16 views

Are 'suspended' transactions even possible?

newbie here, toying with the idea of some gambling game, nft-based. Suppose I want users to gamble on their own NFTs. Obviously I want the actual transaction to occur only if the player loses. I guess ...
user avatar
0 votes
2 answers
37 views

Function Max mint per wallet is not working

learning solidity and curious how i can limit the minting of my NFT to only 2 per wallet address. Trying to prevent people from minting more then 2 tokens during free mint phase using "mapping&...
user avatar
  • 11
0 votes
2 answers
29 views

Error during Ethereum solidity NFT contract execution [Out of gas]?

We have a Rinkeby contract for minting NFTs. Occasionally, when it's in public-sale mode, if a person attempts to mint an NFT, the transaction fails and on the tx's etherscan it says: Warning! Error ...
user avatar
  • 103
0 votes
1 answer
13 views

Multiple inheritance in Solidity

I have a contract C that is Ownable so I can use ownerOnly on its admin functions. Recently, I added some functionality that I'm going to start using in other projects. I refactored the functionality ...
user avatar
1 vote
3 answers
104 views

Do we still need centrallize database at all for Dapp development?

This question keeps popping up in my mind, do we need centralize database at all for Dapp development like PostgreSQL, MongoDB and more, what if we want to store user's email and send them email ...
user avatar
0 votes
0 answers
12 views

Understanding local variables named as same in diffrent functions and modifiers

I'm confused while understanding the local variable _txId is used in several functions and modifiers, do they all have the same value or are they independent for each call. I read that local variables ...
user avatar
  • 24
0 votes
0 answers
18 views

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'eth')

I am following what seems a relatively simple tutorial to create a smartcontract, however, I am getting the above error and I am stumped as to what is causing it Below is my html file <!DOCTYPE ...
user avatar
0 votes
1 answer
15 views

if vs require - Predict the future challenge

this is my first message here! I've been trying to solve this challenge: https://capturetheether.com/challenges/lotteries/predict-the-future/, and I don't understand why I was able to solve it only ...
user avatar
  • 3
0 votes
2 answers
37 views

Solidity interface between two contracts

i am trying to connect two different Smart Contracts. On one hand I have CRUD.sol, which implements CRUD operations in a struct "Data". I have programmed a method readAllData() that returns ...
user avatar
0 votes
1 answer
23 views

What determines when etherscan will automatically verify a contract?

As I understand it, etherscan will look at the bytecode and automatically verify contracts similar to ones its seen before. My question is, how does it make this decision? Does it verify only ...
user avatar
  • 27
1 vote
1 answer
11 views

Permit in a stablecoin

I am trying around and writing a kind of new stablecoin code. How should a permit function look like so it is correctly embedded and secure against any fraudulent usages?
user avatar
0 votes
0 answers
16 views

How can I check the previous values of smart contract variables?

If I have a variable uint public data = 42; and in the next invocation of a smart contract's function, this is now data=43. Can I somehow check and find the previous value (i.e., data=42) ??? Where ...
user avatar
  • 15
0 votes
2 answers
26 views

Pls how do I create a nested array in solidity

I was trying to create a contract that has multiple rooms, in each room there would be some amount of players. Pls how do I acheive this? This is my approach but it's not working. I am unable to ...
user avatar
0 votes
2 answers
26 views

Impementing AggregatorV3Interface into the contract throws Error: cannot estimate gas

I have a working contract deployed on rinkeby, I'm trying to add there a function to get the current ETH/USD price using ChainLink's AggregatorV3Interface . When testing the needed function in Remix, (...
user avatar
0 votes
0 answers
22 views

Trying to connect my smart contract with my front end

I am building a basic DAO program. My smart contracts are mostly finished and my front end is mostly finished except for of course the blockchain elements. Before I jump into my current problem I will ...
user avatar
1 vote
0 answers
27 views

Make a struct returned by ethers.js writable?

In my smart contract, I keep some contract metadata in a struct called _data. What I want to build is a mechanism to retrieve this metadata, make required changes, and then write the struct back to ...
user avatar
  • 507
0 votes
1 answer
21 views

Is Ethereum the best platform for my project? [closed]

I'm a newbie in the blockchain world and I was wondering if I could jog your brains. I'm currently trying to run a few drones using blockchain and smart contracts, but I'm unsure which platform to ...
user avatar
0 votes
1 answer
11 views

Block.number - how to fetch it correctly

I want to get the current block number of all blocks. If I run return block.number it only returns me the number of blocks since the last deploy. Why is it like that?
user avatar
0 votes
0 answers
27 views

Attempting to connect my smart contract with my front end

I am attempting to build a basic DAO program. My smart contracts are mostly finished and my front end is mostly finished except for of course the blockchain elements. Before I jump into my current ...
user avatar
1 vote
1 answer
31 views

How to sort off-chain

I read this article about sorting an array on an off-chain backend, but there are some things I can't wrap my head around. For example, say I have an array of times in no particular order arr ...
user avatar
0 votes
1 answer
20 views

View contract creation param

I'm trying to find the contract creation param on this one: https://rinkeby.etherscan.io/address/0xdbc4949a84cd92c482af74d8813c13588e466841#code But I couldn't find it on etherscan, where can I find ...
user avatar
  • 169
0 votes
1 answer
24 views

How to implement a custom token in a seperate contract

I am new to programming and attempting to design a very basic DAO which implements a native token for voting (as you'll see it is unfinished). Help would be greatly appreciated. I am currently running ...
user avatar
0 votes
0 answers
17 views

Execution reverted while trying to read a variable

I'm playing Ethernaut Level3, the full contract is here: https://ethernaut.openzeppelin.com/level/0x4dF32584890A0026e56f7535d0f2C6486753624f In truffle I first created a simplified contract: // SPDX-...
user avatar
  • 169
0 votes
0 answers
18 views

How to copy contract from mainnet to local node without source code?

I'm deploying contract A locally. I got contract A source code from polygonscan. Contract A has the library IterableMapping as a dependency, and that library doesn't have its source code verified, so ...
user avatar
  • 103
0 votes
2 answers
40 views

Solidity Returning Array of Struct Error

I want to return an array of structs because i want to output all my data. //SPDX-License-Identifier:MIT pragma solidity ^0.8.0; contract MyContract { mapping(uint256 => People) dataList; ...
user avatar
0 votes
2 answers
25 views

How to write a getter function for an array of structs? "storage ref[] storage ref is not implicitly convertible to expected type uint256[]"

I'm developing an app that allows user to make bets against each other. In order to get some useful web-UI info, i need to write a getter function for an array of structs. Simplified version of my ...
user avatar
0 votes
2 answers
43 views

Implement splitting payment in ERC-20 token

I am new to this topic. I'm trying to implement a method to split the payment inside the token contract itself. I know that there is a separate contract for payment splitting, but I want to try to ...
user avatar
1 vote
2 answers
25 views

Why do smart contracts have to be deterministic?

I was wondering why smart contracts have to be deterministic. As I understand it, to deploy a smart contract you just send it as the payload of a transaction without specifying a recipient. It's then ...
user avatar
  • 27
0 votes
1 answer
41 views

In Brownie, Do you need always need .address to use a contract as an contract address variable

new to Brownie as I have been using mostly tutorials. I am trying to use a contract address as a variable to deploy another one, and want to know does adding the ".address" e.g : ContractXY....
user avatar
  • 1
0 votes
1 answer
29 views

Different between send() and sendTransaction()

I'm wondering the difference between send() and sendTransaction() in web3. Take the following test code as example: Contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract ...
user avatar
  • 169

1
2 3 4 5
89