-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new mirror_admin_manager contract * integrate admin_manager with governance, multiple poll types with different parameters * add the hability to change the mir-ust pair on collector * add collector migration logic * feat: ability to deprecate a staking token * add migration loogic for staking pool_infos * feat: integrate collateral_oracle with new tefi_oracle * fix test and typos, closes #77 * feat: integrate mint contract with new oracle and preIPO mech * feat: update mAsset whitelisting process to use new oracle and preIPO mech * chore: update admin_manager schema * chore: fmt and clippy * chore: fmt, clippy and generate schemas * fix(col_oracle): change is_revoked migration to consider rewly revoked assets * fix(col_oracle): add missing migrate_config funtion to migration entry point * fix(gov): minor fixes * make gov update_config an admin action * chore: fmt & clippy fixes * fix typos * gov: add poll_gas_limit parameter to prevent ghost failed polls * gov: add unit tests for new poll configs * migrate MIR-UST pair on contract migration (collector, staking) + add friendlier staking error for deprecated token * fix: modify bond migration check to have new addresses marked as migrated
- Loading branch information
Showing
107 changed files
with
5,104 additions
and
1,266 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,6 @@ | ||
[alias] | ||
wasm = "build --release --target wasm32-unknown-unknown" | ||
wasm-debug = "build --target wasm32-unknown-unknown" | ||
unit-test = "test --lib" | ||
integration-test = "test --test integration" | ||
schema = "run --example 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,47 @@ | ||
[package] | ||
name = "mirror-admin-manager" | ||
version = "2.1.1" | ||
authors = ["Terraform Labs, PTE."] | ||
edition = "2018" | ||
description = "Admin manager contract for Mirror Protocol - holds and manages admin privileges for Mirror contracts" | ||
license = "Apache-2.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] | ||
opt-level = 3 | ||
debug = false | ||
rpath = false | ||
lto = true | ||
debug-assertions = false | ||
codegen-units = 1 | ||
panic = 'abort' | ||
incremental = false | ||
overflow-checks = true | ||
|
||
[features] | ||
# for quicker tests, cargo test --lib | ||
# for more explicit tests, cargo test --features=backtraces | ||
backtraces = ["cosmwasm-std/backtraces"] | ||
|
||
[dependencies] | ||
cw20 = { version = "0.8.0" } | ||
cosmwasm-std = { version = "0.16.0", features = ["iterator"] } | ||
cosmwasm-storage = { version = "0.16.0", features = ["iterator"] } | ||
mirror-protocol = { version = "2.1.1", path = "../../packages/mirror_protocol" } | ||
schemars = "0.8.1" | ||
serde = { version = "1.0.103", default-features = false, features = ["derive"] } | ||
cw-storage-plus = { version = "0.8.0", features = ["iterator"]} | ||
thiserror = { version = "1.0.20" } | ||
|
||
[dev-dependencies] | ||
cosmwasm-schema = "0.16.0" |
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 @@ | ||
# Mirror Admin Manager <!-- omit in toc --> |
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,23 @@ | ||
use std::env::current_dir; | ||
use std::fs::create_dir_all; | ||
|
||
use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; | ||
|
||
use mirror_protocol::admin_manager::{ | ||
AuthRecordResponse, ConfigResponse, ExecuteMsg, InstantiateMsg, MigrationRecordResponse, | ||
QueryMsg, | ||
}; | ||
|
||
fn main() { | ||
let mut out_dir = current_dir().unwrap(); | ||
out_dir.push("schema"); | ||
create_dir_all(&out_dir).unwrap(); | ||
remove_schemas(&out_dir).unwrap(); | ||
|
||
export_schema(&schema_for!(InstantiateMsg), &out_dir); | ||
export_schema(&schema_for!(ExecuteMsg), &out_dir); | ||
export_schema(&schema_for!(QueryMsg), &out_dir); | ||
export_schema(&schema_for!(ConfigResponse), &out_dir); | ||
export_schema(&schema_for!(AuthRecordResponse), &out_dir); | ||
export_schema(&schema_for!(MigrationRecordResponse), &out_dir); | ||
} |
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,15 @@ | ||
# stable | ||
newline_style = "unix" | ||
hard_tabs = false | ||
tab_spaces = 4 | ||
|
||
# unstable... should we require `rustup run nightly cargo fmt` ? | ||
# or just update the style guide when they are stable? | ||
#fn_single_line = true | ||
#format_code_in_doc_comments = true | ||
#overflow_delimited_expr = true | ||
#reorder_impl_items = true | ||
#struct_field_align_threshold = 20 | ||
#struct_lit_single_line = true | ||
#report_todo = "Always" | ||
|
25 changes: 25 additions & 0 deletions
25
contracts/mirror_admin_manager/schema/auth_record_response.json
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,25 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "AuthRecordResponse", | ||
"type": "object", | ||
"required": [ | ||
"address", | ||
"end_time", | ||
"start_time" | ||
], | ||
"properties": { | ||
"address": { | ||
"type": "string" | ||
}, | ||
"end_time": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
}, | ||
"start_time": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
contracts/mirror_admin_manager/schema/config_response.json
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,19 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "ConfigResponse", | ||
"type": "object", | ||
"required": [ | ||
"admin_claim_period", | ||
"owner" | ||
], | ||
"properties": { | ||
"admin_claim_period": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
}, | ||
"owner": { | ||
"type": "string" | ||
} | ||
} | ||
} |
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,110 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "ExecuteMsg", | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"update_owner" | ||
], | ||
"properties": { | ||
"update_owner": { | ||
"type": "object", | ||
"required": [ | ||
"owner" | ||
], | ||
"properties": { | ||
"owner": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"execute_migrations" | ||
], | ||
"properties": { | ||
"execute_migrations": { | ||
"type": "object", | ||
"required": [ | ||
"migrations" | ||
], | ||
"properties": { | ||
"migrations": { | ||
"type": "array", | ||
"items": { | ||
"type": "array", | ||
"items": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
}, | ||
{ | ||
"$ref": "#/definitions/Binary" | ||
} | ||
], | ||
"maxItems": 3, | ||
"minItems": 3 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"authorize_claim" | ||
], | ||
"properties": { | ||
"authorize_claim": { | ||
"type": "object", | ||
"required": [ | ||
"authorized_addr" | ||
], | ||
"properties": { | ||
"authorized_addr": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"claim_admin" | ||
], | ||
"properties": { | ||
"claim_admin": { | ||
"type": "object", | ||
"required": [ | ||
"contract" | ||
], | ||
"properties": { | ||
"contract": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
], | ||
"definitions": { | ||
"Binary": { | ||
"description": "Binary is a wrapper around Vec<u8> to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec<u8>", | ||
"type": "string" | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
contracts/mirror_admin_manager/schema/instantiate_msg.json
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,19 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "InstantiateMsg", | ||
"type": "object", | ||
"required": [ | ||
"admin_claim_period", | ||
"owner" | ||
], | ||
"properties": { | ||
"admin_claim_period": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
}, | ||
"owner": { | ||
"type": "string" | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
contracts/mirror_admin_manager/schema/migration_record_response.json
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,53 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "MigrationRecordResponse", | ||
"type": "object", | ||
"required": [ | ||
"executor", | ||
"migrations", | ||
"time" | ||
], | ||
"properties": { | ||
"executor": { | ||
"type": "string" | ||
}, | ||
"migrations": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/MigrationItem" | ||
} | ||
}, | ||
"time": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
} | ||
}, | ||
"definitions": { | ||
"Binary": { | ||
"description": "Binary is a wrapper around Vec<u8> to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec<u8>", | ||
"type": "string" | ||
}, | ||
"MigrationItem": { | ||
"type": "object", | ||
"required": [ | ||
"contract", | ||
"msg", | ||
"new_code_id" | ||
], | ||
"properties": { | ||
"contract": { | ||
"type": "string" | ||
}, | ||
"msg": { | ||
"$ref": "#/definitions/Binary" | ||
}, | ||
"new_code_id": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.