Skip to content

Commit

Permalink
fix: forge fmt(config vscode)
Browse files Browse the repository at this point in the history
  • Loading branch information
seinmyung25 committed Sep 2, 2024
1 parent 282816d commit 7cfbc12
Show file tree
Hide file tree
Showing 46 changed files with 583 additions and 547 deletions.
41 changes: 0 additions & 41 deletions .prettierrc.json

This file was deleted.

31 changes: 0 additions & 31 deletions .solhint.json

This file was deleted.

4 changes: 2 additions & 2 deletions contracts/ERC165.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity ^0.8.0;

import { IERC20, IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC20, IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

contract ERC165 {
bytes4 public erc20 = type(IERC20).interfaceId;
Expand Down
38 changes: 21 additions & 17 deletions contracts/access/CallOrder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,37 @@

pragma solidity ^0.8.0;

import { EcoOwnable } from "./EcoOwnable.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { StorageSlot } from "@openzeppelin/contracts/utils/StorageSlot.sol";
import {EcoOwnable} from "./EcoOwnable.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol";

interface ICallOrder {
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) external payable returns (bytes memory);
function functionCallWithValue(address target, bytes memory data, uint256 value)
external
payable
returns (bytes memory);

function functionDelegateCall(address target, bytes memory data) external payable returns (bytes memory);
}

abstract contract CallOrder is ICallOrder, EcoOwnable {
function functionCallWithValue(
address target,
bytes calldata data,
uint256 value
) external payable override onlyOwner returns (bytes memory) {
function functionCallWithValue(address target, bytes calldata data, uint256 value)
external
payable
override
onlyOwner
returns (bytes memory)
{
return Address.functionCallWithValue(target, data, value);
}

function functionDelegateCall(
address target,
bytes calldata data
) external payable override onlyOwner returns (bytes memory) {
function functionDelegateCall(address target, bytes calldata data)
external
payable
override
onlyOwner
returns (bytes memory)
{
return Address.functionDelegateCall(target, data);
}
}
6 changes: 3 additions & 3 deletions contracts/access/EcoOwnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity ^0.8.0;

import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";

interface IOwnable {
function owner() external view returns (address);
Expand Down
22 changes: 14 additions & 8 deletions contracts/access/SelectorRoleControlUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

pragma solidity ^0.8.0;

import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { IEcoOwnable, EcoOwnable } from "./EcoOwnable.sol";
import { AccessControlEnumerableUpgradeable, AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/extensions/AccessControlEnumerableUpgradeable.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";

import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

import { IAccessControlEnumerable, IAccessControl } from "@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {IEcoOwnable, EcoOwnable} from "./EcoOwnable.sol";
import {
AccessControlEnumerableUpgradeable,
AccessControlUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/extensions/AccessControlEnumerableUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";

import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

import {
IAccessControlEnumerable,
IAccessControl
} from "@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol";

interface IPausable {
function pause() external;
Expand Down
6 changes: 3 additions & 3 deletions contracts/access/SlotOrder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

pragma solidity ^0.8.0;

import { EcoOwnable } from "./EcoOwnable.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { StorageSlot } from "@openzeppelin/contracts/utils/StorageSlot.sol";
import {EcoOwnable} from "./EcoOwnable.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol";

interface ISlotOrder {
function setSlot(bytes32 slot, bytes32 value) external;
Expand Down
4 changes: 2 additions & 2 deletions contracts/access/test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity ^0.8.0;

import { EcoOwnable } from "./EcoOwnable.sol";
import { SelectorRoleControlUpgradeable } from "./SelectorRoleControlUpgradeable.sol";
import {EcoOwnable} from "./EcoOwnable.sol";
import {SelectorRoleControlUpgradeable} from "./SelectorRoleControlUpgradeable.sol";

contract Mock_TestEcoOwnable is EcoOwnable {
constructor() {
Expand Down
4 changes: 3 additions & 1 deletion contracts/ccip/interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ interface IStandardBridge {
bytes calldata _extraData
) external;

function finalizeBridgeETH(address _from, address _to, uint256 _amount, bytes calldata _extraData) external payable;
function finalizeBridgeETH(address _from, address _to, uint256 _amount, bytes calldata _extraData)
external
payable;

function finalizeBridgeERC20(
address _localToken,
Expand Down
4 changes: 3 additions & 1 deletion contracts/kroma/interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ interface IStandardBridge {
bytes calldata _extraData
) external;

function finalizeBridgeETH(address _from, address _to, uint256 _amount, bytes calldata _extraData) external payable;
function finalizeBridgeETH(address _from, address _to, uint256 _amount, bytes calldata _extraData)
external
payable;

function finalizeBridgeERC20(
address _localToken,
Expand Down
32 changes: 12 additions & 20 deletions contracts/kroma/mock_bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

pragma solidity ^0.8.20;

import { ISelectorRoleControl, SelectorRoleControlUpgradeable } from "../access/SelectorRoleControlUpgradeable.sol";
import {ISelectorRoleControl, SelectorRoleControlUpgradeable} from "../access/SelectorRoleControlUpgradeable.sol";

import { IKromaBridge } from "./interfaces.sol";
import { IEcoERC20 } from "../token/ERC20/IERC20.sol";
import { IL2BridgeERC20 } from "../token/ERC20/ERC20L2BridgedUpgradeable.sol";
import {IKromaBridge} from "./interfaces.sol";
import {IEcoERC20} from "../token/ERC20/IERC20.sol";
import {IL2BridgeERC20} from "../token/ERC20/ERC20L2BridgedUpgradeable.sol";

interface IMockKromaBridge is IKromaBridge, ISelectorRoleControl {
function remoteBridge() external view returns (IKromaBridge);
Expand Down Expand Up @@ -66,14 +66,10 @@ contract Mock_L1KromaBridge is MockKromaBridgeBase {
remoteBridge.finalizeBridgeERC20(_localToken, _remoteToken, _from, _to, _amount, _extraData);
}

function finalizeBridgeERC20(
address,
address _remoteToken,
address,
address _to,
uint256 _amount,
bytes calldata
) public onlyAdmin {
function finalizeBridgeERC20(address, address _remoteToken, address, address _to, uint256 _amount, bytes calldata)
public
onlyAdmin
{
// caller's remote == local
IEcoERC20(_remoteToken).transfer(_to, _amount);
}
Expand Down Expand Up @@ -104,14 +100,10 @@ contract Mock_L2KromaBridge is MockKromaBridgeBase {
remoteBridge.finalizeBridgeERC20(_localToken, _remoteToken, _from, _to, _amount, _extraData);
}

function finalizeBridgeERC20(
address,
address _remoteToken,
address,
address _to,
uint256 _amount,
bytes calldata
) public onlyAdmin {
function finalizeBridgeERC20(address, address _remoteToken, address, address _to, uint256 _amount, bytes calldata)
public
onlyAdmin
{
// caller's remote == local
IEcoERC20(_remoteToken).mint(_to, _amount);
}
Expand Down
32 changes: 16 additions & 16 deletions contracts/proxy/admin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

pragma solidity ^0.8.20;

import { EcoOwnable } from "../access/EcoOwnable.sol";
import { CallOrder } from "../access/CallOrder.sol";
import { SlotOrder } from "../access/SlotOrder.sol";
import { MulticallUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol";
import {EcoOwnable} from "../access/EcoOwnable.sol";
import {CallOrder} from "../access/CallOrder.sol";
import {SlotOrder} from "../access/SlotOrder.sol";
import {MulticallUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol";

import { ITransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";

interface IEcoProxyAdmin {
function initEcoProxyAdmin(address initialOwner) external;
Expand Down Expand Up @@ -50,18 +50,18 @@ contract EcoProxyAdmin is IEcoProxyAdmin, EcoOwnable, CallOrder, SlotOrder, Mult
* - This contract must be the admin of `proxy`.
* - If `data` is empty, `msg.value` must be zero.
*/
function upgradeAndCall(
ITransparentUpgradeableProxy proxy,
address implementation,
bytes memory data
) public payable virtual onlyOwner {
proxy.upgradeToAndCall{ value: msg.value }(implementation, data);
function upgradeAndCall(ITransparentUpgradeableProxy proxy, address implementation, bytes memory data)
public
payable
virtual
onlyOwner
{
proxy.upgradeToAndCall{value: msg.value}(implementation, data);
}
}

contract EcoProxyForProxyAdmin is ERC1967Proxy {
constructor(
address proxyAdminLogic,
address initialOwner
) ERC1967Proxy(proxyAdminLogic, abi.encodeWithSelector(IEcoProxyAdmin.initEcoProxyAdmin.selector, initialOwner)) {}
constructor(address proxyAdminLogic, address initialOwner)
ERC1967Proxy(proxyAdminLogic, abi.encodeWithSelector(IEcoProxyAdmin.initEcoProxyAdmin.selector, initialOwner))
{}
}
4 changes: 2 additions & 2 deletions contracts/proxy/test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

pragma solidity ^0.8.20;

import { EcoProxyAdmin } from "./admin.sol";
import {EcoProxyAdmin} from "./admin.sol";

contract Mock_TestProxyAdminFail is EcoProxyAdmin {
constructor() EcoProxyAdmin(_msgSender()) {}

function command(address to, uint256 value, bytes memory data) public payable returns (bytes memory) {
bool success;
(success, data) = to.call{ value: value }(data);
(success, data) = to.call{value: value}(data);
require(success, "call fail");
return data;
}
Expand Down
24 changes: 11 additions & 13 deletions contracts/proxy/transparent.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

pragma solidity ^0.8.0;

import { ERC1967Utils } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import { ITransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";

import { EcoProxyAdmin, EcoProxyForProxyAdmin } from "./admin.sol";
import {EcoProxyAdmin, EcoProxyForProxyAdmin} from "./admin.sol";

// EcoTransparentUpgradeableProxy
contract EcoTUPWithAdmin is ERC1967Proxy {
Expand Down Expand Up @@ -68,16 +68,14 @@ contract EcoTUPWithAdmin is ERC1967Proxy {
}

contract EcoTUPDeployAdmin is EcoTUPWithAdmin {
constructor(
address _logic,
bytes memory _data
) EcoTUPWithAdmin(address(new EcoProxyAdmin(msg.sender)), _logic, _data) {}
constructor(address _logic, bytes memory _data)
EcoTUPWithAdmin(address(new EcoProxyAdmin(msg.sender)), _logic, _data)
{}
}

contract EcoTUPWithAdminLogic is EcoTUPWithAdmin {
constructor(
address proxyAdminLogic,
address _logic,
bytes memory _data
) payable EcoTUPWithAdmin(address(new EcoProxyForProxyAdmin(proxyAdminLogic, msg.sender)), _logic, _data) {}
constructor(address proxyAdminLogic, address _logic, bytes memory _data)
payable
EcoTUPWithAdmin(address(new EcoProxyForProxyAdmin(proxyAdminLogic, msg.sender)), _logic, _data)
{}
}
Loading

0 comments on commit 7cfbc12

Please sign in to comment.