-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add submsg impl to allow failure in cosmos stargate call and set upgrade handler for testnet upgrade * add diff command * fix condition * change default csr to zero * fix review comments * change comment
- Loading branch information
Showing
15 changed files
with
336 additions
and
48 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
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,49 @@ | ||
module TestAccount::submsg { | ||
use std::cosmos; | ||
use std::string::String; | ||
use std::event; | ||
use std::signer; | ||
|
||
public entry fun stargate( | ||
account: &signer, | ||
data: vector<u8>, | ||
allow_failure: bool, | ||
id: u64, // callback id | ||
fid: String, // function id | ||
) { | ||
if (allow_failure) { | ||
cosmos::stargate_with_options(account, data, cosmos::allow_failure_with_callback(id, fid)); | ||
} else { | ||
cosmos::stargate_with_options(account, data, cosmos::disallow_failure_with_callback(id, fid)); | ||
} | ||
} | ||
|
||
#[event] | ||
struct ResultEvent has drop { | ||
id: u64, | ||
success: bool, | ||
} | ||
|
||
#[event] | ||
struct ResultEventWithSigner has drop { | ||
account: address, | ||
id: u64, | ||
success: bool, | ||
} | ||
|
||
public entry fun callback_with_signer( | ||
account: &signer, | ||
id: u64, | ||
success: bool, | ||
) { | ||
event::emit(ResultEventWithSigner { account: signer::address_of(account), id, success }); | ||
|
||
} | ||
|
||
public entry fun callback_without_signer( | ||
id: u64, | ||
success: bool, | ||
) { | ||
event::emit(ResultEvent { id, success }); | ||
} | ||
} |
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
Oops, something went wrong.