Skip to content

Commit

Permalink
feat!: create Version contract and inherit it (#764)
Browse files Browse the repository at this point in the history
* feat!: create `Version` contract and inherit it

* docs: update auto generated docs
  • Loading branch information
b00ste authored Oct 27, 2023
1 parent b2bc093 commit 0745ed4
Show file tree
Hide file tree
Showing 30 changed files with 604 additions and 3 deletions.
2 changes: 2 additions & 0 deletions contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";

// modules
import {Version} from "../Version.sol";
import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
import {ERC725XCore} from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
import {
Expand Down Expand Up @@ -76,6 +77,7 @@ import {
abstract contract LSP0ERC725AccountCore is
ERC725XCore,
ERC725YCore,
Version,
IERC1271,
ILSP0ERC725Account,
ILSP1UniversalReceiver,
Expand Down
3 changes: 2 additions & 1 deletion contracts/LSP17ContractExtension/LSP17Extension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.4;

// modules
import {Version} from "../Version.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";

// constants
Expand All @@ -13,7 +14,7 @@ import {_INTERFACEID_LSP17_EXTENSION} from "./LSP17Constants.sol";
* @dev Implementation of the extension logic according to LSP17ContractExtension.
* This module can be inherited to provide context of the msg variable related to the extendable contract
*/
abstract contract LSP17Extension is ERC165 {
abstract contract LSP17Extension is ERC165, Version {
/**
* @dev See {IERC165-supportsInterface}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import {ILSP7DigitalAsset} from "../../LSP7DigitalAsset/ILSP7DigitalAsset.sol";

// modules
import {Version} from "../../Version.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";

// libraries
Expand Down Expand Up @@ -54,6 +55,7 @@ import {CannotRegisterEOAsAsAssets} from "../LSP1Errors.sol";
*/
contract LSP1UniversalReceiverDelegateUP is
ERC165,
Version,
ILSP1UniversalReceiverDelegate
{
using ERC165Checker for address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import {ILSP7DigitalAsset} from "../../LSP7DigitalAsset/ILSP7DigitalAsset.sol";

// modules
import {Version} from "../../Version.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";

// libraries
Expand Down Expand Up @@ -44,6 +45,7 @@ import {CannotRegisterEOAsAsAssets} from "../LSP1Errors.sol";
*/
contract LSP1UniversalReceiverDelegateVault is
ERC165,
Version,
ILSP1UniversalReceiverDelegate
{
/**
Expand Down
2 changes: 2 additions & 0 deletions contracts/LSP6KeyManager/LSP6KeyManagerCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from "../LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol";

// modules
import {Version} from "../Version.sol";
import {ILSP14Ownable2Step} from "../LSP14Ownable2Step/ILSP14Ownable2Step.sol";
import {ERC725Y} from "@erc725/smart-contracts/contracts/ERC725Y.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
Expand Down Expand Up @@ -83,6 +84,7 @@ abstract contract LSP6KeyManagerCore is
ILSP6,
ILSP20,
ILSP25,
Version,
LSP6SetDataModule,
LSP6ExecuteModule,
LSP6ExecuteRelayCallModule,
Expand Down
5 changes: 4 additions & 1 deletion contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import {
} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
import {ILSP7DigitalAsset} from "./ILSP7DigitalAsset.sol";

// modules
import {Version} from "../Version.sol";

// libraries
import {
ERC165Checker
Expand Down Expand Up @@ -48,7 +51,7 @@ import {
* Similar to ERC20, the non-standard {increaseAllowance} and {decreaseAllowance} functions
* have been added to mitigate the well-known issues around setting allowances.
*/
abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset, Version {
using EnumerableSet for EnumerableSet.AddressSet;

// --- Storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import {
ILSP8IdentifiableDigitalAsset
} from "./ILSP8IdentifiableDigitalAsset.sol";

// modules
import {Version} from "../Version.sol";

// libraries
import {
EnumerableSet
Expand Down Expand Up @@ -48,7 +51,8 @@ import {
* @dev Core Implementation of a LSP8 compliant contract.
*/
abstract contract LSP8IdentifiableDigitalAssetCore is
ILSP8IdentifiableDigitalAsset
ILSP8IdentifiableDigitalAsset,
Version
{
using EnumerableSet for EnumerableSet.AddressSet;
using EnumerableSet for EnumerableSet.Bytes32Set;
Expand Down
2 changes: 2 additions & 0 deletions contracts/LSP9Vault/LSP9VaultCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";

// modules
import {Version} from "../Version.sol";
import {ERC725XCore} from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
import {
Expand Down Expand Up @@ -79,6 +80,7 @@ import {
contract LSP9VaultCore is
ERC725XCore,
ERC725YCore,
Version,
LSP14Ownable2Step,
LSP17Extendable,
ILSP1UniversalReceiver,
Expand Down
16 changes: 16 additions & 0 deletions contracts/Version.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;

abstract contract Version {
string internal constant _VERSION = "0.12.0";

/**
* @dev Get the version of the contract.
* @notice Contract version.
*
* @return The version of the the contract.
*/
function version() public view virtual returns (string memory) {
return _VERSION;
}
}
27 changes: 27 additions & 0 deletions docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,33 @@ Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be not

<br/>

### version

:::note References

- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#version)
- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol)
- Function signature: `version()`
- Function selector: `0x54fd4d50`

:::

```solidity
function version() external view returns (string);
```

_Contract version._

Get the version of the contract.

#### Returns

| Name | Type | Description |
| ---- | :------: | -------------------------------- |
| `0` | `string` | The version of the the contract. |

<br/>

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.
Expand Down
27 changes: 27 additions & 0 deletions docs/contracts/LSP17ContractExtension/LSP17Extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ See [`IERC165-supportsInterface`](#ierc165-supportsinterface).

<br/>

### version

:::note References

- Specification details: [**LSP-17-ContractExtension**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-ContractExtension.md#version)
- Solidity implementation: [`LSP17Extension.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP17ContractExtension/LSP17Extension.sol)
- Function signature: `version()`
- Function selector: `0x54fd4d50`

:::

```solidity
function version() external view returns (string);
```

_Contract version._

Get the version of the contract.

#### Returns

| Name | Type | Description |
| ---- | :------: | -------------------------------- |
| `0` | `string` | The version of the the contract. |

<br/>

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.
Expand Down
27 changes: 27 additions & 0 deletions docs/contracts/LSP17Extensions/Extension4337.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,33 @@ Must validate caller is the entryPoint. Must validate the signature and nonce

<br/>

### version

:::note References

- Specification details: [**LSP-17-Extensions**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-Extensions.md#version)
- Solidity implementation: [`Extension4337.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP17Extensions/Extension4337.sol)
- Function signature: `version()`
- Function selector: `0x54fd4d50`

:::

```solidity
function version() external view returns (string);
```

_Contract version._

Get the version of the contract.

#### Returns

| Name | Type | Description |
| ---- | :------: | -------------------------------- |
| `0` | `string` | The version of the the contract. |

<br/>

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,33 @@ _Reacted on received notification with `typeId`._

<br/>

### version

:::note References

- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#version)
- Solidity implementation: [`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol)
- Function signature: `version()`
- Function selector: `0x54fd4d50`

:::

```solidity
function version() external view returns (string);
```

_Contract version._

Get the version of the contract.

#### Returns

| Name | Type | Description |
| ---- | :------: | -------------------------------- |
| `0` | `string` | The version of the the contract. |

<br/>

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,33 @@ Handles two cases: Writes the received [LSP-7-DigitalAsset] or [LSP-8-Identifiab

<br/>

### version

:::note References

- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#version)
- Solidity implementation: [`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol)
- Function signature: `version()`
- Function selector: `0x54fd4d50`

:::

```solidity
function version() external view returns (string);
```

_Contract version._

Get the version of the contract.

#### Returns

| Name | Type | Description |
| ---- | :------: | -------------------------------- |
| `0` | `string` | The version of the the contract. |

<br/>

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.
Expand Down
27 changes: 27 additions & 0 deletions docs/contracts/LSP6KeyManager/LSP6KeyManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,33 @@ Get The address of the contract linked to this Key Manager.

<br/>

### version

:::note References

- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#version)
- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP6KeyManager/LSP6KeyManager.sol)
- Function signature: `version()`
- Function selector: `0x54fd4d50`

:::

```solidity
function version() external view returns (string);
```

_Contract version._

Get the version of the contract.

#### Returns

| Name | Type | Description |
| ---- | :------: | -------------------------------- |
| `0` | `string` | The version of the the contract. |

<br/>

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.
Expand Down
27 changes: 27 additions & 0 deletions docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c

<br/>

### version

:::note References

- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#version)
- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol)
- Function signature: `version()`
- Function selector: `0x54fd4d50`

:::

```solidity
function version() external view returns (string);
```

_Contract version._

Get the version of the contract.

#### Returns

| Name | Type | Description |
| ---- | :------: | -------------------------------- |
| `0` | `string` | The version of the the contract. |

<br/>

## Internal Methods

Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.
Expand Down
Loading

0 comments on commit 0745ed4

Please sign in to comment.