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

Scroll and Scroll testnet deployment + proposals #813

Merged
merged 14 commits into from
Mar 28, 2024

Conversation

kevincheng96
Copy link
Contributor

@kevincheng96 kevincheng96 commented Sep 14, 2023

Create deployment and market initialization proposals on Scroll mainnet and Scroll Alpha testnet (bridged to Goerli) for USDC market

by @isabellewei from the Scroll team

Comment on lines 14 to 22
constructor(address l2Messenger_) {
l2Messenger = l2Messenger_;
}

Check notice

Code scanning / Semgrep

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

Consider making costructor payable to save gas.
Comment on lines 14 to 22
constructor(address l2Messenger_) {
l2Messenger = l2Messenger_;
}

Check warning

Code scanning / Semgrep

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

There're no sanity checks for the constructor argument l2Messenger_.
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Comment on lines +19 to +22
constructor(address l2Messenger_) {
l2Messenger = l2Messenger_;
emit NewL2Messenger(address(0), l2Messenger_);
}

Check notice

Code scanning / Semgrep OSS

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

Consider making costructor payable to save gas.
Comment on lines +19 to +22
constructor(address l2Messenger_) {
l2Messenger = l2Messenger_;
emit NewL2Messenger(address(0), l2Messenger_);
}

Check warning

Code scanning / Semgrep OSS

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

There're no sanity checks for the constructor argument l2Messenger_.
@kevincheng96 kevincheng96 changed the title Scroll Alpha testnet deployment Scroll and Scroll testnet deployment + proposals Mar 28, 2024
isabellewei and others added 11 commits March 28, 2024 12:11
* debug

* update price feed

* update config

* temp workaround

* add scroll to scenarios

* uncomment spider debug messages

* add scroll relations

* catch failed spider crawls

* Fix spider for scroll

* update bridge receiver to be compatible with scroll bridge

* update relations

* Modified deployment roots from GitHub Actions

* remove console.log

* rename scroll messenger

* add scroll to governance scenarios

* adapt scroll relay message fn

---------

Co-authored-by: Isabelle Wei <[email protected]>
Co-authored-by: isabelle <[email protected]>
Co-authored-by: kevincheng96 <[email protected]>
Co-authored-by: GitHub Actions Bot <>
* debug

* update price feed

* update config

* temp workaround

* add scroll to scenarios

* uncomment spider debug messages

* add scroll relations

* catch failed spider crawls

* Fix spider for scroll

* update bridge receiver to be compatible with scroll bridge

* update relations

* Modified deployment roots from GitHub Actions

* remove console.log

* rename scroll messenger

* add scroll to governance scenarios

* adapt scroll relay message fn

* fix unit tests

* rename contracts and update message relaying

---------

