Questions tagged [remix]

Questions about Remix, an online browser compiler for Solidity, formerly called Browser Solidity.

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

Fail with call function in solidity by remix

When I try to call function rtu() in remix with 0 wei, it occurs error below If I call it with value (10wei), it shows error below I debug the code, but there is no local vaule in rtu() changed. ...
0
votes
1answer
15 views

ParserError: Expected pragma, import directive or contract /interface/library definition

In an attempt to compile my ABI and verify my contract, I am getting the following warning: "ParserError: Expected pragma, import directive or contract /interface/library definition" on the first line ...
0
votes
0answers
33 views

Transactions go to an older contract address rather than the present deployed one

Though I have deployed a new contract but the transactions go to a previously deployed contract in my application. I'm attaching the screenshot of my Remix-ide code and the code for the front end ...
0
votes
1answer
19 views

# issue: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?

issue: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? gas required exceeds allowance or always failing ...
4
votes
2answers
70 views

Remix now force to use https, how can i continue to use http://remix.ethereum.org?

Recently I was able to both use http://remix.ethereum.org or https://remix.ethereum.org, but today I was not able to direct by browser to the unsecure version of remix. The reason I need to do so is ...
0
votes
1answer
21 views

What I need to verify contract with open-source license?

i m deployed contract in etherscan mainnet. i m verify it with open-source license like (MIT, GNU). now the problem were i don't know were to define license in etherscan ?? and etherscan will validate ...
0
votes
1answer
33 views

Web3 - Assign nonce to smarct contract transact

