This is a tool to generate Rust bindings for Solidity contracts to use with the Internet Computer.
```rust contract_abis!("../abi");
threadlocal! {
static ORACLEADDRESSES: RefCell
async fn set_value(symbol: String, value: WrappedU256) { struct Dist { nw: SupportedNetwork, addr: Address, }
for d in ORACLE_ADDRESSES.with(|addresses| {
addresses
.borrow()
.iter()
.map(|(&k, &v)| Dist { nw: k, addr: v })
.collect::<Vec<Dist>>()
}) {
let context = ctx(d.nw).unwrap();
let oracle = IPriceOracle::new(d.addr.clone(), &context); // This is the generated binding
let res = oracle
.set_price(
symbol.to_string().clone(),
value.value(),
Some(call_options()),
)
.await.unwrap();
ic_cdk::println!("set_value: {:?}", res);
}
} fn calloptions() -> Options { let calloptions = CallOptionsBuilder::default() .transform(Some(TransformContext { function: TransformFunc(candid::Func { principal: iccdk::api::id(), method: "transformrequest".tostring(), }), context: vec![], })) .maxresp(None) .cycles(None) .build() .unwrap(); let mut opts = Options::default(); opts.calloptions = Some(calloptions); opts } ```