Skip to content

Commit

Permalink
Merge branch 'main' into add-rate-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
odysseus0 authored Dec 4, 2023
2 parents b2e1f63 + 86e3dda commit 80d2452
Show file tree
Hide file tree
Showing 19 changed files with 1,712 additions and 1,624 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = {
' ',
],
],
'import/no-unresolved': ERROR,
'import/no-unresolved': [ERROR, {ignore: ['^@docusaurus']}],
'import/no-extraneous-dependencies': [ERROR, {includeTypes: true}],
'react/require-default-props': [
WARNING,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'
- name: Test build
env:
TARGET_URL: "https://docs.flashbots.net"
Expand Down
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true,
"source.fixAll.stylelint": true
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"mdx.experimentalLanguageServer": true,
"css.validate": false,
"scss.validate": false,
"javascript.validate.enable": false,
"typescript.validate.enable": false,
"typescript.validate.enable": true,
"javascript.suggest.paths": false,
"typescript.suggest.paths": false,
}
18 changes: 17 additions & 1 deletion docs/community-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,20 @@ title: Community Tools

### [Rated Network](https://www.rated.network/?network=mainnet&view=pool&timeWindow=1d&page=1)

- Information about validators, pools, relays, etc.
- Information about validators, pools, relays, etc.

### [MEV-Boost Relay & Builder Stats](https://www.relayscan.io/)

- Ethereum MEV-Boost Relay Monitoring.

### [MEV Data by EigenPhi](https://eigenphi.io/)

- Analytical explorers detailing MEV and liquidity on-chain data.

### [Ethereum Block Value Analytics](https://payload.de/data/)

- Transaction pool, value over time, and builder bids of Ethereum block.

### [libMEV](https://libmev.com/)

- A living dashboard with MEV searcher data.
2 changes: 0 additions & 2 deletions docs/flashbots-auction/advanced/reputation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ $$
r(U) = \frac{\sum_{T\in H_U}(\Delta_{coinbase_T} + g_Tp_T)}{\sum_{T\in S_U}g_T}
$$

<!-- markdownlint-disable MD037 -->
$r$: searcher reputation score.
$H_U$: set of all transactions $T$ submitted by searcher $U$ to `eth_sendBundle` RPC and successfully landed on chain.
$S_U$: set of all transactions $T$ submitted by searcher $U$ to `eth_sendBundle` and `eth_callBundle` RPC.
$g_{T}$: _gas used_ by transaction $T$.
$p_{T}$: _gas price_ of transaction $T$.
$\Delta_{coinbase_T}$: coinbase difference from direct payment in transaction $T$.
<!-- markdownlint-enable MD037 -->

## Querying reputation

