core/states/profit_and_loss.state library