Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

npx oz send-tx --value 1e17 transfers 0.000000000000007703 Ether #1546

Open
abcoathup opened this issue May 26, 2020 · 0 comments
Open

npx oz send-tx --value 1e17 transfers 0.000000000000007703 Ether #1546

abcoathup opened this issue May 26, 2020 · 0 comments
Labels
kind:bug topic:cli Related to OpenZeppelin CLI

Comments

@abcoathup
Copy link
Contributor

abcoathup commented May 26, 2020

Reported by Gökhan Çoban in Telegram attempting to send a transaction with value 0.1 ether to a contract.

If 1e17 is an invalid number format the command should fail. If 1e17 is supported then 0.1 Ether should be sent.

1e17 is being parsed as Hex so is treated as 7703 (thanks to Anatol in Telegram)

npx oz send-tx --value 1e17 transfers 0.000000000000007703 Ether

$ npx oz send-tx --value 1e17
? Pick a network rinkeby
? Pick an instance Vault at 0x4fb98139603b42aa4d335aFD5ABF9C53b2971f9c
? Select which function doStuff()
✓ Transaction successful. Transaction hash: 0xc0abd34292759d431928f4629069b1b680ddcc4caa2b9c89ef781a75a87c70a7

Transaction on Etherscan: https://rinkeby.etherscan.io/tx/0xc0abd34292759d431928f4629069b1b680ddcc4caa2b9c89ef781a75a87c70a7

npx oz send-tx --value 100000000000000000 transfers 0.1 Ether

$ npx oz send-tx --value 100000000000000000
? Pick a network rinkeby
? Pick an instance Vault at 0x4fb98139603b42aa4d335aFD5ABF9C53b2971f9c
? Select which function doStuff()
✓ Transaction successful. Transaction hash: 0xd884e183e28a3a13059c040643320b02437fe8a7d2b3d1a6944e50c4f86ebeab

Transaction on Etherscan:
https://rinkeby.etherscan.io/tx/0xd884e183e28a3a13059c040643320b02437fe8a7d2b3d1a6944e50c4f86ebeab

npx oz send-tx --value 0.1 fails with invalid number value (as it should)

$ npx oz send-tx --value 0.1
? Pick a network rinkeby
? Pick an instance Vault at 0x4fb98139603b42aa4d335aFD5ABF9C53b2971f9c
? Select which function doStuff()
✖ Calling: 'doStuff' with no arguments
Error while trying to send transaction to 0x4fb98139603b42aa4d335aFD5ABF9C53b2971f9c. Error: Error: Error: [number-to-bn] while converting number "0.1" to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported. Given value: "0.1"

The following contract was deployed to Rinkeby for testing at address: 0x4fb98139603b42aa4d335aFD5ABF9C53b2971f9c

Vault.sol

// contracts/Vault.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;


contract Vault {
    function doStuff() external payable {}

    receive() external payable {}
}
@frangio frangio added kind:bug topic:cli Related to OpenZeppelin CLI labels May 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind:bug topic:cli Related to OpenZeppelin CLI
Projects
None yet
Development

No branches or pull requests

2 participants