-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added contracts, tests, and workflows
- Loading branch information
1 parent
7ff5039
commit 0cf0993
Showing
73 changed files
with
11,220 additions
and
3,927 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"path": "cz-conventional-changelog" | ||
} |
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,16 @@ | ||
# EditorConfig http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# All files | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.sol] | ||
indent_size = 4 |
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,31 @@ | ||
# GENERAL | ||
|
||
## The network used for testing purposes | ||
NETWORK_NAME="mainnet" # ["mainnet", "goerli", "polygon", "polygonMumbai"] | ||
|
||
# CONTRACTS | ||
|
||
## Hex encoded private keys separated by a comma `,`a | ||
PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" # Default hardhat account 0 private key. DON'T USE FOR DEPLOYMENTS | ||
|
||
## Infura credentials | ||
INFURA_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" | ||
|
||
## Gas Reporting | ||
REPORT_GAS='true' | ||
COINMARKETCAP_API_KEY="zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz" | ||
|
||
## Block explorers | ||
ETHERSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" | ||
POLYGONSCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" | ||
BASESCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" | ||
|
||
# SUBGRAPH | ||
|
||
## The Graph credentials | ||
GRAPH_KEY="zzzzzzzzzzzz" | ||
|
||
## Subgraph | ||
SUBGRAPH_NAME="osx" | ||
SUBGRAPH_VERSION="alice-debug-1s" | ||
SUBGRAPH_NETWORK_NAME="goerli" # ["mainnet", "goerli", "polygon", "polygonMumbai"] |
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,38 @@ | ||
name: 'Contracts' | ||
|
||
env: | ||
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} | ||
working-directory: contracts | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'contracts/**' | ||
- '.github/workflows/contracts-*.yml' | ||
|
||
jobs: | ||
tests: | ||
runs-on: 'ubuntu-latest' | ||
defaults: | ||
run: | ||
working-directory: ${{env.working-directory}} | ||
steps: | ||
- name: 'Check out the repo' | ||
uses: 'actions/checkout@v3' | ||
|
||
- name: 'Install Node.js' | ||
uses: 'actions/setup-node@v3' | ||
with: | ||
cache: 'yarn' | ||
node-version: 16 | ||
|
||
- name: 'Install general dependencies' | ||
run: 'yarn install' | ||
|
||
- name: 'Build the contracts' | ||
run: 'yarn build' | ||
working-directory: contracts | ||
|
||
- name: 'Test the contracts and generate the coverage report' | ||
run: 'yarn coverage' | ||
working-directory: contracts |
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 |
---|---|---|
|
@@ -4,7 +4,6 @@ env: | |
working-directory: . | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
|
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ name: Subgraph | |
on: | ||
push: | ||
paths: | ||
- 'contracts/**' | ||
- 'subgraph/**' | ||
- '.github/workflows/subgraph-*.yml' | ||
|
||
|
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,7 @@ | ||
module.exports = { | ||
istanbulReporter: ['html', 'lcov'], | ||
providerOptions: { | ||
privateKey: process.env.PRIVATE_KEY, | ||
}, | ||
skipFiles: ['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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"plugins": ["prettier"], | ||
"rules": { | ||
"code-complexity": ["error", 8], | ||
"compiler-version": ["error", "^0.8.8"], | ||
"func-visibility": ["error", {"ignoreConstructors": true}], | ||
"max-line-length": ["off", 100], | ||
"named-parameters-mapping": "warn", | ||
"no-console": "error", | ||
"not-rely-on-time": "error", | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"endOfLine": "auto" | ||
} | ||
] | ||
} | ||
} |
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,3 @@ | ||
# directories | ||
**/artifacts | ||
**/node_modules |
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,35 @@ | ||
{{h 2}} {{visibility}} {{toLowerCase type}} {{name}} | ||
|
||
{{{natspec.notice}}} | ||
|
||
{{#if signature}} | ||
```solidity | ||
{{{signature}}} | ||
``` | ||
{{/if}} | ||
|
||
{{#if natspec.params}} | ||
| Input | Type | Description | | ||
|:----- | ---- | ----------- | | ||
{{#each params}} | ||
| `{{{name}}}` | `{{{type}}}` | {{{joinLines natspec}}} | | ||
{{/each}} | ||
{{#if natspec.returns}} | ||
| **Output** | | | ||
{{#each returns}} | ||
| {{#if name}} `{{name}}` {{else}} `{{@index}}` {{/if}} | `{{type}}` | {{{joinLines natspec}}} | | ||
{{/each}} | ||
{{/if}} | ||
{{else}} | ||
{{#if natspec.returns}} | ||
| Output | Type | Description | | ||
| ------ | ---- | ----------- | | ||
{{#each returns}} | ||
| {{#if name}} `{{{name}}}` {{else}} `{{{@index}}}` {{/if}} | `{{type}}` | {{{joinLines natspec}}} | | ||
{{/each}} | ||
{{/if}} | ||
{{/if}} | ||
|
||
{{#if natspec.dev}} | ||
*{{{natspec.dev}}}* | ||
{{/if}} |
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,12 @@ | ||
## Description | ||
|
||
{{{natspec.notice}}} | ||
|
||
{{{natspec.dev}}} | ||
|
||
## Implementation | ||
|
||
{{#each items}} | ||
{{>item}} | ||
{{/each}} | ||
<!--CONTRACT_END--> |
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,9 @@ | ||
{{>common}} | ||
|
||
```solidity | ||
enum {{name}} { | ||
{{#each members}} | ||
{{name}}{{#unless @last}},{{/unless}} | ||
{{/each}} | ||
} | ||
``` |
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 @@ | ||
{{>common}} |
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 @@ | ||
{{>common}} |
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 @@ | ||
{{>common}} |
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,69 @@ | ||
import {HelperOptions, Utils} from 'handlebars'; | ||
|
||
/** | ||
* Returns a Markdown heading marker. An optional number increases the heading level. | ||
* | ||
* Input Output | ||
* {{h}} {{name}} # Name | ||
* {{h 2}} {{name}} ## Name | ||
*/ | ||
export function h(opts: HelperOptions): string; | ||
export function h(hsublevel: number, opts: HelperOptions): string; | ||
export function h(hsublevel: number | HelperOptions, opts?: HelperOptions) { | ||
const {hlevel} = getHLevel(hsublevel, opts); | ||
return new Array(hlevel).fill('#').join(''); | ||
} | ||
|
||
/** | ||
* Delineates a section where headings should be increased by 1 or a custom number. | ||
* | ||
* {{#hsection}} | ||
* {{>partial-with-headings}} | ||
* {{/hsection}} | ||
*/ | ||
export function hsection(opts: HelperOptions): string; | ||
export function hsection(hsublevel: number, opts: HelperOptions): string; | ||
export function hsection( | ||
this: unknown, | ||
hsublevel: number | HelperOptions, | ||
opts?: HelperOptions | ||
) { | ||
let hlevel; | ||
({hlevel, opts} = getHLevel(hsublevel, opts)); | ||
opts.data = Utils.createFrame(opts.data); | ||
opts.data.hlevel = hlevel; | ||
return opts.fn(this as unknown, opts); | ||
} | ||
|
||
/** | ||
* Helper for dealing with the optional hsublevel argument. | ||
*/ | ||
function getHLevel(hsublevel: number | HelperOptions, opts?: HelperOptions) { | ||
if (opts === undefined) { | ||
throw Error('opts are undefined'); | ||
} | ||
if (typeof hsublevel === 'number') { | ||
hsublevel = Math.max(1, hsublevel); | ||
} else { | ||
opts = hsublevel; | ||
hsublevel = 1; | ||
} | ||
const contextHLevel: number = opts.data?.hlevel ?? 0; | ||
return {opts, hlevel: contextHLevel + hsublevel}; | ||
} | ||
|
||
export function trim(text: string) { | ||
if (typeof text === 'string') { | ||
return text.trim(); | ||
} | ||
} | ||
|
||
export function toLowerCase(text: string) { | ||
return text.toLowerCase(); | ||
} | ||
|
||
export function joinLines(text?: string) { | ||
if (typeof text === 'string') { | ||
return text.replace(/\n+/g, ' '); | ||
} | ||
} |
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 @@ | ||
{{>common}} |
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,7 @@ | ||
|
||
{{#each items}} | ||
{{#hsection}} | ||
{{>item}} | ||
{{/hsection}} | ||
|
||
{{/each}} |
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,9 @@ | ||
{{>common}} | ||
|
||
```solidity | ||
struct {{name}} { | ||
{{#each members}} | ||
{{{typeName.typeDescriptions.typeString}}} {{name}}; | ||
{{/each}} | ||
} | ||
``` |
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 @@ | ||
{{>common}} |
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 @@ | ||
{{>common}} |
Oops, something went wrong.