-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(#151): publish nibiru-ownable, resolve linter errors, and add G…
…H automation
- Loading branch information
Showing
26 changed files
with
1,759 additions
and
39 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,3 @@ | ||
# Adds the "S-triage" label ot any issue that gets opened. | ||
S-triage: | ||
- '/.*/' |
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 @@ | ||
name: "Auto-add GH issues to project" | ||
# Add all issues opened to the issue board for triage and assignment | ||
# GitHub Org and Project Automation | ||
# https://www.notion.so/nibiru/GitHub-Org-and-Project-Automation-c771d671109849ee9fda7c8b741cd66a?pvs=4 | ||
|
||
on: | ||
issues: | ||
types: ["opened", "labeled"] | ||
|
||
permissions: | ||
issues: write | ||
contents: read | ||
|
||
jobs: | ||
# https://github.com/actions/add-to-project | ||
add-to-project: | ||
name: "Add GH ticket to project" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
project-url: https://github.com/orgs/NibiruChain/projects/8 | ||
github-token: ${{ secrets.NIBIRU_PM }} | ||
|
||
label-triage: | ||
name: "Add GH ticket to project" | ||
runs-on: ubuntu-latest | ||
# The action comes from the "Activty types" for the "issues" webhook event | ||
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#issues | ||
if: "github.event.action == 'opened'" | ||
steps: | ||
- uses: github/[email protected] | ||
if: join(github.event.issue.labels) == '' | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" | ||
configuration-path: ".github/issue-labeler-config.yml" | ||
enable-versioned-regex: 0 | ||
not-before: "2024-05-01T00:00:00Z" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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,6 @@ | ||
[alias] | ||
wasm = "build --release --lib --target wasm32-unknown-unknown" | ||
wasm-debug = "build --lib --target wasm32-unknown-unknown" | ||
unit-test = "test --lib" | ||
integration-test = "test --test integration" | ||
schema = "run --bin schema" |
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,34 @@ | ||
[package] | ||
name = "cw3-fixed-multisig" | ||
version = "2.0.1" # Should match contracts/core-cw3-flex-msig | ||
authors = ["Ethan Frey <[email protected]>"] | ||
edition = "2021" | ||
description = "Implementing cw3 with an fixed group multisig" | ||
license = "Apache-2.0" | ||
repository = "https://github.com/NibiruChain/cw-nibiru" | ||
homepage = "https://cosmwasm.com" | ||
documentation = "https://docs.cosmwasm.com" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[features] | ||
# use library feature to disable all instantiate/execute/query exports | ||
library = [] | ||
|
||
[dependencies] | ||
cosmwasm-schema = { workspace = true } | ||
cw-utils = { workspace = true } | ||
cw2 = { workspace = true } | ||
cw3 = { workspace = true } | ||
cw-storage-plus = { workspace = true } | ||
cosmwasm-std = { workspace = true } | ||
schemars = { workspace = true } | ||
serde = { workspace = true } | ||
thiserror = { workspace = true } | ||
|
||
[dev-dependencies] | ||
cw20 = { workspace = true } | ||
cw20-base = { workspace = true } | ||
cw-multi-test = { workspace = true } | ||
easy-addr = { workspace = true } |
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,65 @@ | ||
# CW3 Fixed Multisig | ||
|
||
This is a simple implementation of the [cw3 spec](../../packages/cw3/README.md). | ||
It is a multisig with a fixed set of addresses created upon instatiation. | ||
Each address may have the same weight (K of N), or some may have extra voting | ||
power. This works much like the native Cosmos SDK multisig, except that rather | ||
than aggregating the signatures off chain and submitting the final result, | ||
we aggregate the approvals on-chain. | ||
|
||
This is usable as is, and probably the most secure implementation of cw3 | ||
(as it is the simplest), but we will be adding more complex cases, such | ||
as updating the multisig set, different voting rules for the same group | ||
with different permissions, and even allow token-weighted voting. All through | ||
the same client interface. | ||
|
||
## Instantiation | ||
|
||
To create the multisig, you must pass in a set of `HumanAddr` with a weight | ||
for each one, as well as a required weight to pass a proposal. To create | ||
a 2 of 3 multisig, pass 3 voters with weight 1 and a `required_weight` of 2. | ||
|
||
Note that 0 *is an allowed weight*. This doesn't give any voting rights, but | ||
it does allow that key to submit proposals that can later be approved by the | ||
voters. Any address not in the voter set cannot submit a proposal. | ||
|
||
## Execution Process | ||
|
||
First, a registered voter must submit a proposal. This also includes the | ||
first "Yes" vote on the proposal by the proposer. The proposer can set | ||
an expiration time for the voting process, or it defaults to the limit | ||
provided when creating the contract (so proposals can be closed after several | ||
days). | ||
|
||
Before the proposal has expired, any voter with non-zero weight can add their | ||
vote. Only "Yes" votes are tallied. If enough "Yes" votes were submitted before | ||
the proposal expiration date, the status is set to "Passed". | ||
|
||
Once a proposal is "Passed", anyone may submit an "Execute" message. This will | ||
trigger the proposal to send all stored messages from the proposal and update | ||
it's state to "Executed", so it cannot run again. (Note if the execution fails | ||
for any reason - out of gas, insufficient funds, etc - the state update will | ||
be reverted, and it will remain "Passed", so you can try again). | ||
|
||
Once a proposal has expired without passing, anyone can submit a "Close" | ||
message to mark it closed. This has no effect beyond cleaning up the UI/database. | ||
|
||
## Running this contract | ||
|
||
You will need Rust 1.44.1+ with `wasm32-unknown-unknown` target installed. | ||
|
||
You can run unit tests on this via: | ||
|
||
`cargo test` | ||
|
||
Once you are happy with the content, you can compile it to wasm via: | ||
|
||
``` | ||
RUSTFLAGS='-C link-arg=-s' cargo wasm | ||
cp ../../target/wasm32-unknown-unknown/release/cw3_fixed_multisig.wasm . | ||
ls -l cw3_fixed_multisig.wasm | ||
sha256sum cw3_fixed_multisig.wasm | ||
``` | ||
|
||
Or for a production-ready (optimized) build, run a build command in the | ||
repository root: https://github.com/CosmWasm/cw-plus#compiling. |
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 @@ | ||
use cosmwasm_schema::write_api; | ||
|
||
use cw3_fixed_multisig::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; | ||
|
||
fn main() { | ||
write_api! { | ||
instantiate: InstantiateMsg, | ||
execute: ExecuteMsg, | ||
query: QueryMsg, | ||
} | ||
} |
Oops, something went wrong.