View Source: contracts/ActivePool.sol
↗ Extends: CheckContract, IActivePool, ActivePoolStorage
ActivePool
The Active Pool holds the ETH collateral and ZUSD debt (but not ZUSD tokens) for all active troves.
When a trove is liquidated, it's ETH and ZUSD debt are transferred from the Active Pool, to either the Stability Pool, the Default Pool, or both, depending on the liquidation conditions.
Events
event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress);
event TroveManagerAddressChanged(address _newTroveManagerAddress);
event ActivePoolZUSDDebtUpdated(uint256 _ZUSDDebt);
event ActivePoolETHBalanceUpdated(uint256 _ETH);
- setAddresses(address _borrowerOperationsAddress, address _troveManagerAddress, address _stabilityPoolAddress, address _defaultPoolAddress)
- getETH()
- getZUSDDebt()
- sendETH(address _account, uint256 _amount)
- increaseZUSDDebt(uint256 _amount)
- decreaseZUSDDebt(uint256 _amount)
- _requireCallerIsBorrowerOperationsOrDefaultPool()
- _requireCallerIsBOorTroveMorSP()
- _requireCallerIsBOorTroveM()
- constructor()
initializer function that sets required addresses
function setAddresses(address _borrowerOperationsAddress, address _troveManagerAddress, address _stabilityPoolAddress, address _defaultPoolAddress) external nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
_borrowerOperationsAddress | address | BorrowerOperations contract address |
_troveManagerAddress | address | TroveManager contract address |
_stabilityPoolAddress | address | StabilityPool contract address |
_defaultPoolAddress | address | DefaultPool contract address |
Source Code
function setAddresses(
address _borrowerOperationsAddress,
address _troveManagerAddress,
address _stabilityPoolAddress,
address _defaultPoolAddress
) external onlyOwner {
checkContract(_borrowerOperationsAddress);
checkContract(_troveManagerAddress);
checkContract(_stabilityPoolAddress);
checkContract(_defaultPoolAddress);
borrowerOperationsAddress = _borrowerOperationsAddress;
troveManagerAddress = _troveManagerAddress;
stabilityPoolAddress = _stabilityPoolAddress;
defaultPoolAddress = _defaultPoolAddress;
emit BorrowerOperationsAddressChanged(_borrowerOperationsAddress);
emit TroveManagerAddressChanged(_troveManagerAddress);
emit StabilityPoolAddressChanged(_stabilityPoolAddress);
emit DefaultPoolAddressChanged(_defaultPoolAddress);
}
Not necessarily equal to the the contract's raw ETH balance - ether can be forcibly sent to contracts.
function getETH() external view
returns(uint256)
Source Code
function getETH() external view override returns (uint) {
return ETH;
}
function getZUSDDebt() external view
returns(uint256)
Source Code
function getZUSDDebt() external view override returns (uint) {
return ZUSDDebt;
}
Send ETH amount to given account. Updates ActivePool balance. Only callable by BorrowerOperations, TroveManager or StabilityPool.
function sendETH(address _account, uint256 _amount) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_account | address | account to receive the ETH amount |
_amount | uint256 | ETH amount to send |
Source Code
function sendETH(address _account, uint _amount) external override {
_requireCallerIsBOorTroveMorSP();
ETH = ETH.sub(_amount);
emit ActivePoolETHBalanceUpdated(ETH);
emit EtherSent(_account, _amount);
(bool success, ) = _account.call{value: _amount}("");
require(success, "ActivePool: sending ETH failed");
}
Increases ZUSD debt of the active pool. Only callable by BorrowerOperations, TroveManager or StabilityPool.
function increaseZUSDDebt(uint256 _amount) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_amount | uint256 | ZUSD amount to add to the pool debt |
Source Code
function increaseZUSDDebt(uint _amount) external override {
_requireCallerIsBOorTroveM();
ZUSDDebt = ZUSDDebt.add(_amount);
ActivePoolZUSDDebtUpdated(ZUSDDebt);
}
Decreases ZUSD debt of the active pool. Only callable by BorrowerOperations, TroveManager or StabilityPool.
function decreaseZUSDDebt(uint256 _amount) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
_amount | uint256 | ZUSD amount to sub to the pool debt |
Source Code
function decreaseZUSDDebt(uint _amount) external override {
_requireCallerIsBOorTroveMorSP();
ZUSDDebt = ZUSDDebt.sub(_amount);
ActivePoolZUSDDebtUpdated(ZUSDDebt);
}
function _requireCallerIsBorrowerOperationsOrDefaultPool() internal view
Source Code
function _requireCallerIsBorrowerOperationsOrDefaultPool() internal view {
require(
msg.sender == borrowerOperationsAddress || msg.sender == defaultPoolAddress,
"ActivePool: Caller is neither BO nor Default Pool"
);
}
function _requireCallerIsBOorTroveMorSP() internal view
Source Code
function _requireCallerIsBOorTroveMorSP() internal view {
require(
msg.sender == borrowerOperationsAddress ||
msg.sender == troveManagerAddress ||
msg.sender == stabilityPoolAddress,
"ActivePool: Caller is neither BorrowerOperations nor TroveManager nor StabilityPool"
);
}
function _requireCallerIsBOorTroveM() internal view
Source Code
function _requireCallerIsBOorTroveM() internal view {
require(
msg.sender == borrowerOperationsAddress || msg.sender == troveManagerAddress,
"ActivePool: Caller is neither BorrowerOperations nor TroveManager"
);
}
function () external payable
Source Code
receive() external payable {
_requireCallerIsBorrowerOperationsOrDefaultPool();
ETH = ETH.add(msg.value);
emit ActivePoolETHBalanceUpdated(ETH);
}
- ActivePool
- ActivePoolStorage
- BaseMath
- BorrowerOperations
- BorrowerOperationsScript
- BorrowerOperationsStorage
- BorrowerWrappersScript
- CheckContract
- CollSurplusPool
- CollSurplusPoolStorage
- console
- Context
- DefaultPool
- DefaultPoolStorage
- DocsCover
- DSAuth
- DSAuthEvents
- DSAuthority
- DSNote
- DSProxy
- DSProxyCache
- DSProxyFactory
- ERC20
- ETHTransferScript
- FeeDistributor
- FeeDistributorStorage
- GasPool
- HintHelpers
- HintHelpersStorage
- IActivePool
- IBalanceRedirectPresale
- IBorrowerOperations
- ICollSurplusPool
- IDefaultPool
- IERC20
- IERC2612
- IExternalPriceFeed
- IFeeDistributor
- IFeeSharingProxy
- ILiquityBase
- ILiquityBaseParams
- IMasset
- IMoCBaseOracle
- Initializable
- IPool
- IPriceFeed
- IRSKOracle
- ISortedTroves
- IStabilityPool
- ITroveManager
- IWrbtc
- IZUSDToken
- LiquityBase
- LiquityBaseParams
- LiquityMath
- LiquitySafeMath128
- MoCMedianizer
- MultiTroveGetter
- MultiTroveGetterStorage
- NueToken
- Ownable
- PriceFeed
- PriceFeedStorage
- ProxiableContract
- ProxiableContract2
- Proxy
- RskOracle
- SafeMath
- SortedTroves
- SortedTrovesStorage
- StabilityPool
- StabilityPoolScript
- StabilityPoolStorage
- Storage
- Storage2
- TokenScript
- TroveManager
- TroveManagerBase
- TroveManagerBase1MinuteBootstrap
- TroveManagerRedeemOps
- TroveManagerScript
- TroveManagerStorage
- UpgradableProxy
- ZUSDToken
- ZUSDTokenStorage