Code Monkey home page Code Monkey logo

depeg-contracts's People

Contributors

christoph2806 avatar doerfli avatar matthiaszimmermann avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ideasincrypto

depeg-contracts's Issues

Payout is send to policy holder not protected wallet

  1. created policy for another wallet (policy holder != protected wallet)
  2. force product into depeg
  3. create claim for full amount from protected wallet
  4. process policies
  5. balance of protected wallet is unchanged, but policy is closed, claim is closed and payout is paidout
>>> instSrv.getClaim('0x44668814f7c4d7fd37a1aa2687904cbdf5fcc63e7849b8e639cc3bd94cb0f559', 0)
(3, 50000000, 50000000, 0x0000000000000000000000000000000000000000000000000000000005e69ec00000000000000000000000000000000000000000000000000000000063eba036, 1676386518, 1676386530)
>>> instSrv.getPayout('0x44668814f7c4d7fd37a1aa2687904cbdf5fcc63e7849b8e639cc3bd94cb0f559', 0);
(0, 1, 50000000, 0x, 1676386530, 1676386530)
>>> instSrv.getPolicy('0x44668814f7c4d7fd37a1aa2687904cbdf5fcc63e7849b8e639cc3bd94cb0f559')
(2, 9588888, 9588888, 1, 0, 5000000000, 50000000, 1676386258, 1676386530)
>>> usd2.balanceOf('0xA3C552FA4756dd343394785283923bE2f27f8814')
0

[Bug]: Apply for policy creates policy on bundle without checking stakes

What happened?

  • create some bundles and stake DIPs on them
  • create one bundle with very low apr and wide min/max range (should cover most of the above bundles)
  • call applyForNewPolicy for one of the staked bundles but the values would also match with the latest (unstaked bundle)

-> policy was added to the unstaked bundle

What operating system are you seeing the problem on?

Mac OS

What browsers are you seeing the problem on?

Firefox

What wallet extension are you using?

Metamask

Rules

  • I agree to follow this project's rules

[Bug]: It is possible to accumulate DIP rewards after the risk bundle was closed, USDT unstaked/bundle burned

What happened?

  1. Create risk bundle.
    https://mumbai.polygonscan.com/tx/0x57f5644041c729d1e4f6545ef35f70caa0af4a8c899b7917475dfa7495f3994f
  2. Stake USDT.
    https://mumbai.polygonscan.com/tx/0x3f28af18f6c36c7bb49071e0752bb408bfc300b010cfa0cd07895db64c3a4b0a
  3. Stake DIP.
    https://mumbai.polygonscan.com/tx/0xe347e7df1b74cd56b16e630f46354fd7c07289e1bb9f72f48ea325490fe27068
  4. Close risk bundle.
    https://mumbai.polygonscan.com/tx/0xe036accb534950b2fd4d604a74e11c58fe59d24575356e9425e50f74aead4cd6
    See "Accumulated Rewards" continue to increase
  5. Burn risk bundle
    https://mumbai.polygonscan.com/tx/0x6ea593abfaa8f34aacd7d9f851a0c9bc21d3a9efd86d5751c24e85db30bcd4c4
    See "Accumulated Rewards" continue to increase
  6. Unstake DIP & claim rewards
    https://mumbai.polygonscan.com/tx/0x776c248b194b5fe286b22ddd706441431d353b70552297f362758cd6cca7c073

Risk bundle created at 03:38:47 PM
Risk bundle closed at 03:51:37 PM, ~770 sec passed since creation -> ~2.75 DIP as rewards
Risk bundle burned at 03:52:59 PM, ~ 852 sec passed since creation -> ~3.04 DIP as rewards
DIP rewards claimed at 04:59:31 PM, ~4844 sec passed since creation -> ~17.28 DIP as rewards
~15.86 DIP as rewards obtained

What operating system are you seeing the problem on?

Mac OS

What browsers are you seeing the problem on?

Safari

What wallet extension are you using?

Metamask

Rules

  • I agree to follow this project's rules

fix github workflow for testing

.env file missing to run tests. one option would be to add an empty .env file in gif-contracts.

tests/conftest.py:99:


substring = 'gif-contracts'

def get_package(substring: str):
    for dependency in config[CONFIG_DEPENDENCIES]:
        if substring in dependency:
            print("using package '{}' for '{}'".format(
                dependency,
                substring))
          return project.load(dependency, raise_if_loaded=False)

E ValueError: Dotenv specified in config but not found at path: /home/runner/.brownie/packages/etherisc/gif-contracts@0a64b7e/.env

Use latest ganache version

currently its fixed to 7.6.0 due to an issue in 7.7.0.
When version > 7.7.0 is released, try its it works again.

Closing a bundle after depeg and before process last price

Cursor_and_Untitled

  • depeg happens at 10.00
  • policy expires at 10.01 (before any claim is made)
  • bundle is closed at 10.04 (still before any claim is made) and all funds are withdrawn as no claims are locking any funds
  • last prices are processed at 10.05 - ๐Ÿ’ฅ

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.