abstract icon indicating copy to clipboard operation
abstract copied to clipboard

Integrate Nois into the Abstract SDK and app

Open adairrr opened this issue 1 year ago • 1 comments

This change adds a nois feature to the abstract-sdk and abstract-app which contract devs can enable to access the Nois api.

The callback handler should be added to their app like so:

const DCA_APP: DCAApp = DCAApp::new(DCA_APP_ID, DCA_APP_VERSION, None)
    .with_instantiate(handlers::instantiate_handler)
    .with_execute(handlers::execute_handler)
    .with_query(handlers::query_handler)
    // Nois callback
    .with_nois_callback(handlers::nois_calback_handler);
    
...

Then, in their contract they can do:

let job_id = "my_job";
let nois = app.nois(deps.as_ref());

let random_msg = nois.next_randomness(job_id, info.funds)?;

Ok(Response::new().add_message(random_msg))

Behind the scenes, the implementation reaches out to ANS to retrieve the nois proxy address.

Note

  • Right now this takes a git dependency on the nois-proxy because they haven't published their packages. We must remove this entirely if we are to merge this change as it will prevent us from publishing. I've already reached out to their team to get it published.
  • Nois proxy does not implement cw2, meaning that it can't be registered as a module in abstract.

Wants

  • Nois payment options in SDK
  • Nois deployment using cw-orchestrator for interchain integrations (maybe with polytone)?
  • Include randomness parsers within nois feature for SDK for easier access
  • Nois proxy as Abstract App for better interchain management.

adairrr avatar Jul 30 '23 21:07 adairrr