pub fn call(
		&mut self,
		dest: T::AccountId,
		value: BalanceOf<T>,
		gas_meter: &mut GasMeter<T>,
		input_data: Vec<u8>,
	) -> ExecResult {
		if self.depth == self.config.max_depth as usize {
			Err(Error::<T>::MaxCallDepthReached)?
		}

		// Assumption: `collect` doesn't collide with overlay because
		// `collect` will be done on first call and destination contract and balance
		// cannot be changed before the first call
		// We do not allow 'calling' plain accounts. For transfering value
		// `seal_transfer` must be used.
		let contract = if let Some(ContractInfo::Alive(info)) = Rent::<T>::collect(&dest) {
			info
		} else {
			Err(Error::<T>::NotCallable)?
		};

		let transactor_kind = self.transactor_kind();
		let caller = self.self_account.clone();

		self.with_nested_context(dest.clone(), contract.trie_id.clone(), |nested| {
			if value > BalanceOf::<T>::zero() {
				transfer(
					TransferCause::Call,
					transactor_kind,
					&caller,
					&dest,
					value,
					nested,
				)?
			}

			let executable = nested.loader.load_main(&contract.code_hash)
				.map_err(|_| Error::<T>::CodeNotFound)?;
			let output = nested.vm.execute(
				&executable,
				nested.new_call_context(caller, value),
				input_data,
				gas_meter,
			).map_err(|e| ExecError { error: e.error, origin: ErrorOrigin::Callee })?;
			Ok(output)
		})
	}
/// Make a call to the specified address, optionally transferring some funds.
Make a call to the specified address, optionally transferring some funds.
Make a call to the specified address optionally transferring some funds .
pub fn call(
		&mut self,
		dest: T::AccountId,
		value: BalanceOf<T>,
		gas_meter: &mut GasMeter<T>,
		input_data: Vec<u8>,
	) -> ExecResult {
		if self.depth == self.config.max_depth as usize {
			Err(Error::<T>::MaxCallDepthReached)?
		}
		// Assumption: `collect` doesn't collide with overlay because
		// `collect` will be done on first call and destination contract and balance
		// cannot be changed before the first call
		// We do not allow 'calling' plain accounts. For transfering value
		// `seal_transfer` must be used.
		let contract = if let Some(ContractInfo::Alive(info)) = Rent::<T>::collect(&dest) {
			info
		} else {
			Err(Error::<T>::NotCallable)?
		};
		let transactor_kind = self.transactor_kind();
		let caller = self.self_account.clone();
		self.with_nested_context(dest.clone(), contract.trie_id.clone(), |nested| {
			if value > BalanceOf::<T>::zero() {
				transfer(
					TransferCause::Call,
					transactor_kind,
					&caller,
					&dest,
					value,
					nested,
				)?
			}
			let executable = nested.loader.load_main(&contract.code_hash)
				.map_err(|_| Error::<T>::CodeNotFound)?;
			let output = nested.vm.execute(
				&executable,
				nested.new_call_context(caller, value),
				input_data,
				gas_meter,
			).map_err(|e| ExecError { error: e.error, origin: ErrorOrigin::Callee })?;
			Ok(output)
		})
	}
pub fn call ( & mut self , dest : T :: AccountId , value : BalanceOf < T > , gas_meter : & mut GasMeter < T > , input_data : Vec < u8 > , ) -> ExecResult { if self . depth == self . config . max_depth as usize { Err ( Error :: < T > :: MaxCallDepthReached ) ? } // Assumption: `collect` doesn't collide with overlay because // `collect` will be done on first call and destination contract and balance // cannot be changed before the first call // We do not allow 'calling' plain accounts. For transfering value // `seal_transfer` must be used. let contract = if let Some ( ContractInfo :: Alive ( info ) ) = Rent :: < T > :: collect ( & dest ) { info } else { Err ( Error :: < T > :: NotCallable ) ? } ; let transactor_kind = self . transactor_kind ( ) ; let caller = self . self_account . clone ( ) ; self . with_nested_context ( dest . clone ( ) , contract . trie_id . clone ( ) , | nested | { if value > BalanceOf :: < T > :: zero ( ) { transfer ( TransferCause :: Call , transactor_kind , & caller , & dest , value , nested , ) ? } let executable = nested . loader . load_main ( & contract . code_hash ) . map_err ( | _ | Error :: < T > :: CodeNotFound ) ? ; let output = nested . vm . execute ( & executable , nested . new_call_context ( caller , value ) , input_data , gas_meter , ) . map_err ( | e | ExecError { error : e . error , origin : ErrorOrigin :: Callee } ) ? ; Ok ( output ) } ) }
Make a call to the specified address, optionally transferring some funds.
Make a call to the specified address optionally transferring some funds .
&mut self
dest
T::AccountId
value
BalanceOf<T>
gas_meter
&mut GasMeter<T>
input_data
Vec<u8>
&mut self
dest
T::AccountId
value
BalanceOf<T>
gas_meter
&mut GasMeter<T>
input_data
Vec<u8>