def set_order(self): bundle_set = utils.prepare_for_sending(self._bundle_set) bid = utils.prepare_for_sending(self._bid) tx = self._dealer_contract.contract.functions.setOrder(bundle_set, bid).transact({'from': self._account_address}) while self._provider.eth.getTransactionReceipt(tx) is None: time.sleep(1)
def set_mmp_attributes(self): mmp_values = utils.prepare_for_sending(self._mmp_values) mkt_prices = utils.prepare_for_sending(self._mmp_duals) mmp_target_coefs = utils.prepare_for_sending(self._mmp_target_coefs) mmp_constraint_bounds = utils.prepare_for_sending( self._mmp_constraint_bounds) self._dealer_contract.contract.functions.setMMPAttributes( mmp_values, mkt_prices, mmp_target_coefs, mmp_constraint_bounds).transact({'from': self._account_address})
def test_prepare_for_sending(self): array = np.array([1, 2, 3]) value = 1.56 prepared_array = utils.prepare_for_sending(array) prepared_value = utils.prepare_for_sending(value) self.assertIsInstance(prepared_array, list) self.assertIsInstance(prepared_array[0], int) self.assertIsInstance(prepared_value, int)
def set_order(self): bundle_set = utils.prepare_for_sending(self._bundle_set) bid = utils.prepare_for_sending(self._bid) if (bid > 0): prepayment = utils.from_ether_to_wei(self._bid) else: prepayment = 0 tx_hash = self._dealer_contract.contract.functions.setOrder( bundle_set, bid, prepayment).transact({ 'from': self._account_address, 'value': prepayment })
def set_mkt_prices(self): mkt_prices = utils.prepare_for_sending(self._mkt_prices) tx = self._dealer_contract.contract.functions.setMktPrices( mkt_prices).transact({'from': self._account_address})
def get_trade_information(self): trade = utils.prepare_for_sending(self._trade) return self._account, trade, self._prepayment, self._bill, self._refund
def set_resource_inventory(self): resource_inventory = utils.prepare_for_sending( self._resource_inventory) self._dealer_contract.contract.functions.setResourceInventory( resource_inventory).transact({'from': self._account_address})
def get_trade_information(self): trade = utils.prepare_for_sending(self._trade) # bill = utils.prepare_for_sending(self._bill) return self._account, trade, self._bill