Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [contract-development]

Questions regarding the development of smart contracts

Filter by
Sorted by
Tagged with
0
votes
2answers
30 views

Is this function prone to underflow hacking?

So I want to write as simple as possible withdrawal function in a token contract which also doesn't use Safemath for one very simple reason: I admit I don't understand well enough data types in EVM so ...
0
votes
1answer
19 views

Does it make sense to require token value to be anything but negative to prevent hack (more details below…)?

I was asked to validate a smart contract for a token and a function that puzzled me looks like that: function transferFrom(address _from, address _to, uint tokens) { require(...
1
vote
1answer
15 views

Automatically extracting functions names and parameters from ABI JSON file

I have done some work on captioned subject. For example, I can extract all getter functions (and some constructors as well) of all given smart contracts (in abi json file format). Then i can call (...
0
votes
0answers
18 views

How to build a P2P wager contract with Solidity

I am looking to build a contract with Solidity that will take wagers on a football game between a bunch of friends. Each user should be able to place a bet on either team, with each bet to be added to ...
1
vote
2answers
31 views

loop though all the members of a map

I need to loop though all of the members of a map and change their property (which is a struct). the way i'm doing this is when adding a member to the map object also save it's address inside an ...
0
votes
1answer
17 views

Could not call contract function with its signature

Web3.js documentation says here that the methods of a smart contract are available through: The name: myContract.methods.myMethod The name with parameters: myContract.methods['myMethod(uint256)'] The ...
0
votes
3answers
17 views

Emitting Transfer Event even when there is no actual transfer

I am new to smart contracts and trying to understand it so that i can detect Ether transfers done to my user via Smart Contract. I know I can find the event emitted from topics[]. But for those ...
1
vote
1answer
10 views

Many-2-Many ERC721 Pattern?

I'm looking to build a smart contract with a function which is able to generate a unique and limited amount of ERC721 tokens based on an input string. I also want to be able to look up all the tokens ...
0
votes
2answers
35 views

Solidity contract reentry attacked

The idea is to have a user call send() with some eth. The contract decides if user won/lost. Winner gets a prize msg.sender.transfer(msg.value + winnings); loser gets nothing. Unfortunately the ...
0
votes
0answers
12 views

Extract function names alongwith their parameter name and types from abi JSON file

My task is to get function names, its parameters and type of parameters from provided .json file. Then call each extracted function with extracted parameters. The code from this Get all function names ...
0
votes
0answers
18 views

How can I call selfdestruct when it is located in a constructor and not in the ABI of my contract?

I am reading some tutorials and while planning to deploy test contract on ropsten I have something like this: pragma solidity 0.5.1; contract destroy { constructor(address payable receiver) ...
0
votes
1answer
20 views

Could not call contract function

I want to access the balance of contract(i.e. 0x552F3AfaA0394632f4aEfa9E923fA3e2bbDAF5FE) and its totalSupply(state variable). I could access the balancec of this contract , but why I could not call ...
1
vote
1answer
24 views

How to search value in data field transaction

I need to look for a value in the data field of a transaction and to know which transactions contain the desired value. Let me explain with an example. In the data field of a transaction there is for ...
0
votes
1answer
39 views

How to deploy and get address of smart contract in same javascript program

I want to deploy a smart contract (provided in .json file) and need its address (on testnet blockchain) and then try to send some transactions to it. All these should be done through javascript. Here ...
0
votes
2answers
24 views

Linking to Compound Smart Contract

I'm still new with the solidity and it seems to be a very basics question. What i'm trying to do is to call the link the compound smart contract with mine. And when i try to compile is complaining : "...
0
votes
0answers
17 views

Does a contract creation failure leave the target address with nonce 1?

When contracts are created, they start with nonce 1 not nonce 0. This is since the implementation of EIP-161. The ETH wiki page on nonces outlines what happens when a contract A tries to create a ...
0
votes
0answers
19 views

Can a dapp/smart contract execute a transaction based on a private github file modification?

Scenario Suppose someone promises to deliver code to a private repository, that person is so sure they will, that they even said: "here is x eth, if I don't deliver in time, send the x eth to a ...
-1
votes
1answer
40 views

Unable to test a smart contract on ropsten test network

I launch and verify an ERC20 based smart contract on a ropsten test network which allows user to interact with the contract (send eth to it and the contract automatically send token in returns as in ...
0
votes
2answers
17 views

How to get the result by parsing the log after executing the contract? How can I get the execution result?

How to get the result by parsing the log after executing the contract? How can I get the execution result ?
0
votes
1answer
28 views

Desired Revert if Condition Is True [closed]

What is the best way to revert inside a function if a particular condition is true? Sometimes safeguarding with require statements is not enough, i.e. uint256 constant public OFFER_LIMIT = 500 ...
0
votes
1answer
27 views

Memory Utilization Pattern Solidity?

I was wondering what is the most efficient way (and why), to use variables in memory for function calls with regards to A and B? A) Like this: function checkBalance() public view returns (uint256) ...
0
votes
1answer
46 views

smart contract is too smart: different bahaviors of smart contract on different version of geth or solidity

recently I am learning how to deploy and call smart contract on ethereum. I am working on a very simple contract as follows: pragma solidity >=0.4.24 <0.6.0; contract TestContract{ uint ...
0
votes
0answers
8 views

Retrieving ERC-223 token address on tokenFallback() function

I made a sample smart contract that can update the value of different existing ERC-223 tokens received in the contract as below. Assuming that the IERC223 was taken from here. address[] ...
2
votes
1answer
41 views

How can a smart contract store mutable data outside blockchain?

As storing persistent data on blockchain is costly due to the storage operation being gas-expensive, what are the solutions to store mutable data outside the realm of blockchain from within a smart ...
0
votes
1answer
19 views

What does it mean to flush to an ethereum address

If ether is sent to a contract then flushed to an address what does this mean? Does it mean the contract sends the money to a recipient?
0
votes
1answer
41 views

Payable external function call not updating state variables

I'm trying to get buyToken() to update the balance of the caller. I'm using Truffle and Ganache, running tests, but the testBuyToken() function keeps failing, apparently the BALANCES variable isn't ...
0
votes
0answers
16 views

How do a set cookie for a Dapp's front end and pass the information to blockchain?

I am trying to look up documentation on setting up cookies for my dapp using web3 but I am unable to find resources. Can I just use js functions like setCookie and getCookie as one would do for a ...
0
votes
1answer
18 views

Need to enumerate keys of a mapping [duplicate]

I have a directed multigraph of courts "trusting" each other: struct TrustedCourt { uint256 courtId; mapping (uint256 => uint256) limits; // intercourt token => amount } ...
2
votes
2answers
30 views

How to generate a new token for ERC1155?

Developing an ERC1155 contract, how to generate an address for a new token? I need to create an API function like function createToken() returns (address). How? Should I just use an incrementing-by-...
0
votes
1answer
37 views

Error Handling on Contract Calls to Other Contracts

I'm trying to call a function from another contract and need a way to accommodate errors. Say contract A has the method getBalance: function getBalance(address x) public view ...
0
votes
0answers
34 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 ...
0
votes
0answers
18 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
2answers
30 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
1answer
29 views

How estimate GAS from a contract call with Web3j

I'm trying to estimate gas cost of a contract call, i need to send a string to a contract, but i need to see if i overtook the GAS limit. I'm trying like this: Transaction t = Transaction....
0
votes
1answer
21 views

Is there any chance to retrieve data on a database(sql) to a smart contract [duplicate]

I want to write a smart contract that gets id numbers as inputs and then retrieve data that are recorded in a database.Is there any specific database for that process.
0
votes
1answer
33 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 ...
0
votes
0answers
22 views

Failed to compile <modul not found>

please help me Module not found: Can't resolve 'web3' in 'C:\Users\block\src\components' i don'k know why .. my app.js import React, { Component } from 'react'; import logo from './logo.svg'; ...
0
votes
2answers
23 views

Check if contract exists in list

I've got a contract which creates another contracts and stores them in a list. How can I check that contract with specific index already exists? import "./User.sol"; contract Main is Ownable { ...
0
votes
1answer
39 views

Must consider things for every smart contract

When creating smart contract from scratch, what kind of things you should consider? For example: 1.Certain functions should be accessible only by creator/specific addresses 2.Fallback function Is ...
0
votes
1answer
25 views

Keeping a finite set of addresses (Solidity)

struct Data { ... } contract Court { mapping(address => Data) subcourts; } I want to keep track of a small finite set (which can be added or removed) of all keys of this mapping. What is the ...
0
votes
0answers
11 views

Auction Contract with “Right to Bid”

I build a basic reverse auction you see here using Solidity and the ethereum remix IDE. In addition to the functionalities already implemented I would like to add a "SafetyLimit" amounting to half the ...
0
votes
1answer
76 views

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 ...
0
votes
0answers
28 views

Bunch of Smart contracts with Ownerships and User fees free transfers

I need a community advise on how to organize smart contracts architecture. So what we have: Users who have not eth and wallets. Users generate actions which involves token transfers. Users don't care ...
0
votes
0answers
20 views

which type can use to store abi in a contract

If I want to store abi in contract, which type can be use? and How can I get it later. For example, if I use bytes to store a contract's abi. How can I use JSON.parse to get it. I have not find a ...
0
votes
1answer
33 views

Why my smart contract's function always return 0?

I'm new on Ethereum. I'm trying to deploy my first smart contract in my private blockchain but my function always returns 0. I wrote the simple Smart Contract: pragma solidity^0.5.0; contract ...
0
votes
1answer
48 views

Help me Understand the flow of this smart contract

I have 2 smart contract, below is the implementatin of them : 1) import "./MaintainableUpgradeabilityProxy.sol"; function _createProxy(address implementation, address serviceRegistry) internal ...
0
votes
0answers
27 views

How simulate blockchain and smart contract in VANET?

I am a beginner in the blokchain, I am blocked how I start simulate a blockchain and smart contract in vanet. Can you help me and inform me how I have to simulate blockchain and smart contract in the ...
0
votes
1answer
37 views

How to call ecrecover() in pure assembly?

If I do remember correctly, it’s a contract built‑in in the Ethereum Virtual machine, isn’t it? if yes, what’s the address to call for it?
2
votes
2answers
92 views

How to assemble a contract’s code?

I wrote a contract into bare assembly (no solidity or Vhyper syntax and with all address being static). How to convert it into bytecode? If possible using the new http://remix.ethereum.org or another ...
0
votes
2answers
31 views

how to write a test case for msg.sender==0?

In my contract I am use the below mapping. mapping(address => uint)Drivers In the function function registerDriver(uint _perkm) public payable returns(string memory) { require(...