Verified contractExactUNLICENSED
PauserProxy
Address0x10b1f36452e27f08b0b5747f577ff816b0e6b5fa
- Balance
0 ETH
- Transactions
21
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 1,000,000 runs
- EVM version
- cancun
- License
- UNLICENSED
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,159,393
- Creation transaction
- 0x5485d33797…1658b144d8
project/contracts/src/USG/Utilities/PauserProxy.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
import {LightOwnable} from "../Utilities/abstract/LightOwnable.sol";
import {IPauseSettings} from "../../interfaces/internals/USG/IPauseSettings.sol";
/// @title PauserProxy
/// @author Tangent Finance
/// @notice Batch pauser proxy for USG markets. Allows to pause / unpause ALL markets atomically.
contract PauserProxy is LightOwnable {
struct PauseMultiParams {
IPauseSettings market;
uint64 isDepositPaused;
uint64 isBorrowPaused;
uint64 isLeveragePaused;
}
/// @notice Tangent Internal EOA allowing to pause all markets
address public pauser;
/// @notice Hypernative EOA allowing to pause all markets
address public emergencyPauser;
constructor(address _admin, address _pauser, address _emergencyPauser) {
_transferOwnership(_admin);
pauser = _pauser;
emergencyPauser = _emergencyPauser;
}
event SetPauser(address _pauser);
event SetEmergencyPauser(address _emergencyPauser);
error NotAPauser();
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
OWNER ACTIONS
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-= */
/**
* @notice Pauses all 3 pausable features of the list of market provided
* @dev Callable by the emergencyPauser, pauser and admin
* @param markets Array of markets to fully pause
*/
function pauseAll(IPauseSettings[] calldata markets) external {
require(msg.sender == pauser || msg.sender == emergencyPauser || msg.sender == owner, NotAPauser());
uint256 marketsLen = markets.length;
for (uint256 i = 0; i < marketsLen; i++) {
IPauseSettings market = markets[i];
market.setPause(IPauseSettings.PauseEnum.DepositPaused, 1);
market.setPause(IPauseSettings.PauseEnum.BorrowPaused, 1);
market.setPause(IPauseSettings.PauseEnum.LeveragePaused, 1);
}
}
/**
* @notice Updates pausing parameters atomically for several markets in one tx.
* @dev Callable only by the owner. We don't want unpause to be exposed to an EOA.
* @param p Array of markets with new pausing configuration to set
*/
function manageMultiPausing(PauseMultiParams[] calldata p) external onlyOwner {
uint256 pLen = p.length;
for (uint256 i = 0; i < pLen; i++) {
IPauseSettings market = p[i].market;
market.setPause(IPauseSettings.PauseEnum.DepositPaused, p[i].isDepositPaused);
market.setPause(IPauseSettings.PauseEnum.BorrowPaused, p[i].isBorrowPaused);
market.setPause(IPauseSettings.PauseEnum.LeveragePaused, p[i].isLeveragePaused);
}
}
/**
* @notice Updates the pauser address
* @dev Callable only by the admin.
* @param _pauser New pausing executor
*/
function setPauser(address _pauser) external onlyOwner {
pauser = _pauser;
emit SetPauser(_pauser);
}
/**
* @notice Updates the emergency pauser address
* @dev Callable only by the admin.
* @param _emergencyPauser New emergency pauser
*/
function setEmergencyPauser(address _emergencyPauser) external onlyOwner {
emergencyPauser = _emergencyPauser;
emit SetEmergencyPauser(_emergencyPauser);
}
}
project/contracts/src/USG/Utilities/abstract/LightOwnable.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.22;
abstract contract LightOwnable {
address public owner;
error OwnableUnauthorizedAccount(address account);
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner != msg.sender) {
revert OwnableUnauthorizedAccount(msg.sender);
}
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = owner;
owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
project/contracts/src/interfaces/internals/USG/IPauseSettings.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IPauseSettings {
enum PauseEnum {
DepositPaused,
BorrowPaused,
LeveragePaused
}
function getPausedSettings() external view returns (uint64, uint64, uint64);
function setPause(PauseEnum pauseType, uint64 isPaused) external;
}
Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 1000000,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.