Expand Down
1 change: 1 addition & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ module.exports = async function createConfigAsync() {
},
};
},
'docusaurus-plugin-sass'
],
}
}
33 changes: 18 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
},
"dependencies": {
"@algolia/client-search": "^4.20.0",
"@docusaurus/core": "^3.0.0-beta.0",
"@docusaurus/plugin-content-docs": "^3.0.0-beta.0",
"@docusaurus/plugin-sitemap": "^3.0.0-beta.0",
"@docusaurus/preset-classic": "^3.0.0-beta.0",
"@docusaurus/utils": "^3.0.0-beta.0",
"@docusaurus/utils-common": "^3.0.0-beta.0",
"@mdx-js/react": "^2.3.0",
"@metamask/sdk-react": "^0.9.0",
"@docusaurus/core": "^3.0.0",
"@docusaurus/plugin-content-docs": "^3.0.0",
"@docusaurus/plugin-sitemap": "^3.0.0",
"@docusaurus/preset-classic": "^3.0.0",
"@docusaurus/utils": "^3.0.0",
"@docusaurus/utils-common": "^3.0.0",
"@mdx-js/react": "^3.0.0",
"@radix-ui/react-switch": "^1.0.3",
"@vercel/analytics": "^0.1.11",
"autoprefixer": "^10.4.16",
"axios": "^1.4.0",
"change-case": "^5.1.2",
"clsx": "^1.1.1",
"docusaurus-plugin-sass": "^0.2.5",
"dotenv": "^8.2.0",
"ethers": "^6.7.1",
"postcss": "^8.4.31",
Expand All @@ -44,8 +44,9 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-loadable": "^5.5.0",
"rehype-katex": "^6.0.3",
"remark-math": "^5.1.1",
"rehype-katex": "^7",
"remark-math": "^6",
"sass": "^1.69.5",
"search-insights": "^2.8.3",
"tailwindcss": "^3.3.3",
"webpack": "^5.88.1"
Expand All @@ -63,9 +64,9 @@
]
},
"devDependencies": {
"@docusaurus/eslint-plugin": "^3.0.0-beta.0",
"@docusaurus/module-type-aliases": "^3.0.0-beta.0",
"@docusaurus/tsconfig": "^3.0.0-beta.0",
"@docusaurus/eslint-plugin": "^3.0.0",
"@docusaurus/module-type-aliases": "^3.0.0",
"@docusaurus/tsconfig": "^3.0.0",
"@flashbots/mev-share-client": "^0.7.10",
"@tsconfig/docusaurus": "^2.0.2",
"@types/react": "^18.2.23",
Expand All @@ -80,9 +81,8 @@
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-import-resolver-webpack": "^0.13.7",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-mdx": "^2.2.0",
Expand All @@ -99,5 +99,8 @@
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-standard": "^29.0.0",
"typescript": "^5.2.2"
},
"engines": {
"node": ">=18.0"
}
}
21 changes: 21 additions & 0 deletions src/components/Banner/Banner.custom.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@use '_base';

/*
Add custom CSS styling for your banner here
You can add any classes you'd like based on the markup for your banner
The .banner class is already provided and apply to the parent element of
the banner.
The '@extend %banner-structure' defines the structural properties for the
banner and should not be removed.
*/

.banner {
@extend %banner-structure; // Do not remove
}


[data-theme=dark] .banner {
@extend %banner-structure; // Do not remove
}
12 changes: 12 additions & 0 deletions src/components/Banner/Banner.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@use 'base';

.banner {
@extend %banner-structure;

background-color: var(--banner-background-color, var(--ifm-navbar-background-color));
color: var(--banner-text-color, var(--ifm-font-color-base));

a {
color: var(--banner-text-color , var(--ifm-font-color-base));
}
}
82 changes: 82 additions & 0 deletions src/components/Banner/Banner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* Custom Banner Module
Use it to quickly deploy a simple banner to the Flashbots homepage
To add a new banner all you need to do is edit the ./banner.config.tsx
file and set the applicable properties. No other work is necessary.
You'll find more in-depth documentation there.
*/

import React from 'react'
import clsx from 'clsx'
import bannerConfig from './banner.config'
import customStyles from './Banner.custom.module.scss'
import bannerStyles from './Banner.module.scss'

export interface BannerOptions {
bannerContent?: JSX.Element | string | null
backgroundColor: string
textColor: string
startDate: string | null
endDate: string | null
customBannerCSS: boolean
}

class BannerConfigs {
options: BannerOptions

constructor(options: BannerOptions) {
this.options = options
}

// Sets the appropriate CSS rules for the element
// based on the `customCSS` option
getBannerStyle(): React.CSSProperties | null {
return !this.options.customBannerCSS
? {
"--banner-text-color": this.options.textColor,
"--banner-background-color": this.options.backgroundColor
}
: null
}

// Sets the appropriate class name for the element
// based on the `customCSS` option
getBannerClass(): string {
const styles = this.options.customBannerCSS ? customStyles : bannerStyles

return clsx(styles.banner)
}

// Determines whether the banner should appear based on:
// 1. Whether there is content to be shown
// 2. The start and end dates exist and are valid
shouldShowBanner(): boolean {
if (!this.options.bannerContent) {
return false
}

const parsedStart = Date.parse(this.options.startDate)
const parsedEnd = Date.parse(this.options.endDate)
const currentDate = Date.now()

return (
(isNaN(parsedStart) || parsedStart <= currentDate) &&
(isNaN(parsedEnd) || parsedEnd >= currentDate)
)
}
}

