fn call_contract_checked(
        &mut self,
        contract_package: ContractPackage,
        contract_hash: ContractHash,
        contract: Contract,
        entry_point: EntryPoint,
        args: RuntimeArgs,
    ) -> Result<CLValue, Error> {
        // if public, allowed
        // if not public, restricted to user group access
        self.validate_entry_point_access(&contract_package, entry_point.access())?;

        // This will skip arguments check for system contracts only. This code should be removed on
        // next major version bump. Argument checks for system contract is still done during
        // execution of a system contract.
        if !self
            .context
            .system_contract_registry()?
            .values()
            .any(|&system_hash| system_hash == contract_hash)
        {
            let entry_point_args_lookup: BTreeMap<&str, &Parameter> = entry_point
                .args()
                .iter()
                .map(|param| {
                    // Skips all optional parameters
                    (param.name(), param)
                })
                .collect();

            let args_lookup: BTreeMap<&str, &NamedArg> = args
                .named_args()
                .map(|named_arg| (named_arg.name(), named_arg))
                .collect();

            // ensure args type(s) match defined args of entry point

            for (param_name, param) in entry_point_args_lookup {
                if let Some(named_arg) = args_lookup.get(param_name) {
                    if param.cl_type() != named_arg.cl_value().cl_type() {
                        return Err(Error::type_mismatch(
                            param.cl_type().clone(),
                            named_arg.cl_value().cl_type().clone(),
                        ));
                    }
                } else if !param.cl_type().is_option() {
                    return Err(Error::MissingArgument {
                        name: param.name().to_string(),
                    });
                }
            }
        }

        // if session the caller's context
        // else the called contract's context
        let context_key = self.get_context_key_for_contract_call(contract_hash, &entry_point)?;

        self.execute_contract(
            context_key,
            context_key,
            contract_hash,
            contract,
            args,
            entry_point,
            self.context.protocol_version(),
        )
    }
/// Calls contract if caller has access, and args match entry point definition
Calls contract if caller has access, and args match entry point definition
Calls contract if caller has access and args match entry point definition
fn call_contract_checked(
        &mut self,
        contract_package: ContractPackage,
        contract_hash: ContractHash,
        contract: Contract,
        entry_point: EntryPoint,
        args: RuntimeArgs,
    ) -> Result<CLValue, Error> {
        // if public, allowed
        // if not public, restricted to user group access
        self.validate_entry_point_access(&contract_package, entry_point.access())?;
        // This will skip arguments check for system contracts only. This code should be removed on
        // next major version bump. Argument checks for system contract is still done during
        // execution of a system contract.
        if !self
            .context
            .system_contract_registry()?
            .values()
            .any(|&system_hash| system_hash == contract_hash)
        {
            let entry_point_args_lookup: BTreeMap<&str, &Parameter> = entry_point
                .args()
                .iter()
                .map(|param| {
                    // Skips all optional parameters
                    (param.name(), param)
                })
                .collect();
            let args_lookup: BTreeMap<&str, &NamedArg> = args
                .named_args()
                .map(|named_arg| (named_arg.name(), named_arg))
                .collect();
            // ensure args type(s) match defined args of entry point
            for (param_name, param) in entry_point_args_lookup {
                if let Some(named_arg) = args_lookup.get(param_name) {
                    if param.cl_type() != named_arg.cl_value().cl_type() {
                        return Err(Error::type_mismatch(
                            param.cl_type().clone(),
                            named_arg.cl_value().cl_type().clone(),
                        ));
                    }
                } else if !param.cl_type().is_option() {
                    return Err(Error::MissingArgument {
                        name: param.name().to_string(),
                    });
                }
            }
        }
        // if session the caller's context
        // else the called contract's context
        let context_key = self.get_context_key_for_contract_call(contract_hash, &entry_point)?;
        self.execute_contract(
            context_key,
            context_key,
            contract_hash,
            contract,
            args,
            entry_point,
            self.context.protocol_version(),
        )
    }
fn call_contract_checked ( & mut self , contract_package : ContractPackage , contract_hash : ContractHash , contract : Contract , entry_point : EntryPoint , args : RuntimeArgs , ) -> Result < CLValue , Error > { // if public, allowed // if not public, restricted to user group access self . validate_entry_point_access ( & contract_package , entry_point . access ( ) ) ? ; // This will skip arguments check for system contracts only. This code should be removed on // next major version bump. Argument checks for system contract is still done during // execution of a system contract. if ! self . context . system_contract_registry ( ) ? . values ( ) . any ( | & system_hash | system_hash == contract_hash ) { let entry_point_args_lookup : BTreeMap < & str , & Parameter > = entry_point . args ( ) . iter ( ) . map ( | param | { // Skips all optional parameters ( param . name ( ) , param ) } ) . collect ( ) ; let args_lookup : BTreeMap < & str , & NamedArg > = args . named_args ( ) . map ( | named_arg | ( named_arg . name ( ) , named_arg ) ) . collect ( ) ; // ensure args type(s) match defined args of entry point for ( param_name , param ) in entry_point_args_lookup { if let Some ( named_arg ) = args_lookup . get ( param_name ) { if param . cl_type ( ) != named_arg . cl_value ( ) . cl_type ( ) { return Err ( Error :: type_mismatch ( param . cl_type ( ) . clone ( ) , named_arg . cl_value ( ) . cl_type ( ) . clone ( ) , ) ) ; } } else if ! param . cl_type ( ) . is_option ( ) { return Err ( Error :: MissingArgument { name : param . name ( ) . to_string ( ) , } ) ; } } } // if session the caller's context // else the called contract's context let context_key = self . get_context_key_for_contract_call ( contract_hash , & entry_point ) ? ; self . execute_contract ( context_key , context_key , contract_hash , contract , args , entry_point , self . context . protocol_version ( ) , ) }
Calls contract if caller has access, and args match entry point definition
Calls contract if caller has access and args match entry point definition
&mut self
contract_package
ContractPackage
contract_hash
ContractHash
contract
Contract
entry_point
EntryPoint
args
RuntimeArgs
&mut self
contract_package
ContractPackage
contract_hash
ContractHash
contract
Contract
entry_point
EntryPoint
args
RuntimeArgs