Skip to content

Commit

Permalink
currency -> asset fixes #617
Browse files Browse the repository at this point in the history
allow 12 character long asset codes fixes #616
name offers in a more intuitive way fixes #573
  • Loading branch information
jedmccaleb committed Jul 20, 2015
1 parent 9c0504d commit b61983a
Show file tree
Hide file tree
Showing 35 changed files with 779 additions and 598 deletions.
8 changes: 7 additions & 1 deletion Builds/VisualStudio2015/stellar-core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@
<ClInclude Include="..\..\src\util\Timer.h" />
<ClInclude Include="..\..\src\util\types.h" />
<ClInclude Include="..\..\src\util\XDRStream.h" />
<ClInclude Include="src\generated\xdr\Stellar-ledger-entries.h" />
<ClInclude Include="src\generated\xdr\Stellar-ledger.h" />
<ClInclude Include="src\generated\xdr\Stellar-overlay.h" />
<ClInclude Include="src\generated\xdr\Stellar-SCP.h" />
<ClInclude Include="src\generated\xdr\Stellar-transaction.h" />
<ClInclude Include="src\generated\xdr\Stellar-types.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\AUTHORS" />
Expand Down Expand Up @@ -537,4 +543,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
37 changes: 24 additions & 13 deletions Builds/VisualStudio2015/stellar-core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@
<Filter Include="herder">
<UniqueIdentifier>{951355b1-432c-4dbe-87c0-bf77b6fab706}</UniqueIdentifier>
</Filter>
<Filter Include="overlay\generated">
<UniqueIdentifier>{a9692317-8851-4932-8329-6d2bb1a54787}</UniqueIdentifier>
</Filter>
<Filter Include="xdr">
<UniqueIdentifier>{fe536180-763e-40aa-8c30-2a100a064b94}</UniqueIdentifier>
</Filter>
Expand All @@ -85,6 +82,9 @@
<Filter Include="herder\docs">
<UniqueIdentifier>{aa45d521-588a-4f8f-b737-d3667c7d9404}</UniqueIdentifier>
</Filter>
<Filter Include="xdr\generated">
<UniqueIdentifier>{02035318-e72a-43b0-a250-8b3af9fb4bbf}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\ledger\LedgerManagerImpl.cpp">
Expand Down Expand Up @@ -491,9 +491,6 @@
<ClInclude Include="..\..\src\overlay\OverlayManagerImpl.h">
<Filter>overlay</Filter>
</ClInclude>
<ClInclude Include="..\..\src\generated\StellarXDR.h">
<Filter>overlay\generated</Filter>
</ClInclude>
<ClInclude Include="..\..\src\main\Config.h">
<Filter>main</Filter>
</ClInclude>
Expand Down Expand Up @@ -788,6 +785,25 @@
<ClInclude Include="..\..\src\main\dumpxdr.h">
<Filter>main</Filter>
</ClInclude>
<ClInclude Include="..\..\src\overlay\StellarXDR.h" />
<ClInclude Include="src\generated\xdr\Stellar-ledger.h">
<Filter>xdr\generated</Filter>
</ClInclude>
<ClInclude Include="src\generated\xdr\Stellar-ledger-entries.h">
<Filter>xdr\generated</Filter>
</ClInclude>
<ClInclude Include="src\generated\xdr\Stellar-overlay.h">
<Filter>xdr\generated</Filter>
</ClInclude>
<ClInclude Include="src\generated\xdr\Stellar-SCP.h">
<Filter>xdr\generated</Filter>
</ClInclude>
<ClInclude Include="src\generated\xdr\Stellar-transaction.h">
<Filter>xdr\generated</Filter>
</ClInclude>
<ClInclude Include="src\generated\xdr\Stellar-types.h">
<Filter>xdr\generated</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\AUTHORS" />
Expand Down Expand Up @@ -858,9 +874,6 @@
</None>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\src\overlay\StellarXDR.x">
<Filter>overlay</Filter>
</CustomBuild>
<CustomBuild Include="..\..\src\xdr\Stellar-ledger.x">
<Filter>xdr</Filter>
</CustomBuild>
Expand All @@ -876,8 +889,6 @@
<CustomBuild Include="..\..\src\xdr\Stellar-ledger-entries.x">
<Filter>xdr</Filter>
</CustomBuild>
<CustomBuild Include="..\..\src\scp\Stellar-SCP.x">
<Filter>scp</Filter>
</CustomBuild>
<CustomBuild Include="..\..\src\xdr\Stellar-SCP.x" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Other details:
single, standard XDR for canonical (hashed) format, history, and
inter-node messaging.

