Skip to content

Commit

Permalink
Remove posaitionCount, from Registry, and add missing Distrust Posi…
Browse files Browse the repository at this point in the history
…tion Event
  • Loading branch information
crispymangoes committed Aug 8, 2023
1 parent 91ed760 commit a33838d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Registry.sol
Expand Up @@ -356,7 +356,13 @@ contract Registry is Ownable {
* @param isDebt bool indicating whether this position takes on debt or not
* @param adaptorData arbitrary bytes used to configure this position
*/
event PositionAdded(uint32 id, address adaptor, bool isDebt, bytes adaptorData);
event Registry__PositionTrusted(uint32 id, address adaptor, bool isDebt, bytes adaptorData);

/**
* @notice Emitted when a position is distrusted.
* @param id the positions id
*/
event Registry__PositionDistrusted(uint32 id);

/**
* @notice Attempted to trust a position not being used.
Expand Down Expand Up @@ -384,12 +390,6 @@ contract Registry is Ownable {
*/
uint256 public constant PRICE_ROUTER_REGISTRY_SLOT = 2;

/**
* @notice Stores the number of positions that have been added to the registry.
* Starts at 101.
*/
uint32 public positionCount = 100;

/**
* @notice Maps a position hash to a position Id.
* @dev can be used by adaptors to verify that a certain position is open during Cellar `callOnAdaptor` calls.
Expand Down Expand Up @@ -449,7 +449,7 @@ contract Registry is Ownable {
if (!priceRouter.isSupported(assets[i])) revert Registry__PositionPricingNotSetUp(address(assets[i]));
}

emit PositionAdded(positionId, adaptor, isDebt, adaptorData);
emit Registry__PositionTrusted(positionId, adaptor, isDebt, adaptorData);
}

/**
Expand All @@ -460,6 +460,7 @@ contract Registry is Ownable {
function distrustPosition(uint32 positionId) external onlyOwner {
if (!isPositionTrusted[positionId]) revert Registry__PositionIsNotTrusted(positionId);
isPositionTrusted[positionId] = false;
emit Registry__PositionDistrusted(positionId);
}

/**
Expand Down

0 comments on commit a33838d

Please sign in to comment.