Seller monopoly
This commit is contained in:
parent
6993766862
commit
67e0c72c82
|
|
@ -5,7 +5,7 @@ resolution = true
|
||||||
skip-lint = false
|
skip-lint = false
|
||||||
|
|
||||||
[programs.localnet]
|
[programs.localnet]
|
||||||
tournaments = "88dRZraTvmpqMs8GqtgCc321Foo5bWtDAsXJ1kqoc6nC"
|
tournaments = "3owEKMMjFuuYN2HjT2J2GiVauDivNBeYqaUymyX7Q8Lw"
|
||||||
|
|
||||||
[registry]
|
[registry]
|
||||||
url = "https://api.apr.dev"
|
url = "https://api.apr.dev"
|
||||||
|
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
use anchor_lang::prelude::*;
|
|
||||||
use anchor_spl::{
|
|
||||||
associated_token::AssociatedToken, token_interface::{Mint, TokenAccount, TokenInterface, close_account, transfer_checked, CloseAccount, TransferChecked}
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{Sales, DataRegistry, DATA_REGISTRY_SEED};
|
|
||||||
|
|
||||||
use super::transfer_tokens;
|
|
||||||
|
|
||||||
#[derive(Accounts)]
|
|
||||||
pub struct AddSeller <'info>{
|
|
||||||
#[account(mut)]
|
|
||||||
pub seller: Signer<'info>,
|
|
||||||
|
|
||||||
// #[account(
|
|
||||||
// mut,
|
|
||||||
// associated_token::mint=mint,
|
|
||||||
// associated_token::authority = seller,
|
|
||||||
// associated_token::token_program= token_program,
|
|
||||||
// )]
|
|
||||||
// pub seller_token_account: InterfaceAccount<'info, TokenAccount>,
|
|
||||||
|
|
||||||
#[account(
|
|
||||||
init,
|
|
||||||
payer = seller,
|
|
||||||
space = 8 + Sales::INIT_SPACE,
|
|
||||||
seeds= [b"sales", seller.key().as_ref()],
|
|
||||||
bump
|
|
||||||
)]
|
|
||||||
pub sales: Account<'info, Sales>,
|
|
||||||
|
|
||||||
#[account(mint::token_program = token_program)]
|
|
||||||
pub mint: InterfaceAccount<'info, Mint>,
|
|
||||||
|
|
||||||
#[account(
|
|
||||||
init,
|
|
||||||
payer =seller,
|
|
||||||
associated_token::mint=mint,
|
|
||||||
associated_token::authority = sales,
|
|
||||||
associated_token::token_program= token_program,
|
|
||||||
)]
|
|
||||||
pub vault: InterfaceAccount<'info, TokenAccount>,
|
|
||||||
|
|
||||||
#[account(
|
|
||||||
mut,
|
|
||||||
seeds=[DATA_REGISTRY_SEED],
|
|
||||||
bump
|
|
||||||
)]
|
|
||||||
pub data_registry: Account<'info, DataRegistry>,
|
|
||||||
|
|
||||||
pub system_program: Program<'info, System>,
|
|
||||||
pub token_program: Interface<'info, TokenInterface>,
|
|
||||||
pub associated_token_program: Program<'info, AssociatedToken>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// pub fn send_tickets_to_vault(ctx: &Context<AddSeller>, tickets_count: u64) -> Result<()>{
|
|
||||||
// transfer_tokens(
|
|
||||||
// &ctx.accounts.seller_token_account,
|
|
||||||
// &ctx.accounts.vault,
|
|
||||||
// &tickets_count,
|
|
||||||
// &ctx.accounts.mint,
|
|
||||||
// &ctx.accounts.seller,
|
|
||||||
// &ctx.accounts.token_program
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
pub fn save_sales_account(ctx: Context<AddSeller>) -> Result<()> {
|
|
||||||
ctx.accounts.sales.set_inner(
|
|
||||||
Sales{
|
|
||||||
seller: ctx.accounts.seller.key(),
|
|
||||||
vault: ctx.accounts.vault.key(),
|
|
||||||
mint: ctx.accounts.mint.key(),
|
|
||||||
bump: ctx.bumps.sales
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
ctx.accounts.data_registry.sales_pdas.push(ctx.accounts.sales.key());
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
use anchor_lang::prelude::*;
|
use anchor_lang::prelude::*;
|
||||||
use anchor_spl:: token::{Mint, Token, TokenAccount};
|
use anchor_spl::{
|
||||||
|
associated_token::AssociatedToken, token_interface::{Mint, TokenAccount, TokenInterface, close_account, transfer_checked, CloseAccount, TransferChecked}
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::{ DataRegistry, DATA_REGISTRY_SEED};
|
||||||
use crate::{Sales, DataRegistry, DATA_REGISTRY_SEED};
|
|
||||||
|
|
||||||
#[derive(Accounts)]
|
#[derive(Accounts)]
|
||||||
pub struct Initialize <'info>{
|
pub struct Initialize <'info>{
|
||||||
|
|
@ -18,12 +19,26 @@ pub struct Initialize <'info>{
|
||||||
)]
|
)]
|
||||||
pub data_registry: Account<'info, DataRegistry>,
|
pub data_registry: Account<'info, DataRegistry>,
|
||||||
|
|
||||||
|
#[account(mint::token_program = token_program)]
|
||||||
|
pub mint: InterfaceAccount<'info, Mint>,
|
||||||
|
#[account(
|
||||||
|
init,
|
||||||
|
payer =signer,
|
||||||
|
associated_token::mint=mint,
|
||||||
|
associated_token::authority = data_registry,
|
||||||
|
associated_token::token_program= token_program,
|
||||||
|
)]
|
||||||
|
pub vault: InterfaceAccount<'info, TokenAccount>,
|
||||||
|
|
||||||
pub system_program: Program<'info, System>,
|
pub system_program: Program<'info, System>,
|
||||||
|
pub token_program: Interface<'info, TokenInterface>,
|
||||||
|
pub associated_token_program: Program<'info, AssociatedToken>
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handler(ctx: Context<Initialize>) -> Result<()> {
|
pub fn handler(ctx: Context<Initialize>) -> Result<()> {
|
||||||
let reg_acc = &mut ctx.accounts.data_registry;
|
let reg_acc = &mut ctx.accounts.data_registry;
|
||||||
reg_acc.authority = ctx.accounts.signer.key();
|
reg_acc.authority = ctx.accounts.signer.key();
|
||||||
|
reg_acc.sales_pda = ctx.accounts.vault.key();
|
||||||
msg!("Initiated Ticket store");
|
msg!("Initiated Ticket store");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use anchor_lang::prelude::*;
|
use anchor_lang::prelude::*;
|
||||||
use crate::{DataRegistry, Sales, Tournament, DATA_REGISTRY_SEED};
|
use crate::{DataRegistry,Tournament, DATA_REGISTRY_SEED};
|
||||||
use anchor_spl::{associated_token::AssociatedToken, token_interface::{transfer_checked, Mint, TokenAccount, TokenInterface, TransferChecked}};
|
use anchor_spl::{associated_token::AssociatedToken, token_interface::{transfer_checked, Mint, TokenAccount, TokenInterface, TransferChecked}};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -56,22 +56,13 @@ pub struct JoinTorunament<'info>{
|
||||||
)]
|
)]
|
||||||
pub data_registry: Account<'info, DataRegistry>,
|
pub data_registry: Account<'info, DataRegistry>,
|
||||||
|
|
||||||
#[account(mut)]
|
|
||||||
pub seller:SystemAccount<'info>,
|
|
||||||
|
|
||||||
#[account(mint::token_program = token_program)]
|
#[account(mint::token_program = token_program)]
|
||||||
pub mint: InterfaceAccount<'info, Mint>,
|
pub mint: InterfaceAccount<'info, Mint>,
|
||||||
|
|
||||||
#[account(
|
|
||||||
mut,
|
|
||||||
seeds= [b"sales", seller.key().as_ref()],
|
|
||||||
bump = sales.bump
|
|
||||||
)]
|
|
||||||
pub sales: Account<'info, Sales>,
|
|
||||||
#[account(
|
#[account(
|
||||||
mut,
|
mut,
|
||||||
associated_token::mint= mint,
|
associated_token::mint= mint,
|
||||||
associated_token::authority = sales,
|
associated_token::authority = data_registry,
|
||||||
associated_token::token_program = token_program
|
associated_token::token_program = token_program
|
||||||
)]
|
)]
|
||||||
vault: InterfaceAccount<'info, TokenAccount>,
|
vault: InterfaceAccount<'info, TokenAccount>,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
pub mod initialize;
|
pub mod initialize;
|
||||||
pub use initialize::*;
|
pub use initialize::*;
|
||||||
|
|
||||||
pub mod add_seller;
|
|
||||||
pub use add_seller::*;
|
|
||||||
|
|
||||||
pub mod add_tournament;
|
pub mod add_tournament;
|
||||||
pub use add_tournament::*;
|
pub use add_tournament::*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
|
|
||||||
use anchor_lang::{prelude::*, solana_program::{native_token::LAMPORTS_PER_SOL, system_instruction}};
|
use anchor_lang::{prelude::*, solana_program::{native_token::LAMPORTS_PER_SOL, system_instruction}};
|
||||||
use anchor_spl::{
|
use anchor_spl::{
|
||||||
associated_token::AssociatedToken, token_interface::{Mint, TokenAccount, TokenInterface, close_account, transfer_checked, CloseAccount, TransferChecked}
|
associated_token::AssociatedToken,token_interface::{transfer_checked, Mint, TokenAccount, TokenInterface, TransferChecked}
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{error::CustomErrors, Sales};
|
use crate::{error::CustomErrors, DataRegistry, DATA_REGISTRY_SEED};
|
||||||
|
|
||||||
use super::transfer_tokens;
|
use super::transfer_tokens;
|
||||||
|
|
||||||
pub fn pay_seller(ctx:&Context<PurchaseTickets>, amount:u64)->Result<()>{
|
pub fn pay_seller(ctx:&Context<PurchaseTickets>, amount:u64)->Result<()>{
|
||||||
let from_account = &ctx.accounts.buyer;
|
let from_account = &ctx.accounts.buyer;
|
||||||
let to_account = &ctx.accounts.seller;
|
let to_account = &ctx.accounts.author;
|
||||||
|
|
||||||
let transfer_instruction = system_instruction::transfer(
|
let transfer_instruction = system_instruction::transfer(
|
||||||
from_account.key,
|
from_account.key,
|
||||||
|
|
@ -31,28 +31,27 @@ pub fn pay_seller(ctx:&Context<PurchaseTickets>, amount:u64)->Result<()>{
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handover_tickets(ctx:Context<PurchaseTickets>, amount:u64)->Result<()>{
|
pub fn handover_tickets(ctx:Context<PurchaseTickets>, amount:u64)->Result<()>{
|
||||||
let seeds = &[
|
let accounts = TransferChecked {
|
||||||
b"sales",
|
|
||||||
ctx.accounts.seller.to_account_info().key.as_ref(),
|
|
||||||
&[ctx.accounts.sales.bump]
|
|
||||||
];
|
|
||||||
|
|
||||||
let signer_seeds = [&seeds[..]];
|
|
||||||
|
|
||||||
let accounts = TransferChecked{
|
|
||||||
from: ctx.accounts.vault.to_account_info(),
|
from: ctx.accounts.vault.to_account_info(),
|
||||||
to: ctx.accounts.buyer_token_account.to_account_info(),
|
to: ctx.accounts.buyer_token_account.to_account_info(),
|
||||||
mint: ctx.accounts.mint.to_account_info(),
|
authority: ctx.accounts.data_registry.to_account_info(),
|
||||||
authority: ctx.accounts.sales.to_account_info()
|
mint: ctx.accounts.mint.to_account_info()
|
||||||
};
|
};
|
||||||
|
let bump = ctx.bumps.data_registry;
|
||||||
|
let seeds = &[
|
||||||
|
&DATA_REGISTRY_SEED[..],
|
||||||
|
&[bump]
|
||||||
|
];
|
||||||
|
|
||||||
let cpi_context = CpiContext::new_with_signer(
|
let signer_seeds = &[&seeds[..]];
|
||||||
ctx.accounts.token_program.to_account_info(),
|
|
||||||
accounts,
|
let ctx = CpiContext::new_with_signer(
|
||||||
&signer_seeds
|
ctx.accounts.token_program.to_account_info(),
|
||||||
|
accounts,
|
||||||
|
signer_seeds
|
||||||
);
|
);
|
||||||
|
|
||||||
transfer_checked(cpi_context, amount*LAMPORTS_PER_SOL, ctx.accounts.mint.decimals)
|
transfer_checked(ctx, amount *LAMPORTS_PER_SOL, 9)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -62,12 +61,15 @@ pub struct PurchaseTickets<'info>{
|
||||||
#[account(mut)]
|
#[account(mut)]
|
||||||
pub buyer:Signer<'info>,
|
pub buyer:Signer<'info>,
|
||||||
|
|
||||||
#[account(mut)]
|
|
||||||
pub seller:SystemAccount<'info>,
|
|
||||||
|
|
||||||
#[account(mint::token_program = token_program)]
|
#[account(mint::token_program = token_program)]
|
||||||
pub mint: InterfaceAccount<'info, Mint>,
|
pub mint: InterfaceAccount<'info, Mint>,
|
||||||
|
|
||||||
|
#[account(
|
||||||
|
mut,
|
||||||
|
address = data_registry.authority
|
||||||
|
)]
|
||||||
|
pub author: SystemAccount<'info>,
|
||||||
|
|
||||||
#[account(
|
#[account(
|
||||||
init_if_needed,
|
init_if_needed,
|
||||||
payer= buyer,
|
payer= buyer,
|
||||||
|
|
@ -76,16 +78,18 @@ pub struct PurchaseTickets<'info>{
|
||||||
associated_token::token_program = token_program
|
associated_token::token_program = token_program
|
||||||
)]
|
)]
|
||||||
pub buyer_token_account: Box<InterfaceAccount<'info, TokenAccount>>,
|
pub buyer_token_account: Box<InterfaceAccount<'info, TokenAccount>>,
|
||||||
|
|
||||||
#[account(
|
#[account(
|
||||||
mut,
|
mut,
|
||||||
seeds= [b"sales", seller.key().as_ref()],
|
seeds = [DATA_REGISTRY_SEED],
|
||||||
bump = sales.bump
|
bump
|
||||||
)]
|
)]
|
||||||
pub sales: Account<'info, Sales>,
|
pub data_registry: Account<'info, DataRegistry>,
|
||||||
|
|
||||||
#[account(
|
#[account(
|
||||||
mut,
|
mut,
|
||||||
associated_token::mint= mint,
|
associated_token::mint= mint,
|
||||||
associated_token::authority = sales,
|
associated_token::authority = data_registry,
|
||||||
associated_token::token_program = token_program
|
associated_token::token_program = token_program
|
||||||
)]
|
)]
|
||||||
vault: InterfaceAccount<'info, TokenAccount>,
|
vault: InterfaceAccount<'info, TokenAccount>,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use anchor_lang::prelude::*;
|
||||||
use anchor_spl:: token::{Mint, Token, TokenAccount};
|
use anchor_spl:: token::{Mint, Token, TokenAccount};
|
||||||
|
|
||||||
|
|
||||||
use crate::{error::CustomErrors, DataRegistry, Sales, DATA_REGISTRY_SEED};
|
use crate::{error::CustomErrors, DataRegistry, DATA_REGISTRY_SEED};
|
||||||
|
|
||||||
pub fn handler(ctx: Context<SetData>, new_auth:Pubkey)->Result<()>{
|
pub fn handler(ctx: Context<SetData>, new_auth:Pubkey)->Result<()>{
|
||||||
require!(ctx.accounts.signer.key() == ctx.accounts.data_registry.authority, CustomErrors::Unauthorized);
|
require!(ctx.accounts.signer.key() == ctx.accounts.data_registry.authority, CustomErrors::Unauthorized);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ pub use constants::*;
|
||||||
pub use instructions::*;
|
pub use instructions::*;
|
||||||
pub use state::*;
|
pub use state::*;
|
||||||
|
|
||||||
declare_id!("88dRZraTvmpqMs8GqtgCc321Foo5bWtDAsXJ1kqoc6nC");
|
declare_id!("3owEKMMjFuuYN2HjT2J2GiVauDivNBeYqaUymyX7Q8Lw");
|
||||||
#[program]
|
#[program]
|
||||||
pub mod tournaments {
|
pub mod tournaments {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
@ -18,12 +18,6 @@ pub mod tournaments {
|
||||||
initialize::handler(ctx)
|
initialize::handler(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_seller(ctx: Context<AddSeller>, tickets_count:u64) -> Result<()> {
|
|
||||||
// msg!("seller ata: {}", ctx.accounts.seller_token_account.key());
|
|
||||||
// add_seller::send_tickets_to_vault(&ctx, tickets_count)?;
|
|
||||||
add_seller::save_sales_account(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn purchase_tickets(ctx:Context<PurchaseTickets>, amount:u64)->Result<()>{
|
pub fn purchase_tickets(ctx:Context<PurchaseTickets>, amount:u64)->Result<()>{
|
||||||
let ticket_price: u64 =( LAMPORTS_PER_SOL / 100) * 3;
|
let ticket_price: u64 =( LAMPORTS_PER_SOL / 100) * 3;
|
||||||
purchase::pay_seller(&ctx, ticket_price)?;
|
purchase::pay_seller(&ctx, ticket_price)?;
|
||||||
|
|
@ -35,7 +29,7 @@ pub mod tournaments {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn join_tournament(ctx:Context<JoinTorunament>, id:u64)-> Result<()>{
|
pub fn join_tournament(ctx:Context<JoinTorunament>, id:u64)-> Result<()>{
|
||||||
join_tournament::transfer_ticket_to_vault(&ctx, id);
|
// join_tournament::transfer_ticket_to_vault(&ctx, id);
|
||||||
join_tournament::add_to_participants_list(ctx, id)
|
join_tournament::add_to_participants_list(ctx, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
use anchor_lang::prelude::*;
|
use anchor_lang::{prelude::*, Bump};
|
||||||
|
|
||||||
#[account]
|
#[account]
|
||||||
#[derive(InitSpace)]
|
#[derive(InitSpace)]
|
||||||
pub struct DataRegistry{
|
pub struct DataRegistry{
|
||||||
#[max_len(100)]
|
pub sales_pda: Pubkey,
|
||||||
pub sales_pdas: Vec<Pubkey>,
|
|
||||||
pub authority: Pubkey
|
pub authority: Pubkey
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
pub mod sales;
|
|
||||||
pub use sales::Sales;
|
|
||||||
|
|
||||||
pub mod data_registry;
|
pub mod data_registry;
|
||||||
pub use data_registry::DataRegistry;
|
pub use data_registry::DataRegistry;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
use anchor_lang::prelude::*;
|
|
||||||
|
|
||||||
#[account]
|
|
||||||
#[derive(InitSpace)]
|
|
||||||
pub struct Sales{
|
|
||||||
pub seller: Pubkey,
|
|
||||||
pub vault: Pubkey,
|
|
||||||
pub mint : Pubkey,
|
|
||||||
pub bump:u8
|
|
||||||
}
|
|
||||||
636
tournaments.json
Normal file
636
tournaments.json
Normal file
|
|
@ -0,0 +1,636 @@
|
||||||
|
{
|
||||||
|
"address": "3owEKMMjFuuYN2HjT2J2GiVauDivNBeYqaUymyX7Q8Lw",
|
||||||
|
"metadata": {
|
||||||
|
"name": "tournaments",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"spec": "0.1.0",
|
||||||
|
"description": "Created with Anchor"
|
||||||
|
},
|
||||||
|
"instructions": [
|
||||||
|
{
|
||||||
|
"name": "add_tournament",
|
||||||
|
"discriminator": [
|
||||||
|
86,
|
||||||
|
126,
|
||||||
|
171,
|
||||||
|
66,
|
||||||
|
224,
|
||||||
|
148,
|
||||||
|
167,
|
||||||
|
201
|
||||||
|
],
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"name": "payer",
|
||||||
|
"writable": true,
|
||||||
|
"signer": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tournament_account",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
116,
|
||||||
|
111,
|
||||||
|
117,
|
||||||
|
114,
|
||||||
|
110,
|
||||||
|
97,
|
||||||
|
109,
|
||||||
|
101,
|
||||||
|
110,
|
||||||
|
116
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "arg",
|
||||||
|
"path": "id"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "data_registry",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
115,
|
||||||
|
97,
|
||||||
|
108,
|
||||||
|
101,
|
||||||
|
115,
|
||||||
|
95,
|
||||||
|
114,
|
||||||
|
101,
|
||||||
|
103
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "system_program",
|
||||||
|
"address": "11111111111111111111111111111111"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"type": "u64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "start_time",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "initialize",
|
||||||
|
"discriminator": [
|
||||||
|
175,
|
||||||
|
175,
|
||||||
|
109,
|
||||||
|
31,
|
||||||
|
13,
|
||||||
|
152,
|
||||||
|
155,
|
||||||
|
237
|
||||||
|
],
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"name": "signer",
|
||||||
|
"writable": true,
|
||||||
|
"signer": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "data_registry",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
115,
|
||||||
|
97,
|
||||||
|
108,
|
||||||
|
101,
|
||||||
|
115,
|
||||||
|
95,
|
||||||
|
114,
|
||||||
|
101,
|
||||||
|
103
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mint"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vault",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "data_registry"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "token_program"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "mint"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"program": {
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
140,
|
||||||
|
151,
|
||||||
|
37,
|
||||||
|
143,
|
||||||
|
78,
|
||||||
|
36,
|
||||||
|
137,
|
||||||
|
241,
|
||||||
|
187,
|
||||||
|
61,
|
||||||
|
16,
|
||||||
|
41,
|
||||||
|
20,
|
||||||
|
142,
|
||||||
|
13,
|
||||||
|
131,
|
||||||
|
11,
|
||||||
|
90,
|
||||||
|
19,
|
||||||
|
153,
|
||||||
|
218,
|
||||||
|
255,
|
||||||
|
16,
|
||||||
|
132,
|
||||||
|
4,
|
||||||
|
142,
|
||||||
|
123,
|
||||||
|
216,
|
||||||
|
219,
|
||||||
|
233,
|
||||||
|
248,
|
||||||
|
89
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "system_program",
|
||||||
|
"address": "11111111111111111111111111111111"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "token_program"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "associated_token_program",
|
||||||
|
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"args": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "join_tournament",
|
||||||
|
"discriminator": [
|
||||||
|
77,
|
||||||
|
21,
|
||||||
|
212,
|
||||||
|
206,
|
||||||
|
77,
|
||||||
|
82,
|
||||||
|
124,
|
||||||
|
31
|
||||||
|
],
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"name": "user",
|
||||||
|
"writable": true,
|
||||||
|
"signer": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tournament_account",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
84,
|
||||||
|
111,
|
||||||
|
117,
|
||||||
|
114,
|
||||||
|
110,
|
||||||
|
97,
|
||||||
|
109,
|
||||||
|
101,
|
||||||
|
110,
|
||||||
|
116
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "arg",
|
||||||
|
"path": "id"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "data_registry",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
115,
|
||||||
|
97,
|
||||||
|
108,
|
||||||
|
101,
|
||||||
|
115,
|
||||||
|
95,
|
||||||
|
114,
|
||||||
|
101,
|
||||||
|
103
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mint"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vault",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "data_registry"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "token_program"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "mint"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"program": {
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
140,
|
||||||
|
151,
|
||||||
|
37,
|
||||||
|
143,
|
||||||
|
78,
|
||||||
|
36,
|
||||||
|
137,
|
||||||
|
241,
|
||||||
|
187,
|
||||||
|
61,
|
||||||
|
16,
|
||||||
|
41,
|
||||||
|
20,
|
||||||
|
142,
|
||||||
|
13,
|
||||||
|
131,
|
||||||
|
11,
|
||||||
|
90,
|
||||||
|
19,
|
||||||
|
153,
|
||||||
|
218,
|
||||||
|
255,
|
||||||
|
16,
|
||||||
|
132,
|
||||||
|
4,
|
||||||
|
142,
|
||||||
|
123,
|
||||||
|
216,
|
||||||
|
219,
|
||||||
|
233,
|
||||||
|
248,
|
||||||
|
89
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "system_program",
|
||||||
|
"address": "11111111111111111111111111111111"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "token_program"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "associated_token_program",
|
||||||
|
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"type": "u64"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "purchase_tickets",
|
||||||
|
"discriminator": [
|
||||||
|
146,
|
||||||
|
121,
|
||||||
|
85,
|
||||||
|
207,
|
||||||
|
182,
|
||||||
|
70,
|
||||||
|
169,
|
||||||
|
155
|
||||||
|
],
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"name": "buyer",
|
||||||
|
"writable": true,
|
||||||
|
"signer": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mint"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "author",
|
||||||
|
"writable": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "buyer_token_account",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "buyer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "token_program"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "mint"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"program": {
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
140,
|
||||||
|
151,
|
||||||
|
37,
|
||||||
|
143,
|
||||||
|
78,
|
||||||
|
36,
|
||||||
|
137,
|
||||||
|
241,
|
||||||
|
187,
|
||||||
|
61,
|
||||||
|
16,
|
||||||
|
41,
|
||||||
|
20,
|
||||||
|
142,
|
||||||
|
13,
|
||||||
|
131,
|
||||||
|
11,
|
||||||
|
90,
|
||||||
|
19,
|
||||||
|
153,
|
||||||
|
218,
|
||||||
|
255,
|
||||||
|
16,
|
||||||
|
132,
|
||||||
|
4,
|
||||||
|
142,
|
||||||
|
123,
|
||||||
|
216,
|
||||||
|
219,
|
||||||
|
233,
|
||||||
|
248,
|
||||||
|
89
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "data_registry",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
115,
|
||||||
|
97,
|
||||||
|
108,
|
||||||
|
101,
|
||||||
|
115,
|
||||||
|
95,
|
||||||
|
114,
|
||||||
|
101,
|
||||||
|
103
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vault",
|
||||||
|
"writable": true,
|
||||||
|
"pda": {
|
||||||
|
"seeds": [
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "data_registry"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "token_program"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "account",
|
||||||
|
"path": "mint"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"program": {
|
||||||
|
"kind": "const",
|
||||||
|
"value": [
|
||||||
|
140,
|
||||||
|
151,
|
||||||
|
37,
|
||||||
|
143,
|
||||||
|
78,
|
||||||
|
36,
|
||||||
|
137,
|
||||||
|
241,
|
||||||
|
187,
|
||||||
|
61,
|
||||||
|
16,
|
||||||
|
41,
|
||||||
|
20,
|
||||||
|
142,
|
||||||
|
13,
|
||||||
|
131,
|
||||||
|
11,
|
||||||
|
90,
|
||||||
|
19,
|
||||||
|
153,
|
||||||
|
218,
|
||||||
|
255,
|
||||||
|
16,
|
||||||
|
132,
|
||||||
|
4,
|
||||||
|
142,
|
||||||
|
123,
|
||||||
|
216,
|
||||||
|
219,
|
||||||
|
233,
|
||||||
|
248,
|
||||||
|
89
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "system_program",
|
||||||
|
"address": "11111111111111111111111111111111"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "token_program"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "associated_token_program",
|
||||||
|
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"name": "amount",
|
||||||
|
"type": "u64"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"name": "DataRegistry",
|
||||||
|
"discriminator": [
|
||||||
|
169,
|
||||||
|
50,
|
||||||
|
35,
|
||||||
|
17,
|
||||||
|
11,
|
||||||
|
106,
|
||||||
|
49,
|
||||||
|
193
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Tournament",
|
||||||
|
"discriminator": [
|
||||||
|
175,
|
||||||
|
139,
|
||||||
|
119,
|
||||||
|
242,
|
||||||
|
115,
|
||||||
|
194,
|
||||||
|
57,
|
||||||
|
92
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"errors": [
|
||||||
|
{
|
||||||
|
"code": 6000,
|
||||||
|
"name": "CustomError",
|
||||||
|
"msg": "Custom error message"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 6001,
|
||||||
|
"name": "InsufficientFunds",
|
||||||
|
"msg": "Insufficient funds to purchase a ticket, Recharge your wallet and try again"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": 6002,
|
||||||
|
"name": "Unauthorized",
|
||||||
|
"msg": "Only the owner can perform this action"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"name": "DataRegistry",
|
||||||
|
"type": {
|
||||||
|
"kind": "struct",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "sales_pda",
|
||||||
|
"type": "pubkey"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "authority",
|
||||||
|
"type": "pubkey"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Tournament",
|
||||||
|
"type": {
|
||||||
|
"kind": "struct",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"type": "u64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "participants",
|
||||||
|
"type": {
|
||||||
|
"vec": "pubkey"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "start_time",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constants": [
|
||||||
|
{
|
||||||
|
"name": "DATA_REGISTRY_SEED",
|
||||||
|
"type": {
|
||||||
|
"array": [
|
||||||
|
"u8",
|
||||||
|
9
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"value": "[115, 97, 108, 101, 115, 95, 114, 101, 103]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ID",
|
||||||
|
"type": "string",
|
||||||
|
"value": "\"\""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user