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-design]

for high-level questions about the choices made during contract construction

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
24 views

How Ethereum stores its data in the blockchain

I am new to ethereum and the blockchain, but I am wondering about blockchain databases. Mainly I am wondering how exactly the database data and the blockchain merge. For instance, in a database you ...
1
vote
1answer
31 views

How to convert bytes32 to uint8 in solidity ^0.5.0?

I can see that conversions from bytes to uint used to be much easier in previous versions of solidity. Now, using the same syntax, I get this error: TypeError: Explicit type conversion not allowed ...
2
votes
1answer
20 views

How to integrate ERC 721 and 20 to create semi-fungible tokens?

ERC 721 defines non-fungible tokens where each token is unique. But if one needs to create a token where there is a limited supply of various types, is there a an effective way to accomplish this by ...
0
votes
1answer
14 views

Associate event struct to user addresses

I have two contracts. One called User and other called Event pragma solidity ^0.4.24; contract User { mapping(uint=>address) addresses; uint addressRegistryCount; } pragma solidity ^...
0
votes
0answers
10 views

Using Private Blockchains/DLT (E.g., Quorum) for Cybersecurity purposes to forestall data exfiltration/data leakage through consensus mechanism [on hold]

I am keen to use Private Blockchains/DLT such as Quorum for cybersecurity intent namely to deter and forestall data exfiltration through consensus mechanisms, i.e., securing read operations on smart ...
0
votes
1answer
16 views

Unable to use call.value to send the ether to another contract

Block Builder! I create a bank and client contracts, in order to reproduce DAO attack event. The client can deposit, but can not withdraw. I enclose the repo from Github here: https://github.com/...
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 ...
2
votes
2answers
39 views

Is there a limit to the function call output?

