vyperfun / vyper.fun

Cryptozombies for Vyper: Learn Vyper by building games!
https://learn.vyperlang.org/
MIT License
115 stars 53 forks source link

Interfaces Example Invalid "some_address" Parameter Fixed! ;`) #97

Closed theirrationalone closed 1 year ago

theirrationalone commented 1 year ago
interface Car:
    def calculateDoubleSpeed() -> uint256: pure
    def getSpeed() -> uint256: view
    def increaseSpeed(): nonpayable
    def payForPetrol(): payable

# look at "some_address" parameter, That should be "car_address".
@external
def test(some_address: address):
    Car(car_address).calculateDoubleSpeed()  # cannot change storage
    Car(car_address).getSpeed()  # cannot change storage, but reads itself
    Car(car_address).increaseSpeed()  # storage can be altered
    Car(car_address).payForPetrol(value=100)  # storage can be altered, and value can be sent

;`)