Token
When using the Token smart contract, additional top-level functionality is available to use.
To access the top-level functionality, use the get_token
method when creating the contract instance:
contract = python.get_token(
"{{contract_address}}",
)
The extensions that the Token Drop contract supports are listed below.
- ERC20
- ERC20Burnable
- ERC20Mintable
- ERC20BatchMintable
- ERC20SignatureMintable
- ERC20Permit
- PlatformFee
- PrimarySale
- Permissions
- ContractMetadata
- Gasless
mint
Mint tokens to the connected wallet.
amount = 100
receipt = contract.mint(amount)
Configuration
mint_to
The same as mint
, but allows you to specify the address to mint the tokens to.
address = "0x7fDae677aA6f94Edff9872C4b91D26407709c790"
amount = 100
receipt = contract.mint_to(address, amount)
Configuration
mint_batch_to
Mint tokens to many wallets in one transaction.
from thirdweb.types.currency import TokenAmount
# Data of the tokens you want to mint
args = [
TokenAmount("0x7fDae677aA6f94Edff9872C4b91D26407709c790", 1),
TokenAmount("0x7fDae677aA6f94Edff9872C4b91D26407709c790", 2),
]
contract.mint_batch_to(args)
Configuration
args
A List
of TokenAmount
objects containing the following properties:
class TokenAmount:
to_address: str
amount: Price
contract.mint_batch_to(
[
TokenAmount("{{wallet_address}}", 0.2),
TokenAmount("0x...", 1.4),
]
)
get_vote_balance
Get the connected wallet's voting power in this token.
vote_balance = contract.get_vote_balance()
Configuration
Return Value
A CurrencyValue
object representing the vote balance of the connected wallet.
class CurrencyValue(Currency):
value: PriceWei
display_value: Price
get_vote_balance_of
Get the voting power of the specified wallet in this token.
account = "0x..."
vote_balance = contract.get_vote_balance(account)
Configuration
get_delegation
Get the connected wallets delegatee address for this token.
delegation_address = contract.get_delegation()
Configuration
Return Value
A str
representing the delegation address of the connected wallet.
get_delegation_of
Get a specified wallets delegatee for this token.
account = "0x..."
delegation_address = contract.get_delegation_of(account)
Configuration
delegate_to
Delegate the connected wallet's tokens to a specified wallet.
delegatee_address = "0x..."
contract.delegate_to(delegatee_address)
Configuration
delegatee_address
Wallet address to delegate tokens to. Must be of type str
.
delegatee_address = "0x..."
contract.delegate_to(delegatee_address)