-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Review #1
base: main
Are you sure you want to change the base?
Fix Review #1
Conversation
@@ -4,6 +4,7 @@ import params as Params | |||
import pools as Pools | |||
import fees as Fees | |||
import positions as Positions | |||
import ERC20Plus as ERC20Plus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
@@ -55,10 +56,10 @@ def CONTEXT( | |||
quote_token: address, | |||
desired : uint256, | |||
slippage : uint256, | |||
payload : Bytes[224] | |||
payload : Bytes[512] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
base_decimals : uint256 = ERC20Plus(base_token).decimals() | ||
quote_decimals: uint256 = ERC20Plus(quote_token).decimals() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
@@ -72,6 +73,7 @@ def CONTEXT( | |||
|
|||
######################################################################## | |||
@external | |||
@nonreentrant("lock") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
@@ -80,7 +82,7 @@ def mint( | |||
quote_amt : uint256, | |||
desired : uint256, | |||
slippage : uint256, | |||
payload : Bytes[224] | |||
payload : Bytes[512] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
@@ -101,14 +103,15 @@ def mint( | |||
return self.CORE.mint(1, base_token, quote_token, lp_token, base_amt, quote_amt, ctx) | |||
|
|||
@external | |||
@nonreentrant("lock") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
def burn( | ||
base_token : address, | ||
quote_token : address, | ||
lp_token : address, | ||
lp_amt : uint256, | ||
desired : uint256, | ||
slippage : uint256, | ||
payload : Bytes[224] | ||
payload : Bytes[512] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
@@ -128,6 +131,7 @@ def burn( | |||
return self.CORE.burn(1, base_token, quote_token, lp_token, lp_amt, ctx) | |||
|
|||
@external | |||
@nonreentrant("lock") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
@@ -136,7 +140,7 @@ def open( | |||
leverage : uint256, | |||
desired : uint256, | |||
slippage : uint256, | |||
payload : Bytes[224] | |||
payload : Bytes[512] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
@@ -158,13 +162,14 @@ def open( | |||
return self.CORE.open(1, base_token, quote_token, long, collateral0, leverage, ctx) | |||
|
|||
@external | |||
@nonreentrant("lock") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
def close( | ||
base_token : address, | ||
quote_token : address, | ||
position_id : uint256, | ||
desired : uint256, | ||
slippage : uint256, | ||
payload : Bytes[224] | ||
payload : Bytes[512] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
@@ -183,13 +188,14 @@ def close( | |||
return self.CORE.close(1, base_token, quote_token, position_id, ctx) | |||
|
|||
@external | |||
@nonreentrant("lock") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
def liquidate( | ||
base_token : address, | ||
quote_token: address, | ||
position_id: uint256, | ||
desired : uint256, | ||
slippage : uint256, | ||
payload : Bytes[224] | ||
payload : Bytes[512] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/1.
Fixes issues: #94
@@ -160,7 +160,7 @@ def balanced(state: Value, burn_value: uint256, ctx: Ctx) -> Tokens: | |||
# Magic number which depends on the smallest fee one wants to support | |||
# and the blocktime (since fees are per block). See types.vy/Parameters | |||
# for an example. | |||
DENOM: constant(uint256) = 1_000_000_000 | |||
DENOM: constant(uint256) = 1_000_000_000_000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/3.
Fixes issues: #66
@@ -60,12 +60,12 @@ def utilization(reserves: uint256, interest: uint256) -> uint256: | |||
""" | |||
Reserve utilization in percent (rounded down). | |||
""" | |||
return 0 if (reserves == 0 or interest == 0) else (interest / (reserves / 100)) | |||
return 0 if (reserves == 0 or interest == 0) else (interest / (reserves / 100_000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/3.
Fixes issues: #66
|
||
@internal | ||
@pure | ||
def scale(fee: uint256, utilization: uint256) -> uint256: | ||
return (fee * utilization) / 100 | ||
return (fee * utilization) / 100_000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/3.
Fixes issues: #66
pool : PoolState = self.POOLS.lookup(pos.pool) | ||
bc : uint256 = pool.base_collateral | ||
qc : uint256 = pool.quote_collateral | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/2.
Fixes issues: #96
@@ -206,19 +210,19 @@ def value(id: uint256, ctx: Ctx) -> PositionValue: | |||
quote_transfer : [], | |||
# in the worst case describe above, reserves | |||
# dont change | |||
quote_reserves : [self.MATH.PLUS(pos.collateral), #does not need min() | |||
quote_reserves : [self.MATH.PLUS(min(pos.collateral, qc)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/2.
Fixes issues: #96
self.MATH.MINUS(fees.funding_paid)], | ||
quote_collateral: [self.MATH.PLUS(fees.funding_paid), | ||
self.MATH.MINUS(pos.collateral)], | ||
self.MATH.MINUS(min(pos.collateral, qc))], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/2.
Fixes issues: #96
}) if pos.long else Deltas({ | ||
base_interest : [], | ||
quote_interest : [self.MATH.MINUS(pos.interest)], | ||
|
||
base_transfer : [], | ||
base_reserves : [self.MATH.PLUS(pos.collateral), | ||
base_reserves : [self.MATH.PLUS(min(pos.collateral, bc)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/2.
Fixes issues: #96
self.MATH.MINUS(fees.funding_paid)], | ||
base_collateral : [self.MATH.PLUS(fees.funding_paid), # <- | ||
self.MATH.MINUS(pos.collateral)], | ||
self.MATH.MINUS(min(pos.collateral, bc))], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/2.
Fixes issues: #96
avail_pay : uint256 = pool.quote_collateral if pos.long else ( | ||
pool.base_collateral ) | ||
funding_paid : uint256 = min(c1.deducted, avail_pay) | ||
# borrowing_paid is for informational purposes only, could also say | ||
# min(c2.deducted, avail_pay - funding_paid). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/2.
Fixes issues: #96
borrowing_paid : uint256 = c2.deducted | ||
# other users' bad positions do not affect liquidatability |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change related to https://github.com/Velar-co/gl-sherlock/pull/2.
Fixes issues: #96
Fix Review of
Repo:
Velar-co/gl-sherlock
Commit Hash:
cbc8105da41820b43a642e55303f0b5ba2281a90