aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract_wrappers/ether_token_wrapper.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-09 23:09:20 +0800
committerFabio Berger <me@fabioberger.com>2017-11-09 23:09:20 +0800
commitc96c681758a9bb62b4444ce21747c3781e9dc742 (patch)
tree545cf0c2adea7777d7e2c9bff6015e7b33cc0843 /src/contract_wrappers/ether_token_wrapper.ts
parent6007609f7132d5f919c8e9de04ae6c652ce38980 (diff)
downloaddexon-sol-tools-c96c681758a9bb62b4444ce21747c3781e9dc742.tar
dexon-sol-tools-c96c681758a9bb62b4444ce21747c3781e9dc742.tar.gz
dexon-sol-tools-c96c681758a9bb62b4444ce21747c3781e9dc742.tar.bz2
dexon-sol-tools-c96c681758a9bb62b4444ce21747c3781e9dc742.tar.lz
dexon-sol-tools-c96c681758a9bb62b4444ce21747c3781e9dc742.tar.xz
dexon-sol-tools-c96c681758a9bb62b4444ce21747c3781e9dc742.tar.zst
dexon-sol-tools-c96c681758a9bb62b4444ce21747c3781e9dc742.zip
Add assert.isValidBaseUnitAmount that checks for decimals in amounts that should be in baseUnits. This can sometimes alert developers whenever they accidentally pass in unitAmounts.
Diffstat (limited to 'src/contract_wrappers/ether_token_wrapper.ts')
-rw-r--r--src/contract_wrappers/ether_token_wrapper.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/contract_wrappers/ether_token_wrapper.ts b/src/contract_wrappers/ether_token_wrapper.ts
index 7c94e314a..6db07228e 100644
--- a/src/contract_wrappers/ether_token_wrapper.ts
+++ b/src/contract_wrappers/ether_token_wrapper.ts
@@ -30,6 +30,7 @@ export class EtherTokenWrapper extends ContractWrapper {
*/
public async depositAsync(amountInWei: BigNumber, depositor: string): Promise<string> {
assert.isBigNumber('amountInWei', amountInWei);
+ assert.isValidBaseUnitAmount('amountInWei', amountInWei);
await assert.isSenderAddressAsync('depositor', depositor, this._web3Wrapper);
const ethBalanceInWei = await this._web3Wrapper.getBalanceInWeiAsync(depositor);
@@ -51,6 +52,7 @@ export class EtherTokenWrapper extends ContractWrapper {
*/
public async withdrawAsync(amountInWei: BigNumber, withdrawer: string): Promise<string> {
assert.isBigNumber('amountInWei', amountInWei);
+ assert.isValidBaseUnitAmount('amountInWei', amountInWei);
await assert.isSenderAddressAsync('withdrawer', withdrawer, this._web3Wrapper);
const wethContractAddress = await this.getContractAddressAsync();