Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
 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})
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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
            })
Exemplo n.º 5
0
 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})
Exemplo n.º 6
0
 def get_trade_information(self):
     trade = utils.prepare_for_sending(self._trade)
     return self._account, trade, self._prepayment, self._bill, self._refund
Exemplo n.º 7
0
 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})
Exemplo n.º 8
0
    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