mirror of
https://github.com/Instadapp/yield-contract.git
synced 2024-07-29 21:47:29 +00:00
Check to
is vaild for withdraw function
This commit is contained in:
parent
8bcec5c0ac
commit
d43a1509ee
|
@ -164,6 +164,7 @@ contract PoolToken is ReentrancyGuard, DSMath, ERC20Pausable {
|
|||
*/
|
||||
function withdraw(uint tknAmt, address to) external nonReentrant whenNotPaused returns (uint _tknAmt) {
|
||||
uint poolBal = baseToken.balanceOf(address(this));
|
||||
require(to != address(0), "to-address-not-vaild");
|
||||
require(tknAmt <= poolBal, "not-enough-liquidity-available");
|
||||
uint _bal = balanceOf(msg.sender);
|
||||
uint _tknBal = wdiv(_bal, exchangeRate);
|
||||
|
|
|
@ -160,6 +160,7 @@ contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath {
|
|||
*/
|
||||
function withdraw(uint tknAmt, address to) external nonReentrant whenNotPaused returns (uint _tknAmt) {
|
||||
uint poolBal = address(this).balance;
|
||||
require(to != address(0), "to-address-not-vaild");
|
||||
require(tknAmt <= poolBal, "not-enough-liquidity-available");
|
||||
uint _bal = balanceOf(msg.sender);
|
||||
uint _tknBal = wdiv(_bal, exchangeRate);
|
||||
|
|
Loading…
Reference in New Issue
Block a user