Skip to content

Commit

Permalink
Update formatting given recent forge fmt changes (#220)
Browse files Browse the repository at this point in the history
* Update formatting given recent forge fmt changes

* Resolve formatting issues

---------

Co-authored-by: Peter Robinson <[email protected]>
  • Loading branch information
ermyas and drinkcoffee authored May 16, 2024
1 parent f0d0c44 commit 24dc024
Show file tree
Hide file tree
Showing 49 changed files with 670 additions and 533 deletions.
10 changes: 7 additions & 3 deletions contracts/access/MintingAccessControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@ abstract contract MintingAccessControl is AccessControlEnumerable {
/// @notice Role to mint tokens
bytes32 public constant MINTER_ROLE = bytes32("MINTER_ROLE");

/** @notice Allows admin grant `user` `MINTER` role
/**
* @notice Allows admin grant `user` `MINTER` role
* @param user The address to grant the `MINTER` role to
*/
function grantMinterRole(address user) public onlyRole(DEFAULT_ADMIN_ROLE) {
grantRole(MINTER_ROLE, user);
}

/** @notice Allows admin to revoke `MINTER_ROLE` role from `user`
/**
* @notice Allows admin to revoke `MINTER_ROLE` role from `user`
* @param user The address to revoke the `MINTER` role from
*/
function revokeMinterRole(address user) public onlyRole(DEFAULT_ADMIN_ROLE) {
revokeRole(MINTER_ROLE, user);
}

/** @notice Returns the addresses which have DEFAULT_ADMIN_ROLE */
/**
* @notice Returns the addresses which have DEFAULT_ADMIN_ROLE
*/
function getAdmins() public view returns (address[] memory) {
uint256 adminCount = getRoleMemberCount(DEFAULT_ADMIN_ROLE);
address[] memory admins = new address[](adminCount);
Expand Down
3 changes: 2 additions & 1 deletion contracts/allowlist/IOperatorAllowlist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ pragma solidity 0.8.19;
* @notice Required interface of an OperatorAllowlist compliant contract
*/
interface IOperatorAllowlist {
/** @notice Returns true if an address is Allowlisted false otherwise
/**
* @notice Returns true if an address is Allowlisted false otherwise
* @param target the address to be checked against the Allowlist
*/
function isAllowlisted(address target) external view returns (bool);
Expand Down
86 changes: 61 additions & 25 deletions contracts/bridge/x/v4/CoreV4.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,59 @@ interface CoreV4 {
);
event LogDepositCancel(uint256 starkKey, uint256 vaultId, uint256 assetId);
event LogDepositCancelReclaimed(
uint256 starkKey, uint256 vaultId, uint256 assetType, uint256 nonQuantizedAmount, uint256 quantizedAmount
uint256 starkKey,
uint256 vaultId,
uint256 assetType,
uint256 nonQuantizedAmount,
uint256 quantizedAmount
);
event LogDepositNftCancelReclaimed(
uint256 starkKey, uint256 vaultId, uint256 assetType, uint256 tokenId, uint256 assetId
uint256 starkKey,
uint256 vaultId,
uint256 assetType,
uint256 tokenId,
uint256 assetId
);
event LogMintWithdrawalPerformed(
uint256 ownerKey, uint256 assetType, uint256 nonQuantizedAmount, uint256 quantizedAmount, uint256 assetId
uint256 ownerKey,
uint256 assetType,
uint256 nonQuantizedAmount,
uint256 quantizedAmount,
uint256 assetId
);
event LogMintableWithdrawalAllowed(uint256 ownerKey, uint256 assetId, uint256 quantizedAmount);
event LogNftDeposit(
address depositorEthKey, uint256 starkKey, uint256 vaultId, uint256 assetType, uint256 tokenId, uint256 assetId
address depositorEthKey,
uint256 starkKey,
uint256 vaultId,
uint256 assetType,
uint256 tokenId,
uint256 assetId
);
event LogNftWithdrawalAllowed(uint256 ownerKey, uint256 assetId);
event LogNftWithdrawalPerformed(
uint256 ownerKey, uint256 assetType, uint256 tokenId, uint256 assetId, address recipient
uint256 ownerKey,
uint256 assetType,
uint256 tokenId,
uint256 assetId,
address recipient
);
event LogTokenAdminAdded(address tokenAdmin);
event LogTokenAdminRemoved(address tokenAdmin);
event LogTokenRegistered(uint256 assetType, bytes assetInfo, uint256 quantum);
event LogUserRegistered(address ethKey, uint256 starkKey, address sender);
event LogWithdrawalAllowed(
uint256 ownerKey, uint256 assetType, uint256 nonQuantizedAmount, uint256 quantizedAmount
uint256 ownerKey,
uint256 assetType,
uint256 nonQuantizedAmount,
uint256 quantizedAmount
);
event LogWithdrawalPerformed(
uint256 ownerKey, uint256 assetType, uint256 nonQuantizedAmount, uint256 quantizedAmount, address recipient
uint256 ownerKey,
uint256 assetType,
uint256 nonQuantizedAmount,
uint256 quantizedAmount,
address recipient
);

function defaultVaultWithdrawalLock() external view returns (uint256);
Expand All @@ -137,24 +165,27 @@ interface CoreV4 {

function getAssetInfo(uint256 assetType) external view returns (bytes memory assetInfo);

function getCancellationRequest(uint256 starkKey, uint256 assetId, uint256 vaultId)
external
view
returns (uint256 request);
function getCancellationRequest(
uint256 starkKey,
uint256 assetId,
uint256 vaultId
) external view returns (uint256 request);

function getDepositBalance(uint256 starkKey, uint256 assetId, uint256 vaultId)
external
view
returns (uint256 balance);
function getDepositBalance(
uint256 starkKey,
uint256 assetId,
uint256 vaultId
) external view returns (uint256 balance);

function getEthKey(uint256 ownerKey) external view returns (address);

function getFullWithdrawalRequest(uint256 starkKey, uint256 vaultId) external view returns (uint256 res);

function getQuantizedDepositBalance(uint256 starkKey, uint256 assetId, uint256 vaultId)
external
view
returns (uint256 balance);
function getQuantizedDepositBalance(
uint256 starkKey,
uint256 assetId,
uint256 vaultId
) external view returns (uint256 balance);

function getQuantum(uint256 presumedAssetType) external view returns (uint256 quantum);

Expand Down Expand Up @@ -241,21 +272,26 @@ interface CoreV4 {

event LogDefaultVaultWithdrawalLockSet(uint256 newDefaultLockTime);
event LogDepositToVault(
address ethKey, uint256 assetId, uint256 vaultId, uint256 nonQuantizedAmount, uint256 quantizedAmount
address ethKey,
uint256 assetId,
uint256 vaultId,
uint256 nonQuantizedAmount,
uint256 quantizedAmount
);
event LogVaultWithdrawalLockSet(address ethKey, uint256 assetId, uint256 vaultId, uint256 timeRelease);
event LogWithdrawalFromVault(
address ethKey, uint256 assetId, uint256 vaultId, uint256 nonQuantizedAmount, uint256 quantizedAmount
address ethKey,
uint256 assetId,
uint256 vaultId,
uint256 nonQuantizedAmount,
uint256 quantizedAmount
);

function depositERC20ToVault(uint256 assetId, uint256 vaultId, uint256 quantizedAmount) external;

function depositEthToVault(uint256 assetId, uint256 vaultId) external payable;

function getQuantizedVaultBalance(address ethKey, uint256 assetId, uint256 vaultId)
external
view
returns (uint256);
function getQuantizedVaultBalance(address ethKey, uint256 assetId, uint256 vaultId) external view returns (uint256);

function getVaultBalance(address ethKey, uint256 assetId, uint256 vaultId) external view returns (uint256);

Expand Down
9 changes: 6 additions & 3 deletions contracts/bridge/x/v4/RegistrationV4.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ contract RegistrationV4 {
imx = CoreV4(_imx);
}

function registerAndWithdrawAll(address ethKey, uint256 starkKey, bytes calldata signature, uint256 assetType)
external
{
function registerAndWithdrawAll(
address ethKey,
uint256 starkKey,
bytes calldata signature,
uint256 assetType
) external {
if (!isRegistered(starkKey)) {
imx.registerEthAddress(ethKey, starkKey, signature);
}
Expand Down
5 changes: 4 additions & 1 deletion contracts/deployer/create/OwnableCreateDeploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ contract OwnableCreateDeploy {
* @param bytecode The bytecode of the contract to be deployed
*/
// slither-disable-next-line locked-ether

function deploy(bytes memory bytecode) external payable {
// solhint-disable-next-line custom-errors
require(msg.sender == owner, "CreateDeploy: caller is not the owner");
assembly {
if iszero(create(callvalue(), add(bytecode, 32), mload(bytecode))) { revert(0, 0) }
if iszero(create(callvalue(), add(bytecode, 32), mload(bytecode))) {
revert(0, 0)
}
}
}
}
6 changes: 3 additions & 3 deletions contracts/mocks/MockOnReceive.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ contract MockOnReceive {

// Attempt to transfer token to another address on receive
function onERC721Received(
address /* operator */,
address /* from */,
uint256 tokenId,
address,
/* operator */ address,
/* from */ uint256 tokenId,
bytes calldata /* data */
) public returns (bytes4) {
tokenAddress.transferFrom(address(this), recipient, tokenId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ pragma solidity 0.8.19;
// using the following command to dependency clashes.
// npm install @chainlink/contracts

/** ****************************************************************************
/**
*
* @notice Interface for contracts using VRF randomness
* *****************************************************************************
* @dev PURPOSE
Expand Down Expand Up @@ -102,6 +103,7 @@ pragma solidity 0.8.19;
abstract contract VRFConsumerBaseV2 {
error OnlyCoordinatorCanFulfill(address have, address want);
// solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i

address private immutable vrfCoordinator;

/**
Expand Down
1 change: 0 additions & 1 deletion contracts/random/offchainsources/supra/ISupraRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity 0.8.19;
/**
* @notice API for interacting with Supra's Verifiable Random Function.
*/

interface ISupraRouter {
function generateRequest(
string memory _functionSig,
Expand Down
1 change: 0 additions & 1 deletion contracts/token/erc1155/preset/ImmutableERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {ImmutableERC1155Base} from "../abstract/ImmutableERC1155Base.sol";
* @title ImmutableERC1155
* @author @jasonzwli, Immutable
*/

contract ImmutableERC1155 is ImmutableERC1155Base {
/// ===== Constructor =====

Expand Down
22 changes: 13 additions & 9 deletions contracts/token/erc20/preset/ImmutableERC20FixedSupplyNoBurn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,37 @@ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {IImmutableERC20Errors} from "./Errors.sol";


/**
* @notice ERC 20 contract that mints a fixed total supply of tokens when the contract
* @notice ERC 20 contract that mints a fixed total supply of tokens when the contract
* is deployed.
* @dev This contract has the concept of an owner, called _hubOwner in the constructor.
* @dev This contract has the concept of an owner, called _hubOwner in the constructor.
* This account has no rights to execute any administrative actions within the contract,
* with the exception of transferOwnership. This account is accessed via the owner()
* function. The Immutable Hub uses this function to help associate the ERC 20 contract
* with the exception of transferOwnership. This account is accessed via the owner()
* function. The Immutable Hub uses this function to help associate the ERC 20 contract
* with a specific Immutable Hub account.
*/
contract ImmutableERC20FixedSupplyNoBurn is Ownable, ERC20 {

/**
* @dev Mints `_totalSupply` number of token and transfers them to `_owner`.
*
* @param _name Name of the token.
* @param _symbol Token symbol.
* @param _totalSupply Supply of the token.
* @param _treasurer Initial owner of entire supply of all tokens.
* @param _hubOwner The account associated with Immutable Hub.
* @param _hubOwner The account associated with Immutable Hub.
*/
constructor(string memory _name, string memory _symbol, uint256 _totalSupply, address _treasurer, address _hubOwner) ERC20(_name, _symbol) {
constructor(
string memory _name,
string memory _symbol,
uint256 _totalSupply,
address _treasurer,
address _hubOwner
) ERC20(_name, _symbol) {
_mint(_treasurer, _totalSupply);
_transferOwnership(_hubOwner);
}

/**
/**
* @notice Prevent calls to renounce ownership.
*/
function renounceOwnership() public pure override {
Expand Down
22 changes: 12 additions & 10 deletions contracts/token/erc20/preset/ImmutableERC20MinterBurnerPermit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {IImmutableERC20Errors} from "./Errors.sol";
* @notice ERC 20 contract that wraps Open Zeppelin's ERC 20 contract.
* This contract has the concept of a hubOwner, called _hubOwner in the constructor.
* This account has no rights to execute any administrative actions within the contract,
* with the exception of renouncing their ownership.
* The Immutable Hub uses this function to help associate the ERC 20 contract
* with the exception of renouncing their ownership.
* The Immutable Hub uses this function to help associate the ERC 20 contract
* with a specific Immutable Hub account.
*/
contract ImmutableERC20MinterBurnerPermit is ERC20Capped, ERC20Burnable, ERC20Permit, MintingAccessControl {
Expand All @@ -24,19 +24,24 @@ contract ImmutableERC20MinterBurnerPermit is ERC20Capped, ERC20Burnable, ERC20Pe
* @dev Delegate to Open Zeppelin's contract.
* @param _roleAdmin The account that has the DEFAULT_ADMIN_ROLE.
* @param _minterAdmin The account that has the MINTER_ROLE.
* @param _hubOwner The account that owns the contract and is associated with Immutable Hub.
* @param _hubOwner The account that owns the contract and is associated with Immutable Hub.
* @param _name Name of the token.
* @param _symbol Token symbol.
* @param _maxTokenSupply The maximum supply of the token.
*/
constructor(address _roleAdmin, address _minterAdmin, address _hubOwner, string memory _name, string memory _symbol, uint256 _maxTokenSupply) ERC20(_name, _symbol) ERC20Permit(_name) ERC20Capped(_maxTokenSupply) {
constructor(
address _roleAdmin,
address _minterAdmin,
address _hubOwner,
string memory _name,
string memory _symbol,
uint256 _maxTokenSupply
) ERC20(_name, _symbol) ERC20Permit(_name) ERC20Capped(_maxTokenSupply) {
_grantRole(DEFAULT_ADMIN_ROLE, _roleAdmin);
_grantRole(HUB_OWNER_ROLE, _hubOwner);
_grantRole(MINTER_ROLE, _minterAdmin);
}


/**
* @dev Mints `amount` number of token and transfers them to the `to` address.
* @param to the address to mint the tokens to.
Expand All @@ -46,9 +51,8 @@ contract ImmutableERC20MinterBurnerPermit is ERC20Capped, ERC20Burnable, ERC20Pe
_mint(to, amount);
}


/**
* @dev Renounces the role `role` from the calling account. Prevents the last hub owner and admin from
* @dev Renounces the role `role` from the calling account. Prevents the last hub owner and admin from
* renouncing their role.
* @param role The role to renounce.
* @param account The account to renounce the role from.
Expand All @@ -60,12 +64,10 @@ contract ImmutableERC20MinterBurnerPermit is ERC20Capped, ERC20Burnable, ERC20Pe
super.renounceRole(role, account);
}


/**
* @dev Delegate to Open Zeppelin's ERC20Capped contract.
*/
function _mint(address account, uint256 amount) internal override(ERC20, ERC20Capped) {
ERC20Capped._mint(account, amount);
}

}
Loading

0 comments on commit 24dc024

Please sign in to comment.