Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
228 commits
Select commit Hold shift + click to select a range
ee65afb
current dev
MishaShWoof Jul 25, 2025
7e08ec9
fix: working dev
MishaShWoof Jul 25, 2025
2bb3587
fix: scenarios
MishaShWoof Jul 28, 2025
9f5564c
fix
MishaShWoof Jul 28, 2025
88fe803
fix
MishaShWoof Jul 28, 2025
8b5ee76
Update index.ts
MishaShWoof Jul 28, 2025
700a4c6
Update DeploymentManager.ts
MishaShWoof Jul 29, 2025
4cbf863
fix: unit tests
MishaShWoof Aug 14, 2025
2bc2dbf
fix: working linea scenarios and prepare workflow fix
MishaShWoof Aug 20, 2025
0313418
Merge branch 'main' of github.com:woof-software/comet into develop
MishaShWoof Sep 16, 2025
688d515
fix: remove linea markets from dev
MishaShWoof Sep 16, 2025
df8d724
fix: remove localhost deployment
MishaShWoof Sep 19, 2025
0001bd6
fix: unify import
MishaShWoof Sep 22, 2025
d04a40d
Merge branch 'main' of github.com:woof-software/comet into develop
MishaShWoof Sep 25, 2025
c4eb7e4
feat: Added extended pause feature
VladyslavPerederWoof Oct 24, 2025
11589ce
fix: Correct asset index validation in CometExt contract
VladyslavPerederWoof Oct 24, 2025
b12c80a
refactore: Removed function for getting index of asset
VladyslavPerederWoof Oct 24, 2025
ffea781
feat: Add functions to check collateral transfer and withdrawal pause…
VladyslavPerederWoof Oct 24, 2025
cfba488
test: Added tests for extended pause logic
VladyslavPerederWoof Oct 24, 2025
2c8fb4f
test: Implement scenarios for withdrawal pause conditions and fund ad…
VladyslavPerederWoof Oct 24, 2025
8ba8c0c
test: Add scenarios for handling paused supply and transfer condition…
VladyslavPerederWoof Oct 24, 2025
15604ec
test: Add setupFork function for mainnet forking in tests
VladyslavPerederWoof Oct 27, 2025
6b17062
test: Remove exclusive focus from extended pause functionality tests
VladyslavPerederWoof Oct 27, 2025
d33db9a
test: Add comprehensive tests for extended pause upgrade scenarios
VladyslavPerederWoof Oct 27, 2025
e1a72c1
chore: Added natspec docs for added functions, errors, variables and …
VladyslavPerederWoof Oct 27, 2025
4446f59
test: Reworked tests structure and logic
VladyslavPerederWoof Oct 28, 2025
b7558f1
test: Simplify event extraction in extended pause upgrade test
VladyslavPerederWoof Oct 28, 2025
bceff9a
test: Refactor extended pause test structure and remove unused variables
VladyslavPerederWoof Oct 28, 2025
4347303
fix: Review fixes
VladyslavPerederWoof Oct 29, 2025
852226c
fix: added skip logic for zero collateral factors
VladyslavPerederWoof Nov 5, 2025
bf51327
test: added tests for skip collateral factors logic
VladyslavPerederWoof Nov 5, 2025
4ee3754
test: fixed tests for supply
VladyslavPerederWoof Nov 6, 2025
f96c266
test: fixed tests for supply and transfer
VladyslavPerederWoof Nov 6, 2025
b47d0e1
fix: review fixes
VladyslavPerederWoof Nov 6, 2025
b5f5cdb
fix: lint fixes
VladyslavPerederWoof Nov 6, 2025
883b6c8
test: test fixes
VladyslavPerederWoof Nov 10, 2025
5177225
chore: added natspec for tests
VladyslavPerederWoof Nov 11, 2025
d93806d
chore: removed scenario
VladyslavPerederWoof Nov 11, 2025
2621df6
Merge branch 'main' of github.com:woof-software/comet into develop
MishaShWoof Nov 11, 2025
aceaf43
fixes from recent prs
MishaShWoof Nov 11, 2025
63e198b
chore: added scenarios
VladyslavPerederWoof Nov 11, 2025
d96232b
Merge branch develop into fix/avoid-pricefeed-paralysis
VladyslavPerederWoof Nov 11, 2025
e01e9c3
chore: added new scenarious
VladyslavPerederWoof Nov 11, 2025
1662266
fix: initialize loop variable in asset iteration
VladyslavPerederWoof Nov 11, 2025
534a449
chore: added descriptions for scenarious
VladyslavPerederWoof Nov 11, 2025
df2dbbf
chore: removed unused variables
VladyslavPerederWoof Nov 11, 2025
58f05d7
refactor: update getLiquidityWithLiquidateCF function signature and a…
VladyslavPerederWoof Nov 11, 2025
1f2f885
fix: fixes
VladyslavPerederWoof Nov 11, 2025
88963e5
chore: remove unused dependency @nomicfoundation/hardhat-network-help…
VladyslavPerederWoof Nov 11, 2025
9bab7ee
chore: add @nomicfoundation/hardhat-network-helpers dependency to har…
VladyslavPerederWoof Nov 11, 2025
6f4a76f
feat: added custom snapshot
VladyslavPerederWoof Nov 11, 2025
3f9caef
fix: change base rpc
MishaShWoof Nov 12, 2025
b1cc600
fix: fixed scenario
VladyslavPerederWoof Nov 12, 2025
82926d8
fix: eslint fixes
VladyslavPerederWoof Nov 12, 2025
f728fd8
feat: add new wbtc whale address to the WHALES list
VladyslavPerederWoof Nov 13, 2025
5c84e87
chore: fix of withdraw scenario
VladyslavPerederWoof Nov 13, 2025
454a2fe
chore: temp skip of nearly added scenarios
VladyslavPerederWoof Nov 13, 2025
7340afa
fix: lint fix
VladyslavPerederWoof Nov 13, 2025
a4c2f41
refactor: enhance quoteCollateral tests to support extended asset lis…
VladyslavPerederWoof Nov 13, 2025
5853567
refactor: update WithdrawScenario to include asset list check in filt…
VladyslavPerederWoof Nov 13, 2025
485ad16
refactor: enhance LiquidationScenario and QuoteCollateral tests to ut…
VladyslavPerederWoof Nov 14, 2025
68f6aab
fix: change rpc
MishaShWoof Nov 14, 2025
60b8360
refactor: update LiquidationScenario and QuoteCollateral tests to ski…
VladyslavPerederWoof Nov 14, 2025
01bb95e
refactor: streamline quoteCollateral function by using local variable…
VladyslavPerederWoof Nov 17, 2025
76ec8f3
refactor: optimize usesAssetList function by introducing a local vari…
VladyslavPerederWoof Nov 17, 2025
03042fb
Merge branch develop into fix/avoid-pricefeed-paralysis
VladyslavPerederWoof Nov 17, 2025
d2801ea
fix: replace ankr with quicknode
MishaShWoof Nov 17, 2025
248034d
fix: fix quote collateral scenario
VladyslavPerederWoof Nov 17, 2025
df2cd6b
fix: update quote calculation to allow for a margin of error in colla…
VladyslavPerederWoof Nov 17, 2025
d85107e
fix: increase margin of error in quote calculation for collateral sce…
VladyslavPerederWoof Nov 17, 2025
d290a86
refactor: enhance LiquidationScenario by adding asset delisting check…
VladyslavPerederWoof Nov 17, 2025
1b6365f
Merge branch develop into fix/avoid-pricefeed-paralysis
VladyslavPerederWoof Nov 17, 2025
16c12c0
refactor: update LiquidationScenario to remove unnecessary scenario.o…
VladyslavPerederWoof Nov 17, 2025
9a18af1
fix: increase margin of error in quote calculation for collateral sce…
VladyslavPerederWoof Nov 17, 2025
49c4893
fix: update quote calculation to use BigInt for margin of error in co…
VladyslavPerederWoof Nov 17, 2025
4d9df56
refactor: remove redundant comments in LiquidationScenario and Withdr…
VladyslavPerederWoof Nov 17, 2025
33e306f
feat: introduce snapshot helper functions for blockchain state manage…
VladyslavPerederWoof Nov 17, 2025
9971c2b
Merge branch develop into woof-software/extended-pause
VladyslavPerederWoof Nov 17, 2025
6491c74
feat: add asset delisting and extended asset list support functions
VladyslavPerederWoof Nov 18, 2025
0c9472a
fix: fix scenarios
VladyslavPerederWoof Nov 18, 2025
20092de
refactor: export toBigInt function from helpers for reuse in math cal…
VladyslavPerederWoof Nov 18, 2025
dbfb903
refactor: remove commented-out code for CometExtAssetList check
VladyslavPerederWoof Nov 18, 2025
5ea9e22
feat: add new ezETH and weETH whale addresses to the WHALES list for …
VladyslavPerederWoof Nov 18, 2025
a7018a9
feat: add new whale addresses for various assets across multiple netw…
VladyslavPerederWoof Nov 18, 2025
9c7300f
fix: fix scenario file naming
VladyslavPerederWoof Nov 19, 2025
1b6904e
chore: natspec fixes
VladyslavPerederWoof Nov 19, 2025
79e17b1
refactor: replace setupExtendedAssetListSupport with supportsExtended…
VladyslavPerederWoof Nov 19, 2025
675bc10
Merge branch woof-software/extended-pause into fix/avoid-pricefeed-pa…
VladyslavPerederWoof Nov 20, 2025
518bc58
feat: revert changes on AssetList and added mock for temp v of new one
VladyslavPerederWoof Nov 21, 2025
52bd37d
feat: add support for mock asset list factory in configurator tests
VladyslavPerederWoof Nov 21, 2025
001b60c
Merge branch 'main' of github.com:woof-software/comet into develop
MishaShWoof Nov 24, 2025
38a9d9e
fix: working tests
MishaShWoof Nov 24, 2025
525e5a8
fix: working forge test
MishaShWoof Nov 24, 2025
d73df39
Update run-forge-tests.yaml
MishaShWoof Nov 24, 2025
640d956
Update run-forge-tests.yaml
MishaShWoof Nov 24, 2025
e0f36c1
feat: integrate mock asset list factory support into deployment process
VladyslavPerederWoof Nov 25, 2025
8567489
refactor: rename pause-related events in CometExt and CometExtInterfa…
VladyslavPerederWoof Nov 25, 2025
7040929
refactor: update event names for collateral and base supply pause act…
VladyslavPerederWoof Nov 25, 2025
3d059f2
Merge branch develop into woof-software/extended-pause
VladyslavPerederWoof Nov 26, 2025
49ac136
Update run-scenarios.yaml
MishaShWoof Nov 27, 2025
a16813a
fix: env in scenario
MishaShWoof Nov 27, 2025
0407aa6
fix: use different keys for etherscan
MishaShWoof Nov 27, 2025
1a368d4
fix: strict order
MishaShWoof Nov 27, 2025
a34434f
fix: pass the prepared state
MishaShWoof Nov 27, 2025
9d6c077
fix: remove matrix
MishaShWoof Nov 27, 2025
58ed478
fix: pass node modules
MishaShWoof Nov 27, 2025
892de86
test: added collateral deactivation tests
VladyslavPerederWoof Nov 27, 2025
4bfdbef
feat: added collateral deactivation logic
VladyslavPerederWoof Nov 27, 2025
0e67e92
fix: add contracts to cache before scenario run
MishaShWoof Nov 28, 2025
bc0871e
fix: cache path fix
MishaShWoof Nov 28, 2025
5f4fc6f
fix: use hidden files
MishaShWoof Nov 28, 2025
5a77147
fix: fuji
MishaShWoof Nov 28, 2025
de4b034
chore: added natspec
VladyslavPerederWoof Dec 2, 2025
4d7177e
test: added scenarios for deactivated collateral feature
VladyslavPerederWoof Dec 2, 2025
cc47692
test: added tests for deactivated collateral feature
VladyslavPerederWoof Dec 2, 2025
e8c854a
chore: added more comprehensive docs for tests
VladyslavPerederWoof Dec 2, 2025
a80b37b
fix: add temporary hack to skip processing specific proposals (510, 5…
VladyslavPerederWoof Dec 2, 2025
b287ff2
feat: rotate apikeys and some arbitrum fixes
MishaShWoof Dec 2, 2025
070fda2
Merge pull request #279 from woof-software/speed-up-scenarios
MishaShWoof Dec 3, 2025
98e6783
fix: working arbitrum scenarios
MishaShWoof Dec 3, 2025
b2b05a2
fix: teth symbol fix
MishaShWoof Dec 3, 2025
a0fdad7
fix: add debug for spider
MishaShWoof Dec 3, 2025
2a1124f
Merge branch 'feat/service-patch' into woof-software/extended-pause
VladyslavPerederWoof Dec 12, 2025
6e2d418
feat: fixed unpause logic for asset with index >= 8 with additional t…
VladyslavPerederWoof Dec 12, 2025
a17020b
feat: enforced tests for isLiquidatable semantics acrosss liquidateCF…
VladyslavPerederWoof Dec 12, 2025
1b39615
fix: correct order of collateral asset supply logic in supplyCollater…
VladyslavPerederWoof Dec 12, 2025
87d8cba
chore: remove unnecessary console log from `SupplyScenario.ts`
VladyslavPerederWoof Dec 15, 2025
226cba6
Merge branch woof-software/extended-pause into feat/collateral-deacti…
VladyslavPerederWoof Dec 15, 2025
7a35ff0
test: enhanced scenarios for deactivated collaterals
VladyslavPerederWoof Dec 16, 2025
bcf1a21
fix: update transfer scenario description to clarify behavior when as…
VladyslavPerederWoof Dec 16, 2025
c1e706a
refactor: simplify pause state checks in CometWithExtendedAssetList c…
VladyslavPerederWoof Dec 16, 2025
00361c5
chore: update COMP_WHALES addresses for mainnet
VladyslavPerederWoof Dec 16, 2025
6d01265
feat: add error handling for collateral activation and deactivation i…
VladyslavPerederWoof Dec 17, 2025
b0a580b
test: enhance scenarios for collateral activation and deactivation wi…
VladyslavPerederWoof Dec 17, 2025
21e9a90
refactor: update COMP_WHALES addresses for mainnet in index.ts
VladyslavPerederWoof Dec 17, 2025
40816b6
test: improve collateral activation and deactivation tests with addit…
VladyslavPerederWoof Dec 17, 2025
8d13300
chore: optimized scenarios with for loops
VladyslavPerederWoof Dec 18, 2025
17a1175
refactor: remove temporary hacks for skipping specific proposals in P…
VladyslavPerederWoof Dec 18, 2025
9b39261
chore: code refactoring
VladyslavPerederWoof Dec 18, 2025
a46de9b
Merge branch woof-software/extended-pause into feat/collateral-deacti…
VladyslavPerederWoof Dec 18, 2025
e3e2c63
chore: update governance addresses by removing outdated entries and a…
VladyslavPerederWoof Dec 19, 2025
91a6421
chore: update governance addresses by removing outdated entries and a…
VladyslavPerederWoof Dec 19, 2025
0cf69cd
Merge branch 'main' of github.com:woof-software/comet into develop
MishaShWoof Dec 22, 2025
e7f8ce6
fix: ronin and forge test fixes
MishaShWoof Dec 22, 2025
bd8375b
Merge branch develop into woof-software/extended-pause
VladyslavPerederWoof Dec 22, 2025
ac17fbc
Merge branch woof-software/extended-pause into feat/collateral-deacti…
VladyslavPerederWoof Dec 22, 2025
5875e80
feat: Supply tests update
artemwoofsoftware Dec 23, 2025
b3456da
fix: working arbitrum scenarios
MishaShWoof Dec 24, 2025
41461c0
refactor: simplify currentPauseOffsetStatus function in CometExt cont…
VladyslavPerederWoof Dec 30, 2025
313a7f6
refactore: supply tests
VladyslavPerederWoof Jan 14, 2026
f8fc889
feat: Utilization peaking impact & borrow indexes grow in empty market
VladyslavPerederWoof Jan 16, 2026
d70140b
feat: added lenders illiquidity preventions
VladyslavPerederWoof Jan 20, 2026
633b26d
chore: removed receive func
VladyslavPerederWoof Jan 20, 2026
5c6ba4d
chore: remove unused import of hardhat console
VladyslavPerederWoof Jan 20, 2026
9174842
test: added tests for supply 24 collaterals
VladyslavPerederWoof Jan 27, 2026
cba9d1c
test: added test for transfering base tokens
VladyslavPerederWoof Jan 28, 2026
c87c47b
test: addedadditional tests for transfer
VladyslavPerederWoof Jan 29, 2026
d237a3d
Merge pull request #249 from woof-software/woof-software/extended-pause
VladyslavBudiukWOOF Jan 30, 2026
676dad1
test: enhance transfer tests with additional scenarios and snapshot f…
VladyslavPerederWoof Feb 3, 2026
61d8db1
Merge branch feat/service-patch into fix/avoid-pricefeed-paralysis
VladyslavPerederWoof Feb 4, 2026
4c6c978
test: added tests for price feed with revert
VladyslavPerederWoof Feb 5, 2026
171d350
feat: removed MockAssetList sc with factory, updated checks in AssetL…
VladyslavPerederWoof Feb 6, 2026
45536f0
refactor: remove redundant check for descaled borrow collateral facto…
VladyslavPerederWoof Feb 6, 2026
0b015d4
test: add non-standard token transfer scenarios and fee-on-transfer h…
VladyslavPerederWoof Feb 6, 2026
cd2e749
Merge branch feat/service-patch into woof-software/supply-tests
VladyslavPerederWoof Feb 9, 2026
7b4ceb4
Merge branch feat/service-patch into test/transfer-functionality
VladyslavPerederWoof Feb 9, 2026
21bf6dc
test: enhance supply tests with additional checks for paused states a…
VladyslavPerederWoof Feb 9, 2026
35b6f1c
test: remove isolation from supply test suite
VladyslavPerederWoof Feb 9, 2026
48676c8
test: add scenarios for pausing lender and borrower transfers, and co…
VladyslavPerederWoof Feb 10, 2026
fcc6f59
test: add tests for pausing and unpausing collateral supply for multi…
VladyslavPerederWoof Feb 10, 2026
f0dd507
fix: internal audit fixes
VladyslavPerederWoof Feb 12, 2026
bd73b8e
fix: internal audit fixes
VladyslavPerederWoof Feb 12, 2026
3f53179
feat: added accrueInternal to supply and withdraw collateral function…
VladyslavPerederWoof Feb 19, 2026
cb452af
refactor: simplify supply functions by removing redundant operator pa…
VladyslavPerederWoof Feb 19, 2026
91760c1
refactor: enhance isLiquidatable logic and improve asset price handli…
VladyslavPerederWoof Feb 20, 2026
8b2ea24
new fixes
MishaShWoof Feb 23, 2026
73cb01d
fix
MishaShWoof Feb 23, 2026
7d4a913
fix: precision fix
MishaShWoof Feb 23, 2026
f78c91e
feat: withdrawal test refactoring with reduced duplication, non-stand…
Feb 23, 2026
a39d72a
WIP: utilization for transferBase and during withdraw for lenders
VladyslavPerederWoof Feb 26, 2026
0375004
feat: add collateral deactivation checks and update error messages
VladyslavPerederWoof Feb 27, 2026
87eedc5
fix: Additional cases, revert case replacement, ext pause restruct
Feb 28, 2026
de79748
fix: restore amount assignment in supplyCollateral function to ensure…
VladyslavPerederWoof Mar 5, 2026
d345a99
Merge branch feat/withdrawal-test-refactoring into feat/supply-n-with…
VladyslavPerederWoof Mar 31, 2026
32d79c6
Merge branch test/transfer-functionality into feat/supply-n-withdraw-…
VladyslavPerederWoof Mar 31, 2026
f70ca50
refactor: split accrueAccount into internal and external functions fo…
VladyslavPerederWoof Apr 1, 2026
7080468
fix: forge-std revert
VladyslavPerederWoof Apr 3, 2026
c8bd632
revert: forge-std to previous version
VladyslavPerederWoof Apr 3, 2026
5fdd114
revert: packages and lock file
VladyslavPerederWoof Apr 3, 2026
6bed860
wip: skipped logic for pushing utilization back
VladyslavPerederWoof Apr 3, 2026
32831a3
wip: removed console log
VladyslavPerederWoof Apr 3, 2026
8a568ee
chore: restore @tenderly/hardhat-tenderly dependency in package.json
VladyslavPerederWoof Apr 3, 2026
002a06d
fix: moved assetPrices array creation after check of user principal
VladyslavPerederWoof Apr 3, 2026
2efe3b1
refactor: enhance collateral factor validation logic in AssetList con…
VladyslavPerederWoof Apr 3, 2026
f0ea472
feat: enhance utilization checks during transfers and withdrawals to …
VladyslavPerederWoof Apr 7, 2026
f3ebdba
fix: change scroll rpc
MishaShWoof Apr 9, 2026
cda82b3
Merge pull request #339 from woof-software/feat/supply-n-withdraw-accrue
VladyslavPerederWoof Apr 10, 2026
5c1934d
Merge pull request #345 from woof-software/feat/price-fetching-optimi…
VladyslavPerederWoof Apr 10, 2026
da00690
fix: update ProposalConstraint to skip proposal 510 and 567
VladyslavPerederWoof Apr 10, 2026
8404b8a
Merge branch 'woof-software/supply-tests' into fix/supplyInternal-red…
VladyslavPerederWoof Apr 10, 2026
805b3e5
fix: added proposal for skip
VladyslavPerederWoof Apr 10, 2026
0b405a1
Merge branch 'woof-software/supply-tests' into feat/lenders-illiquidity
VladyslavPerederWoof Apr 10, 2026
5528c8a
fix: update skipped proposals
VladyslavPerederWoof Apr 10, 2026
1f84908
Merge branch 'woof-software/supply-tests' into fix/supplyInternal-red…
VladyslavPerederWoof Apr 10, 2026
7644e5f
chore: skipped temporary proposals
VladyslavPerederWoof Apr 10, 2026
c5c7492
fix: tests fixes
VladyslavPerederWoof Apr 10, 2026
0442a1c
Merge pull request #340 from woof-software/fix/supplyInternal-redunda…
VladyslavPerederWoof Apr 14, 2026
79f0cd4
Merge branch 'woof-software/supply-tests' into feat/lenders-illiquidity
VladyslavPerederWoof Apr 14, 2026
c750952
Merge pull request #316 from woof-software/feat/lenders-illiquidity
VladyslavPerederWoof Apr 14, 2026
a2775bc
Merge branch 'develop' into feat/service-patch
VladyslavPerederWoof Apr 14, 2026
7c6d081
Merge branch 'feat/service-patch' into woof-software/supply-tests
VladyslavPerederWoof Apr 14, 2026
267d847
fix: Forge tests workflow fixed
VladyslavPerederWoof Apr 15, 2026
8572779
Merge pull request #313 from woof-software/woof-software/supply-tests
VladyslavPerederWoof Apr 15, 2026
72c9ae4
chore: removed receive function that was added accidetly and was not …
VladyslavPerederWoof Apr 15, 2026
953f998
Merge branch fix/avoid-pricefeed-paralysis into feat/service-patch
VladyslavPerederWoof Apr 16, 2026
a6c26bf
Merge branch feat/collateral-deactivation into feat/service-patch
VladyslavPerederWoof Apr 17, 2026
15d5ab0
fix(scenarios): update asset borrow collateral factor to zero before …
VladyslavPerederWoof Apr 17, 2026
ccc4855
fix: update relations and cctp addresses
MishaShWoof Apr 24, 2026
e5144db
fix
MishaShWoof Apr 24, 2026
3744ceb
Merge remote-tracking branch 'origin/develop' into test/configurator-…
vlad-woof-software Apr 30, 2026
c980175
fix: handle max gaslimit per tx
MishaShWoof May 1, 2026
750ede2
fix: slither
MishaShWoof May 1, 2026
066eade
test(configurator): rewrite ConfiguratorScenario with expanded coverage
vlad-woof-software May 4, 2026
ef4730f
Merge remote-tracking branch 'origin/develop' into test/configurator-…
vlad-woof-software May 4, 2026
bcbe895
test(configurator): remove .only modifier from all scenarios
vlad-woof-software May 4, 2026
1b63584
test(configurator): replace some hardcoded addresses and add missing …
vlad-woof-software May 5, 2026
143d058
chore: allowlist MockERC20 from capo for compilation
vlad-woof-software May 6, 2026
5a1d54c
test(configurator): replace all remaining stub addresses with deploye…
vlad-woof-software May 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-market.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ inputs.network }}"
ethereum_url: "${{ fromJSON('{\"linea\":\"${LINEA_QUICKNODE_LINK}\",\"ronin\":\"${RONIN_QUICKNODE_LINK}\",\"unichain\":\"${UNICHAIN_QUICKNODE_LINK}\",\"mantle\":\"${MANTLE_QUICKNODE_LINK}\",\"optimism\":\"${OPTIMISM_QUICKNODE_LINK}\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"${MAINNET_QUICKNODE_LINK}\",\"sepolia\":\"${SEPOLIA_QUICKNODE_LINK}\",\"polygon\":\"${POLYGON_QUICKNODE_LINK}\",\"arbitrum\":\"${ARBITRUM_QUICKNODE_LINK}\",\"base\":\"${BASE_QUICKNODE_LINK}\",\"scroll\":\"https://rpc.scroll.io\"}')[github.event.inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"linea\":\"${LINEA_QUICKNODE_LINK}\",\"ronin\":\"${RONIN_QUICKNODE_LINK}\",\"unichain\":\"${UNICHAIN_QUICKNODE_LINK}\",\"mantle\":\"${MANTLE_QUICKNODE_LINK}\",\"optimism\":\"${OPTIMISM_QUICKNODE_LINK}\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"${MAINNET_QUICKNODE_LINK}\",\"sepolia\":\"${SEPOLIA_QUICKNODE_LINK}\",\"polygon\":\"${POLYGON_QUICKNODE_LINK}\",\"arbitrum\":\"${ARBITRUM_QUICKNODE_LINK}\",\"base\":\"${BASE_QUICKNODE_LINK}\",\"scroll\":\"https://scroll.drpc.org\"}')[github.event.inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/enact-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ inputs.network }}"
ethereum_url: "${{ fromJSON('{\"linea\":\"${LINEA_QUICKNODE_LINK}\",\"ronin\":\"${RONIN_QUICKNODE_LINK}\",\"unichain\":\"${UNICHAIN_QUICKNODE_LINK}\",\"mantle\":\"${MANTLE_QUICKNODE_LINK}\",\"optimism\":\"${OPTIMISM_QUICKNODE_LINK}\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"${MAINNET_QUICKNODE_LINK}\",\"sepolia\":\"${SEPOLIA_QUICKNODE_LINK}\",\"polygon\":\"${POLYGON_QUICKNODE_LINK}\",\"arbitrum\":\"${ARBITRUM_QUICKNODE_LINK}\",\"base\":\"${BASE_QUICKNODE_LINK}\",\"scroll\":\"https://rpc.scroll.io\"}')[github.event.inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"linea\":\"${LINEA_QUICKNODE_LINK}\",\"ronin\":\"${RONIN_QUICKNODE_LINK}\",\"unichain\":\"${UNICHAIN_QUICKNODE_LINK}\",\"mantle\":\"${MANTLE_QUICKNODE_LINK}\",\"optimism\":\"${OPTIMISM_QUICKNODE_LINK}\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"${MAINNET_QUICKNODE_LINK}\",\"sepolia\":\"${SEPOLIA_QUICKNODE_LINK}\",\"polygon\":\"${POLYGON_QUICKNODE_LINK}\",\"arbitrum\":\"${ARBITRUM_QUICKNODE_LINK}\",\"base\":\"${BASE_QUICKNODE_LINK}\",\"scroll\":\"https://scroll.drpc.org\"}')[github.event.inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ inputs.network }}"
ethereum_url: "${{ fromJSON('{\"linea\":\"${LINEA_QUICKNODE_LINK}\",\"ronin\":\"${RONIN_QUICKNODE_LINK}\",\"unichain\":\"${UNICHAIN_QUICKNODE_LINK}\",\"mantle\":\"${MANTLE_QUICKNODE_LINK}\",\"optimism\":\"${OPTIMISM_QUICKNODE_LINK}\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"${MAINNET_QUICKNODE_LINK}\",\"sepolia\":\"${SEPOLIA_QUICKNODE_LINK}\",\"polygon\":\"${POLYGON_QUICKNODE_LINK}\",\"arbitrum\":\"${ARBITRUM_QUICKNODE_LINK}\",\"base\":\"${BASE_QUICKNODE_LINK}\",\"scroll\":\"https://rpc.scroll.io\"}')[github.event.inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"linea\":\"${LINEA_QUICKNODE_LINK}\",\"ronin\":\"${RONIN_QUICKNODE_LINK}\",\"unichain\":\"${UNICHAIN_QUICKNODE_LINK}\",\"mantle\":\"${MANTLE_QUICKNODE_LINK}\",\"optimism\":\"${OPTIMISM_QUICKNODE_LINK}\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"${MAINNET_QUICKNODE_LINK}\",\"sepolia\":\"${SEPOLIA_QUICKNODE_LINK}\",\"polygon\":\"${POLYGON_QUICKNODE_LINK}\",\"arbitrum\":\"${ARBITRUM_QUICKNODE_LINK}\",\"base\":\"${BASE_QUICKNODE_LINK}\",\"scroll\":\"https://scroll.drpc.org\"}')[github.event.inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/run-slither.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ jobs:
with:
python-version: '3.x'

