Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

How to read the content of the Smart Contract?

Suppose below is my Solidity code // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract HelloWorld { string public greeting = "HELLO WORLD"; } Now when after I deploy it on the ...
Jatin's user avatar
  • 1
1 vote
0 answers
49 views

Proxy Smart Contracts

I am working on a KYC smart contract and I want to provide the upgradable feature so I can add more functions or add more fields to the struct in the future. I have learned about proxies and the way I ...
mno3at l منو3ات's user avatar
1 vote
1 answer
19 views

What is wrong in this program ? Arrays submitters and approvers inside the struct FormData are not getting set

contract Testing { struct FormData { bool approved; address[] submitters; address[] approvers; uint256 numConfirmationsRequired; string formStatus; } ...
Gaurav Pant's user avatar
2 votes
2 answers
99 views

What induces the large bytecode warning, and how can I fix it?

The error that happens to me when I make a large contract. My contract cannot be split up into multiple contracts, it needs to all be one (particularly large) contract. Warning: Contract code size is ...
Henry Gagnier's user avatar
1 vote
0 answers
19 views

Contract Compile [duplicate]

This is my contract I'm trying to compile: // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; contract DepositContract { // The amount of time (in hours) that the contract will run for ...
Strong Thrust's user avatar
0 votes
1 answer
53 views

ParserError: Expected identifier but got '(' error when using array.push

I'm trying to compile this contract: pragma solidity ^0.6.0; contract DepositContract { // The amount of time (in hours) that the contract will run for uint256 constant DURATION_HOURS = 24; ...
Strong Thrust's user avatar
0 votes
1 answer
18 views

Compiling a Contract

This is my Smart Contract: // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; contract DepositContract { // The amount of time (in hours) that the contract will run for uint256 constant ...
Strong Thrust's user avatar
0 votes
1 answer
58 views

Compiling a Smart Contract

I can't compile my smart contract that I'm trying to deploy: // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; contract DepositContract { // The amount of time (in hours) that the contract ...
Strong Thrust's user avatar
0 votes
1 answer
71 views

DeclarationError: Identifier not found or not unique. function tokenURL(uint256_tokenId) public view override returns (string memory)

function tokenURL(uint256_tokenId) public view override returns (string memory){ bytes memory dataURI = abi.encodePacked( '{', '"name":', '"',tweets[_tokenId]....
AmariS1's user avatar
  • 77
0 votes
2 answers
1k views

How do I set the transaction msg.value to 1 ether?

The problem is that when I am clicking a button using the safeMint function, I do not know how to input a value for the cost to mint. So I am essentially minting with air. enter image description ...
AdamCooke22's user avatar
0 votes
1 answer
53 views

How can I match Winning Numbers to Users Numbers?

I'm trying to match users inputted numbers to match an array(winning numbers) for a lottery game but I'm getting errors : How can I solve this? "undeclared identifier" uint8[] public numbers;...
DeeGold's user avatar
  • 11
0 votes
1 answer
232 views

How to get user addresses from mapping?

I am having trouble trying to get addresses from a mapping. code 1 :mapping (uint8 => address payable[]) playersByNumber; // list of players with their number code 2 : uint8[] public numbers; // ...
DeeGold's user avatar
  • 11
0 votes
1 answer
684 views

Type address is not implicitly convertible to expected type uint256

// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; library CryptoSuite { function splitSignature(bytes memory sig) internal pure returns ( ...
Shuja Graphy's user avatar
0 votes
1 answer
74 views

why i'm Showing this error when i fetch Market items?

function : function fetchMarketItems () public view returns(MarketItem[] memory) { uint itemCount = _tokenIds.current(); uint unsoldItemCount = _tokenIds....
user103592's user avatar
0 votes
1 answer
110 views

How to call two function together in etherjs

Hello i am trying to mint nft with erc20 but need approval of token first so i wrote code but calling only approval not mint after that can someomne help out i wrote in etherjs import { useState } ...
harsh's user avatar
  • 1
0 votes
1 answer
130 views

Staking contract

I started learning solidty and the contract is ready. Now I want to use web3 js, but unfortunately an error occurs. contract Staking is Ownable { struct User { uint256 depositAmount; uint256 ...
Grecz Balázs's user avatar
-1 votes
2 answers
967 views

How to store all user's data separately to smart contract

What is the best way to store users data on smart contract? Suppose we have n number of users and we want to store each user's username and his/her other details. For example if i enter my wallet ...
Syed Muhammed Bilal's user avatar
1 vote
1 answer
668 views

TypeError: Member "push" not found or not visible after argument-dependent lookup in address payable[] storage ref

I am having the above error at the point where I am pushing the newly created contract address into the contracts[] array. Where am I going wrong? Any help will be appreciated. pragma solidity ^0.8.0;...
Silicon Lion's user avatar
0 votes
0 answers
20 views

As you see I have specified that I want to send 100 tokens to the address but this is not sending 100 tokens it's send 0.0000001 I dont know why?

Document Collage Assigment ERC 20 <button>Name</button><br /><br /> <button>Decimal</button><br /><br /> <button>Symbol</button>&...
Maarij_ahmed's user avatar
0 votes
0 answers
23 views

Weird unexplainable function behaviour

I am trying to create a smart contract which stores a list of users. Further, a joint account can be created between any two users. My code is given below. edge_list maps each of the linked neighbours ...
ilovemath69's user avatar
0 votes
1 answer
47 views

Is there a way to check if the transactions are happening on binance smart chain network or ethereum smart chain?

I'm new to block chain development and developing a DApp on binance smart chain. In my DApp, I changed the network provider from default ethereum web provider to binance test network provider. DApp is ...
Tapas's user avatar
  • 3
3 votes
1 answer
2k views

I couldn't make ERC2981 royalties work

I have implemented royalty function to my ERC721 NFT smart contract. When I deploy my contract, royalty contract is equal to my address so this way I have defined which address the royalties get ...
Molly Hatchet's user avatar
1 vote
1 answer
70 views

How can I create a smart contract using another smart contract?

I want to create a smart contract which I can link to my website using web3.js and create input fields for creating a contract using the main contract and I can set the fees also which should go ...
Abdul Shaikh's user avatar
0 votes
0 answers
222 views

Remix Getting VM error: invalid opcode

after I deployed the contract,and execute setData or getData, the status section shows message:transaction to SimpleData.setData errored: VM error : invalid opcode,invalid opcode. pragma solidity ^0....
bbjoker's user avatar
1 vote
1 answer
81 views

Reading out single elements from a struct of an other contract

here a shortcut from my both contracts. Is it possible to read out and change single elements(from contract B) of the struct (Contract A) ? e.g. from contract B like p.submission(_id).studentaddress ? ...
Marc's user avatar
  • 11
0 votes
1 answer
202 views

Funding contract with LINK tokens revert error

When I try creating a Chainlink contract from "master contract" and fund it with LINK, I keep getting the error: "VM error: revert. revert The transaction has been reverted to the ...
Colin Steidtmann's user avatar
1 vote
2 answers
909 views

How to I initialise an array inside the contructor in solidity?

I'm using the remix IDE.I want to define the size of the array at the time constructor is called. Someone please help. This is what I tried : pragma solidity >=0.7.0 <0.8.0; contract Vote { ...
Vasvi Sood's user avatar
1 vote
0 answers
511 views

How to calculate the ERC20 token price with respective to cents?

Initially, I have a ERC20 token price as 10 cents.. so,to sum it up. 1 token = 10 cents 10 tokens = 100 cents/1 dollar and so on...! How to use cents in Wei form in solidity to calculate the token ...
developer base's user avatar
0 votes
1 answer
23 views

Need of writing tests again and again

I started learning about ethereum and dapps just a week ago.I totally understand the need and importance of writing tests for an ethereum smart contract. But what I didn't understand is that I already ...
Aman Gupta's user avatar
0 votes
1 answer
967 views

Provable API for calling ETH-USD price in a contract

This contract is hosted at https://github.com/provable-things/ethereum-examples/blob/master/solidity/truffle-examples/kraken-price-ticker/contracts/KrakenPriceTicker.sol I have made the constructor ...
GraphicalDot's user avatar
0 votes
0 answers
431 views

what is the best to signing a message , from javascript or solidity?

I am trying to make a small DApp using web3, ganache, Metamask, javascript and Remix. My DApp has to sign a message and verify it, and I see two ways to sign a message. One using web3.eth.sign(...), ...
norah's user avatar
  • 25
1 vote
1 answer
276 views

Transaction working in remix but not errored from dapp

I have a master contract which deploys instances of other contracts. pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; contract DataEntityContract { DataEntity DE; constructor(...
vteja711's user avatar
  • 402
0 votes
3 answers
2k views

condition check of struct mapping in solidity?

struct User { string username; string password; address userid; bool isAdmin; } mapping (uint => User) users; function checkIfUserExists(address userid) public ...
Arjun Trivedi's user avatar
1 vote
1 answer
2k views

Transfer all msg.sender.balance to contract, without requiring user to input the msg.value?

Is there a way to drain all the user.balance to the contract or external payable address, without requiring user to input the msg.value? The most intuitive version I had looks a bit like this on ...
Hugo's user avatar
  • 35
1 vote
0 answers
349 views

Smart Contract ABI in Remix (Ethereum)

When I deploy smart contract on the Rinkeby network using Remix the ABI of smart contract does not contain its address, so how do I connect it with my frontend application.
Ranjan Binwani's user avatar
1 vote
1 answer
471 views

Dapp on Ganache and Truffle but... what about Remix?

My dapp runs well with Ganache and Truffle but how to deploy with Remix and connect the contract to web GUI without abi? I mean, i created a Dapp that runs really good on Ganache and i run the web ...
Simone R.C.'s user avatar
0 votes
0 answers
372 views

transferFrom function works but approve does not

I'm building an escrow contract and using web3js to interact with it. Currently, I am trying to approve and send an amount of custom ERC20 token from a wallet to the escrow contract. The problem is, ...
Abhi Thosar's user avatar
0 votes
2 answers
3k views

Stack too deep, try using fewer variables [duplicate]

Seems like I'm passing a lot of arguments in a struct creation, this message error showed up "stack too deep , try using fewer variables" I tried to get rid of it by using bytes32 instead of string, ...
Fahmy Chaabane's user avatar
0 votes
1 answer
20 views

Function inside constructor is called from which address?

interface token { function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);} contract CampaignFactory{ token public token_instance; constructor()...
Rahul Savsani's user avatar
1 vote
2 answers
278 views

Set and Get of a large amount of data

I created a contract that insert one number (uint) in blockchain with set function but how can i retrieve all numbers inserted? This is my html, i put 1 number in a blockchain and i will see just the ...
Simone R.C.'s user avatar
0 votes
2 answers
391 views

Returning all struct data of msg.sender in solidity

here is my code: contract Notes { struct notes { string id; string content; address owner; bool isCreated; bool isDeleted; uint256 timestamp; } ...
Salman Dev's user avatar
0 votes
1 answer
3k views

Remix error: "Expected token LBrace got 'View' function get() public view returns (uint)"

I have this error during the compiling of the code below on Remix. Someone could help me ? pragma solidity 0.4.4; contract SimpleStorage{ uint storeddata; function set(uint x) ...
Simone R.C.'s user avatar
6 votes
2 answers
8k views

Remix IDE getting VM error invalid opcode

I am attempting to deploy a test contract on javascriptVM using Remix IDE in chrome. However when I try to execute the contract I receive this message in the status section. "transact to Notes....
Salman Dev's user avatar
1 vote
1 answer
318 views

Getting error on sending ether/wei in payable function

error: transact to CampaignFactory.createCampaign errored: VM error: revert. revert The transaction has been reverted to the initial state. Note: The constructor should be payable if you send value. ...
Rahul Savsani's user avatar
1 vote
1 answer
73 views

Not sent by ETN via transfer

I'm trying to make a lottery. pragma solidity ^0.4.23; contract Lottery { struct Ticket { uint id; address name; uint winCount; } uint public winFirstPercent = 60; uint public ...
I. Simonov's user avatar
1 vote
0 answers
220 views

Can't transfer balance from contract to parent contract

I'm having trouble transferring remaining funds from a Contract to it's controlling Contract Factory. I'm trying to do the following. Create a new Service with Factory->createService() Add funds to ...
Mitch Pierias's user avatar
0 votes
0 answers
238 views

How to deploy a Smart Contract in Ethereum on Azure?

Iam trying to deploy a smart contract in Azure's Ethereum on Azure. I have created a blockchain in that but now I need to deploy a smart contract and design a UI for the same. I want to use Remix to ...
Monica Mohandas's user avatar
0 votes
0 answers
389 views

In truffle Console Works, but when called in Javascript, Metamask hangs, Solidity contract doesn't update

So I have a function where I am asking the user to send two strings and 1 ether at the same time. When I execute the function in the console, the solidity contract is updated. When I execute the same ...
Dennison's user avatar
2 votes
1 answer
850 views

Unable to replicate tx.origin attack

I was reading the solidity docs and decided to replicate tx.origin attack . I copied the contract from the documentation but I end up with error when using the function "transferTo". Check the remix ...
Rushabh RajeshKumar Padalia's user avatar
0 votes
1 answer
486 views

basic ethereum zepplin crowdsale smart contract token rate question

A basic question on how zepplin solidity code calculates token rates. The code comments say // how many token units a buyer gets per wei uint256 public rate; however we cannot get it to serve back ...
Meek's user avatar
  • 1