Skip to content

Commit e03d235

Browse files
Merge pull request #715 from qubic/develop (Release v1.274.0)
Release v1.274.0
2 parents 6f020e2 + 57cd01c commit e03d235

File tree

12 files changed

+3816
-14
lines changed

12 files changed

+3816
-14
lines changed

src/Qubic.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<ClInclude Include="common_buffers.h" />
2525
<ClInclude Include="contracts\ComputorControlledFund.h" />
2626
<ClInclude Include="contracts\Qdraw.h" />
27+
<ClInclude Include="contracts\qRWA.h" />
2728
<ClInclude Include="contracts\Qswap.h" />
2829
<ClInclude Include="contracts\RandomLottery.h" />
2930
<ClInclude Include="contracts\SupplyWatcher.h" />

src/Qubic.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@
312312
<ClInclude Include="contract_core\execution_time_accumulator.h">
313313
<Filter>contract_core</Filter>
314314
</ClInclude>
315+
<ClInclude Include="contracts\qRWA.h">
316+
<Filter>contracts</Filter>
317+
</ClInclude>
315318
</ItemGroup>
316319
<ItemGroup>
317320
<Filter Include="platform">

src/contract_core/contract_def.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,20 @@
201201
#define CONTRACT_STATE2_TYPE QRAFFLE2
202202
#include "contracts/QRaffle.h"
203203

204+
#ifndef NO_QRWA
205+
206+
#undef CONTRACT_INDEX
207+
#undef CONTRACT_STATE_TYPE
208+
#undef CONTRACT_STATE2_TYPE
209+
210+
#define QRWA_CONTRACT_INDEX 20
211+
#define CONTRACT_INDEX QRWA_CONTRACT_INDEX
212+
#define CONTRACT_STATE_TYPE QRWA
213+
#define CONTRACT_STATE2_TYPE QRWA2
214+
#include "contracts/qRWA.h"
215+
216+
#endif
217+
204218
// new contracts should be added above this line
205219

206220
#ifdef INCLUDE_CONTRACT_TEST_EXAMPLES
@@ -308,6 +322,9 @@ constexpr struct ContractDescription
308322
{"QBOND", 182, 10000, sizeof(QBOND)}, // proposal in epoch 180, IPO in 181, construction and first use in 182
309323
{"QIP", 189, 10000, sizeof(QIP)}, // proposal in epoch 187, IPO in 188, construction and first use in 189
310324
{"QRAFFLE", 192, 10000, sizeof(QRAFFLE)}, // proposal in epoch 190, IPO in 191, construction and first use in 192
325+
#ifndef NO_QRWA
326+
{"QRWA", 197, 10000, sizeof(QRWA)}, // proposal in epoch 195, IPO in 196, construction and first use in 197
327+
#endif
311328
// new contracts should be added above this line
312329
#ifdef INCLUDE_CONTRACT_TEST_EXAMPLES
313330
{"TESTEXA", 138, 10000, sizeof(TESTEXA)},
@@ -423,6 +440,9 @@ static void initializeContracts()
423440
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QBOND);
424441
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QIP);
425442
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QRAFFLE);
443+
#ifndef NO_QRWA
444+
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QRWA);
445+
#endif
426446
// new contracts should be added above this line
427447
#ifdef INCLUDE_CONTRACT_TEST_EXAMPLES
428448
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(TESTEXA);

src/contracts/QIP.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,21 @@ struct QIP : public ContractBase
464464
state.transferRightsFee = 100;
465465
}
466466

467+
struct BEGIN_EPOCH_locals
468+
{
469+
ICOInfo ico;
470+
};
471+
472+
BEGIN_EPOCH_WITH_LOCALS()
473+
{
474+
if (qpi.epoch() == 196)
475+
{
476+
locals.ico = state.icos.get(0);
477+
locals.ico.remainingAmountForPhase3 = qpi.numberOfPossessedShares(locals.ico.assetName, locals.ico.issuer, SELF, SELF, SELF_INDEX, SELF_INDEX);
478+
state.icos.set(0, locals.ico);
479+
}
480+
}
481+
467482
struct END_EPOCH_locals
468483
{
469484
ICOInfo ico;
@@ -477,20 +492,19 @@ struct QIP : public ContractBase
477492
locals.ico = state.icos.get(locals.idx);
478493
if (locals.ico.startEpoch == qpi.epoch() && locals.ico.remainingAmountForPhase1 > 0)
479494
{
495+
locals.ico.remainingAmountForPhase2 += locals.ico.remainingAmountForPhase1;
480496
locals.ico.remainingAmountForPhase1 = 0;
481-
locals.ico.remainingAmountForPhase2 += locals.ico.remainingAmountForPhase1;
482497
state.icos.set(locals.idx, locals.ico);
483498
}
484499
if (locals.ico.startEpoch + 1 == qpi.epoch() && locals.ico.remainingAmountForPhase2 > 0)
485500
{
486-
locals.ico.remainingAmountForPhase2 = 0;
487501
locals.ico.remainingAmountForPhase3 += locals.ico.remainingAmountForPhase2;
502+
locals.ico.remainingAmountForPhase2 = 0;
488503
state.icos.set(locals.idx, locals.ico);
489504
}
490505
if (locals.ico.startEpoch + 2 == qpi.epoch() && locals.ico.remainingAmountForPhase3 > 0)
491506
{
492507
qpi.transferShareOwnershipAndPossession(locals.ico.assetName, locals.ico.issuer, SELF, SELF, locals.ico.remainingAmountForPhase3, locals.ico.creatorOfICO);
493-
locals.ico.remainingAmountForPhase3 = 0;
494508
state.icos.set(locals.idx, state.icos.get(state.numberOfICO - 1));
495509
state.numberOfICO--;
496510
}

0 commit comments

Comments
 (0)