Stack Exchange Network

Stack Exchange network consists of 174 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 [contract-development]

Questions regarding the development of smart contracts

1
vote
0answers
6 views

How to improve web3 when importing and stop doing the same task over and over again?

When using web3js, you will automatically have to make file to create an instance of that contract which you will use in your main project to interact with. For example, smartContract.js import ...
0
votes
0answers
15 views

looking for ethereum account easy management process

Suppose I want users to answer surveys and that each response are hashed and sent to ethereum. My issue is the user experience of creating an account and login without metamask which is not user ...
0
votes
0answers
24 views

Transferring ether balance from contract balance to winner,not working

here is my Solidity snippet: function deliverPrizes(address payable winner) public onlyOwner{ winner.transfer(address(this).balance); } This is what I wrote on truffle console: dCoders....
0
votes
0answers
12 views

Transfering funds from a contract address to a list of winners [on hold]

I'm building a competition dapp where user has to pay to the contract to participate and I want to send the collected funds to 3 winners. How can I do so in a smart contract.Help
0
votes
2answers
24 views

Use function return variable of smart contract in web3.py

since im new to solidity programming i have some problem with executing my Contract. My Contract looks like this: # Solidity source code contract_source_code = ''' pragma solidity ^0.4.1; contract ...
0
votes
1answer
13 views

TypeError: Return argument type bytes32 is not implicitly convertible to expected type (type of first return variable)

