-
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
0 parents
commit 07398df
Showing
15 changed files
with
11,500 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Massa Labs | ||
|
||
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,5 @@ | ||
# Recurring payments | ||
|
||
This dapp allow you to send FT token to a recipient in the future and regularly. | ||
|
||
For example, the recipient will receive the token every month until the end date. |
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 @@ | ||
WALLET_SECRET_KEY="" | ||
|
||
JSON_RPC_URL_PUBLIC=https://buildnet.massa.net/api/v2:33035 |
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 @@ | ||
module.exports = { | ||
extends: ['@massalabs'], | ||
}; |
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,18 @@ | ||
name: massa sc ci tests | ||
on: [push] | ||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
|
||
- name: Install | ||
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
build | ||
.env |
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,60 @@ | ||
# My Massa Smart-contract Project | ||
|
||
## Build | ||
|
||
By default this will build all files in `assembly/contracts` directory. | ||
|
||
```shell | ||
npm run build | ||
``` | ||
|
||
## Deploy a smart contract | ||
|
||
Prerequisites : | ||
|
||
- You must add a `.env` file at the root of the repository with the following keys set to valid values : | ||
- WALLET_SECRET_KEY="wallet_secret_key" | ||
- JSON_RPC_URL_PUBLIC=<https://test.massa.net/api/v2:33035> | ||
|
||
These keys will be the ones used by the deployer script to interact with the blockchain. | ||
|
||
The following command will build contracts in `assembly/contracts` directory and execute the deployment script | ||
`src/deploy.ts`. This script will deploy on the node specified in the `.env` file. | ||
|
||
```shell | ||
npm run deploy | ||
``` | ||
|
||
You can modify `src/deploy.ts` to change the smart contract being deployed, and to pass arguments to the constructor | ||
function: | ||
|
||
- line 31: specify what contract you want to deploy | ||
- line 33: create the `Args` object to pass to the constructor of the contract you want to deploy | ||
|
||
When the deployment operation is executed on-chain, the | ||
[constructor](https://github.com/massalabs/massa-sc-toolkit/blob/main/packages/sc-project-initializer/commands/init/assembly/contracts/main.ts#L10) | ||
function of the smart contract being deployed will | ||
be called with the arguments provided in the deployment script. | ||
|
||
The deployment script uses [massa-sc-deployer library](https://www.npmjs.com/package/@massalabs/massa-sc-deployer) | ||
to deploy smart contracts. | ||
|
||
You can edit this script and use [massa-web3 library](https://www.npmjs.com/package/@massalabs/massa-web3) | ||
to create advanced deployment procedure. | ||
|
||
For more information, please visit our ReadTheDocs about | ||
[Massa smart-contract development](https://docs.massa.net/en/latest/web3-dev/smart-contracts.html). | ||
|
||
## Unit tests | ||
|
||
The test framework documentation is available here: [as-pect docs](https://as-pect.gitbook.io/as-pect) | ||
|
||
```shell | ||
npm run test | ||
``` | ||
|
||
## Format code | ||
|
||
```shell | ||
npm run fmt | ||
``` |
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,24 @@ | ||
{ | ||
"targets": { | ||
"coverage": { | ||
"lib": ["./node_modules/@as-covers/assembly/index.ts"], | ||
"transform": ["@as-covers/transform", "@as-pect/transform"] | ||
}, | ||
"noCoverage": { | ||
"transform": ["@as-pect/transform"] | ||
} | ||
}, | ||
"options": { | ||
"exportMemory": true, | ||
"outFile": "output.wasm", | ||
"textFile": "output.wat", | ||
"bindings": "raw", | ||
"exportStart": "_start", | ||
"exportRuntime": true, | ||
"use": ["RTRACE=1"], | ||
"debug": true, | ||
"exportTable": true | ||
}, | ||
"extends": "./asconfig.json", | ||
"entries": ["./node_modules/@as-pect/assembly/assembly/index.ts"] | ||
} |
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,28 @@ | ||
import createMockedABI from '@massalabs/massa-as-sdk/vm-mock'; | ||
|
||
export default { | ||
/** | ||
* A set of globs passed to the glob package that qualify typescript files for testing. | ||
*/ | ||
entries: ['assembly/__tests__/**/*.spec.ts'], | ||
/** | ||
* A set of globs passed to the glob package that quality files to be added to each test. | ||
*/ | ||
include: ['assembly/__tests__/**/*.include.ts'], | ||
/** | ||
* A set of regexp that will disclude source files from testing. | ||
*/ | ||
disclude: [/node_modules/], | ||
/** | ||
* Add your required AssemblyScript imports here. | ||
*/ | ||
async instantiate(memory, createImports, instantiate, binary) { | ||
return createMockedABI(memory, createImports, instantiate, binary); | ||
}, | ||
/** Enable code coverage. */ | ||
// coverage: ["assembly/**/*.ts"], | ||
/** | ||
* Specify if the binary wasm file should be written to the file system. | ||
*/ | ||
outputBinary: false, | ||
}; |
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 @@ | ||
{ | ||
"targets": { | ||
"debug": { | ||
"sourceMap": true, | ||
"debug": true, | ||
"transform": ["@massalabs/as-transformer"] | ||
}, | ||
"release": { | ||
"sourceMap": true, | ||
"optimizeLevel": 3, | ||
"shrinkLevel": 0, | ||
"converge": false, | ||
"noAssert": false, | ||
"transform": ["@massalabs/as-transformer"] | ||
} | ||
}, | ||
"options": { | ||
"exportRuntime": true, | ||
"bindings": "esm" | ||
} | ||
} |
Oops, something went wrong.