All development related with the ONLYONE token.

Comments
  • Buy Tokens on Pancake Swap

    Buy Tokens on Pancake Swap

    Hi

    I'm using your code for 1 month but today it's not working and I don't know why. Whenever I try to buy with code transactions fail with 'INSUFFICIENT_INPUT_AMOUNT'. Could you look at this problem? Thanks.

    opened by cem-altuner 10
  • [SELL_TOKEN] Should using swapExactTokensForETH to sell token?

    [SELL_TOKEN] Should using swapExactTokensForETH to sell token?

    Hi @religion-counter, I am using function "swapExactTokensForETHSupportingFeeOnTransferTokens" to sell token following your example: https://github.com/religion-counter/onlyone/blob/main/helper-scripts/sell-onlyone-pancakeswap.js#L76. --> I found out 2 issues:

    1. Some token can't swap: example: 0x3e900195b93423b8e7bddd63d1d51c02fd18ccdf. I have changed using swapExactTokensForETH replace swapExactTokensForETHSupportingFeeOnTransferTokens, sell success.
    2. I have read the document and found out that: using swapExactTokensForETH better "Identical to swapExactTokensForETH, but succeeds for tokens that take a fee on transfer." image --> Please give me your opinion about the pros and cons of functions:
    • swapExactTokensForETHSupportingFeeOnTransferTokens
    • swapExactTokensForETH
    opened by thanglv-1330 5
  • Approve the transaction when sell token

    Approve the transaction when sell token

    Hi @religion-counter, I have a question about the source code in "sell-onlyone-pancakeswap.js" file:

    What approves the transaction when sell the token? Is it necessary or not? I have commented code about Approve ONLYONE spend from line 50 - 67. I have still sell the token. Can you explain it , please? https://github.com/religion-counter/onlyone/blob/c402ad334bdcc38827f42a5de707e0dea7bd8bd7/helper-scripts/sell-onlyone-pancakeswap.js#L50

    opened by thanglv1302 4
  • How to raise slippage

    How to raise slippage

    image Hi @religion-counter , I have built and buy the success token following: https://github.com/religion-counter/onlyone/blob/main/helper-scripts/buy-onlyone-pancakeswap.js But, I wanna raise slippage. You know, many tokens have slippage very high. Please give me your opinion. Thanks.

    opened by thanglv1302 4
  • How to get Amount a token in my wallet metamask (BSC)

    How to get Amount a token in my wallet metamask (BSC)

    Hi @religion-counter, I have an issue that needs suggestions from you: How to get Amount a token in my wallet metamask (BSC)? Please give me your opinion. Thanks

    opened by thanglv-1330 3
  • Error: Returned error: insufficient funds for gas * price + value

    Error: Returned error: insufficient funds for gas * price + value

    Hi, first of all thanks a lot for this content, it's hard to find this kind of code to let us know how things work under the hood.
    I'm trying to buy a token (RUSD) with BUSD. The fact is i'm always getting that i have not enough funds on my wallet, even if i have enough BNB (0.5) to pay the transaction fee.

    I'm using your code, just changed a few things for my needs:

    var fs = require('fs')
    var Tx = require('ethereumjs-tx').Transaction;
    var Web3 = require('web3')
    var Common = require('ethereumjs-common').default;
    
    var web3 = new Web3(new Web3.providers.HttpProvider('https://bsc-dataseed.binance.org/'))
    var BSC_FORK = Common.forCustomChain(
        'mainnet',
        {
            name: 'Binance Smart Chain Mainnet',
            networkId: 56,
            chainId: 56,
            url: 'https://bsc-dataseed.binance.org/'
        },
        'istanbul',
    );
    
    // Amount to buy
    const execSync = require('child_process').execSync;
    const originalAmountToBuyWith = execSync('node getTokensBalance.js busd', { encoding: 'utf-8' }).replace(/\s+/g, ' ').trim();
    
    var busdAmount = web3.utils.toWei(originalAmountToBuyWith, 'ether');
    
    var config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
    
    console.log(`Buying RUSD for ${originalAmountToBuyWith} BUSD from pancakeswap for address ${config.walletAddress}`);
    
    var res = buyRUSD(config.walletAddress, busdAmount);
    console.log(res);
    
    async function buyRUSD(walletAddress, amount) {
    
        var amountToBuyWith = web3.utils.toHex(amount);
        var privateKey = Buffer.from(config.privateKey, 'hex')  ;
    
        var amountOutMin = '100' + Math.random().toString().slice(2,6);
    
        var routerAbi = JSON.parse(fs.readFileSync('pancake-router-abi.json', 'utf-8'));
        var contract = new web3.eth.Contract(routerAbi, config.pancakeSwapRouterAddress, {from: walletAddress});
        var data = contract.methods.swapExactETHForTokens(
            web3.utils.toHex(amountOutMin),
            [config.busdAddress,
             config.rusdAddress],
            walletAddress,
            web3.utils.toHex(Math.round(Date.now()/1000)+60*20),
        );
    
        var count = await web3.eth.getTransactionCount(walletAddress);
    
        var rawTransaction = {
            "from":walletAddress,
            "gasPrice": web3.utils.toHex(web3.utils.toWei('5', 'gwei')),
            "gasLimit": 100000,
            "to":config.pancakeSwapRouterAddress,
            "value":web3.utils.toHex(amountToBuyWith),
            "data":data.encodeABI(),
            "nonce":web3.utils.toHex(count)
        };
    
        var transaction = new Tx(rawTransaction, { 'common': BSC_FORK });
        transaction.sign(privateKey);
    
        var result = await web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'));
        return result;
    }
    

    I always get (node:327974) UnhandledPromiseRejectionWarning: Error: Returned error: insufficient funds for gas * price + value. I'm using my metamask wallet, i'm sure the wallet address is good, also the privatekey associated.

    Another point, how are you sure you won't spend too much transaction fees if there is some congestion ? gasLimit i suppose.

    Thanks again mate if you have any idea! Gabriel.

    opened by phackt 3
  • transaction underpriced

    transaction underpriced

    When I buy ONLYONE I get (node: 75260) UnhandledPromiseRejectionWarning: Error: Returned error: transaction underpriced, what could be wrong? The code is exactly like yours.

    https://github.com/religion-counter/onlyone/blob/main/helper-scripts/buy-onlyone-pancakeswap.js

    opened by microooji 1
  • About Sell

    About Sell

    Hi bro,

    I fixed all my mistakes for buying a token but, can't sell 🤒

    Could you help ?

    Failed Transaction

    // Sells ONLYONE for BNB from pancakeswap for address ${targetAccounts[targetIndex].address}
    
    var fs = require('fs')
    var Tx = require('ethereumjs-tx').Transaction;
    var Web3 = require('web3')
    var Common = require('ethereumjs-common').default;
    
    var web3 = new Web3(new Web3.providers.HttpProvider('https://bsc-dataseed.binance.org/'))
    var BSC_FORK = Common.forCustomChain(
        'mainnet',
        {
            name: 'Binance Smart Chain Mainnet',
            networkId: 56,
            chainId: 56,
            url: 'https://bsc-dataseed.binance.org/'
        },
        'istanbul',
    );
    
    
    let rawData = fs.readFileSync('data.json');
    let progData = JSON.parse(rawData);
    
    sellMulty();
    
    async function sellMulty() {
        var onyloneAmount = 1;
        var res = sellOnlyone(progData.mainAccount, onyloneAmount*1e18)
        .catch(e => {
            console.error("Error in sell:", e);
            process.exit(1);
        });
        console.log(res);
        
    }
    
    async function sellOnlyone(targetAccount, amount) {
    
        var amountToSell = web3.utils.toHex(amount);
        var privateKeyBuffer =  progData.privateKey;
        var privateKey = Buffer.from(privateKeyBuffer,'hex');
        var abiArray = JSON.parse(JSON.parse(fs.readFileSync('onlyone-abi.json','utf-8')));
    
        var tokenAddress = '0x370AbbD30774E52C47C596807a288cec48f42319'; // CAKEWHALE contract address
        var WBNBAddress = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'; // WBNB token address
        var pancakeSwapRouterAddress = '0x10ed43c718714eb63d5aa57b78b54704e256024e';
    
        // Approve ONLYONE spend
        var onlyoneContract = new web3.eth.Contract(abiArray, tokenAddress, {from: targetAccount});
        var approveOnlyoneSpendData = onlyoneContract.methods.approve(pancakeSwapRouterAddress, web3.utils.toWei('1', 'ether'));
        var count = await web3.eth.getTransactionCount(targetAccount);
        var rawTransactionApprove = {
            "from":targetAccount,
            "gasPrice":web3.utils.toHex(5000000000),
            "gasLimit":web3.utils.toHex(210000),
            "to":tokenAddress,
            "value":"0x0",
            "data":approveOnlyoneSpendData.encodeABI(),
            "nonce":web3.utils.toHex(count)
        };
        var transactionApprove = new Tx(rawTransactionApprove, {'common':BSC_FORK});
        transactionApprove.sign(privateKey)
    
        var resultApprove = await web3.eth.sendSignedTransaction('0x' + transactionApprove.serialize().toString('hex'));
        console.log("Approved" + resultApprove);
    
        // var onlyOneWbnbCakePairAddress = '0xd22fa770dad9520924217b51bf7433c4a26067c2';
        // var pairAbi = JSON.parse(fs.readFileSync('cake-pair-onlyone-bnb-abi.json', 'utf-8'));
        // var pairContract = new web3.eth.Contract(pairAbi, onlyOneWbnbCakePairAddress/*, {from: targetAccount.address}*/);
        var amountOutMin = web3.utils.toHex(1); // 540BNB is the price of one onlyone
    
        var routerAbi = JSON.parse(fs.readFileSync('pancake-router-abi.json', 'utf-8'));
        var contract = new web3.eth.Contract(routerAbi, pancakeSwapRouterAddress, {from: targetAccount});
        var data = contract.methods.swapExactTokensForETHSupportingFeeOnTransferTokens(
            amountToSell,
            amountOutMin,
            [tokenAddress,
            //  '0xe9e7cea3dedca5984780bafc599bd69add087d56' /* BUSD address */, // Add this if you want to go through the onlyone-busd pair
             WBNBAddress],
            targetAccount,
            web3.utils.toHex(Math.round(Date.now()/1000)+60*20),
        );
    
        count = await web3.eth.getTransactionCount(targetAccount);
        var rawTransaction = {
            "from":targetAccount,
            "gasPrice":web3.utils.toHex(5000000000),
            "gasLimit":web3.utils.toHex(460000),
            "to":pancakeSwapRouterAddress,
            "value":web3.utils.toHex(0),
            "data":data.encodeABI(),
            "nonce":web3.utils.toHex(count)
        };
    
        var transaction = new Tx(rawTransaction, { 'common': BSC_FORK });
        transaction.sign(privateKey);
    
        var result = await web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'));
        console.log(result)
        return result;
    }
    
    function sleep(ms) {
        return new Promise((resolve) => {
            setTimeout(resolve, ms);
        });
    } 
    
    opened by cem-altuner 1
  • TypeError: Cannot read properties of undefined (reading 'address')

    TypeError: Cannot read properties of undefined (reading 'address')

    Hello hope you are good ?

    i run npm install

    i creat a files .json like this : [{"address":"0x551c1F831533/////55FB6fa3ef86","privateKey":"a7fda8be82590279/////////412a96e8c85"}]

    i run node buy-onlyone-pancakeswap.js and get this error : console.log(Buying ONLYONE for ${originalAmountToBuyWith} BNB from pancakeswap for address ${targetAccount.address}); ^ TypeError: Cannot read properties of undefined (reading 'address')

    opened by MichaelJacksonCoin 3
  • issues with signing the transaction with private key

    issues with signing the transaction with private key

    helloo, I hope you are all well. first thank you for the example, I am learning a ton from reading and adapting the code.

    I cannot however get a basic buy to work.

    Error: Private key must be 32 bytes in length. (tx type=0 hash=not available (unsigned) nonce=12 value=125141000000000 signed=false hf=istanbul gasPrice=5000000000)
    

    I get the error above. Do you think this is an issue with my address and private key? I have copied the adress and private key from my bsc wallet, I even tried changing the private key to hex.

    any help would be appreciated thanks (:

    opened by putintin420 3
  • Path in swap functions

    Path in swap functions

    Hi, hope you're well. It's quite hard to find relevant information when we are developing our own code so i try here hoping it may help other people.

    I'm looking about getting the best price (meaning having the best 'path') before calling my swap function (ex swapExactTokensForXXX). So here the third parameter is the raw path provided but if you're using pancakeswap for ex, you'll see that before swapping it will be able to find for you the best route / path in order to provide you the best price. For ex instead of stupidly working with the pool token1/token2, it will propose a best price with the route token1/tokenX/token2, using different liquidity pools.

    So my question is; do you have any clue about how to find the best route when dealing with these contracts ?

    Thanks a lot, Cheers.

    [edit] Interesting links:
    https://github.com/uniswap-integration/simple-uniswap-sdk#uniswap-pair-factory

    opened by cryptofomo1 3
  • Selling Tokens on PancakeSwap

    Selling Tokens on PancakeSwap

    Hey, I tried your examples for buying tokens on PancakeSwap. Everything works fine. Now Im trying to sell tokens and I cant get it to work. Could you maybe make an example for that too, or give me some tips? Thanks!

    opened by freshmeat87 29
Owner
Onlyone Finance
I am the main developer in the Onlyone Finance project
Onlyone Finance
This repo contains all the materials for placement as well as Practical lab codes for all subjects and notes. For students graduating in 2023

UEMK_PLACEMENT_2023 This repo contains all the materials for placement as well as Practical lab codes for all subjects and notes. For students graduat

Shambashib Majumdar 8 Mar 5, 2022
Tuya 37 Dec 26, 2022
Shitty, yet simple way to get someone's token right at their discord client's startup.

discord-token-stealer Shitty, yet simple discord injector to add a little spice to their discord client Disclaimer: This is for educational purposes o

Gavin 3 Sep 26, 2022
Mc-msa-token-getter - Scripts to retrieve MC authentication tokens for use in modding dev envs.

Minecraft MSA Token Getter Python and Java scripts to retrieve MC authentication tokens for use in modding dev envs. Requires a properly configured Az

Ryan 1 Jan 3, 2022
An extension for Keycloak, that enables web-based sign in with Apple and token exchange

Apple Identity Provider for Keycloak ?? This repository represents an extension for Keycloak, which enables Sign in with Apple for web-based applicati

Klaus Betz 58 Dec 29, 2022
JSON Web Token implementation for Java according to RFC 7519. Easily create, parse and validate JSON Web Tokens using a fluent API.

JWT-Java JSON Web Token library for Java according to RFC 7519. Table of Contents What are JSON Web Tokens? Header Payload Signature Features Supporte

Bastiaan Jansen 6 Jul 10, 2022
Integrates with XRPLedger to send token payment to trustline addresses

strategyengine token distribution rest service This service also runs here -- https://fsedistributionservice-56gpv2b23a-uc.a.run.app/ #How to run loca

strategyengine 8 Dec 14, 2022
Scan and patch tool for CVE-2021-44228 and related log4j concerns.

A Log4J2 CVE-2021-44228 Vulnerability Scanner and Patcher Links to download the latest version: Linux x64 with glibc2.17+ (RHEL7+) Windows & all other

SAS Software 33 Jun 1, 2022
QuickPerf is a testing library for Java to quickly evaluate and improve some performance-related properties

QuickPerf is a testing library for Java to quickly evaluate and improve some performance-related properties quickperf.io ?? Documentation Annotations

null 365 Dec 15, 2022
This repository is related to the Java Web Developer (ND035), Course - Web Services and APIs

About this Repository This repository is related to the Java Web Developer (ND035), Course - Web Services and APIs It contains the following folders:

Rasha Omran 1 Jan 28, 2022
Java related projects and also a begginer level projects

Java related projects and also a begginer level projects

Akshit Sijwali 3 Dec 15, 2022
This repository contains Java programs to become zero to hero in Java. Programs related to each and every concep are present from easy to intermidiate level.

Learn Java Programming In this repository you will find topic wise programs of java from basics to intermediate. This follows topic wise approach that

Sahil Batra 15 Oct 9, 2022
Integrated related support for Spring Boot projects

Table of Contents xyz-support 介绍 引入 当前引用Spring Boot版本 当前引用外部依赖的版本 当前已支持的服务 文件(对象存储)服务 文档服务 手册 文件(对象存储)服务 配置 使用例子 api介绍 文档服务 excel服务 配置 使用例子 api介绍 xyz-

xiaoyezi 3 Oct 20, 2021
📊It includes all the work done during the Java-React Bootcamp.

?? Java + React Bootcamp ?? Part 1 - Java Part 2 - React ?? Lecture Class: Youtube ?? Instructor: Engin Demirog ?? Course Materials: Kodlama.io Bootca

İlknur Sucaklı 20 Jun 21, 2022
Jornada Big Tech: I will have 3 months to study and prepare myself for the Big Tech interviews. Repository containing all my study material.

Jornada Big Tech (Big Tech Journey) Jornada Big Tech: I will have 3 months to study and prepare myself for the Big Tech interviews. Repository contain

Camila Maia 87 Dec 8, 2022
All I know about Spring as a Spring Boot app

All about Spring This repository contains all the knowledge I have and all the things I can do with Spring You can download v1.0.0 java-doc here In th

Soroush Mehrad 12 Jul 16, 2022
Mint 0.1.1 public release, HWID System removed. Feel free to use. (Note: for all of u thinking its ratted; its not.)

Mint By: zPrestige_ | ! zPrestige_#1514 | git Kambing | dragonhacker32_#3091 | git FB | FB#7334 | git ZenovJB | Zenov#0603 | git Support no support No

null 17 Dec 2, 2022
trace all binder-funcion calls on android-platform

BinderHackDemo trace all binder-funcion calls on android-platform 该demo展示了如何使用libbinderhack.so模块,trace-app自身进程binder调用情况 您可以通过该次提交,查看如何使用libbinderhack

null 4 Dec 25, 2021
All the Android-Java Projects in Single Repository

Android Java Projects List of Projects Factorial Calculator Multiplication Table Web App Steps to Run the Applications Clone this Repository Create a

Rajan Gautam 2 Oct 10, 2022