Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [solidity]

Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

0
votes
1answer
3 views

Calling an address array in web3 returns an error that the method needs arguments

I'm declaring a public address array in my contract, but when I call it, I get an error saying it's expecting an argument. Can someone shine a light on what is happening here? Contract.sol uint ...
0
votes
0answers
5 views

TypeError: Member “equal” not found or not visible after argument-dependent lookup in type(library Assert)

Truffle v5.0.8 (core: 5.0.8) Solidity v0.5.0 (solc-js) Node v10.13.0 Web3.js v1.0.0-beta.37 Assert.equal worked in Truffle 4.x. pragma solidity >=0.4.21 <0.6.0; import "truffle/Assert.sol"; ...
1
vote
0answers
9 views

Adding additional info for initial state of Drizzle

How do I add extra content to the initial state of drizzle? I want to keep some local information that is not dependant on the blockchain. Should I keep a seperate redux store for that or is there a ...
0
votes
0answers
16 views

How should I pass a nested struct as a function argument in Remix IDE?

Example contract: pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; contract someContract { struct structOne { uint a; } struct structTwo { uint b; ...
0
votes
0answers
10 views

Smart contract migration through Proxy delegate pattern in solidity 0.5

I am trying to do smart contract migration in solidity 0.5 using the proxy delegate pattern. When I write the integration test in javascript how should i make a delegate call using the proxy contract ...
0
votes
1answer
13 views

How to get parameters of an object from array using loop

I am using a loop to retrieve an object from array. Then get its details and compare it with other string. But it gives error Type bytes32 is not implicitly convertible to expected type struct ...
0
votes
1answer
17 views

Delay a transaction

Is it possible to delay a transaction in one contract? let's say Alice wants to send a product to Bob and Bob has to transfer, for example, 2 Ethers to Alice for buying that product. How can I do ...
3
votes
1answer
23 views

Embedding ETH Wallet Address into Webpage

Hey is there a quick way to embed an Ethereum wallet address and a button into my existing website so as to allow people to send in their ETH donations to me? Or do I need to go through the whole npm ...
1
vote
1answer
14 views

Encoded input params

I created a simple test contract with a single method: pragma solidity ^0.4.24; contract SimpleTest { function testFunc(string name, bool isFirst) public { //do stuff } } I'm ...
1
vote
1answer
15 views

Create Contract Solidity 0.5

My code works with compiler 0.4.25 but not with the latest version. I want to keep track of every "Contract 2" that "Contract 1" create. Contract 1 uint public countContract; address[] public ...
0
votes
0answers
19 views

address.replace is not a function

I'm not really sure why this web3 method is being called in my code and why it's not a function apparently. Can anyone help me understand what the issue is here? Unhandled Rejection (TypeError): ...
0
votes
0answers
7 views

Getting value for Event watch in solidity and react

I'm trying to listen for an event in my smart contract when I call another function. Smart contract event event documentAdded( uint id ); Smart contract method function sendDocument( ...
0
votes
0answers
24 views

How dapp owners pay for their clients transcaction fees in the Ethereum Blockchain?

I am currently dealing with a problem in Ethereum Blockchain. I wrote a smart contract in Solidity Language, about a site that someone can make his Registration and after the transaction is completed ...
0
votes
1answer
19 views

Solidity modifiers in library?

Isn't it possible to define modifiers in libraries? I'm really asking myself why, because thats some functionality you would need over and over again. If I would like to hypothetically implement some ...
0
votes
1answer
20 views

Cannot read property 'sendEth' of undefined, 'sendEth' is function in smart contract

Hi I'm trying to interact with an Ethereum smart contract but it is always showing "TypeError : Cannot read property 'sendEth' of undefined" where 'sendEth' is a function in my smart contract Here is ...
0
votes
1answer
12 views

Creating a new contract specifying a sender and value with factory pattern

I am using a factory pattern to deploy its children contracts here. The child contract has a constructor as followed: constructor ( string memory _potName, uint _duration, uint ...
0
votes
0answers
16 views

How to flush token to another contract from token holder's token balance from ERC-20 contract?

I have to implement the following scenario: - One ERC-20 token contract. - Another contract which will flush tokens of ERC-20 tokens. - Add these tokens to one, defined Admin address. Note: All ...
0
votes
1answer
21 views

How to test kill function including selfdestruct()?

there. I'm coding kill function below: function kill() public onlyOwner returns (bool) { selfdestruct(msg.sender); return true; } and my unit test code: function testOwnerCanKillContract()...
1
vote
2answers
24 views

On-chain settlement based on off-chain activity

I'm build a DApp where the end-user should be able to attach a proof (could be information, data, attachment, whatever). Now, if the DApp accepts this proof as being legit off-chain, then I want the ...
1
vote
0answers
7 views

What happens when some files use the ABIEncoderV2 and some don't

The version 2 of the ABIEncoder used by solidity can be enabled with: pragma experimental ABIEncoderV2; What happens if I compile with truffe a project that has some files with that pragma and some ...
0
votes
1answer
20 views

How to integrate Drizzle with react

I have currently set up a truffle project with react, redux and react-router. I just finished writing my first implementation of the smart contract, and now want redux to connect with the smart ...
0
votes
0answers
15 views

From Truffle Ganache and localhost to Web Server

i created a contract that run easy on my localhost with npm run dev after truffle migrate --reset and i can use my GUI on localhost:3000. Now i tried to deploy it on infura Ropsten using my Metamask ...
0
votes
0answers
17 views

Purchase of ICO token in Fiat currency/ Bitcoin [on hold]

I want to launch my ICO, where you can buy tokens with fiat currency, ethereum and bitcoins. Suggest any help, How I can integrate it within a minimal time? Any Free API's Are available for the same?
0
votes
0answers
16 views

Deployment of smart contract

How to deploy a smart contract on my own blokchain network? I have created using python and running on postman client server interface. I have already tested on ganache , solidity IDE and ethfiddle.
0
votes
1answer
25 views

Is it possible to access the mapping of a deleted struct

I understand that when you use the delete() function on a struct it will delete all its data excluding its structs, as delete cannot recurse through these. Does this mean we can still access these ...
0
votes
1answer
18 views

How to return values from dynamic array push function?

How to fetch value from dynamic array push function? Below is the code of pushing function, but how will I fetching that array values? contract PushStruct { struct MyStruct { uint field1; ...
2
votes
1answer
22 views

What is the non-transactional behavior of the EVM?

This question is about Solidity code that reads the state of a deployed contract on a Geth node using web3.js. When I call claimsProcessed() with a different account than admin, I expected it to throw ...
1
vote
1answer
24 views

Can I avoid manually changing code from solidity 0.4.17 to 0.5?

I'm totally newbie in blockchain programming and I have a situation: I have to continue the project written on truffle framework with solidity version 0.4.17, the problem is that I couldn't manage to ...
1
vote
1answer
14 views

onERC721Recieved implementation

As per the ERC721 requirements, I have to implement onERC721Recieved. This is how I did it: function onERC721Received( address _operator, address _from, uint256 _tokenId, ...
0
votes
1answer
32 views

is there any way to save data from sensor on smart contract automatically?

I want to take the temperature value from one sensor on save it on the contract of manually , i tried to use node-red , or raspberry pi but i didn't get a good result. the second question is it ...
4
votes
1answer
20 views

Is pre 0.5.0 keccak256(a,b) equivalent to post 0.5.0 keccak256(abi.encodePacked(a,b))?

In pre 0.5.0 Solidity if you wanted to hash a some set of data you would do keccak(a, b, c). Post 0.5.0 keccak only takes 1 arg and it is suggested to use keccak(abi.encodePacked(a,b,c)) instead But ...
3
votes
3answers
101 views

ERC721: How to get the owned tokens of an address

There is a balanceOf function, but it only displays one uint (the token identifier) I see most ERC721 tokens doing this so I am confused on how to view all owned tokens.
1
vote
2answers
25 views

Best way to delete element of a dynamic array without knowing the index

I have this mapping mapping(bytes32 => address[]) public authorisation; This maps a hash with a list of authorised users. I have a function to add, and confirm - these work and its not an ...
0
votes
2answers
27 views

How to increment a solidity variable using a function

i want to count every time that i call the function , i tried to increase the number by every time that I called but it doesn't work , it always gives 1 . function getdeployedcontracts () public ...
1
vote
1answer
18 views

In-line assembly error

I am checking if an address is a smart contract. Similarly to many articles and example-codes out there, i do this within my function: uint32 size; assembly{ size := extcodesize(_to) } if(size &...
0
votes
1answer
28 views

Solidity events and its's necessity

I don't understand solidity events at all. For example: https://rinkeby.etherscan.io/address/0xc5a79064168c0aa3706c33d70b94a09103e9656b#events Some events show its names, others show methods without ...
0
votes
0answers
10 views

IPFS dynamic content

Can my users store dynamic content on IPFS and how that will reflect on my dapp, what will happend when everytime user can update the state of the app. How this will reflect it? Imagine something like ...
0
votes
0answers
17 views

Couldn't open browser

preetam@LAPTOP-84LFN4UL:~/kyc-ethereum-dapp$ npm run dev pet-shop@1.0.0 dev /home/preetam/kyc-ethereum-dapp lite-server ** browser-sync config ** { injectChanges: false, files: [ './**/*.{html,...
2
votes
2answers
45 views

Is it possible to implement the essence of smart-contract into another one before deploying the first one?

My question means for example that the primary contract stores names of secondary contracts, for example like this: mapping (address => string) secondaryContractNames; I know we can in the ...
0
votes
1answer
40 views

Multi token transfer issue [on hold]

In exchange contract,With multi token when I call approve function from exchange contract, nor my address and spender get approved. Instead only the exchange address and spender gets approved. Its ...
0
votes
1answer
19 views

How to set up Quorum Blockchain?

I have read a lot about Quorum blockchain. My goal is to run and test it. I have found many articles. Could anyone suggest me good start-up articles for setting-up the Quorum on a number of nodes and ...
0
votes
2answers
18 views

No such file or directory: 'solc': 'solc'

I have been trying to follow the following tutorial [https://github.com/adamyala/Your_First_Decentralized_Application_Python] But the following error occurs: I have followed all the steps in ...
2
votes
1answer
13 views

What is the alternative to using **label** in solidity inline assembly code?

What is the alternative to using label in Solidity inline assembly code? Label is deprecated in new version.
0
votes
0answers
18 views

ERC721, approveForAll-implementation, and others

I am currently implementing ERC721 as the standard for token-exchange in the game I am programming. I am taking inspiration from the CryptoKitties-smart contract. One thing I have realized, is that ...
2
votes
1answer
17 views

Invalid implicit conversion from uint256 to bytes memory requested

I am trying to create a simple random function but it gives me an error. I can't figure out what I do wrong. Solidity 0.5.0; function random() private view returns(uint){ uint source = ...
2
votes
0answers
34 views

Solidity get return variable from a send method in React

I'm trying to call a method that pushes data to my Blockchain and then returns back the ID of the new struct I created. This is how I'm calling the method in my React code: const documentId = await ...
0
votes
0answers
22 views

Solidity and mongodb

Hello I have to create dapp, and more specific I want to create something like store where people can create items and sell them. The problem is I want to keep information about the items offchain (...
1
vote
1answer
23 views

Solidity Vs Vyper

What is the key differences between Solidity and Vyper? In present and future which one can more acceptable for making smart contracts and why?
1
vote
1answer
14 views

Augur, publicBuyCompleteSets reverts

I'm building a contract function that purchases and distributes complete sets of AugurShares for a specific market. (Testing on Rinkeby). Version of Augur-core (node_modules/augur) used: https://...
0
votes
0answers
13 views

Verify transaction was included in certain block within smart contract

Is there a good resource for proving that a particular transaction was included in block x?