Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Base USDS market #137

Open
wants to merge 69 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
bba7d99
feat: create comet with extended asset list
MishaShWoof Aug 9, 2024
fc16ae0
feat: move new cometExt to its own contract
MishaShWoof Aug 12, 2024
6b62ee6
fix: clean up
MishaShWoof Aug 12, 2024
d06a3f6
fix: gas optimization
MishaShWoof Aug 12, 2024
d2873ad
fix: more gas optimization
MishaShWoof Aug 12, 2024
5e867a0
fix: linter fix
MishaShWoof Aug 12, 2024
8ab1786
fix: natspec
MishaShWoof Aug 12, 2024
171eb7a
fix: more natspec
MishaShWoof Aug 12, 2024
53f1513
Update index.ts
MishaShWoof Aug 23, 2024
8df38e6
fix: remove unused iterface
MishaShWoof Aug 26, 2024
70e8a73
feat: add prepare and enact for simulation
MishaShWoof Aug 26, 2024
4c0a8f4
fix: fix to workflow
MishaShWoof Aug 26, 2024
c29f4b9
Update enact-migration.yaml
MishaShWoof Aug 26, 2024
cf08c19
fix: reverse
MishaShWoof Aug 26, 2024
71fee7b
feat: add prepare and enact workflow
MishaShWoof Aug 26, 2024
57d04f7
feat: update enact migration script
dmitriy-woof-software Aug 26, 2024
f0c33a1
feat: update enact migration script
dmitriy-woof-software Aug 26, 2024
df2d152
feat: update enact migration script
dmitriy-woof-software Aug 26, 2024
92937aa
feat: update enact migration script
dmitriy-woof-software Aug 26, 2024
b72092c
fix: remove verification from simulatative migration
MishaShWoof Aug 27, 2024
ea15450
Merge branch 'main' of github.com:woof-software/comet into woof-softw…
MishaShWoof Sep 17, 2024
dfe98c9
feat: fixes after audit
MishaShWoof Sep 19, 2024
4f2ba04
fix: working tests
MishaShWoof Sep 19, 2024
e641f95
fix: no network issue resolved
MishaShWoof Dec 13, 2024
986efa2
Merge branch 'main' into woof-software/collateral-extension
MishaShWoof Dec 20, 2024
5c75787
fix: audit fixes
MishaShWoof Dec 23, 2024
4e41a94
fix
MishaShWoof Dec 23, 2024
547e934
Merge branch 'woof-software/fix-to-no-network' of github.com:woof-sof…
MishaShWoof Dec 23, 2024
6635049
feat: working scenarios
MishaShWoof Dec 26, 2024
4ba3b92
feat: migrations and working scenarios
MishaShWoof Dec 27, 2024
c792011
fix
MishaShWoof Dec 27, 2024
9d67b33
fix: secret fix for scroll
MishaShWoof Dec 27, 2024
978dec0
fix: increase arbitrary number
MishaShWoof Dec 27, 2024
b6fb6a2
fix: scroll scan fix
MishaShWoof Dec 27, 2024
6a7f18a
feat: migrations and descriptions
MishaShWoof Jan 6, 2025
d7d9c2c
fix
MishaShWoof Jan 6, 2025
262fb3b
update descriptions
dmitriy-woof-software Jan 14, 2025
1b4307b
fix
MishaShWoof Jan 14, 2025
2381830
fix: review fix
MishaShWoof Jan 14, 2025
40e0370
fix: naming fix
MishaShWoof Jan 14, 2025
fb9f9b5
fix: optimizer
MishaShWoof Jan 14, 2025
f4860cf
fix: second optimizer fix
MishaShWoof Jan 14, 2025
94131ad
fix: optimization
MishaShWoof Jan 15, 2025
b6ff78e
Merge pull request #100 from woof-software/woof-software/collateral-e…
MishaShWoof Jan 17, 2025
5fe26a2
fix: merge fix
MishaShWoof Jan 17, 2025
d3522dc
fix: extension delegate fix and linter fix
MishaShWoof Jan 23, 2025
d8ac7a5
feat: add force push for ext deployment
dmitriy-woof-software Jan 28, 2025
370f22a
fix: clean up debug
MishaShWoof Jan 28, 2025
4351754
Modified migration from GitHub Actions
Jan 28, 2025
73e0160
Squash 24 Collaterals
MishaShWoof Jan 29, 2025
026289e
Merge branch 'woof-software/squash-base-usds' of github.com:woof-soft…
MishaShWoof Jan 29, 2025
6cbff14
feat: new governance fix and base-usds
MishaShWoof Feb 5, 2025
6cb9b95
fix: description and node version fix
MishaShWoof Feb 5, 2025
cd720ae
feat: new price feed and new collateral
MishaShWoof Feb 6, 2025
b7dca05
fix: linter
MishaShWoof Feb 6, 2025
d29fc06
refactoring
dmitriy-woof-software Feb 6, 2025
5a73237
Modified deployment roots from GitHub Actions
Feb 6, 2025
9122f35
feat: update configuration and migration after deployment
dmitriy-woof-software Feb 6, 2025
7cba1de
add deployment link into proposal description
dmitriy-woof-software Feb 6, 2025
dbb301a
update configurations
dmitriy-woof-software Feb 6, 2025
96b5c48
Modified migration from GitHub Actions
Feb 6, 2025
d08be8a
feat: update migration verify
dmitriy-woof-software Feb 6, 2025
1fd5eb6
re-deploy market
dmitriy-woof-software Feb 6, 2025
c83e6b1
Modified deployment roots from GitHub Actions
Feb 6, 2025
8c37888
update configuration after deployment
dmitriy-woof-software Feb 6, 2025
97afff5
Modified migration from GitHub Actions
Feb 6, 2025
d7c3bb9
fix: remove useless deploy
MishaShWoof Feb 7, 2025
c6b773b
Merge branch 'main' of github.com:woof-software/comet into woof-softw…
dmitriy-woof-software Mar 6, 2025
374ed38
Merge branch 'woof-software/add-base-usds-market' of github.com:woof-…
dmitriy-woof-software Mar 7, 2025
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
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ export default migration('1735299634_update_comet_to_support_more_collaterals',
[]
);

