Skip to content

Commit

Permalink
feat: create IVersionable interface (#87)
Browse files Browse the repository at this point in the history
* chore: add version, update packages
* chore: remove deployed addresses
* chore: remove space
* docs: update `README.md`
* chore: sync files with all repos
* chore: update scripts
* chore: update scripts
* feat: update `@author` comment
* chore: update dependencies
* feat: format scripts
* feat: update `IVersionable` comments
* feat: minor refactoring
---------
Co-authored-by: Igor Senych <72256997+igorsenych-cw@users.noreply.github.com>
Co-authored-by: Igor Senych <igor.senych@cloudwalk.io>
Co-authored-by: Evgenii Zaitsev <evgenii@cloudwalk.io>
  • Loading branch information
ihoroleksiienko authored Nov 10, 2024
1 parent ddb70af commit c8013ee
Show file tree
Hide file tree
Showing 47 changed files with 481 additions and 342 deletions.
27 changes: 14 additions & 13 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
SOLIDITY_VERSION = 0.8.24
OPTIMIZER_ENABLED = true
OPTIMIZER_RUNS = 1000
GAS_REPORTER_ENABLED = false
HARDHAT_MNEMONIC = test test test test test test test test test test test junk
GANACHE_RPC = http://127.0.0.1:7545
GANACHE_MNEMONIC = test test test test test test test test test test test junk
CW_TESTNET_RPC =
CW_TESTNET_PK =
CW_TESTNET_MNEMONIC =
CW_MAINNET_RPC =
CW_MAINNET_PK =
CW_MAINNET_MNEMONIC =
SOLIDITY_VERSION = 0.8.24
OPTIMIZER_ENABLED = true
OPTIMIZER_RUNS = 1000
GAS_REPORTER_ENABLED = false
CONTRACT_SIZER_ENABLED = false
HARDHAT_MNEMONIC = test test test test test test test test test test test junk
GANACHE_RPC = http://127.0.0.1:7545
GANACHE_MNEMONIC = test test test test test test test test test test test junk
CW_TESTNET_RPC =
CW_TESTNET_PK =
CW_TESTNET_MNEMONIC =
CW_MAINNET_RPC =
CW_MAINNET_PK =
CW_MAINNET_MNEMONIC =
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
![example branch parameter](https://github.com/cloudwalk/brlc-token/actions/workflows/build.yml/badge.svg?branch=main)
![example branch parameter](https://github.com/cloudwalk/brlc-token/actions/workflows/test.yml/badge.svg?branch=main)

This repository contains [BRLC](https://infinitepay.io/brlc) token smart contracts.</br>
[BRLC](https://infinitepay.io/brlc) is a stablecoin created and issued by [Infinitepay](https://infinitepay.io).
This repository contains BRLC token smart contracts.

## Project Setup
1. Clone the repo.
Expand All @@ -22,7 +21,7 @@ This repository contains [BRLC](https://infinitepay.io/brlc) token smart contrac
```sh
cp .env.example .env
```
3. Update settings in the newly created `.env` file if needed (e.g. another solidity version, number of optimization runs, private keys (PK) for networks, network RPC URLs, etc.).
3. If necessary, update settings in the newly created `.env` file (e.g., Solidity version, number of optimization runs, network RPC URLs, private keys (PK) for networks, etc.).

## Build and test

Expand All @@ -37,10 +36,6 @@ npx hardhat compile
npx hardhat test
```

## Networks and deployments

Information about deployments across all the networks can be found [here](./docs/deployed-contracts.json).

## Licensing

This project is released under the MIT License, see [LICENSE](./LICENSE).
2 changes: 1 addition & 1 deletion contracts/BRLCToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CWToken } from "./base/CWToken.sol";

/**
* @title BRLCToken contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The BRLC token implementation
*/
contract BRLCToken is CWToken {
Expand Down
2 changes: 1 addition & 1 deletion contracts/BRLCTokenBridgeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ERC20Freezable } from "./base/ERC20Freezable.sol";

/**
* @title BRLCTokenBridgeable contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The BRLC token implementation that supports bridging operations
*/
contract BRLCTokenBridgeable is ERC20Base, ERC20Bridgeable, ERC20Freezable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/USJimToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CWToken } from "./base/CWToken.sol";

/**
* @title USJimToken contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The USJim token implementation
*/
contract USJimToken is CWToken {
Expand Down
6 changes: 4 additions & 2 deletions contracts/base/CWToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import { ERC20Freezable } from "./ERC20Freezable.sol";
import { ERC20Restrictable } from "./ERC20Restrictable.sol";
import { ERC20Hookable } from "./ERC20Hookable.sol";
import { ERC20Trustable } from "./ERC20Trustable.sol";
import { Versionable } from "./Versionable.sol";

import { IERC20ComplexBalance } from "./interfaces/IERC20ComplexBalance.sol";

/**
* @title CWToken contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The CloudWalk token that extends the standard ERC20 token implementation with additional functionality
*/
contract CWToken is
Expand All @@ -23,7 +24,8 @@ contract CWToken is
ERC20Restrictable,
ERC20Hookable,
ERC20Trustable,
IERC20ComplexBalance
IERC20ComplexBalance,
Versionable
{
/**
* @notice Constructor that prohibits the initialization of the implementation of the upgradable contract
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/ERC20Base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { BlocklistableUpgradeable } from "./common/BlocklistableUpgradeable.sol"

/**
* @title ERC20Base contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice This contract is base implementation of the BRLC token with inherited Rescuable,
* Pausable, and Blocklistable functionality.
*/
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/ERC20Bridgeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ERC20Base } from "./ERC20Base.sol";

/**
* @title ERC20Bridgeable contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The ERC20 token implementation that supports bridging operations
*/
abstract contract ERC20Bridgeable is ERC20Base, IERC20Bridgeable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/ERC20Freezable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ERC20Base } from "./ERC20Base.sol";

/**
* @title ERC20Freezable contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The ERC20 token implementation that supports the freezing operations
*/
abstract contract ERC20Freezable is ERC20Base, IERC20Freezable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/ERC20Hookable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ERC20Base } from "./ERC20Base.sol";

/**
* @title ERC20Hookable contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The ERC20 token implementation that supports hooking operations
*/
abstract contract ERC20Hookable is ERC20Base, IERC20Hookable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/ERC20Mintable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ERC20Base } from "./ERC20Base.sol";

/**
* @title ERC20Mintable contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The ERC20 token implementation that supports the mint, premint, and burn operations
*/
abstract contract ERC20Mintable is ERC20Base, IERC20Mintable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/ERC20Restrictable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ERC20Base } from "./ERC20Base.sol";

/**
* @title ERC20Restrictable contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The ERC20 token implementation that supports restriction operations
*/
abstract contract ERC20Restrictable is ERC20Base, IERC20Restrictable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/ERC20Trustable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IERC20Trustable } from "./interfaces/IERC20Trustable.sol";

/**
* @title ERC20Trustable contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The ERC20 token implementation that supports the `trusted` transfers on behalf
*/
abstract contract ERC20Trustable is ERC20Base, IERC20Trustable {
Expand Down
21 changes: 21 additions & 0 deletions contracts/base/Versionable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./interfaces/IVersionable.sol";

/**
* @title Versionable contract
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @dev Defines the contract version.
*/
abstract contract Versionable is IVersionable {
// ------------------ Pure functions -------------------------- //

/**
* @inheritdoc IVersionable
*/
function $__VERSION() external pure returns (Version memory) {
return Version(1, 0, 0);
}
}
2 changes: 1 addition & 1 deletion contracts/base/common/BlocklistableUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/O

/**
* @title BlocklistableUpgradeable base contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice Allows to blocklist and unblocklist accounts using the `blocklister` account
* @dev This contract is used through inheritance. It makes available the modifier `notBlocklisted`,
* which can be applied to functions to restrict their usage to not blocklisted accounts only.
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/common/PausableExtUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/securit

/**
* @title PausableExtUpgradeable base contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice Extends the OpenZeppelin's {PausableUpgradeable} contract by adding the `pauser` account
* @dev This contract is used through inheritance. It introduces the `pauser` role that is allowed to
* trigger the paused or unpaused state of the contract that is inherited from this one.
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/common/RescuableUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/O

/**
* @title RescuableUpgradeable base contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice Allows to rescue ERC20 tokens locked up in the contract using the `rescuer` account
* @dev This contract is used through inheritance. It introduces the `rescuer` role that is allowed
* to rescue tokens locked up in the contract that is inherited from this one.
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/interfaces/IERC20Bridgeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

/**
* @title IERC20Bridgeable interface
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The interface of a token that supports bridging operations
*/
interface IERC20Bridgeable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/interfaces/IERC20ComplexBalance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

/**
* @title IERC20ComplexBalance interface
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The interface of a token that supports complex balance tracking
*/
interface IERC20ComplexBalance {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/interfaces/IERC20Freezable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

/**
* @title IERC20Freezable interface
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The interface of a token that supports freezing operations
*/
interface IERC20Freezable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/interfaces/IERC20Hook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

/**
* @title IERC20Hook interface
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The interface of a contract that supports hookable token operations
*/
interface IERC20Hook {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/interfaces/IERC20Hookable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

/**
* @title IERC20Hookable interface
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The interface of a token that supports hooking operations
*/
interface IERC20Hookable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/interfaces/IERC20Mintable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

/**
* @title IERC20Mintable interface
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The interface of a token that supports mint and burn operations
*/
interface IERC20Mintable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/interfaces/IERC20Restrictable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

/**
* @title IERC20Restrictable interface
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The interface of a token that supports restriction operations
*/
interface IERC20Restrictable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/interfaces/IERC20Trustable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

/**
* @title ERC20Trustable contract interface
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice The interface of the token that supports the `trusted` transfers on behalf
*/
interface IERC20Trustable {
Expand Down
24 changes: 24 additions & 0 deletions contracts/base/interfaces/IVersionable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
* @title IVersionable interface
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @dev Defines the function of getting the contract version.
*/
interface IVersionable {
/**
* @dev The struct for the contract version.
*/
struct Version {
uint16 major; // -- The major version of contract
uint16 minor; // -- The minor version of contract
uint16 patch; // -- The patch version of contract
}

/**
* @dev Returns the version of the contract.
*/
function $__VERSION() external pure returns (Version memory);
}
2 changes: 1 addition & 1 deletion contracts/mocks/ERC20HookMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { IERC20Hook } from "./../base/interfaces/IERC20Hook.sol";

/**
* @title ERC20HookMock contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice An implementation of the {IERC20Hook} contract for testing purposes
*/
contract ERC20HookMock is IERC20Hook {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/ERC20TokenMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC2

/**
* @title ERC20TokenMock contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice An implementation of the {ERC20Upgradeable} contract for testing purposes
*/
contract ERC20TokenMock is ERC20Upgradeable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/base/ERC20BaseMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ERC20Base } from "../../base/ERC20Base.sol";

/**
* @title ERC20BaseMock contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice An implementation of the {ERC20Base} contract for testing purposes
*/
contract ERC20BaseMock is ERC20Base {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/base/ERC20BridgeableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ERC20Bridgeable } from "../../base/ERC20Bridgeable.sol";

/**
* @title ERC20BridgeableMock contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice An implementation of the {ERC20Bridgeable} contract for testing purposes
*/
contract ERC20BridgeableMock is ERC20Bridgeable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/base/ERC20FreezableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ERC20Freezable } from "../../base/ERC20Freezable.sol";

/**
* @title ERC20FreezableMock contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice An implementation of the {ERC20Freezable} contract for testing purposes
*/
contract ERC20FreezableMock is ERC20Freezable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/base/ERC20HookableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ERC20Hookable } from "../../base/ERC20Hookable.sol";

/**
* @title ERC20HookableMock contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice An implementation of the {ERC20Hookable} contract for testing purposes
*/
contract ERC20HookableMock is ERC20Hookable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/base/ERC20MintableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ERC20Mintable } from "../../base/ERC20Mintable.sol";

/**
* @title ERC20MintableMock contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice An implementation of the {ERC20Mintable} contract for testing purposes
*/
contract ERC20MintableMock is ERC20Mintable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/base/ERC20RestrictableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ERC20Restrictable } from "../../base/ERC20Restrictable.sol";

/**
* @title ERC20RestrictableMock contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice An implementation of the {ERC20Restrictable} contract for testing purposes
*/
contract ERC20RestrictableMock is ERC20Restrictable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/base/ERC20TrustableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ERC20Trustable } from "../../base/ERC20Trustable.sol";

/**
* @title ERC20TrustableMock contract
* @author CloudWalk Inc.
* @author CloudWalk Inc. (See https://www.cloudwalk.io)
* @notice An implementation of the {ERC20Trustable} contract for testing purposes
*/
contract ERC20TrustableMock is ERC20Trustable {
Expand Down
Loading

0 comments on commit c8013ee

Please sign in to comment.