search

Задание по предмету Математические методы систем распределенного реестра

visibility117
schedule1 месяц назад
sellERC20, Solidity, Web3, тестирование токенов, blockchain
categoryПрограммирование и разработка

2 000 ₽ за проект

descriptionОписание

Нужно реализовать и задеплоить ERC-20 токен на Solidity, написать тесты на перевод токенов между тремя адресами, и замерить расход газа для транзакций с помощью Web3 (включая скрипт или ноутбук). Необходимо выполнить задание ниже, соблюдая все указанные критерии: Pre-Requisites / Recommended Reads Before you begin, review the following: Ethers.js v6 Migration Guide — BigInt Handling A short .gitignore tutorial (to exclude node_modules, .env, etc.) ⚠️ Do not use the old Math or SafeMath library in Solidity (it’s outdated). Solidity v0.8+ already includes overflow protection. Any framework that you are comfortable with. Although Hardhat 3 is out, in class we covered Hardhat version 2. Task 1: (1 point) Deploy the ERC20 token smart contract with any reasonable parameters (like name, symbol) and allocate (mint) assets to it. (1 point) Write a test script to Declare three addresses: Sender, Receiver_1 and Receiver_2. Note: The sender is also a contract deployer. Send some tokens to the Receiver_1 and check the expected balances. For example, if the Sender mints 100 tokens and sends 20 to the receiver, check that the receiver has 20 and the sender has 80. Repeat step 2.b, but this time the receiver is Receiver_2. (2 points) Compute gas consumption per transaction from 1.1 and 1.2 with scripts. Check if all the transactions are successful (blockchain applied changes from the transaction) with scripts. Only Web3 is recommended. (Savefile using experiment.ipynb) Task 2: (3 points) Write a smart contract to compute the ITMO course final grade. I.e., The contract deployer is the professor. The professor can input values to a mapping "assign grades" to students based on the following assumptions: Each student has a wallet address. The professor has a list of this wallet address. (assume in an Excel file off-chain) Grades are assigned as follows: address student_id => uint grades[8], where grades[8] are HA1, ..., HA6, ExamTerm1, ExamFinal. The professor can call a method "compute final grade," which computes a mapping: address student_id => uint final_grade, based on the MMDLS course formula: Intermediate=min(round((max(HA1 +HA2, 2 * ExamTerm1) + HA3 + HA4 + HA5 + HA6) / 6),10) If ExamFinal > 0: final_grade = min(round(0.4 * Intermediate + 0.6 * ExamFinal), 10), Else: final_grade = Intermediate * I(Intermediate >= 6), where I(true) = 1 and I(false) = 0. (3 points) Write at least 5 unique test cases for your deployed ERC20 token contract using the Hardhat framework. Tests must not be repetitive, use different logical scenarios. Use your creativity; similar cases will be counted as one. Submission rules Submit using file name: lastname_firstname.zip lastname_firstname.zip ├── Task1 │ ├── contracts │ │ └── <required files> │ ├── test │ │ └── <required files> │ ├── hardhat.congif.js │ ├── experiment.ipynb │ └── package.json └── Task2 ├── contracts │ └── <required files> ├── test │ └── <required files> ├── hardhat.congif.js └── package.json