Questions tagged [vyper]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
26 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
45 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
65 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
20 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
10 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
10 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
8 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
11 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
46 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
36 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
14 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
15 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
65 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
88 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
19 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
25 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
  • 645
1 vote
1 answer
60 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
11 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
25 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
40 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
43 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
118 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
58 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
221 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
0 votes
0 answers
83 views

Assistance in Web3.py Arbitrage Calculating

Hey I was looking for a prototype on getting this task done in web 3.py lets say the list of dex are: uniswap v2 & v3 and sushiswap and the list of coins are: USDC/USDT/DAI #3.Calculate each DEX's ...
Wealthanaire's user avatar
1 vote
1 answer
648 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
85 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
56 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
77 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
71 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
77 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
30 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,302
1 vote
1 answer
122 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
135 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
  • 35
1 vote
1 answer
127 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
101 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
189 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
468 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
141 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
94 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
116 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
54 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
  • 35
1 vote
0 answers
138 views

How to implement ERC721Receiver with vyper v0.3.3

I am trying to implement a function, onERC721Received, using Vyper v0.3.3, that is called when an NFT is transferred to the contract using safeTransferFrom. According to the this ERC721 token standard,...
Ryan's user avatar
  • 35
1 vote
1 answer
814 views

How to transfer an NFT from a contract address to a wallet address

In a local test environment, I am able to compile this implementation of the ERC721 token standard, deploy it, mint an NFT and transfer it (using the transferFrom function) to the following deployed ...
Ryan's user avatar
  • 35
2 votes
0 answers
440 views

Why is the Vyper Bytecode smaller? What is it giving up?

I have two contracts that are essentially the same, but one is in vyper: # SPDX-License-Identifier: MIT # @version ^0.3.3 my_var: public(uint256) @external def update_var(my_new_var: uint256): ...
Patrick Collins's user avatar
1 vote
2 answers
77 views

How to make an empty bytes32 variable in vyper

How do I make an empty bytes32 variable in vyper? @external def return_empty() -> (bytes32): return ("")
Patrick Collins's user avatar
2 votes
1 answer
108 views

Interfaces not working in vyper

I have the following interface in it's own file: # @version ^0.3.3 interface IFace: def read_stuff() -> uint256: view And I'd like to import it into my other contract. # @version ^0.3.3 import ...
Patrick Collins's user avatar
1 vote
1 answer
48 views

Body must only contain state mutability label: Vyper

I have an interface that I'm making: interface IAggregatorV3: @view @external def decimals() -> uint8: pass However, I'm getting this compile error: Body must only contain ...
Patrick Collins's user avatar
1 vote
1 answer
109 views

Multiple returns or return a tuple in vyper?

I have a contract: interface IAggregatorV3: def getRoundData(uint80) -> [uint80, int256, uint256, uint256, uint80]: view And the contract in solidity returns a tuple of multiple types. How do ...
Patrick Collins's user avatar
0 votes
1 answer
18 views

"Cannot declare String type without a maximum length"

I have a contract: interface IAggregatorV3: def description() -> String: view But when I compile, I get: Cannot declare String type without a maximum length How do I fix this?
Patrick Collins's user avatar