Sitelet https://web.archive.org/web/20200316003106/https://gitter.im/vyperlang/community

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Bryant Eisenbach
    @fubuloubu
    I don't think so, definitely not currently
    Thankfully, it doesn't affect the method_id, so that's not an issue
    but eventually we would want to support dynamic arrays via specifying some sort of max length argument
    (and perhaps min length)
    Michael Egorov
    @michwill
    I see, all right
    Tamaghna Chowdhury
    @iamtamaghna

    Ethcode latest update

    Now you can debug any transaction of Ethereum network (including main and test networks)

    https://link.medium.com/aoNJledtr4

    Michael Egorov
    @michwill

    Anyone minds me creating a grant benefiting Vyper?

    https://gitcoin.co/grants/453/curve-related-vyper-research?tab=description

    (I mean, the grant is already created, and I know some people who want to contribute - just looking for feedback)
    Bryant Eisenbach
    @fubuloubu
    I didn't do a good job promoting it last time though
    last CLR round
    Michael Egorov
    @michwill
    Anyway, I will see if I redirect some grant amounts that way, or hire an engineer to help Vyper :-)
    Hopefully, Curve-ness attracts some funders who didn't care otherwise
    (is it a thing to fund a grant from a grant?)
    Bryant Eisenbach
    @fubuloubu
    As long as you call it out, I'm sure that's okay
    But yeah, having the logo up there might attract end users who don't know about Vyper
    Michael Egorov
    @michwill
    Ok, will see if anything comes out of it
    Michael Egorov
    @michwill
    Brandon McFarland
    @branmcf

    Can someone please help me understand what I'm doing wrong when trying to get the DAI balance of a Kovan address? I'm passing the Kovan DAI contract address at 0xb14A484B3D85Ff97E8d06CcA88a2d0aabE63CBb5 as _dai_address into my Vyper contract constructor and then calling setDaiBalance() from the address 0xb14A484B3D85Ff97E8d06CcA88a2d0aabE63CBb5, which is an address that has 50 Kovan DAI. But whenever I call getDaiBalance() I get 0!

    Here's my code:

    
    contract ERC20m:
        def balanceOf(contractAddress: address) -> uint256: modifying
    
    daitoken: ERC20m
    daiBalance: uint256
    daiAddress: address
    
    def __init__(_dai: address,):
        self.daiAddress = _dai
        self.daitoken = ERC20m(_dai)
    
    @public
    def setDaiBalance(_amount: uint256):
        self.daiBalance = self.daitoken.balanceOf(msg.sender)
    
    @public
    @constant
    def getDaiBalance() -> uint256:
        return self.daiBalance
    Bryant Eisenbach
    @fubuloubu
    Well, first off, balanceOf should be constant not modifying
    Secondly, how are you testing this? Are you actually connected to the Kovan network?
    Actually, you said that 0xb14A....CBb5 is both the Dai address and the address of the token holder you're interested in, are you sure those are both the right addresses to use?
    Brandon McFarland
    @branmcf

    Hey @fubuloubu !

    I originally had balanceOf()as a constant and only changed it to modifying in an attempt to store the returned value for debugging. I'll change it back!

    Oops sorry that was a typo. I'm using 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa as the address of the Kovan DAI contract which I got from here https://github.com/makerdao/developerguides/tree/master/remittance and 0xb14A484B3D85Ff97E8d06CcA88a2d0aabE63CBb5 is a Kovan address that I created for testing which should have 50 DAI as shown here in the "Token" dropdown https://kovan.etherscan.io/address/0xb14A484B3D85Ff97E8d06CcA88a2d0aabE63CBb5. So 0x4f96....a6aa is _dai and 0xb14A....CBb5 is msg.sender in the code above, my bad.

    Yeah I'm testing this on Kovan. I compile the contract with Truffle, deploy it using Node.js + Web3, then interact with it via endpoints on the Node server. The Node code for calling the contract doesn't error out and it looks like this:
    
    const getDaiBalance = async ( params ) => { 
    
        // destructure the address of the deployed contract
        const { contractAddress } = params;
    
        // get a handle to the contract
        let contractInstance = new web3.eth.Contract( contractJson['abi'], contractAddress );
    
        // call getBalance()
        const result = await contractInstance.methods.getDaiBalance().call();
    
        // log the result and return it 
        console.log( 'RESULT: ', result );
        return result
    
    }
    Bryant Eisenbach
    @fubuloubu
    Oh, it's simpler than that, you need to call setDaiBalance() first in your contract
    or copy the line that sets it to also be in the constructor
    not sure what your intent is here, but caching this value in a storage variable is likely to lead to issues like this
    Brandon McFarland
    @branmcf

    Interesting, I really appreciate the response, it sounds like I made the problem worse when trying to debug it!

    All I'm trying to do is assert that a person calling makeOrder() on my contract actually has the _amount of DAI that they're trying to lock into the contract. I'm attempting (but failing) to do this by setting up a handle to the DAI contract in the constructor then calling DAI contract methods (like balanceOf() and transfer()) in other places inside of my contract. The issue is with the assert inside of makeOrder() because I'm always getting 0 as self.daitoken.balanceOf(msg.sender)

    
    contract ERC20m:
        def balanceOf(contractAddress: address) -> uint256: constant
        def transfer(_to: address, _value: uint256) -> bool: modifying
    
    PRECISION: constant(uint256) = 10 ** 18
    
    daitoken: ERC20m
    daiBalance: uint256
    daiAddress: address
    
    def __init__(_dai_address: address,):
        self.daiAddress = _dai_address
        self.daitoken = ERC20m(_dai_address)
    
    @public
    def makeOrder(_amount: uint256):
        # THIS IS THE PROBLEM LINE, balanceOf returns 0!
        assert self.daitoken.balanceOf(msg.sender) >= _amount / PRECISION 
    
        # this line never executes
        self.daitoken.transfer(self, _amount)
    Bryant Eisenbach
    @fubuloubu
    Oh, PRECISION only works with the UI, a re you typing in just 50 for _amount?
    Try 50 * 10**18 instead
    Brandon McFarland
    @branmcf
    If I was trying to lock 50 DAI the _amount being passed into makeOrder() would be 50 * 10**18
    I think the assert line is failing because self.daitoken.balanceOf(msg.sender) is returning 0, but I can't figure out why!
    Bryant Eisenbach
    @fubuloubu
    Does the caller have a balance?
    Brandon McFarland
    @branmcf
    Yes! The caller is 0xb14A484B3D85Ff97E8d06CcA88a2d0aabE63CBb5 and that address has 50 DAI as shown here: https://kovan.etherscan.io/token/0xc4375b7de8af5a38a93548eb8453a498222c4ff2?a=0xb14A484B3D85Ff97E8d06CcA88a2d0aabE63CBb5
    Brandon McFarland
    @branmcf
    I think I know what the problem is...will report back once confirmed
    Bryant Eisenbach
    @fubuloubu
    awesome!
    Brandon McFarland
    @branmcf
    The DAI issued by the Kovan MakerDAO CDP portal is controlled by the contract at 0xC4375B7De8af5a38a93548eb8453a498222C4fF2 NOT the contract at 0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa which is the contract address listed in their docs. I swapped out the address listed in the docs for the address listed on Etherscan and the call worked as expected. I really appreciate all of the responses @fubuloubu, thanks so much!
    Screen Shot 2020-03-05 at 3.44.46 PM.png
    Bryant Eisenbach
    @fubuloubu
    no problem, awesome you figured it out!
    Feist Josselin
    @montyly
    Hi. Is there a way to know if a raw_call failed?
    The documentation states that it returns the data returned, but if the call is not supposed to return anything, how can the caller check the call's success?
    Bryant Eisenbach
    @fubuloubu
    @montyly if a raw_call fails a revert happens
    Call success is required
    Feist Josselin
    @montyly
    oh great, thanks
    Bryant Eisenbach
    @fubuloubu
    yeah, we will probably never add a try-catch semantic, at least not in the forseeable future
    Michael Egorov
    @michwill
    Btw where can I find more info about raw_call?
    Bryant Eisenbach
    @fubuloubu
    docs are pretty underwhelming, all we have is https://vyper.readthedocs.io/en/latest/built-in-functions.html#raw_call
    valdiram lima
    @Valdiramlima_twitter
    Olá
    Alguém aqui entende de contrato inteligente?
    sam bacha
    @sambacha
    hello!
    who here thinks MakerDAO is fucked?