def dummy_producer(msg):
     rospy.loginfo('Received ASK with objective: {}'.format(msg.objective))
     bid = Bid()
     bid.model = msg.model
     bid.token = msg.token
     bid.cost  = msg.cost
     bid.count = msg.count
     bid.deadline = msg.deadline
     bids.publish(bid)
 def prepare_bid(self, model, cost, deadline):
     msg = Bid()
     msg.model = model
     msg.token = self.token_address
     msg.cost = cost
     msg.count = 1
     msg.lighthouseFee = self.lighthouse_fee
     msg.salt = [0]
     msg.signature = [0]
     msg.deadline = deadline
     return msg
    def make_bid(self, incoming_ask):
        rospy.loginfo('Making bid...')

        bid = Bid()
        bid.model = self.model
        bid.objective = incoming_ask.objective
        bid.token = self.token
        bid.cost = incoming_ask.cost
        bid.lighthouseFee = 0
        bid.deadline = self.web3.eth.getBlock('latest').number + self.bid_lifetime
        self.signing_bid_pub(bid)
Пример #4
0
def dict2bid(m):
    msg = Bid()
    msg.model = m['model']
    msg.objective = m['objective']
    msg.token = m['token']
    msg.cost = m['cost']
    msg.lighthouseFee = m['lighthouseFee']
    msg.deadline = m['deadline']
    msg.nonce = unhexlify(m['nonce'].encode('utf-8'))
    msg.signature = unhexlify(m['signature'].encode('utf-8'))
    return msg
Пример #5
0
 def create_offer(m):
     rospy.loginfo('incoming ask')
     if m.model == self.model:
         offer = Bid()
         offer.model = self.model
         offer.objective = 'QmPGhwtN1ndML9iwDYPtMZeqNyQWQPaTRT981MQyZUZbwP'
         offer.token = '0xbD949595eE52346c225a19724084cE517B2cB735'
         offer.cost = 1
         offer.lighthouseFee = 0
         offer.deadline = m.deadline + 1000
         pub.publisher(offer)
Пример #6
0
        def callback(m):
            rospy.loginfo("about to make a bid")

            block = self.web3.eth.getBlock('latest')
            deadline = block.number + 10000  # should be enough for a day

            msg = Bid()
            msg.model = self.model
            msg.token = self.token
            msg.cost = self.cost
            msg.count = self.count
            msg.lighthouseFee = 0
            msg.deadline = deadline

            self.signing_bid.publish(msg)
Пример #7
0
def callback(data):
    if data.model != "QmdFh1HPVe7H4LrDio899mxA7NindgxqiNUM9BNnBD7ryA":
        return

    signing_bid = rospy.Publisher('/liability/infochan/signing/bid',
                                  Bid,
                                  queue_size=128)
    # signing_task = rospy.Publisher('/task', String, queue_size=128)

    rospy.loginfo("Got an Ask:")
    msg = Bid()
    msg.model = data.model
    msg.objective = data.objective
    rospy.loginfo(data)
    msg.token = data.token
    msg.cost = data.cost
    msg.lighthouseFee = 0
    msg.deadline = data.deadline

    rospy.loginfo("Publishing...")
    signing_bid.publish(msg)
    rospy.loginfo("Published Bid")