Skip to content

Commit 10be5f7

Browse files
committed
bugfix
1 parent 832fb0b commit 10be5f7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

alpaca_finance/automated_vault/position.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,13 @@ def _execute(self, function_call: web3.contract.ContractFunction) -> Transaction
231231
return receipt
232232

233233
@staticmethod
234-
def from_wei(amt: int, decimals: int) -> int:
234+
def to_wei(amt: int, decimals: int) -> int:
235235
return amt * (10 ** decimals)
236236

237+
@staticmethod
238+
def from_wei(amt: int, decimals: int) -> int:
239+
return amt / (10 ** decimals)
240+
237241
def _decode_withdraw_transaction(self, transaction_address: Optional):
238242
"""
239243
Returns the transaction data used to invoke the smart contract function for the underlying contract

examples/automated_vault/withdraw.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
],
9191
"source": [
9292
"# Must supply the shares in integer value:\n",
93-
"shares = position.from_wei(2, position.bep20_vault_token.decimals())\n",
93+
"shares = position.to_wei(2, position.bep20_vault_token.decimals())\n",
9494
"shares"
9595
]
9696
},
@@ -192,7 +192,7 @@
192192
],
193193
"source": [
194194
"# Must supply the shares in integer value:\n",
195-
"shares = position.from_wei(2, position.bep20_vault_token.decimals())\n",
195+
"shares = position.to_wei(2, position.bep20_vault_token.decimals())\n",
196196
"shares"
197197
]
198198
},

0 commit comments

Comments
 (0)