aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-12-15 00:22:25 +0800
committerGitHub <noreply@github.com>2016-12-15 00:22:25 +0800
commite97ba77a45b871e7404d8ff5b6432b2f7090dc61 (patch)
treebdf8c1915840e070ba5f72a4340ace8f032bb6c4
parent18f8f29c0a3ed9404f2950c11d77f85d0117c6d5 (diff)
parent56a027bedc88305fe05b09859cbab408d44a0106 (diff)
downloaddexon-solidity-e97ba77a45b871e7404d8ff5b6432b2f7090dc61.tar.gz
dexon-solidity-e97ba77a45b871e7404d8ff5b6432b2f7090dc61.tar.zst
dexon-solidity-e97ba77a45b871e7404d8ff5b6432b2f7090dc61.zip
Merge pull request #1508 from ethereum/multiurls
Use multiple URLs for metadata.
-rw-r--r--docs/miscellaneous.rst8
-rw-r--r--libsolidity/interface/CompilerStack.cpp6
2 files changed, 8 insertions, 6 deletions
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index 81e39a26..4a9dad87 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -334,10 +334,10 @@ Comments are of course also not permitted and used here only for explanatory pur
"myFile.sol": {
// Required: keccak256 hash of the source file
"keccak256": "0x123...",
- // Required (unless "content" is used, see below): URL to the
- // source file, protocol is more or less arbitrary, but a Swarm
- // URL is recommended
- "url": "bzzr://56ab..."
+ // Required (unless "content" is used, see below): Sorted URL(s)
+ // to the source file, protocol is more or less arbitrary, but a
+ // Swarm URL is recommended
+ "urls": [ "bzzr://56ab..." ]
},
"mortal": {
// Required: keccak256 hash of the source file
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index 0b8cecc7..4095844f 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -694,8 +694,10 @@ string CompilerStack::createOnChainMetadata(Contract const& _contract) const
solAssert(s.second.scanner, "Scanner not available");
meta["sources"][s.first]["keccak256"] =
"0x" + toHex(dev::keccak256(s.second.scanner->source()).asBytes());
- meta["sources"][s.first]["url"] =
- "bzzr://" + toHex(dev::swarmHash(s.second.scanner->source()).asBytes());
+ meta["sources"][s.first]["urls"] = Json::arrayValue;
+ meta["sources"][s.first]["urls"].append(
+ "bzzr://" + toHex(dev::swarmHash(s.second.scanner->source()).asBytes())
+ );
}
meta["settings"]["optimizer"]["enabled"] = m_optimize;
meta["settings"]["optimizer"]["runs"] = m_optimizeRuns;