Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ABS-166: Create accountability module #47

Merged
merged 73 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
917c736
create initial structure
0xmovses Aug 22, 2023
4539d87
create initial state
0xmovses Aug 22, 2023
afa4a1b
create handlers and msg
0xmovses Aug 22, 2023
b2f9d0a
create execute handler
0xmovses Aug 22, 2023
a938ec1
update names update state
0xmovses Aug 23, 2023
820eaeb
update handlers
0xmovses Aug 23, 2023
c511e32
add vote handler logic
0xmovses Aug 23, 2023
58ba5ef
fix handler compiler errors
0xmovses Aug 23, 2023
a34af41
Merge branch 'main' into 0xmovses/abs-166
0xmovses Aug 24, 2023
0cd6d9c
refactor, cleanup
0xmovses Aug 24, 2023
bf9d63b
update execute msg, more refactors
0xmovses Aug 24, 2023
7ddc6d6
create wasm test update toml
0xmovses Aug 24, 2023
c392981
create wasm test and setup for e2e
0xmovses Aug 24, 2023
4ebf3e0
Merge branch 'main' into 0xmovses/abs-166
0xmovses Aug 28, 2023
cdd2bde
create integration tests
0xmovses Aug 28, 2023
33662d7
add more tests
0xmovses Aug 28, 2023
8455147
add friend test cases
0xmovses Aug 29, 2023
0761101
add vote cases
0xmovses Aug 29, 2023
56f232b
updates
0xmovses Aug 29, 2023
bc02d4b
integrate adairrr feedback
0xmovses Aug 29, 2023
80c0057
update charge_penalty logic
0xmovses Aug 29, 2023
fa3912b
rebuilt wasms
0xmovses Aug 29, 2023
2302041
fix merge conflict
0xmovses Aug 29, 2023
485f696
rebuilt wasms
0xmovses Aug 30, 2023
0749614
fix tests and cleanup
0xmovses Aug 30, 2023
a109ada
clippy
0xmovses Aug 30, 2023
7f67ea4
integrate PR feedback
0xmovses Aug 31, 2023
23995ff
add impl methods on Vote and Friend
0xmovses Aug 31, 2023
0c2902d
update tests
0xmovses Aug 31, 2023
d97f69a
fix tests, refactor, cleanup
0xmovses Aug 31, 2023
29ba36a
integrate Buckram feedback
0xmovses Aug 31, 2023
1ccc033
add admin strike functionality and add challenge status
0xmovses Sep 1, 2023
668482f
update charge_penalty logic
0xmovses Sep 1, 2023
747ba8b
fix failing tests
0xmovses Sep 4, 2023
8159030
fix flaxy test, add remainder attribute
0xmovses Sep 4, 2023
c1ee4f9
merge main
0xmovses Sep 4, 2023
665ee6e
update to Timestamp use EndKind enum for user input
0xmovses Sep 4, 2023
faf7d92
add Timestamp to Checkin and vote_status
0xmovses Sep 4, 2023
a82034f
update contract logic
0xmovses Sep 4, 2023
f972ac5
remodel state, fix new ownership errors
0xmovses Sep 5, 2023
47fc6ff
update charge penalty math and state
0xmovses Sep 5, 2023
fa1b70a
fix tests intergrate feedback
0xmovses Sep 5, 2023
586ad1d
Merge branch 'main' into 0xmovses/abs-166
0xmovses Sep 5, 2023
78bfb14
update composite key and field names
0xmovses Sep 5, 2023
bea1879
update test after composite keys change
0xmovses Sep 5, 2023
b0b96ad
remove redundant
0xmovses Sep 5, 2023
667b32a
update comments
0xmovses Sep 5, 2023
4e5416f
update responses
0xmovses Sep 6, 2023
2038c82
add transfer msg
0xmovses Sep 6, 2023
9551a41
clippy
0xmovses Sep 6, 2023
33eb190
clippy more
0xmovses Sep 6, 2023
9be126f
run release_build
0xmovses Sep 6, 2023
0d4be6e
Update modules/contracts/apps/challenge/src/handlers/execute.rs
0xmovses Sep 6, 2023
a2df780
Update modules/contracts/apps/challenge/src/handlers/execute.rs
0xmovses Sep 6, 2023
022645f
integrate buckram feedback
0xmovses Sep 6, 2023
258e3a7
integrate Buckram feedback
0xmovses Sep 7, 2023
5aaacea
Merge branch 'main' into 0xmovses/abs-166
0xmovses Sep 7, 2023
6f763b5
generate schema
0xmovses Sep 7, 2023
e7c5a39
Merge branch 'main' into 0xmovses/abs-166
0xmovses Sep 7, 2023
58231c1
bump osmosis-test-tube
0xmovses Sep 7, 2023
b373994
Merge branch '0xmovses/abs-166' of https://github.com/AbstractSDK/abs…
0xmovses Sep 7, 2023
16977e7
Merge branch 'main' into 0xmovses/abs-166
0xmovses Sep 7, 2023
c1347ff
integrate buckram123 feedback
0xmovses Sep 7, 2023
a396d06
Merge branch '0xmovses/abs-166' of https://github.com/AbstractSDK/abs…
0xmovses Sep 7, 2023
a3568ae
merge main
0xmovses Sep 7, 2023
5f17a3b
Merge branch 'main' into 0xmovses/abs-166
0xmovses Sep 9, 2023
4133407
bump chrono
0xmovses Sep 9, 2023
00daa8a
bump chrono again
0xmovses Sep 9, 2023
05910db
chrono to 0.4.23
0xmovses Sep 9, 2023
2c7a03b
chrono to 0.4.27
0xmovses Sep 11, 2023
eee9c73
merge main
0xmovses Sep 11, 2023
7060482
chrono to 0.4.23
0xmovses Sep 11, 2023
5d26c7e
croncat version bump
Buckram123 Sep 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app-template/artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c2ea249ee0244d88defe24e09de2ba63f829614cb8866e7d74c9daa2ede7f4d2 app.wasm
4e4b097907a9eb0a31d4757f73ba741ca4452e1b9f632a4500cc1dfbeba01f4d app-aarch64.wasm
2 changes: 1 addition & 1 deletion app-template/artifacts/checksums_intermediate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9a0d0614b1b6ddc9707739b30ab330ff65c6f244fdfd3893c6f7fca5b471b0e8 ./target/wasm32-unknown-unknown/release/app.wasm
6a3347162d4e89d6aebafd8c7cbd40c686d8161e4b68797b39e1ca49bb4cfb49 ./target/wasm32-unknown-unknown/release/app.wasm
58 changes: 58 additions & 0 deletions integrations/osmosis/tests/osmosis-std-cosmwasm-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[package]
authors = ["Supanat Potiwarakorn <[email protected]>"]
edition = "2021"
name = "osmosis-std-cosmwasm-test"
version = "0.1.0"

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
codegen-units = 1
debug = false
debug-assertions = false
incremental = false
lto = true
opt-level = 3
overflow-checks = true
panic = 'abort'
rpath = false

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[package.metadata.scripts]
optimize = """docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.6
"""

