Skip to content
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

Add support for getting contract IDs that would be assigned to deployments #730

Closed
leighmcculloch opened this issue Oct 13, 2022 · 3 comments · Fixed by #1086
Closed

Add support for getting contract IDs that would be assigned to deployments #730

leighmcculloch opened this issue Oct 13, 2022 · 3 comments · Fixed by #1086

Comments

@leighmcculloch
Copy link
Member

leighmcculloch commented Oct 13, 2022

We need to add support for getting contract IDs that would be assigned to deployments.

We have stub functions already in the code for this capability, but they aren't filled in because the host functions don't exist for them to work. For example:

/// Return the ID of the contract defined by the deployer.
#[doc(hidden)]
pub fn id(&self) -> BytesN<32> {
todo!()
}

The reason to provide this functionality is two fold:

  • So that in tests developers can pre-generate a contract ID that they expect will be used later in the test.
  • So that contracts can store the contract ID of a contract given inputs.

Dependent on stellar/rs-soroban-env#538
Blocking stellar/soroban-examples#152

@anupsdf
Copy link
Contributor

anupsdf commented Sep 12, 2023

@leighmcculloch , Can this be closed now that we have get_contract_id host fn?

@leighmcculloch
Copy link
Member Author

The host fn was implemented, but the sdk work to use it has not been completed, which is what this issue is for.

For example:

/// Return the address of the contract defined by the deployer.
#[doc(hidden)]
/// Returns what the address of the contract will be once deployed.
pub fn deployed_address(&self) -> Address {
todo!()
}

/// Return the address of the contract defined by the deployer.
#[doc(hidden)]
pub fn contract_address(&self) -> Address {
todo!()
}

Also interesting note those two functions used to be named the same, and should still be named the same. Strange that one has been renamed without the other.

@leighmcculloch
Copy link
Member Author

Closed by #1086

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants