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
1answer
9 views

How to get ABI from vyper source code?

My main gold is to interact with contract. Rexmix online IDE gives solidity and Yul language. To interact my contract I need ABI Question How does vyper source code give me an ABI file?
0
votes
1answer
41 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....
0
votes
1answer
6 views

What is NODE_PROVIDER of vyper listener and client

I am following this tutorial The problem is I don't know what is NODE_PROVIDER I had tried watching Марат Гудков answer, 3 weeks ago here is the video from this Moralis channel about ".env" ...
1
vote
0answers
8 views

Why my assert has different value?

I am following Vyper unittestting Here is my contract and unit test # @version ^0.3.0 #Contract Guess Number #Contract should support multiple guess the number games. #Creator of games should rish 10 ...
0
votes
0answers
15 views

No contract found in remix

I am newbie here trying to setup and learn how ethereum for fun. My IDE is vscode on mac. I had installed remix and vyper plugin. I can compile my hello world vyper contract in command line using ...
1
vote
0answers
26 views

Contract migration from Ethereum to L2

I am trying to figure out is it posible and how to migrate contracts from Ethereum main net to other L2. So here what I found: Migrating from contract in Solidity from Ethereum to Optimism is ...
0
votes
0answers
13 views

index on a struct

The veCRV token from Curve includes the following lines of code: point_history: public(Point[100000000000000000000000000000]) # epoch -> unsigned point user_point_history: public(HashMap[address, ...
0
votes
2answers
48 views

Can send ERC20 tokens owned by contract but not by msg.sender

I have two methods: sendfromself() and getbalance() The only difference is that the first method, checks if the msg.sender has any coins in the ERC20 address supplied in the method's arguments, and if ...
0
votes
0answers
12 views

Can not send tokens to contract - Vyper

