All Projects → sirenmarkets → core

sirenmarkets / core

Licence: GPL-3.0 license
SIREN Core Smart Contracts

Programming Languages

typescript
32286 projects
solidity
1140 projects

Projects that are alternatives of or similar to core

awesome-waves
Curated list of awesome things for development on Waves blockchain.
Stars: ✭ 60 (+53.85%)
Mutual labels:  dapp, smart-contracts, defi
mai-protocol
A Protocol for trading decentralized derivatives on Ethereum
Stars: ✭ 22 (-43.59%)
Mutual labels:  smart-contracts, derivatives, defi
zeneth
🏵️ Let Your ETH Chill — Gasless Ethereum account abstraction with Flashbots
Stars: ✭ 112 (+187.18%)
Mutual labels:  dapp, smart-contracts, defi
quipuswap-webapp
🌐 🧙‍♂️ Decentralized application UI for Quipuswap protocol.
Stars: ✭ 21 (-46.15%)
Mutual labels:  dapp, smart-contracts, defi
eth option
ERC20-compatible Option Contracts
Stars: ✭ 22 (-43.59%)
Mutual labels:  options, smart-contracts, derivatives
flow-protocol-ethereum
Flow Protocols powering synthetic asset and margin trading
Stars: ✭ 18 (-53.85%)
Mutual labels:  smart-contracts, defi
PROJ Option Pricing Matlab
Quant Option Pricing - Exotic/Vanilla: Barrier, Asian, European, American, Parisian, Lookback, Cliquet, Variance Swap, Swing, Forward Starting, Step, Fader
Stars: ✭ 85 (+117.95%)
Mutual labels:  options, derivatives
tasit-sdk
A JavaScript / TypeScript SDK for making native mobile Ethereum dapps using React Native
Stars: ✭ 93 (+138.46%)
Mutual labels:  dapp, smart-contracts
UpSideDai
⬆️ Take a HIGHLY leveraged position on the future price of DAI 📈.
Stars: ✭ 26 (-33.33%)
Mutual labels:  smart-contracts, defi
starter-kit-gsn
An OpenZeppelin starter kit focused on GSN.
Stars: ✭ 39 (+0%)
Mutual labels:  dapp, smart-contracts
prb-math
Solidity library for advanced fixed-point math
Stars: ✭ 404 (+935.9%)
Mutual labels:  smart-contracts, defi
contracts
Alice smart contracts
Stars: ✭ 57 (+46.15%)
Mutual labels:  dapp, smart-contracts
Scrypto-Advent-Calendar
Scrypto Advent Calendar. Learn the new programming langage to build secure DeFi applications quickly.
Stars: ✭ 22 (-43.59%)
Mutual labels:  smart-contracts, defi
bloqly
Bloqly: JavaScript Smart Contracts Engine + SQL database
Stars: ✭ 29 (-25.64%)
Mutual labels:  dapp, smart-contracts
go-compound
Golang client for compound.finace api and smart contracts
Stars: ✭ 23 (-41.03%)
Mutual labels:  dapp, defi
bcdhub
Better Call Dev backend
Stars: ✭ 30 (-23.08%)
Mutual labels:  dapp, smart-contracts
optlib
A library for financial options pricing written in Python.
Stars: ✭ 166 (+325.64%)
Mutual labels:  options, derivatives
typescript-eth-starter
🔌 Ethereum Dapp Basic Typescript Starter
Stars: ✭ 125 (+220.51%)
Mutual labels:  dapp, smart-contracts
ape
The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals
Stars: ✭ 339 (+769.23%)
Mutual labels:  smart-contracts, defi
solidity-cli
Compile solidity-code faster, easier and more reliable
Stars: ✭ 49 (+25.64%)
Mutual labels:  dapp, smart-contracts

SIREN logo

Siren Markets Core Smart Contracts

This repository contains the source code for the Siren Markets core smart contracts.

SIREN CI Coverage Status GitHub contributors GitHub commit activity GitHub Stars GitHub repo size GitHub

Website sirenmarkets.com Blog Docs Governance Twitter SirenProtocol

GitHub pull requests by-label GitHub Issues

Mainnet Contract List

Build and test

$ npm install
$ npm test

Design Goals

  • Build a fully unit tested system with 100% code coverage, including error scenarios and event logging
  • Allow the Siren system to be upgradeable over time by the governance system to include new functionality not included in the initial launch, without requiring migration to a new token (e.g. Augur)
  • Minimize gas by deploying proxy contracts whenever possible instead of full logic contracts
  • Utilize Open Zeppelin contracts whenever possible instead of rolling our own version
  • Fully comment the codebase so new developers can quickly grok the protocol and contribute

Protocol Overview

See the technical documentation for more details on the protocol

Series Lifecycle Example

Below is one of the unit tests showing the flow for, minting options, exercising an option, and claiming the remaining series' collateral.

it("Allows claiming after expiration with full redemptions", async () => {
  // Amount we will be minting
  const MINT_AMOUNT = 100

  // Give Alice 100 tokens
  await collateralToken.mint(aliceAccount, MINT_AMOUNT)

  // Save off the tokens
  const bTokenIndex = await deployedSeriesController.bTokenIndex(seriesId)

  // approve the amount and mint alice some options - wBTC collateral will be locked into series contract
  await collateralToken.approve(deployedSeriesController.address, MINT_AMOUNT, {
    from: aliceAccount,
  })
  await deployedSeriesController.mintOptions(seriesId, MINT_AMOUNT, {
    from: aliceAccount,
  })

  // Send the bTokens from alice to Bob - simulates alice selling option
  await deployedERC1155Controller.safeTransferFrom(
    aliceAccount,
    bobAccount,
    bTokenIndex,
    MINT_AMOUNT,
    "0x0",
    { from: aliceAccount },
  )

  // Move the block time into the future so the contract is expired
  await time.increaseTo(expiration + ONE_DAY)

  // Bob exercises
  await deployedERC1155Controller.setApprovalForAll(
    deployedSeriesController.address,
    true,
    { from: bobAccount },
  )
  await deployedSeriesController.exerciseOption(seriesId, MINT_AMOUNT, true, {
    from: bobAccount,
  })

  // Should succeed from Alice claiming leftover collateral
  await deployedERC1155Controller.setApprovalForAll(
    deployedSeriesController.address,
    true,
    { from: aliceAccount },
  )
  await deployedSeriesController.claimCollateral(seriesId, MINT_AMOUNT, {
    from: aliceAccount,
  })

  // Bob should own his share of collateral tokens
  assertBNEq(
    await collateralToken.balanceOf(bobAccount),
    "17",
    "bob should have his collateral",
  )

  // Alice should own her share of collateral tokens
  assertBNEq(
    await collateralToken.balanceOf(aliceAccount),
    "83",
    "alice should have her collateral",
  )
})

Development

This repo will generate TS clients for the contracts on install. When updating the contracts, the TS definitions can be manually updated by:

  1. Running npm run compile
  2. Running npm run build

The compiled JSON ABI files should be commited after deployment so that the deployment metadata is available in the repo.

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].