New answers tagged

0

function createProduct(string memory _name, uint _price, string memory _info, uint _quantity) public payable { This function signature has _price in ethers. So try changing the default units to the ether from Wei and send the appropriate price of the product. Mine is working [vm]from:0x4b0...4d2dbto:Buyproduct.purchaseProduct(uint256,uint256) 0x1df......


0

Have a look at the documentation on Crowdsale Rate which covers how to calculate the rate: https://docs.openzeppelin.com/contracts/2.x/crowdsales#crowdsale-rate If you have questions on using OpenZeppelin you can also ask in the Community Forum: https://forum.openzeppelin.com/ Disclosure: I am the Community Manager at OpenZeppelin


0

The method you described would work. A cost optimization would be to log an event whenever a user sent their tokens to the contract. This would remove the requirement for both an array and a mapping. When attempting to read the data off-chain (for the swap to the other token), you can simply read each event that occurred on that contract. An example would be:...


0

--rpccorsdomain "package://a7df6d3c223593f3550b35e90d7b0b1f.mod" Does the trick!


0

I'd suggest to upgrade to solidity 0.5. The constructor have an invalid syntax error. It should be something like this function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public { totalSupply = 250000000 * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // ...


1

To import from a tag or branch use /blob/<tag> import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.4.0/contracts/math/SafeMath.sol"; It is not mentioned explicitly in the documentation https://remix-ide.readthedocs.io/en/latest/import.html but it works.


0

I actually solved the problem by reading the doucmentation for ethereumjs-tx it says: When use the package ethereumjs-tx at the version of 2.0.0, if we don’t specify the parameter chain, it will use mainnet, so if you wan to use at the other network, you should add this parameter chain to specify. So if you specify your transaction to kovan ({'chain':'kovan'...


0

The error only indicates that your transaction hasn't been mined yet, not that there is anything wrong with it: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent Moreover, it even tells you to make sure that it has been sent (though "mined" would probably be more suitable here). You can do that by ...


0

I had this similar issue before, and finally got it work like this const ConvertLib = artifacts.require("ConvertLib"); const MetaCoin = artifacts.require("MetaCoin"); module.exports = function(deployer) { ConvertLib.address = "0xabce987676..."; deployer.link(ConvertLib, MetaCoin); deployer.deploy(MetaCoin); };


1

Being that departmentEmployees is a dynamic array, this assignment naturally reverts: departmentEmployees[_employeeId] = _employeeId; You can change that variable to a mapping, but then, what's the point in mapping a key to its own value (in your case, _employeeId to _employeeId)? So you probably want to leave that variable as is, and simply change your ...


1

You need the hexadecimal representation of the 6-byte value that you want to pass. First off, it should start with 0x (although Remix might be able to manage without it). But more importantly, it needs to consist of 12 hexadecimal characters, since each character represents 4 bits, while each byte stores 8 bits (so each byte is represented by 2 characters)....


2

Does returning false prevent bool function from further execution in Solidity? Returning any value prevents any function in (probably) every language from further execution. This will give bad jump dest or revert, correct? No, not correct: revert and require(<an expression which evaluates to false>) will revert the transaction with a REVERT ...


0

When you deploy a contract with Remix (and any client capable of deploying a contract) you need to give the contract the required constructor arguments. In your case the required arguments are: uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol These values can be given only when deploying the contract and therefore only once. ...


0

The correct syntax is function snd(uint256 amount) public payable { rc.dep.value(amount)(); }


Top 50 recent answers are included