I have a simple contract for storing string tuple of ipfs hashes data in the array pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; contract Store { string[] public objects; ...
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. ...
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
1answer
30 views

In a smart contract : If a specific exception is raised…can a Human decide and validate the Smart Contract? [closed]

In a Ethereum Smart Contract : If a specific exception is raised...can a Human decide and validate the Smart Contract "by hand" ?
0
votes
0answers
28 views

What is use of absolute Path on Json file of a Smart Contract?

What is the use of absolutePath on JSON artifact of a Smart Contract? Does this mean we need the .sol file on the same server where web3.js apis are running? { "absolutePath": "/home/hashcode01/...
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
0answers
16 views

Contract the makes other contracts race condition issue

I have a smart contract that is making two (a token and a crowdsale) other contracts. mapping (uint => myStruct) myMapping; function start(uint uuid) public returns (bool) { address ...
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 ...
1
vote
1answer
64 views

How does delegatecall work from Solidity 0.5.0 onwards?

I am trying, for learning purposes only, to make a mutable smart contract, but I couldn't find anything useful on stackexchange because everything I found was using pragma solidity ^0.4.x; So, I have ...
1
vote
3answers
36 views

Cost-effective way to calculate final user balance based on variable events

Apologies for the title. I'm not sure what would be a more descriptive way to name this question. Assume there is a contract which has 3 potential parties. Buyers, sellers and shareholders. Buyers/...
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
37 views

Is it possible to have 15 variables in a struct in solidity?

I have a struct with two variables bool, nine bytes 32 and three uint. The problems I want to add another bytes32 but I get this error "InternalCompilerError: Stack too deep, try removing local ...
1
vote
0answers
20 views

Is there a way for a smart contract to manage a codebase?

For example, could one set up a smart contract with governance protocols which could merge PR’s in a github repository? How might one govern open source via a smart contract? In a related vein, is ...
1
vote
2answers
50 views

Getting ParserError: Expected ',' but got 'payable' and also one important security issue with contract

I have write a small smart contract for lottery system. however there is problem. please see below full code. pragma solidity >=0.4.22 <0.6.0; contract Lottery{ address[] public players; //...
1
vote
1answer
25 views

Need to use function modifiers however little confuse when implement and how

Hi I need help for writing below auction code. I want to use modifier however there is some changes in solidity which make me confuse. I have mentioned below where I need changes within "//" pragma ...
0
votes
2answers
33 views

Is it ok to store tokens at 0x0?

I would like to store tokens somewhere else than my wallet due to security reasons. I made a voting system contract and when more than 50% of authorized voters vote for yes, contract transfers limited ...
2
votes
1answer
30 views

Add more logic to a payable function

Is it possible to include in a payable function a message such as "Transaction rejected - Company not registered" which is displayed when a transaction is rejected? My code is as per below: ...
0
votes
1answer
30 views

How do I take value from array of objects?

I have a problem with my code. contract Registration { address public owner; uint conceptPrice; uint conceptValue; function Registration(uint _conceptPrice) public { owner = msg.sender; ...
1
vote
1answer
23 views

Solidity/Remix Error: The constructor should be payable if you send value enum change state

I'm using this (State Machine) design pattern in solidity and having an error when changing the state after executing the first function. Any hint? Thank you! Error: revert The transaction has been ...
0
votes
1answer
43 views

Design pattern for game development

I am developing a game which currently uses a GameFactory contract to create instances of a Game contract. The Factory pattern would allow any number of players to play their own single player game ...
0
votes
1answer
63 views

The use of ERC20 tokens in a private ethereum network

I am being told to use a private blockchain instead of the public one in attempt to cut gas cost. But I was hit with the problem of the value of ether and tokens in this private blockchain. I am ...
1
vote
2answers
23 views

Is it possible to interact with a contract deployed within another contract via web3js?

Be very helpful to know if the scenario below is possible contract A { import "./B.sol"; ... address c = new B(); b = B (c) } //somewhere in JS instance_of_B = web3.eth.contract(B.abi).at(c);
1
vote
0answers
38 views

Modifier to only allow access via staticcall

I'm trying to create a modifier that only allows a function to be called using staticcall. Using the view declaration in Solidity 0.5.0 guarantees that a function won't change state, but it still ...
1
vote
1answer
17 views

Is ERC20ImplUpgradeable a Scam?

I found this in GUSD Smart Contract. The ERC20ImplUpgradeable means that the contract can always be changed. And our coin can be stolen whenever they wish without any trace. If this is allowed by ...
0
votes
1answer
20 views

What is a suitable pattern for mobile/web apps that leverage ether?

Looking to understand how to build an app that leverages Ethereum - what suitable patterns are out there (ideally to go via some tutorials). I'd like to build a Hello World simple app (mobile and/or ...
1
vote
1answer
24 views

How to facilitate search and look-up from outside?

Given a master contract that continually generate child contracts, how to facilitate outsider to read some data located in the child contracts. In other words, how to publish the addresses of the ...
1
vote
1answer
116 views

Smart contracts for bidding

In a scenario where a contract represents a buyer-seller agreement, sellers need to publish for each new bid a new contract/ or new entry in an array within a single same contract, and then a buyer ...
1
vote
1answer
58 views

How to implement Ethereum mixing (or coin tumbling) to preserve anonymity in smart contracts?

According to this answer: (https://ethereum.stackexchange.com/a/62694/23024) one of the approaches to anonymize users in smart contracts is: "writing a smart contract which accepts Ether ...
0
votes
1answer
106 views

Anonymity preserving approaches in smart contracts?

What approaches are practicable to enhance anonymity in smart contracts? P.S.1: Some proposals have been proposed such as Hawk or ZoE project ;however, I am looking for other approaches. P.S.2 : ...
0
votes
2answers
56 views

Signing legal smart contracts

In "conventional", physical legal contracts, parties usually sign them with a handwritten/electronic/digital signature, depending on the form of the contract. But as legal smart contracts are ...
1
vote
2answers
81 views

Efficient way of checking and inserting array address that is unqiue

I have a following requirement that need to be cater in dapp. Insert array of address The array need to be unique. If one of the array address already exists, reject and revert entire operation. ...
1
vote
0answers
21 views

Challenges of Contract design [closed]

I am about to start designing a smart contract intended to be the backbone of a platform in the finance domain. My question is what are the challenges and problems that I may face or have to deal ...
0
votes
1answer
36 views

Contract design on querying list with certain outcome - O(n) issue

I need to query a list of Campaign from smart contract to display on my dapp. It would be easily done in a traditional database (we have did this in the past using traditional db but now we want to ...
1
vote
0answers
40 views

Smart contract design for gas refund

I'm designing a proxy smart contract that will be filled with eth by users so that anyone has an incentive to perform transactions useful to the user. I won't go into the detail of "usefulness" here. ...
-2
votes
1answer
37 views

What other function calls can freeze a smart contract like the pause() function?

I'm learning to audit Ethereum smart contract code for clues if a smart contract can be frozen or not. Many smart contract creators claim their contracts are "unstoppable", but I'd like to know if ...
0
votes
1answer
30 views

Insurance platform's and Ethereum smart contracts

I am trying to create a proof of concept for an insurance platform, a one that deals with risk and selling promises of coverage. A similar idea will be the car insurance platform's where you pay each ...
0
votes
1answer
140 views

Time Lock and vesting smart contract

I would like to create a smart contract that will take care of locking and/or vesting funds to several beneficiaries (inputted by the owner of the smart contract). The funds that it will vest and lock ...
0
votes
1answer
19 views

Why is it that my first original contract containing the setters and gettters are not showing up when I hit deploy?

pragma solidity ^0.4.24; contract Bank{ uint private value; constructor(uint amount) public{ value = amount; } function deposit(uint amount) public{ value += amount; ...
2
votes
1answer
40 views

Handling the String msg returned from revert() in solidity

This is my sample contract.. pragma solidity ^ 0.4.15; contract Sample{ struct Info { address pubKey; //key bytes32 Id; } mapping(address => Info) public userMap; // ...
2
votes
1answer
27 views

Is there any point in adding msg.sender to an event?

I am asked to provide the value of msg.sender as part of an event emitted in a function. It is something like: contract MyContract { event MyEvent(address indexed sender, uint256 input, uint256 ...
1
vote
1answer
49 views

Force two users to send the same amount of ether when starting a game

In my smart contract, I want the two participants to send the same amount of ether so they can start a game of rock, paper, scissors. How can I modify the sendEnoughCash() function do that? This is ...