Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Fix displaying ETH balance in wrap and unwrap commands + lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gbalabasquer committed Oct 31, 2019
1 parent 7877c21 commit c1cbb2e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion libexec/mcd/mcd---to-wad
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
# hex to decimal wad
set -e
seth --to-fix 18 $(mcd --to-dec $1)
seth --to-fix 18 "$(mcd --to-dec "$1")"
8 changes: 4 additions & 4 deletions libexec/mcd/mcd-unwrap
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
### mcd-unwrap -- Unwrap WETH to ETH
### Usage: mcd unwrap <amount>
set -e
mcd --require-from $0
mcd --require-from "$0"
[ -n "$1" ] || mcd --fail "mcd-wrap: Please specify an amount to wrap"
seth send ${ETH?} 'withdraw(uint)' $(seth --to-word $(seth --to-wei "$1 eth"))
seth send "${ETH?}" 'withdraw(uint)' "$(seth --to-word "$(seth --to-wei "$1 eth")")"

[[ $SETH_ASYNC == yes ]] && exit 1

sig="balanceOf(address)(uint)"
weth=$(mcd --to-wad $(seth call ${ETH?} "$sig" "$ETH_FROM"))
eth=$(mcd --to-wad $(seth balance $ETH_FROM))
weth=$(mcd --to-wad "$(seth call "${ETH?}" "$sig" "$ETH_FROM")")
eth=$(seth --to-fix 18 "$(seth balance "$ETH_FROM")")

echo "eth $eth"
echo "weth $weth"
8 changes: 4 additions & 4 deletions libexec/mcd/mcd-wrap
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
### mcd-wrap -- Wrap ETH to WETH
### Usage: mcd wrap <amount>
set -e
mcd --require-from $0
mcd --require-from "$0"
[ -n "$1" ] || mcd --fail "mcd-wrap: Please specify an amount to wrap"
seth send ${ETH?} --value $(seth --to-wei "$1 eth")
seth send "${ETH?}" --value "$(seth --to-wei "$1 eth")"

[[ $SETH_ASYNC == yes ]] && exit 1

sig="balanceOf(address)(uint)"
weth=$(mcd --to-wad $(seth call ${ETH?} "$sig" "$ETH_FROM"))
eth=$(mcd --to-wad $(seth balance $ETH_FROM))
weth=$(mcd --to-wad "$(seth call "${ETH?}" "$sig" "$ETH_FROM")")
eth=$(seth --to-fix 18 "$(seth balance "$ETH_FROM")")

echo "eth $eth"
echo "weth $weth"

0 comments on commit c1cbb2e

Please sign in to comment.