diff --git a/packages/backend/src/Application.ts b/packages/backend/src/Application.ts index a715f8833..cb3ce1a13 100644 --- a/packages/backend/src/Application.ts +++ b/packages/backend/src/Application.ts @@ -11,6 +11,7 @@ import { L2TransactionController } from './api/controllers/L2TransactionControll import { MerkleProofController } from './api/controllers/MerkleProofController' import { SearchController } from './api/controllers/SearchController' import { StateUpdateController } from './api/controllers/StateUpdateController' +import { TermsOfServiceController } from './api/controllers/TermsOfServiceController' import { TransactionController } from './api/controllers/TransactionController' import { TransactionSubmitController } from './api/controllers/TransactionSubmitController' import { TutorialController } from './api/controllers/TutorialController' @@ -688,6 +689,10 @@ export class Application { tutorialService ) + const termsOfServiceController = new TermsOfServiceController( + pageContextService + ) + const apiServer = new ApiServer(config.port, logger, { routers: [ createStatusRouter(statusService), @@ -703,6 +708,7 @@ export class Application { l2TransactionController, escapeHatchController, tutorialController, + termsOfServiceController, config ), createTransactionRouter( diff --git a/packages/backend/src/api/controllers/TermsOfServiceController.ts b/packages/backend/src/api/controllers/TermsOfServiceController.ts new file mode 100644 index 000000000..d3d43baf4 --- /dev/null +++ b/packages/backend/src/api/controllers/TermsOfServiceController.ts @@ -0,0 +1,34 @@ +import { renderTermsOfServicePage } from '@explorer/frontend' +import { UserDetails } from '@explorer/shared' + +import { PageContextService } from '../../core/PageContextService' +import { getHtmlFromMarkdown } from '../../utils/markdown/getHtmlFromMarkdown' +import { ControllerResult } from './ControllerResult' + +export class TermsOfServiceController { + constructor(private readonly pageContextService: PageContextService) {} + + async getTermsOfServicePage( + givenUser: Partial + ): Promise { + const context = await this.pageContextService.getPageContext(givenUser) + let contents: string + try { + const path = 'src/content/tos.md' + contents = getHtmlFromMarkdown(path) + } catch { + return { + type: 'not found', + message: 'The page you were looking for does not exist', + } + } + + return { + type: 'success', + content: renderTermsOfServicePage({ + context, + contents, + }), + } + } +} diff --git a/packages/backend/src/api/routers/FrontendRouter.ts b/packages/backend/src/api/routers/FrontendRouter.ts index 0e48d292c..bf313e0bd 100644 --- a/packages/backend/src/api/routers/FrontendRouter.ts +++ b/packages/backend/src/api/routers/FrontendRouter.ts @@ -12,6 +12,7 @@ import { L2TransactionController } from '../controllers/L2TransactionController' import { MerkleProofController } from '../controllers/MerkleProofController' import { SearchController } from '../controllers/SearchController' import { StateUpdateController } from '../controllers/StateUpdateController' +import { TermsOfServiceController } from '../controllers/TermsOfServiceController' import { TransactionController } from '../controllers/TransactionController' import { TutorialController } from '../controllers/TutorialController' import { UserController } from '../controllers/UserController' @@ -32,6 +33,7 @@ export function createFrontendRouter( l2TransactionController: L2TransactionController, escapeHatchController: EscapeHatchController, tutorialController: TutorialController, + termsOfServiceController: TermsOfServiceController, config: Config ) { const router = new Router() @@ -498,6 +500,14 @@ export function createFrontendRouter( ) ) + router.get('/tos', async (ctx) => { + const givenUser = getGivenUser(ctx) + const result = await termsOfServiceController.getTermsOfServicePage( + givenUser + ) + applyControllerResult(ctx, result) + }) + if (config.starkex.tradingMode === 'perpetual') { if (!forcedTradeOfferController) { throw new Error( diff --git a/packages/backend/src/content/tos.md b/packages/backend/src/content/tos.md new file mode 100644 index 000000000..81325504f --- /dev/null +++ b/packages/backend/src/content/tos.md @@ -0,0 +1,129 @@ +# **Terms of Service** + +**Last Updated:** 2024-09-18 + +## **1. General Information** + +### **1.1. About Us** + +These Terms of Service ("Terms") govern your access to and use of the dYdX Explorer ("the Explorer"), operated by L2BEAT, a limited liability company (spółka z ograniczoną odpowiedzialnością) with its registered office in Warsaw at Poznańska 16/4, 00-680 Warsaw, Poland. + +### **1.2. Acceptance of Terms** + +By accessing or using the Explorer, you agree to be bound by these Terms and all applicable laws and regulations. If you do not agree with these Terms, you must not use the Explorer. + +## **2. Description of Services** + +### **2.1. Nature of Service** + +The Explorer is a user interface designed to facilitate interactions with the dYdX exchange and its underlying smart contracts on the Ethereum blockchain. L2BEAT does not execute any actions independently, as the Explorer merely serves as a tool for users to interact with these third-party smart contracts. All blockchain transactions created with the help of the Explorer are submitted to the blockchain through the users’ wallet applications and then executed by the blockchain without further action from either the Explorer or L2BEAT. L2BEAT does not guarantee the functionality, security, or accuracy of any smart contracts accessed through the Explorer, nor can it ensure that they are bug-free or will work as intended. + +### **2.2. Third-Party Independence** + +- **dYdX Exchange**: The dYdX exchange is operated independently by its own operators, and L2BEAT does not control its operations. The exchange can cease operations leaving the smart contracts as the only means of accessing funds transferred to the exchange. +- **Smart Contracts**: The smart contracts utilized by the dYdX exchange are authored by StarkWare Ltd. and other respective authors or organizations. L2BEAT is not responsible for the functionality or security of these smart contracts or any other underlying systems. + +## **3. User Responsibilities, Risks, and Disclaimers** + +### **3.1. User Responsibility** + +- **Verification**: Users must verify all actions through their own Ethereum wallets. Users are responsible for confirming that any transaction they approve aligns with their intentions. +- **Independent Validation**: Users should independently validate the details of any smart contract interactions initiated via the Explorer. +- **Independent Submission:** To sign and submit blockchain transactions created with the help of the Explorer users have to use a wallet application of their choice. L2BEAT does neither cover nor receive any fees that the user pays for having their transaction executed on the blockchain. + +### **3.2. No Guarantees or Warranties** + +The Explorer is provided without any guarantees of availability, reliability, or accuracy. L2BEAT does not warrant that the Explorer will be error-free or uninterrupted. L2BEAT makes no representation regarding the accuracy of any data or information presented within the Explorer. + +### **3.3. Limitation of Liability** + +You expressly understand and agree that L2BEAT, its affiliates, subsidiaries, officers, directors, employees, agents, partners, and licensors shall not be liable to you for any direct, indirect, incidental, special, consequential, or exemplary damages, including, but not limited to, damages for loss of profits, goodwill, use, data, the cost of procuring substitute goods or services, or other intangible losses (even if L2BEAT has been advised of the possibility of such damages), resulting from any of the following: + +- **Your use of or inability to use the Explorer**: This includes any software or systems that make the services available. +- **Modifications or termination of the service**: This covers any changes made to the Explorer, any suspension or discontinuation of the service, or any part thereof, whether temporary or permanent. +- **User-generated content**: This pertains to the use, disclosure, or display of any user-generated content provided through the Explorer. +- **Unauthorized access**: This involves unauthorized access to or alteration of your transmissions, data, or wallet. +- **Data loss or corruption**: This includes the deletion, corruption, failure to store, send, or receive your transmissions or data on or through the Explorer. +- **Conduct of third parties**: This refers to statements or conduct of any third party related to the Explorer, including but not limited to interactions with the dYdX exchange, smart contracts by StarkWare or other respective authors, or other third-party services. +- **Other matters related to the Explorer**: This covers any other matter relating to your use of the Explorer or its functionalities. + +This limitation of liability shall apply to the fullest extent permitted by applicable law, regardless of the form of action, whether in contract, tort, strict liability, or otherwise. You acknowledge that the Explorer is provided without any warranties, and this limitation of liability is an essential part of the agreement between you and L2BEAT. + +### **3.4. Prohibited Uses** + +You agree that all activities and conduct in connection with your use of the Explorer, including any transactions, will comply with all applicable laws, regulations, guidelines, and policies of any governmental or regulatory body. You further agree not to use the Explorer for any illegal or unlawful purpose, including, but not limited to, the following prohibited uses: + +- **Illegal Activities**: Engaging in any activity that violates applicable laws, including anti-money laundering (AML) and anti-terrorist financing laws. +- **Unlawful Transactions**: Conducting transactions involving the proceeds of illegal activities or violating any laws or regulations related to fraud, theft, or other unlawful conduct. +- **Privacy Violations**: Engaging in activities that violate privacy laws, including the unauthorized collection, use, or disclosure of personal data. +- **Unauthorized Access**: Attempting to gain unauthorized access to the Explorer, other users' accounts, or any systems connected to the Explorer. +- **Abusive Behavior**: Engaging in conduct that is abusive, harassing, or harmful to others, including spamming, phishing, or distributing malicious software. +- **Circumventing Security**: Attempting to bypass or interfere with the security features of the Explorer or related systems. +- **Fraud and Misrepresentation**: Impersonating any person or entity or misrepresenting your affiliation with a person or entity. +- **Market Manipulation**: Engaging in activities that manipulate, deceive, or otherwise distort any market in which the Explorer operates. + +Any breach of this clause may result in the immediate termination of your access to the Explorer and could lead to legal action. + +### **3.5. Acknowledgement of Risks and Responsibilities** + +By using the Explorer or interacting with the site in any way, you acknowledge and understand the inherent risks associated with cryptographic systems. You warrant that you have a sufficient understanding of the usage and intricacies of native cryptographic tokens, such as Ether (ETH), smart contract-based tokens like those adhering to the Ethereum Token Standard (ERC-20), and blockchain-based software systems. + +L2BEAT does not own or control the underlying software or hardware that forms and operates blockchain networks. The software for blockchain networks is generally open source, allowing anyone to use, copy, modify, and distribute it. By using the Explorer, you acknowledge and agree that: + +1. **No Control Over Blockchain Networks**: L2BEAT is not responsible for the operation, functionality, security, or availability of the underlying software, hardware, and networks, which may experience disruptions or failures. +2. **Risks of Forks**: The underlying protocols of blockchain networks may be subject to sudden changes in operating rules, known as "Forks." Such Forks may materially affect the Explorer, and L2BEAT may decide, at its discretion, not to support (or to cease supporting) a Forked network. You acknowledge and agree that L2BEAT assumes no responsibility for the underlying software protocols, whether Forked or not. + +The networks utilized by the Explorer rely on public/private key cryptography. You are solely responsible for securing and protecting your private keys or other access credentials and hardware equipment used to access digital assets. L2BEAT does not have access to or custody of your private keys or digital assets. + +**Loss of Private Keys**: Losing control of your private keys will result in permanent and irreversible denial of access to your digital assets on the Ethereum blockchain or any other network. If your private keys are lost or compromised, neither L2BEAT nor any other person can retrieve or protect your digital assets. In such cases, you will not be able to transfer your digital assets or realize their value or utility. + +## **4. Use at Your Own Risk** + +- Users engage with the Explorer entirely at their own risk. By using the Explorer, you acknowledge that blockchain-based services have inherent risks, including but not limited to potential software bugs, vulnerabilities, and financial loss. +- L2BEAT disclaims all liability for any actions taken based on information or functionalities provided by the Explorer. + +## **5. No Financial or Investment Advice** + +- The information provided by the Explorer is for informational purposes only and does not constitute financial, investment, or other professional advice. +- You should conduct your own research and consult professional advisors as necessary before making any investment decisions. + +## **6. Third-Party Content and Services** + +- The Explorer interfaces with third-party platforms and smart contracts. L2BEAT disclaims responsibility for the content, actions, or failures of these third parties. +- L2BEAT does not endorse, guarantee, or assume responsibility for any third-party products or services, including those available through the dYdX exchange, StarkWare Ltd., or other respective authors and organizations. + +## **7. Indemnification** + +- You agree to indemnify, defend, and hold harmless L2BEAT, its affiliates, officers, directors, employees, and agents from and against any claims, liabilities, damages, losses, and expenses, including without limitation reasonable legal fees, arising out of or in any way connected with your use of the Explorer, your violation of these Terms, or your violation of any rights of another person or entity. + +## **8. Security** + +- You are responsible for maintaining the security of your wallet and private keys. L2BEAT does not store or have access to your private keys. +- L2BEAT disclaims all liability for any security breaches, losses, or unauthorized access to your Ethereum wallet or transactions. + +## **9. Termination of Access** + +- L2BEAT reserves the right to modify, suspend, or discontinue the Explorer at any time without notice. +- L2BEAT may terminate or restrict your access to the Explorer if you violate these Terms or engage in conduct that we determine to be harmful to the Explorer, other users, or L2BEAT. + +## **10. Amendments to Terms** + +- L2BEAT reserves the right to update or modify these Terms at any time. We will notify users of any material changes by posting the revised Terms on our website. Your continued use of the Explorer following the posting of changes signifies your acceptance of those changes. + +## **11. Governing Law and Jurisdiction** + +- These Terms are governed by the laws of Poland, without regard to its conflict of law principles. Any disputes arising from these Terms or your use of the Explorer shall be subject to the exclusive jurisdiction of the courts in Poland. + +## **12. Miscellaneous** + +### **12.1. Severability** + +If any provision of these Terms is found to be invalid or unenforceable, the remaining provisions shall remain in full force and effect. + +### **12.2. Waiver** + +No waiver of any term of these Terms shall be deemed a further or continuing waiver of such term or any other term, and L2BEAT's failure to assert any right or provision under these Terms shall not constitute a waiver of such right or provision. + +## **13. Contact Information** + +If you have any questions or concerns about these Terms, please contact us at legal@l2beat.com diff --git a/packages/frontend/src/view/components/page/Footer.tsx b/packages/frontend/src/view/components/page/Footer.tsx index 0df0c3d34..489584509 100644 --- a/packages/frontend/src/view/components/page/Footer.tsx +++ b/packages/frontend/src/view/components/page/Footer.tsx @@ -1,9 +1,16 @@ +import { PageContext } from '@explorer/shared' import React from 'react' import { L2BeatLogo } from '../../assets/logos/L2BeatLogo' import { StarkWareLogo } from '../../assets/logos/StarkWareLogo' +import { Link } from '../Link' -export function Footer() { +interface FooterProps { + readonly context: PageContext +} + +export function Footer({ context }: FooterProps) { + const { instanceName } = context return (