Code Monkey home page Code Monkey logo

Comments (4)

poolpitako avatar poolpitako commented on August 22, 2024

@pinyeda you don't need to use interfaces. instead of:

vault = interface.VaultAPI("0xdA816459F1AB5631232FE5e97a05BBBb94970c95")
token = interface.IERC20("0x6b175474e89094c44da98b954eedeac495271d0f")

just do:

vault = Contract("0xdA816459F1AB5631232FE5e97a05BBBb94970c95")
token = Contract("0x6b175474e89094c44da98b954eedeac495271d0f")

if you setup etherescan correctly in brownie, brownie will download the interface from etherscan.

re-open if you need further help.

from brownie-strategy-mix.

pinyeda avatar pinyeda commented on August 22, 2024

Hmm, getting the same result even without using interfaces. addStrategy doesn't exist on vault.

I've set up my etherscan token, infura key, pulled down a fresh template repo. Are you able to recreate this?

from brownie-strategy-mix.

pinyeda avatar pinyeda commented on August 22, 2024

Ah, I ended up getting addStrategy to show when using project.load. (was etherscan returning the wrong interface??)

Then i got an error about the argument length. The readme must be incorrect here-

>>> from pathlib import Path
>>> yearnvaults = project.load(Path.home() / ".brownie" / "packages" / config["dependencies"][0])
>>> v = yearnvaults.Vault.at("0xdA816459F1AB5631232FE5e97a05BBBb94970c95")
>>> strategy = Strategy.deploy(v, {"from": accounts[0]})
>>> 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

Adding the missing debtRatio argument to addStrategy works.

>>> tx = v.addStrategy(strategy, 5, Wei("1000 ether"), 2 ** 256 - 1, 50, {"from": gov})
Transaction sent: 0xed96ac1f215078f34464add3c23bce650880fca71050beee84291afd9092fe4b
  Gas price: 0.0 gwei   Gas limit: 12000000   Nonce: 1

from brownie-strategy-mix.

pinyeda avatar pinyeda commented on August 22, 2024

The above transaction fails actually, I'm not sure why. Is there a way to make the stack trace readable?

>>> tx.info()
Transaction was Mined (reverted)
---------------------
Tx Hash: 0xb85062290f6983ccd35fcee9a04363555484dace913a1af096ab22865fbbf5b9
From: 0xFEB4acf3df3cDEA7399794D0869ef76A6EfAff52
To: 0xdA816459F1AB5631232FE5e97a05BBBb94970c95
Value: 0
Function: Vault.addStrategy
Block: 13615435
Gas Used: 33369 / 12000000 (0.3%)

>>> tx.call_trace()
Call trace for '0xb85062290f6983ccd35fcee9a04363555484dace913a1af096ab22865fbbf5b9':
Initial call cost  [22424 gas]
Vault.addStrategy  0:635  [92 / 10945 gas]
└── Vyper_contract.addStrategy  [DELEGATECALL]  12:625  [7104 / 10853 gas]
    ├── Strategy.vault  [STATICCALL]  350:451  [1889 gas]
    └── Strategy.want  [STATICCALL]  480:578  [1860 gas]

EDIT: tx.traceback is what i'm looking for:

>>> tx.traceback()
Traceback for '0xb85062290f6983ccd35fcee9a04363555484dace913a1af096ab22865fbbf5b9':

Trace step 624, program counter 9453:
  File "Vyper_contract.vy", line 1192, in Vyper_contract.addStrategy:
    assert self.debtRatio + debtRatio <= MAX_BPS

from brownie-strategy-mix.

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.