- name: Install solc
run: sudo add-apt-repository ppa:ethereum/ethereum;sudo add-apt-repository ppa:ethereum/ethereum-dev;sudo apt-get update;sudo apt-get install solc

- name: Install packages
run: pip install slither-analyzer solc-select

Expand Down
23 changes: 18 additions & 5 deletions contracts/AssetList.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.15;

import "./IPriceFeed.sol";

Check warning on line 4 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

global import of path ./IPriceFeed.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "./IERC20NonStandard.sol";

Check warning on line 5 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

global import of path ./IERC20NonStandard.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "./CometMainInterface.sol";

Check warning on line 6 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

global import of path ./CometMainInterface.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import "./CometCore.sol";

Check warning on line 7 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

global import of path ./CometCore.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

/**
* @title Compound's Asset List
Expand All @@ -20,12 +20,12 @@
/// @dev The max value for a collateral factor (1)
uint64 internal constant MAX_COLLATERAL_FACTOR = FACTOR_SCALE;

uint256 internal immutable asset00_a;

Check warning on line 23 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

Immutable variables name are set to be in capitalized SNAKE_CASE
uint256 internal immutable asset00_b;

Check warning on line 24 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

Immutable variables name are set to be in capitalized SNAKE_CASE
uint256 internal immutable asset01_a;

Check warning on line 25 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

Immutable variables name are set to be in capitalized SNAKE_CASE
uint256 internal immutable asset01_b;

Check warning on line 26 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

Immutable variables name are set to be in capitalized SNAKE_CASE
uint256 internal immutable asset02_a;

Check warning on line 27 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

Immutable variables name are set to be in capitalized SNAKE_CASE
uint256 internal immutable asset02_b;

Check warning on line 28 in contracts/AssetList.sol

View workflow job for this annotation

GitHub Actions / Contract linter

Immutable variables name are set to be in capitalized SNAKE_CASE
uint256 internal immutable asset03_a;
uint256 internal immutable asset03_b;
uint256 internal immutable asset04_a;
Expand Down Expand Up @@ -137,9 +137,18 @@
if (IPriceFeed(priceFeed).decimals() != PRICE_FEED_DECIMALS) revert CometMainInterface.BadDecimals();
if (IERC20NonStandard(asset).decimals() != decimals_) revert CometMainInterface.BadDecimals();

// Ensure collateral factors are within range
if (assetConfig.borrowCollateralFactor >= assetConfig.liquidateCollateralFactor) revert CometMainInterface.BorrowCFTooLarge();
if (assetConfig.liquidateCollateralFactor > MAX_COLLATERAL_FACTOR) revert CometMainInterface.LiquidateCFTooLarge();
// Valid collateral factor configurations:
// 1. Both zero => fully de-listed
// 2. borrowCF=0, liquidateCF>0 => soft de-list (no new borrows, controlled liquidation wind-down)
// 3. Both non-zero, properly ordered => active collateral
// Invalid: borrowCF>0, liquidateCF=0 => reverts (borrow power without liquidation coverage)
if (assetConfig.borrowCollateralFactor != 0 && assetConfig.liquidateCollateralFactor == 0) {
revert CometMainInterface.BorrowCFTooLarge();
} else if (assetConfig.borrowCollateralFactor != 0 && assetConfig.liquidateCollateralFactor != 0) {
// Ensure collateral factors are within range
if (assetConfig.borrowCollateralFactor > assetConfig.liquidateCollateralFactor) revert CometMainInterface.BorrowCFTooLarge();
if (assetConfig.liquidateCollateralFactor > MAX_COLLATERAL_FACTOR) revert CometMainInterface.LiquidateCFTooLarge();
}

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
Comment on lines +145 to +151
Comment on lines +147 to +151

unchecked {
// Keep 4 decimals for each factor
Expand All @@ -148,8 +157,12 @@
uint16 liquidateCollateralFactor = uint16(assetConfig.liquidateCollateralFactor / descale);
uint16 liquidationFactor = uint16(assetConfig.liquidationFactor / descale);

// Be nice and check descaled values are still within range
if (borrowCollateralFactor >= liquidateCollateralFactor) revert CometMainInterface.BorrowCFTooLarge();
if (borrowCollateralFactor != 0 && liquidateCollateralFactor == 0) {
revert CometMainInterface.BorrowCFTooLarge();
} else if (borrowCollateralFactor != 0 && liquidateCollateralFactor != 0) {
// Be nice and check descaled values are still within range
if (borrowCollateralFactor >= liquidateCollateralFactor) revert CometMainInterface.BorrowCFTooLarge();
}

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.
Comment on lines +160 to +165
Comment on lines +162 to +165

// Keep whole units of asset for supply cap
uint64 supplyCap = uint64(assetConfig.supplyCap / (10 ** decimals_));
Expand Down
18 changes: 18 additions & 0 deletions contracts/CometCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ abstract contract CometCore is CometConfiguration, CometStorage, CometMath {
uint8 internal constant PAUSE_ABSORB_OFFSET = 3;
uint8 internal constant PAUSE_BUY_OFFSET = 4;

/// @dev Offsets for specific actions in the extended pause flag bit array
/// @dev Offset of pause lenders withdraw
uint24 internal constant PAUSE_LENDERS_WITHDRAW_OFFSET = 0;
/// @dev Offset of pause borrowers withdraw
uint24 internal constant PAUSE_BORROWERS_WITHDRAW_OFFSET = 1;
/// @dev Offset of pause collateral supply
uint24 internal constant PAUSE_COLLATERAL_SUPPLY_OFFSET = 2;
/// @dev Offset of pause base supply
uint24 internal constant PAUSE_BASE_SUPPLY_OFFSET = 3;
/// @dev Offset of pause lenders transfer
uint24 internal constant PAUSE_LENDERS_TRANSFER_OFFSET = 4;
/// @dev Offset of pause borrowers transfer
uint24 internal constant PAUSE_BORROWERS_TRANSFER_OFFSET = 5;
/// @dev Offset of pause collateral transfer
uint24 internal constant PAUSE_COLLATERALS_TRANSFER_OFFSET = 6;
/// @dev Offset of pause collateral withdraw
uint24 internal constant PAUSE_COLLATERALS_WITHDRAW_OFFSET = 7;

/// @dev The decimals required for a price feed
uint8 internal constant PRICE_FEED_DECIMALS = 8;

Expand Down
216 changes: 216 additions & 0 deletions contracts/CometExt.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity 0.8.15;

import "./CometExtInterface.sol";
import "./CometMainInterface.sol";

contract CometExt is CometExtInterface {
/** Public constants **/
Expand Down Expand Up @@ -29,6 +30,27 @@
/// @dev The ERC20 symbol for wrapped base token
bytes32 internal immutable symbol32;

