-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update coverage [skip ci] * Deploy cbBTC/USDC --------- Co-authored-by: Size <[email protected]>
- Loading branch information
Showing
18 changed files
with
5,980 additions
and
493 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ node_modules | |
# Crytic | ||
crytic-export | ||
echidna | ||
medusa |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,28 @@ | ||
{ | ||
"chainId": "8453", | ||
"commit": "f9f953a", | ||
"deployments": { | ||
"PriceFeed": "0x634160Ce49Fe29FC086E0B12230bD571c3A4858b", | ||
"Size-implementation": "0x94Afc4AfA15A4d3973fb02fc989de25D52aADD78", | ||
"Size-proxy": "0xB21Bbe052F5cE9ae681c59725f0A313765Fd016c" | ||
}, | ||
"networkConfiguration": "base-production-cbbtc-usdc", | ||
"parameters": { | ||
"borrowATokenCap": "1000000000000", | ||
"crLiquidation": "1300000000000000000", | ||
"crOpening": "1500000000000000000", | ||
"feeRecipient": "0x12328ea44ab6d7b18aa9cc030714763734b625db", | ||
"fragmentationFee": "1000000", | ||
"minimumCreditBorrowAToken": "10000000", | ||
"owner": "0x462b545e8bbb6f9e5860928748bfe9ecc712c3a7", | ||
"sequencerUptimeFeed": "0xbcf85224fc0756b9fa45aa7892530b47e10b6433", | ||
"underlyingBorrowToken": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", | ||
"underlyingBorrowTokenAggregator": "0x7e860098f58bbfc8648a4311b374b1d669a2bc6b", | ||
"underlyingBorrowTokenHeartbeat": "95040", | ||
"underlyingCollateralToken": "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf", | ||
"underlyingCollateralTokenAggregator": "0x07da0e54543a844a80abe69c8a12f22b3aa59f9d", | ||
"underlyingCollateralTokenHeartbeat": "95040", | ||
"variablePool": "0xa238dd80c259a72e81d7e4664a9801593f98d1c5", | ||
"weth": "0x4200000000000000000000000000000000000006" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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,82 @@ | ||
{ | ||
"fuzzing": { | ||
"workers": 10, | ||
"workerResetLimit": 50, | ||
"timeout": 0, | ||
"testLimit": 0, | ||
"callSequenceLength": 100, | ||
"corpusDirectory": "medusa", | ||
"coverageEnabled": true, | ||
"targetContracts": [ | ||
"CryticNonTransferrableScaledTokenDifferentialCryticTester" | ||
], | ||
"targetContractsBalances": [], | ||
"constructorArgs": {}, | ||
"deployerAddress": "0x30000", | ||
"senderAddresses": [ | ||
"0x10000", | ||
"0x20000", | ||
"0x30000" | ||
], | ||
"blockNumberDelayMax": 60480, | ||
"blockTimestampDelayMax": 604800, | ||
"blockGasLimit": 125000000, | ||
"transactionGasLimit": 12500000, | ||
"testing": { | ||
"stopOnFailedTest": true, | ||
"stopOnFailedContractMatching": true, | ||
"stopOnNoTests": true, | ||
"testAllContracts": false, | ||
"traceAll": false, | ||
"assertionTesting": { | ||
"enabled": true, | ||
"testViewMethods": false, | ||
"panicCodeConfig": { | ||
"failOnCompilerInsertedPanic": false, | ||
"failOnAssertion": true, | ||
"failOnArithmeticUnderflow": false, | ||
"failOnDivideByZero": false, | ||
"failOnEnumTypeConversionOutOfBounds": false, | ||
"failOnIncorrectStorageAccess": false, | ||
"failOnPopEmptyArray": false, | ||
"failOnOutOfBoundsArrayAccess": false, | ||
"failOnAllocateTooMuchMemory": false, | ||
"failOnCallUninitializedVariable": false | ||
} | ||
}, | ||
"propertyTesting": { | ||
"enabled": true, | ||
"testPrefixes": [ | ||
"property_" | ||
] | ||
}, | ||
"optimizationTesting": { | ||
"enabled": true, | ||
"testPrefixes": [ | ||
"optimize_" | ||
] | ||
} | ||
}, | ||
"chainConfig": { | ||
"codeSizeCheckDisabled": true, | ||
"cheatCodes": { | ||
"cheatCodesEnabled": true, | ||
"enableFFI": false | ||
} | ||
} | ||
}, | ||
"compilation": { | ||
"platform": "crytic-compile", | ||
"platformConfig": { | ||
"target": ".", | ||
"solcVersion": "", | ||
"exportDirectory": "", | ||
"args": ["--compile-libraries=(Errors,0x10),(UpdateConfig,0x11),(Deposit,0x12),(Withdraw,0x13),(Initialize,0x14),(Events,0x15),(Multicall,0x16),(DepositTokenLibrary,0x17),(OfferLibrary,0x18),(CapsLibrary,0x19),(LoanLibrary,0x1a),(RiskLibrary,0x1b),(LiquidateWithReplacement,0x1c),(Claim,0x1d),(Compensate,0x1e),(SellCreditLimit,0x1f),(BuyCreditMarket,0x20),(Liquidate,0x21),(Repay,0x22),(SellCreditMarket,0x23),(SelfLiquidate,0x24),(BuyCreditLimit,0x25),(SetUserConfiguration,0x26),(YieldCurveLibrary,0x27),(AccountingLibrary,0x28),(Math,0x29),(YieldCurveHelper,0x2a)","--foundry-compile-all"] | ||
} | ||
}, | ||
"logging": { | ||
"level": "info", | ||
"logDirectory": "", | ||
"noColor": false | ||
} | ||
} |
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
140 changes: 140 additions & 0 deletions
140
test/local/token/differential/CryticNonTransferrableScaledTokenDifferential.sol
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,140 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.23; | ||
|
||
import {IPool} from "@aave/interfaces/IPool.sol"; | ||
|
||
import {WadRayMath} from "@aave/protocol/libraries/math/WadRayMath.sol"; | ||
import {CryticAsserts} from "@chimera/CryticAsserts.sol"; | ||
import {vm} from "@chimera/Hevm.sol"; | ||
import {IERC20Metadata} from "@openzeppelin/contracts/interfaces/IERC20Metadata.sol"; | ||
import {NonTransferrableScaledToken} from "@src/token/NonTransferrableScaledToken.sol"; | ||
import {NonTransferrableScaledTokenV1} from "@test/local/token/differential/NonTransferrableScaledTokenV1.sol"; | ||
import {INonTransferrableScaledTokenCall} from | ||
"@test/local/token/differential/interfaces/INonTransferrableScaledTokenCall.sol"; | ||
import {INonTransferrableScaledTokenStaticcall} from | ||
"@test/local/token/differential/interfaces/INonTransferrableScaledTokenStaticcall.sol"; | ||
import {SimplePool} from "@test/local/token/differential/mocks/SimplePool.sol"; | ||
import {USDC} from "@test/mocks/USDC.sol"; | ||
|
||
// echidna . --contract CryticNonTransferrableScaledTokenDifferentialCryticTester --config echidna.yaml | ||
// medusa fuzz | ||
contract CryticNonTransferrableScaledTokenDifferentialCryticTester is CryticAsserts { | ||
string private constant ERROR = "ERROR"; | ||
|
||
NonTransferrableScaledTokenV1 private v1; | ||
NonTransferrableScaledToken private v2; | ||
USDC private underlying; | ||
IPool private pool; | ||
|
||
constructor() { | ||
underlying = new USDC(address(this)); | ||
pool = IPool(address(new SimplePool(WadRayMath.RAY))); | ||
v1 = new NonTransferrableScaledTokenV1( | ||
pool, | ||
IERC20Metadata(underlying), | ||
msg.sender, | ||
string.concat(underlying.name(), " Test"), | ||
string.concat(underlying.symbol(), " TEST"), | ||
underlying.decimals() | ||
); | ||
v2 = new NonTransferrableScaledToken( | ||
pool, | ||
IERC20Metadata(underlying), | ||
msg.sender, | ||
string.concat(underlying.name(), " Test"), | ||
string.concat(underlying.symbol(), " TEST"), | ||
underlying.decimals() | ||
); | ||
} | ||
|
||
// Helper function for regular calls | ||
function callFunction(address target1, address target2, bytes memory data) internal { | ||
vm.prank(msg.sender); | ||
(bool success1, bytes memory result1) = target1.call(data); | ||
|
||
vm.prank(msg.sender); | ||
(bool success2, bytes memory result2) = target2.call(data); | ||
|
||
t(success1 == success2, ERROR); | ||
if (success1) { | ||
t(keccak256(result1) == keccak256(result2), ERROR); | ||
} | ||
} | ||
|
||
function staticCallFunction(address target1, address target2, bytes memory data) internal { | ||
vm.prank(msg.sender); | ||
(bool success1, bytes memory result1) = target1.staticcall(data); | ||
|
||
vm.prank(msg.sender); | ||
(bool success2, bytes memory result2) = target2.staticcall(data); | ||
|
||
t(success1 == success2, ERROR); | ||
if (success1) { | ||
t(keccak256(result1) == keccak256(result2), ERROR); | ||
} | ||
} | ||
|
||
function mintScaled(address to, uint256 scaledAmount) external { | ||
callFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenCall.mintScaled, (to, scaledAmount)) | ||
); | ||
} | ||
|
||
function burnScaled(address from, uint256 scaledAmount) external { | ||
callFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenCall.burnScaled, (from, scaledAmount)) | ||
); | ||
} | ||
|
||
function transferFrom(address from, address to, uint256 value) external { | ||
callFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenCall.transferFrom, (from, to, value)) | ||
); | ||
} | ||
|
||
function transfer(address to, uint256 value) external { | ||
callFunction(address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenCall.transfer, (to, value))); | ||
} | ||
|
||
function approve(address spender, uint256 value) external { | ||
callFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenCall.approve, (spender, value)) | ||
); | ||
} | ||
|
||
function allowance(address owner, address spender) external { | ||
staticCallFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenStaticcall.allowance, (owner, spender)) | ||
); | ||
} | ||
|
||
function scaledBalanceOf(address account) external { | ||
staticCallFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenStaticcall.scaledBalanceOf, (account)) | ||
); | ||
} | ||
|
||
function balanceOf(address account) external { | ||
staticCallFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenStaticcall.balanceOf, (account)) | ||
); | ||
} | ||
|
||
function scaledTotalSupply() external { | ||
staticCallFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenStaticcall.scaledTotalSupply, ()) | ||
); | ||
} | ||
|
||
function totalSupply() external { | ||
staticCallFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenStaticcall.totalSupply, ()) | ||
); | ||
} | ||
|
||
function liquidityIndex() external { | ||
staticCallFunction( | ||
address(v1), address(v2), abi.encodeCall(INonTransferrableScaledTokenStaticcall.liquidityIndex, ()) | ||
); | ||
} | ||
} |
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