Please join the Ethereum Python Dev discord, which has a #vyper channel! https://discord.gg/jDZVkcTCqs
there is a #vyper channel in the Python EthDev discord. Please join the discussion there: https://discord.gg/FwuxuvGSjz
casual reminder
AttributeError: 'StructType' object has no attribute 'typ'
@fubuloubu hi, hope to find you well! can you perhaps send me the link to discord? unable to join
I updated the link!
Hi, I have a basic question with
raw_call
. When the internal call reverted, doesraw_call
revert the transaction or just return the result?
Any exception thrown in an EVM execution will result in a reversion/abandonment of the tx. My understanding is that's fundamental to the EVM and not anything the language has an impact on.
hi, im new in vyper. Import function from another file is quite confused.
I defined a internal pure func in one.vy like this
@internal
@pure
def AddOne(x: uint256) -> uint256:
return x + 1
then i wanna import it in two.vy
from contracts.one import AddOne
@external
@pure
def AddOneTest(x: uint256) -> uint256:
return AddOne(x)
but an error occured on last line:
vyper.exceptions.TypeMismatch: Given reference has type uint256, expected address
my vyper version is 0.3.1. What should I do.
NEED HELP
I am new to Vyper. I was analyzing the contract there I saw raw_call in a method
raw_call(reward_contract, self.claim_sig)
its permalink: https://github.com/curvefi/curve-dao-contracts/blob/3bee979b7b6293c9e7654ee7dfbf5cc9ff40ca58/contracts/gauges/RewardsOnlyGauge.vy#L113
and claim_sig Four-byte selectors for staking, withdrawing, and claiming, left padded with zero bytes. If the reward contract can be claimed from but does not require staking, the staking and withdraw selectors should be set to 0x00
more about sigs: A concatenation of three four-byte function signatures: stake, withdraw, and getReward. The signatures are then right padded with empty bytes. See the example below for more information on how to prepare this data.
An example of generating the signatures input and enabling a vanilla SNX rewards contract:
Rewards = Contract("0x99ac10631f69c753ddb595d074422a0922d9056b")
first, we get the signatures for depositing, withdrawing and claiming sigs = [rewards.stake.signature, rewards.withdraw.signature, rewards.getReward.signature] sigs ["0xa694fc3a", "0x2e1a7d4d", "0x3d18b912"]
now we remove the leading 0x and concatentate them sigs = "".join(i[2:] for i in sigs) sigs "a694fc3a2e1a7d4d3d18b912"
finally, we add the leading 0x and trailing 00 bytes sigs = "0x" + sigs + ("00" * 20) sigs "0xa694fc3a2e1a7d4d3d18b9120000000000000000000000000000000000000000"
now we are ready to set the rewards contract gauge.set_rewards(rewards, sigs, [reward_token] + [ZERO_ADDRESS] * 7, {'from': alice})
and the question is:
as it says there are three signatures... does raw_call calls every function? and how is it passing their parameters?