Code Monkey home page Code Monkey logo

Comments (4)

Chi-AnTai avatar Chi-AnTai commented on July 3, 2024

Hi, @rmeissner
I am also facing this problem, do you have any solution or advise on this ?

from safe-smart-account.

rmeissner avatar rmeissner commented on July 3, 2024

Will not be fixed: #197

from safe-smart-account.

mmv08 avatar mmv08 commented on July 3, 2024

I had a weird brainfart and struggled to understand the example calculations, so I'll leave some details for a future reference:

  1. The gas price in a token is calculated as gwei_price * 1_eth_to_token_ratio
  2. In the example 1_eth_to_token_ratio would be 100, 1 ETH = 100 LOVE
  3. The result is 5 * 10^11

My biggest problem was understanding where 1e12 came from. If we use uniswap, then the price 1_eth_to_token_ratio would be calculated as:
price = love_reserves / eth_reserves
where love_reserves and eth_reserves are in their smallest denomination; therefore, if we want to get to their largest denomination, every reserve has to be divided by 10 ^ token_decimals, so we get 10 ^ 6 / 10 ^ 18, which turns into 10 ^ -12.

The example calculation is in the largest denomination, so to get to the smallest, we need to multiply it by 10 ^ -12 which is the same as dividing by 10 ^ 12

from safe-smart-account.

livingrockrises avatar livingrockrises commented on July 3, 2024

if you send tokenGasPrice multiplied by a factor say 1e18 and update handlePayment to divide by this fixed number then it solves the problem.
we tried to keep variable tokenGasPriceFactor but fixed high value also makes sense.

from safe-smart-account.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.