Skip to content

Commit

Permalink
reverted fathom bridge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrbch committed Oct 24, 2024
1 parent dd17c55 commit 490551f
Show file tree
Hide file tree
Showing 16 changed files with 5 additions and 1,219 deletions.
2 changes: 1 addition & 1 deletion add-collateral.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"51":{"tokenAddress":"0x0000000000000000000000000000000000000000","testOracle":"0x0000000000000000000000000000000000000000","fathomProxyFactory":"0x0000000000000000000000000000000000000000","fathomProxyAdmin":"0x0000000000000000000000000000000000000000"},"31337":{"tokenAddress":"0x828e4F72BC7B912f6Fde900071212aAA075BBd22","testOracle":"0x0dC763b6a547deb5ED263cdf26B5e4D456989582","fathomProxyFactory":"0x28c6408131836B0f1Adbae443b65B76487723C4b","fathomProxyAdmin":"0xc38d2D6bc857129aAAd365eDae5f7f286f4Ce994"},"token":"GLD"}
{"51":{"tokenAddress":"0x0000000000000000000000000000000000000000","testOracle":"0x0000000000000000000000000000000000000000","fathomProxyFactory":"0x0000000000000000000000000000000000000000","fathomProxyAdmin":"0x0000000000000000000000000000000000000000"},"31337":{"tokenAddress":"0x22879cD092f74aBA6d198B053f25b7e26BBbd5Da","testOracle":"0x828e4F72BC7B912f6Fde900071212aAA075BBd22","fathomProxyFactory":"0x13cdf6cA2C1c216198FB51A4c515FDa6F11B9dE0","fathomProxyAdmin":"0x28c6408131836B0f1Adbae443b65B76487723C4b"},"token":"GLD"}
511 changes: 0 additions & 511 deletions contracts/main/bridge/AsterizmClientUpgradeableTransparency.sol

This file was deleted.

159 changes: 0 additions & 159 deletions contracts/main/bridge/FathomBridge.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/main/interfaces/IBookKeeper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface IBookKeeper {
int256 _debtShare
) external;

function totalStablecoinIssued() external view returns (uint256);
function totalStablecoinIssued() external returns (uint256);

function moveStablecoin(
address _src,
Expand Down
33 changes: 0 additions & 33 deletions contracts/main/interfaces/IFathomBridge.sol

This file was deleted.

32 changes: 1 addition & 31 deletions contracts/main/stablecoin-core/ShowStopper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "../interfaces/ILiquidationEngine.sol";
import "../interfaces/IPriceFeed.sol";
import "../interfaces/IPriceOracle.sol";
import "../interfaces/ISystemDebtEngine.sol";
import "../interfaces/IFathomBridge.sol";
import "../interfaces/ICagable.sol";
import "../utils/CommonMath.sol";

Expand Down Expand Up @@ -39,8 +38,6 @@ contract ShowStopper is CommonMath, IShowStopper, PausableUpgradeable {
mapping(address => uint256) public stablecoinAccumulator; // [wad]
mapping(bytes32 => mapping(address => uint256)) public redeemedStablecoinAmount; // [wad]

IFathomBridge public fathomBridge;

event LogCage(uint256 _cageCoolDown);
event LogCageCollateralPool(bytes32 indexed _collateralPoolId);

Expand All @@ -55,7 +52,6 @@ contract ShowStopper is CommonMath, IShowStopper, PausableUpgradeable {
event LogSetLiquidationEngine(address indexed _caller, address _liquidationEngine);
event LogSetSystemDebtEngine(address indexed _caller, address _systemDebtEngine);
event LogSetPriceOracle(address indexed _caller, address _priceOracle);
event LogSetFathomBridge(address indexed _caller, address _fathomBridge);
event LogSetCageCoolDown(address indexed _caller, uint256 _cageCoolDown);

modifier onlyOwner() {
Expand Down Expand Up @@ -103,12 +99,6 @@ contract ShowStopper is CommonMath, IShowStopper, PausableUpgradeable {
emit LogSetPriceOracle(msg.sender, _priceOracle);
}

function setFathomBridge(address _fathomBridge) external onlyOwner {
require(live == 1, "ShowStopper/not-live");
fathomBridge = IFathomBridge(_fathomBridge);
emit LogSetFathomBridge(msg.sender, _fathomBridge);
}

/// @notice Initiates the process of emergency shutdown (cage).
/// @dev This function can only be called by the contract owner.
/// @param _cageCoolDown Length of the cooldown period for the emergency shutdown, in seconds.
Expand Down Expand Up @@ -183,8 +173,7 @@ contract ShowStopper is CommonMath, IShowStopper, PausableUpgradeable {
require(debt == 0, "ShowStopper/debt-not-zero");
require(bookKeeper.stablecoin(address(systemDebtEngine)) == 0, "ShowStopper/surplus-not-zero");
require(block.timestamp >= cagedTimestamp + cageCoolDown, "ShowStopper/cage-cool-down-not-finished");
_cageBridge();
debt = _finalizeDebt();
debt = bookKeeper.totalStablecoinIssued();
emit LogFinalizeDebt();
}

Expand Down Expand Up @@ -258,25 +247,6 @@ contract ShowStopper is CommonMath, IShowStopper, PausableUpgradeable {
emit LogRedeemLockedCollateral(_collateralPoolId, _collateralReceiver, _lockedCollateralAmount);
}

function _finalizeDebt() internal view returns (uint256){
uint256 _totalBridgedInAmount = fathomBridge.totalBridgedInAmount() * RAY;
uint256 _totalBridgedOutAmount = fathomBridge.totalBridgedOutAmount() * RAY;
uint256 _debt = bookKeeper.totalStablecoinIssued();
if (_totalBridgedInAmount > _totalBridgedOutAmount) {
return _debt + _totalBridgedInAmount - _totalBridgedOutAmount;
} else if (_totalBridgedInAmount < _totalBridgedOutAmount) {
return _debt - (_totalBridgedOutAmount - _totalBridgedInAmount);
} else {
return _debt;
}
}

function _cageBridge() internal {
if (address(fathomBridge) != address(0)) {
ICagable(address(fathomBridge)).cage();
}
}

function _safeToInt256(uint256 _number) internal pure returns (int256) {
require(int256(_number) >= 0, "ShowStopper/overflow");
return int256(_number);
Expand Down
Loading

0 comments on commit 490551f

Please sign in to comment.