Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: post-exploit changes #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions .github/workflows/check-code-format.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: Check Code Format

on:
push:
branches:
- "master"

pull_request:
branches:
- "master"

jobs:
validate-format:
runs-on: ubuntu-latest

steps:
- name: Clone Source Code
uses: actions/checkout@v2

- name: Install Dependencies
run: yarn install

- name: Validate Code Format
run: yarn prettier --check .
name: Check Code Format
on:
push:
branches:
- "master"
pull_request:
branches:
- "master"
jobs:
validate-format:
runs-on: ubuntu-latest
steps:
- name: Clone Source Code
uses: actions/checkout@v2
- name: Install Dependencies
run: yarn install
- name: Validate Code Format
run: yarn prettier --check .
54 changes: 27 additions & 27 deletions .github/workflows/hardhat-test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: Test with Hardhat

on:
push:
branches:
- "master"

pull_request:
branches:
- "master"

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Clone Source Code
uses: actions/checkout@v2

- name: Install Dependencies
run: yarn install

- name: Compile with Hardhat
run: yarn compile

- name: Test with Hardhat
run: yarn test
name: Test with Hardhat
on:
push:
branches:
- "master"
pull_request:
branches:
- "master"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Clone Source Code
uses: actions/checkout@v2
- name: Install Dependencies
run: yarn install
- name: Compile with Hardhat
run: yarn compile
- name: Test with Hardhat
run: yarn test
34 changes: 17 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package-lock.json
deploy.sh
node_modules
build
contracts/artifacts
.openzeppelin/.session
.DS_Store
dist

# Hardhat files
cache/
artifacts/

# OpenZeppelin dev files
.openzeppelin/unknown-*.json

typechain/
package-lock.json
deploy.sh
node_modules
build
contracts/artifacts
.openzeppelin/.session
.DS_Store
dist
# Hardhat files
cache/
artifacts/
# OpenZeppelin dev files
.openzeppelin/unknown-*.json
typechain/
12 changes: 6 additions & 6 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extension": ["ts"],
"spec": "./tests/**/*.spec.ts",
"require": "ts-node/register",
"timeout": 10000
}
{
"extension": ["ts"],
"spec": "./tests/**/*.spec.ts",
"require": "ts-node/register",
"timeout": 10000
}
12 changes: 6 additions & 6 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.git/
node_modules/
build/
cache/
artifacts/
typechain/
.git/
node_modules/
build/
cache/
artifacts/
typechain/
30 changes: 15 additions & 15 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 125,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false,
"explicitTypes": "preserve"
}
}
]
}
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 125,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false,
"explicitTypes": "preserve"
}
}
]
}
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2021 Linear Finance

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2021 Linear Finance
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
84 changes: 42 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
# Linear Finance

