-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
2,202 additions
and
1 deletion.
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,22 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
cache: 'yarn' | ||
cache-dependency-path: '**/yarn.lock' | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn 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,11 @@ | ||
{ | ||
"tabWidth": 2, | ||
"printWidth": 120, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"jsxSingleQuote": false, | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"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,68 @@ | ||
# Contributing | ||
|
||
This agreement is for collaboration, it may not be detailed enough, if it is not clear how to do what you want, this is a normal situation, just ask your colleagues. | ||
|
||
## Tech | ||
|
||
TBD | ||
|
||
## Main flow | ||
|
||
```shell | ||
git clone git@github.com:EverscaleGuild/ever-smv-dao.git | ||
cd ever-smv-dao | ||
git checkout -b feature/name-of-feature origin/main | ||
``` | ||
|
||
Coding and testing local see [README.md Develop](https://github.com/EverscaleGuild/ever-smv-dao/blob/main/README.md#develop) | ||
|
||
> Git history: work log vs recipe https://www.bitsnbites.eu/git-history-work-log-vs-recipe/ | ||
Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) | ||
|
||
```shell | ||
git commit --message "feat: paypal payment for different users" | ||
``` | ||
|
||
or | ||
|
||
```shell | ||
git commit --message "fix: hide password display when searching for a user" | ||
``` | ||
|
||
Push and create pull requests | ||
|
||
```shell | ||
git push --set-upstream origin feature/name-of-feature | ||
``` | ||
|
||
Follow by link: | ||
|
||
```shell | ||
https://github.com/EverscaleGuild/ever-smv-dao/pull/new/feature/name-of-feature | ||
``` | ||
|
||
## Update branch from main | ||
|
||
> A tidy, linear Git history https://www.bitsnbites.eu/a-tidy-linear-git-history/ | ||
Get the latest upstream changes and update the working branch: | ||
|
||
```shell | ||
git fetch --prune origin | ||
git rebase --autostash --ignore-date origin/main | ||
``` | ||
|
||
During the rebase, there may be conflicts, they need to be resolved and after the decision to continue the rebase: | ||
|
||
```shell | ||
git rebase --continue | ||
``` | ||
|
||
Upload the updated working branch to the repository, given that we changed the history, this should be done with the force option: | ||
|
||
```shell | ||
git push --force --set-upstream origin feature/name-of-feature | ||
``` | ||
|
||
More details can be found in the tutorial: [git rebase](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase). |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 EverscaleGuild | ||
|
||
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pragma ton-solidity >= 0.64.0; | ||
pragma ever-solidity >= 0.64.0; | ||
|
||
contract Document { | ||
|
||
|
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,103 @@ | ||
import { Address, Contract, Giver, ProviderRpcClient, Transaction } from "locklift"; | ||
import { Ed25519KeyPair } from "everscale-standalone-client"; | ||
|
||
// Reimplements this class if you need to use custom giver contract | ||
export class SimpleGiver implements Giver { | ||
public giverContract: Contract<typeof giverAbi>; | ||
|
||
constructor(ever: ProviderRpcClient, readonly keyPair: Ed25519KeyPair, address: string) { | ||
const giverAddr = new Address(address); | ||
this.giverContract = new ever.Contract(giverAbi, giverAddr); | ||
} | ||
|
||
public async sendTo(sendTo: Address, value: string): Promise<{ transaction: Transaction; output?: {} }> { | ||
return this.giverContract.methods | ||
.sendTransaction({ | ||
value: value, | ||
dest: sendTo, | ||
bounce: false, | ||
}) | ||
.sendExternal({ publicKey: this.keyPair.publicKey }); | ||
} | ||
} | ||
|
||
const giverAbi = { | ||
"ABI version": 2, | ||
header: ["time", "expire"], | ||
functions: [ | ||
{ | ||
name: "upgrade", | ||
inputs: [{ name: "newcode", type: "cell" }], | ||
outputs: [], | ||
}, | ||
{ | ||
name: "sendTransaction", | ||
inputs: [ | ||
{ name: "dest", type: "address" }, | ||
{ name: "value", type: "uint128" }, | ||
{ name: "bounce", type: "bool" }, | ||
], | ||
outputs: [], | ||
}, | ||
{ | ||
name: "getMessages", | ||
inputs: [], | ||
outputs: [ | ||
{ | ||
components: [ | ||
{ name: "hash", type: "uint256" }, | ||
{ name: "expireAt", type: "uint64" }, | ||
], | ||
name: "messages", | ||
type: "tuple[]", | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "constructor", | ||
inputs: [], | ||
outputs: [], | ||
}, | ||
], | ||
events: [], | ||
} as const; | ||
|
||
export class GiverWallet implements Giver { | ||
public giverContract: Contract<typeof giverWallet>; | ||
|
||
constructor(ever: ProviderRpcClient, readonly keyPair: Ed25519KeyPair, address: string) { | ||
const giverAddr = new Address(address); | ||
this.giverContract = new ever.Contract(giverWallet, giverAddr); | ||
} | ||
|
||
public async sendTo(sendTo: Address, value: string): Promise<{ transaction: Transaction; output?: {} }> { | ||
return this.giverContract.methods | ||
.sendTransaction({ | ||
value: value, | ||
dest: sendTo, | ||
bounce: false, | ||
flags: 3, | ||
payload: "", | ||
}) | ||
.sendExternal({ publicKey: this.keyPair.publicKey }); | ||
} | ||
} | ||
|
||
const giverWallet = { | ||
"ABI version": 2, | ||
header: ["pubkey", "time", "expire"], | ||
functions: [ | ||
{ | ||
name: "sendTransaction", | ||
inputs: [ | ||
{ name: "dest", type: "address" }, | ||
{ name: "value", type: "uint128" }, | ||
{ name: "bounce", type: "bool" }, | ||
{ name: "flags", type: "uint8" }, | ||
{ name: "payload", type: "cell" }, | ||
], | ||
outputs: [], | ||
}, | ||
], | ||
events: [], | ||
} as const; |
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,85 @@ | ||
import { LockliftConfig } from "locklift"; | ||
import { FactorySource } from "./build/factorySource"; | ||
import { SimpleGiver, GiverWallet } from "./giverSettings"; | ||
|
||
declare global { | ||
const locklift: import("locklift").Locklift<FactorySource>; | ||
} | ||
|
||
const LOCAL_NETWORK_ENDPOINT = "http://localhost/graphql"; | ||
|
||
const config: LockliftConfig = { | ||
compiler: { | ||
// Specify path to your TON-Solidity-Compiler | ||
// path: "/mnt/o/projects/broxus/TON-Solidity-Compiler/build/solc/solc", | ||
|
||
// Or specify version of compiler | ||
version: "0.64.0", | ||
|
||
// Specify config for extarnal contracts as in exapmple | ||
// externalContracts: { | ||
// "node_modules/broxus-ton-tokens-contracts/build": ['TokenRoot', 'TokenWallet'] | ||
// } | ||
}, | ||
linker: { | ||
// Specify path to your stdlib | ||
// lib: "/mnt/o/projects/broxus/TON-Solidity-Compiler/lib/stdlib_sol.tvm", | ||
// // Specify path to your Linker | ||
// path: "/mnt/o/projects/broxus/TVM-linker/target/release/tvm_linker", | ||
|
||
// Or specify version of linker | ||
version: "0.16.1", | ||
}, | ||
networks: { | ||
local: { | ||
// Specify connection settings for https://github.com/broxus/everscale-standalone-client/ | ||
connection: { | ||
group: "localnet", | ||
type: "graphql", | ||
data: { | ||
endpoints: [LOCAL_NETWORK_ENDPOINT], | ||
latencyDetectionInterval: 1000, | ||
local: true, | ||
}, | ||
}, | ||
// This giver is default local-node giverV2 | ||
giver: { | ||
// Check if you need provide custom giver | ||
giverFactory: (ever, keyPair, address) => new SimpleGiver(ever, keyPair, address), | ||
address: "0:ece57bcc6c530283becbbd8a3b24d3c5987cdddc3c8b7b33be6e4a6312490415", | ||
key: "172af540e43a524763dd53b26a066d472a97c4de37d5498170564510608250c3", | ||
}, | ||
tracing: { | ||
endpoint: LOCAL_NETWORK_ENDPOINT, | ||
}, | ||
keys: { | ||
// Use everdev to generate your phrase | ||
// !!! Never commit it in your repos !!! | ||
// phrase: "action inject penalty envelope rabbit element slim tornado dinner pizza off blood", | ||
amount: 20, | ||
}, | ||
}, | ||
dev: { | ||
// Specify connection settings for https://github.com/broxus/everscale-standalone-client/ | ||
connection: "testnet", | ||
// This giver is default Wallet | ||
giver: { | ||
// Check if you need provide custom giver | ||
giverFactory: (ever, keyPair, address) => new GiverWallet(ever, keyPair, address), | ||
address: "0:ece57bcc6c530283becbbd8a3b24d3c5987cdddc3c8b7b33be6e4a6312490415", | ||
key: "172af540e43a524763dd53b26a066d472a97c4de37d5498170564510608250c3", | ||
}, | ||
keys: { | ||
// Use everdev to generate your phrase | ||
// !!! Never commit it in your repos !!! | ||
// phrase: "action inject penalty envelope rabbit element slim tornado dinner pizza off blood", | ||
amount: 20, | ||
}, | ||
}, | ||
}, | ||
mocha: { | ||
timeout: 2000000, | ||
}, | ||
}; | ||
|
||
export default 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,43 @@ | ||
{ | ||
"name": "ever-smv-dao", | ||
"version": "1.0.0-alpha.0", | ||
"description": "DAO with soft majority voting (SMV) on Everscale", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/EverscaleGuild/ever-smv-dao.git" | ||
}, | ||
"keywords": [ | ||
"tvm", | ||
"solidity", | ||
"locklift", | ||
"dao", | ||
"smv", | ||
"everscale" | ||
], | ||
"author": "EverscaleGuild", | ||
"license": "MIT", | ||
"scripts": { | ||
"nvm": "echo $npm_package_engines_node | cut -d'=' -f2", | ||
"local-network": "everdev se reset", | ||
"contract-build": "locklift build", | ||
"contract-deploy-local": "npx locklift run --network local --script scripts/1-deploy-document.ts", | ||
"contract-deploy-dev": "npx locklift run --network dev --script scripts/1-deploy-document.ts", | ||
"contract-test": "npx locklift test --network local", | ||
"test": "yarn local-network && sleep 5s && yarn contract-test" | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.3.3", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^18.7.14", | ||
"chai": "^4.3.6", | ||
"everdev": "^1.3.0", | ||
"everscale-standalone-client": "^2.1.0", | ||
"locklift": "^2.2.1", | ||
"prettier": "^2.7.1", | ||
"ts-mocha": "^10.0.0", | ||
"typescript": "^4.7.4" | ||
} | ||
} |
Oops, something went wrong.