Git Product home page Git Product logo

bscvaluedefi-exploit's Introduction

bscValueDefi-Exploit

Abusing delayed share calculations on 4000% APR staking (8 quintillion APY) on ValueDeFi Binance Smart Chain.

Example

BSCVALUEDEFI2X

Overview

  • vFarm: Emission + Swap.
  • vSafe: AutoCompounding using vFarm.
  • earn(): Compound and recalculate share price.

earn() can be called by anyone and costs approximately 2$ in gas fees. Only upon earn() are share values calculated, but the underlying assets are growing each block. By remaining in vFarm just before earn() more than doubles the APY that can be had.

Usage

  1. Encrypt/Obfuscate keys
    • Default: $ python utils.py <base64-target>
    • Encrypt with AES for VPS.
  2. Configure config.json
  3. Start with $ python earn.py
  4. Profit.

Calculations

  • The bearnfi strategy usually harvests strategy every 600 blocks unless user-called.
  • Users call varies from time to time (check $ python scout.py).

Hence we estimate the block that earn() will be called, and park our assets in vFarm just in time. In practice the gas fees are so low that depending on capital and APR the fees will be recouped within a few blocks.

Structure

  • earn.py - The algorithm.
  • scout.py - Trimmed artifact of big-brain block prediction.
  • utils.py - Utilites for encryption and profit calculations.
  • .\bsc - Scripts for interacting with the EVM eg. deposit, withdraw...

Config

# VARIABLE     # TYPE (DEFAULT) : <DESCRIPTION>. 
------------------------------------------------------------------------
MYADDRESS      # STR  (None)    : Base64 encoded Public eth/bsc address.
SECRETKEY      # STR  (None)    : Base64 encoded Private eth/bsc key.
APIKEY         # STR  (None)    : Base64 encoded BscScan.com API key.
RISK           # FL   (1.05)    : Risk profile of missing user-called earn().
SAFEBASELINE   # UINT (1e18)    : Initial assets - deflationary.
FARMBASELINE   # UINT (1e18)    : Initial assets - inflationary.
GASTHRESHOLD   # UINT (3e15)    : Before swapping/harboring in vSafe.
MINTX          # UINT (1e5)     : Minimum transaction amount.
BUFFER         # UINT (160)     : Minimum earn() block distance.
AUTOCOMPLIM    # UINT (1e14)    : Not implemented.
AUTOCOMPOUND   # Bool (false)   : Not implemented.
VERBOSE        # Bool (true)    : Verbosity of prints.
ALARM          # Bool (false)   : Artifact. 4 second alarm at script termination. (IFTTT)
DEBUG          # Bool (false)   : Extra verbosity.
MAKER          # Bool (true)    : Force earn based on estBlock().

Considerations

Risk

It is advisable to lower the RISK if MAKER is false.

Baseline

The value in vSafe (SAFEBASELINE) is easily inferred from the amount of vSafe tokens, the same is not true for the amount of LP-Tokens within vFarm.

Hence we have the following:

  • Undershoot SAFEBASELINE as it deflates upon earn() misses.
  • Do not start earn.py with assets in vFarm unless correct value for FARMBASELINE in config.

References

Change History

v1.0: Force earn() now 98% time in vFarm.

v0.3: Polynomial earn() block prediction with sin/cos cyclical input.

bscvaluedefi-exploit's People

Contributors

wp-lkl avatar

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.