- No use of custom datatypes (No custom time epochs, currency codes, decimal
- No use of custom datatypes (No custom time epochs, asset codes, decimal
floating point, etc.)


Expand Down
2 changes: 1 addition & 1 deletion docs/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- [Transactions] (transaction.md)
- [Operations] (operations.md)
- [Reserve and Fees] (fees.md)
- [Issuing Currency] (currency.md)
- [Issuing Asset] (asset.md)
- [Distributed Exchange] (exchange.md)
- [History System] (history.md)
- [Versioning and Upgrading] (versioning.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ category: Getting Started
# Stellar-core Overview

Stellar is a decentralized, federated peer-to-peer network that allows people to
send payments in any currency anywhere in the world instantaneously, and with
send payments in any asset anywhere in the world instantaneously, and with
minimal fee.

`Stellar-core` is the core component of this network. `Stellar-core` is a C++
Expand Down
4 changes: 2 additions & 2 deletions src/bucket/BucketTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ TEST_CASE("merging bucket entries", "[bucket]")
liveEntry.trustLine() = tlGen(10);
deadEntry.type(TRUSTLINE);
deadEntry.trustLine().accountID = liveEntry.trustLine().accountID;
deadEntry.trustLine().currency = liveEntry.trustLine().currency;
deadEntry.trustLine().asset = liveEntry.trustLine().asset;
std::vector<LedgerEntry> live{liveEntry};
std::vector<LedgerKey> dead{deadEntry};
std::shared_ptr<Bucket> b1 =
Expand All @@ -472,7 +472,7 @@ TEST_CASE("merging bucket entries", "[bucket]")
liveEntry.type(OFFER);
liveEntry.offer() = ofGen(10);
deadEntry.type(OFFER);
deadEntry.offer().accountID = liveEntry.offer().accountID;
deadEntry.offer().sellerID = liveEntry.offer().sellerID;
deadEntry.offer().offerID = liveEntry.offer().offerID;
std::vector<LedgerEntry> live{liveEntry};
std::vector<LedgerKey> dead{deadEntry};
Expand Down
10 changes: 5 additions & 5 deletions src/bucket/LedgerCmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ using xdr::operator<;
*
* - The same type
* - If accounts, then with same accountID
* - If trustlines, then with same (accountID, currency) pair
* - If offers, then with same (accountID, sequence) pair
* - If trustlines, then with same (accountID, asset) pair
* - If offers, then with same (sellerID, sequence) pair
*
* Equivalently: Two LedgerEntries have the same 'identity' iff their
* corresponding LedgerKeys are exactly equal. This operator _could_ be
Expand Down Expand Up @@ -55,17 +55,17 @@ struct LedgerEntryIdCmp
if (btl.accountID < atl.accountID)
return false;
{
return atl.currency < btl.currency;
return atl.asset < btl.asset;
}
}

case OFFER:
{
auto const& aof = a.offer();
auto const& bof = b.offer();
if (aof.accountID < bof.accountID)
if (aof.sellerID < bof.sellerID)
return true;
if (bof.accountID < aof.accountID)
if (bof.sellerID < aof.sellerID)
return false;
return aof.offerID < bof.offerID;
}
Expand Down
8 changes: 4 additions & 4 deletions src/ledger/EntryFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ EntryFrame::storeLoad(LedgerKey const& key, Database& db)
{
auto const& tl = key.trustLine();
res = std::static_pointer_cast<EntryFrame>(
TrustFrame::loadTrustLine(tl.accountID, tl.currency, db));
TrustFrame::loadTrustLine(tl.accountID, tl.asset, db));
}
break;
case OFFER:
{
auto const& off = key.offer();
res = std::static_pointer_cast<EntryFrame>(
OfferFrame::loadOffer(off.accountID, off.offerID, db));
OfferFrame::loadOffer(off.sellerID, off.offerID, db));
}
break;
}
Expand Down Expand Up @@ -158,12 +158,12 @@ LedgerEntryKey(LedgerEntry const& e)
case TRUSTLINE:
k.type(TRUSTLINE);
k.trustLine().accountID = e.trustLine().accountID;
k.trustLine().currency = e.trustLine().currency;
k.trustLine().asset = e.trustLine().asset;
break;

case OFFER:
k.type(OFFER);
k.offer().accountID = e.offer().accountID;
k.offer().sellerID = e.offer().sellerID;
k.offer().offerID = e.offer().offerID;
break;
}
Expand Down
12 changes: 6 additions & 6 deletions src/ledger/LedgerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ auto validLedgerEntryGenerator = autocheck::map(
{
case TRUSTLINE:
{
le.trustLine().currency.type(CURRENCY_TYPE_ALPHANUM);
strToCurrencyCode(le.trustLine().currency.alphaNum().currencyCode,
le.trustLine().asset.type(ASSET_TYPE_CREDIT_ALPHANUM4);
strToAssetCode(le.trustLine().asset.alphaNum4().assetCode,
"USD");
clampLow<int64_t>(0, le.trustLine().balance);
clampLow<int64_t>(0, le.trustLine().limit);
Expand All @@ -55,12 +55,12 @@ auto validLedgerEntryGenerator = autocheck::map(

case OFFER:
{
le.offer().takerGets.type(CURRENCY_TYPE_ALPHANUM);
strToCurrencyCode(le.offer().takerGets.alphaNum().currencyCode,
le.offer().selling.type(ASSET_TYPE_CREDIT_ALPHANUM4);
strToAssetCode(le.offer().selling.alphaNum4().assetCode,
"CAD");

le.offer().takerPays.type(CURRENCY_TYPE_ALPHANUM);
strToCurrencyCode(le.offer().takerPays.alphaNum().currencyCode,
le.offer().buying.type(ASSET_TYPE_CREDIT_ALPHANUM4);
strToAssetCode(le.offer().buying.alphaNum4().assetCode,
"EUR");

clampLow<int64_t>(0, le.offer().amount);
Expand Down
Loading

4 comments on commit b61983a

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from graydon
at jedmccaleb@b61983a

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging jedmccaleb/stellar-core/master = b61983a into auto

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jedmccaleb/stellar-core/master = b61983a merged ok, testing candidate = f377b61d

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.