Questions tagged [vyper]

Vyper is a contract-oriented, pythonic programming language that targets the Ethereum Virtual Machine.

Filter by
Sorted by
Tagged with
2 votes
1 answer
21 views

What's `//` in Vyper?

I'm doing some division in vyper (v0.4.0b), but I keep getting this error: InvalidOperation: Cannot perform decimal division on uint256 (hint: did you mean `(convert(price, uint256) * ...
Patrick Collins's user avatar
0 votes
0 answers
14 views

How do I import a package in vyper version 0.4.0^?

For example, let's say I want to import snekmate: from snekmate.tokens import ERC20 as base_token How do I get snekmate into my packages? Do I have to import them to my contracts folder?
Patrick Collins's user avatar
4 votes
2 answers
56 views

How to do pow_mod256?

Vyper has the built in function a ** b % (2 ** 256). Is there any way to make the same calculation in Solidity?
Anton Grigorev's user avatar
0 votes
0 answers
3 views

Pass an array to a deposit method in Vyper

I'm trying to create a deposit function in Vyper that I can pass an array of addresses and amounts to eg: { "beneficiaries": [ { "address": "...
Christian Papathanasiou's user avatar
1 vote
0 answers
17 views

Building a Hardhat Project in an AWS EC2 Debian Box, Vyper Compiler Error

Everything is working, solidity contracts compile. But I want to use Vyper; I love vyper, because Vitalik Buterin made it and it has such beautiful simplicity. For some reason I cannot get hardhats ...
Jack Vafi's user avatar
0 votes
0 answers
11 views

Safe, Secure, Random Number using only Vyper smart contracts (NO CHAINLINK VRF)

For the purposes of my gaming project I am ditching chainlink VRF in order to obtain a random number because honestly... I hate everything about chainlink. Paying .1 link for a random number is absurd ...
Jack Vafi's user avatar
0 votes
3 answers
66 views

Chainlink VRF Contract Logic Error

I am beginning my journey in web3 so please be understanding 🙂 I am struggling to find an issue in my contract that uses VRF. It is a simple coinflip written in Vyper. I have deployed a consumer and ...
szaleju's user avatar
0 votes
0 answers
30 views

Coinbase pool smart contract code

What is this contract and where can I find its code? https://etherscan.io/address/0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43#code It looks like it was deployed by Coinbase. However, I don't see any ...
Mila A's user avatar
  • 713
2 votes
1 answer
87 views

Determine compiler used to create a given bytecode

Context The method that the solc compiler uses to set storage slots for a mapping is slightly different from how the Vyper compiler does so. In Vyper, it's keccak256(slotMapping, key), while in ...
Another0xDev's user avatar
1 vote
1 answer
111 views

Creating a uniswap V1 pool and Interracting with it

