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

fix: remove unnecessary visibility from constructors #180

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 contracts/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ contract Bridge is Pausable, Context, EIP712 {
@param domainID ID of chain the Bridge contract exists on.
@param accessControl Address of access control contract.
*/
constructor (uint8 domainID, address accessControl) EIP712("Bridge", "3.1.0") public {
constructor (uint8 domainID, address accessControl) EIP712("Bridge", "3.1.0") {
_domainID = domainID;
_accessControl = IAccessControlSegregator(accessControl);

Expand Down
6 changes: 3 additions & 3 deletions contracts/Forwarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract Forwarder is EIP712 {

mapping(address => uint256) private _nonces;

constructor() EIP712("Forwarder", "0.0.1") public {}
constructor() EIP712("Forwarder", "0.0.1") {}

function getNonce(address from) public view returns (uint256) {
return _nonces[from];
Expand All @@ -49,9 +49,9 @@ contract Forwarder is EIP712 {
(bool success, bytes memory returndata) = req.to.call{gas: req.gas, value: req.value}(
abi.encodePacked(req.data, req.from)
);

assert(gasleft() > req.gas / 63);

return (success, returndata);
}
}
}
2 changes: 1 addition & 1 deletion contracts/Migrations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ contract Migrations {
address public owner;
uint public last_completed_migration;

constructor() public {
constructor() {
owner = msg.sender;
}

Expand Down
10 changes: 5 additions & 5 deletions contracts/TestContracts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ contract HandlerRevert is ERCHandlerHelpers {

constructor(
address bridgeAddress
) public ERCHandlerHelpers(bridgeAddress) {
) ERCHandlerHelpers(bridgeAddress) {
}

function executeProposal(bytes32, bytes calldata) external view {
Expand Down Expand Up @@ -163,7 +163,7 @@ contract XC20Test is ERC20 {
contract ERC20PresetMinterPauserDecimals is ERC20PresetMinterPauser {

uint8 private immutable customDecimals;
constructor(string memory name, string memory symbol, uint8 decimals) public ERC20PresetMinterPauser(name, symbol){
constructor(string memory name, string memory symbol, uint8 decimals) ERC20PresetMinterPauser(name, symbol){
customDecimals = decimals;
}

Expand All @@ -177,9 +177,9 @@ contract TestDeposit {

/**
This helper can be used to prepare execution data for Bridge.deposit() on the source chain
if PermissionlessGenericHandler is used
if PermissionlessGenericHandler is used
and if the target function accepts (address depositor, bytes executionData).
The execution data (packed as bytes) will be packed together with depositorAddress
The execution data (packed as bytes) will be packed together with depositorAddress
in PermissionlessGenericHandler before execution on the target chain.
This function packs the bytes parameter together with a fake address and removes the address.
After repacking in the handler together with depositorAddress, the offsets will be correct.
Expand All @@ -206,4 +206,4 @@ contract TestDeposit {
function executeUnpacked(address depositor, uint256 num, address[] memory addresses, bytes memory message) external {
emit TestExecute(depositor, num, addresses[1], message);
}
}
}
2 changes: 1 addition & 1 deletion contracts/handlers/FeeHandlerRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract FeeHandlerRouter is IFeeHandler, AccessControl {
/**
@param bridgeAddress Contract address of previously deployed Bridge.
*/
constructor(address bridgeAddress) public {
constructor(address bridgeAddress) {
_bridgeAddress = bridgeAddress;
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/handlers/PermissionedGenericHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ contract PermissionedGenericHandler is IHandler {
*/
constructor(
address bridgeAddress
) public {
) {
_bridgeAddress = bridgeAddress;
}

Expand Down
10 changes: 5 additions & 5 deletions contracts/handlers/PermissionlessGenericHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract PermissionlessGenericHandler is IHandler {
*/
constructor(
address bridgeAddress
) public {
) {
_bridgeAddress = bridgeAddress;
}

Expand Down Expand Up @@ -59,7 +59,7 @@ contract PermissionlessGenericHandler is IHandler {
executionData is repacked together with executionDataDepositor address for using it in the target contract.
If executionData contains dynamic types then it is necessary to keep the offsets correct.
executionData should be encoded together with a 32-byte address and then passed as a parameter without that address.
If the target function accepts (address depositor, bytes executionData)
If the target function accepts (address depositor, bytes executionData)
then a function like the following one can be used:

function prepareDepositData(bytes calldata executionData) view external returns (bytes memory) {
Expand All @@ -75,7 +75,7 @@ contract PermissionlessGenericHandler is IHandler {

Another example: if the target function accepts (address depositor, uint[], address)
then a function like the following one can be used:

function prepareDepositData(uint[] calldata uintArray, address addr) view external returns (bytes memory) {
bytes memory encoded = abi.encode(address(0), uintArray, addr);
return this.slice(encoded, 32);
Expand Down Expand Up @@ -116,7 +116,7 @@ contract PermissionlessGenericHandler is IHandler {
executionData is repacked together with executionDataDepositor address for using it in the target contract.
If executionData contains dynamic types then it is necessary to keep the offsets correct.
executionData should be encoded together with a 32-byte address and then passed as a parameter without that address.
If the target function accepts (address depositor, bytes executionData)
If the target function accepts (address depositor, bytes executionData)
then a function like the following one can be used:

function prepareDepositData(bytes calldata executionData) view external returns (bytes memory) {
Expand All @@ -133,7 +133,7 @@ contract PermissionlessGenericHandler is IHandler {

Another example: if the target function accepts (address depositor, uint[], address)
then a function like the following one can be used:

function prepareDepositData(uint[] calldata uintArray, address addr) view external returns (bytes memory) {
bytes memory encoded = abi.encode(address(0), uintArray, addr);
return this.slice(encoded, 32);
Expand Down
2 changes: 1 addition & 1 deletion contracts/handlers/fee/BasicFeeHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract BasicFeeHandler is IFeeHandler, AccessControl {
@param bridgeAddress Contract address of previously deployed Bridge.
@param feeHandlerRouterAddress Contract address of previously deployed FeeHandlerRouter.
*/
constructor(address bridgeAddress, address feeHandlerRouterAddress) public {
constructor(address bridgeAddress, address feeHandlerRouterAddress) {
_bridgeAddress = bridgeAddress;
_feeHandlerRouterAddress = feeHandlerRouterAddress;
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/AccessControlSegregator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract AccessControlSegregator {
@param functions List of functions to be granted access to.
@param accounts List of accounts.
*/
constructor(bytes4[] memory functions, address[] memory accounts) public {
constructor(bytes4[] memory functions, address[] memory accounts) {
require(accounts.length == functions.length, "array length should be equal");

_grantAccess(GRANT_ACCESS_SIG, msg.sender);
Expand Down