Skip to content

Commit 91ee641

Browse files
Brechtpddong77
authored andcommitted
[Protocol3] Add check for invalid accountID for token transfers (#263)
1 parent a8a2825 commit 91ee641

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/loopring_v3/contracts/impl/libexchange/ExchangeWithdrawals.sol

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,15 @@ library ExchangeWithdrawals
463463
internal
464464
returns (bool success)
465465
{
466-
address to = S.accounts[accountID].owner;
467466
// If we're withdrawing from the protocol fee account send the tokens
468-
// directly to the protocol fee manager
469-
if (accountID == 0) {
467+
// directly to the protocol fee vault.
468+
// If we're withdrawing to an unknown account (can currently happen while
469+
// distributing tokens in shutdown) send the tokens to the protocol fee vault as well.
470+
address to;
471+
if (accountID == 0 || accountID >= S.accounts.length) {
470472
to = S.loopring.protocolFeeVault();
473+
} else {
474+
to = S.accounts[accountID].owner;
471475
}
472476

473477
address token = S.getTokenAddress(tokenID);

0 commit comments

Comments
 (0)