/** Modifiers **/

/**
* @dev Modifier to check if the sender is the governor or pause guardian
*/
modifier onlyGovernorOrPauseGuardian() {
if (msg.sender != CometMainInterface(address(this)).governor() &&
msg.sender != CometMainInterface(address(this)).pauseGuardian())
revert OnlyPauseGuardianOrGovernor();
_;
}

/**
* @dev Modifier to check if the asset index is valid
* @param assetIndex The index of the asset
*/
modifier isValidAssetIndex(uint24 assetIndex) {
if (assetIndex >= CometMainInterface(address(this)).numAssets()) revert InvalidAssetIndex();
_;
}

/**
* @notice Construct a new protocol instance
* @param config The mapping of initial/constant parameters
Expand Down Expand Up @@ -205,4 +227,198 @@
if (block.timestamp >= expiry) revert SignatureExpired();
allowInternal(signatory, manager, isAllowed_);
}

/*//////////////////////////////////////////////////////////////
EXTENDED PAUSE CONTROL
//////////////////////////////////////////////////////////////*/

/**
* @notice Set the status of a pause offset
* @param offset The offset to set
* @param paused The new status of the pause offset
*/
function setPauseFlag(uint24 offset, bool paused) internal {
paused ? extendedPauseFlags |= (uint24(1) << offset) : extendedPauseFlags &= ~(uint24(1) << offset);
}

