Skip to content

Commit

Permalink
Fix GitHub links (#551)
Browse files Browse the repository at this point in the history
* Fix small issue with import

* Update package cow-js

* Fix code style issues with Prettier

* Update npm version

* Fix contributing link

* Change readme

* Point links to right place

* Point contracts to right name

* Update link to services

* Update link for token

* Update explorer

* Fix twitter link

* Add githublinks

* Walletlink connector param cannot be a constant

Co-authored-by: Lint Action <[email protected]>
Co-authored-by: Alfetopito <[email protected]>
  • Loading branch information
3 people authored May 18, 2022
1 parent c4ec19d commit 04804ac
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Thank you for your interest in contributing to the CowSwap interface! 🐮
## Finding a first issue

Start with issues with the label
[`good first issue`](https://github.com/Gnosis/cowswap/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22).
[`Help wanted`](https://github.com/cowprotocol/cowswap/issues?q=is%3Aopen+is%3Aissue+label%3A%22Help_Wanted%22+).

## Pull requests

Expand Down
23 changes: 8 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/gnosis/gp-swap-ui)

<p align="center">
<img height="120" src="https://bafybeig5h43icn326c45qmwl4mpimskfaqa3o2pnkuht5pqb6gfcfjzlxi.ipfs.dweb.link/">
</p>

[![Lint](https://github.com/gnosis/dex-swap/workflows/Lint/badge.svg)](https://github.com/gnosis/dex-swap/actions?query=workflow%3ALint)
[![Tests](https://github.com/gnosis/dex-swap/workflows/Tests/badge.svg)](https://github.com/gnosis/dex-swap/actions?query=workflow%3ATests)
[![Tests](https://github.com/cowprotocol/cowswap/workflows/CI/badge.svg)](https://github.com/cowprotocol/cowswap/actions/workflows/ci.yml?query=workflow%3ACI)
[![Styled With Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io/)

CowSwap is the first trading interface built on top of CoW Protocol v2.
CowSwap is the first trading interface built on top of CoW Protocol.

It allows you to buy and sell tokens using gas-less orders that are settled peer-to-peer among its users or into any on-chain liquidity source while providing MEV protection.

- 🐮**Official Website**🐮: <https://cowswap.exchange/>

- ENS Website (alternative): <https://cowswap.eth.link>, or <https://cowswap.eth/> if you have MetaMask or an ENS compatible browser.
- The website can also be run locally, or from IPFS. Every release will have an IPFS hash associated, available in the [Releases](https://github.com/gnosis/gp-swap-ui/releases) section.
- The website can also be run locally, or from IPFS. Every release will have an IPFS hash associated, available in the [Releases](https://github.com/cowprotocol/cowswap/releases) section.

- Protocol: <https://cow.fi>
- Docs: <https://docs.cow.fi>
- Stats: <https://dune.xyz/gnosis.protocol/Gnosis-Protocol-V2>
- Twitter: [@gnosisPM](https://twitter.com/gnosisPM)
- Reddit: [/r/gnosisPM](https://www.reddit.com/r/gnosisPM)
- Twitter: [@MEVprotection](https://twitter.com/MEVprotection)
- Discord: <https://discord.com/invite/cowprotocol>

Please see the:

- [CoW Protocol: Smart contracts](https://github.com/gnosis/gp-v2-contracts)
- [CoW Protocol: Services](https://github.com/gnosis/gp-v2-services)
- [CoW Protocol: Smart contracts](https://github.com/cowprotocol/contracts)
- [CoW Protocol: Services](https://github.com/cowprotocol/services)

You can block an entire list of tokens by passing in a tokenlist like [here](./src/constants/lists.ts) or you can block specific tokens by adding them to [unsupported.tokenlist.json](./src/constants/tokenLists/unsupported.tokenlist.json).

Expand Down Expand Up @@ -143,7 +136,7 @@ REACT_APP_NETWORK_URL_100=https://rpc.xdaichain.com
Fee quote requests and posting orders are sent to an API. This API has the responsibility of collecting orders and
handing them to the solvers.

The reference implementation of th API is [gp-v2-services](https://github.com/gnosis/gp-v2-services).
The reference implementation of th API is [gp-v2-services](https://github.com/cowprotocol/services).

The API endpoint is configured using the environment variable ` {XDAI|RINKEBY|MAINNET}` to e.g. `"http://localhost:8080/api"` when running the services locally.

Expand Down
4 changes: 2 additions & 2 deletions src/custom/api/gnosisProtocol/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
SigningSchemeValue,
UnsignedOrder,
} from 'utils/signatures'
import { APP_DATA_HASH, GAS_FEE_ENDPOINTS } from 'constants/index'
import { APP_DATA_HASH, GAS_FEE_ENDPOINTS, RAW_CODE_LINK } from 'constants/index'
import { registerOnWindow } from 'utils/misc'
import { isBarn, isDev, isLocal, isPr } from '../../utils/environments'
import OperatorError, {
Expand Down Expand Up @@ -63,7 +63,7 @@ function getProfileUrl(): Partial<Record<ChainId, string>> {
[ChainId.MAINNET]: process.env.REACT_APP_PROFILE_API_URL_STAGING_MAINNET || 'https://api.cow.fi/affiliate/api',
}
}
const STRATEGY_URL_BASE = 'https://raw.githubusercontent.com/gnosis/cowswap/configuration/config/strategies'
const STRATEGY_URL_BASE = RAW_CODE_LINK + '/configuration/config/strategies'
function getPriceStrategyUrl(): Record<SupportedChainId, string> {
return {
[SupportedChainId.MAINNET]: STRATEGY_URL_BASE + '/strategy-1.json',
Expand Down
6 changes: 3 additions & 3 deletions src/custom/api/gnosisProtocol/errors/OperatorError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export interface ApiErrorObject {
}

// Conforms to backend API
// https://github.com/gnosis/gp-v2-services/blob/main/crates/orderbook/openapi.yml#L801
// https://github.com/cowprotocol/services/blob/main/crates/orderbook/openapi.yml#L801
// and
// https://github.com/gnosis/gp-v2-services/blob/main/crates/orderbook/openapi.yml#L740
// https://github.com/cowprotocol/services/blob/main/crates/orderbook/openapi.yml#L740
export enum ApiErrorCodes {
DuplicateOrder = 'DuplicateOrder',
InvalidSignature = 'InvalidSignature',
Expand Down Expand Up @@ -94,7 +94,7 @@ export default class OperatorError extends Error {
description: ApiErrorObject['description']

// Status 400 errors
// https://github.com/gnosis/gp-v2-services/blob/9014ae55412a356e46343e051aefeb683cc69c41/orderbook/openapi.yml#L563
// https://github.com/cowprotocol/services/blob/9014ae55412a356e46343e051aefeb683cc69c41/orderbook/openapi.yml#L563
static apiErrorDetails = ApiErrorCodeDetails

public static async getErrorMessage(response: Response, action: ApiActionType) {
Expand Down
4 changes: 2 additions & 2 deletions src/custom/api/gnosisProtocol/errors/QuoteError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface GpQuoteErrorObject {
}

// Conforms to backend API
// https://github.com/gnosis/gp-v2-services/blob/main/crates/orderbook/openapi.yml
// https://github.com/cowprotocol/services/blob/main/crates/orderbook/openapi.yml
export enum GpQuoteErrorCodes {
UnsupportedToken = 'UnsupportedToken',
InsufficientLiquidity = 'InsufficientLiquidity',
Expand Down Expand Up @@ -67,7 +67,7 @@ export default class GpQuoteError extends Error {
data?: any

// Status 400 errors
// https://github.com/gnosis/gp-v2-services/blob/9014ae55412a356e46343e051aefeb683cc69c41/orderbook/openapi.yml#L563
// https://github.com/cowprotocol/services/blob/9014ae55412a356e46343e051aefeb683cc69c41/orderbook/openapi.yml#L563
static quoteErrorDetails = GpQuoteErrorDetails

public static async getErrorMessage(response: Response) {
Expand Down
12 changes: 8 additions & 4 deletions src/custom/components/ErrorBoundary/ErrorBoundaryMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import CowError from 'assets/cow-swap/CowError.png'
import { UniIcon, LogoImage } from '../Header'
import { HeaderRow } from 'components/Header/HeaderMod'
import Footer from 'components/Footer'
import { DISCORD_LINK, CODE_LINK } from 'constants/index'

/* const FallbackWrapper = styled.div`
display: flex;
Expand Down Expand Up @@ -197,9 +198,12 @@ export default class ErrorBoundary extends React.Component<unknown, ErrorBoundar
<LinkWrapper>
<ExternalLink
id="create-github-issue-link"
href={`https://github.com/gnosis/cowswap/issues/new?assignees=&labels=🐞 Bug,🔥 Critical&body=${encodedBody}&title=${encodeURIComponent(
`Crash report: \`${error.name}${error.message && `: ${truncate(error.message)}`}\``
)}`}
href={
CODE_LINK +
`/issues/new?assignees=&labels=🐞 Bug,🔥 Critical&body=${encodedBody}&title=${encodeURIComponent(
`Crash report: \`${error.name}${error.message && `: ${truncate(error.message)}`}\``
)}`
}
>
<ThemedText.Link fontSize={16}>
<Trans>Create an issue on GitHub</Trans>
Expand All @@ -208,7 +212,7 @@ export default class ErrorBoundary extends React.Component<unknown, ErrorBoundar
</ExternalLink>
</LinkWrapper>
<LinkWrapper>
<ExternalLink id="get-support-on-discord" href="https://chat.cowswap.exchange/">
<ExternalLink id="get-support-on-discord" href={DISCORD_LINK}>
<ThemedText.Link fontSize={16}>
<Trans>Get support on Discord</Trans>
<span></span>
Expand Down
5 changes: 2 additions & 3 deletions src/custom/components/Header/URLWarning/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from 'styled-components/macro'
import { BARN_URL, PRODUCTION_URL } from 'constants/index'
import { BARN_URL, PRODUCTION_URL, RAW_CODE_LINK } from 'constants/index'
import { AlertTriangle } from 'react-feather'
import URLWarningUni, { PhishAlert, StyledClose } from './URLWarningMod'
import { useAnnouncementVisible, useCloseAnnouncement } from 'state/profile/hooks'
Expand Down Expand Up @@ -49,8 +49,7 @@ const Wrapper = styled.div`

// Announcement content: Modify this file to edit the announcement
// https://github.com/gnosis/cowswap/blob/configuration/config/announcements/announcements.md
const ANNOUNCEMENTS_MARKDOWN_BASE_URL =
'https://raw.githubusercontent.com/gnosis/cowswap/configuration/config/announcements'
const ANNOUNCEMENTS_MARKDOWN_BASE_URL = RAW_CODE_LINK + '/configuration/config/announcements'

function getAnnouncementUrl(chainId: number) {
return `${ANNOUNCEMENTS_MARKDOWN_BASE_URL}/announcements-${chainId}.md`
Expand Down
2 changes: 1 addition & 1 deletion src/custom/connectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const portis = new PortisConnector({
export const walletlink = new WalletLinkConnector({
url: rpcNetworks[NETWORK_CHAIN_ID],
appName: 'CowSwap',
appLogoUrl: 'https://raw.githubusercontent.com/gnosis/gp-swap-ui/develop/public/favicon.png',
appLogoUrl: 'https://raw.githubusercontent.com/cowprotocol/cowswap/develop/public/favicon.png',
supportedChainIds: getSupportedChainIds(),
})

Expand Down
11 changes: 7 additions & 4 deletions src/custom/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const COW_CONTRACT_ADDRESS: Record<number, string> = {
[ChainId.RINKEBY]: '0xbdf1e19f8c78A77fb741b44EbA5e4c0C8DBAeF91',
}

// See https://github.com/gnosis/gp-v2-contracts/commit/821b5a8da213297b0f7f1d8b17c893c5627020af#diff-12bbbe13cd5cf42d639e34a39d8795021ba40d3ee1e1a8282df652eb161a11d6R13
// See https://github.com/cowprotocol/contracts/commit/821b5a8da213297b0f7f1d8b17c893c5627020af#diff-12bbbe13cd5cf42d639e34a39d8795021ba40d3ee1e1a8282df652eb161a11d6R13
export const NATIVE_CURRENCY_BUY_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'
export const NATIVE_CURRENCY_BUY_TOKEN: { [chainId in ChainId | number]: Token } = {
[ChainId.MAINNET]: new Token(ChainId.MAINNET, NATIVE_CURRENCY_BUY_ADDRESS, 18, 'ETH', 'Ether'),
Expand All @@ -94,13 +94,16 @@ export const WETH_LOGO_URI =
export const XDAI_LOGO_URI =
'https://raw.githubusercontent.com/1Hive/default-token-list/master/src/assets/xdai/0xe91d153e0b41518a2ce8dd3d7944fa863463a97d/logo.png'

const GITHUB_REPOSITORY = 'cowprotocol/cowswap'
export const CODE_LINK = 'https://github.com/' + GITHUB_REPOSITORY
export const RAW_CODE_LINK = 'https://raw.githubusercontent.com/' + GITHUB_REPOSITORY

export const DOCS_LINK = 'https://docs.cow.fi'
export const CONTRACTS_CODE_LINK = 'https://github.com/gnosis/gp-v2-contracts'
export const CODE_LINK = 'https://github.com/cowprotocol/cowswap'
export const CONTRACTS_CODE_LINK = 'https://github.com/cowprotocol/contracts'
export const DISCORD_LINK = 'https://discord.com/invite/cowprotocol'
export const DUNE_DASHBOARD_LINK = 'https://duneanalytics.com/gnosis.protocol/Gnosis-Protocol-V2'
export const TWITTER_LINK = 'https://twitter.com/mevprotection'
export const GPAUDIT_LINK = 'https://github.com/gnosis/gp-v2-contracts/blob/main/audits/GnosisProtocolV2May2021.pdf'
export const GPAUDIT_LINK = 'https://github.com/cowprotocol/contracts/blob/main/audits/GnosisProtocolV2May2021.pdf'
export const FLASHBOYS_LINK = 'https://arxiv.org/abs/1904.05234'
export const COWWIKI_LINK = 'https://en.wikipedia.org/wiki/Coincidence_of_wants'
export const GNOSIS_FORUM_ROADTODECENT_LINK = 'https://forum.gnosis.io/t/gpv2-road-to-decentralization/1245'
Expand Down
4 changes: 2 additions & 2 deletions src/custom/constants/lists.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// used to mark unsupported tokens, these are hosted lists of unsupported tokens
import { SupportedChainId as ChainId } from 'constants/chains'
import { RAW_CODE_LINK } from '.'

export * from '@src/constants/lists'

Expand All @@ -24,8 +25,7 @@ const GEMINI_LIST = 'https://www.gemini.com/uniswap/manifest.json'
const BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json'

// Rinkeby Default
const RINKEBY_LIST =
'https://raw.githubusercontent.com/cowprotocol/cowswap/main/src/custom/tokens/rinkeby-token-list.json'
const RINKEBY_LIST = RAW_CODE_LINK + '/main/src/custom/tokens/rinkeby-token-list.json'

// XDAI Default
const HONEY_SWAP_XDAI = 'https://tokens.honeyswap.org'
Expand Down
2 changes: 1 addition & 1 deletion src/custom/pages/Faq/TradingFaq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default function TokenFaq() {
When an order is executed, the settlement contract withdraws the sell amount from the trader’s token balance
via the CoW Protocol Vault Relayer (for more information read{' '}
<ExternalLinkFaq
href="https://github.com/gnosis/gp-v2-contracts/blob/main/src/contracts/GPv2VaultRelayer.sol"
href="https://github.com/cowprotocol/contracts/blob/main/src/contracts/GPv2VaultRelayer.sol"
target="_blank"
rel="noopener noreferrer"
>
Expand Down
4 changes: 2 additions & 2 deletions src/custom/state/claim/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ function _getClaimManyArgs({
nativeTokenPrice,
}: GetClaimManyArgsParams): GetClaimManyArgsResult {
// Arrays are named according to contract parameters
// For more info, check https://github.com/gnosis/gp-v2-token/blob/main/src/contracts/mixins/MerkleDistributor.sol#L123
// For more info, check https://github.com/cowprotocol/token/blob/main/src/contracts/mixins/MerkleDistributor.sol#L123
const indices: ClaimManyFnArgs[0] = []
const claimTypes: ClaimManyFnArgs[1] = []
const claimants: ClaimManyFnArgs[2] = []
Expand Down Expand Up @@ -731,7 +731,7 @@ function _hasNoInputOrInputIsGreaterThanClaimAmount(
*
* The calculation is done based on the formula:
* vCowAmount * wethPrice / 10^18
* See https://github.com/gnosis/gp-v2-token/blob/main/src/contracts/mixins/Claiming.sol#L314-L320
* See https://github.com/cowprotocol/token/blob/main/src/contracts/mixins/Claiming.sol#L314-L320
*/
function _getClaimValue(claim: UserClaimData, vCowAmount: string, nativeTokenPrice: string): string {
if (claim.type !== ClaimType.UserOption) {
Expand Down
2 changes: 1 addition & 1 deletion src/custom/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface TokensFromMarketParams<T> extends Market<T> {
}

export function getCanonicalMarket<T>({ sellToken, buyToken, kind }: CanonicalMarketParams<T>): Market<T> {
// TODO: Implement smarter logic https://github.com/gnosis/gp-ui/issues/331
// TODO: Implement smarter logic https://github.com/cowprotocol/explorer/issues/9

// Not big reasoning on my selection of what is base and what is quote (important thing in this PR is just to do a consistent selection)
// The used reasoning is:
Expand Down

0 comments on commit 04804ac

Please sign in to comment.