I have a smart contract. I want to execute one of its state modifying functions. This is the code: const result = await smartContractObject.methods .addSomething(_valueToAdd) .send( { gas: '...
1
vote
2answers
29 views

“Gas estimation failed” on Ropsten with Invalid RPC JSON

I'm running into an issue going through a basic example in "Mastering Ethereum"... I have a Faucet contract (on Ropsten) per the book that looks like... pragma solidity ^0.5.1; //mastering ethereum ...
0
votes
1answer
23 views

Web3 - Access return value of events

I want to get the value that my smart contract returns in javascript. Here is the contract. (version 0.4.25 - web3 version 1.2) pragma solidity ^0.4.25; contract SimpleStorage { uint public ...
0
votes
0answers
27 views

Error: Operator << not compatible with types bytes1 and int_const 1 return b10 << 1;

I don't know how to correct the code of function 4 & 5. pragma solidity ^0.4.4; contract C { bytes1 b10 = 0x6c;// l-> 0110 1100 6c转换为10进制-》12*16^0+6*16^1=108 bytes1 b11 = 0x69; ...
0
votes
1answer
18 views

Call to other contract method return false when two parameters are passed

Caller Contract Called.call(abi.encodeWithSignature("test(address, address)"),empAddress, empContAddress) Called Contract event ad(address); function test(address e, address f)public{ ...
1
vote
1answer
25 views

Solidity - Return value of Smart Contract Transact

Why do Solidity transact functions not return any value? Here is an easy example. I tested it in remix and web3. pragma solidity ^0.4.25; contract SimpleStorage { uint public storedData; ...
0
votes
0answers
34 views

Error: Member “transfer” not found or not visible after argument-dependent lookup in address 0.4.4 [duplicate]

pragma solidity ^0.4.4; contract PayableWorld { function deposite () payable{ address dyw2 = 0x1De57DD112092D60F45c9e2045424003e6B2C75a; dyw2.transfer(msg.value); } how can i change the ...
0
votes
1answer
21 views

Parser Error On Remix Solidity ERC20 Smart Contract Token

This Is My First ERC20 Smart Contract Token. I Am Trying To Compile It Using Solidity 0.5.0. Plz Need Your Help Guys. pragma solidity ^0.5.0; contract TusharCoin { uint256 public totalSupply; ...
0
votes
1answer
27 views

How can I store multiple strings mapped to an address in Smart Contract (solidity)?

I want to save multiple files in Ipfs and store its hashes mapped to an user address. I thought of having an array mapped to address and pushing to it, but does not seem to be the right approach. ...
0
votes
1answer
20 views

ERC20 - Approve & TransferFrom not working

The getTokenBalance function seems to retrieve data from the ERC20 contract just fine so I don't think there is an issue with how I'm using the interface. Additionally, I also tested out separating ...
0
votes
0answers
26 views

Solidity Contract cost calcuation

How can I calculate the cost of running my contract and running each function? I've noticed in Ethereum when a transaction is successful we have a transaction cost and a execution cost, what the ...
0
votes
0answers
8 views

DigixDAO smart contract functionality/pattern

Can someone explain the usage of initialisation functionality and _resolver arguments in the various constructors of digixdao? i.e. following contract What is a resolver and isn't the job of a ...
0
votes
1answer
21 views

Getting information from contract address?

pragma solidity ^0.5.0; import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol'; contract SubToken{ using SafeMath for uint; struct token{ ...
0
votes
1answer
12 views

interface function declarations to be used internally

Is it possible to use externally declared interface functions internally in a smart contract? i.e. say contract A inherits interface A, would contract A be able to implement the functions from ...
0
votes
0answers
29 views

Is it possible to insert some custom data in the DATA field of an Ethereum Transaction?

i am working on trying to get some data encoded/inserted into an ethereum transaction. Let me describe my environment first, i am using Web3py, Ganache and Remix IDE. I am able to successfully ...
-3
votes
2answers
38 views

Trying to create an instance of an abstract contract

pragma solidity ^0.5.0; import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol'; contract SubToken{ mapping(address => uint) balances; ...
0
votes
1answer
22 views

Inheritance and contract creation

If I modularise a contract into two contracts, and inherit one of them instead using a monolithic approach, will the deployment costs be larger with two contracts or is the cost the same as with the ...
0
votes
0answers
11 views

Contract Design Patterns | Should I use some sort of factory pattern?

I have 3 structs which are nested into each other i.e. struct A <- struct B <-- struct C All 3 structs belong to their own contracts (contract A, contract B, contract C) and each contract has ...
0
votes
0answers
9 views

when to create a library contract

when should one consider creating library instead of a contract? Would it make sense to create a library if all it does is calculations or reporting read values?
0
votes
1answer
24 views

Solidity Events

I'm using Solidity events to interact with my html page, once a change is done in the contract or page the watch function from html reflects back to the contract. My question here is, while checking ...
-2
votes
0answers
33 views

ownership and gas

I have just started implementing ownership checks in my code. I used the code: contract owned { constructor() public { owner = msg.sender; } address public owner; } Then ...
0
votes
0answers
13 views

Best Practices Of Building A DAO Contract Structure Tree

When building a DAO of interconnected smart contracts on Ethereum, what is the best way to organise the contract structure? More specifically, are there any particular design pattern(s) like MVC in ...
3
votes
1answer
28 views

approve-transferfrom pattern between contracts

What is the general process-flow of approving contract a to spend tokens on behalf of contract b and how would a sufficient function implementation look like which successfully achieves this? For ...
3
votes
2answers
48 views

Setting Remix default Compiler Version

Is it possible to set the default Compiler version in Remix? Each time I open Remix, the compiler defaults to version 0.5.0+commit.1d4f565a. However, there is currently up to version 0.5.10 available ...
4
votes
1answer
25 views

Invalid implicit conversion from bytes calldata to bytes storage pointer requested

The code below produces an error: code: function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes calldata _data ) external { _safeTransferFrom(...
0
votes
0answers
107 views

Solidity and Web3js codes are not working inside the private Ethereum(geth) network but same codes are working in public ethereum

geth version : 1.9.0-stable-52f24617, node version : v10.16.3, npm version : 6.9.0, web3 version : -- web3@1.0.0-beta.36. genesis.json: { "config": { "chainId": 966308076, "homesteadBlock": 0, "...
3
votes
1answer
39 views

Why solidity's keccak returns different value from online generators?

I try to implement my own little modifited commit&reveal voting. I have problem with revael phase. Reveal metod signature look like: function reveal(bytes32[] memory _reveals, bytes32[] memory ...
0
votes
0answers
20 views

Interface restrictions

Why are interfaces restricted to enums, events, structs and functions? Why are they restricted from containing state variable declarations if they can contain structs?
0
votes
0answers
12 views

when to use byte32 -> string conversion in events, functions etc

When is it a good practice to use string conversion from bytes32? i.e. in events, functions and similar. What does doing so bring in terms of cons to gas costs?
2
votes
0answers
26 views

deploying Solidity contract in Remix

I am trying to deploy Solidity contract in Remix for my study purpose. However, I failed to deploy SmartMesh contract in Remix (below, I attach the link for the code): https://etherscan.io/address/...
2
votes
0answers
15 views

Name Styling Best Practices Internal/External variables/functions etc

The solidity docs clearly specify how to style function order, types etc. However, are there an appropriate way to also separate between internal/external variables, functions etc. I see some people ...
0
votes
2answers
24 views

Fetching stored values for use in function logic

Are there any benefits from fetching stored data into other functions by calling a function to call a private variable, instead of calling the private variable directly? What is best practices? ...
0
votes
1answer
9 views

DeclarationError: Identifier already declared. when writing in solidity

DeclarationError: Identifier already declared near function pragma solidity ^0.5.1; contract Timestamp{ uint start; uint end; function start() public{ start = block.timestamp; } ...
0
votes
0answers
26 views

Create lots of hashes with ID

I have this code to create hash. function getUniqueHash(address _hashunique) public view returns (address) { bytes20 b = bytes20(keccak256(msg.sender, block.timestamp)); uint ...
0
votes
1answer
38 views

I can't execute transaction from Dapp: Nounce too low

I'am trying to use go-ethereum on my local network: I have configured a 5-node quorum network on my local machine and I'am building Dapp. I created smart contract and generated go bindings. When I ...
0
votes
1answer
34 views

create ERC-20 token from a contract function

I would like to do a function create contract with ERC-20 interface. But I have a few problems. If anyone help me I’ll be appreciated. Here’s the code : pragma solidity ^0.5.0; import 'https://...
0
votes
1answer
27 views

create contract from function / contract

**Hey guys ! I just try to make a contract for create a contract. It supposed to be ERC-20 interface so my first contract for this. But I don’t know how can I do _mint and createContract functions ...
1
vote
1answer
21 views

Assert.equals() weird behavior does not recognize (apparently) equal strings

I'm facing problems related to string comparison using Assert.equals() provided by remix_tests.sol. I made a toy contract and a related test to show what the problem is: https://gist.github.com/...
0
votes
0answers
17 views

address.call(abi.encodeWithSignature(“func(<param>)”, _params) doesnot work

contract C1 { uint public num; address public sender; function callSetNum(address c2, uint256 _num) public { (bool res,) = c2.call(abi.encodeWithSignature("setNum(uint256)",_num)); ...
0
votes
1answer
46 views

Why is my calculation broken?

I have a smart contract that holds a token balance, let's call it Token A, users may send this smart contract Token B to receive Token A, they do so by specifying the amount of Token A they would like ...
1
vote
0answers
23 views

Pass hexadecimal literal to contract using web3js

I have a hex literal that I need to pass into a contract using web3, and I'm not sure how to go about formatting it. In solidity, its formatted like so: hex'...
0
votes
1answer
22 views

Adding the delta to a token transfer

Let's say I have 5 contributors to a pool of a smart contract. They all contributed 1 ether. The smart contract lost 2 ether, and now I want to transfer back the remaining 3 ether to the 5 ...
0
votes
1answer
19 views

Expected identifier but got reserved keyword 'reference' Product public reference; ^-------^ [closed]

hello guys I am a beginner. I would like to make a function for create a contract. I found a example on the internet but gives me an error so I dont know what should I do. Anyone can help me ? ...
0
votes
3answers
58 views

Error transferring balance. Runs out of gas

This is probably a simple problem to fix, but it is very frustrating. I am developing in Solidity using Remix 0.5.10. I have a loan contract that collects funds from borrowers. I now want to ...