Skip to content

A programming language with flows for writing safer smart contracts.

Notifications You must be signed in to change notification settings

ReedOei/Psamathe

Repository files navigation

Psamathe

Psamathe is a programming language targeted at the blockchain, intended to make smart contracts safer and more concise. It uses a new flow abstraction, which represents an atomic transfer. This operation is very convenient for implementing common kinds of smart contracts, such as token contracts, auctions, etc. and works well with Psamathe's other features to provide safety and conciseness.

For an introduction to Psamathe, see this short paper or this talk.

Installation

To install and use Psamathe, clone the repository and navigate to it. You will need Stack. Then run:

cd Compiler/
stack install

Then you can compile Psamathe programs by:

psamathe file.flow

Psamathe compiles to Solidity, and by default, the Solidity code is printed to the screen. Note that Psamathe is still very much under development.

Examples

Here is an example implementation of the transfer function from ERC-20.

type Token is fungible asset uint256
transformer transfer(balances : map address => Token,
                     dst : address,
                     amount : uint256) {
    balances[msg.sender] --[ amount ]-> balances[dst]
}

Additional examples can be found in the examples/ folder in this directory, or in the Compiler/test/resources/ directory.

IDE Support

Currently, the only "IDE Support" for Psamathe is via a Vim syntax highlighting file, flow.vim in this repository's root.

About

A programming language with flows for writing safer smart contracts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published