-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create
IVersion
interface (#19)
* feat: add contract version * test: add tests for contract version * fix: change comments, types * fix: typo * feat: change version function to $, add abstract instead interface * test: change version test * fix: update version * test: update version test * test: remove unnecessary import * fix: rename version class, function * test: update version test * fix: add version interface * feat: remove `__VERSION` functions * feat: change version to `4.0.0` * chore: disable `stylistic/linebreak-style` checks * feat: move `IVersion` interface to the separate file --------- Co-authored-by: Igor Senych <igor.senych@cloudwalk.io>
- Loading branch information
1 parent
c3461fb
commit e379bf8
Showing
8 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/IVersion.sol"; | ||
|
||
/** | ||
* @title Versionable contract | ||
* @author CloudWalk Inc. (See https://cloudwalk.io) | ||
* @dev Defines the contract version. | ||
*/ | ||
abstract contract Versionable is IVersion { | ||
// ------------------ Pure functions -------------------------- // | ||
|
||
/** | ||
* @inheritdoc IVersion | ||
*/ | ||
function $__VERSION() external pure returns (Version memory) { | ||
return Version(4, 0, 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
/** | ||
* @title IVersion interface | ||
* @author CloudWalk Inc. (See https://cloudwalk.io) | ||
* @dev Defines the function to get the contract version. | ||
*/ | ||
interface IVersion { | ||
/** | ||
* @dev The struct for the contract version. | ||
*/ | ||
struct Version { | ||
uint8 major; // -- The major version of contract | ||
uint8 minor; // -- The minor version of contract | ||
uint8 patch; // -- The patch version of contract | ||
} | ||
|
||
/** | ||
* @dev Returns the version of the contract. | ||
*/ | ||
function $__VERSION() external pure returns (Version memory); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters