-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
29 changed files
with
19,129 additions
and
0 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,4 @@ | ||
node_modules/ | ||
dist/ | ||
coverage/ | ||
.eslintrc.js |
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,8 @@ | ||
// Copyright Abridged, Inc. 2022. All Rights Reserved. | ||
// Node module: @collabland/staking-contracts | ||
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
|
||
module.exports = { | ||
extends: '@loopback/eslint-config', | ||
}; |
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,66 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# Transpiled JavaScript files from Typescript | ||
/dist | ||
|
||
# Cache used by TypeScript's incremental build | ||
*.tsbuildinfo | ||
|
||
src/types |
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,5 @@ | ||
{ | ||
"exit": true, | ||
"recursive": true, | ||
"require": "source-map-support/register" | ||
} |
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 @@ | ||
dist |
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 @@ | ||
{ | ||
"bracketSpacing": false, | ||
"singleQuote": true, | ||
"printWidth": 80, | ||
"trailingComma": "all", | ||
"arrowParens": "avoid" | ||
} |
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 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}/dist/index.js", | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Run Mocha tests", | ||
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", | ||
"runtimeArgs": [ | ||
"-r", | ||
"${workspaceRoot}/node_modules/source-map-support/register" | ||
], | ||
"cwd": "${workspaceRoot}", | ||
"autoAttachChildProcesses": true, | ||
"args": [ | ||
"--config", | ||
"${workspaceRoot}/.mocharc.json", | ||
"${workspaceRoot}/dist/__tests__/**/*.js", | ||
"-t", | ||
"0" | ||
] | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "attach", | ||
"name": "Attach to Process", | ||
"port": 5858 | ||
} | ||
] | ||
} |
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,32 @@ | ||
{ | ||
"editor.rulers": [80], | ||
"editor.tabCompletion": "on", | ||
"editor.tabSize": 2, | ||
"editor.trimAutoWhitespace": true, | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true, | ||
"source.fixAll.eslint": true | ||
}, | ||
|
||
"files.exclude": { | ||
"**/.DS_Store": true, | ||
"**/.git": true, | ||
"**/.hg": true, | ||
"**/.svn": true, | ||
"**/CVS": true, | ||
"dist": true, | ||
}, | ||
"files.insertFinalNewline": true, | ||
"files.trimTrailingWhitespace": true, | ||
|
||
"typescript.tsdk": "./node_modules/typescript/lib", | ||
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false, | ||
"typescript.preferences.quoteStyle": "single", | ||
"eslint.run": "onSave", | ||
"eslint.nodePath": "./node_modules", | ||
"eslint.validate": [ | ||
"javascript", | ||
"typescript" | ||
] | ||
} |
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,29 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Watch and Compile Project", | ||
"type": "shell", | ||
"command": "npm", | ||
"args": ["--silent", "run", "build:watch"], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"problemMatcher": "$tsc-watch" | ||
}, | ||
{ | ||
"label": "Build, Test and Lint", | ||
"type": "shell", | ||
"command": "npm", | ||
"args": ["--silent", "run", "test:dev"], | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
}, | ||
"problemMatcher": ["$tsc", "$eslint-compact", "$eslint-stylish"] | ||
} | ||
] | ||
} |
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,6 @@ | ||
{ | ||
"@loopback/cli": { | ||
"packageManager": "npm", | ||
"version": "4.1.2" | ||
} | ||
} |
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,36 @@ | ||
# Developer's Guide | ||
|
||
We use Visual Studio Code for developing `@collabland/staking-contracts` and recommend the same to our | ||
users. | ||
|
||
## VSCode setup | ||
|
||
Install the following extensions: | ||
|
||
- [eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) | ||
- [prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) | ||
|
||
## Development workflow | ||
|
||
### Visual Studio Code | ||
|
||
1. Start the build task (Cmd+Shift+B) to run TypeScript compiler in the | ||
background, watching and recompiling files as you change them. Compilation | ||
errors will be shown in the VSCode's "PROBLEMS" window. | ||
|
||
2. Execute "Run Rest Task" from the Command Palette (Cmd+Shift+P) to re-run the | ||
test suite and lint the code for both programming and style errors. Linting | ||
errors will be shown in VSCode's "PROBLEMS" window. Failed tests are printed | ||
to terminal output only. | ||
|
||
### Other editors/IDEs | ||
|
||
1. Open a new terminal window/tab and start the continuous build process via | ||
`npm run build:watch`. It will run TypeScript compiler in watch mode, | ||
recompiling files as you change them. Any compilation errors will be printed | ||
to the terminal. | ||
|
||
2. In your main terminal window/tab, run `npm run test:dev` to re-run the test | ||
suite and lint the code for both programming and style errors. You should run | ||
this command manually whenever you have new changes to test. Test failures | ||
and linter errors will be printed to the terminal. |
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,26 @@ | ||
Copyright (c) Abridged, Inc. 2022. | ||
Node module: @collabland/staking-contracts | ||
This project is licensed under the MIT License, full text below. | ||
|
||
-------- | ||
|
||
MIT License | ||
|
||
Copyright (c) Abridged, Inc. 2022 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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 @@ | ||
# collabland@/staking-contracts | ||
|
||
This project provides support for a curated list of stacking contracts for Collab.Land's token gating capabilities. |
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,66 @@ | ||
// Copyright Abridged, Inc. 2022. All Rights Reserved. | ||
// Node module: @collabland/staking-contracts | ||
// This file is licensed under the MIT License. | ||
// License text available at https://opensource.org/licenses/MIT | ||
|
||
require('@nomiclabs/hardhat-ethers'); | ||
require('@nomiclabs/hardhat-solhint'); | ||
require('@typechain/hardhat'); | ||
const path = require('path'); | ||
|
||
const DEPLOYER_PRIVATE_KEY = | ||
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'; | ||
|
||
const USER1_PRIVATE_KEY = | ||
'0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d'; | ||
|
||
const USER2_PRIVATE_KEY = | ||
'0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a'; | ||
|
||
// You need to export an object to set up your config | ||
// Go to https://hardhat.org/config/ to learn more | ||
const config = { | ||
solidity: { | ||
version: '0.8.3', | ||
settings: { | ||
optimizer: { | ||
enabled: true, | ||
runs: 1000, | ||
}, | ||
}, | ||
}, | ||
paths: { | ||
root: path.join(__dirname, '.'), | ||
sources: path.join(__dirname, './src/contracts'), | ||
tests: path.join(__dirname, './dist/__tests__'), | ||
cache: path.join(__dirname, './dist/cache'), | ||
artifacts: path.join(__dirname, './dist/artifacts'), | ||
}, | ||
defaultNetwork: 'hardhat', | ||
networks: { | ||
hardhat: { | ||
accounts: [ | ||
{ | ||
balance: '10000000000000000000000', | ||
privateKey: DEPLOYER_PRIVATE_KEY, | ||
}, | ||
{ | ||
balance: '10000000000000000000000', | ||
privateKey: USER1_PRIVATE_KEY, | ||
}, | ||
{ | ||
balance: '10000000000000000000000', | ||
privateKey: USER2_PRIVATE_KEY, | ||
}, | ||
], | ||
}, | ||
}, | ||
typechain: { | ||
outDir: 'src/types', | ||
target: 'ethers-v5', | ||
externalArtifacts: [path.join(__dirname, 'src/contracts/**/*.json')], | ||
dontOverrideCompile: false, | ||
}, | ||
}; | ||
|
||
module.exports = config; |
Oops, something went wrong.