View Contract State

import json
from pachira import *
test_net_addresses_path = '/Users/ian_moore/repos/indexeddefi/script/deployments/TestnetStage1-addresses.json'

f = open(test_net_addresses_path)
test_net_addresses = json.load(f)
base_pool_addr = test_net_addresses['basePool']
index_pool_addr = test_net_addresses['indexedPool']
study_addr = test_net_addresses['study']

Connect to network

connect = ConnectW3(Net.LOCALHOST)
connect.apply()

View IUniswapV2Pair

abi = ABILoad(Platform.PACHIRA, JSONContract.IUniswapV2Pair)
vContract = ViewContract(connect, abi)
view_fns_res = vContract.apply(base_pool_addr)
view_fns_res
{'DOMAIN_SEPARATOR': b'\xc8\xe6A\xd2\x99\t\x0fHP\xe3\xbdFW\xf0Ut\x8e\xa3o\xe0=\xf7\xed\xe1VN|\x9e\xf5f\xacz',
 'decimals': 18,
 'factory': '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
 'getReserves': [100000000000000000000050,
  100000000000000000000049,
  1725384132],
 'kLast': 0,
 'name': 'MockUniV2 Pari of fWGas/TRC1',
 'price0CumulativeLast': 109038234029231380199140422913622016,
 'price1CumulativeLast': 109038234029231380199140422913622016,
 'symbol': 'fWGas/TRC1',
 'token0': '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
 'token1': '0xfAEFac1C9e8AF3a030857C4e61066f0a510253AF',
 'totalSupply': 100000000000000000000023}

View UniV2IndexedYieldLinearExitPool

index_pool_addr
'0x5FC8d32690cc91D4c39d9d3abcBD16989F875707'
abi = ABILoad(Platform.PACHIRA, JSONContract.UniV2IndexedYieldLinearExitPool)
vContract = ViewContract(connect, abi)
view_fns_res = vContract.apply(index_pool_addr)
view_fns_res
{'basePool': '0x387E3656De052275554f8D8B78C4B1a9B088345C',
 'basePoolLocalBal': 99999999999999999999023,
 'getTokensIn': ['0x387E3656De052275554f8D8B78C4B1a9B088345C',
  '0xfAEFac1C9e8AF3a030857C4e61066f0a510253AF',
  '0x0000000000000000000000000000000000000000'],
 'getTokensOut': ['0x387E3656De052275554f8D8B78C4B1a9B088345C',
  '0xfAEFac1C9e8AF3a030857C4e61066f0a510253AF',
  '0x0000000000000000000000000000000000000000'],
 'token0': '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
 'token1': '0xfAEFac1C9e8AF3a030857C4e61066f0a510253AF',
 'totalSupply': 199999999999999999998023,
 'yieldToken': '0x387E3656De052275554f8D8B78C4B1a9B088345C'}

View MintableRCIndexedYieldLinearExitPoolStudy

abi = ABILoad(Platform.PACHIRA, JSONContract.MintableRCIndexedYieldLinearExitPoolStudy)
vContract = ViewContract(connect, abi)
view_fns_res = vContract.apply(study_addr)
view_fns_res
{'DETF_NFT_TOKEN_ID': 0,
 'basePool': '0x387E3656De052275554f8D8B78C4B1a9B088345C',
 'lockEnd': 1727976110,
 'lockPeriod': 2592000,
 'name': '',
 'owner': '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
 'proposedOwner': '0x0000000000000000000000000000000000000000',
 'rc': '0xfAEFac1C9e8AF3a030857C4e61066f0a510253AF',
 'subject': '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
 'symbol': '',
 'withdrawEnabled': False}