Skip to content

Commit

Permalink
WIP adding create v2 API
Browse files Browse the repository at this point in the history
  • Loading branch information
ascjones committed Feb 1, 2024
1 parent b2a2cf9 commit bd83e18
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
27 changes: 22 additions & 5 deletions crates/env/src/call/create_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::{
ExecutionInput,
Selector,
},
types::Gas,
ContractEnv,
Environment,
Error,
Expand Down Expand Up @@ -175,7 +176,12 @@ where
/// The code hash of the created contract.
code_hash: E::Hash,
/// The maximum gas costs allowed for the instantiation.
gas_limit: u64,
/// todo: [AJ] ref_time_limit docs
ref_time_limit: Gas,
/// todo: [AJ] `proof_time_limit` docs
proof_time_limit: Gas,
/// todo: [AJ] `storage_deposit_limit` docs
storage_deposit_limit: Option<E::Balance>,
/// The endowment for the instantiated contract.
endowment: E::Balance,
/// The input data for the instantiation.
Expand All @@ -198,10 +204,21 @@ where
&self.code_hash
}

/// The gas limit for the contract instantiation.
/// todo: [AJ] ref_time_limit docs
#[inline]
pub fn gas_limit(&self) -> u64 {
self.gas_limit
pub fn ref_time_limit(&self) -> u64 {
self.ref_time_limit
}

/// todo: [AJ] proof_time_limit docs
#[inline]
pub fn proof_time_limit(&self) -> u64 {
self.proof_time_limit
}

/// todo: [AJ] `storage_deposit_limit` docs
pub fn storage_deposit_limit(&self) -> u64 {
self.proof_time_limit
}

/// The endowment for the instantiated contract.
Expand Down Expand Up @@ -698,7 +715,7 @@ where
pub fn params(self) -> CreateParams<E, ContractRef, Args, Salt, RetType> {
CreateParams {
code_hash: self.code_hash.value(),
gas_limit: self.gas_limit.unwrap_or_else(|| 0),
ref_time_limit: self.gas_limit.unwrap_or_else(|| 0),
endowment: self.endowment.value(),
exec_input: self.exec_input.value(),
salt_bytes: self.salt.value(),
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/cross-contract-calls/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod cross_contract_calls {
///
/// To do this we will use the uploaded `code_hash` of `OtherContract`.
#[ink(constructor)]
pub fn new(other_contract: AccountId) -> Self {
pub fn new(other_contract_code_hash: Hash) -> Self {
// todo: need to add instantiate_v2 methods...
let other_contract = OtherContractRef::new(true)
.code_hash(other_contract_code_hash)
Expand Down

0 comments on commit bd83e18

Please sign in to comment.