Deploy Token
The Deploy Token
tool is part of AgentiPy, used for deploying new SPL (Solana Program Library) tokens on the Solana blockchain. This involves creating a new token mint, initializing it, and minting an initial supply to the creator's associated token account.
Functionality
This tool is implemented in the TokenDeploymentManager
class.
Key Methods:
deploy_token(agent: SolanaAgentKit, decimals: int = 9) -> Dict[str, Any]
:Takes a
SolanaAgentKit
instance and an optionaldecimals
parameter for the new token (defaulting to 9).Generates a new
Keypair
for the token mint.Constructs a transaction that includes instructions for:
Creating a new account for the mint, owned by the SPL Token Program.
Initializing the mint with the specified
decimals
, mint authority, and freeze authority (set to the agent's wallet).Creating an associated token account (ATA) for the agent's wallet to receive the initial supply.
Minting an initial supply (hardcoded to 1,000,000,000 tokens adjusted by 10^8, which seems like a potential point of confusion as decimals are also a parameter) to the creator's ATA.
Signs the transaction with both the new mint's keypair and the agent's wallet.
Sends and confirms the transaction.
Returns a dictionary containing the new
mint
address (as a string) and the transactionsignature
.
Note: This tool creates a new SPL token on the Solana blockchain. The agent's wallet will be the mint and freeze authority for the token and will receive the initial minted supply. The amount of tokens minted initially is hardcoded in the script.
Source Code
You can find the source code for this tool on GitHub: https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/deploy_token.py
Last updated