-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consider contract address length for instantiate2 #97
Merged
taitruong
merged 6 commits into
public-awesome:main
from
arkprotocol:contract_address_length
May 31, 2024
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
be03613
consider contract address length for instantiate2
taitruong 64ec72b
instantiate and migrate with contract_addr_length
taitruong f87d740
query ContractAddrLength, cleanup, schema
taitruong 333cccb
use u32 instead of usize
taitruong 79a3988
cargo schema
taitruong 482054d
cleanup
taitruong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 10 additions & 0 deletions
10
packages/ics721/schema/raw/response_to_contract_addr_length.json
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,10 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Nullable_uint", | ||
"type": [ | ||
"integer", | ||
"null" | ||
], | ||
"format": "uint", | ||
"minimum": 0.0 | ||
} |
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 |
---|---|---|
|
@@ -31,6 +31,8 @@ pub struct InstantiateMsg { | |
pub pauser: Option<String>, | ||
/// The admin address for instantiating new cw721 contracts. In case of None, contract is immutable. | ||
pub cw721_admin: Option<String>, | ||
/// The optional contract address length being used for instantiate2. In case of None, default length is 32 (standard in cosmwasm). | ||
pub contract_addr_length: Option<usize>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. usize has different sizes in dev and production. Better use u32 here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed and changed to u32 |
||
} | ||
|
||
#[cw_serde] | ||
|
@@ -162,6 +164,10 @@ pub enum QueryMsg { | |
#[returns(Option<Option<::cosmwasm_std::Addr>>)] | ||
Cw721Admin {}, | ||
|
||
/// Gets the contract address length being used for instantiate2. In case of None, default length is 32 (standard in cosmwasm). | ||
#[returns(Option<usize>)] | ||
ContractAddrLength {}, | ||
|
||
/// Gets a list of classID as key (from | ||
/// NonFungibleTokenPacketData) and cw721 contract as value | ||
/// (instantiated for that classID). | ||
|
@@ -212,5 +218,7 @@ pub enum MigrateMsg { | |
cw721_base_code_id: Option<u64>, | ||
/// The admin address for instantiating new cw721 contracts. In case of "", contract is immutable. | ||
cw721_admin: Option<String>, | ||
/// The optional contract address length being used for instantiate2. In case of None, default length is 32 (standard in cosmwasm). | ||
contract_addr_length: Option<usize>, | ||
}, | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the main logic for slicing addr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@humanalgorithm look here, for Injective
CONTRACT_ADDR_LENGTH
is set with20
. All other chains have no entry inCONTRACT_ADDR_LENGTH
storage.Value is then used for slicing first 20 bytes:
canonical_cw721_addr[..len]