Skip to content

Commit

Permalink
feat: Remove types forwarding to interface's assoc
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikthebird committed Apr 22, 2024
1 parent 252758d commit 7d8da72
Show file tree
Hide file tree
Showing 22 changed files with 285 additions and 292 deletions.
2 changes: 1 addition & 1 deletion examples/contracts/cw1-subkeys/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct Cw1SubkeysContract<'a> {
#[sv::error(ContractError)]
#[sv::messages(cw1 as Cw1)]
#[sv::messages(whitelist as Whitelist)]
impl Cw1SubkeysContract<'_> {
impl<'abcd> Cw1SubkeysContract<'abcd> {
pub const fn new() -> Self {
Self {
whitelist: Cw1WhitelistContract::new(),
Expand Down
2 changes: 1 addition & 1 deletion examples/contracts/cw1-whitelist/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct Cw1WhitelistContract<'a> {
#[sv::error(ContractError)]
#[sv::messages(cw1 as Cw1)]
#[sv::messages(whitelist as Whitelist)]
impl Cw1WhitelistContract<'_> {
impl<'asdf> Cw1WhitelistContract<'asdf> {
pub const fn new() -> Self {
Self {
admins: Map::new("admins"),
Expand Down
2 changes: 1 addition & 1 deletion examples/contracts/cw20-base/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct Cw20Base<'a> {
#[sv::messages(cw20_allowances as Allowances)]
#[sv::messages(cw20_marketing as Marketing)]
#[sv::messages(cw20_minting as Minting)]
impl Cw20Base<'_> {
impl<'abcd> Cw20Base<'abcd> {
pub const fn new() -> Self {
Self {
token_info: Item::new("token_info"),
Expand Down
4 changes: 2 additions & 2 deletions examples/contracts/generic_contract/src/bin/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn main() {

write_api! {
instantiate: InstantiateMsg<SvCustomMsg>,
execute: ContractExecMsg<SvCustomMsg, SvCustomMsg, SvCustomMsg>,
query: ContractQueryMsg<SvCustomMsg>,
execute: ContractExecMsg<SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg,>,
query: ContractQueryMsg<SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg,>,
}
}
28 changes: 15 additions & 13 deletions examples/contracts/generic_contract/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ where
#[cfg(test)]
mod tests {
use super::sv::mt::CodeId;
use super::{SvCustomMsg, SvCustomQuery};
use super::{GenericContract, SvCustomMsg, SvCustomQuery};
use crate::contract::sv::mt::GenericContractProxy;
use cw_multi_test::IntoBech32;
use sylvia::multitest::App;
Expand All @@ -204,18 +204,20 @@ mod tests {
let app = App::<cw_multi_test::BasicApp<SvCustomMsg, SvCustomQuery>>::custom(|_, _, _| {});
#[allow(clippy::type_complexity)]
let code_id: CodeId<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
String,
GenericContract<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
String,
>,
_,
> = CodeId::store_code(&app);

Expand Down
32 changes: 17 additions & 15 deletions examples/contracts/generic_contract/src/custom_and_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cosmwasm_std::{CosmosMsg, Response, StdError, StdResult};
use custom_and_generic::CustomAndGeneric;
use sylvia::types::{ExecCtx, QueryCtx, SudoCtx};

use crate::contract::{SvCustomMsg, SvCustomQuery};
use crate::contract::{GenericContract, SvCustomMsg, SvCustomQuery};

impl<
InstantiateT,
Expand All @@ -18,7 +18,7 @@ impl<
MigrateT,
FieldT,
> CustomAndGeneric
for crate::contract::GenericContract<
for GenericContract<
InstantiateT,
Exec1T,
Exec2T,
Expand Down Expand Up @@ -104,7 +104,7 @@ impl<

#[cfg(test)]
mod tests {
use super::{SvCustomMsg, SvCustomQuery};
use super::{GenericContract, SvCustomMsg, SvCustomQuery};
use crate::contract::sv::mt::CodeId;
use custom_and_generic::sv::mt::CustomAndGenericProxy;
use cw_multi_test::IntoBech32;
Expand All @@ -114,18 +114,20 @@ mod tests {
fn proxy_methods() {
let app = App::<cw_multi_test::BasicApp<SvCustomMsg, SvCustomQuery>>::custom(|_, _, _| {});
let code_id = CodeId::<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
String,
GenericContract<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
String,
>,
_,
>::store_code(&app);

Expand Down
31 changes: 17 additions & 14 deletions examples/contracts/generic_contract/src/cw1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::contract::GenericContract;
use cosmwasm_std::{CosmosMsg, Response, StdError, StdResult};
use cw1::{CanExecuteResp, Cw1};
use sylvia::types::{ExecCtx, QueryCtx};
Expand All @@ -16,7 +17,7 @@ impl<
MigrateT,
FieldT,
> Cw1
for crate::contract::GenericContract<
for GenericContract<
InstantiateT,
Exec1T,
Exec2T,
Expand Down Expand Up @@ -50,7 +51,7 @@ impl<
#[cfg(test)]
mod tests {
use crate::contract::sv::mt::CodeId;
use crate::contract::{SvCustomMsg, SvCustomQuery};
use crate::contract::{GenericContract, SvCustomMsg, SvCustomQuery};
use cosmwasm_std::{CosmosMsg, Empty};
use cw1::sv::mt::Cw1Proxy;
use cw_multi_test::IntoBech32;
Expand All @@ -60,18 +61,20 @@ mod tests {
fn proxy_methods() {
let app = App::<cw_multi_test::BasicApp<SvCustomMsg, SvCustomQuery>>::custom(|_, _, _| {});
let code_id = CodeId::<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
String,
GenericContract<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
String,
>,
_,
>::store_code(&app);

Expand Down
32 changes: 17 additions & 15 deletions examples/contracts/generic_contract/src/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use generic::Generic;
use serde::Deserialize;
use sylvia::types::{CustomMsg, ExecCtx, QueryCtx, SudoCtx};

use crate::contract::SvCustomMsg;
use crate::contract::{GenericContract, SvCustomMsg};

impl<
InstantiateT,
Expand All @@ -19,7 +19,7 @@ impl<
MigrateT,
FieldT,
> Generic
for crate::contract::GenericContract<
for GenericContract<
InstantiateT,
Exec1T,
Exec2T,
Expand Down Expand Up @@ -117,7 +117,7 @@ where
#[cfg(test)]
mod tests {
use crate::contract::sv::mt::CodeId;
use crate::contract::{SvCustomMsg, SvCustomQuery};
use crate::contract::{GenericContract, SvCustomMsg, SvCustomQuery};
use cosmwasm_std::CosmosMsg;
use cw_multi_test::IntoBech32;
use generic::sv::mt::GenericProxy;
Expand All @@ -128,18 +128,20 @@ mod tests {
let app = App::<cw_multi_test::BasicApp<SvCustomMsg, SvCustomQuery>>::custom(|_, _, _| {});
#[allow(clippy::type_complexity)]
let code_id: CodeId<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
String,
GenericContract<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
String,
>,
_,
> = CodeId::store_code(&app);

Expand Down
6 changes: 3 additions & 3 deletions examples/contracts/generics_forwarded/src/bin/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use cosmwasm_schema::write_api;
#[cfg(not(tarpaulin_include))]
fn main() {
use generics_forwarded::contract::sv::{ContractExecMsg, ContractQueryMsg, InstantiateMsg};
use generics_forwarded::contract::SvCustomMsg;
use generics_forwarded::contract::{SvCustomMsg, SvCustomQuery};

write_api! {
instantiate: InstantiateMsg<SvCustomMsg>,
Expand All @@ -18,7 +18,7 @@ fn main() {
// This potentially could be done with some type alias, not sure how it would affect the
// schema.
// execute: <GenericForwardedContract as ContractApi>::ContractExec,
execute: ContractExecMsg<SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg>,
query: ContractQueryMsg<SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg>,
execute: ContractExecMsg<SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomQuery, String>,
query: ContractQueryMsg<SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomMsg, SvCustomQuery, String>,
}
}
32 changes: 17 additions & 15 deletions examples/contracts/generics_forwarded/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ where
#[cfg(test)]
mod tests {
use super::sv::mt::CodeId;
use super::{SvCustomMsg, SvCustomQuery};
use super::{GenericsForwardedContract, SvCustomMsg, SvCustomQuery};
use crate::contract::sv::mt::GenericsForwardedContractProxy;
use cw_multi_test::IntoBech32;
use sylvia::multitest::App;
Expand All @@ -214,20 +214,22 @@ mod tests {
let app = App::<cw_multi_test::BasicApp<SvCustomMsg, SvCustomQuery>>::custom(|_, _, _| {});
#[allow(clippy::type_complexity)]
let code_id: CodeId<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomQuery,
String,
GenericsForwardedContract<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomQuery,
String,
>,
_,
> = CodeId::store_code(&app);

Expand Down
36 changes: 19 additions & 17 deletions examples/contracts/generics_forwarded/src/custom_and_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use custom_and_generic::CustomAndGeneric;
use serde::Deserialize;
use sylvia::types::{CustomMsg, CustomQuery, ExecCtx, QueryCtx, SudoCtx};

use crate::contract::SvCustomMsg;
use crate::contract::{GenericsForwardedContract, SvCustomMsg};
use crate::error::ContractError;

impl<
Expand All @@ -22,7 +22,7 @@ impl<
CustomQueryT,
FieldT,
> CustomAndGeneric
for crate::contract::GenericsForwardedContract<
for GenericsForwardedContract<
InstantiateT,
Exec1T,
Exec2T,
Expand Down Expand Up @@ -126,7 +126,7 @@ where
#[cfg(test)]
mod tests {
use crate::contract::sv::mt::CodeId;
use crate::contract::{SvCustomMsg, SvCustomQuery};
use crate::contract::{GenericsForwardedContract, SvCustomMsg, SvCustomQuery};
use cosmwasm_std::CosmosMsg;
use custom_and_generic::sv::mt::CustomAndGenericProxy;
use cw_multi_test::IntoBech32;
Expand All @@ -136,20 +136,22 @@ mod tests {
fn proxy_methods() {
let app = App::<cw_multi_test::BasicApp<SvCustomMsg, SvCustomQuery>>::custom(|_, _, _| {});
let code_id = CodeId::<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomQuery,
String,
GenericsForwardedContract<
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomMsg,
SvCustomQuery,
String,
>,
_,
>::store_code(&app);

Expand Down
Loading

0 comments on commit 7d8da72

Please sign in to comment.