const cometFactoryExtendedAssetList = await deploymentManager.deploy(
'cometFactoryExtendedAssetList',
'CometFactoryExtendedAssetList.sol',
const cometFactoryWithExtendedAssetList = await deploymentManager.deploy(
'cometFactoryWithExtendedAssetList',
'CometFactoryWithExtendedAssetList.sol',
[]
);
const {
@@ -49,13 +49,13 @@ export default migration('1735299634_update_comet_to_support_more_collaterals',
]
);
return {
cometFactoryExtendedAssetList: cometFactoryExtendedAssetList.address,
cometFactoryWithExtendedAssetList: cometFactoryWithExtendedAssetList.address,
newCometExt: _newCometExt.address
};
},

async enact(deploymentManager: DeploymentManager, govDeploymentManager, {
cometFactoryExtendedAssetList,
cometFactoryWithExtendedAssetList,
newCometExt,
}) {

@@ -77,7 +77,7 @@ export default migration('1735299634_update_comet_to_support_more_collaterals',
newCometExtAddress = newCometExt;

const setFactoryCalldata = await calldata(
configurator.populateTransaction.setFactory(comet.address, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(comet.address, cometFactoryWithExtendedAssetList)
);

const setExtensionDelegateCalldata = await calldata(
Original file line number Diff line number Diff line change
@@ -21,9 +21,9 @@ export default migration('1735299626_update_comet_to_support_more_collaterals',
[]
);

const cometFactoryExtendedAssetList = await deploymentManager.deploy(
'cometFactoryExtendedAssetList',
'CometFactoryExtendedAssetList.sol',
const cometFactoryWithExtendedAssetList = await deploymentManager.deploy(
'cometFactoryWithExtendedAssetList',
'CometFactoryWithExtendedAssetList.sol',
[]
);
const {
@@ -53,13 +53,13 @@ export default migration('1735299626_update_comet_to_support_more_collaterals',
]
);
return {
cometFactoryExtendedAssetList: cometFactoryExtendedAssetList.address,
cometFactoryWithExtendedAssetList: cometFactoryWithExtendedAssetList.address,
newCometExt: _newCometExt.address
};
},

async enact(deploymentManager: DeploymentManager, govDeploymentManager, {
cometFactoryExtendedAssetList,
cometFactoryWithExtendedAssetList,
newCometExt,
}) {

@@ -81,7 +81,7 @@ export default migration('1735299626_update_comet_to_support_more_collaterals',
newCometExtAddress = newCometExt;

const setFactoryCalldata = await calldata(
configurator.populateTransaction.setFactory(comet.address, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(comet.address, cometFactoryWithExtendedAssetList)
);
const setExtensionDelegateCalldata = await calldata(
configurator.populateTransaction.setExtensionDelegate(comet.address, newCometExt)
@@ -92,7 +92,7 @@ export default migration('1735299626_update_comet_to_support_more_collaterals',
);

const setFactoryCalldataUSDCE = await calldata(
configurator.populateTransaction.setFactory(USDCE_COMET, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(USDCE_COMET, cometFactoryWithExtendedAssetList)
);
const setExtensionDelegateCalldataUSDCE = await calldata(
configurator.populateTransaction.setExtensionDelegate(USDCE_COMET, newCometExt)
@@ -103,7 +103,7 @@ export default migration('1735299626_update_comet_to_support_more_collaterals',
);

const setFactoryCalldataUSDT = await calldata(
configurator.populateTransaction.setFactory(USDT_COMET, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(USDT_COMET, cometFactoryWithExtendedAssetList)
);
const setExtensionDelegateCalldataUSDT = await calldata(
configurator.populateTransaction.setExtensionDelegate(USDT_COMET, newCometExt)
@@ -114,7 +114,7 @@ export default migration('1735299626_update_comet_to_support_more_collaterals',
);

const setFactoryCalldataWETH = await calldata(
configurator.populateTransaction.setFactory(WETH_COMET, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(WETH_COMET, cometFactoryWithExtendedAssetList)
);
const setExtensionDelegateCalldataWETH = await calldata(
configurator.populateTransaction.setExtensionDelegate(WETH_COMET, newCometExt)
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ export default migration('1735299656_update_comet_to_support_more_collaterals',
[]
);

const cometFactoryExtendedAssetList = await deploymentManager.deploy(
'cometFactoryExtendedAssetList',
'CometFactoryExtendedAssetList.sol',
const cometFactoryWithExtendedAssetList = await deploymentManager.deploy(
'cometFactoryWithExtendedAssetList',
'CometFactoryWithExtendedAssetList.sol',
[]
);
const {
@@ -49,13 +49,13 @@ export default migration('1735299656_update_comet_to_support_more_collaterals',
]
);
return {
cometFactoryExtendedAssetList: cometFactoryExtendedAssetList.address,
cometFactoryWithExtendedAssetList: cometFactoryWithExtendedAssetList.address,
newCometExt: _newCometExt.address
};
},

async enact(deploymentManager: DeploymentManager, govDeploymentManager, {
cometFactoryExtendedAssetList,
cometFactoryWithExtendedAssetList,
newCometExt,
}) {

@@ -77,7 +77,7 @@ export default migration('1735299656_update_comet_to_support_more_collaterals',
newCometExtAddress = newCometExt;

const setFactoryCalldata = await calldata(
configurator.populateTransaction.setFactory(comet.address, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(comet.address, cometFactoryWithExtendedAssetList)
);

const setExtensionDelegateCalldata = await calldata(
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ export default migration('1735299663_update_comet_to_support_more_collaterals',
[]
);

const cometFactoryExtendedAssetList = await deploymentManager.deploy(
'cometFactoryExtendedAssetList',
'CometFactoryExtendedAssetList.sol',
const cometFactoryWithExtendedAssetList = await deploymentManager.deploy(
'cometFactoryWithExtendedAssetList',
'CometFactoryWithExtendedAssetList.sol',
[]
);
const {
@@ -49,13 +49,13 @@ export default migration('1735299663_update_comet_to_support_more_collaterals',
]
);
return {
cometFactoryExtendedAssetList: cometFactoryExtendedAssetList.address,
cometFactoryWithExtendedAssetList: cometFactoryWithExtendedAssetList.address,
newCometExt: _newCometExt.address
};
},

async enact(deploymentManager: DeploymentManager, govDeploymentManager, {
cometFactoryExtendedAssetList,
cometFactoryWithExtendedAssetList,
newCometExt,
}) {

@@ -77,7 +77,7 @@ export default migration('1735299663_update_comet_to_support_more_collaterals',
newCometExtAddress = newCometExt;

const setFactoryCalldata = await calldata(
configurator.populateTransaction.setFactory(comet.address, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(comet.address, cometFactoryWithExtendedAssetList)
);

const setExtensionDelegateCalldata = await calldata(
Original file line number Diff line number Diff line change
@@ -20,9 +20,9 @@ export default migration('1735299703_update_comet_to_support_more_collaterals',
[]
);

const cometFactoryExtendedAssetList = await deploymentManager.deploy(
'cometFactoryExtendedAssetList',
'CometFactoryExtendedAssetList.sol',
const cometFactoryWithExtendedAssetList = await deploymentManager.deploy(
'cometFactoryWithExtendedAssetList',
'CometFactoryWithExtendedAssetList.sol',
[]
);
const {
@@ -52,13 +52,13 @@ export default migration('1735299703_update_comet_to_support_more_collaterals',
]
);
return {
cometFactoryExtendedAssetList: cometFactoryExtendedAssetList.address,
cometFactoryWithExtendedAssetList: cometFactoryWithExtendedAssetList.address,
newCometExt: _newCometExt.address
};
},

async enact(deploymentManager: DeploymentManager, govDeploymentManager, {
cometFactoryExtendedAssetList,
cometFactoryWithExtendedAssetList,
newCometExt,
}) {

@@ -78,7 +78,7 @@ export default migration('1735299703_update_comet_to_support_more_collaterals',
newCometExtAddress = newCometExt;

const setFactoryCalldata = await calldata(
configurator.populateTransaction.setFactory(comet.address, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(comet.address, cometFactoryWithExtendedAssetList)
);
const setExtensionDelegateCalldata = await calldata(
configurator.populateTransaction.setExtensionDelegate(comet.address, newCometExt)
@@ -89,7 +89,7 @@ export default migration('1735299703_update_comet_to_support_more_collaterals',
);

const setFactoryCalldataUSDC = await calldata(
configurator.populateTransaction.setFactory(USDC_COMET, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(USDC_COMET, cometFactoryWithExtendedAssetList)
);
const setExtensionDelegateCalldataUSDC = await calldata(
configurator.populateTransaction.setExtensionDelegate(USDC_COMET, newCometExt)
@@ -100,7 +100,7 @@ export default migration('1735299703_update_comet_to_support_more_collaterals',
);

const setFactoryCalldataWETH = await calldata(
configurator.populateTransaction.setFactory(WETH_COMET, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(WETH_COMET, cometFactoryWithExtendedAssetList)
);
const setExtensionDelegateCalldataWETH = await calldata(
configurator.populateTransaction.setExtensionDelegate(WETH_COMET, newCometExt)
@@ -111,7 +111,7 @@ export default migration('1735299703_update_comet_to_support_more_collaterals',
);

const setFactoryCalldataUSDBC = await calldata(
configurator.populateTransaction.setFactory(USDBC_COMET, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(USDBC_COMET, cometFactoryWithExtendedAssetList)
);
const setExtensionDelegateCalldataUSDBC = await calldata(
configurator.populateTransaction.setExtensionDelegate(USDBC_COMET, newCometExt)
Original file line number Diff line number Diff line change
@@ -16,9 +16,9 @@ export default migration('1735299714_update_comet_to_support_more_collaterals',
[]
);

const cometFactoryExtendedAssetList = await deploymentManager.deploy(
'cometFactoryExtendedAssetList',
'CometFactoryExtendedAssetList.sol',
const cometFactoryWithExtendedAssetList = await deploymentManager.deploy(
'cometFactoryWithExtendedAssetList',
'CometFactoryWithExtendedAssetList.sol',
[]
);
const {
@@ -48,13 +48,13 @@ export default migration('1735299714_update_comet_to_support_more_collaterals',
]
);
return {
cometFactoryExtendedAssetList: cometFactoryExtendedAssetList.address,
cometFactoryWithExtendedAssetList: cometFactoryWithExtendedAssetList.address,
newCometExt: _newCometExt.address
};
},

async enact(deploymentManager: DeploymentManager, govDeploymentManager, {
cometFactoryExtendedAssetList,
cometFactoryWithExtendedAssetList,
newCometExt,
}) {

@@ -74,7 +74,7 @@ export default migration('1735299714_update_comet_to_support_more_collaterals',
newCometExtAddress = newCometExt;

const setFactoryCalldata = await calldata(
configurator.populateTransaction.setFactory(comet.address, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(comet.address, cometFactoryWithExtendedAssetList)
);

const setExtensionDelegateCalldata = await calldata(
Original file line number Diff line number Diff line change
@@ -16,9 +16,9 @@ export default migration('1735299718_update_comet_to_support_more_collaterals',
[]
);

const cometFactoryExtendedAssetList = await deploymentManager.deploy(
'cometFactoryExtendedAssetList',
'CometFactoryExtendedAssetList.sol',
const cometFactoryWithExtendedAssetList = await deploymentManager.deploy(
'cometFactoryWithExtendedAssetList',
'CometFactoryWithExtendedAssetList.sol',
[]
);
const {
@@ -48,13 +48,13 @@ export default migration('1735299718_update_comet_to_support_more_collaterals',
]
);
return {
cometFactoryExtendedAssetList: cometFactoryExtendedAssetList.address,
cometFactoryWithExtendedAssetList: cometFactoryWithExtendedAssetList.address,
newCometExt: _newCometExt.address
};
},

async enact(deploymentManager: DeploymentManager, govDeploymentManager, {
cometFactoryExtendedAssetList,
cometFactoryWithExtendedAssetList,
newCometExt,
}) {

@@ -74,7 +74,7 @@ export default migration('1735299718_update_comet_to_support_more_collaterals',
newCometExtAddress = newCometExt;

const setFactoryCalldata = await calldata(
configurator.populateTransaction.setFactory(comet.address, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(comet.address, cometFactoryWithExtendedAssetList)
);

const setExtensionDelegateCalldata = await calldata(
Original file line number Diff line number Diff line change
@@ -16,9 +16,9 @@ export default migration('1735299723_update_comet_to_support_more_collaterals',
[]
);

const cometFactoryExtendedAssetList = await deploymentManager.deploy(
'cometFactoryExtendedAssetList',
'CometFactoryExtendedAssetList.sol',
const cometFactoryWithExtendedAssetList = await deploymentManager.deploy(
'cometFactoryWithExtendedAssetList',
'CometFactoryWithExtendedAssetList.sol',
[]
);
const {
@@ -48,13 +48,13 @@ export default migration('1735299723_update_comet_to_support_more_collaterals',
]
);
return {
cometFactoryExtendedAssetList: cometFactoryExtendedAssetList.address,
cometFactoryWithExtendedAssetList: cometFactoryWithExtendedAssetList.address,
newCometExt: _newCometExt.address
};
},

async enact(deploymentManager: DeploymentManager, govDeploymentManager, {
cometFactoryExtendedAssetList,
cometFactoryWithExtendedAssetList,
newCometExt,
}) {

@@ -74,7 +74,7 @@ export default migration('1735299723_update_comet_to_support_more_collaterals',
newCometExtAddress = newCometExt;

const setFactoryCalldata = await calldata(
configurator.populateTransaction.setFactory(comet.address, cometFactoryExtendedAssetList)
configurator.populateTransaction.setFactory(comet.address, cometFactoryWithExtendedAssetList)
);

const setExtensionDelegateCalldata = await calldata(
Loading

Unchanged files with check annotations Beta

/// @notice The number of assets this contract actually supports
uint8 public immutable numAssets;
constructor(CometConfiguration.AssetConfig[] memory assetConfigs) {
uint8 _numAssets = uint8(assetConfigs.length);
numAssets = _numAssets;
(asset00_a, asset00_b) = getPackedAssetInternal(assetConfigs, 0);
(asset01_a, asset01_b) = getPackedAssetInternal(assetConfigs, 1);
(asset02_a, asset02_b) = getPackedAssetInternal(assetConfigs, 2);
(asset03_a, asset03_b) = getPackedAssetInternal(assetConfigs, 3);
(asset04_a, asset04_b) = getPackedAssetInternal(assetConfigs, 4);
(asset05_a, asset05_b) = getPackedAssetInternal(assetConfigs, 5);
(asset06_a, asset06_b) = getPackedAssetInternal(assetConfigs, 6);
(asset07_a, asset07_b) = getPackedAssetInternal(assetConfigs, 7);
(asset08_a, asset08_b) = getPackedAssetInternal(assetConfigs, 8);
(asset09_a, asset09_b) = getPackedAssetInternal(assetConfigs, 9);
(asset10_a, asset10_b) = getPackedAssetInternal(assetConfigs, 10);
(asset11_a, asset11_b) = getPackedAssetInternal(assetConfigs, 11);
(asset12_a, asset12_b) = getPackedAssetInternal(assetConfigs, 12);
(asset13_a, asset13_b) = getPackedAssetInternal(assetConfigs, 13);
(asset14_a, asset14_b) = getPackedAssetInternal(assetConfigs, 14);
(asset15_a, asset15_b) = getPackedAssetInternal(assetConfigs, 15);
(asset16_a, asset16_b) = getPackedAssetInternal(assetConfigs, 16);
(asset17_a, asset17_b) = getPackedAssetInternal(assetConfigs, 17);
(asset18_a, asset18_b) = getPackedAssetInternal(assetConfigs, 18);
(asset19_a, asset19_b) = getPackedAssetInternal(assetConfigs, 19);
(asset20_a, asset20_b) = getPackedAssetInternal(assetConfigs, 20);
(asset21_a, asset21_b) = getPackedAssetInternal(assetConfigs, 21);
(asset22_a, asset22_b) = getPackedAssetInternal(assetConfigs, 22);
(asset23_a, asset23_b) = getPackedAssetInternal(assetConfigs, 23);
}

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: compound.solidity.missing-constructor-sanity-checks Warning

There're no sanity checks for the constructor argument assetConfigs.

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.non-payable-constructor Note

Consider making costructor payable to save gas.
/**
* @dev Checks and gets the packed asset info for storage in 2 variables
function getPackedAssetInternal(CometConfiguration.AssetConfig[] memory assetConfigs, uint i) internal view returns (uint256, uint256) {
CometConfiguration.AssetConfig memory assetConfig;
if (i < assetConfigs.length) {
assembly {

Check warning on line 121 in contracts/AssetList.sol

GitHub Actions / Contract linter

Avoid to use inline assembly. It is acceptable only in rare cases
assetConfig := mload(add(add(assetConfigs, 0x20), mul(i, 0x20)))
}
} else {
function nonReentrantBefore() internal {
bytes32 slot = REENTRANCY_GUARD_FLAG_SLOT;
uint256 status;
assembly ("memory-safe") {

Check warning on line 182 in contracts/CometWithExtendedAssetList.sol

GitHub Actions / Contract linter

Avoid to use inline assembly. It is acceptable only in rare cases
status := sload(slot)
}
if (status == REENTRANCY_GUARD_ENTERED) revert ReentrantCallBlocked();
assembly ("memory-safe") {

Check warning on line 187 in contracts/CometWithExtendedAssetList.sol

GitHub Actions / Contract linter

Avoid to use inline assembly. It is acceptable only in rare cases
sstore(slot, REENTRANCY_GUARD_ENTERED)
}
}
*/
function nonReentrantAfter() internal {
bytes32 slot = REENTRANCY_GUARD_FLAG_SLOT;
uint256 status;

Check warning on line 197 in contracts/CometWithExtendedAssetList.sol

GitHub Actions / Contract linter

Variable "status" is unused
assembly ("memory-safe") {

Check warning on line 198 in contracts/CometWithExtendedAssetList.sol

GitHub Actions / Contract linter

Avoid to use inline assembly. It is acceptable only in rare cases
sstore(slot, REENTRANCY_GUARD_NOT_ENTERED)
}
}
uint256 preTransferBalance = IERC20NonStandard(asset).balanceOf(address(this));
IERC20NonStandard(asset).transferFrom(from, address(this), amount);
bool success;
assembly ("memory-safe") {

Check warning on line 663 in contracts/CometWithExtendedAssetList.sol

GitHub Actions / Contract linter

Avoid to use inline assembly. It is acceptable only in rare cases
switch returndatasize()
case 0 { // This is a non-standard ERC-20
success := not(0) // set success to true
function doTransferOut(address asset, address to, uint amount) internal {
IERC20NonStandard(asset).transfer(to, amount);
bool success;
assembly ("memory-safe") {

Check warning on line 687 in contracts/CometWithExtendedAssetList.sol

GitHub Actions / Contract linter

Avoid to use inline assembly. It is acceptable only in rare cases
switch returndatasize()
case 0 { // This is a non-standard ERC-20
success := not(0) // set success to true
uint startGas = gasleft();
accrueInternal();
for (uint i = 0; i < accounts.length; ) {

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.array-length-outside-loop Note

Caching the array length outside a loop saves reading it on each iteration, as long as the array's length is not changed during the loop.
absorbInternal(absorber, accounts[i]);
unchecked { i++; }

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-prefix-increment-not-postfix Note

Consider using the prefix increment expression whenever the return value is not needed.
The prefix increment expression is cheaper in terms of gas.
}
uint gasUsed = startGas - gasleft();
// Using gas price instead of base fee would more accurately reflect spend,
// but is also subject to abuse if refunds were to be given automatically.
LiquidatorPoints memory points = liquidatorPoints[absorber];
points.numAbsorbs++;

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-prefix-increment-not-postfix Note

Consider using the prefix increment expression whenever the return value is not needed.
The prefix increment expression is cheaper in terms of gas.
points.numAbsorbed += safe64(accounts.length);
points.approxSpend += safe128(gasUsed * block.basefee);
liquidatorPoints[absorber] = points;
uint8 _reserved = accountUser._reserved;
uint256 basePrice = getPrice(baseTokenPriceFeed);
uint256 deltaValue = 0;

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.init-variables-with-default-value Note

Uninitialized variables are assigned with the types default value.
Explicitly initializing a variable with its default value costs unnecessary gas.
for (uint8 i = 0; i < numAssets; ) {
if (isInAsset(assetsIn, i, _reserved)) {
emit AbsorbCollateral(absorber, account, asset, seizeAmount, value);
}
unchecked { i++; }

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-prefix-increment-not-postfix Note

Consider using the prefix increment expression whenever the return value is not needed.
The prefix increment expression is cheaper in terms of gas.
}
uint256 deltaBalance = divPrice(deltaValue, basePrice, uint64(baseScale));
if (isBuyPaused()) revert Paused();
int reserves = getReserves();
if (reserves >= 0 && uint(reserves) >= targetReserves) revert NotForSale();

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.
// Note: Re-entrancy can skip the reserves check above on a second buyCollateral call.
baseAmount = doTransferIn(baseToken, msg.sender, baseAmount);
/**
* @notice Fallback to calling the extension delegate for everything else
*/
fallback() external payable {

Check warning on line 1242 in contracts/CometWithExtendedAssetList.sol

GitHub Actions / Contract linter

Fallback function must be simple
address delegate = extensionDelegate;
assembly {

Check warning on line 1244 in contracts/CometWithExtendedAssetList.sol

GitHub Actions / Contract linter

Avoid to use inline assembly. It is acceptable only in rare cases
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), delegate, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())