diff --git a/tx_kasma/README.md b/tx_kasma/README.md deleted file mode 100644 index 186940a..0000000 --- a/tx_kasma/README.md +++ /dev/null @@ -1,76 +0,0 @@ -

Contract Deployment

- -> UYARI : [Remix](https://remix.ethereum.org/) üzerinden bir dosya oluştur. Aşağıdaki kodu ekle. -> İlk önce compile et sonra Metamask kullanarak deploy et -> Aşağıdaki bölümden kontrat adresini not et. - -``` -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.4; - -contract SimpleStorage { - uint storedData; - - function set() public { - storedData = storedData + 1; - } - - function get() public view returns (uint) { - return storedData; - } -} -``` - -

Node.js ve npm kurulumu yapma

- -> Npm ve node.js kurulumunu yapalım - -``` -# komutları sırasıyla girelim: -curl -sL https://deb.nodesource.com/setup_20.x -o /tmp/nodesource_setup.sh -sudo bash /tmp/nodesource_setup.sh -sudo apt install nodejs - -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash -source ~/.bashrc -nvm install v20.10.0 -nvm use v20.10.0 -npm install -g npm@latest - -``` - - -> Daha sonra burada yeni bir klasör oluştur. npm ile proje oluştur. hepsini enter ile geçebilirsin. - -``` -mkdir bot -cd bot -npm init - -``` - -> index.js dosyasını oluştur. Bu repodaki index.js klasorunu düzelterek yapıştır. - -``` - -nano index.js - -``` - -> Aynısını package.json için yap - -``` - -nano package.json - -``` - -> En son aşağıdakileri çalıştıralım - -``` -npm install -node index.js - -``` - -> Herşey doğru ise Stored Data sürekli aratacak. diff --git a/tx_kasma/index.js b/tx_kasma/index.js deleted file mode 100644 index 391b81f..0000000 --- a/tx_kasma/index.js +++ /dev/null @@ -1,71 +0,0 @@ -const { ethers } = require("ethers"); -const contractABI = [ - { - inputs: [], - name: "set", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "get", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - constant: true, - }, -]; - -const contractAddress = "KONTRAT_ADRESS"; - -const bekle = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); - -async function get() { - const provider = new ethers.providers.JsonRpcProvider("RPC"); - - const private = "PRIVATE_KEY"; - - //for sending from account 0 - - let senderAccount = new ethers.Wallet(private); - let walletsigner = await senderAccount.connect(provider); - const contract = new ethers.Contract( - contractAddress, - contractABI, - walletsigner - ); - - console.log(`${senderAccount.address} is ready. Please wait`); - let bnonce = 0; - while (true) { - const nonce = await provider.getTransactionCount(senderAccount.address); - console.log(`**************Önceki nonce: ${bnonce} şu an ${nonce}`); - let gasPrice = await provider.getGasPrice(); - console.log(`gas: ${gasPrice}`); - try { - const transaction = await contract.set({ - from: walletsigner.account, - }); - - await transaction.wait(); - - console.log(`Transaction completed: ${transaction}`); - bnonce = nonce; - let storedData = await contract.get(); - console.log(`Stored Data: ${storedData}`); - } catch (error) { - console.log(`HATA: ${error}`); - } - - await bekle(1000); - } -} - -get(); diff --git a/tx_kasma/package.json b/tx_kasma/package.json deleted file mode 100644 index a705c71..0000000 --- a/tx_kasma/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "bot", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "ethers": "^5.7.2" - } - } - \ No newline at end of file