Skip to content

Commit

Permalink
69 audit depeg event can happen at incorrect price (#70)
Browse files Browse the repository at this point in the history
* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* audit: Controller.sol needs to implement TVL cant be zero

* total supply and modifier

* audit: timelock in admin functions of vault #66

* audit: getLatestPrice in event of triggerEndEpoch

* audit: Change the isDisaster modifier to revert when price of a pegged asset is equal to the strike price of a Vault

* epochHasEnded

* goerli deployment

* natspec comments

* add quick fix to test before PR refactoring

* 46 audit oracle outdated issues (#63)

* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* removed admin

* add assert to testOwnerAuthorize

* 39 audit controllersol needs to implement tvl cant be zero (#64)

* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* audit: Controller.sol needs to implement TVL cant be zero

* total supply and modifier

* allow rest only after epoch begins

* unused local var

* 66 audit timelock in admin functions of vault (#67)

* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* audit: Controller.sol needs to implement TVL cant be zero

* total supply and modifier

* audit: timelock in admin functions of vault #66

* 41 audit getlatestprice when calling endepoch with sequencer down does not end and epoch (#68)

* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* audit: Controller.sol needs to implement TVL cant be zero

* total supply and modifier

* audit: timelock in admin functions of vault #66

* audit: getLatestPrice in event of triggerEndEpoch

* epochHasEnded

* goerli deployment

* natspec comments

* add quick fix to test before PR refactoring

* 46 audit oracle outdated issues (#63)

* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* removed admin

* add assert to testOwnerAuthorize

* 39 audit controllersol needs to implement tvl cant be zero (#64)

* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* audit: Controller.sol needs to implement TVL cant be zero

* total supply and modifier

* allow rest only after epoch begins

* erased dup test

* 39 audit controllersol needs to implement tvl cant be zero (#64)

* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* audit: Controller.sol needs to implement TVL cant be zero

* total supply and modifier

* allow rest only after epoch begins

* 46 audit oracle outdated issues (#63)

* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* 39 audit controllersol needs to implement tvl cant be zero (#64)

* audit: remove approving of WETH when Depositing Eth

* audit: Vault.sol mapping to epochs is over

* natspec example

* synthax errors on compile

* useless onlyAdmin

* audit: Controller.sol needs to implement TVL cant be zero

* total supply and modifier

* allow rest only after epoch begins

* dup of trigger null epoch

Co-authored-by: 0xnexusflip <[email protected]>

* missing address

Co-authored-by: 0xnexusflip <[email protected]>
  • Loading branch information
MiguelBits and 0xnexusflip authored Sep 29, 2022
1 parent 402c6b4 commit 181025f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Controller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,12 @@ contract Controller {
int256 depegPrice
);

/* solhint-disable var-name-mixedcase */
struct VaultTVL {
uint256 RISK_claimTVL;
uint256 RISK_finalTVL;
uint256 INSR_claimTVL;
uint256 INSR_finalTVL;
}
/* solhint-enable var-name-mixedcase */

/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
Expand Down Expand Up @@ -107,7 +105,7 @@ contract Controller {
revert EpochNotExist();

if(
insrVault.strikePrice() < getLatestPrice(insrVault.tokenInsured())
insrVault.strikePrice() <= getLatestPrice(insrVault.tokenInsured())
)
revert PriceNotAtStrikePrice(getLatestPrice(insrVault.tokenInsured()));

Expand Down Expand Up @@ -236,6 +234,9 @@ contract Controller {
Vault insrVault = Vault(vaultsAddress[0]);
Vault riskVault = Vault(vaultsAddress[1]);

if(block.timestamp < insrVault.idEpochBegin(epochEnd))
revert EpochNotStarted();

if(insrVault.idExists(epochEnd) == false || riskVault.idExists(epochEnd) == false)
revert EpochNotExist();

Expand Down Expand Up @@ -274,6 +275,7 @@ contract Controller {
view
returns (int256 nowPrice)
{
uint observationFrequency = 1 hours;
(
,
/*uint80 roundId*/
Expand Down

0 comments on commit 181025f

Please sign in to comment.