Skip to content

Commit

Permalink
add schemas; bump deps and minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
epanchee committed Sep 24, 2024
1 parent e5eba8b commit c44fb83
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 11 deletions.
2 changes: 1 addition & 1 deletion contracts/emissions_controller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cw-storage-plus.workspace = true
cosmwasm-schema.workspace = true
thiserror.workspace = true
itertools.workspace = true
astroport-governance = { path = "../../packages/astroport-governance", version = "4.0.0" }
astroport-governance = { path = "../../packages/astroport-governance", version = "4.2" }
astroport.workspace = true
neutron-sdk = "0.10.0"
serde_json = "1"
Expand Down
2 changes: 1 addition & 1 deletion contracts/emissions_controller/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn is_outpost_valid(

let escrow_balance = deps
.querier
.query_balance(&escrow_address, &xastro_denom)?
.query_balance(escrow_address, xastro_denom)?
.amount;

match ibc_msg {
Expand Down
2 changes: 1 addition & 1 deletion contracts/emissions_controller/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use astroport_governance::emissions_controller::hub::{
};
use astroport_governance::utils::determine_ics20_escrow_address;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{entry_point, Addr, DepsMut, Empty, Env, Order, Response, StdResult};
use cosmwasm_std::{entry_point, DepsMut, Empty, Env, Order, Response, StdResult};
use cw2::{get_contract_version, set_contract_version};
use cw_storage_plus::Map;

Expand Down
2 changes: 1 addition & 1 deletion contracts/emissions_controller_outpost/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cw-storage-plus.workspace = true
cosmwasm-schema.workspace = true
thiserror.workspace = true
itertools.workspace = true
astroport-governance = { path = "../../packages/astroport-governance", version = "4.0.0" }
astroport-governance = { path = "../../packages/astroport-governance", version = "4.2" }
astroport.workspace = true
serde_json = "1"

Expand Down
7 changes: 5 additions & 2 deletions contracts/emissions_controller_outpost/src/migration.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use cosmwasm_std::{entry_point, DepsMut, Empty, Env, Response};
#![cfg(not(tarpaulin_include))]

use cosmwasm_std::{DepsMut, Empty, Env, Response};
use cw2::{get_contract_version, set_contract_version};

use crate::error::ContractError;
use crate::instantiate::{CONTRACT_NAME, CONTRACT_VERSION};

#[cfg_attr(not(feature = "library"), entry_point)]
#[allow(dead_code)]
#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)]
pub fn migrate(deps: DepsMut, _env: Env, _msg: Empty) -> Result<Response, ContractError> {
let contract_version = get_contract_version(deps.storage)?;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"contract_name": "astroport-emissions-controller-outpost",
"contract_version": "1.0.0",
"contract_version": "1.1.0",
"idl_version": "1.0.0",
"instantiate": {
"$schema": "http://json-schema.org/draft-07/schema#",
Expand Down Expand Up @@ -881,11 +881,20 @@
"emissions_vote": {
"type": "object",
"required": [
"total_voting_power",
"voter",
"votes",
"voting_power"
],
"properties": {
"total_voting_power": {
"description": "Current total voting power on this outpost",
"allOf": [
{
"$ref": "#/definitions/Uint128"
}
]
},
"voter": {
"type": "string"
},
Expand Down Expand Up @@ -921,6 +930,7 @@
"type": "object",
"required": [
"is_unlock",
"total_voting_power",
"voter",
"voting_power"
],
Expand All @@ -929,6 +939,14 @@
"description": "Marker defines whether this packet was sent from vxASTRO unlock context",
"type": "boolean"
},
"total_voting_power": {
"description": "Current total voting power on this outpost",
"allOf": [
{
"$ref": "#/definitions/Uint128"
}
]
},
"voter": {
"type": "string"
},
Expand Down Expand Up @@ -987,6 +1005,7 @@
"type": "object",
"required": [
"proposal_id",
"total_voting_power",
"vote",
"voter",
"voting_power"
Expand All @@ -998,6 +1017,14 @@
"format": "uint64",
"minimum": 0.0
},
"total_voting_power": {
"description": "Current total voting power on this outpost",
"allOf": [
{
"$ref": "#/definitions/Uint128"
}
]
},
"vote": {
"description": "Vote option",
"allOf": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,20 @@
"emissions_vote": {
"type": "object",
"required": [
"total_voting_power",
"voter",
"votes",
"voting_power"
],
"properties": {
"total_voting_power": {
"description": "Current total voting power on this outpost",
"allOf": [
{
"$ref": "#/definitions/Uint128"
}
]
},
"voter": {
"type": "string"
},
Expand Down Expand Up @@ -113,6 +122,7 @@
"type": "object",
"required": [
"is_unlock",
"total_voting_power",
"voter",
"voting_power"
],
Expand All @@ -121,6 +131,14 @@
"description": "Marker defines whether this packet was sent from vxASTRO unlock context",
"type": "boolean"
},
"total_voting_power": {
"description": "Current total voting power on this outpost",
"allOf": [
{
"$ref": "#/definitions/Uint128"
}
]
},
"voter": {
"type": "string"
},
Expand Down Expand Up @@ -179,6 +197,7 @@
"type": "object",
"required": [
"proposal_id",
"total_voting_power",
"vote",
"voter",
"voting_power"
Expand All @@ -190,6 +209,14 @@
"format": "uint64",
"minimum": 0.0
},
"total_voting_power": {
"description": "Current total voting power on this outpost",
"allOf": [
{
"$ref": "#/definitions/Uint128"
}
]
},
"vote": {
"description": "Vote option",
"allOf": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@
"description": "Outpost params contain all necessary information to interact with the remote outpost. This field also serves as marker whether it is The hub (params: None) or remote outpost (Some(params))",
"anyOf": [
{
"$ref": "#/definitions/OutpostParams"
"$ref": "#/definitions/InputOutpostParams"
},
{
"type": "null"
Expand Down Expand Up @@ -676,7 +676,7 @@
}
]
},
"OutpostParams": {
"InputOutpostParams": {
"type": "object",
"required": [
"emissions_controller",
Expand Down Expand Up @@ -1075,6 +1075,10 @@
"minItems": 2
},
"definitions": {
"Addr": {
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
},
"AstroPoolConfig": {
"description": "Each outpost may have one pool that receives flat ASTRO emissions. This pools doesn't participate in the voting process.",
"type": "object",
Expand Down Expand Up @@ -1142,6 +1146,7 @@
"type": "object",
"required": [
"emissions_controller",
"escrow_address",
"ics20_channel",
"voting_channel"
],
Expand All @@ -1150,6 +1155,14 @@
"description": "Emissions controller on a given outpost",
"type": "string"
},
"escrow_address": {
"description": "ICS20 transfer escrow address on Neutron. Calculated automatically based on channel id",
"allOf": [
{
"$ref": "#/definitions/Addr"
}
]
},
"ics20_channel": {
"description": "General IBC channel for fungible token transfers",
"type": "string"
Expand Down
4 changes: 2 additions & 2 deletions schemas/astroport-emissions-controller/raw/execute.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
"description": "Outpost params contain all necessary information to interact with the remote outpost. This field also serves as marker whether it is The hub (params: None) or remote outpost (Some(params))",
"anyOf": [
{
"$ref": "#/definitions/OutpostParams"
"$ref": "#/definitions/InputOutpostParams"
},
{
"type": "null"
Expand Down Expand Up @@ -424,7 +424,7 @@
}
]
},
"OutpostParams": {
"InputOutpostParams": {
"type": "object",
"required": [
"emissions_controller",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"minItems": 2
},
"definitions": {
"Addr": {
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
},
"AstroPoolConfig": {
"description": "Each outpost may have one pool that receives flat ASTRO emissions. This pools doesn't participate in the voting process.",
"type": "object",
Expand Down Expand Up @@ -83,6 +87,7 @@
"type": "object",
"required": [
"emissions_controller",
"escrow_address",
"ics20_channel",
"voting_channel"
],
Expand All @@ -91,6 +96,14 @@
"description": "Emissions controller on a given outpost",
"type": "string"
},
"escrow_address": {
"description": "ICS20 transfer escrow address on Neutron. Calculated automatically based on channel id",
"allOf": [
{
"$ref": "#/definitions/Addr"
}
]
},
"ics20_channel": {
"description": "General IBC channel for fungible token transfers",
"type": "string"
Expand Down

0 comments on commit c44fb83

Please sign in to comment.