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
2answers
12 views

Can a “forward” smart contract forward the received ether to another “forward” smart contract which forwards it to an address?

I am pretty new to solidity. I am trying to create a smart contract which deploys another smart contract and transfers ether to the newly created contract when a payment greater than 0.01 ether is ...
0
votes
0answers
9 views

How to call a function automatically when some condition gets false?

I am having a bidding session where every time a person Bids on some product it checks the condition if the bidding session is valid or not, I want to trigger a finalize bid function which will ...
1
vote
2answers
12 views

ERC20 is it possible create them for private users?

I created my erc20 and i would like no one, except me and those people to whom I send them, to generate my tokens. Is it possible to generate all the tokens and send them to one wallet during the ...
0
votes
1answer
14 views

Out of gas exception when calling contract function

I am calling the contract function below however I get an error: "VM Exception while processing transaction: out of gas". To test I have simplified the function so it only saves a user's name however ...
0
votes
0answers
19 views

when I am initializing the struct by calling the setValue function the tmpid value is changing to some higher value?

pragma solidity ^0.4.0; pragma experimental ABIEncoderV2; contract demo { struct propertyDetails{ uint a; uint b; string c; } mapping(uint => propertyDetails) ...
1
vote
1answer
11 views

How to burn non burnable ERC20?

Suppose you received 250 HELLOCoins and you want to burn them. Unfortunately, HELLOCoins uses OpenZeppelin ERC20 which implements the following function: function _transfer(address from, address to,...
0
votes
2answers
22 views

Which ERC standard is suitable for an ICO token to have types?

There will be ICO with multiple cycles... Here, investors can purchase tokens and after a fixed window of 270 days, they can redeem it back. But within this window period, they can transfer tokens to ...
0
votes
1answer
7 views

POA chain: intrinsic gas too low, contract deployment

I'm trying to deploy my smart contract to a private proof of authority chain with geth, but i always get the following error message intrinsic gas too low This is the JSON RPC request i'm sending. ...
1
vote
1answer
13 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 ...
1
vote
1answer
17 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
29 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
31 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
20 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
1answer
15 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
15 views

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

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....
1
vote
1answer
22 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
27 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
1answer
19 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
21 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
26 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
40 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
24 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
12 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
21 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
24 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
232 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
23 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
21 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
25 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
92 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
43 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
199 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; ...