Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add configurable component authority & Simplify the Components/System API #14

Merged
merged 19 commits into from
Feb 20, 2024

Conversation

GabrielePicco
Copy link
Contributor

@GabrielePicco GabrielePicco commented Feb 15, 2024

Feature: Add configurable component authority & Simplify the Components/System API

Status Type ⚠️ Core Change Issue
Ready Feature/Tooling Yes #9

Problem

Solution

  • Simplify the components/systems API

Components:

#[component]
#[derive(Copy)]
pub struct Position {
    pub x: i64,
    pub y: i64,
    pub z: i64,
}

Systems:

#[system]
pub mod system_fly {

    pub fn execute(ctx: Context<Components>, _args: Vec<u8>) -> Result<Components> {
        let pos = &mut ctx.accounts.position;
        pos.z += 1;
        Ok(ctx.accounts)
    }

    #[system_input]
    pub struct Components {
        pub position: Position,
    }
}
  • Add a configurable authority on each component
  • Add authority checks on update and CPI constraints on the caller

Issues

Closes #9

@GabrielePicco GabrielePicco self-assigned this Feb 15, 2024
@GabrielePicco GabrielePicco merged commit 4661d15 into main Feb 20, 2024
8 checks passed
@GabrielePicco GabrielePicco deleted the feat/component-authority branch February 20, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a configurable authority on the components
1 participant