-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SC-288] Add pause support and external authorized contract (#5)
* add in pause support * add wards * add pause spells and rename to execute() to be more generic * readme and doc fixing * fix readme * add integration tests for pause; add interface for execute-once spells and fix pragma * add multisig integration test * formating and naming fixes * more accurate prod env for integration test of spell * dont need extra role auth
- Loading branch information
Showing
11 changed files
with
846 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity >=0.8.0; | ||
|
||
interface IExecuteOnceSpell { | ||
|
||
/** | ||
* @dev Returns true if the spell has been executed. | ||
*/ | ||
function executed() external view returns (bool); | ||
|
||
/** | ||
* @dev Executes the spell. Can only be called once. | ||
*/ | ||
function execute() external; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity ^0.8.13; | ||
|
||
import { IExecuteOnceSpell } from "src/interfaces/IExecuteOnceSpell.sol"; | ||
import { ISparkLendFreezerMom } from "src/interfaces/ISparkLendFreezerMom.sol"; | ||
|
||
contract EmergencySpell_SparkLend_FreezeAllAssets { | ||
contract EmergencySpell_SparkLend_FreezeAllAssets is IExecuteOnceSpell { | ||
|
||
address public immutable sparkLendFreezerMom; | ||
|
||
bool public executed; | ||
bool public override executed; | ||
|
||
constructor(address sparklendFreezerMom_) { | ||
sparkLendFreezerMom = sparklendFreezerMom_; | ||
constructor(address sparkLendFreezerMom_) { | ||
sparkLendFreezerMom = sparkLendFreezerMom_; | ||
} | ||
|
||
function freeze() external { | ||
function execute() external override { | ||
require(!executed, "FreezeAllAssetsSpell/already-executed"); | ||
executed = true; | ||
ISparkLendFreezerMom(sparkLendFreezerMom).freezeAllMarkets(); | ||
ISparkLendFreezerMom(sparkLendFreezerMom).freezeAllMarkets(true); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity ^0.8.13; | ||
|
||
import { IExecuteOnceSpell } from "src/interfaces/IExecuteOnceSpell.sol"; | ||
import { ISparkLendFreezerMom } from "src/interfaces/ISparkLendFreezerMom.sol"; | ||
|
||
contract EmergencySpell_SparkLend_FreezeSingleAsset { | ||
contract EmergencySpell_SparkLend_FreezeSingleAsset is IExecuteOnceSpell { | ||
|
||
address public immutable sparkLendFreezerMom; | ||
address public immutable reserve; | ||
|
||
bool public executed; | ||
bool public override executed; | ||
|
||
constructor(address sparklendFreezerMom_, address reserve_) { | ||
sparkLendFreezerMom = sparklendFreezerMom_; | ||
constructor(address sparkLendFreezerMom_, address reserve_) { | ||
sparkLendFreezerMom = sparkLendFreezerMom_; | ||
reserve = reserve_; | ||
} | ||
|
||
function freeze() external { | ||
function execute() external override { | ||
require(!executed, "FreezeSingleAssetSpell/already-executed"); | ||
executed = true; | ||
ISparkLendFreezerMom(sparkLendFreezerMom).freezeMarket(reserve); | ||
ISparkLendFreezerMom(sparkLendFreezerMom).freezeMarket(reserve, true); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity ^0.8.13; | ||
|
||
import { IExecuteOnceSpell } from "src/interfaces/IExecuteOnceSpell.sol"; | ||
import { ISparkLendFreezerMom } from "src/interfaces/ISparkLendFreezerMom.sol"; | ||
|
||
contract EmergencySpell_SparkLend_PauseAllAssets is IExecuteOnceSpell { | ||
|
||
address public immutable sparkLendFreezerMom; | ||
|
||
bool public override executed; | ||
|
||
constructor(address sparkLendFreezerMom_) { | ||
sparkLendFreezerMom = sparkLendFreezerMom_; | ||
} | ||
|
||
function execute() external override { | ||
require(!executed, "PauseAllAssetsSpell/already-executed"); | ||
executed = true; | ||
ISparkLendFreezerMom(sparkLendFreezerMom).pauseAllMarkets(true); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity ^0.8.13; | ||
|
||
import { IExecuteOnceSpell } from "src/interfaces/IExecuteOnceSpell.sol"; | ||
import { ISparkLendFreezerMom } from "src/interfaces/ISparkLendFreezerMom.sol"; | ||
|
||
contract EmergencySpell_SparkLend_PauseSingleAsset is IExecuteOnceSpell { | ||
|
||
address public immutable sparkLendFreezerMom; | ||
address public immutable reserve; | ||
|
||
bool public override executed; | ||
|
||
constructor(address sparkLendFreezerMom_, address reserve_) { | ||
sparkLendFreezerMom = sparkLendFreezerMom_; | ||
reserve = reserve_; | ||
} | ||
|
||
function execute() external override { | ||
require(!executed, "PauseSingleAssetSpell/already-executed"); | ||
executed = true; | ||
ISparkLendFreezerMom(sparkLendFreezerMom).pauseMarket(reserve, true); | ||
} | ||
|
||
} |
Oops, something went wrong.