-
Notifications
You must be signed in to change notification settings - Fork 45
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 host functions that calculate contract IDs from inputs #538
Comments
@leighmcculloch Is this issue still relevant? Most of the mentioned host functions have been removed and the mentioned issue has been closed. |
Yeah it should be possible for us to write an SDK function that helps a developer predetermine a contract ID that would be the contract ID of a contract when deployed. |
The infrastructure around deployments has changed a lot, so the examples in the original issue are out of date, but the problem remains. |
We currently have two host functions for creating a contract:
So we just need two additional host functions given the same arguments and returns the contract_id without creating?
@leighmcculloch Can you confirm if this statement is outdated? |
I think we could probably defer this. I suspect someone will need it, but it can be added at any point. |
@leighmcculloch I've created the PR above which adds two new host functions corresponding to contract and asset contract. I think this should cover all the scenarios originally requested to unblock the sdk? Let me know if that's not the case. |
@jayz22 It looks great 👏🏻. That was fast! |
We need a set of host functions that will return contract ID (as Bytes) given a set of inputs.
We have the following functions that can create contracts:
rs-soroban-env/soroban-env-common/src/env.rs
Lines 307 to 321 in 4f2f3a2
In total we need to add
12
new host functions:7
new host functions that are counter-parts to the host functions above, that will return the contract ID that will be used if the deployment was to occur by calling the respective function.get_contract_id_contract_from_ed25519(salt: Object, key: Object) -> Object
get_contract_id_contract_from_contract(salt: Object) -> Object
get_contract_id_contract_from_source_account(salt: Object) -> Object
get_contract_id_token_from_ed25519(salt: Object, key: Object) -> Object
get_contract_id_token_from_contract(salt: Object) -> Object
get_contract_id_token_from_source_account(salt: Object) -> Object
get_contract_id_token_from_asset(asset: Object) -> Object
2
new host functions for getting the contract ID for a deployment from contract that isn't the currently executing contract.get_contract_id_contract_from_other_contract(contract_id: RawVal, salt: Object) -> Object
get_contract_id_token_from_other_contract(contract_id: RawVal, salt: Object) -> Object
We can omit any of these host functions that would always return the same value given the same inputs. For example, I expect we can omit all the token functions except the one that accepts an asset,
Dependent on #537
Blocking stellar/rs-soroban-sdk#730
The text was updated successfully, but these errors were encountered: