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)
示例#2
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
示例#3
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)
示例#4
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")