Use immutable variables where possible (#2528)

Co-authored-by: rotciv <victorfage@gmail.com>
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
pull/2546/head
Francisco Giordano 4 years ago committed by GitHub
parent 0059b17dfc
commit 7d20d0e2d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      contracts/payment/PullPayment.sol
  2. 2
      contracts/payment/escrow/RefundEscrow.sol
  3. 2
      contracts/token/ERC20/ERC20Capped.sol
  4. 6
      contracts/token/ERC20/TokenTimelock.sol

@ -23,7 +23,7 @@ import "./escrow/Escrow.sol";
* payments with {payments}, and retrieve them with {withdrawPayments}.
*/
abstract contract PullPayment {
Escrow private _escrow;
Escrow immutable private _escrow;
constructor () {
_escrow = new Escrow();

@ -23,7 +23,7 @@ contract RefundEscrow is ConditionalEscrow {
event RefundsEnabled();
State private _state;
address payable private _beneficiary;
address payable immutable private _beneficiary;
/**
* @dev Constructor.

@ -8,7 +8,7 @@ import "./ERC20.sol";
* @dev Extension of {ERC20} that adds a cap to the supply of tokens.
*/
abstract contract ERC20Capped is ERC20 {
uint256 private _cap;
uint256 immutable private _cap;
/**
* @dev Sets the value of the `cap`. This value is immutable, it can only be

@ -15,13 +15,13 @@ contract TokenTimelock {
using SafeERC20 for IERC20;
// ERC20 basic token contract being held
IERC20 private _token;
IERC20 immutable private _token;
// beneficiary of tokens after they are released
address private _beneficiary;
address immutable private _beneficiary;
// timestamp when token release is enabled
uint256 private _releaseTime;
uint256 immutable private _releaseTime;
constructor (IERC20 token_, address beneficiary_, uint256 releaseTime_) {
// solhint-disable-next-line not-rely-on-time

Loading…
Cancel
Save