-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Generic cw1-whitelist example (#404)
Part of #399. Makes generic the contracts cw1-whitelist and cw1-subkeys on the examples. The latter depends on the former. --------- Co-authored-by: Jan Woźniak <[email protected]>
- Loading branch information
Showing
22 changed files
with
149 additions
and
141 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
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
use cosmwasm_schema::write_api; | ||
|
||
use cosmwasm_std::Empty; | ||
use cw1_subkeys::contract::sv::{ContractExecMsg, ContractQueryMsg, InstantiateMsg}; | ||
|
||
#[cfg(not(tarpaulin_include))] | ||
fn main() { | ||
write_api! { | ||
instantiate: InstantiateMsg, | ||
execute: ContractExecMsg, | ||
query: ContractQueryMsg, | ||
execute: ContractExecMsg<Empty, Empty>, | ||
query: ContractQueryMsg<Empty, Empty>, | ||
} | ||
} |
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 |
---|---|---|
@@ -1,27 +1,35 @@ | ||
use cosmwasm_std::{Empty, Response, StdResult}; | ||
use sylvia::types::{ExecCtx, QueryCtx}; | ||
use cosmwasm_std::{Response, StdResult}; | ||
use sylvia::types::{CustomMsg, CustomQuery, ExecCtx, QueryCtx}; | ||
use whitelist::responses::AdminListResponse; | ||
use whitelist::Whitelist; | ||
|
||
use crate::contract::Cw1SubkeysContract; | ||
use crate::error::ContractError; | ||
|
||
impl Whitelist for Cw1SubkeysContract { | ||
impl<E, Q> Whitelist for Cw1SubkeysContract<E, Q> | ||
where | ||
E: CustomMsg + 'static, | ||
Q: CustomQuery + 'static, | ||
{ | ||
type Error = ContractError; | ||
type ExecC = Empty; | ||
type QueryC = Empty; | ||
type ExecC = E; | ||
type QueryC = Q; | ||
|
||
fn freeze(&self, ctx: ExecCtx) -> Result<Response, Self::Error> { | ||
fn freeze(&self, ctx: ExecCtx<Self::QueryC>) -> Result<Response<Self::ExecC>, Self::Error> { | ||
self.whitelist.freeze(ctx).map_err(From::from) | ||
} | ||
|
||
fn update_admins(&self, ctx: ExecCtx, admins: Vec<String>) -> Result<Response, Self::Error> { | ||
fn update_admins( | ||
&self, | ||
ctx: ExecCtx<Self::QueryC>, | ||
admins: Vec<String>, | ||
) -> Result<Response<Self::ExecC>, Self::Error> { | ||
self.whitelist | ||
.update_admins(ctx, admins) | ||
.map_err(From::from) | ||
} | ||
|
||
fn admin_list(&self, ctx: QueryCtx) -> StdResult<AdminListResponse> { | ||
fn admin_list(&self, ctx: QueryCtx<Self::QueryC>) -> StdResult<AdminListResponse> { | ||
self.whitelist.admin_list(ctx) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
use cosmwasm_schema::write_api; | ||
|
||
use cosmwasm_std::Empty; | ||
use cw1_whitelist::contract::sv::{ContractExecMsg, ContractQueryMsg, InstantiateMsg}; | ||
|
||
#[cfg(not(tarpaulin_include))] | ||
fn main() { | ||
write_api! { | ||
instantiate: InstantiateMsg, | ||
execute: ContractExecMsg, | ||
query: ContractQueryMsg, | ||
execute: ContractExecMsg<Empty, Empty>, | ||
query: ContractQueryMsg<Empty, Empty>, | ||
} | ||
} |
Oops, something went wrong.