mirror of
https://github.com/Instadapp/yield-contract.git
synced 2024-07-29 21:47:29 +00:00
shut => pause
This commit is contained in:
parent
d6bac5f3ae
commit
e5d80f2a2c
|
@ -37,7 +37,7 @@ contract PoolToken is ERC20, DSMath {
|
||||||
event LogDeposit(uint depositAmt, uint poolMintAmt);
|
event LogDeposit(uint depositAmt, uint poolMintAmt);
|
||||||
event LogWithdraw(uint withdrawAmt, uint poolBurnAmt);
|
event LogWithdraw(uint withdrawAmt, uint poolBurnAmt);
|
||||||
event LogAddInsurance(uint amount);
|
event LogAddInsurance(uint amount);
|
||||||
event LogPoolShut(bool);
|
event LogPausePool(bool);
|
||||||
|
|
||||||
// IERC20 public immutable baseToken;
|
// IERC20 public immutable baseToken;
|
||||||
RegistryInterface public immutable registry; // Pool Registry
|
RegistryInterface public immutable registry; // Pool Registry
|
||||||
|
@ -48,7 +48,7 @@ contract PoolToken is ERC20, DSMath {
|
||||||
uint private tokenBalance; // total token balance since last rebalancing
|
uint private tokenBalance; // total token balance since last rebalancing
|
||||||
uint public exchangeRate = 10 ** 18; // initial 1 token = 1
|
uint public exchangeRate = 10 ** 18; // initial 1 token = 1
|
||||||
uint public insuranceAmt; // insurance amount to keep pool safe
|
uint public insuranceAmt; // insurance amount to keep pool safe
|
||||||
bool public shutPool; // shutdown deposits and withdrawals
|
bool public pausePool; // shutdown deposits and withdrawals
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
address _registry,
|
address _registry,
|
||||||
|
@ -104,7 +104,7 @@ contract PoolToken is ERC20, DSMath {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deposit(uint tknAmt) public payable returns(uint) {
|
function deposit(uint tknAmt) public payable returns(uint) {
|
||||||
require(!shutPool, "pool-shut");
|
require(!pausePool, "pool-shut");
|
||||||
require(tknAmt == msg.value, "unmatched-amount");
|
require(tknAmt == msg.value, "unmatched-amount");
|
||||||
uint _newTokenBal = add(tokenBalance, msg.value);
|
uint _newTokenBal = add(tokenBalance, msg.value);
|
||||||
require(_newTokenBal <= registry.poolCap(address(this)), "deposit-cap-reached");
|
require(_newTokenBal <= registry.poolCap(address(this)), "deposit-cap-reached");
|
||||||
|
@ -116,7 +116,7 @@ contract PoolToken is ERC20, DSMath {
|
||||||
}
|
}
|
||||||
|
|
||||||
function withdraw(uint tknAmt, address to) external returns (uint _tknAmt) {
|
function withdraw(uint tknAmt, address to) external returns (uint _tknAmt) {
|
||||||
require(!shutPool, "pool-shut");
|
require(!pausePool, "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);
|
||||||
|
@ -146,8 +146,8 @@ contract PoolToken is ERC20, DSMath {
|
||||||
|
|
||||||
function shutdown() external {
|
function shutdown() external {
|
||||||
require(msg.sender == instaIndex.master(), "not-master");
|
require(msg.sender == instaIndex.master(), "not-master");
|
||||||
shutPool = !shutPool;
|
pausePool = !pausePool;
|
||||||
emit LogPoolShut(shutPool);
|
emit LogPausePool(pausePool);
|
||||||
}
|
}
|
||||||
|
|
||||||
receive() external payable {}
|
receive() external payable {}
|
||||||
|
|
|
@ -37,7 +37,7 @@ contract PoolToken is ERC20, DSMath {
|
||||||
event LogDeposit(uint depositAmt, uint poolMintAmt);
|
event LogDeposit(uint depositAmt, uint poolMintAmt);
|
||||||
event LogWithdraw(uint withdrawAmt, uint poolBurnAmt);
|
event LogWithdraw(uint withdrawAmt, uint poolBurnAmt);
|
||||||
event LogAddInsurance(uint amount);
|
event LogAddInsurance(uint amount);
|
||||||
event LogPoolShut(bool);
|
event LogPausePool(bool);
|
||||||
|
|
||||||
IERC20 public immutable baseToken; // Base token. Eg:- DAI, USDC, etc.
|
IERC20 public immutable baseToken; // Base token. Eg:- DAI, USDC, etc.
|
||||||
RegistryInterface public immutable registry; // Pool Registry
|
RegistryInterface public immutable registry; // Pool Registry
|
||||||
|
@ -47,7 +47,7 @@ contract PoolToken is ERC20, DSMath {
|
||||||
uint private tokenBalance; // total token balance since last rebalancing
|
uint private tokenBalance; // total token balance since last rebalancing
|
||||||
uint public exchangeRate = 10 ** 18; // initial 1 token = 1
|
uint public exchangeRate = 10 ** 18; // initial 1 token = 1
|
||||||
uint public insuranceAmt; // insurance amount to keep pool safe
|
uint public insuranceAmt; // insurance amount to keep pool safe
|
||||||
bool public shutPool; // shutdown deposits and withdrawals
|
bool public pausePool; // shutdown deposits and withdrawals
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
address _registry,
|
address _registry,
|
||||||
|
@ -102,7 +102,7 @@ contract PoolToken is ERC20, DSMath {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deposit(uint tknAmt) external payable returns(uint) {
|
function deposit(uint tknAmt) external payable returns(uint) {
|
||||||
require(!shutPool, "pool-shut");
|
require(!pausePool, "pool-shut");
|
||||||
uint _newTokenBal = add(tokenBalance, tknAmt);
|
uint _newTokenBal = add(tokenBalance, tknAmt);
|
||||||
require(_newTokenBal <= registry.poolCap(address(this)), "deposit-cap-reached");
|
require(_newTokenBal <= registry.poolCap(address(this)), "deposit-cap-reached");
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ contract PoolToken is ERC20, DSMath {
|
||||||
}
|
}
|
||||||
|
|
||||||
function withdraw(uint tknAmt, address to) external returns (uint _tknAmt) {
|
function withdraw(uint tknAmt, address to) external returns (uint _tknAmt) {
|
||||||
require(!shutPool, "pool-shut");
|
require(!pausePool, "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);
|
||||||
|
@ -144,7 +144,7 @@ contract PoolToken is ERC20, DSMath {
|
||||||
|
|
||||||
function shutdown() external {
|
function shutdown() external {
|
||||||
require(msg.sender == instaIndex.master(), "not-master");
|
require(msg.sender == instaIndex.master(), "not-master");
|
||||||
shutPool = !shutPool;
|
pausePool = !pausePool;
|
||||||
emit LogPoolShut(shutPool);
|
emit LogPausePool(pausePool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user