Skip to content

Commit

Permalink
Merge pull request #309 from DistributedCollective/development
Browse files Browse the repository at this point in the history
live updates
  • Loading branch information
creed-victor authored Jan 28, 2021
2 parents 6a83306 + 89ab30c commit 1c7cf02
Show file tree
Hide file tree
Showing 33 changed files with 1,119 additions and 227 deletions.
78 changes: 78 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Contributor Covenant Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at community@sovryn.app. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Contributing

<a href="https://github.com/DistributedCollective/Sovryn-frontend/graphs/contributors">
<img src="https://contrib.rocks/image?repo=DistributedCollective/Sovryn-frontend" />
</a>

### Bug Reports

To encourage active collaboration, Sovryn strongly encourages pull requests, not just bug reports. "Bug reports" may also be sent in the form of a pull request containing a failing test.

However, if you file a bug report, your issue should contain a title and a clear description of the issue. You should also include as much relevant information as possible. The goal of a bug report is to make it easy for yourself - and others - to replicate the bug and develop a fix.

Remember, bug reports are created in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the bug report will automatically see any activity or that others will jump to fix it. Creating a bug report serves to help yourself and others start on the path of fixing the problem. If you want to chip in, you can help out by fixing any bugs listed in our [issue trackers](https://github.com/issues?q=is%3Aopen+is%3Aissue+label%3Abug+user%3Adistributedcollective).

### Support Questions

Sovryn's GitHub issue trackers are not intended to provide help or support. Instead, use one of the following channels:

- [Discord](https://discord.gg/J22WS6z)
- [Gitbook Tutorials](https://sovryn-1.gitbook.io/sovryn)
- [Sovryn Blog](https://sovryn.app/blog/)

### Core Development Discussion

You may propose new features or improvements of existing dapp behavior in the Sovryn Ideas issue board. If you propose a new feature, please be willing to implement at least some of the code that would be needed to complete the feature.

Informal discussion regarding bugs, new features, and implementation of existing features takes place in the #sorcery channel of the Sovryn Discord server.

### Which Branch?

**All** bug fixes should be sent to the latest stable (master) branch. Bug fixes should never be sent to the development branch unless they fix features that exist only in the upcoming release.

**Minor** features that are fully backward compatible with the current release may be sent to the latest stable branch.

**Major** new features should always be sent to the development branch, which contains the upcoming release.

If you are unsure if your feature qualifies as a major or minor, please ask Victor Creed in the #sorcery channel of the Sovryn Discord server.

### Working With UI

All UI designs used for this repository should be available publically in [Google Drive folder as Adobe XD files](https://drive.google.com/drive/folders/1e_VljWpANJe0o4VmIkKU5Ewo56l9iMaM?usp=sharing)

## Security Vulnerabilities

If you discover a security vulnerability within DApp, please send an e-mail to Victor Creed via creed-victor@protonmail.com. All security vulnerabilities will be promptly addressed.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ Informal discussion regarding bugs, new features, and implementation of existing

If you are unsure if your feature qualifies as a major or minor, please ask Victor Creed in the #sorcery channel of the Sovryn Discord server.

### Working With UI

All UI designs used for this repository should be available publically in [Google Drive folder as Adobe XD files](https://drive.google.com/drive/folders/1e_VljWpANJe0o4VmIkKU5Ewo56l9iMaM?usp=sharing)

## Security Vulnerabilities

If you discover a security vulnerability within DApp, please send an e-mail to Victor Creed via creed-victor@protonmail.com. All security vulnerabilities will be promptly addressed.
Expand Down
56 changes: 5 additions & 51 deletions src/app/components/BorrowInterestRate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,26 @@
* BorrowInterestRate
*
*/
import React, { useEffect, useState } from 'react';
import { bignumber } from 'mathjs';
import { Asset } from 'types/asset';
import React from 'react';
import { weiToFixed } from 'utils/blockchain/math-helpers';
import { useLending_nextBorrowInterestRate } from 'app/hooks/trading/useLending_nextBorrowInterestRate';
import { usePriceFeeds_QueryRate } from 'app/hooks/price-feeds/useQueryRate';
import { LoadableValue } from '../LoadableValue';
import { FieldGroup } from '../FieldGroup';
import { DummyField } from '../DummyField';
import { useTranslation } from 'react-i18next';
import { translations } from '../../../locales/i18n';

interface Props {
asset: Asset;
collateral: Asset;
leverage: number;
weiAmount: string;
value: string;
loading: boolean;
labelColor: string;
}

export function BorrowInterestRate(props: Props) {
export function BorrowInterestRate({ value, loading, labelColor }: Props) {
const { t } = useTranslation();
const { value: result } = usePriceFeeds_QueryRate(
props.collateral,
props.asset,
);

const [totalDeposit, setTotalDeposit] = useState('0');
const [borrowAmount, setBorrowAmount] = useState(totalDeposit);

// Calculate loan tokens we depositing.
useEffect(() => {
let _totalDeposit = '0'; // loanTo
// let totalDeposit = props.loanTokenSent;

if (props.weiAmount !== '0') {
// props.collateralTokenSent != '0'
if (result.rate !== '0') {
_totalDeposit = bignumber(props.weiAmount)
.mul(result.rate)
.div(result.precision)
.add(_totalDeposit)
.toFixed(0);
}
}
setTotalDeposit(_totalDeposit);
// eslint-disable-next-line
}, [JSON.stringify(result), props]);

useEffect(() => {
setBorrowAmount(
bignumber(totalDeposit)
.mul(props.leverage - 1)
.toFixed(0),
);
}, [totalDeposit, props.leverage]);

const { value, loading } = useLending_nextBorrowInterestRate(
props.asset,
borrowAmount,
);

return (
<FieldGroup
label={t(translations.global.interestApr)}
labelColor={props.labelColor}
labelColor={labelColor}
>
<DummyField>
<LoadableValue
Expand Down
5 changes: 5 additions & 0 deletions src/app/components/FormSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Nullable } from 'types';
import styled from 'styled-components/macro';
import { useTranslation } from 'react-i18next';
import { translations } from 'locales/i18n';
import { isMobile } from '../../../utils/helpers';

export type SelectItem = { key: any; label: any; [key: string]: any };

Expand All @@ -24,6 +25,7 @@ interface Props {
outerClasses?: string;
innerClasses?: string;
onChange: (customer: SelectItem) => void;
inputFocus?: boolean;
}

export function FormSelect(props: Props) {
Expand All @@ -46,6 +48,9 @@ export function FormSelect(props: Props) {
<Selector
className={`w-100 ${props.outerClasses || ''}`}
items={props.items}
inputProps={
isMobile() && !props.inputFocus ? { autoFocus: false } : undefined
}
noResults={
<MenuItem
disabled={true}
Expand Down
Loading

1 comment on commit 1c7cf02

@vercel
Copy link

@vercel vercel bot commented on 1c7cf02 Jan 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.