/**
* @notice Get the current status of a pause offset
* @param offset The offset to check
* @return The current status of the pause offset
*/
function currentPauseOffsetStatus(uint24 offset) internal view returns (bool) {
return (extendedPauseFlags & (uint24(1) << offset)) != 0;
}

/**
* @notice Check if the collateral asset is deactivated
* @param assetIndex The index of the collateral asset
* @return Whether the collateral asset is deactivated
*/
function isCollateralDeactivated(uint24 assetIndex) public view returns (bool) {
return (deactivatedCollaterals & (uint24(1) << assetIndex) != 0) == true;
}

/**
* @inheritdoc CometExtInterface
*/
function pauseLendersWithdraw(bool paused) override external onlyGovernorOrPauseGuardian {
if (currentPauseOffsetStatus(PAUSE_LENDERS_WITHDRAW_OFFSET) == paused) revert OffsetStatusAlreadySet(PAUSE_LENDERS_WITHDRAW_OFFSET, paused);

setPauseFlag(PAUSE_LENDERS_WITHDRAW_OFFSET, paused);

emit LendersWithdrawPauseAction(paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseBorrowersWithdraw(bool paused) override external onlyGovernorOrPauseGuardian {
if (currentPauseOffsetStatus(PAUSE_BORROWERS_WITHDRAW_OFFSET) == paused) revert OffsetStatusAlreadySet(PAUSE_BORROWERS_WITHDRAW_OFFSET, paused);

setPauseFlag(PAUSE_BORROWERS_WITHDRAW_OFFSET, paused);

emit BorrowersWithdrawPauseAction(paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseCollateralWithdraw(bool paused) override external onlyGovernorOrPauseGuardian {
if (currentPauseOffsetStatus(PAUSE_COLLATERALS_WITHDRAW_OFFSET) == paused) revert OffsetStatusAlreadySet(PAUSE_COLLATERALS_WITHDRAW_OFFSET, paused);

setPauseFlag(PAUSE_COLLATERALS_WITHDRAW_OFFSET, paused);

emit CollateralWithdrawPauseAction(paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseCollateralAssetWithdraw(uint24 assetIndex, bool paused) override external onlyGovernorOrPauseGuardian isValidAssetIndex(assetIndex) {
if ((collateralsWithdrawPauseFlags & (uint24(1) << assetIndex) != 0) == paused) revert CollateralAssetOffsetStatusAlreadySet(collateralsWithdrawPauseFlags, assetIndex, paused);

paused ? collateralsWithdrawPauseFlags |= (uint24(1) << assetIndex) : collateralsWithdrawPauseFlags &= ~(uint24(1) << assetIndex);

emit CollateralAssetWithdrawPauseAction(assetIndex, paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseCollateralSupply(bool paused) override external onlyGovernorOrPauseGuardian {
if (currentPauseOffsetStatus(PAUSE_COLLATERAL_SUPPLY_OFFSET) == paused) revert OffsetStatusAlreadySet(PAUSE_COLLATERAL_SUPPLY_OFFSET, paused);

setPauseFlag(PAUSE_COLLATERAL_SUPPLY_OFFSET, paused);

emit CollateralSupplyPauseAction(paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseBaseSupply(bool paused) override external onlyGovernorOrPauseGuardian {
if (currentPauseOffsetStatus(PAUSE_BASE_SUPPLY_OFFSET) == paused) revert OffsetStatusAlreadySet(PAUSE_BASE_SUPPLY_OFFSET, paused);

setPauseFlag(PAUSE_BASE_SUPPLY_OFFSET, paused);

emit BaseSupplyPauseAction(paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseCollateralAssetSupply(uint24 assetIndex, bool paused) override external onlyGovernorOrPauseGuardian isValidAssetIndex(assetIndex) {
if ((collateralsSupplyPauseFlags & (uint24(1) << assetIndex) != 0) == paused) revert CollateralAssetOffsetStatusAlreadySet(collateralsSupplyPauseFlags, assetIndex, paused);
if (!paused && isCollateralDeactivated(assetIndex)) revert CollateralIsDeactivated(assetIndex);

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.

paused ? collateralsSupplyPauseFlags |= (uint24(1) << assetIndex) : collateralsSupplyPauseFlags &= ~(uint24(1) << assetIndex);

emit CollateralAssetSupplyPauseAction(assetIndex, paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseLendersTransfer(bool paused) override external onlyGovernorOrPauseGuardian {
if (currentPauseOffsetStatus(PAUSE_LENDERS_TRANSFER_OFFSET) == paused) revert OffsetStatusAlreadySet(PAUSE_LENDERS_TRANSFER_OFFSET, paused);

setPauseFlag(PAUSE_LENDERS_TRANSFER_OFFSET, paused);

emit LendersTransferPauseAction(paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseBorrowersTransfer(bool paused) override external onlyGovernorOrPauseGuardian {
if (currentPauseOffsetStatus(PAUSE_BORROWERS_TRANSFER_OFFSET) == paused) revert OffsetStatusAlreadySet(PAUSE_BORROWERS_TRANSFER_OFFSET, paused);

setPauseFlag(PAUSE_BORROWERS_TRANSFER_OFFSET, paused);

emit BorrowersTransferPauseAction(paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseCollateralTransfer(bool paused) override external onlyGovernorOrPauseGuardian {
if (currentPauseOffsetStatus(PAUSE_COLLATERALS_TRANSFER_OFFSET) == paused) revert OffsetStatusAlreadySet(PAUSE_COLLATERALS_TRANSFER_OFFSET, paused);

setPauseFlag(PAUSE_COLLATERALS_TRANSFER_OFFSET, paused);

emit CollateralTransferPauseAction(paused);
}

/**
* @inheritdoc CometExtInterface
*/
function pauseCollateralAssetTransfer(uint24 assetIndex, bool paused) override external onlyGovernorOrPauseGuardian isValidAssetIndex(assetIndex) {
if ((collateralsTransferPauseFlags & (uint24(1) << assetIndex) != 0) == paused) revert CollateralAssetOffsetStatusAlreadySet(collateralsTransferPauseFlags, assetIndex, paused);
if (!paused && isCollateralDeactivated(assetIndex)) revert CollateralIsDeactivated(assetIndex);

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-nested-if Note

Using nested is cheaper than using && multiple check combinations.
There are more advantages, such as easier to read code and better coverage reports.

paused ? collateralsTransferPauseFlags |= (uint24(1) << assetIndex) : collateralsTransferPauseFlags &= ~(uint24(1) << assetIndex);

emit CollateralAssetTransferPauseAction(assetIndex, paused);
}

/**
* @inheritdoc CometExtInterface
*/
function deactivateCollateral(uint24 assetIndex) override external isValidAssetIndex(assetIndex) {
if (msg.sender != CometMainInterface(address(this)).pauseGuardian()) revert OnlyPauseGuardian();
if (isCollateralDeactivated(assetIndex)) revert CollateralIsDeactivated(assetIndex);

// Mark collateral as deactivated
deactivatedCollaterals |= (uint24(1) << assetIndex);
emit CollateralDeactivated(assetIndex);

// Pause supply of this collateral
collateralsSupplyPauseFlags |= (uint24(1) << assetIndex);
emit CollateralAssetSupplyPauseAction(assetIndex, true);

// Pause transfer of this collateral
collateralsTransferPauseFlags |= (uint24(1) << assetIndex);
emit CollateralAssetTransferPauseAction(assetIndex, true);
}

/**
* @inheritdoc CometExtInterface
*/
function activateCollateral(uint24 assetIndex) override external isValidAssetIndex(assetIndex) {
if (msg.sender != CometMainInterface(address(this)).governor()) revert OnlyGovernor();
if ((deactivatedCollaterals & (uint24(1) << assetIndex) != 0) == false) revert CollateralIsActivated(assetIndex);

// Mark collateral as activated
deactivatedCollaterals &= ~(uint24(1) << assetIndex);
emit CollateralActivated(assetIndex);

// Unpause supply of this collateral
collateralsSupplyPauseFlags &= ~(uint24(1) << assetIndex);
emit CollateralAssetSupplyPauseAction(assetIndex, false);

// Unpause transfer of this collateral
collateralsTransferPauseFlags &= ~(uint24(1) << assetIndex);
emit CollateralAssetTransferPauseAction(assetIndex, false);
}
}
Loading
Loading