You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More generally, this means that the result of liquidating a position multiple times eventually lead to a healthy position (possibly empty).
111
111
112
-
## Safety
112
+
## Authorization
113
+
114
+
Morpho Blue also defines primitive authorization system, where users can authorize an account to fully manage their position.
115
+
This allows to rebuild more granular control of the position on top by authorizing an immutable contract with limited capabilities.
116
+
The authorization is verified to be sound in the sense that no user can modify the position of another user without proper authorization (except when liquidating).
117
+
118
+
Let's detail the rule that makes sure that the supply side stays consistent.
119
+
120
+
```solidity
121
+
rule userCannotLoseSupplyShares(env e, method f, calldataarg data)
122
+
filtered { f -> !f.isView }
123
+
{
124
+
MorphoHarness.Id id;
125
+
address user;
126
+
127
+
// Assume that the e.msg.sender is not authorized.
128
+
require !isAuthorized(user, e.msg.sender);
129
+
require user != e.msg.sender;
113
130
114
-
### Authorization
131
+
mathint sharesBefore = supplyShares(id, user);
115
132
116
-
Morpho Blue also defines a sound authorization system where users cannot modify positions of other users without proper authorization (except when liquidating).
133
+
f(e, data);
117
134
118
-
Positions of users are also independent, so loans cannot be impacted by loans from other users.
135
+
mathint sharesAfter = supplyShares(id, user);
136
+
137
+
assert sharesAfter >= sharesBefore;
138
+
}
139
+
```
140
+
141
+
In the previous rule, an arbitrary function of Morpho Blue `f` is called with arbitrary `data`.
142
+
Shares of `user` on the market identified by `id` are recorded before and after this call.
143
+
In this way, it is checked that the supply shares are increasing when the caller of the function is neither the owner of those shares (`user != e.msg.sender`) nor authorized (`!isAuthorized(user, e.msg.sender)`).
0 commit comments