# Purr-fect Chaos - Metaplex Track submission
Due to certain reasons, we are unable to make the repository public. Apologies for the inconvenience. If the board members would like to review our code, please feel free to reach out to us via Twitter or Telegram. We are more than happy to provide support:
Twitter: https://x.com/trankhac_vy
Telegram: @khacvy
**Purrfect Chao**s is a fully on-chain social game that leverages the power of Metaplex Core.
Users need to mint a cat to play the game. Each cat is a Metaplex Core NFT:
- We use **Permanent Freeze Delegate** to freeze the asset, preventing users from transferring it to others. This ensures fair gameplay and prevents cheating.
```
plugin.push(PluginAuthorityPair {
plugin: Plugin::PermanentFreezeDelegate(PermanentFreezeDelegate { frozen: true }),
authority: Some(PluginAuthority::UpdateAuthority),
});
```
- By using the **Attribute Plugin**, we store all the cat's attributes on-chain, making the game transparent. These attributes are updated based on in-game actions; for example, cleaning will increase HP, while being attacked will reduce HP and deduct points.
```
let attributes = pet.to_attributes();
plugin.push(PluginAuthorityPair {
plugin: Plugin::Attributes(attributes),
authority: Some(PluginAuthority::UpdateAuthority),
});
CreateV2CpiBuilder::new(&ctx.accounts.mpl_core_program.to_account_info())
.asset(&ctx.accounts.pet_mint.to_account_info())
.collection(Some(&ctx.accounts.collection_mint.to_account_info()))
.payer(&ctx.accounts.payer.to_account_info())
.authority(Some(&ctx.accounts.season.to_account_info()))
.owner(Some(&ctx.accounts.payer.to_account_info()))
.system_program(&ctx.accounts.system_program.to_account_info())
.name(name.clone())
.uri(uri)
.plugins(plugin)
.invoke_signed(&[&ctx.accounts.season.seeds()])?;
```
```
pub fn update_nft_attributes<'info>(
program: &UncheckedAccount<'info>,
pet_account: &Account<'info, BaseAssetV1>,
collection_mint: &Account<'info, BaseCollectionV1>,
payer: &Signer<'info>,
authority: &AccountInfo<'info>,
system_program: &Program<'info, System>,
pet: &Pet,
seeds: &[&[&[u8]]],
) -> Result<()> {
UpdatePluginV1CpiBuilder::new(&program.to_account_info())
.asset(&pet_account.to_account_info())
.collection(Some(&collection_mint.to_account_info()))
.payer(&payer.to_account_info())
.authority(Some(&authority.to_account_info()))
.system_program(&system_program.to_account_info())
.plugin(Plugin::Attributes(pet.to_attributes()))
.invoke_signed(seeds)
.map_err(|error| error.into())
}
```