Skip to content

Commit

Permalink
added decimals, fixed imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvolear committed Apr 14, 2023
1 parent bc42b81 commit c6e2785
Show file tree
Hide file tree
Showing 55 changed files with 1,958 additions and 807 deletions.
2 changes: 1 addition & 1 deletion contracts/access-control/MerkleWhitelisted.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";

/**
* @notice The Whitelist Access Control module
Expand Down
9 changes: 5 additions & 4 deletions contracts/access-control/RBAC.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

import "../interfaces/access-control/IRBAC.sol";
import {IRBAC} from "../interfaces/access-control/IRBAC.sol";

import "../libs/utils/TypeCaster.sol";
import "../libs/arrays/SetHelper.sol";
import {TypeCaster} from "../libs/utils/TypeCaster.sol";
import {SetHelper} from "../libs/arrays/SetHelper.sol";
import {StringSet} from "../libs/data-structures/StringSet.sol";

/**
* @notice The Role Based Access Control (RBAC) module
Expand Down
7 changes: 5 additions & 2 deletions contracts/access-control/extensions/RBACGroupable.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../../interfaces/access-control/extensions/IRBACGroupable.sol";
import {IRBACGroupable} from "../../interfaces/access-control/extensions/IRBACGroupable.sol";

import "../RBAC.sol";
import {StringSet} from "../../libs/data-structures/StringSet.sol";
import {SetHelper} from "../../libs/arrays/SetHelper.sol";

import {RBAC} from "../RBAC.sol";

/**
* @notice The Role Based Access Control (RBAC) module
Expand Down
10 changes: 5 additions & 5 deletions contracts/compound-rate-keeper/AbstractCompoundRateKeeper.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

import "../interfaces/compound-rate-keeper/ICompoundRateKeeper.sol";
import {ICompoundRateKeeper} from "../interfaces/compound-rate-keeper/ICompoundRateKeeper.sol";

import "../libs/math/DSMath.sol";
import {DSMath} from "../libs/math/DSMath.sol";

import "../utils/Globals.sol";
import {PRECISION} from "../utils/Globals.sol";

/**
* @notice The Compound Rate Keeper module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

import "../AbstractCompoundRateKeeper.sol";
import {AbstractCompoundRateKeeper} from "../AbstractCompoundRateKeeper.sol";

/**
* @notice The Ownable preset of CompoundRateKeeper
Expand Down
8 changes: 4 additions & 4 deletions contracts/contracts-registry/AbstractContractsRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

import "./proxy/ProxyUpgrader.sol";
import "./AbstractDependant.sol";
import {ProxyUpgrader} from "./proxy/ProxyUpgrader.sol";
import {AbstractDependant} from "./AbstractDependant.sol";

/**
* @notice The ContractsRegistry module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

import "../../libs/arrays/Paginator.sol";
import {Paginator} from "../../libs/arrays/Paginator.sol";

import "../../contracts-registry/AbstractDependant.sol";
import {AbstractDependant} from "../../contracts-registry/AbstractDependant.sol";

import "./proxy/ProxyBeacon.sol";
import {ProxyBeacon} from "./proxy/ProxyBeacon.sol";

/**
* @notice The PoolContractsRegistry module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/Create2.sol";
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";

import "../../../contracts-registry/AbstractDependant.sol";
import "../AbstractPoolContractsRegistry.sol";
import {AbstractDependant} from "../../../contracts-registry/AbstractDependant.sol";
import {AbstractPoolContractsRegistry} from "../AbstractPoolContractsRegistry.sol";

import "./proxy/PublicBeaconProxy.sol";
import {PublicBeaconProxy} from "./proxy/PublicBeaconProxy.sol";

/**
* @notice The PoolContractsRegistry module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
import {BeaconProxy} from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";

/**
* @notice The PoolContractsRegistry module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

import "../AbstractPoolContractsRegistry.sol";
import {AbstractPoolContractsRegistry} from "../AbstractPoolContractsRegistry.sol";

/**
* @notice The Ownable preset of PoolContractsRegistry
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts-registry/pools/proxy/ProxyBeacon.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import {IBeacon} from "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

/**
* @notice The PoolContractsRegistry module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

import "../AbstractContractsRegistry.sol";
import {AbstractContractsRegistry} from "../AbstractContractsRegistry.sol";

/**
* @notice The Ownable preset of ContractsRegistry
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts-registry/proxy/ProxyUpgrader.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

/**
* @notice The ContractsRegistry module
Expand Down
5 changes: 3 additions & 2 deletions contracts/diamond/Diamond.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/Address.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "./DiamondStorage.sol";
import {DiamondStorage} from "./DiamondStorage.sol";

/**
* @notice The Diamond standard module
Expand Down
2 changes: 1 addition & 1 deletion contracts/diamond/DiamondStorage.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/**
* @notice The Diamond standard module
Expand Down
4 changes: 2 additions & 2 deletions contracts/diamond/presets/OwnableDiamond/OwnableDiamond.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../../Diamond.sol";
import "./OwnableDiamondStorage.sol";
import {Diamond} from "../../Diamond.sol";
import {OwnableDiamondStorage} from "./OwnableDiamondStorage.sol";

/**
* @notice The Ownable preset of Diamond proxy
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/access-control/IRBAC.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../../libs/data-structures/StringSet.sol";
import {StringSet} from "../../libs/data-structures/StringSet.sol";

/**
* @notice The RBAC module
Expand Down
2 changes: 1 addition & 1 deletion contracts/libs/arrays/ArrayHelper.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/math/Math.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

/**
* @notice A simple library to work with arrays
Expand Down
4 changes: 2 additions & 2 deletions contracts/libs/arrays/Paginator.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "../data-structures/StringSet.sol";
import {StringSet} from "../data-structures/StringSet.sol";

/**
* @notice Library for pagination.
Expand Down
4 changes: 2 additions & 2 deletions contracts/libs/arrays/SetHelper.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "../data-structures/StringSet.sol";
import {StringSet} from "../data-structures/StringSet.sol";

/**
* @notice A simple library to work with sets
Expand Down
2 changes: 1 addition & 1 deletion contracts/libs/data-structures/PriorityQueue.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../utils/TypeCaster.sol";
import {TypeCaster} from "../utils/TypeCaster.sol";

/**
* @notice The library that realizes a heap based priority queue.
Expand Down
2 changes: 1 addition & 1 deletion contracts/libs/data-structures/memory/Vector.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../../utils/TypeCaster.sol";
import {TypeCaster} from "../../utils/TypeCaster.sol";

/**
* @notice The memory data structures module
Expand Down
11 changes: 11 additions & 0 deletions contracts/libs/decimals/DecimalsConverter.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

/**
* @notice This library is used to convert numbers that use token's N decimals to M decimals.
* Comes extremely handy with standardizing the business logic that is intended to work with many different ERC20 tokens
Expand Down Expand Up @@ -30,6 +32,15 @@ pragma solidity ^0.8.4;
* }
*/
library DecimalsConverter {
/**
* @notice The function to get the decimals of ERC20 token. Needed for bytecode optimization
* @param token_ the ERC20 token
* @return the decimals of provided token
*/
function decimals(address token_) internal view returns (uint256) {
return ERC20(token_).decimals();
}

/**
* @notice The function to bring the number to 18 decimals of precision
* @param amount_ the number to convert
Expand Down
Loading

0 comments on commit c6e2785

Please sign in to comment.