Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Michael Egorov
    @michwill
    E.g. a: uint256[3] = [convert(0, uint256) for i in range(3)]
    Or even a: uint256[3] = [convert(0, uint256)] * 3
    It's probably hard to do all-vyper list comprehensions, but even for just constants (e.g. no variables) it's an easier first step
    Of course, "clear" function will do too
    Bryant Eisenbach
    @fubuloubu
    well, we probably have some leeway over list literals because that goes through a Python interpretation first to see if things can be done to reduce it like constant folding. I think list literals of the second type seem like a reasonable addition. Can you propose that as a VIP?
    Alexander
    @alexangelj_twitter
    Is there anyway to convert a timestamp into a string?
    Can anything be converted into a string?
    Bryant Eisenbach
    @fubuloubu
    no, I don't think so
    bytes are compatible I think
    since string is just ASCII bytes IIRC?
    also, gitter migration went smoothly than I expected
    Alexander
    @alexangelj_twitter
    I want to concat a string and a timestamp in the contract but it doens't seem like I can do that, so I'll have to put the concat string as the parameter?
    Bryant Eisenbach
    @fubuloubu
    yeah probably. what are you trying to do?
    Alexander
    @alexangelj_twitter
    I am creating four tokens from a factory, each token has a timestamp that is unique, I wanted to concat a symbol (string) with the timestamp, and pass that as the token symbol, but it doesn't seem like I can do that in contract, so instead of giving it a unique string symbol, I just gave it a new variable tokenId which is a bytes32, and I concat the (keccak hash of the symbol and convert timestamp into bytes 32)
    I wanted each symbol of token to be "SYM1577678400" as a string, but I can just have it as bytes32 I guess
    Bryant Eisenbach
    @fubuloubu
    oh, weird I see
    ya, you can't do that yet lol
    string parsing is... expensive
    also, timestamps can be manipulated by miners yada, yada
    Alexander
    @alexangelj_twitter
    yeah haha, I tried to get creative but wasn't really worth it, then I realized I should just use the address as the id...
    Bryant Eisenbach
    @fubuloubu
    Yup!
    Charles Cooper
    @charles-cooper
    @fubuloubu we could do some pair coding today if you want
    Alexander
    @alexangelj_twitter
    I want to use the @nonreentrant decorator but I am confused by what <key> should be?
    Alexander
    @alexangelj_twitter
    Also, another question: can this function be reentered?
    self.mint(msg.sender, amount)
    return self.asset.transferFrom(msg.sender, self, amount)
    I suspect it could when transferFrom calls msg.sender
    Bryant Eisenbach
    @fubuloubu
    Well, that makes an external call to self.asset
    If you trust that contract it's unlikely to do any harm i.e. if it's a token you've created
    If you're making something that let's any ERC20 token be that asset, it's worth considering the token could be compromised
    But msg.sender doesn't do anything special there, just an address variable
    But mint probably wouldn't cause harm by itself, it doesn't impact any internal state of the contract
    Alexander
    @alexangelj_twitter
    self.asset is a trusted contract I create, but in this case msg.sender could be a malicious contract right?
    Bryant Eisenbach
    @fubuloubu
    It could be, but if your token contract doesn't communicate to the initiator of your method, you have nothing to worry about
    Félix Robles
    @Findeton
    in vyper, can a payable function send money to somewhere else?
    Michael Egorov
    @michwill
    Is it possible to do something like import a as b? When I'm doing it, vyper complains about unknown interface and it wants import a as a
    Bryant Eisenbach
    @fubuloubu
    @Findeton yes, you can send from inside any function, including payable ones
    @michwill unsure, the import support is sorta new and may be a little fuzzy around the edges. If it's not working like how you expect, I would open an issue
    Michael Egorov
    @michwill
    Bryant Eisenbach
    @fubuloubu
    👍
    Félix Robles
    @Findeton
    @fubuloubu how can I check the balance of the contract's address?
    Bryant Eisenbach
    @fubuloubu
    self.balance
    Félix Robles
    @Findeton
    thanks!
    Aristotelis Triantafyllidis
    @Totoual
    Hi, is there a way around of concating lists of bytes32 other than manually adding each element in the concat() function? I mean I am not able to pass the list inside the concat function because it doesn't support it.
    I need something similar to this.
        temp: bytes32[BATCH_SIZE]
        temp_from_supplies: bytes32[BATCH_SIZE]
        for i in ragne(BATCH_SIZE):
            id: uint256 = _ids[i]
            temp[i] = convert(id, bytes32)
            supply: uint256 = _from_supplies[i]
            temp_from_supplies[i] = supply
    
    hash: bytes32 = keccak256(concat(temp, temp_from_supplies))
    Bryant Eisenbach
    @fubuloubu
    I can't see exactly what you're trying to do, but currently that is the pain we have when working with hashing types. @charles-cooper is working on the ABI encoder, which will make this significantly easier to do
    You will just have to do hash: bytes32 = keccak256(abi_encode(_ids, _from_supplies))
    It's probably our biggest missing feature at the moment
    Also will allow us to do data passing on calls like ERC721 transfer
    Aristotelis Triantafyllidis
    @Totoual
    Hmm thanks for your response. So this is not implemented yet right ? I am creating a hash of some items along with a signature that I receive and I am verifying the address.
    Bryant Eisenbach
    @fubuloubu
    Yeah, not yet. I mean, you can do what you're looking to do today, but it will be significantly easier once the ABI encoder is complete.
    It's actually kind of cool that concat(bytes32[N], bytes32[N]) works to give you a string of bytes. I don't think I've seen someone do that yet