Hot answers tagged

1

you can instead use a factory class which creates token as follows in this design subtoken is an abstract class, implemented by token class and in the end a factory class which will create different instances of token class. pragma solidity ^0.5.0; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; ...


1

Looks like to fix your errors you'll need to do a few things: First, for every function in SubContract, you'll need to define them. For instance, totalSupply() needs some code to go with it, so the compiler knows what to do when you call that function. All of the "missing interface" errors go with that. You need to define function totalSupply() public ...


1

It is not posible for all cases unless totalA equals totalB in which case you will have amountB = amountA. The division truncates the result discarding decimals digits, in your example the return value of convertBtoA should be 163813609331349736.27117520077928403. For most use cases small rounding errors are accepted, for example ERC20 and Ether both have ...


1

You didn't explain the periodicity and other details. Is the membership fixed or do they come and go? Does the contract continue to gain/lose on operations, or is this a wrap-up and final settlement? In the simplest case I can think of, all members join (deposit), then things happen, then you establish the entitlement of each member at a point in time and ...


1

pragma solidity ^0.5.0; contract Product { Factory public factory; Product public x; constructor(Product _reference, Factory _factory) public{ x = _reference; factory = _factory; } function haveFactoryCreateProductWithReferenceToThis() public { emit ProductCreated(factory.createNewProduct(this)); } event ProductCreated(Product indexed ...


1

In Remix, there's a problem with blockhash() when using Javascript VM (https://github.com/ethereum/remix-ide/issues/1794). If you try to deploy this contract in Ropsten, it will not fail. So, the problem lies in line 375, which runs when the constructor is called. challengeNumber = block.blockhash(block.number-1);


Only top voted, non community-wiki answers of a minimum length are eligible