-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement Proxy contract deployment on context creation, implem…
…ent Update proxy contract, optimized tests so that they catch more variations of responses
- Loading branch information
1 parent
9eb9174
commit 53986b4
Showing
5 changed files
with
274 additions
and
224 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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::CONTEXT_CONFIGS; | ||
|
||
#[ic_cdk::update] | ||
pub fn set_proxy_code(proxy_code: Vec<u8>) -> Result<(), String> { | ||
CONTEXT_CONFIGS.with(|configs| { | ||
let mut configs = configs.borrow_mut(); | ||
|
||
// Check if caller is the owner | ||
if ic_cdk::api::caller() != configs.owner { | ||
return Err("Unauthorized: only owner can set proxy code".to_string()); | ||
} | ||
|
||
configs.proxy_code = Some(proxy_code); | ||
Ok(()) | ||
}) | ||
} |
Oops, something went wrong.