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

Squash Unichain Mainnet USDC #122

Open
wants to merge 83 commits into
base: squash-unichain-mainnet
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
83 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
56e20cc
fix: fixes after audit
MishaShWoof Jan 30, 2025
7e9df6c
feat: unichain-testnet
MishaShWoof Feb 4, 2025
ae82bb2
squash 24 collaterals
MishaShWoof Feb 7, 2025
7521336
Merge branch 'squash-unichain-sepolia' of github.com:woof-software/co…
MishaShWoof Feb 7, 2025
d196a86
wip
MishaShWoof Feb 7, 2025
7655616
feat: unichain usdc
MishaShWoof Feb 11, 2025
edc43d7
Merge branch 'squash-unichain-mainnet' of github.com:woof-software/co…
MishaShWoof Feb 11, 2025
f657b7c
fix
MishaShWoof Feb 11, 2025
431e6e1
fix
MishaShWoof Feb 11, 2025
b4b9004
fix: workflow
MishaShWoof Feb 11, 2025
7a79118
feat: description
MishaShWoof Feb 11, 2025
c2f4205
remove uni testnet
MishaShWoof Feb 12, 2025
2c412fd
fix: linter
MishaShWoof Feb 12, 2025
05f3c79
fix: review fixes
MishaShWoof Feb 14, 2025
2f43ee4
feat: specs from gauntlet
MishaShWoof Feb 17, 2025
fcf19d1
fix: review fix
MishaShWoof Feb 18, 2025
898c178
feat: update version of hayesgm/seacrest to support unichain
dmitriy-woof-software Feb 18, 2025
30651ae
clean up PR
dmitriy-woof-software Feb 18, 2025
d30cd80
clean up PR
dmitriy-woof-software Feb 18, 2025
7942c6e
Modified deployment roots from GitHub Actions
Feb 18, 2025
b414c9d
feat: update description, caps and speeds
dmitriy-woof-software Feb 18, 2025
14847bd
fix: verification and reward scenario fix
MishaShWoof Feb 19, 2025
f82afac
Add usds on base and wbtc on mainnet roots (#968)
dmitriy-woof-software Feb 24, 2025
ffd68b7
Add linea USDC roots (#969)
dmitriy-woof-software Feb 25, 2025
2ec6b45
Update LICENSE (#960)
maximevtush Feb 25, 2025
980f128
fix: audit fixes
MishaShWoof Feb 27, 2025
e155e64
fix: update description
MishaShWoof Feb 27, 2025
ca88508
Modified migration from GitHub Actions
Feb 27, 2025
059c119
Сomet with extended asset list (#904)
MishaShWoof Mar 6, 2025
e270b2a
Add Unichain USDC roots (#971)
dmitriy-woof-software Mar 6, 2025
12ff0d1
Proposal for Base USDS market (#959)
MishaShWoof Mar 7, 2025
2a132d2
Deploy WBTC market on Mainnet (#954)
MishaShWoof Mar 7, 2025
1b62da7
Merge branch 'main' of github.com:woof-software/comet into woof-softw…
dmitriy-woof-software Mar 7, 2025
38864f5
CCTP
MishaShWoof Mar 11, 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
2 changes: 1 addition & 1 deletion scenario/utils/index.ts
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import { isBridgeProposal } from './isBridgeProposal';

export { mineBlocks, setNextBaseFeeToZero, setNextBlockTimestamp };

export const MAX_ASSETS = 15;
export const MAX_ASSETS = 30;
export const UINT256_MAX = 2n ** 256n - 1n;

export interface ComparativeAmount {

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;
uint256[] memory _assets_a = new uint256[](_numAssets);
uint256[] memory _assets_b = new uint256[](_numAssets);
for (uint i = 0; i < _numAssets; ) {
(uint256 asset_a, uint256 asset_b) = getPackedAssetInternal(assetConfigs, i);
_assets_a[i] = asset_a;
_assets_b[i] = asset_b;
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.
}
assets_a = _assets_a;
assets_b = _assets_b;
}

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
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 51 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 179 in contracts/CometExtendedAssetList.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 184 in contracts/CometExtendedAssetList.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 194 in contracts/CometExtendedAssetList.sol

GitHub Actions / Contract linter

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

Check warning on line 195 in contracts/CometExtendedAssetList.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 638 in contracts/CometExtendedAssetList.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 662 in contracts/CometExtendedAssetList.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;
uint16 assetsIn = accountUser.assetsIn;
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)) {
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 1215 in contracts/CometExtendedAssetList.sol

GitHub Actions / Contract linter

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

Check warning on line 1217 in contracts/CometExtendedAssetList.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())