TinyMan
Choice Coin is available on TinyMan and included in several asset pairs.
Overview
TinyMan is a liquidity pool software which supports Algorand Standard Assets (ASA) liquidity pools. The software is innovative insofar as it allows users to perform swaps and yield farming with minimal fees. As such, TinyMan provides access to small market places, leveling the playing field with institutionalized finance. TinyMan is a great decentralized finance (DeFi) technology on the Algorand network.
Liquidity Pools
Liquidity pools are accounts holding two different ASAs contributed by poolers. In return for providing assets, poolers receive a share of transaction fees. Liquidity must be added and withdrawn in ASA pairs. In exchange for providing liquidity, poolers receive pool tokens. Pool tokens can be withdrawn at anytime for the proportional representation of the pool.
Asset Swaps
A swap is an ASA transfer to or from a liquidity pool. Swaps can be made using the TinyMan web application or using the TinyMan Python-SDK. Swaps initiate an ASA transfer from the swapper's wallet and the liquidity pool.
Wrapper
The Choice Coin TinyMan Wrapper is an open source wrapper that allows users to acquire Choice Coin directly through their Terminal using ALGO and various Algorand Standard Assets (ASAs). Currently, the Choice-TinyMan Wrapper supports ALGO, USDC, YLDY, OPUL, AKITA, GEMS, ACORN, COMAND, TACO, and HDL. This wrapper leverages the TinyMan Python SDK, which is an open source software for interacting with TinyMan. This allows users to get Choice Coin by swapping ASAs directly from their terminal, thus allowing them to participate in the ecosystem through an asset of their choosing.
1
from tinyman.v1.client import TinymanMainnetClient
2
from algosdk.v2client import algod
3
from algosdk import account, encoding, mnemonic,transaction
4
5
print("Welcome to the custom Choice-TinyMan Terminal Wrapper!.")
6
7
address = ""
8
user_mnemonic = ""
9
private_key = mnemonic.to_private_key(user_mnemonic)
10
client = TinymanMainnetClient(user_address = address)
11
if(not client.is_opted_in()):
12
print('Account not opted into TinyMan app, opting in now..')
13
transaction_group = client.prepare_app_optin_transactions()
14
transaction_group.sign_with_private_key(address, account['private_key'])
15
result = client.submit(transaction_group, wait=True)
16
Copied!
This code block allows the user to remotely connect to the TinyMan Client, this enabling them to make swaps for Choice Coin. It also opts them into the application in case they have not used TinyMan before.
1
def choice_for_algo():
2
Choice = client.fetch_asset(297995609)
3
ALGO = client.fetch_asset(0)
4
pool = client.fetch_pool(Choice, ALGO)
5
quote = pool.fetch_fixed_input_swap_quote(ALGO(1_000_000), slippage=0.01)
6
print(quote)
7
print(f'Choice per ALGO: {quote.price}')
8
print(f'Choice per ALGO (worst case): {quote.price_with_slippage}')
9
print("Do you still want to go through this transaction? Type Y for 'Yes' and N for 'No'")
10
binary = input()
11
if binary == "Y":
12
new = int(input("How much ALGO do you want to spend? ")) * 1000000
13
quote = pool.fetch_fixed_input_swap_quote(ALGO(new), slippage=0.01)
14
print(f'Swapping {quote.amount_in} to {quote.amount_out_with_slippage}')
15
transaction_group = pool.prepare_swap_transactions_from_quote(quote)
16
# Sign the group with our key
17
transaction_group.sign_with_private_key(address, private_key)
18
# Submit transactions to the network and wait for confirmation
19
result = client.submit(transaction_group, wait=True)
20
21
# Check if any excess remaining after the swap
22
excess = pool.fetch_excess_amounts()
23
if Choice in excess:
24
amount = excess[Choice]
25
print(f'Excess: {amount}')
26
if amount > 1_000_000:
27
transaction_group = pool.prepare_redeem_transactions(amount)
28
transaction_group.sign_with_private_key(address, private_key)
29
result = client.submit(transaction_group, wait=True)
30
else:
31
print('Returning to wrapper home')
Copied!
This code block fetches the current price statistics for the Algo-Choice liquidity pool, and then proceeds to allow the user to make a decision as to whether they want to continue with the swap. If the user decides to continue with the transaction, the wrapper automatically signs the transaction and finishes the swap.
Links
TinyMan Website: https://tinyman.org/
Last modified 23d ago
Copy link