Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to TypeScript #1

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
[*.js]
[*.ts]
indent_size = 2
max_line_length = 120
[*.sol]
Expand Down
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CONFIG_FILE_PATH=FULL PATH TO THE CONFIG JSON
TYPECHAIN_TARGET=TYPECHAIN TARGET

# Vault
VAULT_DISABLED=IS VAULT DISABLED
VAULT_ENDPOINT=ENDPOINT WITH PORT TO VAULT SERVER
VAULT_TOKEN=VAULT PRIVATE TOKEN
VAULT_UPLOAD_CONFIG_PATH=FULL PATH ON VAULT TO SAVE CONFIG FOR GRAPH
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Bug Report
description: File a bug report
labels: ['bug']
assignees:
-
body:
- type: markdown
attributes:
value: Thanks for taking the time to fill out this bug report!
- type: input
id: version
attributes:
label: "Project version"
placeholder: "1.2.3"
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: What happened?
description: A brief description of what happened and what you expected to happen
validations:
required: true
- type: textarea
id: reproduction-steps
attributes:
label: "Minimal reproduction steps"
description: "The minimal steps needed to reproduce the bug"
validations:
required: true
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Feature request
description: Suggest a new feature
labels: ['feature']
assignees:
-
body:
- type: textarea
id: feature-description
attributes:
label: "Describe the feature"
description: "A description of what you would like to see in the project"
validations:
required: true
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/other-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: Other issue
about: Other kind of issue
---
16 changes: 16 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: setup

description: setup

runs:
using: composite
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: npm

- name: Install packages
run: npm install
shell: bash
23 changes: 23 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "checks"

on:
push:
branches:
- main
pull_request:
branches:
- main
- dev

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Run tests
run: npm run test
16 changes: 16 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
node_modules
.env
.DS_Store
package-lock.json

# Hardhat files
cache
artifacts
coverage.json
coverage

# Typechain generated files
generated-types

