def main(sample_period, auction_address, chain_name, state_file, host, port):
from gevent.pywsgi import WSGIServer
app = Flask(__name__)
api = Api(app)
project = Project()
with project.get_chain(chain_name) as chain:
Auction = chain.provider.get_contract_factory('DutchAuction')
auction_contract = Auction(address=auction_address)
sampler = EventSampler(auction_address, chain, state_file_path=state_file)
api.add_resource(AuctionStatus, "/status",
resource_class_kwargs={'auction_contract': auction_contract,
'sampler': sampler})
rest_server = WSGIServer((host, port), app)
server_greenlet = gevent.spawn(rest_server.serve_forever)
server_greenlet.join()
评论列表
文章目录