MCPcopy Create free account
hub / github.com/cowprotocol/services / generate_binding

Function generate_binding

contracts/src/codegen.rs:382–415  ·  view source on GitHub ↗
(instance: &mut SolMacroGen, all_derives: bool)

Source from the content-addressed store, hash-verified

380}
381
382fn generate_binding(instance: &mut SolMacroGen, all_derives: bool) -> Result<()> {
383 let input = instance
384 .get_sol_input()
385 .map_err(|err| anyhow::anyhow!("{:?}", err))?
386 .normalize_json()
387 .map_err(|err| anyhow::anyhow!("{:?}", err))?;
388 let SolInput {
389 attrs: _,
390 path: _,
391 kind,
392 } = input;
393
394 let tokens = match kind {
395 SolInputKind::Sol(mut file) => {
396 let sol_attr: syn::Attribute = if all_derives {
397 syn::parse_quote! {
398 #[sol(rpc, alloy_sol_types = alloy_sol_types, alloy_contract =
399 alloy_contract, all_derives = true)]
400 }
401 } else {
402 syn::parse_quote! {
403 #[sol(rpc, alloy_sol_types = alloy_sol_types, alloy_contract =
404 alloy_contract)]
405 }
406 };
407 file.attrs.push(sol_attr);
408 expand(file)?
409 }
410 _ => unreachable!(),
411 };
412
413 instance.expansion = Some(tokens);
414 Ok(())
415}
416
417struct NetworkArm(u64, (String, Option<u64>));
418

Callers 1

generate_codeMethod · 0.85

Calls 1

get_sol_inputMethod · 0.80

Tested by

no test coverage detected