Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [solidity]

Solidity is a high-level language whose syntax is similar to that of JavaScript and it is designed to compile to code for the Ethereum Virtual Machine. A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the ...

3
votes
2answers
39 views

How to modelize smart contracts in UML?

I am looking for a way to modelize ethereum smart contracts interaction using a modeling language like UML. I have the following serivce Contract: contract ServiceContract { constructor (...
2
votes
0answers
17 views

Solidity Assembly. Read struct from storage & delegatecall

I'm using a low level delegatecall to forward my calls to a library but I'm not familiar enough with inline assemblyl to make it work. contract BountyProxy { using BountyLibrary for BountyLibrary....
0
votes
1answer
11 views

Even-though i don't have constructor in my code i am getting error the constructor should be payable if you send value

This is my code in Solidity pragma solidity ^0.4.17; contract WithdrawalContract { mapping(address => uint) buyers; function buy()public payable { require(msg.value > 0); ...
0
votes
0answers
20 views

solidity value not set

I have the following code to create a contract. I am using solidity 0.4.24. The type of minPrice is string and it's 0.001 from the input. For some reason, I am getting the value of 0 on the ...
0
votes
1answer
10 views

SOLIDITY CODING — _totalSupply 0

enter image description here Add 4 lines of code ALL of it are success! But check wallet.ethereum.org can't find LC TOKEN and also ropsten.etherscan does not appear to be a valid Token Contract ...
-1
votes
0answers
12 views

Solidity, What is mean address call gas values ()

I'm analyzing some solidity code. It's translate from byte code. memory[temp16 + ~0x1f:temp16 + ~0x1f + 0x20] = address(var5).call.gas(msg.gas).value(0x00) (memory[temp16:temp16 + ...
0
votes
1answer
15 views

Deploy solidity issue on Remix ide

i get trouble on Remix IDE try to deploy but no deploy button due to no contract can be select is first issues; second METAMASK no fake ether for making transaction need how to get some fake ether for ...
0
votes
1answer
22 views

Language used to built smart contracts in hyperledger composer

As Solidity is used to create Smart Contracts in Ethereum, Which language is used to create a smart contract in Hyperledger Composer?
0
votes
0answers
16 views

Web3 Not Wiring Up

I made a new project with truffle unbox react and assuming I deployed the dapp directly to Rinkeby with Infura I'm having a problem interacting with web3 in my app.js I have a web3 file in my src ...
0
votes
1answer
24 views

Inhertiance in Solidity and Cryptozombies: How can I deploy a full OOP tree?

I'm working my way through the cryptozombies tutorial and ran into a conceptual snag. It seems that the "ZombieFactory" contract is meant to be a singleton contract that contains the global state for ...
1
vote
1answer
26 views

How to implement self destruct pattern in Solidity?

Hi I am working on the auction app in block chain using solidity as smart contract in Ethereum. The requirements are The DAPP will ask for the auction in the public domain like for example selling an ...
-2
votes
1answer
22 views

Ethereum - When we use the smart contract

We have to develop a blockchain application in the medical domain.so as a beginner, I have some questions. When we use the smart contracts? How to store the patient details(whether complete text or ...
8
votes
1answer
104 views

Data on Private Ethereum blockchain lost/disappears after couple of days

I am deploying a private ethereum blockchain (geth) on a virtual machine on Azure. Upon deploying my Solidity contracts on the blockchain and launching my NodeJS application to it, I am able to add ...
0
votes
0answers
17 views

ERC20 token, function “balanceOf(address _owner)” returns 0

Aloha everyone :) I have problem - function included in ERC20TokenInterface called "functionOf(address _owner)" return 0 when called from web3 ( version will be provided below ) package.json { "...
0
votes
0answers
17 views

ParsedContract.sol:87:3: ParserError: Expected primary expression. event LogNewShop(address shop);

I get this error : ParsedContract.sol:87:3: ParserError: Expected primary expression. event LogNewShop(address shop); for this : event LogNewShop(address shop); function addShop(address _newShop,...
0
votes
1answer
12 views

assembly logical shift left solidity don't work

function shift(int val) returns(int) { int res; assembly { let m := mload(0x40) mstore(m, shl(2, val)) mstore(0x40, add(m, 0x20)) res := mload(m) } ...
-1
votes
1answer
30 views

browser/ballot.sol:102:18: ParserError: Expected '{' but got identifier contract token is ERC20Interface, Owned, SafeMath { ^----^

I get an error msg when trying to compile ParserError: Expected '{' but got identifier contract token is ERC20Interface, Owned, SafeMath { ^----^ on line 102 in the code pragma ...
0
votes
1answer
28 views

Smart Contract with Abstract Methods

I have a problem where I'm trying to implement a smart contract with 'future maintainability' software design in mind. Suppose there is a contract which represents a person personal.sol We have ...
1
vote
0answers
21 views

ganache-cli dependencies not found

I am trying to use ganache and web3.js inside a Next.js application. I run an instance of the ganache-cli in my terminal and then create an instance of web3.js using ganache as a provider with the ...
0
votes
1answer
12 views

Invalid number of arguments to Solidity function error when calling mapping getter

Having a mapping such as: mapping(address => uint[]) public myMapping creates automatically a getter. However when I call that getter like this: myMapping(anAddress) I get the following error: ...
1
vote
3answers
37 views

Can third party send an ERC20 token transaction to ethereum blockchain?

I want to create a smart contract which people can transfer tokens without ether in their wallet. Suppose A want to transfer ERC20 tokens to B, but he does not have ether in his wallet. Does third ...
1
vote
2answers
36 views

Storing data into the blockchain

Writing a DApp where it stores data into a "blockchain". I'm trying to write this in solidity but i don't understand how to store it into a "blockchain". Am i able to do it like this? Would it be safe ...
1
vote
1answer
21 views

TypeError: No matching declaration found after variable lookup balanceOf[msg.sender] = totalSupply_

So I am using a combination of Openzepplin solidity contracts to create a burnable token with a supply cap of 3million. I keep getting the above error on the last contract and I have no idea why. I ...
2
votes
1answer
38 views

Ethereum : How to auto-split an ETH transaction into 2 other transactions

Let's say I have a shared wallet where ethers are collected for me and my brother. We share 50% each other of this wallet. if one ETH transaction comes to this wallet, is there an automated way to ...
3
votes
1answer
52 views

Solidity error: Expected identifier, got 'LParen'

I'm getting the error: Expected identifier, got 'LParen' Problem is, this code is from the Solidity docs! I have tried many thing for this error but to no avail. The link where I got the code is: ...
1
vote
1answer
29 views

Can ethereum contract owner pay the gas of a transaction?

Is it possible that the contract owner will pay the gas fees of every token transaction is being made in an ERC20 token contract? I've searched for a solution online and couldn't find anything.
0
votes
1answer
18 views

Solidity function overloading behavior

My contract like this, the question is why foo(uint256 n) not working(no value return). If the contract just hava foo(uint256 n), it works. contract OverloadContract { // working function foo(uint256 ...
1
vote
2answers
53 views

Is it possible to get the return value of an external function that gets data from another contracts external function?

Note: This is ONLY an issue when calling external-view functions from web3js, as it doesn't create a transaction I've got 2 contracts, A and B (one is a storage contract, and the other is more of a ...
2
votes
1answer
64 views

Best Way To Delay Users In Javascript

I'm creating an app where users submit a request via a button, and then the app requires (for security reasons) that they not be able to return to that page for a fairly short while (say, ten to ...
0
votes
2answers
46 views

Encountered two children with the same key in React

I'm currently trying to learn how to create a webapp to interact with an Ethereum contract I wrote. Therefore I have chosen to learn how use React and Semantic-UI. The page I am working on is not ...
-1
votes
0answers
14 views

Making a wallet with smart contract

Making a wallet with smart contract on solidity. Have some ideas im wondering whether i can do or not. The crowdfunding website i'm creating uses multiple cryptocurrency to buy points and the points ...
1
vote
1answer
30 views

Msg.sender does not work inside a “view” function, why? Is there a workaround?

I want to create a viewable function (needs to return a string to the user) that searches a mapping for msg.sender and if the senders value is x, I want the contract to proceed accordingly. It all ...
-1
votes
0answers
14 views

error with 'npm install remix-ied -g' on win7 or centos

When I deploy contract on the online remix, it shows the above error message and a red prompt. However, the miner block log describes the contract has been deployed successfully. Why there is still ...
0
votes
0answers
12 views

red × when deploy the contract on the online remix

As the above log , it prompts the contract was deployed successfully ,but why is there still the red ×? http://remix.ethereum.org/#optimize=true&version=soljson-v0.4.24+commit.e67f0147.js
2
votes
1answer
497 views

How to get public key with web3 library ethereum

How to get public key with web3 library when you are already unlocked.
0
votes
1answer
31 views

Create a new fixed size array in solidity

What is the difference between the below two array? without new keyword: bool[3] fixedArray; with new keyword: bool[] fixedArray2 = new bool[](3);
0
votes
0answers
69 views

Solidity Web3 Transaction Receipt returns null

Really struggling to fix this error. Constantly returns alert("receipt status fail"), and I can't fix it. Any ideas? The receipt returned in null. I'm trying to verify the transaction and then use ...
1
vote
0answers
29 views

error in calling 'npm install remix-ide -g' on win7 or centos

There are the logs as the below when I call the commad 'npm install remix-ide -g' >gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] make: 进入目录“/home/ethereum/ethereum/remix-ide/...
0
votes
1answer
27 views

Create Smart Contract and use ABI functions

For a recent test it's been requested me to generate a Smart Contract with Ethernum and use some functions provided through ABI json to extract some info. I'm using https://ropsten.etherscan.io as ...
0
votes
1answer
35 views

waitOnReceipt function doesn't work in solidity, running on SuperBlocks

Running on https://studio.superblocks.com/ trying to make a a fun game in Solidity. the problem happens when I call waitfor receipt inside the "addKity" function. Any ideas why? I suspect it could be ...
1
vote
1answer
14 views

Does solidity optimize gas usage based on total storage used before and after a contract method is called?

Here is a simple contract to demonstrate what I am asking: contract Example { uint256 intOne; uint256 intTwo; function test1() public payable { intOne = 300; } function ...
0
votes
1answer
14 views

Accepting parameters in javascript to send to solidity smart contract

Wrote this simple solidity contract where the functions accept a few parameters. function fund(uint _dbIndex, uint _fundedAmount) public { uint totalAmount = projectWallets[_dbIndex].fundedAmount;...
0
votes
3answers
178 views

Web3 | TransferFrom() transactions always Failed

I'm trying to send Custom ERC20 Token to Owner Wallet Address using transferFrom() function using Web3.js However all the Transactions are failed. Which is the same problem occur on Remix IDE. Some ...
0
votes
1answer
18 views

Solidity: Retrieving values of Array of Structs in Mapping

I have some solidity code where I am attempting to gather the ids which are a value stored on a Struct. I have a mapping where the key is an address, and the value is an array of Structs. Whenever I ...
0
votes
1answer
33 views

Accessing smart contract member functions through Web3

I have the following smart contract deployed on Ganache (migrated through Truffle): pragma solidity ^0.4.24; contract Logistics{ address public owner = msg.sender; mapping(address => ...
2
votes
2answers
62 views

Exit Scam Solidity game

I'm looking through Exit Scam's game code. But there are some lines that I do not understand at all. Contract code At Line 189: Why is there an address at ...Interface(...); ? ...
0
votes
0answers
17 views

Configurable smart contracts

Want to create marketplace where user can select smart contract template and configure it as per his/her requirements and generate decentralized application (dApps) over any blockchain. Help or ...
2
votes
1answer
35 views

encode three integers into single integer

I have to encode 3 numbers into the same integer. I have these 3 measurements uint256 carLength; uint256 carWidth; uint256 carDepth; and i want to encode these 3 numbers into the same integer with ...
0
votes
0answers
21 views

Solidity function returning manager address of 0x00000 after contract deployment in Remix IDE

I have recently ran into a bit of an issue with a solidity contract I created and am trying to deploy and interact with inside of the Remix IDE. The function I have written to return the address of ...
-1
votes
0answers
14 views

What is the reason for not just issuing a token on the testnet (e.g. Rinkeby) so that Gas costs are free (Rinkeby ETH from faucet)?

If someone wants a token to be usable and easily transferable between users, without the prohibitive costs of paying for gas every time with real ETH (and thus, money), why not just deploy it on ...