Beispiel #1
0
// Helper function
CubeSignature::CubeSignature(const PAlgebra& alg): ndims(0)
{
  Vec<long> _dims(INIT_SIZE, alg.numOfGens());
  for (long i=0; i<(long)alg.numOfGens(); i++) _dims[i] = alg.OrderOf(i);
  initSignature(_dims);
}
StubChainAdaptor::StubChainAdaptor(QObject* parent)
    : QObject(parent)
{
    auto orphanage = message.getOrphanage();
    auto coinOrphan = orphanage.newOrphan<Coin>();
    auto coin = coinOrphan.get();
    coin.setName("BTS");
    coin.setId(0);
    coin.setPrecision(5);
    coins.emplace_back(kj::mv(coinOrphan));

    coinOrphan = orphanage.newOrphan<Coin>();
    coin = coinOrphan.get();
    coin.setName("FMV");
    coin.setId(1);
    coin.setPrecision(0);
    coins.emplace_back(kj::mv(coinOrphan));

    coinOrphan = orphanage.newOrphan<Coin>();
    coin = coinOrphan.get();
    coin.setName("USD");
    coin.setId(2);
    coin.setPrecision(2);
    coins.emplace_back(kj::mv(coinOrphan));

    std::reference_wrapper<std::vector<capnp::Orphan<Balance>>> bals = balances["nathan"];
    auto balanceOrphan = orphanage.newOrphan<Balance>();
    auto balance = balanceOrphan.get();
    balance.setAmount(50000000);
    balance.initId(1)[0] = 0;
    balance.setType(0);
    bals.get().emplace_back(kj::mv(balanceOrphan));

    balanceOrphan = orphanage.newOrphan<Balance>();
    balance = balanceOrphan.get();
    balance.setAmount(10);
    balance.initId(1)[0] = 1;
    balance.setType(1);
    bals.get().emplace_back(kj::mv(balanceOrphan));

    balanceOrphan = orphanage.newOrphan<Balance>();
    balance = balanceOrphan.get();
    balance.setAmount(5000);
    balance.initId(1)[0] = 2;
    balance.setType(2);
    bals.get().emplace_back(kj::mv(balanceOrphan));

    bals = balances["dev.nathanhourt.com"];

    balanceOrphan = orphanage.newOrphan<Balance>();
    balance = balanceOrphan.get();
    balance.setAmount(10000000);
    balance.initId(1)[0] = 3;
    balance.setType(0);
    bals.get().emplace_back(kj::mv(balanceOrphan));

    bals = balances["adam"];

    balanceOrphan = orphanage.newOrphan<Balance>();
    balance = balanceOrphan.get();
    balance.setAmount(88);
    balance.initId(1)[0] = 4;
    balance.setType(1);
    bals.get().emplace_back(kj::mv(balanceOrphan));

    auto contestOrphan = orphanage.newOrphan<Contest>();
    auto contest = contestOrphan.get();
    auto ucontest = contest.getContest();
    contest.initSignature(0);
    ucontest.initId(1)[0] = 0;
    ucontest.setCoin(1);
    ucontest.setName("Lunch poll");
    ucontest.setDescription("Where should we go for lunch?");
    ucontest.setStartTime(static_cast<uint64_t>(QDateTime::fromString("2015-09-20T12:00:00",
                                                                      Qt::ISODate).toMSecsSinceEpoch()));
    auto tags = ucontest.initTags(1);
    tags[0].setKey("category");
    tags[0].setValue("food");
    auto contestants = ucontest.initContestants(3);
    contestants[0].setName("Wikiteria");
    contestants[0].setDescription("Cafeteria on the CRC campus");
    contestants[1].setName("Wicked Taco");
    contestants[1].setDescription("Restaurant on Prices Fork");
    contestants[2].setName("Firehouse");
    contestants[2].setDescription("Sub Shop on University City Blvd");
    contests.emplace_back(kj::mv(contestOrphan));

    contestOrphan = orphanage.newOrphan<Contest>();
    contest = contestOrphan.get();
    ucontest = contest.getContest();
    contest.initSignature(0);
    ucontest.initId(1)[0] = 1;
    ucontest.setCoin(0);
    ucontest.setName("Upgrade Authorization");
    ucontest.setDescription("Do the BitShares stakeholders accept the upgrade to version 2.0, "
                            "using the Graphene Toolkit?");
    ucontest.setStartTime(static_cast<uint64_t>(QDateTime::fromString("2015-09-11T12:00:00",
                                                                      Qt::ISODate).toMSecsSinceEpoch()));
    tags = ucontest.initTags(1);
    tags[0].setKey("category");
    tags[0].setValue("hard-forks");
    contestants = ucontest.initContestants(2);
    contestants[0].setName("Yes");
    contestants[0].setDescription("Accept the upgrade, and hard-fork to BitShares 2.0");
    contestants[1].setName("No");
    contestants[1].setDescription("Reject the upgrade, and continue using BitShares 0.9.x");
    contests.emplace_back(kj::mv(contestOrphan));
}