Skip to content

Commit

Permalink
fix: Rename PoolConfigurator setter events
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmtzinf committed Dec 1, 2021
1 parent 0438cc7 commit 53b40ce
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 54 deletions.
44 changes: 12 additions & 32 deletions contracts/interfaces/IPoolConfigurator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,52 +53,32 @@ interface IPoolConfigurator {
);

/**
* @notice Emitted when stable rate borrowing is enabled on a reserve
* @notice Emitted when stable rate borrowing state is changed on a reserve
* @param asset The address of the underlying asset of the reserve
* @param enabled True if stable rate borrowing is enabled, false otherwise
**/
event StableRateEnabledOnReserve(address indexed asset);
event StableRateBorrowingOnReserve(address indexed asset, bool enabled);

/**
* @notice Emitted when stable rate borrowing is disabled on a reserve
* @notice Emitted when a reserve is activated or deactivated
* @param asset The address of the underlying asset of the reserve
* @param active True if reserve is active, false otherwise
**/
event StableRateDisabledOnReserve(address indexed asset);
event ReserveActive(address indexed asset, bool active);

/**
* @notice Emitted when a reserve is activated
* @notice Emitted when a reserve is frozen or unfrozen
* @param asset The address of the underlying asset of the reserve
* @param frozen True if reserve is frozen, false otherwise
**/
event ReserveActivated(address indexed asset);
event ReserveFrozen(address indexed asset, bool frozen);

/**
* @notice Emitted when a reserve is deactivated
* @notice Emitted when a reserve is paused or unpaused
* @param asset The address of the underlying asset of the reserve
* @param paused True if reserve is paused, false otherwise
**/
event ReserveDeactivated(address indexed asset);

/**
* @notice Emitted when a reserve is frozen
* @param asset The address of the underlying asset of the reserve
**/
event ReserveFrozen(address indexed asset);

/**
* @notice Emitted when a reserve is unfrozen
* @param asset The address of the underlying asset of the reserve
**/
event ReserveUnfrozen(address indexed asset);

/**
* @notice Emitted when a reserve is paused
* @param asset The address of the underlying asset of the reserve
**/
event ReservePaused(address indexed asset);

/**
* @notice Emitted when a reserve is unpaused
* @param asset The address of the underlying asset of the reserve
**/
event ReserveUnpaused(address indexed asset);
event ReservePaused(address indexed asset, bool paused);

/**
* @notice Emitted when a reserve is dropped
Expand Down
56 changes: 56 additions & 0 deletions contracts/interfaces/NewChainlink.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// 0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012
// AAVE / USD 8 0x547a514d5e3769680Ce22B2361c10Ea13619e8a9

interface AggregatorInterface {
function latestAnswer() external view returns (int256);

function latestTimestamp() external view returns (uint256);

function latestRound() external view returns (uint256);

function getAnswer(uint256 roundId) external view returns (int256);

function getTimestamp(uint256 roundId) external view returns (uint256);

event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);

event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
}

interface AggregatorV3Interface {
function decimals() external view returns (uint8);

function description() external view returns (string memory);

function version() external view returns (uint256);

// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);

function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}

interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {}
26 changes: 4 additions & 22 deletions contracts/protocol/pool/PoolConfigurator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,7 @@ contract PoolConfigurator is VersionedInitializable, IPoolConfigurator {
currentConfig.setStableRateBorrowingEnabled(enabled);
_pool.setConfiguration(asset, currentConfig.data);

if (enabled) {
emit StableRateEnabledOnReserve(asset);
} else {
emit StableRateDisabledOnReserve(asset);
}
emit StableRateBorrowingOnReserve(asset, enabled);
}

/// @inheritdoc IPoolConfigurator
Expand All @@ -201,23 +197,15 @@ contract PoolConfigurator is VersionedInitializable, IPoolConfigurator {
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
currentConfig.setActive(active);
_pool.setConfiguration(asset, currentConfig.data);
if (active) {
emit ReserveActivated(asset);
} else {
emit ReserveDeactivated(asset);
}
emit ReserveActive(asset, active);
}

/// @inheritdoc IPoolConfigurator
function setReseveFreeze(address asset, bool freeze) external override onlyRiskOrPoolAdmins {
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
currentConfig.setFrozen(freeze);
_pool.setConfiguration(asset, currentConfig.data);
if (freeze) {
emit ReserveFrozen(asset);
} else {
emit ReserveUnfrozen(asset);
}
emit ReserveFrozen(asset, freeze);
}

/// @inheritdoc IPoolConfigurator
Expand All @@ -236,14 +224,8 @@ contract PoolConfigurator is VersionedInitializable, IPoolConfigurator {
function setReservePause(address asset, bool paused) public override onlyEmergencyOrPoolAdmin {
DataTypes.ReserveConfigurationMap memory currentConfig = _pool.getConfiguration(asset);
currentConfig.setPaused(paused);

_pool.setConfiguration(asset, currentConfig.data);

if (paused) {
emit ReservePaused(asset);
} else {
emit ReserveUnpaused(asset);
}
emit ReservePaused(asset, paused);
}

/// @inheritdoc IPoolConfigurator
Expand Down

0 comments on commit 53b40ce

Please sign in to comment.