Skip to content

Commit

Permalink
Use dependencies from lib/@openzeppelin-contracts (#39)
Browse files Browse the repository at this point in the history
* Remove vendored entrypoint + replace dependencies

* lint javascript

* lint solidity

* fix tests

* fix tests

* update submodule

* clean

* fix entrypoint testing

* simplification

* try fix slither by reverting to master

* try fix by removing symlinks

* try fix

* up

* Update TOOLING.md

---------

Co-authored-by: Arr00 <[email protected]>
  • Loading branch information
Amxx and arr00 authored Dec 17, 2024
1 parent 35e820e commit a3703ae
Show file tree
Hide file tree
Showing 39 changed files with 2,010 additions and 4,079 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up environment
uses: ./.github/actions/setup
- run: npm run lint
Expand Down Expand Up @@ -82,4 +84,4 @@ jobs:
uses: codespell-project/[email protected]
with:
check_filenames: true
skip: package-lock.json,vendor
skip: package-lock.json
15 changes: 0 additions & 15 deletions .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc
12 changes: 0 additions & 12 deletions .solcover.js

This file was deleted.

1 change: 1 addition & 0 deletions .solcover.js
11 changes: 11 additions & 0 deletions TOOLING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Difference with @openzeppelin/contracts

## Slither

Community repo uses a different slither config than @openzeppelin/contracts.
We had to remove the following line that causes issues:

```json
"compile_force_framework": "hardhat"
```

10 changes: 5 additions & 5 deletions contracts/crosschain/axelar/mocks/AxelarGatewayMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract AxelarGatewayMock {
using Strings for string;
using BitMaps for BitMaps.BitMap;

BitMaps.BitMap private pendingCommandIds;
BitMaps.BitMap private _pendingCommandIds;

event CommandIdPending(
bytes32 indexed commandId,
Expand Down Expand Up @@ -45,8 +45,8 @@ contract AxelarGatewayMock {
)
);

require(!pendingCommandIds.get(uint256(commandId)));
pendingCommandIds.set(uint256(commandId));
require(!_pendingCommandIds.get(uint256(commandId)));
_pendingCommandIds.set(uint256(commandId));

emit CommandIdPending(commandId, destinationChain, destinationContractAddress, payload);

Expand All @@ -61,8 +61,8 @@ contract AxelarGatewayMock {
string calldata sourceAddress,
bytes32 payloadHash
) external returns (bool) {
if (pendingCommandIds.get(uint256(commandId))) {
pendingCommandIds.unset(uint256(commandId));
if (_pendingCommandIds.get(uint256(commandId))) {
_pendingCommandIds.unset(uint256(commandId));

emit IAxelarGateway.ContractCallExecuted(commandId);

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20/extensions/ERC20Allowlist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract contract ERC20Allowlist is ERC20 {
/**
* @dev Allowed status of addresses. True if allowed, False otherwise.
*/
mapping(address account => bool) internal _allowed;
mapping(address account => bool) private _allowed;

/**
* @dev Emitted when a `user` is allowed to transfer and approve.
Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20/extensions/ERC20Blocklist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract contract ERC20Blocklist is ERC20 {
/**
* @dev Blocked status of addresses. True if blocked, False otherwise.
*/
mapping(address user => bool) internal _blocked;
mapping(address user => bool) private _blocked;

/**
* @dev Emitted when a user is blocked.
Expand Down
1 change: 1 addition & 0 deletions contracts/token/ERC20/extensions/ERC20Collateral.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ abstract contract ERC20Collateral is ERC20, IERC6372 {
/**
* @inheritdoc IERC6372
*/
// solhint-disable-next-line func-name-mixedcase
function CLOCK_MODE() public view virtual returns (string memory) {
return "mode=timestamp";
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20/extensions/ERC20Custodian.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract contract ERC20Custodian is ERC20 {
/**
* @dev The amount of tokens frozen by user address.
*/
mapping(address user => uint256 amount) internal _frozen;
mapping(address user => uint256 amount) private _frozen;

/**
* @dev Emitted when tokens are frozen for a user.
Expand Down
6 changes: 3 additions & 3 deletions contracts/token/ERC20/extensions/ERC4626Fees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
abstract contract ERC4626Fees is ERC4626 {
using Math for uint256;

uint256 private constant _BASIS_POINT_SCALE = 1e4;
uint256 private constant BASIS_POINT_SCALE = 1e4;

// === Overrides ===

Expand Down Expand Up @@ -92,12 +92,12 @@ abstract contract ERC4626Fees is ERC4626 {
/// @dev Calculates the fees that should be added to an amount `assets` that does not already include fees.
/// Used in {IERC4626-mint} and {IERC4626-withdraw} operations.
function _feeOnRaw(uint256 assets, uint256 feeBasisPoints) private pure returns (uint256) {
return assets.mulDiv(feeBasisPoints, _BASIS_POINT_SCALE, Math.Rounding.Ceil);
return assets.mulDiv(feeBasisPoints, BASIS_POINT_SCALE, Math.Rounding.Ceil);
}

/// @dev Calculates the fee part of an amount `assets` that already includes fees.
/// Used in {IERC4626-deposit} and {IERC4626-redeem} operations.
function _feeOnTotal(uint256 assets, uint256 feeBasisPoints) private pure returns (uint256) {
return assets.mulDiv(feeBasisPoints, feeBasisPoints + _BASIS_POINT_SCALE, Math.Rounding.Ceil);
return assets.mulDiv(feeBasisPoints, feeBasisPoints + BASIS_POINT_SCALE, Math.Rounding.Ceil);
}
}
2 changes: 1 addition & 1 deletion contracts/utils/Masks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ library Masks {
}

/// @dev Returns the symmetric difference (∆) of two masks, also known as disjunctive union or exclusive OR (XOR)
function symmetric_difference(Mask m1, Mask m2) internal pure returns (Mask) {
function symmetricDifference(Mask m1, Mask m2) internal pure returns (Mask) {
return m1.union(m2).difference(m1.intersection(m2));
}
}
1 change: 0 additions & 1 deletion contracts/vendor/erc4337-entrypoint/README.md

This file was deleted.

Loading

0 comments on commit a3703ae

Please sign in to comment.