Exemplo n.º 1
0
def getValidBid():
    b = Offer()
    b.model = validBidDict['model']
    b.objective = validBidDict['objective']
    b.token = validBidDict['token']
    b.cost = validBidDict['cost']
    b.validator = validBidDict['validator']
    b.lighthouse = validBidDict['lighthouse']
    b.lighthouseFee = validBidDict['lighthouseFee']
    b.deadline = validBidDict['deadline']
    b.nonce = unhexlify(validBidDict['nonce'].encode('utf-8'))
    b.signature = unhexlify(validBidDict['signature'].encode('utf-8'))
    return b
Exemplo n.º 2
0
def dict2bid(m):
    msg = Offer()
    msg.model = m['model']
    msg.objective = m['objective']
    msg.token = m['token']
    msg.cost = m['cost']
    msg.validator = m['validator']
    msg.lighthouse = m['lighthouse']
    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
Exemplo n.º 3
0
def getValidBid():
    b = Offer()
    b.model = Multihash()
    b.model.multihash = validBidDict['model']
    b.objective = Multihash()
    b.objective.multihash = validBidDict['objective']
    b.token = Address()
    b.token.address = validBidDict['token']
    b.cost = UInt256()
    b.cost.uint256 = str(validBidDict['cost'])
    b.validator = Address()
    b.validator.address = validBidDict['validator']
    b.lighthouse = Address()
    b.lighthouse.address = validBidDict['lighthouse']
    b.lighthouseFee = UInt256()
    b.lighthouseFee.uint256 = str(validBidDict['lighthouseFee'])
    b.deadline = UInt256()
    b.deadline.uint256 = str(validBidDict['deadline'])
    b.sender = Address()
    b.sender.address = validAskDict['sender']
    b.nonce = UInt256()
    b.nonce.uint256 = str(validAskDict['nonce'])
    b.signature = unhexlify(validBidDict['signature'].encode('utf-8'))
    return b