Skip to content

Commit

Permalink
Merge branch 'master' into poc_easy_polls
Browse files Browse the repository at this point in the history
  • Loading branch information
sczembor authored Aug 10, 2023
2 parents 73b55b1 + 948713b commit a2265da
Show file tree
Hide file tree
Showing 29 changed files with 4,940 additions and 279 deletions.
3,901 changes: 3,901 additions & 0 deletions contracts/Cargo.lock

Large diffs are not rendered by default.

30 changes: 18 additions & 12 deletions contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ edition = "2021"
license = "Mozilla Public License Version 2.0"
repository = "https://github.com/near-ndc/i-am-human"

# compilation profile for a release target
[profile.release]
codegen-units = 1
# s = optimize for binary size ("z" would additionally turn off loop vectorization), z is recommended usually
Expand All @@ -27,23 +26,30 @@ opt-level = "s"
# link time optimization
lto = true
panic = "abort"
# overflow-checks = true
# debug = false
# debug-assertions = false
# rpath = false

[profile.test]
panic = "abort"
overflow-checks = true
debug = false
debug-assertions = false
rpath = false


[workspace.dependencies]
near-sdk = { version = "^4.1.1", features = ["unstable"] }
near-contract-standards = "^4.1.1"
uint = { version = "^0.9.5", default-features = false }
serde_json = "^1.0"
anyhow = "1.0.71"
ed25519-dalek = "1"
near-abi = "0.3.0"
schemars = "0.8.12"
pretty_assertions = "1.4.0"
anyhow = "1.0.71"
tokio = { version = "1.29.1", features = ["full"] }
workspaces = { version = "0.7.0", features = ["unstable"] }
near-contract-standards = "^4.1.1"
near-crypto = "0.17"
near-primitives = "0.17.0"
near-sdk = { version = "^4.1.1", features = ["unstable"] }
near-units = "0.2.0"
pretty_assertions = "1.4.0"
schemars = "0.8.12"
serde_json = { version = "^1.0", features = ["raw_value"] }
tokio = { version = "1.29.1", features = ["full"] }
tracing = "0.1.37"
uint = { version = "^0.9.5", default-features = false }
workspaces = { version = "0.7.0", features = ["unstable"] }
12 changes: 5 additions & 7 deletions contracts/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
##
# I Am Human

res:
mkdir -p res

add-deps:
rustup target add wasm32-unknown-unknown

build:
build: res
@RUSTFLAGS='-C link-arg=-s' cargo build --all --target wasm32-unknown-unknown --release
@mkdir -p res
@cp target/wasm32-unknown-unknown/release/*.wasm res/

cp-builds:
@mkdir -p res
@cp target/wasm32-unknown-unknown/release/*.wasm res/

test:
test: build
@cargo test
31 changes: 24 additions & 7 deletions contracts/Makefile-common.mk
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
build:
res:
mkdir -p res

build: res
@RUSTFLAGS='-C link-arg=-s' cargo build --target wasm32-unknown-unknown --release
@cp ../target/wasm32-unknown-unknown/release/*.wasm ../res/
# @cargo near abi

build-quick:
build-debug: res
@RUSTFLAGS='-C link-arg=-s' cargo build --target wasm32-unknown-unknown
@cp ../target/wasm32-unknown-unknown/release/*.wasm ../res/
@cp ../target/wasm32-unknown-unknown/debug/*.wasm ../res/

build-abi: res
@cargo near abi
@cp ../target/near/*/*_abi.json ../res


build-all:
build-all: res
@RUSTFLAGS='-C link-arg=-s' cargo build --all --target wasm32-unknown-unknown --release
@cp ../target/wasm32-unknown-unknown/release/*.wasm ../res/
@cargo near abi
@cp ../target/near/*/*_abi.json ../res

lint:
cargo clippy -- --no-deps

test:
lint-fix:
cargo clippy --fix -- --no-deps


test: build
# to test specific test run: cargo test <test name>
@cargo test

test-unit-debug:
@RUST_BACKTRACE=1 cargo test --lib -- --nocapture
@RUST_BACKTRACE=1 cargo test --lib -- --show-output

test-unit:
@cargo test --lib
17 changes: 17 additions & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contracts

## Requirements

- Rust v1.69.
Note: near-sdk doesn't work with Rust v1.70: https://github.com/near/nearcore/issues/9143
- Cargo
- [cargo-near](https://github.com/near/cargo-near)

## Building

To create release WASM and ABI in the `res` directory, run:

```shell
cd <contract>
make build
```
5 changes: 3 additions & 2 deletions contracts/community-sbt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ Only admin can add or revoke minting authority.

#### TTL

Time To Live (TTL) is a duration in milliseconds used to define token expire time: `expires_at = now + ttl`
The constructor parameter is used to define max and default TTL when minting tokens.
Time To Live (TTL) is a duration in milliseconds used to define token expire time: `expires_at = now + ttl`.
Every token class has its own `MAX_TTL` value which is being set when enabling new class for minting.
The `max_ttl` value can be changed by an admin by calling the `set_max_ttl` method.

#### SBT classes

Expand Down
Loading

0 comments on commit a2265da

Please sign in to comment.