• Stars
    star
    116
  • Rank 302,152 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 4 years ago
  • Updated 16 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OUSD and OETH are stablecoins that passively accrue yield while you are holding it

Origin DeFi's OTokens: Origin Dollar (OUSD) and Origin Ether (OETH)

For more details about the product, checkout our docs.


Branch CI/CD Status
master Origin DeFi

Requirements

  • Node Version
    • ^16.0.0 >= node <=^18.0.0
    • Recommended: ^18.0.0
  • Web3 Wallet

Installation

# Clone the origin-dollar project
git clone [email protected]:OriginProtocol/origin-dollar.git
cd origin-dollar

Description

The origin-dollar project is a repo that hosts the smart contracts of some Origin DeFi projects including OUSD and OETH. For Governance related contracts, head over to (origin-dollar-governance)[https://github.com/OriginProtocol/ousd-governance]. In order to run this project locally, you will need to run the Eth node.

Eth Node

The smart contracts and all of their associated code are located in the <project-root>/contracts directory. The Ethereum tests and the local Ethereum EVM node are managed by Hardhat.

A variety of Hardhat tasks are available to interact with the contracts. Additional information can be found by running npx hardhat from the contracts/ directory.


Running the node

The dapp interacts with many 3rd party contracts (Uniswap, Curve, Sushiswap) and it would be too cumbersome to initialize all those contracts in a fresh node environment and set them to a state that mimics the Mainnet. For that reason we are using Hardhat's forked mode. By setting the BLOCK_NUMBER environment variable, the node will download part of the mainnet state that it requires to fulfill the requests. It is less reliable since the node isn't as stable in forked mode (and sometimes requires restarts), but mimicking the mainnet is a huge benefit. We used to develop with fresh state node, but the behavior discrepancies between fresh node and mainnet have started to become too large. For that reason, we have deprecated the fresh state development.

Rename contracts/dev.env to .env and set PROVIDER_URL to a valid one (Sign up for a free Alchemy or Infura account, create a new API key, and use the URL they provide). If you would like the forked net to mimic a more recent state of mainnet update the BLOCK_NUMBER to a more recent Ethereum block. Also add your mainnet testing account(s) (if more than one, comma separate them) under the ACCOUNTS_TO_FUND. After the node starts up, the script will transfer 100k of USDT, OUSD and DAI to those accounts. Open a separate terminal to run the hardhat node in.

Run the node:

# Enter the smart contracts dir
cd contracts

# Install the dependencies
yarn install

# Run the node in forked mode
yarn run node

Minting Stablecoins via hardhat task

This is an option, but a simpler way is to use the ACCOUNTS_TO_FUND setting described above.

# Mint 1000 worth of each supported stablecoin to each account defined in the mnemonic
npx hardhat fund --amount 1000 --network localhost

Running Smoke Tests

Smoke tests can be run in 2 modes:

  • Run scripts/test/smokeTest.sh to launch interactive mode. All the "before contract changes" parts of tests will execute and wait for the user to manually using a console performs contract changes. Once those are done, hit "Enter" in the smoke test console and the second part of the tests shall be run that validate that contract changes haven't broken basic functionality.
  • Run scripts/test/smokeTest.sh --deployid [numeric_id_of_deploy] will run smoke tests against a specific deployment validating that basic functionality didn't break.


Fork Tests

Head over to contracts/fork-test.md


Contributing

Want to contribute to OUSD? Awesome!

OUSD is an Open Source project and we welcome contributions of all sorts. There are many ways to help, from reporting issues, contributing to the code, and helping us improve our community.

The best way to get involved is to join the Origin Protocol discord server and head over to the channel named ORIGIN DOLLAR & DEFI

Utils

Git pre-commit hooks (using Husky)

Setup

# install Husky
npx install husky

# from project root folder install Husky hooks
npx husky install

If the script in .husky/pre-commit returns non 0 exit the pre-commit hook will fail. Currently the script prevents a commit if there is an ".only" in the test scripts. Use "git commit --no-verify" if you have the hook enabled and you'd like to skip pre-commit check.

More Repositories

1

origin

Monorepo for our developer tools and decentralized marketplace application
JavaScript
652
star
2

security

Materials related to security: docs, checklists, processes, etc...
Solidity
199
star
3

origin-playground

Playground for us to try out new ideas, specifically around Identity (ERC 725) & the Origin Marketplace
JavaScript
159
star
4

dshop

Origin Dshop - launch your own decentralized store
JavaScript
138
star
5

telegram-moderator

Telegram bot for controlling spam, logging, and more
Python
113
star
6

origin-js

We've moved to a monorepo: https://github.com/OriginProtocol/origin
JavaScript
81
star
7

origin-website

The code powering our website
HTML
40
star
8

react-native-samsung-bks

React Native wrapper for Samsung Blockchain Keystore SDK
Java
16
star
9

origin-bridge

We've moved to a monorepo: https://github.com/OriginProtocol/origin/tree/master/infra/bridge
Python
15
star
10

minimal-proxy-example

An example implementation of a Minimal Proxy | EIP-1167
JavaScript
11
star
11

ousd-governance

OUSD Governance Portal and Contracts
Solidity
11
star
12

ousd.com

Frontend for ousd.com
TypeScript
11
star
13

nft-launchpad

Contracts for Origin's NFT platform
JavaScript
10
star
14

origin-tracer

Ethereum transactions visualization tool
TypeScript
9
star
15

origin-docs-archived

We've moved to a monorepo: https://github.com/OriginProtocol/origin/tree/master/docs
JavaScript
9
star
16

ousd-analytics

Web application to pull statistics on OUSD from the blockchain.
Python
8
star
17

website-frontend

originprotocol.com front-end
JavaScript
6
star
18

origin-box

We've moved to a monorepo: https://github.com/OriginProtocol/origin/blob/master/DEVELOPMENT.md
Shell
5
star
19

origin-defi

Origin Protocol frontend monorepo
TypeScript
4
star
20

origin-mobile

We've moved to a monorepo: https://github.com/OriginProtocol/origin/tree/master/mobile
JavaScript
3
star
21

origin-squid

Origin Subsquid
TypeScript
3
star
22

wash-inspector

NFT trade analytics tool that identifies NFTs that have been wash traded.
TypeScript
2
star
23

origin-schemas

Example Origin listing schemas
2
star
24

civic-proxy

Handles the decrypting of user information being returned from Civic
JavaScript
2
star
25

origin-monorepo

The Origin Protocol monorepo for dApps and resuable packages across the organization
TypeScript
2
star
26

origin-devops

We've moved to a monorepo: https://github.com/OriginProtocol/origin/tree/master/devops
2
star
27

test-builds

Test builds of the Origin dapp
CSS
2
star
28

oeth.com

Frontend for oeth.com
TypeScript
2
star
29

origin-squid-notifications

Subsquid for Notifications
TypeScript
2
star
30

ousd-compensation-calculation

Scripts, utilties, and data for the OUSD attack compensation
Python
1
star
31

telegram-discord-bridge

JavaScript
1
star
32

stolen

Literally the Worst Idea
JavaScript
1
star
33

origin-dollar-docs

Official documentation for OUSD. This repo is used to sync changes between Crowdin and Gitbook.
1
star
34

origin-how-to

1
star
35

oeth-dapp

The dapp for oeth integration
TypeScript
1
star
36

origin-cms

JavaScript
1
star
37

veogv

Solidity
1
star
38

story.xyz

Story.xyz frontend using Next.js
TypeScript
1
star