-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b8fa45
commit af41c54
Showing
3 changed files
with
20 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
mod private; | ||
mod superadmin; | ||
|
||
pub use crate::permissions::superadmin::{ | ||
ensure_super_admin, is_super_admin, not_super_admin_error, | ||
}; | ||
|
||
pub use crate::permissions::private::{ensure_private, not_self_contract_error}; |
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,16 @@ | ||
use cosmwasm_std::{Addr, Env}; | ||
use cosmwasm_std::{StdError, StdResult}; | ||
|
||
const ERR_NOT_SELF_CONTRACT: &str = "[FET_ERR_NOT_SELF] Sender is not a self contract."; | ||
|
||
pub fn ensure_private(env: &Env, address: &Addr) -> StdResult<()> { | ||
if env.contract.address != address { | ||
return Err(not_self_contract_error()); | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn not_self_contract_error() -> StdError { | ||
StdError::generic_err(ERR_NOT_SELF_CONTRACT) | ||
} |
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