Kind of like a on-chain oracle?
Please help
Ben
October 21, 2021, 12:33pm
2
Yes, they’re storing information in local state of the pool contract, see python here for how its accessed.
asset1_id = get_state_int(validator_app_state, 'a1')
asset2_id = get_state_int(validator_app_state, 'a2')
pool_logicsig = get_pool_logicsig(validator_app_id, asset1_id, asset2_id)
pool_address = pool_logicsig.address()
assert(account_info['address'] == pool_address)
asset1_reserves = get_state_int(validator_app_state, 's1')
asset2_reserves = get_state_int(validator_app_state, 's2')
issued_liquidity = get_state_int(validator_app_state, 'ilt')
unclaimed_protocol_fees = get_state_int(validator_app_state, 'p')
liquidity_asset = account_info['created-assets'][0]
liquidity_asset_id = liquidity_asset['index']
outstanding_asset1_amount = get_state_int(validator_app_state, b64encode(b'o' + (asset1_id).to_bytes(8, 'big')))
outstanding_asset2_amount = get_state_int(validator_app_state, b64encode(b'o' + (asset2_id).to_bytes(8, 'big')))
outstanding_liquidity_asset_amount = get_state_int(validator_app_state, b64encode(b'o' + (liquidity_asset_id).to_bytes(8, 'big')))
Visit their docs or discord for more info
1 Like
To complement @Ben 's excellent answer:
Before going into production, you must check with the TinyMan team that there is no risk they change the way data is stored in the smart contract in the future.
Thank you both very much!