I have deployed a normal Vyper ERC20 contract and also created the below contract to interact with this. What I would like to do, is to transfer my ERC20 tokens to this contract (by calling the ...
1
vote
2answers
197 views

Swapping my own ERC20 token for USDC and back - Vyper contract

I want to create a very simple swap between my own ERC20 and USDC. I'm coding this all in Vyper and Python. One way I have envisaged this working is by monitoring the USDC Transfer events on the ...
0
votes
0answers
59 views

msg.sender and msg.value - do they work only for sent Etherum or do they work for ERC20 tokens sent to the contract too?

I'm starting to learn Vyper and I wanted to ask a question regarding msg.sender and msg.value If I created a simple contract that simply returns msg.sender and msg.value I understand that if I sent ...
1
vote
0answers
24 views

raw_call issues vyper

I am trying to do a swap using quickswap on polygon network with my contract below. After deploying my contract I get this error when executing the function: Internal JSON-RPC error. { "code"...
0
votes
0answers
22 views

Best practice for ecrecover in Vyper

What is the best practice for using ecrecover in Vyper? Because of signature malleability OpenZeppelin recommends to use their version of ecrecover for Solidity https://github.com/OpenZeppelin/...
2
votes
1answer
67 views

How to use Script from Brownie Dependency

I have a brownie project containing the source code for a Vault contract as well as it's deployment script. Badger-Vaults Containing the Vault.vy contract for vaults, as well as scripts/...
1
vote
1answer
29 views

What does this parameter mean in this curve fi function?

I am trying to add 22 dai to a polygon curve pool. Here is the function I am using: If I am trying to add 22 dai into the pool, what do I put for the parameters? Thanks!
0
votes
0answers
23 views

Vyper uint256 division with decimal precision

I am aware of this question here and the answer is correct however I am struggling to understand how to actually divide uint256 values with an arbitrary decimal precision Here is the function I am ...
1
vote
1answer
272 views

How to input decimal parameter in web3.py?

I have a contract with this abi [ { "stateMutability": "nonpayable", "type": "constructor", "inputs": [ {"name": "...
0
votes
0answers
25 views

Executing functions from a contract address

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol#L57 Line #57 of Address.sol is used to execute a transaction that transfers ether from the contract ...
1
vote
1answer
17 views

Simple Remix Fail

has anybody any idea why the following code cannot be compiled on REMIX with the VYPER COMPILER? @public @constant def hello() -> string[100]: return "hello world" Thanks!
0
votes
0answers
240 views

Remix: Gas estimation errored with the following message (see below). (...) execution reverted

I am trying to deploy a smart contract on remix written in VYPER. The code for the simple open auction comes from the vyper documentation website. Remix compiles the code perfectly fine. However, when ...
3
votes
0answers
35 views

How to make a multiplication and division without overflow and any loss of precision in Vyper

How can I calculate X * Y / Z in vyper uint256 without overflow and any loss of precision? I want to build Vyper FullMath library functions similar to the Uniswap V3 FullMath library written in ...
1
vote
1answer
134 views

How to replicate pushing and deleting from an array of structs from Solidity in Vyper?

I'm trying to re-create a Solidity contract in Vyper for a demonstration and am trying to figure out the best way to replicate adding/removing from an array of structs... As far as I can tell I'd have ...
0
votes
0answers
56 views

Vyper Smart Contract deployment using web3.py, Clique PoA

I am new to Blockchain Dapp development so bear with me if I sound a bit out of court. Coming from a Python background, I am trying to use web3.py to create, deploy and interact with vyper ^0.2.0 ...
1
vote
2answers
56 views

Vyper convert TypeMismatch error

I'm trying to use convert in Vyper but get the following error: vyper.exceptions.TypeMismatch: Expecting one of ('num_literal', 'int128', 'int256', 'bytes32', 'Bytes', 'address', 'bool', 'decimal') ...
1
vote
0answers
37 views

Convert uint256 to String[x] in vyper?

The documentation contains, as one of the Data Manipulation built in functions, the function concat(); the example given is @external @view def foo(a: String[5], b: String[5], c: String[5]) -> ...
0
votes
2answers
391 views

How to deploy a Vyper smart contract? Remix fails to compile

I have been trying all the solutions and tutorials I found on the Internet, with no success. Remix fails to compile vyper smart contracts in local and remote. How to make it work?
2
votes
0answers
167 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
1answer
38 views

full stack dapp clone example elastic supply algorithmic stablecoin

I'm new to vyper (but have some python experience), I would like to clone a very simple dapp to have a look at the full stack of an ethereum dapp from back end (write compile and deploy a simple ...
0
votes
1answer
136 views

I want to understand something with BigNumber assertions

I have create a truffle project with a smartcontract and a test file. Here is an extract of the test file: expect(ret).to.be.bignumber.equal(new BN('42')); ret is a value returned by a smartcontract'...
0
votes
0answers
27 views

try except in Vyper language

I want to call a function on an external contract from a Vyper contract. I want to handle a potential revert of this call. Python try...except is not implemented in Vyper. What should i do instead ? ...
0
votes
1answer
20 views

External call with Vyper

I want to call another contract from my vyper contract. I have read several tutorials and documentations and there is 2 ways to do that: First method: interface MyExternalContract: def ...
1
vote
1answer
15 views

vyper integer default value

Here is what i have read on this vyper official documentation: https://vyper.readthedocs.io/en/stable/types.html#initial-values int128 1 uint256 1 I have create this very basic smartcontract: ...
1
vote
1answer
42 views

Memory variables vs storage variables in Vyper

Is there a way to specify if a variable is memory or storage like we do in solidity ? Thanks
0
votes
1answer
58 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
1answer
44 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
1answer
178 views

Vyper binary fixed point vs Decimal fixed point

there is something i do not understand in Vyper documentation: https://vyper.readthedocs.io/en/stable/index.html Binary fixed point: Decimal fixed point is better, because any decimal fixed point ...
0
votes
1answer
24 views

Difference between @constant and @view on a smartcontract function

I am reading some vyper projects on github. I have seen 2 attributes on the line before the function name: @constant and @view According to documentation, this 2 attributes are saying the function may ...
0
votes
1answer
221 views

How to handle precision errors in solidity? [closed]

Say I have some division and the result is the answer is off-by-one. I've multiplied it by 10^18 to give the decimals but the issue is its still off by one. How do i stop repetitions of this ...
1
vote
1answer
21 views

Is there a gas cost incurred when creating a contract abstraction?

I have a smart contract in vyper (SomeContract) that gets called within another smart contract: some_contract: address = _some_contract SomeContract(some_contract).foo() # Is there a cost incurred ...
1
vote
1answer
87 views

Uniswap V1 Calculation of token_amount When Adding Liquidity

In the Exchange contract of Uniswap v1, the addLiquidity function involves calculating token_amount using the formula token_amount: uint256 = msg.value * token_reserve / eth_reserve + 1 Why is there ...
0
votes
1answer
185 views

Why is my view function running out of gas when reading from mapping/HashMap?

I have the following vyper code: address_to_addresses: public(HashMap[address, address[2]) Vyper auto generates a view function called address_to_addresses(arg0: address, arg1: uint256) -> address ...
0
votes
1answer
431 views

Contract to interact with another contract written in vyper

I am trying to interact with another contract (Curve finance) via my own contract. (eg get prices, to execute trades , etc) The thing is , the contract is written in Vyper. https://etherscan.io/...
0
votes
0answers
113 views

Transaction error thrown with Vyper smart contract in MetaMask

I am trying to troubleshoot a problem I'm having with a crowdsale contract (written in Vyper). The contract compiles fine, and I can deploy the contract to Rinkeby without any problems, however when I ...
1
vote
1answer
264 views

Is there a Vyper equivalent to OpenZeppelin's SafeERC20.safeTransfer?

OpenZeppelin provides the SafeERC20 Solidity library as a way to handle the possible variations of ERC20. Is there an equivalent way to do this using Vyper?
2
votes
1answer
110 views

Does Vyper have an equivalent CHAINID assembly function?

Since v0.5.12, Solidity provides a CHAINID OPCODE in assembly: function getChainID() external view returns (uint256) { uint256 id; assembly { id := chainid() } return id; } ...
1
vote
1answer
138 views

How do you create an array in vyper?

How do you create an array in vyper? I want to create the array below but vyper is confusion. Outcomes = [5, 500, 5000, 50000, 500000000, -1, -100, -1000, -10000, -100000, -500, -5000, -50000, -...
1
vote
0answers
64 views

vyper no mappings allowed when adding a function to initialize a struct that has a map inside

Version Information vyper Version (output of vyper --version): 0.1.0b17+commit.eaa6754 OS: Debian GNU/Linux 10 (buster) Python Version - 3.6.2 Environment (output of pip freeze): asttokens==2.0.3 ...
0
votes
1answer
51 views

Why 'Out of gas' error when there is still a lot of gas?

Gas limit was set to 6,000,000 Tx consumed just 1,943,125 Yet is still failed with Out of gas error. If it makes any difference, this is my contract which calls other contracts with raw_call (in ...
6
votes
3answers
4k views

Vyper vs. Solidity - benefits and differences

What are the benefits and differences of using Vyper over Solidity for smart contracts? Are there any other differences besides syntax? Are there any features for better developer experience (...
0
votes
1answer
61 views

How is contract code executed in Vyper?

I'm trying to execute my first contract on Ethereum. I've been able to compile and deploy one of Vyper's test examples of an auction. I believe the contract is executed when a transaction is sent to ...