mirror of
https://github.com/Instadapp/yield-contract.git
synced 2024-07-29 21:47:29 +00:00
withdraw return uint
This commit is contained in:
parent
a115927405
commit
26e86c9436
|
@ -118,14 +118,13 @@ contract PoolToken is ERC20, DSMath {
|
||||||
emit LogDeposit(tknAmt, _mintAmt);
|
emit LogDeposit(tknAmt, _mintAmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
function withdraw(uint tknAmt, address to) external returns (uint) {
|
function withdraw(uint tknAmt, address to) external returns (uint _tknAmt) {
|
||||||
require(!shutPool, "pool-shut");
|
require(!shutPool, "pool-shut");
|
||||||
uint poolBal = address(this).balance;
|
uint poolBal = address(this).balance;
|
||||||
require(tknAmt <= poolBal, "not-enough-liquidity-available");
|
require(tknAmt <= poolBal, "not-enough-liquidity-available");
|
||||||
uint _bal = balanceOf(msg.sender);
|
uint _bal = balanceOf(msg.sender);
|
||||||
uint _tknBal = wmul(_bal, exchangeRate);
|
uint _tknBal = wmul(_bal, exchangeRate);
|
||||||
uint _burnAmt;
|
uint _burnAmt;
|
||||||
uint _tknAmt;
|
|
||||||
if (tknAmt == uint(-1)) {
|
if (tknAmt == uint(-1)) {
|
||||||
_burnAmt = _bal;
|
_burnAmt = _bal;
|
||||||
_tknAmt = wmul(_burnAmt, exchangeRate);
|
_tknAmt = wmul(_burnAmt, exchangeRate);
|
||||||
|
|
|
@ -117,14 +117,13 @@ contract PoolToken is ERC20, DSMath {
|
||||||
emit LogDeposit(tknAmt, _mintAmt);
|
emit LogDeposit(tknAmt, _mintAmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
function withdraw(uint tknAmt, address to) external returns (uint) {
|
function withdraw(uint tknAmt, address to) external returns (uint _tknAmt) {
|
||||||
require(!shutPool, "pool-shut");
|
require(!shutPool, "pool-shut");
|
||||||
uint poolBal = baseToken.balanceOf(address(this));
|
uint poolBal = baseToken.balanceOf(address(this));
|
||||||
require(tknAmt <= poolBal, "not-enough-liquidity-available");
|
require(tknAmt <= poolBal, "not-enough-liquidity-available");
|
||||||
uint _bal = balanceOf(msg.sender);
|
uint _bal = balanceOf(msg.sender);
|
||||||
uint _tknBal = wmul(_bal, exchangeRate);
|
uint _tknBal = wmul(_bal, exchangeRate);
|
||||||
uint _burnAmt;
|
uint _burnAmt;
|
||||||
uint _tknAmt;
|
|
||||||
if (tknAmt == uint(-1)) {
|
if (tknAmt == uint(-1)) {
|
||||||
_burnAmt = _bal;
|
_burnAmt = _bal;
|
||||||
_tknAmt = wmul(_burnAmt, exchangeRate);
|
_tknAmt = wmul(_burnAmt, exchangeRate);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user