npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

plankton-keeper-abi

v0.0.2

Published

Plankton Keeper Json ABI files

Downloads

10

Readme

Integration of TCRs, CPM and Ocean Tokens with Solidity

name: Integration of TCRs, CPM, and Ocean tokens with Solidity
type: development
status: initial draft
editor: Fang Gong <[email protected]>
collaborator: Aitor Argomaniz <[email protected]>
date: 06/01/2018

1. Objective

In this POC, we put following modules together:

  • TCRs: users create challenges and resolve them through voting to maintain registries;
  • Ocean Tokens: the intrinsic tokens circulated inside Ocean network, which is used in the voting of TCRs;
  • Curated Proofs Market: the core marketplace where people can transact with each other and curate assets through staking with Ocean tokens.

2. Public Interface

The following project exposes the following public interfaces:

2.1 Curation Market

//Allows a user to start an application. Takes tokens from user and sets apply stage end time.
function apply(bytes32 _listingHash, uint _amount, string _data);

// Allows the owner of a listingHash to increase their unstaked deposit.
function deposit(bytes32 _listingHash, uint _amount);

//Allows the owner of a listingHash to decrease their unstaked deposit.
function withdraw(bytes32 _listingHash, uint _amount);

// Allows the owner of a listingHash to remove the listingHash from the whitelist
function exit(bytes32 _listingHash);

// Starts a poll for a listingHash which is either in the apply stage or already in the whitelist. 
function challenge(bytes32 _listingHash, string _data);

// Updates a listingHash’s status from ‘application’ to ‘listing’ or resolves a challenge if one exists.
function updateStatus(bytes32 _listingHash);

// Called by a voter to claim their reward for each completed vote.
function claimReward(uint _challengeID, uint _salt);

// Calculates the provided voter’s token reward for the given poll.
function voterReward(address _voter, uint _challengeID, uint _salt);

// Determines whether the given listingHash be whitelisted.
function canBeWhitelisted(bytes32 _listingHash);

// Returns true if the provided listingHash is whitelisted
function isWhitelisted(bytes32 _listingHash);

// Determines the number of tokens awarded to the winning party in a challenge.
   function determineReward(uint _challengeID);

2.2 Marketplace

// Register provider and assets (upload by changing uploadBits)
function register(uint256 assetId) public returns (bool success);

// publish consumption information about an Asset
function publish(uint256 assetId, bytes32 url, bytes32 token) external returns (bool success);

// purchase an asset and get the consumption information
function purchase(uint256 assetId) external returns (bytes32 url, bytes32 token);

// Return the list of available assets
function listAssets() external view returns (uint256[50]); 

2.3 Query functions


// Return the number of drops associated to the message.sender to an Asset 
function dropsBalance(uint256 assetId) public view returns (uint256);

// Return true or false if an Asset is active given the assetId
function checkAsset(uint256 assetId) public view returns (bool);

// Get the url attribute associated to a given the assetId
function getAssetUrl(uint256 assetId) public view returns (bytes32);

// Get the token attribute associated to a given the assetId
function getAssetToken(uint256 assetId) public view returns (bytes32);

// Retrieve the msg.sender Provider token balance
function tokenBalance() public view returns (uint256);

2.3 Events

// Asset Events
event AssetRegistered(uint256 indexed _assetId, address indexed _owner);
event AssetPublished(uint256 indexed _assetId, address indexed _owner);
event AssetPurchased(uint256 indexed _assetId, address indexed _owner);

// Token Events
event TokenWithdraw(address indexed _requester, uint256 amount);
event TokenBuyDrops(address indexed _requester, uint256 indexed _assetId, uint256 _ocn, uint256 _drops);
event TokenSellDrops(address indexed _requester, uint256 indexed _assetId, uint256 _ocn, uint256 _drops);

3. File Structure

There are several folders and each includes solidity source files for each module:

  • bondingCurve: it caculates the bonding curve values when users purchase drops or sell drops in the marketplace;
  • plcrvoting: Partial Lock Commit Reveal Voting System;
  • tcr: the TCRs related files;
  • token: Ocean tokens based on ERC20 standard;
  • zeppelin: the library files from OpenZeppelin;
  • market.sol: curated proofs market (on-going work)

4. Architecture of Modules

The dependency between different modules are illustrated as below:

  • Marketplace (Market.sol) sends listing hash to TCRs (Registry.sol) so that to create challenges.
  • Users can use Ocean Tokens (OceanToken.sol) to vote for or against (PLCRVoting.sol).
  • Voting is configured with the parameters (Parameterizer.sol).
  • Marketplace uses bonding curve (BancorFormula.sol) to determine the price of drops.
  • BancorFormula calculates the power function (Power.sol).
  • TCRs (Registry.sol) send the voting result back to Marketplace (Market.sol).

5. Architecture of solidity Market contract

First draft of UML class diagram

6. Compile, Migrate and Test

Use $ npm install to download all the required libraries

Use $ truffle compile to compile those solidity files:

Then deploy them into testRPC $ truffle migrate:

Note:

  • there are Error: run out of gas because we try to deploy so many contracts as one single transaction. Tune the gas value in truffle.js file to make them run through.
  • we enable the solc optimizer to reduce the gas cost of deployment. It can now be deployed with less gas limit such as "gas = 5000000"
  • no need to update the "from : 0x3424ft..." in truffle.js and it will use the first account in testRPC or ganache-cli by default.

Test them with $ truffle test test/registry.js: