Code Monkey home page Code Monkey logo

brownie-strategy-mix's People

Contributors

akshaynexus avatar anticlimactic avatar banteg avatar coolgeye1 avatar dmolina79 avatar dsommer123 avatar fubuloubu avatar gallodasballo avatar macarse avatar orbxball avatar pandadefi avatar poolpitako avatar smoothbot avatar theryanmiller avatar unlockedmutex avatar willyloman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brownie-strategy-mix's Issues

README Instructions Contain Typo

Currently, the README has the following instruction:

...
token = Token("0x6b175474e89094c44da98b954eedeac495271d0f")
...

When I run this, I see the error TypeError: 'ContractContainer' object is not callable because we are trying to invoke call the Token object which is of type >>> type(Token) <class 'brownie.network.contract.ContractContainer'>.

We should really be calling the method Token.at like:

token = Token.at("0x6b175474e89094c44da98b954eedeac495271d0f")

README.md instructions for ganache are incorrect.

I tried following the instructions to install ganache at the url in the README:

https://github.com/trufflesuite/ganache-cli

If you click on the link you'll see that it takes you to trufflesuite/ganache. I believe truffle consolidated their products.

If you install the package there, brownie will be unsuccessful in starting a node as the parameters have different names (i.e. instead of chainId it is now chain.chainId etc.

The package that yearn was referring to was this package, which has been deprecated in favor of the above package.

https://www.npmjs.com/package/ganache-cli

The quick fix is to change the link to this package, the longer fix would be to change things around to work with the newer package.

add matching tags for releases based of yearn vaults repo

Strategist need to target live vaults with different versions, e.g: 0.3.0, 0.3.5 0.4.2

We need to add matching tags version like v0.3.0 that strategist forking this repo can quickly
build the strategy with all test working on them as expected.

v0.3.0 in brownie mix should point to v0.3.0-1 in yearn-vaults to make the version simpler and avoid anyone deploying new strategies without health checks.

All code needs to be adjusted so its compatible with each vault version release.

Important releases to have matching tags for:

v0.3.0
v0.3.2
v0.3.3
v0.3.5
v0.4.2

(rest are not as critical since we don't have live vaults for those)

Add integration with Tenderly to improve debugging

This has to be optional so anyone can choose if they want to use it or not.

Every time a test suite is run:

  • Create a new fork in Tenderly
  • Run every test
  • Print log messages that let you check Tenderly dashboard
  • Clean up: if everything was ok, delete the fork. Else, keep it for debugging.

Import deploy script from Yearn-Vaults

return # TODO: Deploy one using scripts from Vault project

I'm looking into ways to import the deploy script from Yearn-Vaults into the Strategy Mix, I can import contracts but I can't find a way to import scripts.

Can you give me an intuition for how to make that work?

I'd be happy to add this functionality if you can point me in the right direction

Readme incorrect for addStrategy arguments

The readme omits the debtRatio argument to addStrategy:

>>> v.addStrategy(strategy, Wei("1000 ether"), 2 ** 256 - 1, 50, {"from": gov})
  File "<console>", line 1, in <module>
  File "brownie/network/contract.py", line 1692, in __call__
    return self.transact(*args)
  File "brownie/network/contract.py", line 1575, in transact
    data=self.encode_input(*args),
  File "brownie/network/contract.py", line 1610, in encode_input
    data = format_input(self.abi, args)
  File "brownie/convert/normalize.py", line 20, in format_input
    raise type(e)(f"{abi['name']} {e}") from None
ValueError: addStrategy Sequence has incorrect length, expected 5 but got 4

related #69

Add Integration Test Suite for Vault and Strategy interactions

Add an integration test suite that strategist can use to test their code that works as a smoke test for the minimum features they need to implement and ensures the strategy is working correctly for normal conditions and emergency mode.

This test suite should help ensure the vault and strategy interactions work correctly.

Covers at least the following scenarios:

  • Test normal operations of vault + strategy interactions like:
    • deposit
    • withdrawal
    • harvest
    • tend
  • Test extraordinary scenarios like Emergency Exit state and ensure liquidate position can properly exit position

Not working with ganache v7.0.0-alpha.1

When I run brownie console per the readme I get an error-

Launching 'ganache-cli --accounts 10 --hardfork istanbul --fork https://mainnet.infura.io/v3/[snip]--gasLimit 12000000 --mnemonic brownie --port 8545 --chainId 1'...
  File "brownie/_cli/__main__.py", line 64, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "brownie/_cli/console.py", line 58, in main
    network.connect(CONFIG.argv["network"])
  File "brownie/network/main.py", line 50, in connect
    rpc.launch(active["cmd"], **active["cmd_settings"])
  File "brownie/network/rpc/__init__.py", line 93, in launch
    raise RPCProcessError(cmd, uri)
RPCProcessError: Unable to launch local RPC client.
Command: ganache-cli
URI: http://127.0.0.1:8545

Running that command directly shows that the --chainId command isn't allowed anymore:

$ ganache-cli --accounts 10 --hardfork istanbul --fork https://mainnet.infura.io/v3/[snip]--gasLimit 12000000 --mnemonic brownie --port 8545 --chainId 1'
Unknown argument: chainId

This is using ganache v7.0.0-alpha.1 and Brownie v1.16.0.

When I downgrade to ganache v6.12.2 it works as expected:

$ npm install [email protected] --global
$ brownie console
...

Launching 'ganache-cli --accounts 10 --hardfork istanbul --fork https://mainnet.infura.io/v3/[snip] --gasLimit 12000000 --mnemonic brownie --port 8545 --chainId 1'...
Brownie environment is ready.

Cannot add strategy: Contract 'VaultAPI' object has no attribute 'addStrategy'

I'm trying to follow the readme to create a new strategy. I did the following but i'm getting an error:

>>> from pathlib import Path
>>> vault = interface.VaultAPI("0xdA816459F1AB5631232FE5e97a05BBBb94970c95")
>>> token = interface.IERC20("0x6b175474e89094c44da98b954eedeac495271d0f")
>>> gov = "ychad.eth"
>>> strategy = Strategy.deploy(vault, {"from": accounts[0]})
Transaction sent: 0x87d571cf69e58c3032a0cc4bd056a30b65279d602305853bcb6a44b91b1af230
  Gas price: 0.0 gwei   Gas limit: 12000000   Nonce: 2
  Strategy.constructor confirmed   Block: 13611222   Gas used: 2540922 (21.17%)
  Strategy deployed at: 0xE7eD6747FaC5360f88a2EFC03E00d25789F69291

>>> vault.addStrategy(strategy, Wei("1000 ether"), 2 ** 256 - 1, 50, {"from": gov})
  File "<console>", line 1, in <module>
  File "brownie/network/contract.py", line 831, in __getattribute__
    raise AttributeError(f"Contract '{self._name}' object has no attribute '{name}'")
AttributeError: Contract 'VaultAPI' object has no attribute 'addStrategy'

The vault object has plenty of methods, but none of them are addStrategy...

>>> dir(vault)
[abi, address, alias, allowance, apiVersion, approve, balance, balanceOf, bytecode, creditAvailable, debtOutstanding, decimals, decode_input, deposit, depositLimit, expectedReturn, from_abi, from_ethpm, from_explorer, get_method, get_method_object, governance, guardian, info, management, maxAvailableShares, name, permit, pricePerShare, report, revokeStrategy, selectors, set_alias, signatures, strategies, symbol, token, topics, totalAssets, totalSupply, transfer, transferFrom, tx, withdraw]

Am I doing something wrong, or is the readme out of date?

Accessing Vault via local ABI does not work

I just did a fresh clone of this repo and followed the README. This step doesn't work for me and I had to use these steps instead. If it helps, the error I received was:

>>> vault.addStrategy(strategy, 1000, 0, 2 ** 256 - 1, 1_000, {"from": gov})
  File "<console>", line 1, in <module>
  File "brownie/network/contract.py", line 832, in __getattribute__
    raise AttributeError(f"Contract '{self._name}' object has no attribute '{name}'")
AttributeError: Contract 'VaultAPI' object has no attribute 'addStrategy'

when trying to add the strategy using the local ABIs.

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.