Hi people, I’m expressing the Commons Stack as a class
Commons in Python (python notebook here) to abstract away some of the complexity.
The problem is that cadCAD seems to expect the state to serve as the
Commons , but it’s actually all wrapped away behind my
Commons class. The result is I have to make my state update function secretly update more variables than it officially should (see the end of
def update_commons(). I really want the variables funding_pool, collateral_pool, token_supply to be in the state so it’s easy to convert into a pandas Dataframe for plotting, but they’re actually inside the
def update_commons(params, step, sL, s, _input): commons = s["commons"] participants_expenditure = _input["update_network_spending"] for expenditure in participants_expenditure: if expenditure > 0: commons.burn(expenditure) s["funding_pool"] = commons._funding_pool s["collateral_pool"] = commons._collateral_pool s["token_supply"] = commons._token_supply return "commons", commons
I’m not sure if this is okay/violates any assumptions cadCAD internally makes? Is there a different way to do this?