# Hardhat migrate
.storage.json
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": "*.sol",
Expand All @@ -11,7 +12,7 @@
}
},
{
"files": "*.js",
"files": "*.ts",
"options": {
"printWidth": 120,
"tabWidth": 2
Expand Down
File renamed without changes.
18 changes: 11 additions & 7 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"reentrancy": "off",
"prettier/prettier": "off",
"reentrancy": "error",
"prettier/prettier": "warn",
"modifier-name-mixedcase": "off",
"no-empty-blocks": "off",
"func-visibility": "off",
"max-states-count": "off",
"not-rely-on-time": "off",
"compiler-version": "off"
"func-name-mixedcase": "off",
"no-empty-blocks": "warn",
"func-visibility": "warn",
"max-states-count": "warn",
"not-rely-on-time": "warn",
"compiler-version": "off",
"gas-custom-errors": "off",
"var-name-mixedcase": "off",
"reason-string": "off"
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The TokenE core consists of 5 main smart contracts:
Each of these contracts serves an important role for the system:

- The `MasterContractsRegistry` is an [ERC-6224](https://eips.ethereum.org/EIPS/eip-6224) compliant contract that is used throughout the core and its modules.
- The `MasterAccessManagement` is used to handle permissions and access, leveraging [DLSL](https://github.com/dl-solidity-library/dev-modules) RBAC smart contract.
- The `MasterAccessManagement` is used to handle permissions and access, leveraging [solarity](https://github.com/dl-solarity/solidity-lib) RBAC smart contract.
- The `ReviewableRequests` is a primary integration tool that is used to "speak" with admins. One can issue tokens or pass KYC requests via that contract.
- The `ConstantRegistry` that stores the system-wide parameters.
- The `Multicall` is used as a utility to execute batches of transactions.
Expand All @@ -28,10 +28,10 @@ The core contracts are available as an npm package:
$ npm install @tokene/core-contracts
```

Or if you want to use the low-level [DLSL](https://github.com/dl-solidity-library/dev-modules):
Or if you want to use the low-level [solarity](https://github.com/dl-solarity/solidity-lib):

```console
$ npm install @dlsl/dev-modules
$ npm install @solarity/solidity-lib
```

## Integration
Expand Down
13 changes: 5 additions & 8 deletions contracts/core/ConstantsRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@dlsl/dev-modules/contracts-registry/AbstractDependant.sol";
import {AbstractDependant} from "@solarity/solidity-lib/contracts-registry/AbstractDependant.sol";

import "../interfaces/core/IMasterAccessManagement.sol";
import "../interfaces/core/IMasterContractsRegistry.sol";
import "../interfaces/core/IConstantsRegistry.sol";
import {IMasterAccessManagement} from "../interfaces/core/IMasterAccessManagement.sol";
import {IMasterContractsRegistry} from "../interfaces/core/IMasterContractsRegistry.sol";
import {IConstantsRegistry} from "../interfaces/core/IConstantsRegistry.sol";

/**
* @notice The ConstantsRegistry contract. It stores system-wide variables that
Expand Down Expand Up @@ -41,10 +41,7 @@ contract ConstantsRegistry is IConstantsRegistry, AbstractDependant {
* @dev Access: the injector address
* @param registryAddress_ the address of the ContractsRegistry
*/
function setDependencies(
address registryAddress_,
bytes calldata
) external override dependant {
function setDependencies(address registryAddress_, bytes memory) public override dependant {
IMasterContractsRegistry registry_ = IMasterContractsRegistry(registryAddress_);
_masterAccess = IMasterAccessManagement(registry_.getMasterAccessManagement());
}
Expand Down
6 changes: 4 additions & 2 deletions contracts/core/MasterAccessManagement.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@dlsl/dev-modules/access-control/RBAC.sol";
import {TypeCaster} from "@solarity/solidity-lib/libs/utils/TypeCaster.sol";

import "../interfaces/core/IMasterAccessManagement.sol";
import {RBAC} from "@solarity/solidity-lib/access/RBAC.sol";

import {IMasterAccessManagement} from "../interfaces/core/IMasterAccessManagement.sol";

/**
* @notice The MasterAccessManagement contract, extends the RBAC contract. It adds several functions
Expand Down
4 changes: 2 additions & 2 deletions contracts/core/MasterContractsRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "../interfaces/core/IMasterContractsRegistry.sol";
import {IMasterContractsRegistry} from "../interfaces/core/IMasterContractsRegistry.sol";

import "./registry/RoleManagedRegistry.sol";
import {RoleManagedRegistry, IMasterAccessManagement} from "./registry/RoleManagedRegistry.sol";

/**
* @notice The MasterContractsRegistry contract, extends RoleManagedRegistry.
Expand Down
13 changes: 5 additions & 8 deletions contracts/core/ReviewableRequests.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@dlsl/dev-modules/contracts-registry/AbstractDependant.sol";
import {AbstractDependant} from "@solarity/solidity-lib/contracts-registry/AbstractDependant.sol";

import "../interfaces/core/IMasterAccessManagement.sol";
import "../interfaces/core/IMasterContractsRegistry.sol";
import "../interfaces/core/IReviewableRequests.sol";
import {IMasterAccessManagement} from "../interfaces/core/IMasterAccessManagement.sol";
import {IMasterContractsRegistry} from "../interfaces/core/IMasterContractsRegistry.sol";
import {IReviewableRequests} from "../interfaces/core/IReviewableRequests.sol";

/**
* @notice The ReviewableRequests contract. Its main purpose is to forward certian user incentives to change
Expand Down Expand Up @@ -50,10 +50,7 @@ contract ReviewableRequests is IReviewableRequests, AbstractDependant {
* @dev Access: the injector address
* @param registryAddress_ the address of the ContractsRegistry
*/
function setDependencies(
address registryAddress_,
bytes calldata
) external override dependant {
function setDependencies(address registryAddress_, bytes memory) public override dependant {
IMasterContractsRegistry registry_ = IMasterContractsRegistry(registryAddress_);
_masterAccess = IMasterAccessManagement(registry_.getMasterAccessManagement());
}
Expand Down
18 changes: 8 additions & 10 deletions contracts/core/multicall/Multicall.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "@dlsl/dev-modules/contracts-registry/AbstractDependant.sol";
import {AbstractDependant} from "@solarity/solidity-lib/contracts-registry/AbstractDependant.sol";

import "../../interfaces/core/IMasterAccessManagement.sol";
import "../../interfaces/core/IMasterContractsRegistry.sol";
import "./MulticallExecutor.sol";
import {IMasterAccessManagement} from "../../interfaces/core/IMasterAccessManagement.sol";
import {IMasterContractsRegistry} from "../../interfaces/core/IMasterContractsRegistry.sol";

import {MulticallExecutor, IMulticall} from "./MulticallExecutor.sol";

/**
* @notice The Multicall contract. It grants `msg.sender` roles to the internal MulticallExecutor
Expand All @@ -34,10 +35,7 @@ contract Multicall is IMulticall, Initializable, AbstractDependant, ReentrancyGu
* @dev Access: the injector address
* @param registryAddress_ the address of the ContractsRegistry
*/
function setDependencies(
address registryAddress_,
bytes calldata
) external override dependant {
function setDependencies(address registryAddress_, bytes memory) public override dependant {
IMasterContractsRegistry registry_ = IMasterContractsRegistry(registryAddress_);
_masterAccess = IMasterAccessManagement(registry_.getMasterAccessManagement());
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/core/multicall/MulticallExecutor.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

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

import "../../interfaces/core/multicall/IMulticall.sol";
import {IMulticall} from "../../interfaces/core/multicall/IMulticall.sol";

/**
* @notice The MulticallExecutor contract. Its purpose is to execute a batch of functions.
Expand Down
6 changes: 3 additions & 3 deletions contracts/core/registry/RoleManagedRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

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

import "@dlsl/dev-modules/contracts-registry/AbstractContractsRegistry.sol";
import {AbstractContractsRegistry} from "@solarity/solidity-lib/contracts-registry/AbstractContractsRegistry.sol";

import "../../interfaces/core/IMasterAccessManagement.sol";
import {IMasterAccessManagement} from "../../interfaces/core/IMasterAccessManagement.sol";

/**
* @notice The RBAC realization of the AbstractContractsRegistry contract. It uses
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/core/IMasterAccessManagement.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "@dlsl/dev-modules/interfaces/access-control/IRBAC.sol";
import {IRBAC} from "@solarity/solidity-lib/interfaces/access/IRBAC.sol";

interface IMasterAccessManagement is IRBAC {
/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/mock/core/multicall/MulticallMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "../../../core/multicall/Multicall.sol";
import {Multicall} from "../../../core/multicall/Multicall.sol";

contract MulticallMock is Multicall {
bytes[] public latestCallOutputs;
Expand Down
6 changes: 3 additions & 3 deletions contracts/mock/core/multicall/MulticalleeMock.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "@dlsl/dev-modules/libs/utils/TypeCaster.sol";
import {TypeCaster} from "@solarity/solidity-lib/libs/utils/TypeCaster.sol";

import "../../../interfaces/core/multicall/IMulticall.sol";
import "../../../interfaces/core/IMasterAccessManagement.sol";
import {IMulticall} from "../../../interfaces/core/multicall/IMulticall.sol";
import {IMasterAccessManagement} from "../../../interfaces/core/IMasterAccessManagement.sol";

contract MulticalleeMock {
using TypeCaster for *;
Expand Down
2 changes: 1 addition & 1 deletion contracts/mock/core/registry/RoleManagedRegistryMock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import "../../../core/registry/RoleManagedRegistry.sol";
import {RoleManagedRegistry} from "../../../core/registry/RoleManagedRegistry.sol";

contract RoleManagedRegistryMock is RoleManagedRegistry {
function init(
Expand Down
27 changes: 0 additions & 27 deletions contracts/package.json

This file was deleted.

Loading
Loading