Dappsys

Safe, simple, flexible building-blocks for smart-contract systems.


Auth
ds-auth ds-guard ds-roles
Token
ds-token ds-vault
Oracle
ds-cache ds-value
Util
ds-exec ds-math ds-note ds-proxy ds-stop ds-thing
Gov
ds-multisig

DSCache

DSValue with expiry

Authorized users can set and unset a value and a time at which the value will expire. Anyone can read the value and check freshness.

Actions

peek

return the stored value along with boolean true if the value is still valid and false if not.

read

return either the stored value or an exception if expired

prod

set a value and expiry (requires auth)

  // cache.sol -- authed nullable key-value store with expirations

// Copyright 2016-2017  DappHub, LLC

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.4.13;

import 'ds-value/value.sol';

contract DSCache is DSValue
{
    uint128 public zzz;
//  from DSValue:
//  bool    has;
//  bytes32 val;
    function peek() public view returns (bytes32, bool) {
        return (val, has && now < zzz);
    }
    function read() public view returns (bytes32) {
        var (wut, has) = peek();
        assert(now < zzz);
        assert(has);
        return wut;
    }
    function prod(bytes32 wut, uint128 Zzz) public note auth {
        zzz = Zzz;
        poke(wut);
    }
    // from DSValue:
    // function poke(bytes32 wut) note auth {
    //     val = wut;
    //     has = true;
    // }
    // function void() note auth { // unset the value
    //     has = false;
    // }

}

Tools for dapps

We believe that the free software movement is the most important cultural predecessor to the modern-day renaissance in decentralized technologies.

To catalyze the growth of this ecosystem, and to empower hackers to participate, we’re building a comprehensive suite of blockchain-oriented developer tools in the spirit of the Unix philosophy.

Dapp is all you need to start developing for Ethereum. It creates new dapps, runs Solidity unit tests, debugs, deploys, launches testnets, and more.

Seth is a handy tool for slicing and dicing transactions, querying the blockchain, converting between data formats, performing remote calls, and other everyday tasks.

Hevm is our own EVM implementation with a nimble terminal-based Solidity debugger. It’s used for dapp test and dapp debug.

Evmdis is an EVM disassembler written and maintained by Nick Johnson. It’s useful to make sense of EVM bytecode, especially when developing contracts at the assembly or raw bytecode level.

Dappsys - smart contract building blocks

We also maintain Dappsys, an audited collection of smart contract building blocks designed to complement each other. They include;

Using these proven parts lets us focus on the novel features of the systems we develop. We share Dappsys to benefit the smart contract ecosystem.