I have the project of making some educational content on the history of AMMs and to do so I’m trying to interact with Uniswap V1 contracts on Goerli. I’m quite new to all that (this exercise is also ...
toto_story's user avatar
1 vote
1 answer
255 views

Raw call to Uniswap Quoter contract fails (raw_call did not return a value)

I'm trying to create a simple contract using Vyper that calls the Uniswap quoter contract and quoteExactInputSingle method to return the value of output token given a certain input token amount. ...
Christian Papathanasiou's user avatar
2 votes
1 answer
117 views

Uniswap V3 Vyper contract reverting on "swap_usdc" function call

I'm trying to create a simple Vyper contract that withdraws my USDC and converts this to a token that's passed through the argument list in the swap_usdc method. I approve this contract to withdraw my ...
Christian Papathanasiou's user avatar
3 votes
0 answers
45 views

Smart contract in Solidity: call a function from a contract written in Vyper

I'm writing a contract in Solidity, in which I'm trying to call a function from another contract written in Vyper. To do so, I've checked the corresponding function in the ABI of the Vyper contract, ...
Tom's user avatar
  • 31
0 votes
1 answer
11 views

Why we use 'log' in Vyper?

What is the usage of the log? I want to get some examples of why 'log' is used in vyper
Wonjae Choi's user avatar
1 vote
0 answers
15 views

Vyper: How to test internal helper functions?

I'm writing a Roulette contract as a learning activity in Vyper. My contract seems to be working through manual testing, and now I'm starting to write unit tests. I have an internal helper function ...
JoshOrndorff's user avatar
0 votes
0 answers
10 views

Does Brownie support structs and enums?

Brownie is a seemingly popular framework for testing smart contracts (both solidity and vyper) in python. I've just gotten started with brownie and my first few tests are working. However, I can't ...
JoshOrndorff's user avatar
0 votes
0 answers
21 views

Compiling Vyper files results in a 'path exists outside base folder' error

I was working with the truffle VyperStorage Example Box. When I execute truffle compile it shows me the error above. I have installed Vyper using pip.The truffle config.js file is used as default so ...
Muhammad Uzair's user avatar
1 vote
2 answers
62 views

How to base64 encode a string in vyper?

I have a string that looks like this: name: public(constant(String[25])) = "Mood NFT" . . . image_uri: String[1024] = self.happy_svg_uri metadata: String[1206] = ...
Patrick Collins's user avatar
1 vote
0 answers
52 views

What does a minimal ERC-1967 proxy in vyper look like?

What does a minimal ERC-1967 vyper proxy look like?
Patrick Collins's user avatar
0 votes
0 answers
18 views

How do I check for events being emitted in vyper's titanoboa?

I want to test for an event being emitted in titanoboa. How do I do that?
Patrick Collins's user avatar
0 votes
1 answer
16 views

Do I have to mark addresses that I want to send ETH to in vyper as payable?

In solidity, if I want to send ETH to an address, I have to mark it as payable. Do I need to do this in vyper? Solidity example: payable(msg.sender)
Patrick Collins's user avatar
2 votes
1 answer
116 views

Storage collision in vyper hashmap?

Can you get a storage collision in vyper? The HashMap value is stored at the keccack256 of the key. So wouldn't this mean storage collisions are possible?
Patrick Collins's user avatar
0 votes
3 answers
124 views

Where is the first element in a vyper array stored in storage?

I have a vyper contract: favoriteNumber: uint256 # Stored at slot 0 someBool: bool # Stored at slot 1 myArray: uint256[1000] # Length stored at slot 2 The length of myArray would be stored at storage ...
Patrick Collins's user avatar
0 votes
0 answers
29 views

Does vyper's `send` function have the same issue as solidity's `transfer`?

In solidity it's bad practice to use the transfer keyword because of how gas costs are subject to change, and the transfer function has it's gas costs hard-coded. Does vyper's send suffer the same ...
Patrick Collins's user avatar
1 vote
1 answer
27 views

I did not understand this python syntax [closed]

we have: what does pa, pb = pb, pa mean? Help me to understand this.
Hacek 's user avatar
  • 665
1 vote
1 answer
74 views

Vyper: Using a `decimal` type in etherscan

I have deployed a vyper contract to etherscan that looks as such: @external @view def ask(x: decimal) -> decimal: return x However, entering 0x0 into etherscan returns the following error: ...
Patrick Collins's user avatar
1 vote
1 answer
14 views

Hashset in vyper

Does vyper have an equivalent of a hashset? The documentation doesn't say anything about a hashset, but given the existence of a hashmap, I imagine a hashset would be simple to have.
user118109's user avatar
1 vote
1 answer
33 views

HashMap length in vyper

Is there a way to access the number of elements in a hashmap? I can't find any instructions about this in the documentation and nothing I've tried seems to work.
user118109's user avatar
1 vote
1 answer
52 views

What is Solidity's equivalent of raw_call()?

I'm wondering, does Solidity also have a raw_call() function like Vyper which sends a byte[] array (payload) as calldata to a specific address? If so, what is that function? Is it also raw_call()?
MuellerSachs's user avatar
0 votes
1 answer
53 views

Web3j fails to deploy simple Vyper Contract to Ganache

I have a simple hello world contract, compiled with Vyper. I use Web3j CLI to make a Java wrapper class from the contract's abi and bin files. When I deploy it, I get a stack underflow error. I know ...
devdanke's user avatar
  • 174
0 votes
1 answer
190 views

How can i build a bridge from scatch and of course a secure bridge which no one could hack it?

i want to know how bridge work because i want to work on my own bridge for a personnal project. Any good link for documentation and tutorial ? Thanks !
GaraaaOfDesert's user avatar
1 vote
2 answers
59 views

Why does deploying a contract causes two transactions?

I am new to Ethereum, learning about smart contracts. I have a simple hello world contract. # @version ^0.3.7 @external @pure def hola() -> String[5]: return "hola!" Currently, I'm ...
devdanke's user avatar
  • 174
0 votes
1 answer
333 views

Ganache-UI fails to link with Truffle project

Created Truffle project with truffle init. The project has two simple contracts written in Vyper. I configure the project's truffle-config.js to point at Ganache-UI. Using truffle test, my contracts ...
devdanke's user avatar
  • 174
1 vote
1 answer
806 views

Error Installing ETH Brownie

So I get a error for each of the 3 different processes when I attempt to install eth-brownie on my Mac OS... With "pip install eth-brownie", I get the error fatal error: too many ...
Wealthanaire's user avatar
1 vote
1 answer
90 views

Can import Python module to Vyper smart contract?

I don't know my question is right or not. There is a Python module that we should rewrite its source code on a smart contract. Other hand, Vyper is a pythonic language for developing Ethereum smart ...
Alireza's user avatar
  • 533
1 vote
1 answer
64 views

In Brownie test, how to call contract's __default__() method?

I have a contract Foo with a __default__() method. I have another contract Bar that invokes Foo's __default__() method when it calls send(foo.address, 1). When running Brownie tests, with both Foo ...
devdanke's user avatar
  • 174
1 vote
1 answer
91 views

Vyper - Why is my first memory variable placed with an offset of 0x40 (64 bytes) instead of 0x20 (32 bytes) or even 0x00 (no offset)?

I have a vyper contract, as such: @external def add_two(my_number: uint256) -> uint256: two: uint256 = 123456 return my_number + two When you compile this (with 0.3.6), a piece of the ...
Patrick Collins's user avatar
2 votes
1 answer
76 views

What is the best way to remove a value inside a DynArray in vyper?

I would like to know what is the best way to remove an element inside a DynArray in vyper. Seems there is no functionalities like remove() or del(). Only pop() for the last element. For example you ...
jrmunchkin's user avatar
0 votes
1 answer
102 views

Convert from Bytes[32] to bytes32 or bytes8 vyper

In vyper, how can I convert: response: Bytes[32] = raw_call(your_contract_address, call_data, max_outsize=32) to a bytes32 or even just take the first 8 bytes? response: bytes8 = ?
Patrick Collins's user avatar
0 votes
2 answers
32 views

Is Ethereum capable of having dynamicly typed languages?

I am wondering if it is at least theoretically possible for Ethereum to have a language that is loose/weak typing. From what I've seen all the languages on Ethereum are static typed. My understanding ...
zunior's user avatar
  • 1,312
1 vote
1 answer
158 views

Has the used of Solidity in Ethereum gone down over time?

I am getting started learning Solidity for Ethereum contracts. But I worry that Solidity could be displaced by other smart language contracts, or even languages like Python or Go.
SarahRinaldi_93's user avatar
1 vote
0 answers
138 views

Update HashMap within onERC721Received with Vyper

When a contract receives an NFT by calling safeTransferFrom, onERC721Received is automatically called on the receiving contract. I want to be able to update a Hashmap to record the address of the ...
Ryan's user avatar
  • 92
1 vote
1 answer
134 views

Dynamic Bytes Array Vyper

Can I make a dynamic bytes array in vyper? Something like: checkData: DynArray[Bytes, 32] For example, for create a function with the same function signature as a solidity func: function checkUpkeep(...
Patrick Collins's user avatar
2 votes
1 answer
129 views

convert bytes array to string array vyper

Let's say I have a bytes array as such: Bytes[4] = b"\x00" How would I convert this to a string?
Patrick Collins's user avatar
0 votes
1 answer
231 views

Match a solidity function selector with a dynamic array to a vyper function selector

I have a solidity function selector: bytes4 selector = bytes4(keccak256(bytes("rawFulfillRandomWords(uint256,uint256[])"))); (The selector here is 0x1fe543e3) And in this function selector, ...
Patrick Collins's user avatar
1 vote
1 answer
512 views

encodeWithSelector and call equivalence in vyper

What is the encodeWithSelector (from solidity) equivalent in vyper? For example, in solidity, if I wanted to directly the transfer function on our own contract using raw calls, I'd do: function ...
Patrick Collins's user avatar
1 vote
1 answer
155 views

How to pass an array as an input parameter in a function in vyper?

Let's say I have a function and I want to pass my_array as an input parameter, how do I do that in vyper? This is an example, but it throws a compiler error. def my_func(my_array: uint256[]): pass
Patrick Collins's user avatar
2 votes
1 answer
112 views

Vyper: Call function in __init__, Function does not exist or has not been declared yet

I have some vyper code as such: # SPDX-License-Identifier: MIT # @version ^0.3.3 supply: uint256 decimals: uint256 @internal def updateSupply(_supply: uint256): self.supply = _supply @external ...
Patrick Collins's user avatar
1 vote
0 answers
133 views

Vyper gas uint64 overflow error

im trying to deploy a Vyper contract, it compiles, but then, when im deploying it, raise the exception {'code': -32000, 'message': 'gas uint64 overflow'}. Only when I add a value to the HashMap, it ...
jal4's user avatar
  • 11
0 votes
1 answer
69 views

Set address as constant in Vyper

The Vyper docs say that one can define a constant like this: TOTAL_SUPPLY: constant(uint256) = 10000000 but what about defining an constant with type address ? This doesn't compile: CONTRACT_ADDRESS: ...
Ryan's user avatar
  • 92