All Projects → ethersphere → swap-swear-and-swindle

ethersphere / swap-swear-and-swindle

Licence: other
Contracts for Swap, Swear and Swindle. Swap is a protocol for p2p accounting. This is the basis for Swarm’s incentivization model.

Programming Languages

javascript
184084 projects - #8 most used programming language
solidity
1140 projects
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to swap-swear-and-swindle

Starter Kit
An OpenZeppelin starter kit containing React, OpenZeppelin SDK & OpenZeppelin Contracts.
Stars: ✭ 101 (+119.57%)
Mutual labels:  truffle, web3
Eth Vue
Featured in Awesome Vue [https://github.com/vuejs/awesome-vue], a curated list maintained by vuejs of awesome things related to the Vue.js framework, and Awesome List [https://awesomelists.net/150-Vue.js/3863-Open+Source/18749-DOkwufulueze-eth-vue], this Truffle Box provides everything you need to quickly build Ethereum dApps that have authentication features with vue, including configuration for easy deployment to the Ropsten Network. It's also Gravatar-enabled. Connecting to a running Ganache blockchain network from Truffle is also possible -- for fast development and testing purposes. Built on Truffle 5 and Vue 3, eth-vue uses vuex for state management, vuex-persist for local storage of app state, and vue-router for routing. Authentication functionalities are handled by Smart Contracts running on the Ethereum blockchain.
Stars: ✭ 171 (+271.74%)
Mutual labels:  truffle, web3
Web3 Vs Ethers
A basic cheatsheet of Web3.js vs Ethers (along w/ example apps!)
Stars: ✭ 103 (+123.91%)
Mutual labels:  truffle, web3
Angular Truffle Dapp
Angular + Truffle = Beautiful Material Dapp that can be scaled
Stars: ✭ 12 (-73.91%)
Mutual labels:  truffle, web3
eth-decoder
Simple library to decode ethereum transaction and logs
Stars: ✭ 32 (-30.43%)
Mutual labels:  truffle, web3
Trace
Supply chain transparency platform proof-of-concept based on the Ethereum blockchain ✍️
Stars: ✭ 52 (+13.04%)
Mutual labels:  truffle, web3
Truffle Plugin Verify
✅ Verify your smart contracts on Etherscan from the Truffle CLI
Stars: ✭ 144 (+213.04%)
Mutual labels:  truffle, web3
Eattheblocks
Source code for Eat The Blocks, a screencast for Ethereum Dapp Developers
Stars: ✭ 431 (+836.96%)
Mutual labels:  truffle, web3
erebos
JavaScript client and CLI for Swarm
Stars: ✭ 47 (+2.17%)
Mutual labels:  swarm, web3
tool-db
A peer-to-peer decentralized database
Stars: ✭ 15 (-67.39%)
Mutual labels:  swarm, web3
Eth.social
An Ethereum dApp for posting social events.
Stars: ✭ 17 (-63.04%)
Mutual labels:  truffle, web3
starter-kit-gsn
An OpenZeppelin starter kit focused on GSN.
Stars: ✭ 39 (-15.22%)
Mutual labels:  truffle, web3
Docuhash
Simple PoC that shows you how to use IPFS and Ethereum blockchain to store files and their information.
Stars: ✭ 17 (-63.04%)
Mutual labels:  truffle, web3
Marketprotocol
Ethereum based derivatives trading protocol creating digital tokens for any asset
Stars: ✭ 78 (+69.57%)
Mutual labels:  truffle, web3
Typechain
🔌 TypeScript bindings for Ethereum smart contracts
Stars: ✭ 769 (+1571.74%)
Mutual labels:  truffle, web3
Truffle Assertions
🛠 Assertions and utilities for testing Ethereum smart contracts with Truffle unit tests
Stars: ✭ 109 (+136.96%)
Mutual labels:  truffle, web3
React Ethereum Dapp Example
A starter boilerplate for an Ethereum dapp using web3.js v1.0, truffle, react, and parity
Stars: ✭ 384 (+734.78%)
Mutual labels:  truffle, web3
Eth Crypto
Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
Stars: ✭ 420 (+813.04%)
Mutual labels:  truffle, web3
resources
A living collection of resources for participants (and anyone who's interested) in Truffle University's courses 📚
Stars: ✭ 27 (-41.3%)
Mutual labels:  truffle, web3
trufflepig
🍄🐷Truffle contract artifact loading tool for local development
Stars: ✭ 45 (-2.17%)
Mutual labels:  truffle, web3

sw3 contracts

Contracts for Swap, Swear and Swindle.

Please note that all contracts within this repository are considered highly experimental and may cause loss of funds if used in production.

The master branch only contains the SimpleSwap contract for now. Everything else (full Swap, Swear and Swindle) can be found in the experimental branch.

Tests

This is a hardhat project using the truffle plugin (for tests as this used to be truffle-based). You can run tests using yarn test.

yarn
yarn test

To also generate coverage information use yarn coverage instead.

Linting

This repo currently uses solhint as linter. It can be called through yarn:

yarn lint

Go-bindings

To generate go bindings use

yarn abigen

This will generate the bindings in the bindings/ directory. Suitable versions of solc and abigen have to be installed for this to work. Alternatively this can also be done through docker:

docker build -t sw3 -f Dockerfile.abigen .
docker run -v $(pwd)/bindings:/sw3/bindings sw3 yarn abigen

In addition to the file from abigen this will also generate a go file that includes the runtime bytecode.

The go bindings are automatically generated on every release git tag and the pushed to the ethersphere/go-sw3 repository.

Deployments

Swap is deployed on the following networks:

Network Factory Token
Mainnet - 0x19062190B1925b5b6689D7073fDfC8c2976EF8Cb
XDai 0xc2d5a532cf69aa9a1378737d8ccdef884b6e7420 0xdbf3ea6f5bee45c02255b2c26a16f300502f68da (bridged)

Test Deployments

Swap is deployed on the following testnets:

Network Factory Token
Goerli 0x73c412512E1cA0be3b89b77aB3466dA6A1B9d273 0x2aC3c1d3e24b45c6C310534Bc2Dd84B5ed576335
Goerli (Legacy) 0xf0277caffea72734853b834afc9892461ea18474 0x2aC3c1d3e24b45c6C310534Bc2Dd84B5ed576335

Overview

SimpleSwap

SimpleSwap is a chequebook-style contract with support hard deposits.

Cheques

The issuer can issue cheques. Those are a signed piece of data containing the swap address, a beneficiary, and a cumulative amount. If the beneficiary wishes to cash the cheque it needs to be sent to the contract using the cashChequeBeneficiary function. Alternatively anyone else can also cash the cheque using cashCheque provided they have a signature from the beneficiary. In that case they might also get a portion of the payout as a fee. If there is not enough liquid balance in the contract part of the cheque might bounce (whether the full cheque was paid out should be verified through the ChequeCashed event). Later the beneficiary can try cashing again to get the remaining amount.

Hard Deposit

The issuer can lock a certain amount of the balance to a specific beneficiary (increaseHardDeposit) to give solvency guarantees up to the amount of the hard deposit. Decreasing a hard deposit is a two step process: First it needs to be prepared (prepareDecreaseHardDeposit) to start a security delay, which the beneficiary can use to cash the outstanding cheques. Afterwards the deposit can be decreased (decreaseHardDeposit). The balance not covered by hard deposits can be withdrawn by the issuer at any time.

Data Formats

Signatures

For signing purposes the chequebook uses EIP-712 Ethereum typed structured data hashing and signing. The EIP712Domain domain name is Chequebook in version 1.0. The chainId field is used, the verifyingContract and salt fields are omitted.

Cheques

Field Type Description
swap address  the swap contract this is for
beneficiary address  beneficiary of the cheque
cumulativePayout uint256 cumulative amount

CashOut

Field Type Description
swap address  the swap contract this is for
sender address the address allowed to submit this cheque
requestPayout uint256 the maximum amount that should be paid out
recipient address the target of the payment
calleePayout uint256 amount of the payout that should go the caller

CustomHardDepositDecreaseTimeout

Field Type Description
swap address  the swap contract this is for
beneficiary address  beneficiary of the hard deposit
decreaseTimeout uint256 new timeout

Factory

SimpleSwap has an accompanying factory contract SimpleSwapFactory. Deploying through the factory guarantees that the SimpleSwap contract was deployed with the correct init code.

Swap

Swap is SimpleSwap extended with support for promissory notes. You can find it in the experimental branch.

Swear and Swindle

Swear and Swindle are the contracts for the trial system of sw3. You can find them in the experimental branch.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].