![GitHub package.json version](https://img.shields.io/github/package-json/v/Linear-finance/linear) ![GitHub top language](https://img.shields.io/github/languages/top/Linear-finance/linear) [![Test with Hardhat](https://github.com/Linear-finance/linear/actions/workflows/hardhat-test.yml/badge.svg)](https://github.com/Linear-finance/linear/actions/workflows/hardhat-test.yml)

Smart contracts implemented in Solidity for Linear Finance.

## Introduction

Linear Finance is a cross-chain compatible, decentralized delta-one asset protocol to cost-effectively and instantly create, manage, and trade synthetic assets with unlimited liquidity.

Linear Finance ("Linear") is a non-custodial, cross-chain compatible, delta-one asset protocol. Linear's long term DeFi vision is to increase inclusiveness and democratize access to investment assets (digital and traditional). Tremendous value exists in the ability for investors to easily and quickly invest, save fees, and secure assets at fair market value. Linear combines substantial technical experience from numerous crypto projects with extensive financial experience in exotic and structured assets from traditional global asset management firms to bring to market one of the first DeFi projects built upon Ethereum with cross-chain compatibility. Linear will allow users to build and manage spot or portfolio exposures with a slew of innovative digital and traditional financial products.

## Prerequisite

A recent version of [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/) are required to compile the contracts and run tests.

## Compiling

Build the smart contracts using [Hardhat](https://hardhat.org/) with the following command:

```sh
$ yarn install
$ yarn compile
```

You can find compiled contracts in the `./artifacts` folder upon successful compilation.

## Testing

Run test cases with [Hardhat](https://hardhat.org/):

```sh
$ yarn test
```

## Community

[![Discord](https://img.shields.io/discord/738363983031173151?label=discord&logo=discord&style=plastic)](https://discordapp.com/channels/738363983031173151/) [![Twitter Follow](https://img.shields.io/twitter/follow/LinearFinance?label=LinearFinance&style=social)](https://twitter.com/LinearFinance) [![Chat on Telegram](https://img.shields.io/badge/Telegram-brightgreen.svg?logo=telegram&color=%234b4e52)](https://t.me/joinchat/Tb3iAhuMZsyfspxhEWQLvw)

## License

All code in this repository is licensed under [MIT](./LICENSE).
# Linear Finance
![GitHub package.json version](https://img.shields.io/github/package-json/v/Linear-finance/linear) ![GitHub top language](https://img.shields.io/github/languages/top/Linear-finance/linear) [![Test with Hardhat](https://github.com/Linear-finance/linear/actions/workflows/hardhat-test.yml/badge.svg)](https://github.com/Linear-finance/linear/actions/workflows/hardhat-test.yml)
Smart contracts implemented in Solidity for Linear Finance.
## Introduction
Linear Finance is a cross-chain compatible, decentralized delta-one asset protocol to cost-effectively and instantly create, manage, and trade synthetic assets with unlimited liquidity.
Linear Finance ("Linear") is a non-custodial, cross-chain compatible, delta-one asset protocol. Linear's long term DeFi vision is to increase inclusiveness and democratize access to investment assets (digital and traditional). Tremendous value exists in the ability for investors to easily and quickly invest, save fees, and secure assets at fair market value. Linear combines substantial technical experience from numerous crypto projects with extensive financial experience in exotic and structured assets from traditional global asset management firms to bring to market one of the first DeFi projects built upon Ethereum with cross-chain compatibility. Linear will allow users to build and manage spot or portfolio exposures with a slew of innovative digital and traditional financial products.
## Prerequisite
A recent version of [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/) are required to compile the contracts and run tests.
## Compiling
Build the smart contracts using [Hardhat](https://hardhat.org/) with the following command:
```sh
$ yarn install
$ yarn compile
```
You can find compiled contracts in the `./artifacts` folder upon successful compilation.
## Testing
Run test cases with [Hardhat](https://hardhat.org/):
```sh
$ yarn test
```
## Community
[![Discord](https://img.shields.io/discord/738363983031173151?label=discord&logo=discord&style=plastic)](https://discordapp.com/channels/738363983031173151/) [![Twitter Follow](https://img.shields.io/twitter/follow/LinearFinance?label=LinearFinance&style=social)](https://twitter.com/LinearFinance) [![Chat on Telegram](https://img.shields.io/badge/Telegram-brightgreen.svg?logo=telegram&color=%234b4e52)](https://t.me/joinchat/Tb3iAhuMZsyfspxhEWQLvw)
## License
All code in this repository is licensed under [MIT](./LICENSE).
52 changes: 26 additions & 26 deletions contracts/LinearFinance.sol
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;

import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "./upgradeable/LnAdminUpgradeable.sol";

contract LinearFinance is ERC20Upgradeable, LnAdminUpgradeable {
using SafeMathUpgradeable for uint256;

uint256 public constant MAX_SUPPLY = 10000000000e18;

function __LinearFinance_init(address _admin) public initializer {
__ERC20_init("Linear Token", "LINA");
__LnAdminUpgradeable_init(_admin);
}

function mint(address account, uint256 amount) external onlyAdmin {
require(totalSupply().add(amount) <= MAX_SUPPLY, "LinearFinance: max supply exceeded");
_mint(account, amount);
}

function burn(address account, uint amount) external onlyAdmin {
_burn(account, amount);
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "./upgradeable/LnAdminUpgradeable.sol";
contract LinearFinance is ERC20Upgradeable, LnAdminUpgradeable {
using SafeMathUpgradeable for uint256;
uint256 public constant MAX_SUPPLY = 10000000000e18;
function __LinearFinance_init(address _admin) public initializer {
__ERC20_init("Linear Token", "LINA");
__LnAdminUpgradeable_init(_admin);
}
function mint(address account, uint256 amount) external onlyAdmin {
require(totalSupply().add(amount) <= MAX_SUPPLY, "LinearFinance: max supply exceeded");
_mint(account, amount);
}
function burn(address account, uint amount) external onlyAdmin {
_burn(account, amount);
}
}
Loading
Loading