Skip to content

Commit bd83e18

Browse files
committed
WIP adding create v2 API
1 parent b2a2cf9 commit bd83e18

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

crates/env/src/call/create_builder.rs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use crate::{
2424
ExecutionInput,
2525
Selector,
2626
},
27+
types::Gas,
2728
ContractEnv,
2829
Environment,
2930
Error,
@@ -175,7 +176,12 @@ where
175176
/// The code hash of the created contract.
176177
code_hash: E::Hash,
177178
/// The maximum gas costs allowed for the instantiation.
178-
gas_limit: u64,
179+
/// todo: [AJ] ref_time_limit docs
180+
ref_time_limit: Gas,
181+
/// todo: [AJ] `proof_time_limit` docs
182+
proof_time_limit: Gas,
183+
/// todo: [AJ] `storage_deposit_limit` docs
184+
storage_deposit_limit: Option<E::Balance>,
179185
/// The endowment for the instantiated contract.
180186
endowment: E::Balance,
181187
/// The input data for the instantiation.
@@ -198,10 +204,21 @@ where
198204
&self.code_hash
199205
}
200206

201-
/// The gas limit for the contract instantiation.
207+
/// todo: [AJ] ref_time_limit docs
202208
#[inline]
203-
pub fn gas_limit(&self) -> u64 {
204-
self.gas_limit
209+
pub fn ref_time_limit(&self) -> u64 {
210+
self.ref_time_limit
211+
}
212+
213+
/// todo: [AJ] proof_time_limit docs
214+
#[inline]
215+
pub fn proof_time_limit(&self) -> u64 {
216+
self.proof_time_limit
217+
}
218+
219+
/// todo: [AJ] `storage_deposit_limit` docs
220+
pub fn storage_deposit_limit(&self) -> u64 {
221+
self.proof_time_limit
205222
}
206223

207224
/// The endowment for the instantiated contract.
@@ -698,7 +715,7 @@ where
698715
pub fn params(self) -> CreateParams<E, ContractRef, Args, Salt, RetType> {
699716
CreateParams {
700717
code_hash: self.code_hash.value(),
701-
gas_limit: self.gas_limit.unwrap_or_else(|| 0),
718+
ref_time_limit: self.gas_limit.unwrap_or_else(|| 0),
702719
endowment: self.endowment.value(),
703720
exec_input: self.exec_input.value(),
704721
salt_bytes: self.salt.value(),

integration-tests/cross-contract-calls/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod cross_contract_calls {
1919
///
2020
/// To do this we will use the uploaded `code_hash` of `OtherContract`.
2121
#[ink(constructor)]
22-
pub fn new(other_contract: AccountId) -> Self {
22+
pub fn new(other_contract_code_hash: Hash) -> Self {
2323
// todo: need to add instantiate_v2 methods...
2424
let other_contract = OtherContractRef::new(true)
2525
.code_hash(other_contract_code_hash)

0 commit comments

Comments
 (0)