0% found this document useful (0 votes)
3 views4 pages

Bozo Func

The document outlines various administrator and dapp functions for a smart contract, including initialization, admin changes, collection updates, and bot management. It details user interactions such as account creation, order management, token deposits, and withdrawals. Additionally, it describes key account types like treasury, user, referral, and order accounts that facilitate the contract's operations.

Uploaded by

thrillseeker.nw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Bozo Func

The document outlines various administrator and dapp functions for a smart contract, including initialization, admin changes, collection updates, and bot management. It details user interactions such as account creation, order management, token deposits, and withdrawals. Additionally, it describes key account types like treasury, user, referral, and order accounts that facilitate the contract's operations.

Uploaded by

thrillseeker.nw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Administrator functions:

"initialize" basic function of initializing the contract where the mint address of the NFT that
categorized "i.e. the first NFT that gave rise to the collection" must be passed to check the origin of the
NFTs

pub fn initialize(ctx: Context<Initialize>,collection:Pubkey) -> Result<()>{}

"change_admin" function where the account that will be the new admin will be passed "new_admin"
(which receives the collected fees etc)

pub fn change_admin(ctx: Context<TreasureSettings>,new_admin:Pubkey) -> Result<()>{}

"change_collection" function where the mint account of a new collection "new_collection" will be
passed if necessary (which checks the origin of the nft, etc.)

pub fn change_collection(ctx: Context<TreasureSettings>,new_collection:Pubkey) -> Result<()>{}

"add_bot" function responsible for adding a "bot" account to the permissions list as a bot (which will be
used in BE)

pub fn add_bot(ctx: Context<BotSettings>,bot:Pubkey) -> Result<()>{}

"rmv_bot" the inverse of the "add_bot" function will remove the "bot" account if it exists from the
permission list

pub fn rmv_bot(ctx: Context<BotSettings>,bot:Pubkey) -> Result<()>{}


dapp functions:

Refferal: a button that will perform the function of creating the user's global account if they have not
interacted with the dapp before

pub fn refferal(ctx: Context<CreateAutoAccount>) -> Result<()> {}

is the function used to close the order that has the corresponding numbering id:u64

pub fn close_order(ctx: Context<CloseOrder>,id:u64) -> Result<()> {}

is the function that will deposit tokens indirectly to the global account so that it can be used with the
asima function for a specific purpose (bump:u8 will be the same for all functions used to determine the
PDA curve of the global account In addition to the "deposit_sol" function, it does the same thing but is
called when the token in question is a standard solana)

pub fn deposit(ctx: Context<Deposit>,amount:u64,bump:u8) -> Result<()> {}

this function is responsible for withdrawing the tokens from the global account with the "amount"
input (bump:u8 will be the same for all functions used to determine the PDA curve of the global
account from which the tokens are being withdrawn)

pub fn withdraw(ctx: Context<OrderTokenToUser>,amount: u64,_bump: u8, ) -> Result<()> {}


dapp functions 2:

"create_order" the most important function where parameters such as:

id:u64 -> which order of the list of that global account does this order represent

types:u8 -> type 1 quickswap, type 2 buy/sell, type 3 DCA, type 4 spanbuy

amount: u64 -> token in amount

min_amount_expected:u64 -> for the first two functions it will be passed to others, the Owner function
referring to the order will be updated so that it represents in DCA and spanbuy the quantity already
converted into the "exchange" token

rpc:String -> the client's RPC of choice

side:bool -> passed in buy/sell to know how the operation will be carried out "buy: true or sell:false"
(for other functions it is passed as true)

interval:u64 -> the time in timestamp that each DCA operation will be away from the other, for
example "60" minute by minute "86400" day by day etc.

orders:u64 -> how many orders were executed

slippage_bips:u64 number of slippage that the operation will have (30 = 0.3%)

nft_metadata:Option<Pubkey> -> optional in which the metadata address of the nft that the user has is
passed if he has the nft where its legitimacy will be confirmed

limit:u64 -> timestamp to close the order

(functions such as "create_order_and_deposit" and "create_order_and_sol_deposit" (does the same


thing but called the token in question is a standard sun) has the same function, the difference is that
the amount is automatically deposited from the user's account, whereas the default function is for
users who already have the token, the only difference is the _bump which is used to determine the PDA
curve of the global account)

pub fn create_order(ctx: Context<CreateOrder>,id:u64,types:u8,amount:


u64,min_amount_expected:u64,rpc:String,side:bool,interval:u64,orders:u64,slippage_beeps:u64,nft_metadat
a:Option<Pubkey>,limit:u64) -> Result<()> {}
TreasuryKey: This account represents the treasury, which is where funds are kept to execute
operations. The treasury may be responsible for different assets, depending on the logic of the
contract.

USERKey: This is an account associated with the user interacting with the contract. It is used to identify
the user and their operations.

REFFERAL: This account represents a user referenced by another user. It is used in cases where there is
a referral or affiliate program.

OrderKey: This is an account that represents an order in the market. It stores information about the
order, such as type, quantity, limit, among other relevant data.

MetadataKey: This account can be associated with metadata, perhaps related to non-fungible tokens
(NFTs) or other assets. It stores additional information about a specific asset.

AdminTokenAccount: This account represents an account associated with the contract or treasury
administrator. It is used to receive or send administrative tokens.

RefferalTokenAccount: Similar to the AdminTokenAccount account, but for referred users.

FromAutoTokenAccount and ToAutoTokenAccount: These accounts are associated with specific tokens
and are used for automated transactions between users and contracts.

USERTokenAccount: Represents the token account associated with a specific user.

BotKey: This account can represent the role of a bot within the system, if there are integrations with
bots to automate some operations.

poolKeys: These are keys associated with liquidity pools in an AMM (Automated Market Maker)
protocol, used in asset exchange operations.

vaultOwner: Represents the owner of the vault, used in specific asset management operations.

You might also like