Skip to content

Commit

Permalink
style: update code style (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
zgfzgf authored May 21, 2021
1 parent 318d7f2 commit 8978c89
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions contracts/Vault.vy
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def initialize(
log UpdateManagementFee(convert(200, uint256))
self.lastReport = block.timestamp
self.activation = block.timestamp
self.lockedProfitDegradation = convert(DEGRADATION_COEFFICIENT * 46 /10 ** 6 , uint256) # 6 hours in blocks
self.lockedProfitDegradation = convert(DEGRADATION_COEFFICIENT * 46 / 10 ** 6 , uint256) # 6 hours in blocks
# EIP-712
self.DOMAIN_SEPARATOR = keccak256(
concat(
Expand Down Expand Up @@ -901,11 +901,11 @@ def _shareValue(shares: uint256) -> uint256:
return shares

# Determines the current value of `shares`.
# NOTE: if sqrt(Vault.totalAssets()) >>> 1e39, this could potentially revert
# NOTE: if sqrt(Vault.totalAssets()) >>> 1e39, this could potentially revert
freeFunds: uint256 = self._totalAssets() - self._calculateLockedProfit()

return (
shares
shares
* freeFunds
/ self.totalSupply
)
Expand Down Expand Up @@ -969,7 +969,7 @@ def _reportLoss(strategy: address, loss: uint256):
# NOTE: This calculation isn't 100% precise, the adjustment is ~10%-20% more severe due to EVM math
loss * self.debtRatio / self.totalDebt,
self.strategies[strategy].debtRatio,
)
)
# Finally, adjust our strategy's parameters by the loss
self.strategies[strategy].totalLoss += loss
self.strategies[strategy].totalDebt = totalDebt - loss
Expand Down Expand Up @@ -1716,12 +1716,11 @@ def report(gain: uint256, loss: uint256, _debtPayment: uint256) -> uint256:

# Profit is locked and gradually released per block
# NOTE: compute current locked profit and replace with sum of current and new
lockedProfitBeforeLoss :uint256 = self._calculateLockedProfit() + gain - totalFees
lockedProfitBeforeLoss: uint256 = self._calculateLockedProfit() + gain - totalFees
if lockedProfitBeforeLoss > loss:
self.lockedProfit = lockedProfitBeforeLoss - loss
else:
self.lockedProfit = 0

self.lockedProfit = 0

# Update reporting time
self.strategies[msg.sender].lastReport = block.timestamp
Expand Down

0 comments on commit 8978c89

Please sign in to comment.