Skip to content

Commit 0ed3f84

Browse files
refactor: reduce logic divergence
1 parent 3a19b03 commit 0ed3f84

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

contracts/Controller.vy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ def __init__(
164164
borrowed_decimals: uint256 = convert(staticcall BORROWED_TOKEN.decimals(), uint256)
165165
BORROWED_PRECISION = pow_mod256(10, 18 - borrowed_decimals)
166166

167+
# This is useless for lending markets, but leaving it doesn't create any harm
168+
assert extcall BORROWED_TOKEN.approve(
169+
FACTORY.address, max_value(uint256), default_return_value=True
170+
)
171+
167172
self._monetary_policy = monetary_policy
168173
self.liquidation_discount = liquidation_discount
169174
self.loan_discount = loan_discount

contracts/MintController.vy

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ initializes: core
1616

1717
# Usually a bad practice to expose through
1818
# `__interface__` but this contract is just
19-
# an adapter for the constructor of the Controller
19+
# an adapter to make the construct of Controller
20+
# compatible with the old mint factory.
2021
exports: core.__interface__
2122

2223

@@ -37,8 +38,3 @@ def __init__(
3738
amm,
3839
empty(address), # to replace at deployment with view blueprint
3940
)
40-
41-
# TODO do this differently
42-
assert extcall core.BORROWED_TOKEN.approve(
43-
core.FACTORY.address, max_value(uint256), default_return_value=True
44-
)

contracts/constants.vy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ MIN_TICKS_UINT: constant(uint256) = 4
44
MAX_TICKS: constant(int256) = 50
55

66
DEAD_SHARES: constant(uint256) = 1000
7-
# TODO make sure this is used everywhere
87
WAD: constant(uint256) = 10**18
98
SWAD: constant(int256) = 10**18

0 commit comments

Comments
 (0)