Questions tagged [contract-development]

Questions regarding the development of smart contracts

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

Why should I use sstore method in solidity?

assembly What is the difference between using storage and this method? assembly { //allows you to store a value in storage sstore(slot, _admin) }
user avatar
0 votes
0 answers
8 views

setApprovalForAll(..) with OpenSea

I'm still bothering with OpenSea... I'm creating some tokens in OpenSea in Rinkeby, and I'm transferring them via web3 (ethers) through some scripts that I built myself. Question, I have had to ...
user avatar
0 votes
1 answer
9 views

Methods that only return arrays are very common. But, in the 'returns' argument, do I use memory or storage? and why?

// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; contract MyContract{ address[] public myAddresses; function getMyAddresses() public view returns(address[] [[...
user avatar
  • 3
0 votes
1 answer
17 views

How to store a large mapping in a smart contract?

I have a contract that need to access the address of different tokens given their name as a string. I thought about doing the below: contract MyContract{ mapping (string => address) public ...
user avatar
0 votes
0 answers
8 views

How to create a external call instance function to truffle suite

Is there a way to instantiate a function of my contract, not using the truffle console but by creating a js file? if so, how do I do it?
user avatar
  • 1
0 votes
0 answers
9 views

How can I return struct/ structs based on date in timestamp?

I'm trying to make a get function based on date(in timestamp) Do I need another mapping? Take into consideration that it might be more than one registries on the same date. Any help is great. :) ...
user avatar
0 votes
1 answer
19 views

Interacting with one smart contract to another ? , Multiple smart contract interaction ? , One contract calls to another contract ? Solidity

Interacting with one smart contract to another ? , Multiple smart contract interaction ? , One contract calls to another contract ? in Solidity. My questions are: How does a contract with each other ...
user avatar
0 votes
0 answers
14 views

"Error": "Failed to decode output: Error: data out-of-bounds

I've got this strange error in Solidity's Remix: "error": "Failed to decode output: Error: data out-of-bounds (length=36, offset=64, code=BUFFER_OVERRUN, version=abi/5.5.0)" It ...
user avatar
  • 101
0 votes
0 answers
11 views

TypeError: ethers.Contract is not a constructor

I am using ethers.js library. I used the following line to create a contract. I used the same line previously without any issue. contract = new ethers.Contract(address, ERC20_ABI, provider); however,...
user avatar
0 votes
0 answers
6 views

Error when calling factory.methods.getPair with PancakePair (BSC)

After doublechecking all addresses over and over; I'm still running into this error trying to instantiate a contract for CELT_USDT: Error: Returned values aren't valid, did it run Out of Gas? You ...
user avatar
  • 1
0 votes
1 answer
14 views

Multi Contract Interaction / Contract interacting with another contract / Contract using another contract without Inheritance

My question is what are the limitations of one contract using another contract ? When I'm using another contract as shown below, What is the another contract storing ? e.g: If contract B calls ...
user avatar
0 votes
0 answers
2 views

Trouble in testing cryptozombie project

I am following https://cryptozombies.io/ lessons. In testing smart contract on local, I met any problems. On testing contract, I used follow code. const CryptoZombies = artifacts.require("...
user avatar
0 votes
0 answers
29 views

Developing a Staking and Un-staking Smart Contract

I am relatively new to blockchain, and trying to write a staking smart contract, which could stake any ERC20 token and gives APY in the same token with the following requirements: Staking of ERC20 ...
user avatar
0 votes
0 answers
10 views

set address for smart contract to call after launching

Im trying to launch a smart contract that will call on another smart contract, but I need to be able to set the contract address to call on after launch. They actually both need to call on each other, ...
user avatar
0 votes
0 answers
10 views

Is there anything stopping legally designing a project for the sake of "printing high monetary value"?

What's to stop somebody from developing an L2 where one could develop minimum constraints in which they could mint tokens, swap to a dex and then cash out et al. effectively "printing money"?...
user avatar
  • 1
0 votes
1 answer
10 views

How to automate creating multiple bids for an auction smart contract?

I have created a simple auction smart contract in remix and now I have to do some experiments with it. In my model, it is possible to create the requests and then bid those requests with the Bid() ...
user avatar
1 vote
1 answer
25 views

ERC1155 Deficiencies

I'm using a direct implementation of these in a different language and considering the deficiencies of 1155. There is no shortage of articles comparing 721 vs 1155, but all of them go on to say 1155 ...
user avatar
  • 11
0 votes
1 answer
32 views

Generating Randomized Start Index for TokenIds in a NFT Contract

I've recently started exploring and learning Solidity and have been looking at contracts of some of the famous NFT projects. One common pattern that I've found is that most of them set a ...
user avatar
1 vote
2 answers
16 views

How to show my own contract name in Token Tracker field of an ERC1155 Contract?

I am developing an NFT Drop site contract. I want my NFT Contract to be named from ERC1155 to provide a name in the constructor. I have watched and followed many tutorials. They all work the same and ...
user avatar
0 votes
0 answers
8 views

how to index the changes of the eth and tokens in the sender account after a transaction execute

how to index the changes of the eth and tokens in the sender account after a transaction execute?is there a tool to do it?like the etherscan,https://etherscan.io/tx/...
user avatar
0 votes
0 answers
13 views

"await expect" vs. "expect await" in Chai matchers [closed]

What is the correct nesting order of await and expect for Chai matchers? The following does not work: await expect(contract.name()).to.equal("MyToken"); // (1) expect(await contract["...
user avatar
0 votes
1 answer
34 views

Can a smart contract hold/own tokens (USDC)?

I want to write a contract that buys back an ERC20 Token using USDC. (in REMIX IDE) I want to understand what is the best practice for paying out the USDC in return for the ERC20 that was sold to the ...
user avatar
  • 115
1 vote
0 answers
28 views

How does balance of nodes calculated in Ethereum network? [duplicate]

As a beginner of the topic, I am trying to understand the storage concept in Ethereum and smart contracts. Each of the network nodes has a public address called a digital wallet for managing the ...
user avatar
  • 11
0 votes
1 answer
26 views

Encountered an error while attempting to update latest block (error code 1020 on Polygon mainnet)

I'm trying to migrate a smart contract on Polygon (Matic) mainnet through truffle, but I get the following error: node_modules\@trufflesuite\web3-provider-engine\subproviders\rpc.js:57 const ...
user avatar
0 votes
1 answer
24 views

How to deploy Ownable contract with Hardhat and Ethers?

When I deploy an Ownable contract via hardhat (hardhat-deploy in particular) to Optimistic Kovan, it doesn't seem to set the owner correctly, whereas when I deploy the same set of contracts via Remix, ...
user avatar
0 votes
0 answers
12 views

Check Wallet For NFT From Collection Args

I'm trying to implement a whitelist based on NFT ownership from a collection. The whitelist also implements timeout between calls, so the current model is mapping(address=>date) whitelist; where ...
user avatar
  • 11
2 votes
1 answer
35 views

if I add a parameter in a ERC721's mint function, is it still ERC721?

like this, I add a bool value in ERC721's _safeMint and _mint function
user avatar
0 votes
1 answer
31 views

How to mint when using the ERC721A contract (address, tokenid)?

ERC721A's mint function is function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ""); } is it possible to mint with address and tokenId?
user avatar
0 votes
0 answers
19 views

I am not able to execute this function. The code doesn't have errors in itself but execution fails. I want to know what the error is?

This is the function in which I am trying to create an instance of another contract. function createAuction(uint256 _bidIncrement, uint256 _timeInDays) public { uint256 currentBlock = block....
user avatar
0 votes
2 answers
32 views

How a contract burn another contract's NFT?

in the WolfGame V2, their new contract WoolfReborn.sol(https://etherscan.deth.net/address/0x7f36182dee28c45de6072a34d29855bae76dbe2f) can burn NFT from old contract Woolf.sol(https://etherscan.deth....
user avatar
0 votes
1 answer
112 views

Scam code but in smartcontract I dont see scam code

I see have this smartcontract: https://bscscan.com/address/0xee6cacddd3a9370d87db581ee6728226883578e5#code I see a lot of people say this project is a scam, I have tried and can only buy but cannot ...
user avatar
  • 1
0 votes
0 answers
19 views

Stack underflow (0 <=> 2) when creating new smart contract

I'm developing a contract and a Web 3.0 using Hardhat, Ethers.js, Node.js and Web3.0 (Metamask) to do ETH smart contracts and transactions and I'm getting a rare error when trying to execute the ...
user avatar
  • 1
0 votes
1 answer
22 views

Creating an efficient development enviroment + workflow for dApp development

What I want to do is create an efficient workflow for rapidly developing, and testing dapps on different chains LOCALLY. I thought about using Remix IDE, with testing environments for each respective ...
user avatar
0 votes
1 answer
15 views

why a contract alway is itself interface? like(contract Wolf is IWolf; contract Lostpoets is ILostpoets )

I can understand the reason of why there is a IERC721, because it's standard. BUT I can not understand why lots of project's contract is itself's interface, like contract Woolf is IWoolf {} contract ...
user avatar
0 votes
1 answer
19 views

invalid opcode: opcode 0x4b not defined when sending a new contract

I'm trying to create a new transaction and deploy it to the blockchain, but I'm obtaining this warning when I go to inspect the transaction result on etherscan: Warning! Error encountered during ...
user avatar
  • 1
0 votes
0 answers
85 views

HardHat does not build artifacts when i compile the contract

I compile the contract but the json file and the debug file does not appear in the artifacts.i get this from the compiler: "Compiled 1 Solidity file successfully", i have the default hardhat ...
user avatar
0 votes
1 answer
48 views

In Solidity, when invoking an external contract, how do you override its library functions using a separately deployed contract?

I am trying to understand how an exploit occurred on the Ethereum network as per PeckShield's Tweet. According to the exploit transaction logs, contract code at ...
user avatar
1 vote
0 answers
31 views

hardhat verify contract faild! Help!

I use command npx hardhat verify, and the log is: Nothing to compile No need to generate any newer typings. Successfully submitted source code for contract contracts/ygu/yguToken.sol:YGUToken at ...
user avatar
  • 11
0 votes
1 answer
23 views

Withdraw amount from Deployed Contract

Normally we use owner-only restrictions for the withdrawal functions but still, I'm curious why it didn't work. I created a sender and receiver contract. After deploying the contract I kept some ...
user avatar
  • 3
0 votes
1 answer
13 views

Reading Contract Events

i have an promlem readen a Hash from ethereum logs. When a user Mints a token, i fire a mint event: event Mint(address indexed _to, string indexed _hash, uint256 _tokenId); Example for _hash = ...
user avatar
0 votes
1 answer
16 views

How can I add ether ether to my balance and return ether from it later?

I am learning to create smart contracts, but I have encountered such a problem, I am trying to add ether to the balance of the smart contract but it does not work for some reason and the balance is ...
user avatar
0 votes
1 answer
27 views

Block and Contract difference?

I was looking to see the code of the blocks added to the blockchain at Etherscan to determine wether the code is public. But given from the block information I see no way doing that. I have read in ...
user avatar
  • 105
0 votes
0 answers
24 views

Uniswap V3 Oracle library: consult always crashes. Trying to get reliable oracle of Ethereum price in USDC

import "https://raw.githubusercontent.com/Uniswap/v3-periphery/main/contracts/libraries/OracleLibrary.sol"; function poolAddress() public view returns (address) { return ...
user avatar
0 votes
1 answer
14 views

broken for loop

can someone let me know what i got wrong in this for loop, if you need the full code let me know. function calculateSplitPercent() public { for(uint256 i = 0; i >= uniqueIdCounter; i++) { ...
user avatar
0 votes
1 answer
29 views

Can someone please tell me what i have wrong here

function calculateSplitPercent() public { for(uint256 i = 0; i >= uniqueIdCounter; i++) { uint256 spliPercent = balanceOf[uniqueIdToAddress[i]].div(totalFunded).mul(100); ...
user avatar
0 votes
0 answers
9 views

can someone skip threw my contract and let me know if i have any faults

i would appreciate any feedback, i will be adding reentrancy guard aswell but if there is any obvious improvements please let me know. This is still a work in progress ! // SPDX-License-Identifier: ...
user avatar
0 votes
1 answer
25 views

Is it possible to get consumed and remained gas from within a smart contract?

How can I get consumed gas as well as remained gas (which is sent with tx by the caller) from within a smart contract in solidity?
user avatar
0 votes
1 answer
28 views

Who pays funds for Marketing, Giveaways for Decentralized Company like Binance?

I wonder who gives funds for Marketing, Community Giveaways, etc in a decentralized companies like Binance. For Example, right now "Press a Button, Win a Bitcoin!" Event is going and the ...
user avatar
0 votes
1 answer
12 views

Solidity: How can I access a variable dynamically by name?

Is there a way to access variables in solidity using another variable? Something like this: contract Test { uint age; string varAge = "age"; function setAge() public { //...
user avatar
0 votes
2 answers
31 views

Deleting values from a struct

how do i go about removing values from inside a struct and or a mapping. For example iam creating a smart contract that acts kind of like a vault, iam not yet finished but i have a create an account ...
user avatar

1
2 3 4 5
87