-
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.
integrate example my-counter-contract and upload and instantiate cont…
…racts
- Loading branch information
Showing
54 changed files
with
7,650 additions
and
5,620 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,10 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.{js,json,yml}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 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
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 @@ | ||
lts/hydrogen |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 +1,11 @@ | ||
compressionLevel: mixed | ||
|
||
enableColors: true | ||
|
||
enableGlobalCache: false | ||
|
||
nmHoistingLimits: workspaces | ||
|
||
nodeLinker: node-modules | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs | ||
spec: "@yarnpkg/plugin-typescript" | ||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs | ||
spec: "@yarnpkg/plugin-interactive-tools" | ||
|
||
yarnPath: .yarn/releases/yarn-3.2.3.cjs | ||
yarnPath: .yarn/releases/yarn-4.2.2.cjs |
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 |
---|---|---|
|
@@ -66,6 +66,60 @@ Run smart contract test with `yarn hardhat:test` | |
- Edit your frontend homepage at `packages/nextjs/app/page.tsx`. For guidance on [routing](https://nextjs.org/docs/app/building-your-application/routing/defining-routes) and configuring [pages/layouts](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) checkout the Next.js documentation. | ||
- Edit your deployment scripts in `packages/hardhat/deploy` | ||
|
||
### Secret Network | ||
|
||
#### Setup | ||
|
||
* Reference https://docs.scrt.network/secret-network-documentation/development/readme-1 | ||
|
||
* Install Git and Make - https://docs.scrt.network/secret-network-documentation/development/readme-1/setting-up-your-environment#install-requirements | ||
|
||
* Install Rust | ||
``` | ||
rustup update | ||
rustup toolchain use stable | ||
rustup target add wasm32-unknown-unknown | ||
source "$HOME/.cargo/env" | ||
``` | ||
* Install Cargo Generate | ||
``` | ||
cargo install cargo-generate --features vendored-openssl | ||
``` | ||
|
||
* Install dependencies | ||
``` | ||
nvm use | ||
npm install --global lerna | ||
yarn set version 4.2.2 | ||
corepack enable | ||
corepack prepare [email protected] --activate | ||
``` | ||
|
||
#### Create, Compile and Deploy Contract (Example: Counter) | ||
|
||
* Reference https://docs.scrt.network/secret-network-documentation/development/readme-1/compile-and-deploy | ||
|
||
``` | ||
mkdir -p packages/secret-contracts && cd packages/secret-contracts | ||
cargo generate --git https://github.com/scrtlabs/secret-template.git --name my-counter-contract | ||
``` | ||
|
||
* Compile. Note: Outputs contract.wasm and contract.wasm.gz file in the root directory of the secret-contracts/my-counter-contract folder | ||
|
||
``` | ||
cd packages/secret-contracts/my-counter-contract | ||
make build | ||
``` | ||
|
||
* OPTIONAL - optimize contract code | ||
|
||
``` | ||
yarn run secret:clean:uploadContract | ||
yarn run secret:start:uploadContract | ||
yarn run secret:clean:instantiateContract | ||
yarn run secret:start:instantiateContract | ||
``` | ||
|
||
## Documentation | ||
|
||
|
@@ -77,4 +131,4 @@ To know more about its features, check out our [website](https://scaffoldeth.io) | |
|
||
We welcome contributions to Scaffold-ETH 2! | ||
|
||
Please see [CONTRIBUTING.MD](https://github.com/scaffold-eth/scaffold-eth-2/blob/main/CONTRIBUTING.md) for more information and guidelines for contributing to Scaffold-ETH 2. | ||
Please see [CONTRIBUTING.MD](https://github.com/scaffold-eth/scaffold-eth-2/blob/main/CONTRIBUTING.md) for more information and guidelines for contributing to Scaffold-ETH 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,11 @@ | ||
const dotenv = require("dotenv") | ||
const path = require("path") | ||
if (process.env.NODE_ENV === "production") { | ||
dotenv.config({ | ||
path: path.resolve(__dirname, `./.env.production`), | ||
}) | ||
} else { | ||
dotenv.config({ | ||
path: path.resolve(__dirname, "./.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,8 @@ | ||
{ | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json", | ||
"version": "0.0.0", | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"npmClient": "yarn" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[alias] | ||
# Temporarily removed the backtraces feature from the unit-test run due to compilation errors in | ||
# the cosmwasm-std package: | ||
# cosmwasm-std = { git = "https://github.com/scrtlabs/cosmwasm", branch = "secret" } | ||
# unit-test = "test --lib --features backtraces" | ||
unit-test = "test --lib" | ||
schema = "run --bin schema --features schema" |
11 changes: 11 additions & 0 deletions
11
packages/secret-contracts/my-counter-contract/.editorconfig
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 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.rs] | ||
indent_size = 4 |
18 changes: 18 additions & 0 deletions
18
...ges/secret-contracts/my-counter-contract/.github/actions/install-rust/README.md
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 @@ | ||
# install-rust | ||
|
||
A small github action to install `rustup` and a Rust toolchain. This is | ||
generally expressed inline, but it was repeated enough in this repository it | ||
seemed worthwhile to extract. | ||
|
||
Some gotchas: | ||
|
||
- Can't `--self-update` on Windows due to permission errors (a bug in Github | ||
Actions) | ||
- `rustup` isn't installed on macOS (a bug in Github Actions) | ||
|
||
When the above are fixed we should delete this action and just use this inline: | ||
|
||
```yml | ||
- run: rustup update $toolchain && rustup default $toolchain | ||
shell: bash | ||
``` |
12 changes: 12 additions & 0 deletions
12
packages/secret-contracts/my-counter-contract/.github/actions/install-rust/action.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,12 @@ | ||
name: "Install Rust toolchain" | ||
description: "Install both `rustup` and a Rust toolchain" | ||
|
||
inputs: | ||
toolchain: | ||
description: "Default toolchain to install" | ||
required: false | ||
default: "stable" | ||
|
||
runs: | ||
using: node16 | ||
main: "main.js" |
38 changes: 38 additions & 0 deletions
38
packages/secret-contracts/my-counter-contract/.github/actions/install-rust/main.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,38 @@ | ||
const child_process = require('child_process'); | ||
const toolchain = process.env.INPUT_TOOLCHAIN; | ||
const fs = require('fs'); | ||
|
||
function set_env(name, val) { | ||
fs.appendFileSync(process.env['GITHUB_ENV'], `${name}=${val}\n`) | ||
} | ||
|
||
// Needed for now to get 1.24.2 which fixes a bug in 1.24.1 that causes issues | ||
// on Windows. | ||
if (process.platform === 'win32') { | ||
child_process.execFileSync('rustup', ['self', 'update']); | ||
} | ||
|
||
child_process.execFileSync('rustup', ['set', 'profile', 'minimal']); | ||
child_process.execFileSync('rustup', ['update', toolchain, '--no-self-update']); | ||
child_process.execFileSync('rustup', ['default', toolchain]); | ||
|
||
// Deny warnings on CI to keep our code warning-free as it lands in-tree. Don't | ||
// do this on nightly though since there's a fair amount of warning churn there. | ||
// RUSTIX: Disable this so that it doesn't overwrite RUSTFLAGS for setting | ||
// "--cfg rustix_use_libc". We re-add it manually in the workflow. | ||
//if (!toolchain.startsWith('nightly')) { | ||
// set_env("RUSTFLAGS", "-D warnings"); | ||
//} | ||
|
||
// Save disk space by avoiding incremental compilation, and also we don't use | ||
// any caching so incremental wouldn't help anyway. | ||
set_env("CARGO_INCREMENTAL", "0"); | ||
|
||
// Turn down debuginfo from 2 to 1 to help save disk space | ||
set_env("CARGO_PROFILE_DEV_DEBUG", "1"); | ||
set_env("CARGO_PROFILE_TEST_DEBUG", "1"); | ||
|
||
if (process.platform === 'darwin') { | ||
set_env("CARGO_PROFILE_DEV_SPLIT_DEBUGINFO", "unpacked"); | ||
set_env("CARGO_PROFILE_TEST_SPLIT_DEBUGINFO", "unpacked"); | ||
} |
90 changes: 90 additions & 0 deletions
90
packages/secret-contracts/my-counter-contract/.github/workflows/Integration.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,90 @@ | ||
name: Integration Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
tests: | ||
name: ${{ matrix.make.name }} (${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
rust: [1.63.0] | ||
make: | ||
- name: Run integration tests # Integration tests | ||
task: "npx ts-node tests/integration.ts" | ||
include: | ||
- os: ubuntu-latest | ||
sccache-path: /home/runner/.cache/sccache | ||
|
||
env: | ||
RUST_BACKTRACE: full | ||
RUSTC_WRAPPER: sccache | ||
RUSTV: ${{ matrix.rust }} | ||
SCCACHE_CACHE_SIZE: 2G | ||
SCCACHE_DIR: ${{ matrix.sccache-path }} | ||
# SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out | ||
|
||
# Service containers to run with `container-job` | ||
services: | ||
# Label used to access the service container | ||
secret: | ||
# Docker Hub image | ||
image: ghcr.io/scrtlabs/localsecret:v1.6.0-rc.3 | ||
ports: | ||
# Opens tcp port | ||
- 5000:5000 | ||
- 9091:9091 | ||
- 1317:1317 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install sccache | ||
env: | ||
LINK: https://github.com/mozilla/sccache/releases/download | ||
SCCACHE_VERSION: v0.2.15 | ||
run: | | ||
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl | ||
mkdir -p $HOME/.local/bin | ||
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz | ||
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache | ||
chmod +x $HOME/.local/bin/sccache | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: Install dependencies | ||
run: npm --prefix tests/ install # Install dependencies | ||
- uses: ./.github/actions/install-rust | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
- name: Add wasm toolchain | ||
run: | | ||
rustup target add wasm32-unknown-unknown | ||
- name: Cache cargo registry | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo- | ||
- name: Save sccache | ||
uses: actions/cache@v2 | ||
continue-on-error: false | ||
with: | ||
path: ${{ matrix.sccache-path }} | ||
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-sccache- | ||
- name: Start sccache server | ||
run: sccache --start-server | ||
- name: Compile code | ||
run: make build | ||
- name: ${{ matrix.make.name }} | ||
run: ${{ matrix.make.task }} | ||
- name: Print sccache stats | ||
run: sccache --show-stats | ||
- name: Stop sccache server | ||
run: sccache --stop-server || true |
Oops, something went wrong.