8000 Sonic cUSDCev3 by MishaShWoof · Pull Request #975 · compound-finance/comet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Sonic cUSDCev3 #975

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

Open
wants to merge 80 commits into
base: main
Choose a base branch
from

Conversation

MishaShWoof
Copy link
Contributor

No description provided.

Comment on lines 11 to 17
function supportsInterface(
bytes4 interfaceId
) public view virtual override returns (bool) {
return
interfaceId == type(IAny2EVMMessageReceiver).interfaceId ||
interfaceId == type(IERC165).interfaceId;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be better to have it at the end.

import {IERC165} from "../../IERC165.sol";
import {IAny2EVMMessageReceiver, Any2EVMMessage} from "../../IAny2EVMMessageReceiver.sol";

contract RoninBridgeReceiver is SweepableBridgeReceiver, IERC165, IAny2EVMMessageReceiver{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
contract RoninBridgeReceiver is SweepableBridgeReceiver, IERC165, IAny2EVMMessageReceiver{
contract RoninBridgeReceiver is SweepableBridgeReceiver, IERC165, IAny2EVMMessageReceiver {

Comment on lines 19 to 22
error InvalidRouter();
error InvalidChainSelector();

address public l2Router;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error InvalidRouter();
error InvalidChainSelector();
address public l2Router;
address public l2Router;
error InvalidRouter();
error InvalidChainSelector();


function ccipReceive(Any2EVMMessage calldata message) external {
if (msg.sender != l2Router) revert InvalidRouter();
if(message.sourceChainSelector != MAINNET_CHAIN_SELECTOR) revert InvalidChainSelector();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(message.sourceChainSelector != MAINNET_CHAIN_SELECTOR) revert InvalidChainSelector();
if (message.sourceChainSelector != MAINNET_CHAIN_SELECTOR) revert InvalidChainSelector();

Comment on lines 22 to 26
function initialize(address _timelock, address _bridge) public {
require(timelock == address(0), "already initialized");
timelock = _timelock;
bridge = _bridge;
}

Check failure

Code scanning / Semgrep OSS

Semgrep Finding: compound.solidity.lack-of-revert-alreadyinitialized

Function initialize() doesn't have AlreadyInitialized revert
mapping(uint256 => ClaimData) public claims;

function initialize(address _timelock, address _bridge) public {
require(timelock == address(0), "already initialized");

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-custom-error-not-require

Consider using custom errors as they are more gas efficient while allowing developers to describe the error in detail using NatSpec.
Comment on lines 28 to 31
function setClaimData(uint256 id, address token, uint256 amount, address l2Token, address to) public {
require(msg.sender == address(this), "only delegator");
claims[id] = ClaimData(id, token, amount, l2Token, to);
}

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: compound.solidity.state-changing-func-does-not-emit-event

A state changing function does not emit an event.
}

function setClaimData(uint256 id, address token, uint256 amount, address l2Token, address to) public {
require(msg.sender == address(this), "only delegator");

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-custom-error-not-require

Consider using custom errors as they are more gas efficient while allowing developers to describe the error in detail using NatSpec.
}

function call(address[] calldata targets, bytes[] calldata callDatas, uint256[] calldata values) public payable {
require(msg.sender == timelock, "only timelock");

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-custom-error-not-require

Consider using custom errors as they are more gas efficient while allowing developers to describe the error in detail using NatSpec.
function call(address[] calldata targets, bytes[] calldata callDatas, uint256[] calldata values) public payable {
require(msg.sender == timelock, "only timelock");
require(targets.length == callDatas.length && targets.length == values.length, "targets and data length mismatch");
for (uint i = 0; i < targets.length; i++) {

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.unnecessary-checked-arithmetic-in-loop

A lot of times there is no risk that the loop counter can overflow. Using Solidity's unchecked block saves the overflow checks.
function call(address[] calldata targets, bytes[] calldata callDatas, uint256[] calldata values) public payable {
require(msg.sender == timelock, "only timelock");
require(targets.length == callDatas.length && targets.length == values.length, "targets and data length mismatch");
for (uint i = 0; i < targets.length; i++) {

Check notice

Code scanning / Semgrep OSS

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

Consider using the prefix increment expression whenever the return value is not needed. The prefix increment expression is cheaper in terms of gas.
require(msg.sender == timelock, "only timelock");
require(targets.length == callDatas.length && targets.length == values.length, "targets and data length mismatch");
for (uint i = 0; i < targets.length; i++) {
(bool success, bytes memory returnData) = targets[i].call{value: values[i]}(callDatas[i]);

Check failure

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.security.arbitrary-low-level-call

An attacker may perform call() to an arbitrary address with controlled calldata
(bool success, bytes memory returnData) = targets[i].call{value: values[i]}(callDatas[i]);
if (!success) {
// revert with the original error message from the call
if (returnData.length > 0) {

Check notice

Code scanning / Semgrep OSS

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

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.
revert(add(32, returnData), returndata_size)
}
} else {
revert("Delegator: call failed");

Check notice

Code scanning / Semgrep OSS

Semgrep Finding: rules.solidity.performance.use-custom-error-not-require

Consider using custom errors as they are more gas efficient while allowing developers to describe the error in detail using NatSpec.
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.

4 participants
0