-
Notifications
You must be signed in to change notification settings - Fork 45
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 kptk/new-collector
- Loading branch information
Showing
24 changed files
with
770 additions
and
6 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ lib | |
cache | ||
node_modules | ||
report | ||
snapshots |
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
Binary file added
BIN
+1.09 MB
audits/2024-12-05_MixBytes_AaveStataToken(watoken)SecurityAuditReport.pdf
Binary file not shown.
Submodule forge-std
updated
24 files
+193 −0 | CONTRIBUTING.md | |
+17 −1 | README.md | |
+1 −1 | package.json | |
+12 −1 | scripts/vm.py | |
+4 −0 | src/StdChains.sol | |
+5 −5 | src/StdCheats.sol | |
+104 −0 | src/StdJson.sol | |
+1 −1 | src/StdStorage.sol | |
+104 −0 | src/StdToml.sol | |
+534 −77 | src/Vm.sol | |
+471 −463 | src/console.sol | |
+2 −2 | src/interfaces/IERC4626.sol | |
+693 −4 | src/safeconsole.sol | |
+1 −1 | test/StdAssertions.t.sol | |
+16 −15 | test/StdChains.t.sol | |
+10 −10 | test/StdCheats.t.sol | |
+12 −12 | test/StdError.t.sol | |
+1 −1 | test/StdJson.t.sol | |
+4 −14 | test/StdMath.t.sol | |
+13 −5 | test/StdStorage.t.sol | |
+1 −1 | test/StdStyle.t.sol | |
+1 −1 | test/StdToml.t.sol | |
+12 −12 | test/StdUtils.t.sol | |
+9 −6 | test/Vm.t.sol |
Submodule solidity-utils
updated
9 files
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,11 @@ | ||
{ | ||
"full amount; receiver: ->enableCollateral": "144837", | ||
"full amount; sender: ->disableCollateral;": "103274", | ||
"full amount; sender: ->disableCollateral; receiver: ->enableCollateral": "145016", | ||
"full amount; sender: ->disableCollateral; receiver: dirty, ->enableCollateral": "133059", | ||
"full amount; sender: collateralDisabled": "103095", | ||
"partial amount; sender: collateralDisabled;": "103095", | ||
"partial amount; sender: collateralDisabled; receiver: ->enableCollateral": "144837", | ||
"partial amount; sender: collateralEnabled;": "103303", | ||
"partial amount; sender: collateralEnabled; receiver: ->enableCollateral": "145045" | ||
} |
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,10 @@ | ||
{ | ||
"getEModeCategoryCollateralConfig": "8000", | ||
"getEModeCategoryData": "13430", | ||
"getLiquidationGracePeriod": "29197", | ||
"getReserveData": "34935", | ||
"getUserAccountData: supplies: 0, borrows: 0": "22641", | ||
"getUserAccountData: supplies: 1, borrows: 0": "34774", | ||
"getUserAccountData: supplies: 2, borrows: 0": "47296", | ||
"getUserAccountData: supplies: 2, borrows: 1": "28968" | ||
} |
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,15 @@ | ||
{ | ||
"borrow: first borrow->borrowingEnabled": "256189", | ||
"borrow: recurrent borrow": "248474", | ||
"liquidationCall: deficit on liquidated asset": "392266", | ||
"liquidationCall: deficit on liquidated asset + other asset": "422243", | ||
"liquidationCall: full liquidation": "392266", | ||
"liquidationCall: partial liquidation": "381149", | ||
"repay: full repay": "176547", | ||
"repay: partial repay": "189971", | ||
"supply: collateralDisabled": "146829", | ||
"supply: collateralEnabled": "146829", | ||
"supply: first supply->collateralEnabled": "176387", | ||
"withdraw: full withdraw": "165303", | ||
"withdraw: partial withdraw": "181992" | ||
} |
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,6 @@ | ||
{ | ||
"setUserEMode: enter eMode, 1 borrow, 1 supply": "140164", | ||
"setUserEMode: leave eMode, 1 borrow, 1 supply": "112199", | ||
"setUserUseReserveAsCollateral: disableCollateral, 1 supply": "93434", | ||
"setUserUseReserveAsCollateral: enableCollateral, 1 supply": "105145" | ||
} |
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 @@ | ||
{ | ||
"getATokenTotalSupply": "57882", | ||
"getFlashLoanEnabled": "16717", | ||
"getInterestRateStrategyAddress": "43034", | ||
"getIsVirtualAccActive": "16767", | ||
"getLiquidationProtocolFee": "16766", | ||
"getPaused": "16855", | ||
"getReserveCaps": "16767", | ||
"getReserveConfigurationData": "17181", | ||
"getReserveTokensAddresses": "43054", | ||
"getSiloedBorrowing": "16770", | ||
"getTotalDebt": "57882", | ||
"getUnbackedMintCap": "16721", | ||
"getUserReserveData": "32363", | ||
"getVirtualUnderlyingBalance": "16533" | ||
} |
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,6 @@ | ||
{ | ||
"deposit": "284677", | ||
"depositATokens": "220136", | ||
"redeem": "205767", | ||
"redeemAToken": "153413" | ||
} |
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,6 @@ | ||
{ | ||
"borrowETH": "250143", | ||
"depositETH": "222665", | ||
"repayETH": "205774", | ||
"withdrawETH": "269647" | ||
} |
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
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,145 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
|
||
import 'forge-std/Test.sol'; | ||
|
||
import {IAToken} from '../../src/contracts/interfaces/IAToken.sol'; | ||
import {Errors} from '../../src/contracts/protocol/libraries/helpers/Errors.sol'; | ||
import {Testhelpers, IERC20} from './Testhelpers.sol'; | ||
|
||
/** | ||
* Scenario suite for transfer operations. | ||
*/ | ||
contract ATokenTransfer_gas_Tests is Testhelpers { | ||
address token; | ||
IAToken aToken; | ||
address variableDebtToken; | ||
|
||
address sender = makeAddr('sender'); | ||
address receiver = makeAddr('receiver'); | ||
|
||
function setUp() public override { | ||
super.setUp(); | ||
token = tokenList.usdx; | ||
(address aTokenAddress, , address variableDebtTokenAddress) = contracts | ||
.protocolDataProvider | ||
.getReserveTokensAddresses(tokenList.usdx); | ||
aToken = IAToken(aTokenAddress); | ||
variableDebtToken = variableDebtTokenAddress; | ||
} | ||
|
||
function test_transfer_fullAmount() external { | ||
_supplyOnReserve(sender, 1 ether); | ||
vm.prank(sender); | ||
|
||
_skip(100); | ||
|
||
aToken.transfer(receiver, 1 ether); | ||
vm.snapshotGasLastCall( | ||
'AToken.transfer', | ||
'full amount; sender: ->disableCollateral; receiver: ->enableCollateral' | ||
); | ||
} | ||
|
||
function test_transfer_fullAmount_dirtyReceiver() external { | ||
_supplyOnReserve(receiver, 1 ether, tokenList.weth); | ||
_supplyOnReserve(sender, 1 ether); | ||
vm.prank(sender); | ||
|
||
_skip(100); | ||
|
||
aToken.transfer(receiver, 1 ether); | ||
vm.snapshotGasLastCall( | ||
'AToken.transfer', | ||
'full amount; sender: ->disableCollateral; receiver: dirty, ->enableCollateral' | ||
); | ||
} | ||
|
||
function test_transfer_fullAmount_senderCollateralDisabled() external { | ||
_supplyOnReserve(sender, 1 ether); | ||
vm.startPrank(sender); | ||
contracts.poolProxy.setUserUseReserveAsCollateral(token, false); | ||
|
||
_skip(100); | ||
|
||
aToken.transfer(receiver, 1 ether); | ||
vm.snapshotGasLastCall('AToken.transfer', 'full amount; receiver: ->enableCollateral'); | ||
} | ||
|
||
function test_transfer_fullAmount_senderCollateralDisabled_receiverNonZeroFunds2() external { | ||
_supplyOnReserve(sender, 1 ether); | ||
_supplyOnReserve(receiver, 1 ether); | ||
vm.startPrank(sender); | ||
|
||
_skip(100); | ||
|
||
aToken.transfer(receiver, 1 ether); | ||
vm.snapshotGasLastCall('AToken.transfer', 'full amount; sender: ->disableCollateral;'); | ||
} | ||
|
||
function test_transfer_fullAmount_senderCollateralDisabled_receiverNonZeroFunds() external { | ||
_supplyOnReserve(sender, 1 ether); | ||
_supplyOnReserve(receiver, 1 ether); | ||
vm.startPrank(sender); | ||
contracts.poolProxy.setUserUseReserveAsCollateral(token, false); | ||
|
||
_skip(100); | ||
|
||
aToken.transfer(receiver, 1 ether); | ||
vm.snapshotGasLastCall('AToken.transfer', 'full amount; sender: collateralDisabled'); | ||
} | ||
|
||
function test_transfer_partialAmount_senderCollateralEnabled() external { | ||
_supplyOnReserve(sender, 1 ether); | ||
vm.startPrank(sender); | ||
|
||
_skip(100); | ||
|
||
aToken.transfer(receiver, 0.5 ether); | ||
vm.snapshotGasLastCall( | ||
'AToken.transfer', | ||
'partial amount; sender: collateralEnabled; receiver: ->enableCollateral' | ||
); | ||
} | ||
|
||
function test_transfer_partialAmount_senderCollateralEnabled_receiverNonZeroFunds() external { | ||
_supplyOnReserve(sender, 1 ether); | ||
_supplyOnReserve(receiver, 1 ether); | ||
vm.startPrank(sender); | ||
|
||
_skip(100); | ||
|
||
aToken.transfer(receiver, 0.5 ether); | ||
vm.snapshotGasLastCall('AToken.transfer', 'partial amount; sender: collateralEnabled;'); | ||
} | ||
|
||
function test_transfer_partialAmount_receiverNonZeroFunds() external { | ||
_supplyOnReserve(sender, 1 ether); | ||
_supplyOnReserve(receiver, 1 ether); | ||
vm.startPrank(sender); | ||
contracts.poolProxy.setUserUseReserveAsCollateral(token, false); | ||
|
||
_skip(100); | ||
|
||
aToken.transfer(receiver, 0.5 ether); | ||
vm.snapshotGasLastCall('AToken.transfer', 'partial amount; sender: collateralDisabled;'); | ||
} | ||
|
||
function test_transfer_partialAmount() external { | ||
_supplyOnReserve(sender, 1 ether); | ||
vm.startPrank(sender); | ||
contracts.poolProxy.setUserUseReserveAsCollateral(token, false); | ||
|
||
_skip(100); | ||
|
||
aToken.transfer(receiver, 0.5 ether); | ||
vm.snapshotGasLastCall( | ||
'AToken.transfer', | ||
'partial amount; sender: collateralDisabled; receiver: ->enableCollateral' | ||
); | ||
} | ||
|
||
function _supplyOnReserve(address user, uint256 amount) internal { | ||
_supplyOnReserve(user, amount, token); | ||
} | ||
} |
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,67 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
|
||
import 'forge-std/Test.sol'; | ||
|
||
import {Errors} from '../../src/contracts/protocol/libraries/helpers/Errors.sol'; | ||
import {UserConfiguration} from '../../src/contracts/protocol/libraries/configuration/UserConfiguration.sol'; | ||
import {Testhelpers, IERC20} from './Testhelpers.sol'; | ||
|
||
/** | ||
* Scenario suite for pool getter operations. | ||
*/ | ||
contract PoolGetters_gas_Tests is Testhelpers { | ||
// mock users to supply and borrow liquidity | ||
address user = makeAddr('user'); | ||
|
||
function test_getReserveData() external { | ||
contracts.poolProxy.getReserveData(tokenList.usdx); | ||
vm.snapshotGasLastCall('Pool.Getters', 'getReserveData'); | ||
} | ||
|
||
function test_getUserAccountData() external { | ||
contracts.poolProxy.getUserAccountData(user); | ||
vm.snapshotGasLastCall('Pool.Getters', 'getUserAccountData: supplies: 0, borrows: 0'); | ||
} | ||
|
||
function test_getUserAccountData_oneSupplies() external { | ||
_supplyOnReserve(user, 1 ether, tokenList.usdx); | ||
contracts.poolProxy.getUserAccountData(user); | ||
vm.snapshotGasLastCall('Pool.Getters', 'getUserAccountData: supplies: 1, borrows: 0'); | ||
} | ||
|
||
function test_getUserAccountData_twoSupplies() external { | ||
_supplyOnReserve(user, 1 ether, tokenList.usdx); | ||
_supplyOnReserve(user, 1 ether, tokenList.weth); | ||
|
||
contracts.poolProxy.getUserAccountData(user); | ||
vm.snapshotGasLastCall('Pool.Getters', 'getUserAccountData: supplies: 2, borrows: 0'); | ||
} | ||
|
||
function test_getUserAccountData_twoSupplies_oneBorrows() external { | ||
_supplyOnReserve(user, 1 ether, tokenList.usdx); | ||
_supplyOnReserve(user, 1 ether, tokenList.weth); | ||
|
||
_supplyOnReserve(address(1), 0.001e8, tokenList.wbtc); | ||
vm.prank(user); | ||
contracts.poolProxy.borrow(tokenList.wbtc, 0.001e8, 2, 0, user); | ||
|
||
contracts.poolProxy.getUserAccountData(user); | ||
vm.snapshotGasLastCall('Pool.Getters', 'getUserAccountData: supplies: 2, borrows: 1'); | ||
} | ||
|
||
function test_getEModeCategoryData() external { | ||
contracts.poolProxy.getEModeCategoryData(1); | ||
vm.snapshotGasLastCall('Pool.Getters', 'getEModeCategoryData'); | ||
} | ||
|
||
function test_getEModeCategoryCollateralConfig() external { | ||
contracts.poolProxy.getEModeCategoryCollateralConfig(1); | ||
vm.snapshotGasLastCall('Pool.Getters', 'getEModeCategoryCollateralConfig'); | ||
} | ||
|
||
function test_getLiquidationGracePeriod() external { | ||
contracts.poolProxy.getLiquidationGracePeriod(tokenList.usdx); | ||
vm.snapshotGasLastCall('Pool.Getters', 'getLiquidationGracePeriod'); | ||
} | ||
} |
Oops, something went wrong.