(
program_id: &Pubkey,
ctx: Context<CreateAccounts>,
metadata: Metadata,
)
| 16 | }; |
| 17 | |
| 18 | pub fn process_create( |
| 19 | program_id: &Pubkey, |
| 20 | ctx: Context<CreateAccounts>, |
| 21 | metadata: Metadata, |
| 22 | ) -> ProgramResult { |
| 23 | // account validation |
| 24 | |
| 25 | require!( |
| 26 | ctx.accounts.authority.is_signer, |
| 27 | ProgramError::MissingRequiredSignature, |
| 28 | "authority" |
| 29 | ); |
| 30 | |
| 31 | require!( |
| 32 | ctx.accounts.stub.is_signer, |
| 33 | ProgramError::MissingRequiredSignature, |
| 34 | "stub" |
| 35 | ); |
| 36 | |
| 37 | let (derived_key, bump) = |
| 38 | Pubkey::find_program_address(&[ctx.accounts.stub.key.as_ref()], program_id); |
| 39 | |
| 40 | require!( |
| 41 | derived_key == *ctx.accounts.asset.key, |
| 42 | ProgramError::InvalidSeeds, |
| 43 | "asset" |
| 44 | ); |
| 45 | |
| 46 | let signer = [ctx.accounts.stub.key.as_ref(), &[bump]]; |
| 47 | |
| 48 | // initialize the extensions |
| 49 | |
| 50 | let data = AttributesBuilder::with_capacity(25) |
| 51 | .add("transfers", &format!("{:>12}", 0)) |
| 52 | .data(); |
| 53 | |
| 54 | let attributes = ExtensionInput { |
| 55 | extension_type: ExtensionType::Attributes, |
| 56 | length: data.len() as u32, |
| 57 | data: Some(data), |
| 58 | }; |
| 59 | |
| 60 | let data = BlobBuilder::with_capacity(2000) |
| 61 | .set_data( |
| 62 | CONTENT_TYPE, |
| 63 | IMAGE.replace("{#RGB#}", "000,000,000").as_bytes(), |
| 64 | ) |
| 65 | .data(); |
| 66 | |
| 67 | let blob = ExtensionInput { |
| 68 | extension_type: ExtensionType::Blob, |
| 69 | length: data.len() as u32, |
| 70 | data: Some(data), |
| 71 | }; |
| 72 | |
| 73 | let data = ProxyBuilder::with_capacity(100) |
| 74 | .set( |
| 75 | program_id, |
no test coverage detected