MCPcopy Create free account
hub / github.com/JumpCrypto/sol-arc / instance_registry

Function instance_registry

programs/registry/src/lib.rs:40–65  ·  view source on GitHub ↗

* Instance World should normally be regulated by governance; * In this case, we allow anyone to instance a new dominari registry. * We also set the Instance Authority for the World to the Payer * This authority is the only one that can add action_bundles to a given instance */

(ctx:Context<InstanceRegistry>, instance:u64)

Source from the content-addressed store, hash-verified

38 * This authority is the only one that can add action_bundles to a given instance
39 */
40 pub fn instance_registry(ctx:Context<InstanceRegistry>, instance:u64) -> Result<()> {
41 let core_ds = ctx.accounts.core_ds.to_account_info();
42 let accounts = core_ds::cpi::accounts::InitRegistryInstance {
43 payer: ctx.accounts.payer.to_account_info(),
44 system_program: ctx.accounts.system_program.to_account_info(),
45 registry_instance: ctx.accounts.registry_instance.to_account_info(),
46 registry_signer: ctx.accounts.registry_config.to_account_info()
47 };
48 let registry_signer_seeds:&[&[u8]] = &[
49 b"registry_signer",
50 &[*ctx.bumps.get("registry_config").unwrap()]
51 ];
52 let signer_seeds = &[registry_signer_seeds];
53
54 let register_registry_ctx = CpiContext::new_with_signer(
55 core_ds,
56 accounts,
57 signer_seeds
58 );
59
60 core_ds::cpi::init_registry(register_registry_ctx, ctx.program_id.key(), instance)?;
61 ctx.accounts.instance_authority.instance = instance;
62 ctx.accounts.instance_authority.authority = ctx.accounts.payer.key(); // fancier Worlds might have different governance setup for this
63
64 Ok(())
65 }
66
67 /**
68 * Anyone can register new components as long as they use unique URIs

Callers

nothing calls this directly

Calls 1

init_registryFunction · 0.85

Tested by

no test coverage detected