[dependencies]
cosmwasm-schema = "1.1.2"
cosmwasm-std = "1.1.2"
cosmwasm-storage = "1.1.2"
cw-storage-plus = "0.15"
cw2 = "0.13.2"
jsonformat = "2.0.0"
osmosis-std = { path = "../../packages/osmosis-std" }
schemars = "0.8.8"
serde = { version = "1.0.137", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.31" }

[dev-dependencies]
cw-multi-test = "0.13.2"
prost = "0.11.0"
serde_json = "1.0.85"
osmosis-test-tube = "19.0.0"
1 change: 1 addition & 0 deletions modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ serde = { version = "1.0", default-features = false, features = ["derive"] }
thiserror = { version = "1.0" }
protobuf = { version = "2", features = ["with-bytes"] }

chrono = { version = "0.4.23", default-features = false }
clap = { version = "4.0.32", features = ["derive"] }
semver = "1.0"
cw-semver = { version = "1.0" }
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added modules/artifacts/abstract_dca_app-aarch64.wasm
Binary file not shown.
Binary file not shown.
Binary file added modules/artifacts/abstract_etf-aarch64.wasm
Binary file not shown.
Binary file not shown.
14 changes: 8 additions & 6 deletions modules/artifacts/checksums_intermediate.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
4ac9807ef85cb49b1833806702b5195e65744af76db8b490e8acbb5d0c63a728 target/wasm32-unknown-unknown/release/abstract_cw_staking.wasm
80166da60c09fe9cad73f18870a0b4675523b34a41a5833433a56e31c21f2d40 target/wasm32-unknown-unknown/release/abstract_dca_app.wasm
9be0995a2dbff62f0101189362f85a25dec45ddfbc417c9d93545dc98cfa9b07 target/wasm32-unknown-unknown/release/abstract_dex_adapter.wasm
04f8e8894190e762e98d80309650b0df8ccbcce1d655f2e03215b0622ee7f9ba target/wasm32-unknown-unknown/release/abstract_etf.wasm
3290043a8be44d63b5abc9b86231f8a0b98bd82286cf24bbbf1f9bcf717c3fbc target/wasm32-unknown-unknown/release/abstract_tendermint_staking_adapter.wasm
f4407c14b82dd969f93471bb43e4000fa9697c200ff0dca923a56c69cbd22357 target/wasm32-unknown-unknown/release/croncat_app.wasm
f6ff4989cbc6aac3d5ada6ebe6c4ea00d7bd1b2b889506d0f3cfba6c35d2fd7b target/wasm32-unknown-unknown/release/abstract_challenge_app.wasm
049aaf16853b1bb40841360d9f4763326cd338880dadbf7179d9b3fee073f3a8 target/wasm32-unknown-unknown/release/abstract_cw_staking.wasm
1e964735ea5b06b2040b258ee3d2d3c0b2f82ffaa2a3e4765c4ddfcdb66faaae target/wasm32-unknown-unknown/release/abstract_dca_app.wasm
3d16149cc183f6d75e8c665d5f9a9f2d32ed10beec54627db60f613845fa6e4c target/wasm32-unknown-unknown/release/abstract_dex_adapter.wasm
b0ab08be4104af9d09d812aed56ac24b3f197e5e2f9aec702e9bd61f0c75fedc target/wasm32-unknown-unknown/release/abstract_etf.wasm
81d2a2090c5baca4c8054f893742426377d2528c614350a65efeeea7394aedb3 target/wasm32-unknown-unknown/release/abstract_tendermint_staking_adapter.wasm
d2204708c0925b41ef75f5744cec3bf2e02793107b95b02fe398344c4dd18503 target/wasm32-unknown-unknown/release/croncat_app.wasm

Binary file added modules/artifacts/croncat_app-aarch64.wasm
Binary file not shown.
78 changes: 78 additions & 0 deletions modules/contracts/apps/challenge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[package]
name = "abstract-challenge-app"
version = "0.0.1"
authors = [
"CyberHoward <[email protected]>",
"Adair <[email protected]>",
"Abstract Money <[email protected]>",
"0xmovses <[email protected]>",
]
edition = "2021"
homepage = ""
documentation = ""
repository = ""
license = "GPL-3.0-or-later"
keywords = ["cosmos", "cosmwasm", "abstractsdk"]
resolver = "2"

exclude = ["contract.wasm", "hash.txt"]

[lib]
crate-type = ["cdylib", "rlib"]

[[example]]
name = "schema"
required-features = ["schema"]

[features]
default = ["export"]
export = []
# enable node-backed tests (ensure Docker is running)
# run with `cargo test --jobs 1 --features node-tests`
node-tests = ["interface"]
interface = ["export", "dep:abstract-interface", "dep:cw-orch"]
schema = ["abstract-app/schema"]

[dependencies]
cosmwasm-std = { workspace = true }
cosmwasm-schema = { workspace = true }
cw-address-like = { workspace = true }
cw-controllers = { workspace = true }
cw-storage-plus = { workspace = true }
thiserror = { workspace = true }
schemars = { workspace = true }
cw-asset = { workspace = true }
cw-utils = { workspace = true }

abstract-core = { workspace = true }
abstract-app = { workspace = true }
abstract-sdk = { workspace = true }

chrono = { workspace = true, default-features = false }

# Dependencies for interface
abstract-interface = { workspace = true, optional = true }
cw-orch = { workspace = true, optional = true }
croncat-app = { workspace = true, default-features = false }
abstract-dex-adapter = { workspace = true, default-features = false }

[dev-dependencies]
abstract-challenge-app = { path = ".", features = ["interface"] }
abstract-interface = { workspace = true, features = ["daemon"] }
abstract-testing = { workspace = true }
abstract-sdk = { workspace = true, features = ["test-utils"] }
speculoos = "0.11.0"
semver = "1.0"
dotenv = "0.15.0"
env_logger = "0.10.0"
cw-orch = { workspace = true, features = ["daemon"] }
lazy_static = "1.4.0"

croncat-integration-testing = { version = "1.1.1", git = "https://github.com/CronCats/cw-croncat", branch = "unlocked-schedule" }
wyndex-bundle = { workspace = true }
abstract-dex-adapter = { workspace = true, features = [
"interface",
"juno",
"testing",
] }
croncat-app = { workspace = true, features = ["interface"] }
Empty file.
28 changes: 28 additions & 0 deletions modules/contracts/apps/challenge/examples/deploy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use cw_orch::{
anyhow,
prelude::{networks::parse_network, DaemonBuilder},
tokio::runtime::Runtime,
};

use abstract_challenge_app::{contract::CHALLENGE_APP_ID, ChallengeApp};
use abstract_interface::AppDeployer;
use semver::Version;

const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

fn main() -> anyhow::Result<()> {
0xmovses marked this conversation as resolved.
Show resolved Hide resolved
dotenv().ok();
env_logger::init();
let chain = parse_network("uni-6");
0xmovses marked this conversation as resolved.
Show resolved Hide resolved
use dotenv::dotenv;
let version: Version = CONTRACT_VERSION.parse().unwrap();
let rt = Runtime::new()?;
let chain = DaemonBuilder::default()
.chain(chain)
.handle(rt.handle())
.build()?;
let app = ChallengeApp::new(CHALLENGE_APP_ID, chain);

app.deploy(version)?;
Ok(())
}
14 changes: 14 additions & 0 deletions modules/contracts/apps/challenge/examples/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use abstract_challenge_app::contract::ChallengeApp as App;
use cosmwasm_schema::remove_schemas;
use std::env::current_dir;
use std::fs::create_dir_all;

fn main() {
let mut out_dir = current_dir().unwrap();
out_dir.push("schema");
create_dir_all(&out_dir).unwrap();
remove_schemas(&out_dir).unwrap();

#[cfg(feature = "schema")]
App::export_schema(&out_dir);
}
110 changes: 110 additions & 0 deletions modules/contracts/apps/challenge/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Install the tools that are used in this justfile
install-tools:
cargo install cargo-nextest --locked
cargo install taplo-cli --locked
cargo install cargo-watch
cargo install cargo-limit

# Build everything
build:
cargo build --all-features

# Test everything
test:
cargo nextest run

watch-test:
cargo watch -x "nextest run"

# Format your code and `Cargo.toml` files
fmt:
cargo fmt --all
find . -type f -iname "*.toml" -print0 | xargs -0 taplo format

lint:
cargo clippy --all -- -D warnings

lintfix:
cargo clippy --fix --allow-staged --allow-dirty --all-features
just fmt

watch:
cargo watch -x "lcheck --all-features"

check:
cargo check --all-features

deploy:
cargo run --example deploy --features

wasm:
#!/usr/bin/env bash

# Delete all the current wasms first
rm -rf ./artifacts/*.wasm

if [[ $(arch) == "arm64" ]]; then
image="cosmwasm/rust-optimizer-arm64"
else
image="cosmwasm/rust-optimizer"
fi

# Optimized builds
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
${image}:0.12.13

# Generate the schemas for the app contract
schema:
cargo schema

# Generate the typescript client for the app contract
ts-codegen: schema
(cd typescript && npm run codegen)

# Publish the typescript sdk
ts-publish: ts-codegen
(cd typescript && npm publish --access public)

# Generate the schemas for this app and publish them to the schemas repository for access in the Abstract frontend
publish-schemas namespace name version: schema
#!/usr/bin/env bash
set -euxo pipefail

# Pre-run check for 'gh' CLI tool
if ! command -v gh &> /dev/null; then \
echo "'gh' could not be found. Please install GitHub CLI."; exit; \
fi

# check that the metadata exists
if [ ! -e "./metadata.json" ]; then \
echo "Please create metadata.json for module metadata"; exit; \
fi

tmp_dir="$(mktemp -d)"
schema_out_dir="$tmp_dir/{{namespace}}/{{name}}/{{version}}"
metadata_out_dir="$tmp_dir/{{namespace}}/{{name}}"

# Clone the repository to the temporary directory
git clone https://github.com/AbstractSDK/schemas "$tmp_dir"

# Create target directory structure and copy schemas
mkdir -p "$schema_out_dir"
cp -a "./schema/." "$schema_out_dir"

# Copy metadata.json to the target directory
cp "./metadata.json" "$metadata_out_dir"

# Create a new branch with a name based on the inputs
cd "$tmp_dir"
git checkout -b '{{namespace}}/{{name}}/{{version}}'

# Stage all new and changed files for commit
git add .

# Commit the changes with a message
git commit -m 'Add schemas for {{namespace}} {{name}} {{version}}'

# Create a pull request using 'gh' CLI tool
gh pr create --title 'Add schemas for {{namespace}} {{name}} {{version}}' --body ""
9 changes: 9 additions & 0 deletions modules/contracts/apps/challenge/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Challenge",
"description": "Create personal challenges and invite your friends to hold yourself accountable",
"website": "https://abstract.money/",
"docs": "",
"type": "app",
"icon": "RiCoinsLine",
"enabled": false
}
Loading