-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into colin@verif/mint-burn
- Loading branch information
Showing
11 changed files
with
301 additions
and
36 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,18 @@ | ||
{ | ||
"files": [ | ||
"src/MorphoTokenEthereum.sol" | ||
], | ||
"parametric_contracts": [ | ||
"MorphoTokenEthereum" | ||
], | ||
"solc": "solc-0.8.27", | ||
"verify": "MorphoTokenEthereum:certora/specs/RevertsERC20.spec", | ||
"rule_sanity": "basic", | ||
"server": "production", | ||
"packages": [ | ||
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts" | ||
], | ||
"loop_iter": "3", | ||
"optimistic_loop": true, | ||
"msg": "Morpho token ERC20 Reverts Ethereum" | ||
} |
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,18 @@ | ||
{ | ||
"files": [ | ||
"src/MorphoTokenOptimism.sol" | ||
], | ||
"parametric_contracts": [ | ||
"MorphoTokenOptimism" | ||
], | ||
"solc": "solc-0.8.27", | ||
"verify": "MorphoTokenOptimism:certora/specs/RevertsERC20.spec", | ||
"rule_sanity": "basic", | ||
"server": "production", | ||
"packages": [ | ||
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts" | ||
], | ||
"loop_iter": "3", | ||
"optimistic_loop": true, | ||
"msg": "Morpho token ERC20 Reverts Optimism" | ||
} |
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,18 @@ | ||
{ | ||
"files": [ | ||
"src/MorphoTokenEthereum.sol" | ||
], | ||
"parametric_contracts": [ | ||
"MorphoTokenEthereum" | ||
], | ||
"solc": "solc-0.8.27", | ||
"verify": "MorphoTokenEthereum:certora/specs/RevertsMintBurnEthereum.spec", | ||
"rule_sanity": "basic", | ||
"server": "production", | ||
"packages": [ | ||
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts" | ||
], | ||
"loop_iter": "3", | ||
"optimistic_loop": true, | ||
"msg": "Morpho token ERC20 Mint Burn Reverts" | ||
} |
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,18 @@ | ||
{ | ||
"files": [ | ||
"src/MorphoTokenOptimism.sol" | ||
], | ||
"parametric_contracts": [ | ||
"MorphoTokenOptimism" | ||
], | ||
"solc": "solc-0.8.27", | ||
"verify": "MorphoTokenOptimism:certora/specs/RevertsMintBurnOptimism.spec", | ||
"rule_sanity": "basic", | ||
"server": "production", | ||
"packages": [ | ||
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts" | ||
], | ||
"loop_iter": "3", | ||
"optimistic_loop": true, | ||
"msg": "Morpho token ERC20 Mint Burn Reverts" | ||
} |
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,54 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
methods { | ||
function totalSupply() external returns uint256 envfree; | ||
function balanceOf(address) external returns uint256 envfree; | ||
function allowance(address, address) external returns uint256 envfree; | ||
function delegatee(address) external returns address envfree; | ||
function delegatedVotingPower(address) external returns uint256 envfree; | ||
} | ||
|
||
// Check the revert conditions for the transfer function. | ||
rule transferRevertConditions(env e, address to, uint256 amount) { | ||
uint256 balanceOfSenderBefore = balanceOf(e.msg.sender); | ||
uint256 senderVotingPowerBefore = delegatedVotingPower(delegatee(e.msg.sender)); | ||
uint256 recipientVotingPowerBefore = delegatedVotingPower(delegatee(to)); | ||
|
||
// Safe require as it is verified in delegatedLTEqDelegateeVP. | ||
require senderVotingPowerBefore >= balanceOfSenderBefore; | ||
// Safe require that follows from sumOfTwoDelegatedVPLTEqTotalVP() and totalSupplyIsSumOfVirtualVotingPower(). | ||
require delegatee(to) != delegatee(e.msg.sender) => recipientVotingPowerBefore + senderVotingPowerBefore <= totalSupply(); | ||
|
||
transfer@withrevert(e, to, amount); | ||
assert lastReverted <=> e.msg.sender == 0 || to == 0 || balanceOfSenderBefore < amount || e.msg.value != 0; | ||
} | ||
|
||
// Check the revert conditions for the transferFrom function. | ||
rule transferFromRevertConditions(env e, address from, address to, uint256 amount) { | ||
uint256 allowanceOfSenderBefore = allowance(from, e.msg.sender); | ||
uint256 balanceOfHolderBefore = balanceOf(from); | ||
uint256 holderVotingPowerBefore = delegatedVotingPower(delegatee(from)); | ||
uint256 recipientVotingPowerBefore = delegatedVotingPower(delegatee(to)); | ||
|
||
// Safe require as it is verified in delegatedLTEqDelegateeVP. | ||
require holderVotingPowerBefore >= balanceOfHolderBefore; | ||
// Safe require that follows from sumOfTwoDelegatedVPLTEqTotalVP() and totalSupplyIsSumOfVirtualVotingPower(). | ||
require delegatee(to) != delegatee(from) => recipientVotingPowerBefore + holderVotingPowerBefore <= totalSupply(); | ||
|
||
transferFrom@withrevert(e, from, to, amount); | ||
|
||
bool generalRevertConditions = from == 0 || to == 0 || balanceOfHolderBefore < amount || e.msg.value != 0; | ||
|
||
if (allowanceOfSenderBefore != max_uint256) { | ||
assert lastReverted <=> e.msg.sender == 0 || allowanceOfSenderBefore < amount || generalRevertConditions; | ||
} else { | ||
assert lastReverted <=> generalRevertConditions; | ||
} | ||
|
||
} | ||
|
||
// Check the revert conditions for the approve function. | ||
rule approveRevertConditions(env e, address to, uint256 value) { | ||
approve@withrevert(e, to, value); | ||
assert lastReverted <=> e.msg.sender == 0 || to == 0 || e.msg.value != 0; | ||
} |
Oops, something went wrong.