File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
packages/token_migration/src Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -237,12 +237,16 @@ pub mod TokenMigration {
237237 // Swap `amount` of legacy token for new token.
238238 let from_balance_before = from_token . balance_of (token_supplier );
239239 from_token . transfer_from (sender : user , recipient : token_supplier , : amount );
240+ // Defensive check: transfer_from should panic on failure,
241+ // but verify balance change in case the token contract misbehaves.
240242 assert (
241243 from_balance_before + amount == from_token . balance_of (token_supplier ),
242244 Errors :: TRANSFER_FROM_CALLER_FAILED ,
243245 );
244246 let to_balance_before = to_token . balance_of (token_supplier );
245247 to_token . transfer_from (sender : token_supplier , recipient : user , : amount );
248+ // Defensive check: transfer_from should panic on failure,
249+ // but verify balance change in case the token contract misbehaves.
246250 assert (
247251 to_balance_before - amount == to_token . balance_of (token_supplier ),
248252 Errors :: TRANSFER_TO_CALLER_FAILED ,
You can’t perform that action at this time.
0 commit comments