From eb2280b9243ed7bbcd4bc6c04599883d233c4b07 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 9 Jan 2024 11:47:17 +0530 Subject: [PATCH] fixed lint errors --- docs/articles/advanced/using-iprpc.md | 20 +++++++++--- docs/articles/beginner/Learn/react.md | 41 ++++++++++++------------ docs/articles/beginner/Learn/stride.md | 3 +- docs/articles/beginner/Learn/tashi.md | 2 +- docs/articles/beginner/Learn/tutorial.md | 34 ++++++++------------ docs/articles/governance/index.md | 4 ++- docs/articles/governance/voting.md | 2 +- docs/videos/connect_to_metamask.md | 10 +++--- 8 files changed, 61 insertions(+), 55 deletions(-) diff --git a/docs/articles/advanced/using-iprpc.md b/docs/articles/advanced/using-iprpc.md index 7635b49..c23b6e7 100644 --- a/docs/articles/advanced/using-iprpc.md +++ b/docs/articles/advanced/using-iprpc.md @@ -10,7 +10,6 @@ In order to provide decentralized, reliable and public RPC to all developers in Lava ipRPC aggregates RPC providers and provides a unified endpoint for Evmos's entire ecosystem. Regardless of whether you're using `gRPC`, `REST`, `JSON-RPC`, `TendermintRPC`, or `Web-gRPC`, you can query Evmos or post transactions. You can also use websockets to establish a continuous connection instead of conducting a discrete handshake for each relay. - ## Endpoints 🔗 A complete list of endpoints available are available [here](https://docs.evmos.org/develop/api/networks). For ipRPC, please attend only to addresses on the list which have `Lava Network` as a maintainer. A list is provided below for your convenience, as well! @@ -40,16 +39,19 @@ A complete list of endpoints available are available [here](https://docs.evmos.o You can set your `evmosd` installation to use ipRPC for all calls and requests. To do so, you need to configure your default node to use the Tendermint-RPC URL for your respective network. For `mainnet` use: + ```bash ./evmosd config node https://tm.evmos.lava.build:443 ``` For `testnet` use: + ```bash ./evmosd config node https://tm.evmos-testnet.lava.build:443 ``` To ensure that your `evmosd` is correctly setup run the following: + ```bash ./evmosd status ``` @@ -62,53 +64,63 @@ If you get a readout like the following, you're properly configured! Now, all `evmosd` commands which communicate with the blockchain will be carried out securely and efficiently over Lava ipRPC. - ## Test Commands 🖥️ You can send requests to each endpoint directly from the command line without intervention from `evmosd`. This can be done with the use of different tools such as `curl` for HTTP-responsive protocols, `wscat` for web sockets, and `grpcurl` for gRPC. You can also use any of the endpoints programmatically. Some examples are below: - ### 🟢 REST + Send get requests to the appropriate cosmos endpoints! + ```bash curl -X GET -H "Content-Type: application/json" https://rest.evmos.lava.build/cosmos/base/tendermint/v1beta1/blocks/latest curl -X GET -H "Content-Type: application/json" https://rest.evmos-testnet.lava.build/cosmos/base/tendermint/v1beta1/blocks/latest ``` ### 🟢 Tendermint + Send post requests to the Tendermint-RPC endpoint! + ```bash curl -X POST -H "Content-Type: application/json" https://tm.evmos.lava.build --data '{"jsonrpc": "2.0", "id": 1, "method": "status", "params": []}' curl -X POST -H "Content-Type: application/json" https://tm.evmos-testnet.lava.build --data '{"jsonrpc": "2.0", "id": 1, "method": "status", "params": []}' ``` ### 🟢 Tendermint/Websocket + Connect using websockets over Tendermint-RPC. + ```bash wscat -c wss://tm.evmos.lava.build/websocket -x '{"jsonrpc": "2.0", "id": 1, "method": "status", "params": []}' wscat -c wss://tm.evmos-testnet.lava.build/websocket -x '{"jsonrpc": "2.0", "id": 1, "method": "status", "params": []}' ``` ### 🟢 JSON-RPC + Send EVM-style request to JSON-RPC endpoints! + ```bash curl -X POST -H "Content-Type: application/json" https://evmos.lava.build --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' curl -X POST -H "Content-Type: application/json" https://evmos-testnet.lava.build --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' ``` ### 🟢 JSON-RPC/Websocket + Connect using websockets over JSON-RPC. + ```bash wscat -c wss://evmos.lava.build/websocket -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' wscat -c wss://evmos-testnet.lava.build/websocket -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' ``` ### 🟢 gRPC + Use gRPC calls directly with the Cosmos API. + ```bash grpcurl grpc.evmos.lava.build:443 cosmos.base.tendermint.v1beta1.Service/GetLatestBlock grpcurl grpc.evmos-testnet.lava.build:443 cosmos.base.tendermint.v1beta1.Service/GetLatestBlock ``` -✅ The rest is up to you! The possibilities are literally endless! \ No newline at end of file +✅ The rest is up to you! The possibilities are literally endless! diff --git a/docs/articles/beginner/Learn/react.md b/docs/articles/beginner/Learn/react.md index 5b91d0f..6f9adae 100644 --- a/docs/articles/beginner/Learn/react.md +++ b/docs/articles/beginner/Learn/react.md @@ -6,13 +6,13 @@ In this tutorial, we will build a React Web App to interact with the previously This is an advanced tutorial, and it is expected that you have a fundamental understanding of the following dApp development components: -- web3 npm library: https://www.npmjs.com/package/web3 -- React Web-App Development -- HTML and JavaScript -- JavaScript functions, asynchronous functions (async and await) -- React states, and hooks (useEffect) -- MetaMask Wallet. -- Node.js (ensure it is installed on your computer) +- web3 npm library: https://www.npmjs.com/package/web3 +- React Web-App Development +- HTML and JavaScript +- JavaScript functions, asynchronous functions (async and await) +- React states, and hooks (useEffect) +- MetaMask Wallet. +- Node.js (ensure it is installed on your computer) Let’s begin! @@ -43,7 +43,7 @@ This library helps us instantiate the contract and interact with it using functi In this step, we will start building the React component and input fields for interaction. -Let us create a new file `ContractInteraction.js` in the src folder and paste the provided code snippets for the `ContractInteraction ` component. +Let us create a new file `ContractInteraction.js` in the src folder and paste the provided code snippets for the `ContractInteraction` component. ### Step 4: Configure Contract Information @@ -77,7 +77,7 @@ import contractInfo from '../assets/contract.json'; import Web3 from 'web3'; ``` -We import the useEffect and useState hooks from React. +We import the useEffect and useState hooks from React. The contract information (deployed contract address, and the ABI) will be imported from contract.json @@ -187,10 +187,10 @@ const handleAddContractValue = async () => { Explanation: -- const account = accounts[0];: It extracts the first account from the array of accounts connected with Metamask, and the first account is often the one connected with the dApp. -- await contract.methods.addContractValue().send({ ... });: This line sends a transaction to the addContractValue function of the smart contract using the send method. The from field specifies the account sending the transaction, and the value field specifies the amount of Evmos to send along with the transaction. -- const value = await contract.methods.seeContractValue().call();: After successfully sending the transaction, it retrieves the updated value of the contract by calling the seeContractValue method. -- setEvmosValue(Number(value.toString()));: It updates the React state variable evmosValue with the new value fetched from the contract. +- const account = accounts[0];: It extracts the first account from the array of accounts connected with Metamask, and the first account is often the one connected with the dApp. +- await contract.methods.addContractValue().send({ ... });: This line sends a transaction to the addContractValue function of the smart contract using the send method. The from field specifies the account sending the transaction, and the value field specifies the amount of Evmos to send along with the transaction. +- const value = await contract.methods.seeContractValue().call();: After successfully sending the transaction, it retrieves the updated value of the contract by calling the seeContractValue method. +- setEvmosValue(Number(value.toString()));: It updates the React state variable evmosValue with the new value fetched from the contract. Set User Salary @@ -215,7 +215,7 @@ const setSalaryOfUser = async () => { Explanation: -- await contract.methods.setSalary(salaryAddress, salaryValue).send({ ... });: This line sends a transaction to the setSalary function of the smart contract using the send method. The from field specifies the account sending the transaction, and the function arguments salaryAddress and salaryValue are passed to the setSalary function. +- await contract.methods.setSalary(salaryAddress, salaryValue).send({ ... });: This line sends a transaction to the setSalary function of the smart contract using the send method. The from field specifies the account sending the transaction, and the function arguments salaryAddress and salaryValue are passed to the setSalary function. The salaryAddress and salaryValue are set by the administrator in an HTML form that we will create later. @@ -240,8 +240,8 @@ const handleViewSalary = async () => { Explanation: -- const salary = await contract.methods.salaries(viewSalaryAddress).call();: This line calls the salaries mapping getter function of the smart contract using the call method. It retrieves the salary associated with the provided viewSalaryAddress. -- setViewSalaryValue(web3.utils.fromWei(salary, 'ether'));: This updates the state variable viewSalaryValue by converting the retrieved salary from wei to ether using the web3.utils.fromWei method. This assumes that the salary is stored in wei in the smart contract. +- const salary = await contract.methods.salaries(viewSalaryAddress).call();: This line calls the salaries mapping getter function of the smart contract using the call method. It retrieves the salary associated with the provided viewSalaryAddress. +- setViewSalaryValue(web3.utils.fromWei(salary, 'ether'));: This updates the state variable viewSalaryValue by converting the retrieved salary from wei to ether using the web3.utils.fromWei method. This assumes that the salary is stored in wei in the smart contract. ### Step 5: Create HTML input elements @@ -310,15 +310,15 @@ Start your React app: `npm start` -This launches your app in development mode. Open http://localhost:3000 in your browser to see your app. +This launches your app in development mode. Open Localhost 3000 in your browser to see your app. ### Step 8: Interact with the Smart Contract Now our app is running, and we can try and interact with it via our front-end! -- Connect your MetaMask wallet to the Evmos network. -- Ensure your smart contract is deployed to the specified address in contract.json. -- Use the provided buttons to interact with the smart contract: view contract value, add contract value, set salary, view salary, and withdraw salary. +- Connect your MetaMask wallet to the Evmos network. +- Ensure your smart contract is deployed to the specified address in contract.json. +- Use the provided buttons to interact with the smart contract: view contract value, add contract value, set salary, view salary, and withdraw salary. ![React-App](/img/articles/React-3.png)
Image: React App Interface
@@ -338,5 +338,4 @@ Now our app is running, and we can try and interact with it via our front-end!Image: View Salary of Employee
- Congratulations! You've successfully created a React app that interacts with a smart contract deployed on the Evmos network. This tutorial assumes you have a basic understanding of React and the Evmos blockchain. If you encounter any issues, make sure to check the console for error messages and consult the documentation for the libraries used. diff --git a/docs/articles/beginner/Learn/stride.md b/docs/articles/beginner/Learn/stride.md index e97d27b..aea6a98 100644 --- a/docs/articles/beginner/Learn/stride.md +++ b/docs/articles/beginner/Learn/stride.md @@ -66,6 +66,7 @@ Stride contributes significantly to the Evmos and Cosmos ecosystem with the foll ### Tutorials on Stride + https://docs.stride.zone/docs/getting-started-liquid-stake https://docs.stride.zone/docs/providing-liquidity @@ -79,5 +80,3 @@ https://docs.stride.zone/docs/unstaking Github: https://github.com/Stride-Labs Twitter: https://twitter.com/stride_zone - - diff --git a/docs/articles/beginner/Learn/tashi.md b/docs/articles/beginner/Learn/tashi.md index 925cf6a..6bf2eee 100644 --- a/docs/articles/beginner/Learn/tashi.md +++ b/docs/articles/beginner/Learn/tashi.md @@ -86,4 +86,4 @@ YouTube: https://www.youtube.com/watch?v=1HBaw5tNQ2c LinkedIn: https://www.linkedin.com/company/tashi-finance/about/ -Medium: https://medium.com/@tashi_finance \ No newline at end of file +Medium: https://medium.com/@tashi_finance diff --git a/docs/articles/beginner/Learn/tutorial.md b/docs/articles/beginner/Learn/tutorial.md index 29201c9..63fa43f 100644 --- a/docs/articles/beginner/Learn/tutorial.md +++ b/docs/articles/beginner/Learn/tutorial.md @@ -35,6 +35,7 @@ constructor() payable { evmosValue = 0; } ``` + Purpose: This is the constructor function, executed only once during contract deployment. It initializes the contract's state variables. In the above code, the state variables are values that are stored in the contract storage. These variables can be modified during contract execution provided there is a relevant function. @@ -89,7 +90,6 @@ function addContractValue() public payable onlyOwner { } ``` - Purpose: Allows the owner to add tEVMOS to the contract. Details: @@ -156,21 +156,21 @@ We use Remix IDE to develop our payroll smart contract. The web-based IDE can be Here are some key functionalities of Remix IDE: - **Smart Contract Development:** - - *Solidity Editor:* Remix provides a dedicated Solidity code editor with syntax highlighting, autocompletion, and error checking to facilitate the development of smart contracts. + - *Solidity Editor:* Remix provides a dedicated Solidity code editor with syntax highlighting, autocompletion, and error checking to facilitate the development of smart contracts. - **Deployment and Interaction:** - - *Deploy Contracts:* Remix allows developers to deploy smart contracts directly from the IDE to various networks, including Evmos, including the mainnet and testnets. - - *Interact with Contracts:* Developers can interact with deployed contracts, execute functions, and view contract state using Remix's user-friendly interface. + - *Deploy Contracts:* Remix allows developers to deploy smart contracts directly from the IDE to various networks, including Evmos, including the mainnet and testnets. + - *Interact with Contracts:* Developers can interact with deployed contracts, execute functions, and view contract state using Remix's user-friendly interface. - **Code Analysis and Compilation:** - - *Static Analysis:* Remix performs static analysis on smart contract code, highlighting potential issues and vulnerabilities before deployment. - - *Compilation:* The IDE compiles Solidity code into bytecode, which is necessary for deploying contracts to the blockchain. + - *Static Analysis:* Remix performs static analysis on smart contract code, highlighting potential issues and vulnerabilities before deployment. + - *Compilation:* The IDE compiles Solidity code into bytecode, which is necessary for deploying contracts to the blockchain. - **Debugging:** - - *Debugging Tools:* Remix provides debugging tools to help developers identify and fix issues in their smart contracts. This includes breakpoints, step-by-step execution, and variable inspection. + - *Debugging Tools:* Remix provides debugging tools to help developers identify and fix issues in their smart contracts. This includes breakpoints, step-by-step execution, and variable inspection. - **Testing:** - - *Unit Testing:* Developers can create and run unit tests for their smart contracts using Remix, ensuring that the code functions as expected. + - *Unit Testing:* Developers can create and run unit tests for their smart contracts using Remix, ensuring that the code functions as expected. Open the Remix IDE in your web browser. @@ -218,14 +218,14 @@ Our MetaMask wallet is now set up to deploy and interact with the contracts on E Since the default network for Remix IDE is a local Ethereum testnet, we must configure Remix IDE to deploy the contract on Evmos testnet. To do this: -- Switch to the "Deploy & Run Transactions" tab. -- Set Environment to Injected Provider - MetaMask +- Switch to the "Deploy & Run Transactions" tab. +- Set Environment to Injected Provider - MetaMask ![Provider](/img/articles/Tutorial-7.png) At this point, you might observe MetaMask popping up to select accounts to connect with Remix IDE. Choose the accounts you wish to use and click on connect. -Select an account you wish to use to deploy the contract from the “ACCOUNT” tab above, and click the "Deploy" button. +Select an account you wish to use to deploy the contract from the “ACCOUNT” tab above, and click the "Deploy" button. You will observe another MetaMask popup to review the transaction and submit it. Click on ‘Confirm’ to deploy the contract. @@ -243,9 +243,9 @@ Additionally, you can also observe and interact with the contract in Remix IDE: Now that the contract is deployed, you can interact with it: -- Use the addContractValue function to add funds to the contract. -- Use the setSalary function to set salaries for employees. -- Use the paySalary function to withdraw your salary. +- Use the addContractValue function to add funds to the contract. +- Use the setSalary function to set salaries for employees. +- Use the paySalary function to withdraw your salary. Each of these functions require you to confirm MetaMask transactions before they are executed. It is important to confirm the transaction metadata before approving the transaction. @@ -254,9 +254,3 @@ Each of these functions require you to confirm MetaMask transactions before they Congratulations! You've successfully created a simple payroll smart contract. This is a basic example, and real-world payroll systems would require additional features and security considerations. Feel free to explore more advanced features and integrate this contract into a larger decentralized application (dApp). Happy coding! - - - - - - diff --git a/docs/articles/governance/index.md b/docs/articles/governance/index.md index a5d045d..854bc1e 100644 --- a/docs/articles/governance/index.md +++ b/docs/articles/governance/index.md @@ -21,9 +21,11 @@ text proposals, changing [chain parameters](./chain-parameters), and spending [funds from the community pool](./community-pool). ## On- and off-chain Governance Structure + :::tip **Note:** Working on a governance proposal? Make sure to look at the [best practices](./best-practices). ::: + ### Communication Methods Governance practices and decisions are communicated through different types of documents and design artifacts: @@ -51,4 +53,4 @@ involvement from members in the extended community occurs organically. - **[Telegram (@EvmosOrg)](https://t.me/EvmosOrg)** - General Evmos Telegram group - **[Twitter (@EvmosOrg)](https://twitter.com/EvmosOrg)** - - Official Evmos Twitter \ No newline at end of file + - Official Evmos Twitter diff --git a/docs/articles/governance/voting.md b/docs/articles/governance/voting.md index a75b71c..64dc8f2 100644 --- a/docs/articles/governance/voting.md +++ b/docs/articles/governance/voting.md @@ -40,4 +40,4 @@ Though a simple majority `Yes` vote (ie. 50% of participating voting power) is r ### How is quorum determined? -Voting power, whether backing a vote of `Yes`, `Abstain`, `No`, or `NoWithVeto`, counts toward quorum. Quorum is required for the outcome of a governance proposal vote to be considered valid and for deposit contributors to recover their deposit amounts. If the proposal vote does not reach quorum (ie. less than 33.4% of the network's voting power is participating) within 5 days, any deposit amounts will be burned and the proposal outcome will not be considered to be valid. \ No newline at end of file +Voting power, whether backing a vote of `Yes`, `Abstain`, `No`, or `NoWithVeto`, counts toward quorum. Quorum is required for the outcome of a governance proposal vote to be considered valid and for deposit contributors to recover their deposit amounts. If the proposal vote does not reach quorum (ie. less than 33.4% of the network's voting power is participating) within 5 days, any deposit amounts will be burned and the proposal outcome will not be considered to be valid. diff --git a/docs/videos/connect_to_metamask.md b/docs/videos/connect_to_metamask.md index ae78f15..62e4f98 100644 --- a/docs/videos/connect_to_metamask.md +++ b/docs/videos/connect_to_metamask.md @@ -6,8 +6,8 @@ This video is created as part of EvmosNation grant project (organized by Encode In this video, we will learn the following: -- Creating a React app -- Integrating Web3.js library to the React app -- Using Web3.js library to connect to Metamask wallet -- Load addresses from Metamask wallet -- Switch accounts in Metamask wallet \ No newline at end of file +- Creating a React app +- Integrating Web3.js library to the React app +- Using Web3.js library to connect to Metamask wallet +- Load addresses from Metamask wallet +- Switch accounts in Metamask wallet