export default function Banner(): JSX.Element {
const configs = new BannerConfigs(bannerConfig)

if (!configs.shouldShowBanner()) {
return null
}

return (
<div style={configs.getBannerStyle()} className={configs.getBannerClass()}>
{configs.options.bannerContent}
</div>
)
}
19 changes: 19 additions & 0 deletions src/components/Banner/_base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
%banner-structure {
height: fit-content;
padding: 0.5rem 2rem;
text-align: center;
line-height: 1.25;

a{
cursor: pointer;
text-decoration: none;

&:hover {
text-decoration: underline;
}
}

@media (max-width: 720px){
padding: 0.5rem 2rem;
}
}
93 changes: 93 additions & 0 deletions src/components/Banner/banner.config.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/* Custom Banner Module
Use it to quickly deploy a simple banner to the Flashbots homepage
To add a new banner all you need to do is edit the properties below and set them
to your desired values.
For simple banners with just a couple of colors - for copy and background - you
can use the properties here. But if the banner requires more sophisticated styling
you can override the color options by setting `customCSS: true` and adding your CSS
rules to ./Banner.custom.module.scss.
There are detailed explanations for each property below, but here's a quick guide:
- bannerContent: What should appear inside the banner
- backgroundColor: Solid, single color for the banner
- textColor: Solid, single color for all the copy inside the banner
- startDate: When should the banner start appearing on the site
- endDate: When should the banner stop appearing on the site
- customCSS: Whether the banner should make use of custom CSS rules loaded from ./Banner.custom.module.scss
*/

import React from 'react'
import BannerOptions from './Banner'

export const bannerConfig: BannerOptions = {
/*
bannerContent: The pure text or HTML markup to appear in the banner
- Banner won't appear when set to null
Examples:
- bannerContent: null
- bannerContent: "Banner content!"
- bannerContent: (<span>Banner content! <a href='https://example.com' target='_blank' rel='noreferrer'>Link</a></span>)
*/
bannerContent: null,

/*
backgroundColor: Single, solid background color for the banner
- Will default to the site's background when set to null
- Has no effect if customCSS is true
Examples:
- backgroundColor: null
- backgroundColor: "#023047"
*/
backgroundColor: null,

/*
textColor: Single, solid text color for the banner
- Will default to the site's text color when set to null
- Has no effect if customCSS is true
Examples:
- textColor: null
- textColor: "#ffb703"
*/
textColor: null,

/*
startDate: Date and time (UTC) when the banner should start appearing on the website
- When set to null a banner will always appear, provided there is content to be shown
and the endDate, if there is one, hasn't been reached
Format: "YYYY-MM-DD HH:mmZ"
Examples:
- startDate: null
- startDate: "2001-09-14 16:00Z"
*/
startDate: null,

/*
endDate: Date and time (UTC) when the banner should stop appearing on the website
- When set to null a banner will always appear, provided there is content to be shown
and the startDate, if there is one, has been reached
Format: "YYYY-MM-DD HH:mmZ"
Examples:
- endDate: null
- endDate: "2007-02-01 00:00Z"
*/
endDate: null,

/*
customCSS: Determines whether to use a custom CSS instead instead of the color options
- Custom CSS must be set in ./Banner.custom.module.scss
- Will completely bypass backgroundColor and textColor if set to true
Examples:
- customCSS: true
*/
customBannerCSS: false
}

export default bannerConfig
Loading

0 comments on commit 80d2452

Please sign in to comment.