-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* github tasks * feat(Util): string to bytes32 conversion * feat(release): adding github actions * fix(ci): removing bytecode publishing * fix(dist): removing codeowners * fix(executables): storing gateway as immutable * feature(dist): copying the gateway interface * fix(formatting): prettier Co-authored-by: Kiryl Yermakou <rma4ok@gmail.com>
- Loading branch information
Showing
33 changed files
with
750 additions
and
585 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,4 @@ | ||
# Lines starting with '#' are comments. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
* @sammy1991106 @re1ro @Foivos |
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,25 @@ | ||
name: Ensure Conventional Commit message | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
ensure-CC: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: semantic-pull-request | ||
uses: amannn/action-semantic-pull-request@v3.2.6 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
# Configure additional validation for the subject based on a regex. | ||
# This example ensures the subject doesn't start with an uppercase character. | ||
subjectPattern: ^(?![A-Z]).+$ | ||
# If `subjectPattern` is configured, you can use this property to override | ||
# the default error message that is shown when the pattern doesn't match. | ||
# The variables `subject` and `title` can be used within the message. | ||
subjectPatternError: | | ||
The subject "{subject}" found in the pull request title "{title}" | ||
didn't match the configured pattern. Please ensure that the subject | ||
doesn't start with an uppercase character. |
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,30 @@ | ||
name: Linting | ||
|
||
on: | ||
- pull_request | ||
|
||
jobs: | ||
lint: | ||
strategy: | ||
matrix: | ||
node-version: | ||
- 14.x | ||
os: | ||
- ubuntu-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Lint | ||
run: npm run lint | ||
|
||
- name: Flatten | ||
run: npm run flatten |
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,23 @@ | ||
name: 'publish to npm' | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish-to-npm: | ||
name: 'Publish to NPM' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm install | ||
- run: npm run build | ||
- run: cp -r artifacts/contracts/interfaces . | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,27 @@ | ||
name: Testing | ||
|
||
on: | ||
- pull_request | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
node-version: | ||
- 14.x | ||
os: | ||
- ubuntu-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Test | ||
run: npm run test |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
artifacts | ||
cache | ||
build |
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,40 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.9; | ||
|
||
library StringToBytes32 { | ||
error InvalidStringLength(); | ||
|
||
function toBytes32(string memory str) internal pure returns (bytes32) { | ||
// Converting a string to bytes32 for immutable storage | ||
bytes memory stringBytes = bytes(str); | ||
|
||
// We can store up to 31 bytes of data as 1 byte is for encoding length | ||
if (stringBytes.length == 0 || stringBytes.length > 31) revert InvalidStringLength(); | ||
|
||
uint256 stringNumber = uint256(bytes32(stringBytes)); | ||
|
||
// Storing string length as the last byte of the data | ||
stringNumber |= 0xff & stringBytes.length; | ||
return bytes32(abi.encodePacked(stringNumber)); | ||
} | ||
} | ||
|
||
library Bytes32ToString { | ||
function toTrimmedString(bytes32 stringData) internal pure returns (string memory converted) { | ||
// recovering string length as the last byte of the data | ||
uint256 length = 0xff & uint256(stringData); | ||
|
||
// restoring the string with the correct length | ||
// solhint-disable-next-line no-inline-assembly | ||
assembly { | ||
converted := mload(0x40) | ||
// new "memory end" including padding (the string isn't larger than 32 bytes) | ||
mstore(0x40, add(converted, 0x40)) | ||
// store length in memory | ||
mstore(converted, length) | ||
// write actual data | ||
mstore(add(converted, 0x20), stringData) | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.