diff --git a/Cargo.lock b/Cargo.lock index 158edb0b..34ac4b6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -725,7 +725,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -751,7 +750,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -778,7 +776,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -812,7 +809,6 @@ dependencies = [ "lido-staking-base", "neutron-sdk", "prost", - "protobuf", "thiserror", ] @@ -835,7 +831,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -862,7 +857,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -887,7 +881,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -931,7 +924,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -960,7 +952,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -971,8 +962,10 @@ dependencies = [ name = "lido-token" version = "1.0.0" dependencies = [ + "cosmos-sdk-proto", "cosmwasm-schema", "cosmwasm-std", + "cw-ownable", "cw-storage-plus 1.2.0", "cw-utils 1.0.3", "cw2 1.1.2", @@ -1000,7 +993,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -1027,7 +1019,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -1056,7 +1047,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -1084,7 +1074,6 @@ dependencies = [ "neutron-sdk", "prost", "prost-types", - "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -1094,8 +1083,8 @@ dependencies = [ [[package]] name = "neutron-sdk" -version = "0.7.0" -source = "git+https://github.com/neutron-org/neutron-sdk?rev=9f0ed09746b4cc75e902315b0a0d5a3e0e5350a7#9f0ed09746b4cc75e902315b0a0d5a3e0e5350a7" +version = "0.8.0" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/LIDO-68-query-siginig-info#e753df9a24cb0001dfb125ef6f67595da01eee64" dependencies = [ "bech32", "cosmos-sdk-proto", diff --git a/Cargo.toml b/Cargo.toml index 55720228..0f2d27ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,12 +24,11 @@ resolver = "2" [workspace.dependencies] cosmos-sdk-proto = { version = "0.20.0", default-features = false } -base64 = "0.21.2" +base64 = "0.21.5" cw-ownable = "0.5.1" -neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", rev = "9f0ed09746b4cc75e902315b0a0d5a3e0e5350a7" } -prost = "0.12.1" -prost-types = "0.12.1" -protobuf = "3.2.0" +neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "feat/LIDO-68-query-siginig-info" } +prost = "0.12.3" +prost-types = "0.12.3" tendermint-proto = "0.34.0" cosmwasm-std = { version = "1.5.2", default-features = false, features = [ "stargate", diff --git a/contracts/core/Cargo.toml b/contracts/core/Cargo.toml index 4607d668..f99702d2 100644 --- a/contracts/core/Cargo.toml +++ b/contracts/core/Cargo.toml @@ -26,7 +26,6 @@ library = [] cosmos-sdk-proto = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } cosmwasm-schema = { workspace = true } diff --git a/contracts/distribution/Cargo.toml b/contracts/distribution/Cargo.toml index 3689cd99..e936da50 100644 --- a/contracts/distribution/Cargo.toml +++ b/contracts/distribution/Cargo.toml @@ -26,7 +26,6 @@ library = [] cosmos-sdk-proto = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } thiserror = { workspace = true } diff --git a/contracts/factory/Cargo.toml b/contracts/factory/Cargo.toml index 86e4a0db..1cba1143 100644 --- a/contracts/factory/Cargo.toml +++ b/contracts/factory/Cargo.toml @@ -26,7 +26,6 @@ library = [] cosmos-sdk-proto = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } cosmwasm-schema = { workspace = true } diff --git a/contracts/factory/src/contract.rs b/contracts/factory/src/contract.rs index cb250a5a..27763e89 100644 --- a/contracts/factory/src/contract.rs +++ b/contracts/factory/src/contract.rs @@ -58,6 +58,7 @@ pub fn instantiate( remote_opts: msg.remote_opts, owner: info.sender.to_string(), subdenom: msg.subdenom.to_string(), + token_metadata: msg.token_metadata, }, )?; @@ -302,6 +303,8 @@ fn execute_init( msg: to_json_binary(&TokenInstantiateMsg { core_address: core_contract.to_string(), subdenom: config.subdenom, + token_metadata: config.token_metadata, + owner: env.contract.address.to_string(), })?, funds: vec![], salt: Binary::from(salt), diff --git a/contracts/factory/src/msg.rs b/contracts/factory/src/msg.rs index d488bbae..eb50f2e4 100644 --- a/contracts/factory/src/msg.rs +++ b/contracts/factory/src/msg.rs @@ -1,7 +1,7 @@ +use crate::state::{CodeIds, RemoteOpts, State}; use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::Uint128; - -use crate::state::{CodeIds, RemoteOpts, State}; +use lido_staking_base::msg::token::DenomMetadata; #[cw_serde] pub struct InstantiateMsg { @@ -9,6 +9,7 @@ pub struct InstantiateMsg { pub remote_opts: RemoteOpts, pub salt: String, pub subdenom: String, + pub token_metadata: DenomMetadata, } #[cw_serde] diff --git a/contracts/factory/src/state.rs b/contracts/factory/src/state.rs index c7cb64eb..37dcd376 100644 --- a/contracts/factory/src/state.rs +++ b/contracts/factory/src/state.rs @@ -1,5 +1,6 @@ use cosmwasm_schema::cw_serde; use cw_storage_plus::Item; +use lido_staking_base::msg::token::DenomMetadata; #[cw_serde] pub struct CodeIds { @@ -29,6 +30,7 @@ pub struct Config { pub owner: String, pub salt: String, pub subdenom: String, + pub token_metadata: DenomMetadata, } #[cw_serde] diff --git a/contracts/hook-tester/Cargo.toml b/contracts/hook-tester/Cargo.toml index f651d8ae..ac2d8b34 100644 --- a/contracts/hook-tester/Cargo.toml +++ b/contracts/hook-tester/Cargo.toml @@ -26,7 +26,6 @@ library = [] cosmos-sdk-proto = { workspace = true } neutron-sdk = { workspace = true } prost = { workspace = true } -protobuf = { workspace = true } cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } diff --git a/contracts/pump/Cargo.toml b/contracts/pump/Cargo.toml index 40935173..f4c0b787 100644 --- a/contracts/pump/Cargo.toml +++ b/contracts/pump/Cargo.toml @@ -28,7 +28,6 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } diff --git a/contracts/puppeteer-authz/Cargo.toml b/contracts/puppeteer-authz/Cargo.toml index 81dcf58a..b9cab6a4 100644 --- a/contracts/puppeteer-authz/Cargo.toml +++ b/contracts/puppeteer-authz/Cargo.toml @@ -31,7 +31,6 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } cosmwasm-schema = { workspace = true } diff --git a/contracts/puppeteer-authz/src/state.rs b/contracts/puppeteer-authz/src/state.rs index 30824247..73752e5f 100644 --- a/contracts/puppeteer-authz/src/state.rs +++ b/contracts/puppeteer-authz/src/state.rs @@ -1,10 +1,6 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; - use cosmwasm_std::Addr; -use lido_puppeteer_base::{ - msg::DelegationsResponse, - state::{BaseConfig, State, Transfer}, -}; +use lido_puppeteer_base::state::BaseConfig; #[cw_serde] pub struct Config { @@ -35,10 +31,10 @@ impl BaseConfig for Config { pub enum QueryMsg { #[returns(Config)] Config {}, - #[returns(State)] + #[returns(lido_puppeteer_base::state::State)] State {}, - #[returns(Vec)] + #[returns(Vec)] InterchainTransactions {}, - #[returns(DelegationsResponse)] + #[returns(lido_puppeteer_base::msg::DelegationsResponse)] Delegations {}, } diff --git a/contracts/puppeteer/Cargo.toml b/contracts/puppeteer/Cargo.toml index ce10277f..bd489caf 100644 --- a/contracts/puppeteer/Cargo.toml +++ b/contracts/puppeteer/Cargo.toml @@ -28,8 +28,7 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } -tendermint-proto = { workspace = true } +tendermint-proto = { workspace = true } cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } diff --git a/contracts/stargate-poc/Cargo.toml b/contracts/stargate-poc/Cargo.toml index dc493993..1d7e4a83 100644 --- a/contracts/stargate-poc/Cargo.toml +++ b/contracts/stargate-poc/Cargo.toml @@ -28,7 +28,6 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } diff --git a/contracts/strategy/Cargo.toml b/contracts/strategy/Cargo.toml index 142ed4b9..f1e246d5 100644 --- a/contracts/strategy/Cargo.toml +++ b/contracts/strategy/Cargo.toml @@ -26,7 +26,6 @@ library = [] cosmos-sdk-proto = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } cosmwasm-schema = { workspace = true } diff --git a/contracts/token/Cargo.toml b/contracts/token/Cargo.toml index 7dbd9c85..53a3264f 100644 --- a/contracts/token/Cargo.toml +++ b/contracts/token/Cargo.toml @@ -17,8 +17,10 @@ cosmwasm-std = { workspace = true } lido-staking-base = { workspace = true } lido-helpers = { workspace = true } cosmwasm-schema = { workspace = true } +cosmos-sdk-proto = { workspace = true } cw-storage-plus = { workspace = true } cw2 = { workspace = true } cw-utils = { workspace = true } neutron-sdk = { workspace = true } thiserror = { workspace = true } +cw-ownable = { workspace = true } diff --git a/contracts/token/src/contract.rs b/contracts/token/src/contract.rs index 8879c764..5659c49b 100644 --- a/contracts/token/src/contract.rs +++ b/contracts/token/src/contract.rs @@ -1,19 +1,21 @@ +use crate::error::{ContractError, ContractResult}; +use cosmos_sdk_proto::cosmos::bank::v1beta1::{DenomUnit, Metadata}; use cosmwasm_std::{ - attr, ensure_eq, ensure_ne, entry_point, to_json_binary, Binary, Deps, DepsMut, Env, + attr, ensure_eq, ensure_ne, entry_point, to_json_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, SubMsg, Uint128, }; use lido_helpers::answer::{attr_coin, response}; use lido_staking_base::{ - msg::token::{ConfigResponse, ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}, - state::token::{CORE_ADDRESS, DENOM}, + msg::token::{ConfigResponse, DenomMetadata, ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}, + state::token::{CORE_ADDRESS, DENOM, TOKEN_METADATA}, }; use neutron_sdk::{ bindings::{msg::NeutronMsg, query::NeutronQuery}, + proto_types::osmosis::tokenfactory::v1beta1::MsgSetDenomMetadata, query::token_factory::query_full_denom, + stargate::aux::create_stargate_msg, }; -use crate::error::{ContractError, ContractResult}; - pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); pub const CREATE_DENOM_REPLY_ID: u64 = 1; @@ -26,10 +28,13 @@ pub fn instantiate( msg: InstantiateMsg, ) -> ContractResult> { cw2::set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + cw_ownable::initialize_owner(deps.storage, deps.api, Some(&msg.owner))?; let core = deps.api.addr_validate(&msg.core_address)?; CORE_ADDRESS.save(deps.storage, &core)?; + TOKEN_METADATA.save(deps.storage, &msg.token_metadata)?; + DENOM.save(deps.storage, &msg.subdenom)?; let create_denom_msg = SubMsg::reply_on_success( NeutronMsg::submit_create_denom(&msg.subdenom), @@ -47,7 +52,7 @@ pub fn instantiate( #[cfg_attr(not(feature = "library"), entry_point)] pub fn execute( deps: DepsMut, - _env: Env, + env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> ContractResult> { @@ -55,8 +60,19 @@ pub fn execute( ensure_eq!(info.sender, core, ContractError::Unauthorized); match msg { + ExecuteMsg::UpdateOwnership(action) => { + cw_ownable::update_ownership(deps.into_empty(), &env.block, &info.sender, action)?; + Ok(response::<(&str, &str), _>( + "execute-update-ownership", + CONTRACT_NAME, + [], + )) + } ExecuteMsg::Mint { amount, receiver } => mint(deps, amount, receiver), ExecuteMsg::Burn {} => burn(deps, info), + ExecuteMsg::SetTokenMetadata { token_metadata } => { + set_token_metadata(deps, env, info, token_metadata) + } } } @@ -95,9 +111,34 @@ fn burn(deps: DepsMut, info: MessageInfo) -> ContractResult, + env: Env, + info: MessageInfo, + token_metadata: DenomMetadata, +) -> ContractResult> { + cw_ownable::assert_owner(deps.storage, &info.sender)?; + + let denom = DENOM.load(deps.storage)?; + + let msg = create_set_denom_metadata_msg( + env.contract.address.into_string(), + denom.clone(), + token_metadata, + ); + + Ok(response( + "execute-set-denom-metadata", + CONTRACT_NAME, + [attr("denom", denom)], + ) + .add_message(msg)) +} + #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> ContractResult { match msg { + QueryMsg::Ownership {} => Ok(to_json_binary(&cw_ownable::get_ownership(deps.storage)?)?), QueryMsg::Config {} => { let core_address = CORE_ADDRESS.load(deps.storage)?.into_string(); let denom = DENOM.load(deps.storage)?; @@ -127,15 +168,59 @@ pub fn reply( match msg.id { CREATE_DENOM_REPLY_ID => { let subdenom = DENOM.load(deps.storage)?; - let full_denom = query_full_denom(deps.as_ref(), env.contract.address, subdenom)?; + let full_denom = query_full_denom(deps.as_ref(), &env.contract.address, subdenom)?; DENOM.save(deps.storage, &full_denom.denom)?; + let token_metadata = TOKEN_METADATA.load(deps.storage)?; + TOKEN_METADATA.remove(deps.storage); + + let msg = create_set_denom_metadata_msg( + env.contract.address.into_string(), + full_denom.denom.clone(), + token_metadata, + ); + Ok(response( "reply-create-denom", CONTRACT_NAME, [attr("denom", full_denom.denom)], - )) + ) + .add_message(msg)) } id => Err(ContractError::UnknownReplyId { id }), } } + +fn create_set_denom_metadata_msg( + contract_address: String, + denom: String, + token_metadata: DenomMetadata, +) -> CosmosMsg { + create_stargate_msg( + "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata", + MsgSetDenomMetadata { + sender: contract_address, + metadata: Some(Metadata { + denom_units: vec![ + DenomUnit { + denom: denom.clone(), + exponent: 0, + aliases: vec![], + }, + DenomUnit { + denom: token_metadata.display.clone(), + exponent: token_metadata.exponent, + aliases: vec![], + }, + ], + base: denom, + display: token_metadata.display, + name: token_metadata.name, + description: token_metadata.description, + symbol: token_metadata.symbol, + uri: token_metadata.uri.unwrap_or_default(), + uri_hash: token_metadata.uri_hash.unwrap_or_default(), + }), + }, + ) +} diff --git a/contracts/token/src/error.rs b/contracts/token/src/error.rs index b3dcb594..144cece4 100644 --- a/contracts/token/src/error.rs +++ b/contracts/token/src/error.rs @@ -11,6 +11,9 @@ pub enum ContractError { #[error("{0}")] PaymentError(#[from] cw_utils::PaymentError), + #[error("{0}")] + OwnershipError(#[from] cw_ownable::OwnershipError), + #[error("unauthorized")] Unauthorized, diff --git a/contracts/token/src/tests.rs b/contracts/token/src/tests.rs index 1ada48d4..e371d4b6 100644 --- a/contracts/token/src/tests.rs +++ b/contracts/token/src/tests.rs @@ -1,30 +1,37 @@ +use crate::{ + contract::{self, CREATE_DENOM_REPLY_ID}, + error::ContractError, +}; +use cosmos_sdk_proto::{ + cosmos::bank::v1beta1::{DenomUnit, Metadata}, + prost::Message, +}; use cosmwasm_std::{ attr, coin, from_json, - testing::{mock_env, mock_info, MockApi, MockQuerier, MockStorage, MOCK_CONTRACT_ADDR}, - to_json_binary, Addr, ContractResult, CosmosMsg, Event, OwnedDeps, Querier, QuerierResult, + testing::{mock_env, mock_info, MockQuerier, MOCK_CONTRACT_ADDR}, + to_json_binary, Addr, Binary, ContractResult, CosmosMsg, Event, Querier, QuerierResult, QueryRequest, Reply, ReplyOn, SubMsgResult, SystemError, Uint128, }; +use lido_helpers::testing::mock_dependencies; use lido_staking_base::{ - msg::token::{ConfigResponse, ExecuteMsg, InstantiateMsg, QueryMsg}, - state::token::{CORE_ADDRESS, DENOM}, + msg::token::{ConfigResponse, DenomMetadata, ExecuteMsg, InstantiateMsg, QueryMsg}, + state::token::{CORE_ADDRESS, DENOM, TOKEN_METADATA}, }; use neutron_sdk::{ bindings::{msg::NeutronMsg, query::NeutronQuery}, + proto_types::osmosis::tokenfactory::v1beta1::MsgSetDenomMetadata, query::token_factory::FullDenomResponse, }; -use std::marker::PhantomData; - -use crate::{ - contract::{self, CREATE_DENOM_REPLY_ID}, - error::ContractError, -}; -fn mock_dependencies() -> OwnedDeps { - OwnedDeps { - storage: MockStorage::default(), - api: MockApi::default(), - querier: Q::default(), - custom_query_type: PhantomData, +fn sample_metadata() -> DenomMetadata { + DenomMetadata { + exponent: 6, + display: "token".to_string(), + name: "A token".to_string(), + description: "Some token used for testing".to_string(), + symbol: "TOKEN".to_string(), + uri: None, + uri_hash: None, } } @@ -38,12 +45,20 @@ fn instantiate() { InstantiateMsg { core_address: "core".to_string(), subdenom: "subdenom".to_string(), + token_metadata: sample_metadata(), + owner: "admin".to_string(), }, ) .unwrap(); - let core = CORE_ADDRESS.load(deps.as_ref().storage).unwrap(); - assert_eq!(core, Addr::unchecked("core")); + assert_eq!( + CORE_ADDRESS.load(deps.as_ref().storage).unwrap(), + Addr::unchecked("core") + ); + assert_eq!( + TOKEN_METADATA.load(deps.as_ref().storage).unwrap(), + sample_metadata(), + ); let denom = DENOM.load(deps.as_ref().storage).unwrap(); assert_eq!(denom, "subdenom"); @@ -60,7 +75,7 @@ fn instantiate() { assert_eq!( response.events, vec![Event::new("lido-token-instantiate") - .add_attributes([attr("core_address", core), attr("subdenom", "subdenom")])] + .add_attributes([attr("core_address", "core"), attr("subdenom", "subdenom")])] ); assert!(response.attributes.is_empty()); } @@ -68,7 +83,7 @@ fn instantiate() { #[test] fn reply_unknown_id() { let mut deps = mock_dependencies::(); - let error = crate::contract::reply( + let error = contract::reply( deps.as_mut(), mock_env(), Reply { @@ -122,7 +137,11 @@ fn reply() { DENOM .save(deps.as_mut().storage, &String::from("subdenom")) .unwrap(); - let response = crate::contract::reply( + TOKEN_METADATA + .save(deps.as_mut().storage, &sample_metadata()) + .unwrap(); + + let response = contract::reply( deps.as_mut(), mock_env(), Reply { @@ -135,7 +154,46 @@ fn reply() { let denom = DENOM.load(deps.as_ref().storage).unwrap(); assert_eq!(denom, "factory/subdenom"); - assert!(response.messages.is_empty()); + assert_eq!(response.messages.len(), 1); + match response.messages[0].msg.clone() { + CosmosMsg::Stargate { type_url, value } => { + assert_eq!( + type_url, + "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata" + ); + assert_eq!( + value, + Binary::from( + MsgSetDenomMetadata { + sender: MOCK_CONTRACT_ADDR.to_string(), + metadata: Some(Metadata { + description: "Some token used for testing".to_string(), + denom_units: vec![ + DenomUnit { + denom: denom.clone(), + exponent: 0, + aliases: vec![], + }, + DenomUnit { + denom: "token".to_string(), + exponent: 6, + aliases: vec![], + }, + ], + base: denom, + display: "token".to_string(), + name: "A token".to_string(), + symbol: "TOKEN".to_string(), + uri: "".to_string(), + uri_hash: "".to_string(), + }) + } + .encode_to_vec() + ) + ); + } + _ => panic!(), + }; assert_eq!( response.events, vec![Event::new("lido-token-reply-create-denom") @@ -154,7 +212,7 @@ fn mint_zero() { .save(deps.as_mut().storage, &String::from("denom")) .unwrap(); - let error = crate::contract::execute( + let error = contract::execute( deps.as_mut(), mock_env(), mock_info("core", &[]), @@ -177,7 +235,7 @@ fn mint() { .save(deps.as_mut().storage, &String::from("denom")) .unwrap(); - let response = crate::contract::execute( + let response = contract::execute( deps.as_mut(), mock_env(), mock_info("core", &[]), @@ -215,7 +273,7 @@ fn mint_stranger() { .save(deps.as_mut().storage, &String::from("denom")) .unwrap(); - let error = crate::contract::execute( + let error = contract::execute( deps.as_mut(), mock_env(), mock_info("stranger", &[]), @@ -239,7 +297,7 @@ fn burn_zero() { .save(deps.as_mut().storage, &String::from("denom")) .unwrap(); - let error = crate::contract::execute( + let error = contract::execute( deps.as_mut(), mock_env(), mock_info("core", &[]), @@ -262,7 +320,7 @@ fn burn_multiple_coins() { .save(deps.as_mut().storage, &String::from("denom")) .unwrap(); - let error = crate::contract::execute( + let error = contract::execute( deps.as_mut(), mock_env(), mock_info("core", &[coin(20, "coin1"), coin(10, "denom")]), @@ -285,7 +343,7 @@ fn burn_invalid_coin() { .save(deps.as_mut().storage, &String::from("denom")) .unwrap(); - let error = crate::contract::execute( + let error = contract::execute( deps.as_mut(), mock_env(), mock_info("core", &[coin(20, "coin1")]), @@ -308,7 +366,7 @@ fn burn() { .save(deps.as_mut().storage, &String::from("denom")) .unwrap(); - let response = crate::contract::execute( + let response = contract::execute( deps.as_mut(), mock_env(), mock_info("core", &[coin(140, "denom")]), @@ -342,7 +400,7 @@ fn burn_stranger() { .save(deps.as_mut().storage, &String::from("denom")) .unwrap(); - let error = crate::contract::execute( + let error = contract::execute( deps.as_mut(), mock_env(), mock_info("stranger", &[coin(160, "denom")]), @@ -363,7 +421,7 @@ fn query_config() { .save(deps.as_mut().storage, &String::from("denom")) .unwrap(); - let response = crate::contract::query(deps.as_ref(), mock_env(), QueryMsg::Config {}).unwrap(); + let response = contract::query(deps.as_ref(), mock_env(), QueryMsg::Config {}).unwrap(); assert_eq!( response, to_json_binary(&ConfigResponse { diff --git a/contracts/validators-set/Cargo.toml b/contracts/validators-set/Cargo.toml index 4cffaf1c..c58d3a3b 100644 --- a/contracts/validators-set/Cargo.toml +++ b/contracts/validators-set/Cargo.toml @@ -26,7 +26,6 @@ library = [] cosmos-sdk-proto = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } thiserror = { workspace = true } diff --git a/contracts/validators-set/src/tests.rs b/contracts/validators-set/src/tests.rs index 2cb4fc74..974eae50 100644 --- a/contracts/validators-set/src/tests.rs +++ b/contracts/validators-set/src/tests.rs @@ -1,20 +1,10 @@ use cosmwasm_std::{ attr, - testing::{mock_env, mock_info, MockApi, MockQuerier, MockStorage}, - to_json_binary, Addr, Decimal, Event, OwnedDeps, Querier, + testing::{mock_env, mock_info, MockQuerier}, + to_json_binary, Addr, Decimal, Event, }; +use lido_helpers::testing::mock_dependencies; use lido_staking_base::state::validatorset::ConfigOptional; -use neutron_sdk::bindings::query::NeutronQuery; -use std::marker::PhantomData; - -fn mock_dependencies() -> OwnedDeps { - OwnedDeps { - storage: MockStorage::default(), - api: MockApi::default(), - querier: Q::default(), - custom_query_type: PhantomData, - } -} #[test] fn instantiate() { @@ -146,7 +136,7 @@ fn update_config_ok() { mock_env(), mock_info("core", &[]), lido_staking_base::msg::validatorset::ExecuteMsg::UpdateConfig { - new_config: ConfigOptional { + new_config: lido_staking_base::state::validatorset::ConfigOptional { owner: Some(Addr::unchecked("owner1")), stats_contract: Some(Addr::unchecked("stats_contract1")), }, diff --git a/contracts/validators-stats/Cargo.toml b/contracts/validators-stats/Cargo.toml index 54006393..51d84c17 100644 --- a/contracts/validators-stats/Cargo.toml +++ b/contracts/validators-stats/Cargo.toml @@ -29,8 +29,7 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } -tendermint-proto = { workspace = true } +tendermint-proto = { workspace = true } cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } diff --git a/contracts/withdrawal-manager/Cargo.toml b/contracts/withdrawal-manager/Cargo.toml index b20c1b96..d91afa62 100644 --- a/contracts/withdrawal-manager/Cargo.toml +++ b/contracts/withdrawal-manager/Cargo.toml @@ -29,9 +29,7 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } - cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } cw-storage-plus = { workspace = true } diff --git a/contracts/withdrawal-voucher/Cargo.toml b/contracts/withdrawal-voucher/Cargo.toml index 7ca588f3..dd81f7cc 100644 --- a/contracts/withdrawal-voucher/Cargo.toml +++ b/contracts/withdrawal-voucher/Cargo.toml @@ -29,9 +29,7 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } - cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } cw-storage-plus = { workspace = true } diff --git a/integration_tests/src/generated/contractLib/lidoFactory.ts b/integration_tests/src/generated/contractLib/lidoFactory.ts index 79f1a931..479b09a4 100644 --- a/integration_tests/src/generated/contractLib/lidoFactory.ts +++ b/integration_tests/src/generated/contractLib/lidoFactory.ts @@ -6,6 +6,7 @@ export interface InstantiateMsg { remote_opts: RemoteOpts; salt: string; subdenom: string; + token_metadata: DenomMetadata; } export interface CodeIds { core_code_id: number; @@ -24,6 +25,36 @@ export interface RemoteOpts { transfer_channel_id: string; update_period: number; } +export interface DenomMetadata { + /** + * Even longer description, example: "The native staking token of the Cosmos Hub" + */ + description: string; + /** + * Lowercase moniker to be displayed in clients, example: "atom" + */ + display: string; + /** + * Number of decimals + */ + exponent: number; + /** + * Descriptive token name, example: "Cosmos Hub Atom" + */ + name: string; + /** + * Symbol to be displayed on exchanges, example: "ATOM" + */ + symbol: string; + /** + * URI to a document that contains additional information + */ + uri?: string | null; + /** + * SHA256 hash of a document pointed by URI + */ + uri_hash?: string | null; +} export type CallbackArgs = { post_init: {}; }; diff --git a/integration_tests/src/generated/contractLib/lidoPuppeteerAuthz.ts b/integration_tests/src/generated/contractLib/lidoPuppeteerAuthz.ts index 4a5e12aa..a2cc8622 100644 --- a/integration_tests/src/generated/contractLib/lidoPuppeteerAuthz.ts +++ b/integration_tests/src/generated/contractLib/lidoPuppeteerAuthz.ts @@ -34,11 +34,37 @@ export type Addr = string; export type Uint128 = string; export type IcaState = "none" | "in_progress" | "registered" | "timeout"; export type ArrayOfTransfer = Transfer[]; +/** + * A point in time in nanosecond precision. + * + * This type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z. + * + * ## Examples + * + * ``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202); + * + * let ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ``` + */ +export type Timestamp = Uint64; +/** + * A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq. + * + * # Examples + * + * Use `from` to create instances of this and `u64` to get the value out: + * + * ``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42); + * + * let b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ``` + */ +export type Uint64 = string; +export type ArrayOfUnbondingDelegation = UnbondingDelegation[]; export interface LidoPuppeteerAuthzSchema { - responses: Config | DelegationsResponse | State | ArrayOfTransfer; + responses: Config | DelegationsResponse | State | ArrayOfTransfer | ArrayOfUnbondingDelegation; execute: | RegisterDelegatorDelegationsQueryArgs + | RegisterDelegatorUnbondingDelegationsQueryArgs | SetFeesArgs | DelegateArgs | UndelegateArgs @@ -93,9 +119,25 @@ export interface Transfer { recipient: string; sender: string; } +export interface UnbondingDelegation { + last_updated_height: number; + query_id: number; + unbonding_delegations: UnbondingEntry[]; + validator_address: string; +} +export interface UnbondingEntry { + balance: Uint128; + completion_time?: Timestamp | null; + creation_height: number; + initial_balance: Uint128; + [k: string]: unknown; +} export interface RegisterDelegatorDelegationsQueryArgs { validators: string[]; } +export interface RegisterDelegatorUnbondingDelegationsQueryArgs { + validators: string[]; +} export interface SetFeesArgs { ack_fee: Uint128; recv_fee: Uint128; @@ -178,6 +220,9 @@ export class Client { queryDelegations = async(): Promise => { return this.client.queryContractSmart(this.contractAddress, { delegations: {} }); } + queryUnbondingDelegations = async(): Promise => { + return this.client.queryContractSmart(this.contractAddress, { unbonding_delegations: {} }); + } registerICA = async(sender: string, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } return this.client.execute(sender, this.contractAddress, { register_i_c_a: {} }, fee || "auto", memo, funds); @@ -190,6 +235,10 @@ export class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } return this.client.execute(sender, this.contractAddress, { register_delegator_delegations_query: args }, fee || "auto", memo, funds); } + registerDelegatorUnbondingDelegationsQuery = async(sender:string, args: RegisterDelegatorUnbondingDelegationsQueryArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { + if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } + return this.client.execute(sender, this.contractAddress, { register_delegator_unbonding_delegations_query: args }, fee || "auto", memo, funds); + } setFees = async(sender:string, args: SetFeesArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } return this.client.execute(sender, this.contractAddress, { set_fees: args }, fee || "auto", memo, funds); diff --git a/integration_tests/src/generated/contractLib/lidoToken.ts b/integration_tests/src/generated/contractLib/lidoToken.ts index fe58f8a3..d3def309 100644 --- a/integration_tests/src/generated/contractLib/lidoToken.ts +++ b/integration_tests/src/generated/contractLib/lidoToken.ts @@ -3,8 +3,77 @@ import { StdFee } from "@cosmjs/amino"; import { Coin } from "@cosmjs/amino"; export interface InstantiateMsg { core_address: string; + owner: string; subdenom: string; + token_metadata: DenomMetadata; } +export interface DenomMetadata { + /** + * Even longer description, example: "The native staking token of the Cosmos Hub" + */ + description: string; + /** + * Lowercase moniker to be displayed in clients, example: "atom" + */ + display: string; + /** + * Number of decimals + */ + exponent: number; + /** + * Descriptive token name, example: "Cosmos Hub Atom" + */ + name: string; + /** + * Symbol to be displayed on exchanges, example: "ATOM" + */ + symbol: string; + /** + * URI to a document that contains additional information + */ + uri?: string | null; + /** + * SHA256 hash of a document pointed by URI + */ + uri_hash?: string | null; +} +/** + * Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future) + */ +export type Expiration = + | { + at_height: number; + } + | { + at_time: Timestamp; + } + | { + never: {}; + }; +/** + * A point in time in nanosecond precision. + * + * This type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z. + * + * ## Examples + * + * ``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202); + * + * let ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ``` + */ +export type Timestamp = Uint64; +/** + * A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq. + * + * # Examples + * + * Use `from` to create instances of this and `u64` to get the value out: + * + * ``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42); + * + * let b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ``` + */ +export type Uint64 = string; /** * A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq. * @@ -19,20 +88,82 @@ export interface InstantiateMsg { * let c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ``` */ export type Uint128 = string; +/** + * Actions that can be taken to alter the contract's ownership + */ +export type UpdateOwnershipArgs = + | { + transfer_ownership: { + expiry?: Expiration | null; + new_owner: string; + }; + } + | "accept_ownership" + | "renounce_ownership"; export interface LidoTokenSchema { - responses: ConfigResponse; - execute: MintArgs; + responses: ConfigResponse | OwnershipFor_String; + execute: MintArgs | SetTokenMetadataArgs | UpdateOwnershipArgs; [k: string]: unknown; } export interface ConfigResponse { core_address: string; denom: string; } +/** + * The contract's ownership info + */ +export interface OwnershipFor_String { + /** + * The contract's current owner. `None` if the ownership has been renounced. + */ + owner?: string | null; + /** + * The deadline for the pending owner to accept the ownership. `None` if there isn't a pending ownership transfer, or if a transfer exists and it doesn't have a deadline. + */ + pending_expiry?: Expiration | null; + /** + * The account who has been proposed to take over the ownership. `None` if there isn't a pending ownership transfer. + */ + pending_owner?: string | null; +} export interface MintArgs { amount: Uint128; receiver: string; } +export interface SetTokenMetadataArgs { + token_metadata: DenomMetadata; +} +export interface DenomMetadata { + /** + * Even longer description, example: "The native staking token of the Cosmos Hub" + */ + description: string; + /** + * Lowercase moniker to be displayed in clients, example: "atom" + */ + display: string; + /** + * Number of decimals + */ + exponent: number; + /** + * Descriptive token name, example: "Cosmos Hub Atom" + */ + name: string; + /** + * Symbol to be displayed on exchanges, example: "ATOM" + */ + symbol: string; + /** + * URI to a document that contains additional information + */ + uri?: string | null; + /** + * SHA256 hash of a document pointed by URI + */ + uri_hash?: string | null; +} function isSigningCosmWasmClient( @@ -68,6 +199,9 @@ export class Client { queryConfig = async(): Promise => { return this.client.queryContractSmart(this.contractAddress, { config: {} }); } + queryOwnership = async(): Promise => { + return this.client.queryContractSmart(this.contractAddress, { ownership: {} }); + } mint = async(sender:string, args: MintArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } return this.client.execute(sender, this.contractAddress, { mint: args }, fee || "auto", memo, funds); @@ -76,4 +210,12 @@ export class Client { if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } return this.client.execute(sender, this.contractAddress, { burn: {} }, fee || "auto", memo, funds); } + setTokenMetadata = async(sender:string, args: SetTokenMetadataArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { + if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } + return this.client.execute(sender, this.contractAddress, { set_token_metadata: args }, fee || "auto", memo, funds); + } + updateOwnership = async(sender:string, args: UpdateOwnershipArgs, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]): Promise => { + if (!isSigningCosmWasmClient(this.client)) { throw this.mustBeSigningClient(); } + return this.client.execute(sender, this.contractAddress, { update_ownership: args }, fee || "auto", memo, funds); + } } diff --git a/integration_tests/src/testcases/core.fsm.test.ts b/integration_tests/src/testcases/core.fsm.test.ts index 018fed9a..f6a43107 100644 --- a/integration_tests/src/testcases/core.fsm.test.ts +++ b/integration_tests/src/testcases/core.fsm.test.ts @@ -259,6 +259,15 @@ describe('Core', () => { }, salt: 'salt', subdenom: 'lido', + token_metadata: { + description: 'Lido token', + display: 'lido', + exponent: 6, + name: 'Lido liquid staking token', + symbol: 'LIDO', + uri: null, + uri_hash: null, + }, }, 'Lido-staking-factory', [], diff --git a/integration_tests/src/testcases/core.test.ts b/integration_tests/src/testcases/core.test.ts index 355a501f..cf740396 100644 --- a/integration_tests/src/testcases/core.test.ts +++ b/integration_tests/src/testcases/core.test.ts @@ -259,6 +259,15 @@ describe('Core', () => { }, salt: 'salt', subdenom: 'lido', + token_metadata: { + description: 'Lido token', + display: 'lido', + exponent: 6, + name: 'Lido liquid staking token', + symbol: 'LIDO', + uri: null, + uri_hash: null, + }, }, 'Lido-staking-factory', [], diff --git a/integration_tests/src/testcases/puppeteer-authz.test.ts b/integration_tests/src/testcases/puppeteer-authz.test.ts index 81e9a1c8..c8dd4b0a 100644 --- a/integration_tests/src/testcases/puppeteer-authz.test.ts +++ b/integration_tests/src/testcases/puppeteer-authz.test.ts @@ -13,7 +13,7 @@ import { Client as NeutronClient } from '@neutron-org/client-ts'; import { stringToPath } from '@cosmjs/crypto'; import { AccountData, DirectSecp256k1HdWallet } from '@cosmjs/proto-signing'; import { GasPrice } from '@cosmjs/stargate'; -import { setupPark } from '../testSuite'; +import { awaitBlocks, setupPark } from '../testSuite'; import fs from 'fs'; import Cosmopark from '@neutron-org/cosmopark'; import { waitFor } from '../helpers/waitFor'; @@ -544,6 +544,8 @@ describe.skip('Interchain puppeteer with AuthZ support', () => { }); it('query delegations query', async () => { + await awaitBlocks(`http://127.0.0.1:${context.park.ports.gaia.rpc}`, 1); + let delegations: DelegationsResponse; const { gaiaAccount } = context; diff --git a/packages/base/src/msg/strategy.rs b/packages/base/src/msg/strategy.rs index 415d0f79..a3c90d29 100644 --- a/packages/base/src/msg/strategy.rs +++ b/packages/base/src/msg/strategy.rs @@ -1,8 +1,6 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::Uint128; -use super::distribution::IdealDelegation; - #[cw_serde] pub enum ExecuteMsg { UpdateConfig { @@ -19,9 +17,9 @@ pub enum ExecuteMsg { pub enum QueryMsg { #[returns(ConfigResponse)] Config {}, - #[returns(Vec)] + #[returns(Vec)] CalcDeposit { deposit: Uint128 }, - #[returns(Vec)] + #[returns(Vec)] CalcWithdraw { withdraw: Uint128 }, } diff --git a/packages/base/src/msg/token.rs b/packages/base/src/msg/token.rs index 9efe26ae..09be3a76 100644 --- a/packages/base/src/msg/token.rs +++ b/packages/base/src/msg/token.rs @@ -1,28 +1,53 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::Uint128; +use cw_ownable::{cw_ownable_execute, cw_ownable_query}; -#[cosmwasm_schema::cw_serde] +#[cw_ownable_query] +#[cw_serde] #[derive(QueryResponses)] pub enum QueryMsg { #[returns(ConfigResponse)] Config {}, } -#[cosmwasm_schema::cw_serde] +#[cw_serde] pub struct ConfigResponse { pub core_address: String, pub denom: String, } +#[cw_ownable_execute] #[cw_serde] pub enum ExecuteMsg { Mint { amount: Uint128, receiver: String }, Burn {}, + SetTokenMetadata { token_metadata: DenomMetadata }, +} + +#[cw_serde] +pub struct DenomMetadata { + /// Number of decimals + pub exponent: u32, + /// Lowercase moniker to be displayed in clients, example: "atom" + pub display: String, + /// Descriptive token name, example: "Cosmos Hub Atom" + pub name: String, + /// Even longer description, example: "The native staking token of the Cosmos Hub" + pub description: String, + /// Symbol to be displayed on exchanges, example: "ATOM" + pub symbol: String, + /// URI to a document that contains additional information + pub uri: Option, + /// SHA256 hash of a document pointed by URI + pub uri_hash: Option, } + #[cw_serde] pub struct InstantiateMsg { pub core_address: String, pub subdenom: String, + pub token_metadata: DenomMetadata, + pub owner: String, } #[cw_serde] diff --git a/packages/base/src/msg/validatorsstats.rs b/packages/base/src/msg/validatorsstats.rs index e3f2d026..f0903bb2 100644 --- a/packages/base/src/msg/validatorsstats.rs +++ b/packages/base/src/msg/validatorsstats.rs @@ -1,7 +1,5 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; -use crate::state::validatorsstats::{Config, ValidatorState}; - #[cw_serde] pub struct InstantiateMsg { pub connection_id: String, @@ -20,9 +18,9 @@ pub enum ExecuteMsg { #[cw_serde] #[derive(QueryResponses)] pub enum QueryMsg { - #[returns(Config)] + #[returns(crate::state::validatorsstats::Config)] Config {}, - #[returns(Vec)] + #[returns(Vec)] State {}, } diff --git a/packages/base/src/msg/withdrawal_manager.rs b/packages/base/src/msg/withdrawal_manager.rs index 678bc536..518d37c9 100644 --- a/packages/base/src/msg/withdrawal_manager.rs +++ b/packages/base/src/msg/withdrawal_manager.rs @@ -1,8 +1,6 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; use cw721::Cw721ReceiveMsg; -use crate::state::withdrawal_manager::Config; - #[cw_serde] pub struct InstantiateMsg { pub core_contract: String, @@ -14,7 +12,7 @@ pub struct InstantiateMsg { #[cw_serde] #[derive(QueryResponses)] pub enum QueryMsg { - #[returns(Config)] + #[returns(crate::state::withdrawal_manager::Config)] Config {}, } diff --git a/packages/base/src/state/puppeteer.rs b/packages/base/src/state/puppeteer.rs index 4daca08f..c94d7e8a 100644 --- a/packages/base/src/state/puppeteer.rs +++ b/packages/base/src/state/puppeteer.rs @@ -1,5 +1,4 @@ use cosmwasm_schema::cw_serde; - use cosmwasm_std::Addr; use cw_storage_plus::Item; use lido_puppeteer_base::state::BaseConfig; diff --git a/packages/base/src/state/token.rs b/packages/base/src/state/token.rs index 838e2a48..dc5ca9d4 100644 --- a/packages/base/src/state/token.rs +++ b/packages/base/src/state/token.rs @@ -1,5 +1,7 @@ +use crate::msg::token::DenomMetadata; use cosmwasm_std::Addr; use cw_storage_plus::Item; pub const CORE_ADDRESS: Item = Item::new("core"); pub const DENOM: Item = Item::new("denom"); +pub const TOKEN_METADATA: Item = Item::new("denom_metadata"); diff --git a/packages/helpers/src/lib.rs b/packages/helpers/src/lib.rs index 40788e51..236eb25c 100644 --- a/packages/helpers/src/lib.rs +++ b/packages/helpers/src/lib.rs @@ -1,2 +1,3 @@ pub mod answer; pub mod fsm; +pub mod testing; diff --git a/packages/helpers/src/testing.rs b/packages/helpers/src/testing.rs new file mode 100644 index 00000000..4cd27f5d --- /dev/null +++ b/packages/helpers/src/testing.rs @@ -0,0 +1,16 @@ +#![cfg(not(target_arch = "wasm32"))] + +use cosmwasm_std::testing::{MockApi, MockStorage}; +use cosmwasm_std::{OwnedDeps, Querier}; +use neutron_sdk::bindings::query::NeutronQuery; +use std::marker::PhantomData; + +pub fn mock_dependencies() -> OwnedDeps +{ + OwnedDeps { + storage: MockStorage::default(), + api: MockApi::default(), + querier: Q::default(), + custom_query_type: PhantomData, + } +} diff --git a/packages/puppeteer-base/Cargo.toml b/packages/puppeteer-base/Cargo.toml index 92bbac63..eec296cc 100644 --- a/packages/puppeteer-base/Cargo.toml +++ b/packages/puppeteer-base/Cargo.toml @@ -28,7 +28,6 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -protobuf = { workspace = true } tendermint-proto = { workspace = true } thiserror = { workspace = true }