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.

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

Send function transaction to existing smart contract using web3j

I've been exploring web3j and got the credentials working so I'm able to send transactions from an ethereum address. Now I want to send a transaction to an already existing smart contract and use a ...
0
votes
1answer
15 views

TypeError: market.FileViewed is not a function while trying to watch event

I want to watch for fileViewed event and it throws TypeError: market.FileViewed is not a function in marketplace.FileViewed{ ^ My solidity contract: pragma solidity ^0.5.0; contract ...
0
votes
0answers
10 views

Comparison of 2 child-contract-values in factory-contract

in my solidity code I create a tracking-contract and auction-contracts out of a factory-contract. The last function 'a4_Payment' of the auction-contract should be triggered out of the master-contract ...
2
votes
1answer
142 views

How to implement percentage deposit function to smart contract

I need to implement on the deposit function when the ownerAddress is doing a deposit a 10% to be freeze in the smart contract and and if the ownerAddress want's to call the returnDeposit function by ...
0
votes
0answers
9 views

How to deploy smart contract with private wallet?

I am now deploying smart contract using ganache localhost:7545, i want to use infura ropsten account to deploy. Most examples uses Metamask, but i want use own ethreum wallet. How can i use to deploy? ...
0
votes
1answer
110 views

How to make an ETH transfer from a contract that appears as an ETH transaction on the destination address?

I'm learning Solidity, and I've created a very basic contract that sends Ether from the contract to another address. My contract works, and ETH is being transfered (I'm on Rinkeby). ETH is subtracted ...
1
vote
1answer
129 views

Simple Open Auction example - how to run it?

I'm trying to run Simple Open Auction, compiled successfully in Remix. I receive "Exception while processing transaction: revert" when I try to enter recipient account addresses from Ganache, or "...
1
vote
1answer
162 views

Handling require/assert failure errors correctly from a Node.JS app?

I have a getter function in my smart contract that returns one of the string values in statically defined string array. Upon entry to the function, it does a bounds check on the incoming index using ...
0
votes
1answer
42 views

One contract accessing data from another fails

I am trying to get two contracts to interact: pragma solidity ^0.5.10; contract C2 { address public addr; constructor(address per) public { addr = per; } function ...
0
votes
3answers
252 views

How can i retrieve the values matching to an id in solidity

pragma solidity ^0.4.23; contract tracking { struct data { uint ownernumber; uint id; } uint value; mapping (uint256 => data) public datamatching; function storedata (...
0
votes
1answer
267 views

Sending string as address to smartcontract

I have trouble sending an address to a deployed contract, my function looks like this: function addNote(uint _value, address _owner) public { ... } and when I'm sending the parameters: contract....
0
votes
1answer
18 views

How can a smart contract payable based function returns value against any purchase

I am trying to get a return value from the payable function, the idea is a user must pay the fees and in return, he will get his special code. My JS test code is as follow it('get special code ...
0
votes
2answers
611 views

How to get list of Ethereum addresses for Airdrop?

I want to do Airdrop for my tokens and plan to distribute my tokens to 50,000 random Ethereum addresses. How do I get the 50k Ethereum addresses. How do the very well known Tokens airdrops manage to ...
4
votes
1answer
108 views

Retrieve CHAIN_ID of the executing chain from a Solidity contract

Is there a way to directly be able to retrieve CHAIN_ID information about the executing chain from a smart contract? I know that for any chain that has EIP-155 implemented, CHAIN_IDs are retrievable ...
0
votes
1answer
19 views

Setting ERC-20 token price

I'm currently trying to set the token price of my ERC-20 token.The problem I'm having is trying to set the price to ETH(0.01) per token, but the closest value I keep getting to is ETH(0.001) per token ...
0
votes
1answer
22 views

CompilerError: Stack too deep, try removing local variables [on hold]

interface AgreementInterface { function newAgreement(string _leaser, bytes32 _houseId, string _houseAddress, string _describe, bytes32 _signInfo, uint256 _rental, uint ...
1
vote
1answer
201 views

Error: Node error: {“code”:-32015,“data”:“Reverted 0x”,“message”:“VM execution error.”}

I deployed my smart contract on Kovan Etherium testnet. After that, I am trying to interact with smart contract methods using web3 1.0.0. Below is my node js code: var Web3 = require('web3'); var api ...
0
votes
2answers
151 views

Intracting with dapp using frontend truffle petbox

App = { web3Provider: null, contracts: {}, account: '0x0', init: function() { // Load pets. return App.initWeb3(); }, initWeb3: function() { if (typeof web3 !== 'undefined') {...
0
votes
0answers
51 views
+50

Linked contracts not running on go-ethereum

A very simple linked contracts example where A contract has a variable and B contract queries the A contract's variable is running ok on Ropsten+myetherwallet and Remix sandbox, but it fails when ...
4
votes
1answer
980 views

What happens after selfdestruct is called?

https://ropsten.etherscan.io/address/0xf825d3b3d06a4b46379a3c276df7f26abd055463 After selfdestruct call was made, all the balance was transferred to the deployer of the contract. Why are withdraw ...
0
votes
1answer
385 views

Where do I find the “constructor arguments” for a contract deployed with Remix?

When try to verify token, I dont know what to put in for this line: Constructor Arguments ABI-encoded (For contracts that accept constructor parameters) I made token after looking at a YouTube ...
0
votes
1answer
140 views

Solidity Oraclize error

I am learning to use oracles in solidity and I have taken this code to see how it works. But I get the following error: "VM error: revert. revert The transaction has been reverted to the initial state....
1
vote
2answers
649 views

Checking whether a value is a valid enum value

With the following enum definition in Solidity code... enum Direction { North, South, East, West } ... I would like to set up a for-loop that iterates over this enum's values, e.g. for (uint8 dirn =...
0
votes
0answers
27 views

solidity - Send token without using transfer function [on hold]

function purchaseWithToken(uint256 amount) public { require(amount > 0 , "Purchase require amount > 0"); require(_balances[msg.sender] >= amount , "amount not enough"); _balances[...
0
votes
1answer
9 views

How to set constructor parameters before deploying in remix?

I don’t understand how it works. I created a contract with a constructor with parameters. But I don’t understand where to pass these parameters to the constructor. Or I need to set params after ...
1
vote
1answer
51 views

Oraclize can't compile Remix “undeclared identifier”

I was following this, I assume, very simple tutorial for generating a random number using oraclize: https://www.youtube.com/watch?v=J05DBPdkeAo But I end up getting this error and I dont understant ...
0
votes
0answers
9 views

How to have ecrecover return nothing ? I means which value for malformed input?

I have a contract where the hash value is also the key to unlock the money. As the full ecrecover parameters are fetched from transaction parameters, and it was compiled in 2016, it is vulnerable to ...
0
votes
1answer
21 views

How can I interaction to a contract by address from another contract?

I have to access methods of one contract from another contract body. How can I realize that using just a address of first contract? contract KittyShelter{ address KittenRegistry; //Here, ...
0
votes
1answer
22 views

What are the parameters for the ideal gas limit?

I am new to writing smart contracts, in recent times I am having trouble in deploying the smart contracts couple of times so I need a solution for that. I am using the truffle most of the time so ...
0
votes
2answers
72 views
+50

How to send ETH to address(0) from msg.sender address using multiple token's contracts, with Solidity 5.x?

I need the safest way for an user to send any amount of Ethereum to address(0). The amount is calculated by the contract, and there is no limit (assuming there is enough funds). All the code I could ...
0
votes
1answer
77 views

Unhandled promise rejection (rejection id: 1): Error: Transaction has been reverted by the EVM:

I don't know where i'm doing mistake. I have deployed my contract through remix and truffle and it was deployed without any mistake but now i'm deploying it from web3 solc@0.4.24 version and EVM is ...
0
votes
0answers
16 views

Can a factory-contract access/read/modify variables in generated child-contracts?

at the moment I am experimenting with the factory/child-logic in solidity. With my factory contract I am able to create child contracts in which an auction is executed. Now I want to return a variable ...
0
votes
1answer
28 views

Solidity - Creating child contract

Recent code: pragma solidity ^0.5.11; pragma experimental ABIEncoderV2; contract Master { address Pi_C_Owner; address payable public NewAuctionPayable; //Hilfsvariable um ...
3
votes
1answer
206 views

Parse arbitrary bytes input

A function recives bytes as input: function foo (bytes data) How do I parse that into individual byte32 chunks? function foo (bytes data) returns (bytes32[]) My goal is to understand how to handle ...
0
votes
1answer
167 views

How to send ERC20 to 0x0000000000000000000000000000000000000000

How to send ERC20 to 0x0000000000000000000000000000000000000000 I have tried to do this on myetherwallet and it will not send as a transaction, is there a special way to send here? Thanks
0
votes
1answer
102 views

Web3js can not touch smart contract, always return 0

web3js can not touch smart contract. var id = dragoncore.getGenesNum(); has no error, but always return back 0, never changed. -----------------------------web3js code ----------------------------- ...
0
votes
0answers
14 views

cloning div container number of deployed child contracts time and put their data inside div container

Sorry for the silly question. I have a div container "product-card" , I want to loop the number of my deployed smart contracts time. every time when I loop I want to clone this div container and ...
1
vote
3answers
296 views

Can't compile old solidity contracts(version 0.4.17)

I'm new with blockchain development. I'm working on an old project which use solidity 0.4.17 and truffle ^4.0.0-beta.2; These versions were in the package.json file of the project. When I installed ...
0
votes
1answer
24 views

How to change push() method to simple code?

I have this code but it's static and I wanna change it dynamically. function addCandidates(){ if( own == 1 ){ candidate[0].candidate_ID[0] = 1; candidate[0].candidate_ID[1] = 2; ...
0
votes
0answers
6 views

hwo to identifie error from transaction error object?

is it possible to know what is the reason of transaction error from "error" object (nonce, insufficient fund ..) is there status or something to test using it ? Geth error message is generic, I ...
0
votes
0answers
31 views

Solidity bytecode not generated despite no errors

When does a compiler fail to generate bytecode for solidity? The code compiles entirely but both remix and solc js give proper abi but empty bytecode. The contract imports ERC721. Solidity contract: ...
0
votes
1answer
22 views

How to match the data in the struct?

If the Set function receives two inputs 1.["0xca35b7d915458ef540ade6068dfe2f44e8fa733c",50,"ROC","park"] 2.["0x14723a09acff6d2a60dcdf7aa4aff308fddc160c",60,"AU","school"] How can I return all the ...
2
votes
1answer
141 views

Library function overloading

I have 3 libraries, one exposes struct and 2 others expose method with same signature/return type (first one provides default method implementation and second - extended and customized one). When ...
0
votes
2answers
27 views

solidity - How to detect an ERC token has just transferred money to my contract

I am developing an application that automatically converts eth, usdt ... to my token when they transfer money to my contract address. With eth, I can do it, but how to detect other erc tokens, ...
0
votes
1answer
20 views

Could I implement a kill switch in my solidity program?

I was wondering if there was a way to put a killswitch into my solidity code? I am using v0.4.21+commit.dfe3193c Thanks a bunch!
0
votes
2answers
55 views

Accessing private variables using assembly

I would like program an oracle service which I would like to charge a fee for. Therefore, I would store the data of interest as a private variable in my oracle contract. This private variable should ...
0
votes
1answer
19 views

Why is my code calculating incorrectly, it feels right to me?

Why does this keep returning 0? And yes, it is above the claimtime. It does it for every address. I don't know what's wrong? function ViewDividendOwed(address _addr) public view returns (uint256) { ...
0
votes
1answer
107 views

Call contract function from another

I want to know what make the function below called successfully using web3js and throw " Error: VM Exception while processing transaction: revert" when I call it from another smart contract. function ...
0
votes
1answer
6 views

truffle compile/migrate gives error: “ParserError: Expected pragma, import directive or contract/interface/library definition.”

The tutorial I'm following created a 2_Migrations.sol with the following: const Token = artifacts.require("Token"); module exports = function(deployer) { deployer deploy(Token); }; "Truffle ...