Managing Funds

Funding Your Wallet

With SOL ('Lamports')

SOL is the native cryptocurrency of the Solana blockchain. Processing transactions on the blockchain is performed by 'validators', who need to be rewarded for the service they provide. This is achieved by levying a (tiny) transaction fee on each transaction.

When interacting with Solana programmatically, SOL is often a very large unit to work with, so instead the term 'Lamport' is often used instead. A lamport is 10^-9 (i.e. 0.000000001 SOL)

A transaction on Solana costs 5000 lamports (0.000005 SOL) or approximately $0.00015 at the time of writing.

You will need to source funds for your wallet. Initially, just a small amount of SOL is enough to fund a large number of interactions and transactions - 1 SOL is plenty to get started.

If you're on devnet, you can 'airdrop' your wallet a starting balance of 1 SOL. This is demonstrated in the example below:

print(f' - Old SOL/Lamports balance: {await client.request_lamport_balance(owner_keypair.public_key)}')

await client.request_lamport_airdrop(1_000_000_000, owner_keypair.public_key)

print(f' - New SOL/Lamports balance: {await client.request_lamport_balance(owner_keypair.public_key)}')

In this example, you request a 10^9 lamport (=1 SOL) airdrop from the devnet network, printing a before and after balance of SOL/lamports in your wallet.

If you were running this script on mainnet, the airdrop request would simply fail.

Instead, this section of the code would be replaced with either (a) a manual process to transfer SOL from another wallet or from an exchange to this wallet; or (b) for more sophisticated operations - an automated process to distributed funds from a 'funding wallet' to a 'trading wallet'.

With USDC (Tokens for trading)

Trading and settlement on Aver occurs in USDC - a USD-pegged 'stablecoin'.

While SOL is required to cover the minor network costs, USDC is required to trade with. USDC has been selected so as to avoid participants being subject to fluctuations in underlying currency as well as exposure to the traded markets/outcomes of events.

There are many different cryptocurrencies ('tokens'), and storing each requires what is called an 'Associated Token Account' (ATA). This is a type of on-chain account where the balance of a particular token held by a given wallet is recorded and updated.

If your wallet does not already have an ATA for the token in question, you will need to create one. The helper method used here takes care of this for you:

# If the wallet does not already have a 'token account', you will
#  need to create one for this token to store it
ata = await client.get_or_create_associated_token_account(
    owner_keypair.public_key,
    owner_keypair,
)

# Print (USDC) token balance before
token_balance = await client.request_token_balance(client.quote_token, owner_keypair.public_key)
print(f' - Old token balance: {token_balance}')

# Request the airdrop and await the transaction signature
txn_signature = request_token_airdrop(client.aver_api_endpoint, client.quote_token,owner_keypair.public_key, 1_000_000_000)['signature']

# Wait to ensure transaction has been confirmed before moving on
await client.provider.connection.confirm_transaction(txn_signature, Confirmed) 

# Print (USDC) token balance after
token_balance = await client.request_token_balance(client.quote_token, owner_keypair.public_key)
print(f' - New token balance: {token_balance}')

If you were running this script on mainnet, the airdrop request would simply fail.

Instead, this section of the code would be replaced with either (a) a manual process to transfer SOL from another wallet or from an exchange to this wallet; or (b) for more sophisticated operations - an automated process to distributed funds from a 'funding wallet' to a 'trading wallet'.

Last updated