Skip to main content

Questions tagged [vyper]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
17 views

Decompiled Smart Contract Code - Language Identification?

I recently decompiled a smart contract using Etherscan and encountered the following code snippets: def _fallback(): // not payable, default function require calldata.size - 4 >= 0 if caller!= ...
adam mr's user avatar
  • 131
3 votes
1 answer
54 views

Clarification on Theorem 6 from Uniswap V1 Formalized Model: e_0 < e_2 and t_0 < t_2

References: a link to the parent site Formalized Model Document
Vegetal605's user avatar
0 votes
0 answers
35 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 ...
LEVI_104's user avatar
0 votes
0 answers
47 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
RichMond's user avatar
2 votes
1 answer
28 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
19 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
77 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
5 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
31 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
2 answers
53 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
76 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
36 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
  • 1,254
2 votes
1 answer
135 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
179 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
365 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
159 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
57 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
14 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
20 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
13 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
1 vote
2 answers
70 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
64 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
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)
Patrick Collins's user avatar
2 votes
1 answer
136 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
144 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
1 vote
1 answer
30 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
  • 677
1 vote
1 answer
83 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
42 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
61 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
60 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
229 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
64 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
387 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
864 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
93 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
  • 567
1 vote
1 answer
66 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
95 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
83 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
121 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
33 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
174 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
139 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
136 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
133 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
259 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
527 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
162 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
129 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
143 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