I have one issue while deploying the below contract.could anyone help me to find the issue as unable to find issue. pragma solidity >=0.4.22 <0.6.0; contract Lottery { address payable[] ...
0
votes
0answers
11 views

Interacting with Already deployed Ethereum Contract and recording response

I understand this topic has been discussed before, but my question is specific to web3.py. How can I interact with function of already deployed ethereum contracts on Ropsten TestNet. my code runs with ...
0
votes
1answer
21 views

How to configure APIs to run with Ropsten addresses

I have my contracts deployed on Ropsten network. I deployed those contracts from my local machine using Truffle migrate. Then I set up an AWS EC2 Ubuntu server to host my RESTful APIs. I installed ...
-1
votes
2answers
12 views

Expected import directive or contract definition… going crazy. same code different result [on hold]

i am learning from a video course but the teacher doesnt have got the error i got. so we have the same code but different result (error on mine and all ok on his) here my code. pragma solidity ^0....
0
votes
0answers
18 views

ERC721 Default Implementation

I’m working on a card game. Right now it is really simple. There are orcs and cards. Both should be implemented as ERC 721. What would be the most natural way to make the orc an ERC-721 token? ...
0
votes
2answers
14 views

Optimization Exception Remix Editor

I am trying to compile my solidity code in remix editor. I keep getting this error "Optimization exception during compilation". I was using solidity version 0.5.2 till day before yesterday. Now, It is ...
0
votes
2answers
26 views

Can smart contract send tokens/eth if it doesn't have a send function?

Let's assume you just created 1,000 tokens at address 0x012345. You, the owner of 0x012345 sent by mistake all tokens and 1ETH to a smart contract with address 0x987654. This smart contract doesn't ...
1
vote
0answers
18 views

Processing gas cost on a sidechain

I am developing a sidechain that will store data and I want to evaluate the processing of this data in the ethereum network to get the cost in gas. I'm going to develop a smart contract that will ...
1
vote
0answers
28 views

blockhash refactoring, if hashes are relative to latest block, are all stored in contract?

The blockhash refactoring EIP included in Constantinople expands the range of blocks that can be accessed with blockhash(). Besides the last 256 blocks, 256 multiples of 256^1, and 256 multiples of ...
0
votes
1answer
16 views

contract reference another contract, what ABI information needed?

To reference another contract, the ABI is easily included like this. What information needs to be there? The function name, I guess, what about accessability such as public/private/internal/external/...
0
votes
0answers
19 views

My smart contract doesn't accept ERC20

NOTICE: The below implementation works. It assumes that the calling addresse has approved both the spender and the contract to carry the transaction. Because they were not approved it was not working. ...
0
votes
1answer
21 views

find the bytecode of a contract during compilation

Is there a solution to recover the complete bytecode (init + runtime) of a contract imported in solidity. For example "bytes code = getBytecode (Escrow.sol)" and this would be replaced by bytecode ...
0
votes
1answer
12 views

How do I get product/parcelID from particular Assigned address using struct and mapping?

struct Sellers{ address sellerAddress; uint parcelId; uint parcelPrice; } In this struct I've entered multiple parcel Ids to sellerAddress and I've retreived them using _sellerAddress. ...
1
vote
2answers
25 views

OpenZeppelin Starting Balance

I believe that the openzeppelin project have updated their StandardToken smart contract which is now called ERC20.sol. One issue that I have is that the new smart contract has some missing ...
0
votes
0answers
38 views

How to use mapping with array, struct to store seller's and buyer's data in array? [closed]

contract Seller { address payable owner; address [] sellerArray; struct Sellers { address sellerAddress; uint parcelId; uint parcelPrice; } contract Buyer is ...
0
votes
2answers
22 views

smart contracts and ICO: how to begin with when low speed connexion, old computer, low code understanding?

Question: having read https://www.ethereum.org/ and documentation regarding a) designing a token and b) kickstart a project, I wander what is the best way for a beginner like me to run a project ...
0
votes
1answer
11 views

Struct and Mapping input value error of Invalid Opcode while calling setSeller() to store multiple seller's addresses

What dose the -1 means? Or why we should use -1 while pushing one element in array. What should I enter in sellerAccounts: field as input? pragma solidity ^0.5.1; contract Seller{ struct ...
1
vote
1answer
38 views

How do you apply an interest rate on an ERC20 token without making new transactions?

I'm trying to develop an ERC20 token that mints new tokens to holders over time, however I would like to do this in a way that does not require me to make new transactions each time a users balance ...
0
votes
1answer
20 views

How to make transaction of some ether in Buyer Seller type of contract?

In this I have set modifier (msg.sender == sellerAddress) which is not valid. But in this scenario, I want to allow only and only sellerAddress to take ether from my contract. How can I allow only ...
0
votes
1answer
37 views

How does Ethereum Smart Contract work on Mobile Client

I want to deploy a smart contract on server and interact with it using mobile client. I'm not familiar with how does that work but after some research, I found something like below: If we compare ...
0
votes
1answer
22 views

How to convert plain text string variable to bytes32 variable? And how to store bytes32 in one variable after converting? [duplicate]

pragma solidity ^0.4.25; contract Purchase { address public sellerAddress; constructor (address _sellerAddress) { sellerAddress = _sellerAddress; } } contract Buyer is Purchase {...
1
vote
0answers
15 views

state channel between smart contracts

In my scenario, there are data sellers and data buyers which might be persons or organizations. I would like to create a smart contract for data seller and another smart contract for data buyer where ...
0
votes
1answer
22 views

When does a Smart contract get executed/called

I'm fairly new to Ethereum and Smart Contracts. After i publish a Smart Contract on the Chain, on what ways or how will it be executed? Who can call my Smart Contract? And under what conditions? I'm ...
3
votes
3answers
213 views

Converting from bytes in 0.5.x?

I'd like to convert bytes into any other type. I.e. "0x57D80C61128d608857d5310BB514223Bb6011CAB" into the address 0x57D80C61128d608857d5310BB514223Bb6011CAB, "5" into the uint256 5 and so on. I have ...
0
votes
0answers
22 views

How to use Role-Based Access Control via Proxy?

I have a PermissionsManager contract that uses OpenZeppelin's Role-Based Access Control (RBAC) template as a base. Currently function modifiers in my app call PermissionsManager directly to check for ...
3
votes
1answer
23 views

Do contract calls atomically modify contract contents?

Suppose a contract has the following: uint[] arr; function func(int a, int b) { arr.push(a); arr.push(b); } If two clients call func at essentially the same time with (1, 2) and (3, 4), are ...
1
vote
1answer
27 views

For Recipient how do I store Sender's account address and Password of Recipient's own account in hashed from?

How to check following things using Solidity: Password matching (hash formed) if password matches then transfer take place
1
vote
0answers
21 views

How does a real estate property contract work under smart contracts?

I am relatively new to concept of smart contracts. I am reading Nick Zabo's Smart Contracts: Building Blocks for Digital Markets, under the Smart Property section it is mentioned: Smart property ...
0
votes
1answer
25 views

constructor followed by three modifier / instantiation?

I saw this code snippet on openzeppelin, contract DoggoToken is ERC20, ERC20Detailed, ERC20Mintable, ERC20Burnable { constructor( string name, string symbol, uint8 decimals, address[...
1
vote
2answers
19 views

What is the main use of approveAndCall() function and _extraData?

function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); if(!...
0
votes
1answer
20 views

Unable to transfer from a contract to another contract

I was trying to learn how smart contract interaction by implementing a bank contract and a client contract. The end user create a Client contract. Then, he use the Client contract to deposit or ...
2
votes
1answer
21 views

How can I call contract method that suicide and continue execution?

Can I call another contract that eventually will call selfdestruct, and keep executing my function? For example, say I have two contracts as follows: contract Destructor { address owner; ...
0
votes
1answer
79 views

TypeError: Invalid type for argument in function call. Invalid implicit conversion from contract to address requested

I am unable to use the 'this' Keyword in below code. function buyTokens(uint256 _numberOfTokens) public payable { require(msg.value == multiply(_numberOfTokens, tokenPrice)); require(...
0
votes
1answer
41 views

Why is the totalSupply of this token statically initialized to 5500000000?

contract UnixERC20 is StandardToken { function() { throw; } string public name; uint8 public decimals; string public symbol; string public version = 'H1.0'; ...
0
votes
1answer
36 views

Only limited user can access contract

I want to only limited users(addresses) can do a transaction. For example, in a Lottery pool, an only limited user can join it.
0
votes
1answer
19 views

Just in time conversion to ETH in dApp

Let's say I want to facilitate transactions between two parties, and if there is one user who gives payment information, such as their bank account in USD, I'd like to exchange that into ETH ...
1
vote
1answer
179 views

TypeError: Data location must be “memory” for return parameter public view returns (address[16]){

I know that is question has been answered in one form. However, I could not find an answer for my specific case. Here is my code: pragma solidity ^0.5.0; contract Adoption { address[16] adopters; ...
0
votes
0answers
19 views

Passing enum argument to function

So i have this enum, which is later used in struct definition in another contract. i wonder if this is a correct way to use enums in solidity? Additionally, when i run this in remix, addRight ...
0
votes
0answers
34 views

Can I use an address value in such a hash function

I have a method which updates 3 mappings in my contract. To save data I use some items properties and message sender address, which allows easily to get users data. mapping(bytes32 => uint256) ...
0
votes
1answer
25 views

Error while deploying smart contract- This contract does not implement all functions and thus cannot be created

I have written and complied a smart contract written in Solidity for token and crowdsale. Compilation was successful with no errors in Remix IDE. Here is my smart contract pragma solidity ^0.4.25; ...
-3
votes
0answers
28 views

Airdrop doesn't deducted from msg.sender. This contracts has bugs, how to fix it?

Total amount supply limit to 10Billions but suddenly the airdrop sending 1E+59 (I Think is over one hundred thousand trillion ) to a airdrop participant. ---Code from comment follows--- contract **...
0
votes
1answer
26 views

Supply amount exceed total supply! Why the quantity supply shown 1.00 E+59

the quantity amount over the total supply, shown 1E +59 Airdrop solidity code maybe got something problem, does someone had idea?? Can't check for token Holder, "Sorry, We Are Unable To Generate The ...
1
vote
1answer
67 views

Call a payable contract's function from another contract via an interface

I have two contracts, they are connected via an interface. When user calls contract1 function, it uses an interface to call contract2 function which updates it's storage. My problem is that I can ...
0
votes
1answer
21 views

Function execution right based on external contract state, ballot and proposal example

i'm building a sample application which require voting. I think it needs to be split into 2 contracts where the owner of Ballot will create Proposal contracts. Splitting simply because the logic is ...
1
vote
1answer
88 views

Out of gas error for a view function

having a problem with calling a method of my deployed contract in the main Ethereum network. I have a 'view' function which returns user's refund balance, everything worked fine in my local ...