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
0answers
12 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
14 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
41 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/...
0
votes
0answers
16 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
15 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
128 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
18 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
14 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
204 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
28 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
73 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
31 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
41 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
30 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
243 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
135 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
31 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
79 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
21 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
0answers
10 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
11 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
36 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
40 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
38 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
87 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
22 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
137 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
19 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
81 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
128 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
0answers
50 views

How is address comparison done in Vyper?

In solidity, you can do this: address_1 < address_2 But the same code is not possible in vyper. How can I compare which address is larger than the other in vyper?
0
votes
0answers
9 views

What are LLL_codes in Vyper and how do I define those for built-in functions?

I need to create a custom compiler for Vyper with only one addition - set of new built-in functions. How can one do that? I have managed to find file containing all of them, yet I had no luck to find ...
0
votes
1answer
345 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
94 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
235 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
95 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
102 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
54 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
38 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 ...
3
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
53 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 ...
0
votes
2answers
45 views

Bytecode: Does it Reveal What Language it Was Programmed In?

Does EVM bytecode have some indication to what high-level language it was programmed in?
1
vote
1answer
112 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 ...
3
votes
0answers
31 views

does vyper support contracts making contracts?

I am trying to create manager contract that generates player contracts for a game. Right now I am using vyper to try and generate new contracts but that seems to be failing. I know you can have a ...
1
vote
1answer
107 views

Vyper fundraising smart contract: 'Attribute' object has no attribute 'func'

[SOLVED]: See below. I am taking a blockchain and security class and we are working with vyper. We have been tasked with rewriting a fundraising smart contract. However, the compilers do not seem to ...
2
votes
1answer
202 views

How to setup an oracle in Vyper?

I need an ETH-USD price oracle for my vyper contract. So far, the oracle services I've found, like chainlink, are written in solidity. Is it possible to use a solidity oracle in a vyper contract? How ...
0
votes
0answers
53 views

How to correctly send Ether between contracts in vyper?

I have a user, Contract A, and Contract B. I want user to call a function A of Contract A, that function executes function B from Contract B, which sends ether from Contract B to Contract A. Here is ...
0
votes
1answer
22 views

Truffle Contract Abstraction Contract.at() not returning logs when methods are called

In my test file I have this set up: let acc = await Account.deployed() Then when I call a method, I can get the logs in the receipt: let deposit = await acc.deposit() console.log(deposit.receipt....
2
votes
1answer
160 views

Reference contract own address in vyper

how do you reference your own contract address in vyper, for example in solidity you would do something like that: address(this) Is there a way to do the same in vyper? Thanks.
0
votes
0answers
220 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 ...