Co-authored-by: Isabelle Wei <[email protected]>
Co-authored-by: isabelle <[email protected]>
Co-authored-by: kevincheng96 <[email protected]>
Co-authored-by: GitHub Actions Bot <>
…file (#817)

* debug

* update price feed

* update config

* temp workaround

* add scroll to scenarios

* uncomment spider debug messages

* add scroll relations

* catch failed spider crawls

* Fix spider for scroll

* update bridge receiver to be compatible with scroll bridge

* update relations

* Modified deployment roots from GitHub Actions

* remove console.log

* rename scroll messenger

* add scroll to governance scenarios

* adapt scroll relay message fn

* fix unit tests

* rename contracts and update message relaying

* update scroll testnet block explorer URL

* remove base fee

* fix scroll l2 sender address

* remove old roots

* fix type errors

* Modified deployment roots from GitHub Actions

* proposal for intializing usdc market on scroll goerli

* add configurator to scroll relations

* PR comments

---------

Co-authored-by: Isabelle Wei <[email protected]>
Co-authored-by: isabelle <[email protected]>
Co-authored-by: kevincheng96 <[email protected]>
Co-authored-by: GitHub Actions Bot <>
Contract code updates for the OZ audits:
- added docstrings to `ScrollBridgeReceiver` and `IScrollMessenger`
- emit an event when constructing `ScrollBridgeReceiver`

Other fly-by changes:
- update blockscout URL
- update roots from running migration
* debug

* update price feed

* update config

* temp workaround

* add scroll to scenarios

* uncomment spider debug messages

* add scroll relations

* catch failed spider crawls

* Fix spider for scroll

* update bridge receiver to be compatible with scroll bridge

* update relations

* Modified deployment roots from GitHub Actions

* remove console.log

* rename scroll messenger

* add scroll to governance scenarios

* adapt scroll relay message fn

* fix unit tests

* rename contracts and update message relaying

* update scroll testnet block explorer URL

* remove base fee

* fix scroll l2 sender address

* remove old roots

* fix type errors

* Modified deployment roots from GitHub Actions

* proposal for intializing usdc market on scroll goerli

* add configurator to scroll relations

* PR comments

* add docstrings

* emit event when intializing ScrollBridgeReceiver

* PR comments

* update comment

* add usdc market on scroll mainnet

* fix wseth

* create migration

* use gauntlet recommended parameters

* lint and fix timelock params

* set  rewards speed to 0

* add pause guardian

* fix scientific notation

* add scroll mainnet roots

* update scroll relations for wsteth

* PR comments

* update wsteth/USD price feed to exchange rate based

* Modified deployment roots from GitHub Actions

* update proposal description

* update scroll governance proposal to bridge USDC instead of COMP

* final PR comments

* set message value on propsal actions

---------

Co-authored-by: Isabelle Wei <[email protected]>
Co-authored-by: isabelle <[email protected]>
Co-authored-by: kevincheng96 <[email protected]>
Co-authored-by: GitHub Actions Bot <>
Comment on lines +140 to +202
constructor(Configuration memory config) {
// Sanity checks
uint8 decimals_ = ERC20(config.baseToken).decimals();
if (decimals_ > MAX_BASE_DECIMALS) revert BadDecimals();
if (config.storeFrontPriceFactor > FACTOR_SCALE) revert BadDiscount();
if (config.assetConfigs.length > MAX_ASSETS) revert TooManyAssets();
if (config.baseMinForRewards == 0) revert BadMinimum();
if (IPriceFeed(config.baseTokenPriceFeed).decimals() != PRICE_FEED_DECIMALS) revert BadDecimals();

// Copy configuration
unchecked {
governor = config.governor;
pauseGuardian = config.pauseGuardian;
baseToken = config.baseToken;
baseTokenPriceFeed = config.baseTokenPriceFeed;
extensionDelegate = config.extensionDelegate;
storeFrontPriceFactor = config.storeFrontPriceFactor;

decimals = decimals_;
baseScale = uint64(10 ** decimals_);
trackingIndexScale = config.trackingIndexScale;
if (baseScale < BASE_ACCRUAL_SCALE) revert BadDecimals();
accrualDescaleFactor = baseScale / BASE_ACCRUAL_SCALE;

baseMinForRewards = config.baseMinForRewards;
baseTrackingSupplySpeed = config.baseTrackingSupplySpeed;
baseTrackingBorrowSpeed = config.baseTrackingBorrowSpeed;

baseBorrowMin = config.baseBorrowMin;
targetReserves = config.targetReserves;
}

// Set interest rate model configs
unchecked {
supplyKink = config.supplyKink;
supplyPerSecondInterestRateSlopeLow = config.supplyPerYearInterestRateSlopeLow / SECONDS_PER_YEAR;
supplyPerSecondInterestRateSlopeHigh = config.supplyPerYearInterestRateSlopeHigh / SECONDS_PER_YEAR;
supplyPerSecondInterestRateBase = config.supplyPerYearInterestRateBase / SECONDS_PER_YEAR;
borrowKink = config.borrowKink;
borrowPerSecondInterestRateSlopeLow = config.borrowPerYearInterestRateSlopeLow / SECONDS_PER_YEAR;
borrowPerSecondInterestRateSlopeHigh = config.borrowPerYearInterestRateSlopeHigh / SECONDS_PER_YEAR;
borrowPerSecondInterestRateBase = config.borrowPerYearInterestRateBase / SECONDS_PER_YEAR;
}

// Set asset info
numAssets = uint8(config.assetConfigs.length);

(asset00_a, asset00_b) = getPackedAssetInternal(config.assetConfigs, 0);
(asset01_a, asset01_b) = getPackedAssetInternal(config.assetConfigs, 1);
(asset02_a, asset02_b) = getPackedAssetInternal(config.assetConfigs, 2);
(asset03_a, asset03_b) = getPackedAssetInternal(config.assetConfigs, 3);
(asset04_a, asset04_b) = getPackedAssetInternal(config.assetConfigs, 4);
(asset05_a, asset05_b) = getPackedAssetInternal(config.assetConfigs, 5);
(asset06_a, asset06_b) = getPackedAssetInternal(config.assetConfigs, 6);
(asset07_a, asset07_b) = getPackedAssetInternal(config.assetConfigs, 7);
(asset08_a, asset08_b) = getPackedAssetInternal(config.assetConfigs, 8);
(asset09_a, asset09_b) = getPackedAssetInternal(config.assetConfigs, 9);
(asset10_a, asset10_b) = getPackedAssetInternal(config.assetConfigs, 10);
(asset11_a, asset11_b) = getPackedAssetInternal(config.assetConfigs, 11);
(asset12_a, asset12_b) = getPackedAssetInternal(config.assetConfigs, 12);
(asset13_a, asset13_b) = getPackedAssetInternal(config.assetConfigs, 13);
(asset14_a, asset14_b) = getPackedAssetInternal(config.assetConfigs, 14);
}

Check notice

Code scanning / Semgrep OSS

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

Consider making costructor payable to save gas.
if (assetInfo.asset == asset) {
return assetInfo;
}
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.
asset.borrowCollateralFactor
));
}
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.
asset.liquidateCollateralFactor
));
}
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.
bool absorbPaused,
bool buyPaused
) override external {
if (msg.sender != governor && msg.sender != pauseGuardian) revert Unauthorized();

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 +732 to +735
} else if (initialUserBalance != 0 && finalUserBalance == 0) {
// clear bit for asset
userBasic[account].assetsIn &= ~(uint16(1) << assetInfo.offset);
}

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.
accrueInternal();
for (uint i = 0; i < accounts.length; ) {
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.
// 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.

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.
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.
@kevincheng96
Copy link
Contributor Author

I moved the one-line change to Comet.sol into a separate ScrollComet.sol because other networks are still using the original Comet.sol.

Merging now that proposal 233 has passed and queued.

@kevincheng96 kevincheng96 merged commit cb53e0b into main Mar 28, 2024
14 of 40 checks passed
@kevincheng96 kevincheng96 deleted the isabellewei/scroll-deploy branch March 28, 2024 19:53
vincetiu8 pushed a commit to vincetiu8/comet that referenced this pull request May 3, 2024
Create deployment and market initialization proposals on Scroll mainnet and Scroll Alpha testnet (bridged to Goerli) for USDC market

by @isabellewei from the Scroll team

---------

Co-authored-by: isabellewei <[email protected]>
Co-authored-by: Isabelle Wei <[email protected]>
Co-authored-by: isabelle <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants