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
830 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 ...
0 votes
0 answers
32 views

Fail to swap USDT to WETH in curve pool

I want to swap my USDT to WETH in curve pool: [USDT, wBTC, WETH]. // SPDX-License-Identifier: UNLICENSED pragma solidity =0.8.10; import "forge-std/Test.sol"; contract ContractTest is Test ...
0 votes
2 answers
31 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 ...
3 votes
1 answer
630 views

How to get the error message from a failed transaction with web3?

My smart contract has the following piece of code: # check if the election has begun. begin and end time must be in the future and in unix timestamp assert block.timestamp < self.elections[...
0 votes
1 answer
548 views

Vyper: Truffle test read mapping value inside struct

I have the following struct inside my vyper file: races: public({ start: timestamp, end: timestamp, racersBetHash: bytes32[address], racersBetAmount: wei_value[address] }[int128]) Then I ...
0 votes
0 answers
25 views

Swapping tokens with code

how do I swap tokens using java script in pancake swap v3 I'm looking for source code but not finding it anywhere
2 votes
1 answer
26 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) * ...
0 votes
0 answers
17 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?
4 votes
2 answers
63 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?
2 votes
1 answer
689 views

How to call the functions of Ethereum Smart Contract from Android/iOS application?

I've been learning solidity & viper for some time now but i am wondering if it's possible to call the functions/methods of a smart contract (already deployed on Ethereum Network) from an Android/...
0 votes
0 answers
4 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": "...
1 vote
0 answers
21 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 ...
0 votes
1 answer
357 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 ...
1 vote
1 answer
562 views

How to use raw_call in Vyper?

I am new to Vyper and am trying to use the raw_call built in function as defined in the official documentation. I am getting the error where the vyper compiler says that the raw_call function expects ...
0 votes
3 answers
70 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 ...
0 votes
0 answers
34 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 ...
2 votes
1 answer
99 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 ...
2 votes
2 answers
183 views

Sending coins from contract A to contract B

I have two contracts. Contract A is an ERC20 token with initial_supply all owned by the contract itself. And Contract B which exposes a deposit method. When a user sends a transaction to ContractB....
1 vote
1 answer
139 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 ...
2 votes
1 answer
137 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 ...
1 vote
1 answer
313 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. ...
3 votes
0 answers
51 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, ...
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
1 vote
0 answers
16 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 ...
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 ...
0 votes
1 answer
279 views

Only int128 and uint256 int types in vyper

I have read vyper documentation and there is something strange: I only see uint256 and int128 data types for integer values. There is no way to create an uint8 for example in vyper ? Thanks
0 votes
3 answers
137 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 ...
2 votes
1 answer
126 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?
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 ...
1 vote
2 answers
64 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] = ...
1 vote
0 answers
56 views

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

What does a minimal ERC-1967 vyper proxy look like?
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?
0 votes
1 answer
17 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)
0 votes
0 answers
32 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 ...
1 vote
1 answer
37 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.
1 vote
1 answer
28 views

I did not understand this python syntax [closed]

we have: what does pa, pb = pb, pa mean? Help me to understand this.
1 vote
1 answer
76 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: ...
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.
1 vote
1 answer
55 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()?
1 vote
1 answer
659 views

What's the equivalent of Vyper's create_forwarder_to in Solidity?

In Vyper, there's a built-in function called create_forwarder_to, which Duplicates a contract’s code and deploys it as a new instance, by means of a DELEGATECALL. If my understanding is correct, ...
0 votes
1 answer
56 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 ...
1 vote
2 answers
62 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 ...
1 vote
0 answers
430 views

Transfer ERC20 Token with vyper

Hello i m learning vyper and i have this issue: I deployed a standard ERC20 token contract using vyper default contract: https://github.com/ethereum/vyper/blob/master/examples/tokens/ERC20.vy When i ...
0 votes
1 answer
205 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 !
0 votes
1 answer
226 views

Vyper Local compiler failed to fetch

I have vyper installed and my local compiler and remix both on http://localhost:8000 However, when i go to compile it, i get the error in remix saying failed to fetch. and in my mac terminal i get: ...
1 vote
1 answer
158 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
2 votes
2 answers
136 views

Multidimensional String arrays are not supported - Vyper

Whenever I try to make a list of strings (2D array), I get this error Multidimensional String arrays are not supported. This is the code I tried: names: String[30][100]. Does anyone know how to help? (...
1 vote
1 answer
1k views

How to input decimal parameter in web3.py?

I have a contract with this abi [ { "stateMutability": "nonpayable", "type": "constructor", "inputs": [ {"name": "...
1 vote
2 answers
182 views

How can i create an enum in a vyper file

Is there a way to create an enum in a vyper file ? I have tried this: from enum import Enum But it does not work Any idea ? Thanks
1 vote
1 answer
92 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 ...