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
Once token wallet is set, there is no way to set it to the reserve contract anymore. This is because token approval only happens in approveWithdrawAddress, and has the condition that the token wallet address is null, but setTokenWallet checks that the input address is not null. As such, there is no way to reset the token wallet.
Code reference:
function approveWithdrawAddress(ERC20 token, address addr, bool approve) public onlyAdmin {
approvedWithdrawAddresses[keccak256(token, addr)] = approve;
WithdrawAddressApproved(token, addr, approve);
setDecimals(token);
if ((tokenWallet[token] == address(0x0)) && (token != ETH_TOKEN_ADDRESS)) {
tokenWallet[token] = this; // by default
require(token.approve(this, 2 ** 255));
}
}
function setTokenWallet(ERC20 token, address wallet) public onlyAdmin {
require(wallet != address(0x0));
tokenWallet[token] = wallet;
NewTokenWallet(token, wallet);
}
Recommendation is to have a conditional check for token approval in setTokenWallet:
Should probably reset old wallet allowance in this case. And also reset allowance to reserve in case it was non zero before. More generally if u want to change it, then probably should support proper change of token wallet. And not only for wallet as reserve.
Once token wallet is set, there is no way to set it to the reserve contract anymore. This is because token approval only happens in
approveWithdrawAddress
, and has the condition that the token wallet address is null, butsetTokenWallet
checks that the input address is not null. As such, there is no way to reset the token wallet.Code reference:
Recommendation is to have a conditional check for token approval in
setTokenWallet
:The text was updated successfully, but these errors were encountered: