#ifndef TURNSTILE_H #define TURNSTILE_H #include "precompiled.h" class RPC; class MainWindow; struct Tx; struct TurnstileMigrationItem { QString fromAddr; QString intTAddr; QString destAddr; int blockNumber; double amount; int status; }; enum TurnstileMigrationItemStatus { NotStarted = 0, SentToT, SentToZS, NotEnoughBalance, UnknownError }; struct ProgressReport { int step; int totalSteps; int nextBlock; bool hasErrors; QString from; QString to; QString via; }; class Turnstile { public: Turnstile(RPC* _rpc, MainWindow* mainwindow); void planMigration(QString zaddr, QString destAddr, int splits, int numBlocks); QList splitAmount(double amount, int parts); void fillAmounts(QList& amounts, double amount, int count); QList readMigrationPlan(); void writeMigrationPlan(QList plan); void removeFile(); void executeMigrationStep(); ProgressReport getPlanProgress(); bool isMigrationPresent(); static double minMigrationAmount; private: QList getBlockNumbers(int start, int end, int count); QString writeableFile(); void doSendTx(Tx tx, std::function cb); QList::Iterator getNextStep(QList& plan); RPC* rpc; MainWindow* mainwindow; }; #endif