vyperlang / titanoboa

a vyper interpreter
https://titanoboa.readthedocs.io
Other
236 stars 36 forks source link

need better fn description #113

Open bout3fiddy opened 6 months ago

bout3fiddy commented 6 months ago

currently we have:

(Pdb++) self.coins[exchange_i].allowance?
Type:           VyperFunction
String Form:    contracts/mocks/ERC20Mock.vy.allowance
Definition:     self.coins[exchange_i].allowance(*args, value=0, gas=None, sender=None, **kwargs)
Docstring:      None

we need way better description that shows what the args are, what the docstrings are, etc.

charles-cooper commented 6 months ago

this should help: https://github.com/vyperlang/titanoboa/commit/b0099d522fe6f924a761d014d1c261f5406289fc

DanielSchiavini commented 1 month ago

If I try this currently with this function I get:

Signature:   c.approve(*args, value=0, gas=None, sender=None, **kwargs)
Type:        VyperFunction
String form: contract function approve(address,uint256)
File:        ~/curve/boa/boa/contracts/vyper/vyper_contract.py
Docstring:  
@dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
     Beware that changing an allowance with this method brings the risk that someone may use both the old
     and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
     race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
     https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
@param _spender The address which will spend the funds.
@param _value The amount of tokens to be spent.

Which means:

  1. The module is incorrect, the file should be the ERC20.vy instead of vyper_contract.py
  2. The function signature is always the same as VyperFunction.call