This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateStatus(string _domain) public { | |
if (canBeWhitelisted(_domain)) { | |
whitelistApplication(_domain); | |
_NewDomainWhitelisted(_domain); | |
} else if (challengeCanBeResolved(_domain)) { | |
resolveChallenge(_domain); | |
} else { | |
revert(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resetListing(string _domain) private { | |
bytes32 domainHash = keccak256(_domain); | |
Listing storage listing = listings[domainHash]; | |
// Transfers any remaining balance back to the owner | |
if (listing.unstakedDeposit > 0) | |
require(token.transfer(listing.owner, listing.unstakedDeposit)); | |
delete listings[domainHash]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Data { | |
uint rewardPool; // (remaining) Pool of tokens distributed amongst winning voters | |
PLCRVoting voting; // Address of a PLCRVoting contract | |
StandardToken token; // Address of an ERC20 token contract | |
uint challengeID; // An ID corresponding to a pollID in the PLCR contract | |
address challenger; // Owner of Challenge | |
bool resolved; // Indication of if challenge is resolved | |
uint stake; // Number of tokens at risk for either party during challenge | |
uint winningTokens; // (remaining) Amount of tokens used for voting by the winning side | |
mapping(address => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function challenge(string _domain) external returns (uint challengeID) { | |
bytes32 domainHash = keccak256(_domain); | |
Listing storage listing = listings[domainHash]; | |
uint deposit = parameterizer.get("minDeposit"); | |
// Domain must be in apply stage or already on the whitelist | |
require(appWasMade(_domain) || listing.whitelisted); | |
// Prevent multiple challenges | |
require(!challenges[listing.challengeID].isInitialized() || | |
challenges[listing.challengeID].isResolved()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Listing { | |
uint applicationExpiry; // Expiration date of apply stage | |
bool whitelisted; // Indicates registry status | |
address owner; // Owner of Listing | |
uint unstakedDeposit; // Number of unlocked tokens with potential risk if challenged | |
uint challengeID; // Identifier of canonical challenge | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function apply(string _domain, uint _amount) external { | |
require(!isWhitelisted(_domain)); | |
require(!appWasMade(_domain)); | |
require(_amount >= parameterizer.get("minDeposit")); | |
// Sets owner | |
Listing storage listing = listings[keccak256(_domain)]; | |
listing.owner = msg.sender; | |
// Transfers tokens from user to Registry contract |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Registry( | |
address _tokenAddr, | |
address _plcrAddr, | |
address _paramsAddr | |
) { | |
token = StandardToken(_tokenAddr); | |
voting = PLCRVoting(_plcrAddr); | |
parameterizer = Parameterizer(_paramsAddr); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function startPoll(uint _voteQuorum, uint _commitDuration, uint _revealDuration) public returns (uint pollID) { | |
pollNonce = pollNonce + 1; | |
pollMap[pollNonce] = Poll({ | |
voteQuorum: _voteQuorum, | |
commitEndDate: block.timestamp + _commitDuration, | |
revealEndDate: block.timestamp + _commitDuration + _revealDuration, | |
votesFor: 0, | |
votesAgainst: 0 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library AttributeStore { | |
struct Data { | |
mapping(bytes32 => uint) store; | |
} | |
function getAttribute(Data storage self, bytes32 UUID, string attrName) returns (uint) { | |
bytes32 key = sha3(UUID, attrName); | |
return self.store[key]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library DLL { | |
struct Node { | |
uint next; | |
uint prev; | |
} | |
struct Data { | |
mapping(uint => Node) dll; | |
} |