<-->

 

 

 

rankpls

 

    pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
        // your instruction goes here

        let cpi_accounts = chall::cpi::accounts::Init {
            config: ctx.accounts.config.to_account_info(),
            admin: ctx.accounts.mapper.to_account_info(),
            system_program: ctx.accounts.system_program.to_account_info(),
        };
        let cpi_ctx = CpiContext::new(ctx.accounts.chall.to_account_info(), cpi_accounts);
        chall::cpi::init(cpi_ctx)?;

        let cpi_accounts = chall::cpi::accounts::AddBn {
            config: ctx.accounts.config.to_account_info(),
            admin: ctx.accounts.mapper.to_account_info(),
            bn: ctx.accounts.mapper.to_account_info(),
        };
        let cpi_ctx = CpiContext::new(ctx.accounts.chall.to_account_info(), cpi_accounts);
        chall::cpi::add_bn(cpi_ctx)?;

        let cpi_accounts = chall::cpi::accounts::RankMap {
            config: ctx.accounts.config.to_account_info(),
            map: ctx.accounts.map.to_account_info(),
            bn: ctx.accounts.mapper.to_account_info(),
        };
        let cpi_ctx = CpiContext::new(ctx.accounts.chall.to_account_info(), cpi_accounts);
        chall::cpi::rank_map(cpi_ctx)?;


        Ok(())
    }

 

 

 

scorechain

 

    pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
        let cpi_accounts = chall::cpi::accounts::SubmitPlay {
            db: ctx.accounts.db.to_account_info(),
            player: ctx.accounts.user.to_account_info(),
            system_program: ctx.accounts.system_program.to_account_info(),
        };
        let cpi_ctx = CpiContext::new(ctx.accounts.chall.to_account_info(), cpi_accounts);
        chall::cpi::submit_play(cpi_ctx, chall::Play {
            map: String::from("blue zenith"),
            player: String::from("chocomint"),
            pp: 728,
            bounty: 1,
        },)?;
        Ok(())
    }

'writeups' 카테고리의 다른 글

codegate 2024 quals  (0) 2024.06.03
Dreamhack Invitational Quals  (0) 2024.05.03
GCC CTF 2024 - web3  (0) 2024.03.04
LACTF 2024 - zerocoin, remi-s world  (0) 2024.02.19
DiceCTF 2024 Quals - floordrop(blockchain)  (0) 2024.02.05

+ Recent posts