A marketplace listing from an early decentralised marketplace dapp: an admin and a metadata string describing the market.
Key Facts
Description
Market holds the description of one market for the marketplace dapp. Orders placed in it are separate Order contracts.
Source Verified
Exact runtime and creation bytecode match with soljson v0.1.6+commit.d41f8b7c, optimizer on. Source: github.com/gitter-badger/dapp, revision blob dbf1c8cf89 (author original, verbatim). Verified on Etherscan. Not submitted to Sourcify: its oldest supported compiler is v0.1.7.
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract Keystore{
event Key(address indexed addr, bytes data);
function setKey(bytes data){
Key(msg.sender, data);
}
}
contract OrderBook{
event Entry(
address indexed orderAddr
,address indexed storeAddr
,address indexed marketAddr
);
function addEntry(address orderAddr, address storeAddr, address marketAddr){
Entry(orderAddr, storeAddr, marketAddr);
}
}
contract AliasReg {
mapping(address=>bytes32) addrToAliasMap;
mapping(bytes32=>address) aliasToAddrMap;
function claimAlias(bytes32 alias){
if(aliasToAddrMap[alias] != address(0)) throw;
addrToAliasMap[msg.sender]=alias;
aliasToAddrMap[alias]=msg.sender;
}
function getAlias(address addr) constant returns(bytes32){
return addrToAliasMap[addr];
}
function getAddr(bytes32 alias) constant returns(address){
return aliasToAddrMap[alias];
}
}
contract owned{
address owner;
function owned(){
owner = msg.sender;
}
function getOwner() constant returns (address){
return owner;
}
function setOwner(address _owner){
if(msg.sender!=owner) throw;
owner=_owner;
}
}
contract forumable is owned{
address forumAddr;
function forumable(){
var forum = new Forum();
forumAddr = address(forum);
}
function getForumAddr() constant returns(address){
return forumAddr;
}
function setForumAddr(address _forumAddr){
if(msg.sender != owner) throw;
forumAddr = _forumAddr;
}
}
contract Forum is owned{
uint fee;
event Comment(address indexed author, bytes32 indexed parentId, bytes data);
event Moderation(bytes indexed comment, uint8 direction);
function addComment(bytes32 parentId, bytes data){
Comment(msg.sender, parentId, data);
}
function setFee(uint _fee){
if(msg.sender != owner) throw;
fee = _fee;
}
function getFee() constant returns(uint){
return fee;
}
}
contract audible is owned{
function addComment(address forumAddr, bytes32 parentId, bytes data){
if(msg.sender!=owner) throw;
Forum(forumAddr).addComment(parentId,data);
}
}
contract Market is forumable,audible{
event Meta(bytes meta);
bool constant public isMarket = true;
function Market(bytes32 alias, bytes meta, address alasRegAddr){
AliasReg(alasRegAddr).claimAlias(alias);
Meta(meta);
}
function setMeta(bytes meta){
if(msg.sender!=owner) throw;
Meta(meta);
}
}
contract Order{
address buyer;
address storeAddr;
address storeOwner;
address marketAddr;
address marketOwner;
uint feePercentage;
uint disputeSeconds;
uint status;
uint received;
uint timestamp;
uint shippedAt;
uint disputedAt;
uint fee;
uint buyerAmount;
uint receivedAtBlockNumber;
event Meta(bytes meta);
event Message(address indexed sender, bytes text);
event Update(address indexed sender, uint indexed status);
uint constant initialized = 0;
uint constant cancelled = 1;
uint constant shipped = 2;
uint constant finalized = 3;
uint constant disputed = 4;
uint constant resolved = 5;
function Order(
bytes _meta
,address _storeAddr
,address _marketAddr
,uint _feePercentage
,uint _disputeSeconds
,address orderBookAddr
){
buyer = msg.sender;
storeAddr = _storeAddr;
storeOwner = Store(_storeAddr).getOwner();
marketAddr = _marketAddr;
marketOwner = Market(_marketAddr).getOwner();
feePercentage = _feePercentage;
disputeSeconds = _disputeSeconds;
timestamp = now;
Meta(_meta);
OrderBook(orderBookAddr).addEntry(address(this),_storeAddr,_marketAddr);
}
function addMessage(bytes text){
if(msg.sender != buyer && msg.sender != storeOwner && msg.sender != marketOwner)
throw;
Message(msg.sender, text);
}
function(){
received += msg.value;
receivedAtBlockNumber = block.number;
}
function withdraw(uint amount){
if(msg.sender != buyer)
throw;
if(status != initialized)
throw;
if(amount>received)
throw;
var isSent = buyer.send(amount);
if(isSent){
receivedAtBlockNumber = block.number;
received -= amount;
}
}
function getBuyer() constant returns(address){
return buyer;
}
function getStoreAddr() constant returns(address){
return storeAddr;
}
function getMarketAddr() constant returns(address){
return marketAddr;
}
function getFeePercentage() constant returns(uint){
return feePercentage;
}
function getStatus() constant returns(uint){
return status;
}
function getReceived() constant returns(uint){
return received;
}
function getDisputeSeconds() constant returns(uint){
return disputeSeconds;
}
function getTimestamp() constant returns(uint){
return timestamp;
}
function getShippedAt() constant returns(uint){
return shippedAt;
}
function getFee() constant returns(uint){
return fee;
}
function getBuyerAmount() constant returns(uint){
return buyerAmount;
}
function getReceivedAtBlockNumber() constant returns(uint){
return receivedAtBlockNumber;
}
function addUpdate(uint _status) private{
status = _status;
Update(msg.sender,_status);
}
function cancel(){
if(status != initialized)
throw;
if(msg.sender != buyer && msg.sender != storeOwner)
throw;
var isSent = buyer.send(this.balance);
if(!isSent) throw;
addUpdate(cancelled);
}
function markAsShipped(){
if(status != initialized)
throw;
if(msg.sender != storeOwner)
throw;
//don't allow to mark as shipped on same block that a withdrawl is made
if(receivedAtBlockNumber == block.number)
throw;
shippedAt = now;
addUpdate(shipped);
}
function finalize(){
if(status != shipped)
throw;
if(msg.sender != buyer && msg.sender != storeOwner)
throw;
if(msg.sender == storeOwner && now - shippedAt < disputeSeconds)
throw;
var isSent = storeOwner.send(this.balance);
if(!isSent) throw;
addUpdate(finalized);
}
function dispute(){
if(msg.sender != buyer)
throw;
if(status != shipped)
throw;
if(now - shippedAt > disputeSeconds)
throw;
if(marketOwner==address(0))
throw;
addUpdate(disputed);
disputedAt=now;
}
function calculateFee() returns (uint){
// show your work:
// 1. fee = products(feePercent)
// products = fee/feePercent
// products = fee/(feePercentage/100)
// products = (100*fee)/feePercentage
// 2. products + fee = received
// (100*fee)/feePercentage + fee = received
// fee(100/feePercentage + 1) = received
// fee(100/feePercentage + feePercentage/feePercentage) = received
// fee(100+feePercentage)/feePercentage = received
// fee = received/((100+feePercentage)/feePercentage)
// fee = (received * feePercentage)/(100 + feePercentage)
return (received * feePercentage)/(100 + feePercentage);
}
function resolve(uint buyerPercentage){
if(status!=disputed)
throw;
if(msg.sender != marketOwner)
throw;
fee = calculateFee();
buyerAmount = ((received-fee)*buyerPercentage)/100;
var storeOwnerAmount = received - fee - buyerAmount;
marketOwner.send(fee);
if(buyerAmount>0)
buyer.send(buyerAmount);
if(storeOwnerAmount>0)
storeOwner.send(storeOwnerAmount);
addUpdate(resolved);
}
}
contract Store is forumable,audible{
event Meta(bytes meta);
bool constant public isStore = true;
function Store(bytes32 alias, bytes meta, address alasRegAddr){
Meta(meta);
AliasReg(alasRegAddr).claimAlias(alias);
}
function setMeta(bytes meta){
if(msg.sender!=owner) throw;
Meta(meta);
}
}External Links
Related contracts
OpenStore
Same deployerAn open key-value store from an early decentralised marketplace dapp: any account can save a value under its own address, with a timestamp.
0xaf5276...63e191September 30, 2015Contract 0x928fd6...a394a2
Same deployerA first come first served name registry from November 2015: claim a bytes32 alias for your address, and it can never be released.
0x928fd6...a394a2November 23, 2015Contract 0xdfe162...689c7a
Same deployerA contract with no storage at all that exists only to write three indexed addresses into the log.
0xdfe162...689c7aNovember 23, 2015Keystore
Same deployerA public-key directory for an early decentralised marketplace dapp: each account stores the key others use to encrypt messages to it.
0x8eca08...3d5e61November 23, 2015Contract 0x33bf61...f98a64
Same deployerA first come first served name registry from November 2015: claim a bytes32 alias for your address, and it can never be released.
0x33bf61...f98a64November 23, 2015Contract 0x5cdb3c...662fd1
Same deployerA contract with no storage at all that exists only to write three indexed addresses into the log.
0x5cdb3c...662fd1November 23, 2015