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
0 answers
21 views

How do I write redistribution and reflection based tokens using Vyper?

I'm writing a redistribution of reflection based tokens using Vyper, I've added a _swapTokensForETH function to my code which acts to swap my coins for DAI via Uniswap, if I'm only doing transfer ...
user avatar
  • 11
0 votes
0 answers
32 views

Has anyone gotten Brownie developer revert comments to work with Vyper?

When I try to use Brownie developer revert comments with a Vyper contract as described in the Brownie documentation here: Developer Revert Comments Brownie does not seem to recognize the comments. ...
user avatar
0 votes
0 answers
21 views

Vyper convert address to String

How do I convert a variable of type address to a string[n] in Vyper? For example, to achieve a function where only part of the address is displayed as 0xABCD...ABCD instead of the entire address. Here ...
user avatar
0 votes
2 answers
59 views

General function to withdraw any ERC-20/ ERC-721 token sent to a contract

I am deploying a contract today. Tomorrow if some user mistakenly sends ETH to my contract, I can retrieve or return it if I have implemented a payable and a send function. @external @payable def ...
user avatar
0 votes
1 answer
34 views

Initialize hashmap with values in vyper

When using hashmaps in Vyper, can we initialize it directly with more than one value? I am currently looping over a separate list of addresses in the constructor. allowedAdmins: HashMap[address, bool] ...
user avatar
0 votes
0 answers
56 views

Failed to call Uniswap "swapExactTokensForTokens" in a contract

I'm using Vyper to write a contract to realize the transaction function of calling uniswap, but it can't be used normally after deployment. I don't know where there is a problem. I'm very confused. Do ...
user avatar
  • 11
0 votes
0 answers
13 views

How should I write tx to swap ETH for sETH in curve pool?

I try to write script to swap ETH/sETH. but the result is always revert. const amountIn = new hre.ethers.utils.parseEther("1"); const amountMin = await curveContract.get_dy(0, 1, amountIn); ...
user avatar
  • 1
1 vote
1 answer
23 views

Hash two addresses in vyper

I'm trying to write a function in vyper that takes two addresses and returns a 256-bit hash (either keccak256 or sha256). Afaik the builtin hash functions only take Bytes, bytes32 and Strings as ...
user avatar
  • 113
0 votes
0 answers
27 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: ...
user avatar
0 votes
0 answers
31 views

How to properly use Vyper to call Uniswap?

I'm using vyper to write a contract that can call Uniswap to add liquidity, I use the function of raw_call, but it doesn't seem to work, the contract is deployed on rinkeby, I don't know what's going ...
user avatar
  • 11
1 vote
0 answers
94 views

How to use Vyper to call PancakeSwap contract

I'm writing a Vyper contract to call the swapExactTokensForTokens function of PancakeSwap, but when I try to deploy, I find it doesn't work. I don't know what happened. I really need help. This is my ...
user avatar
  • 11
0 votes
0 answers
12 views

Can I take interface of vyper file in solidity file

There are some contracts in .vy file extension that is vyper language. I want to take an interface if it in solidity file. Is it possible to do that? If you, can anyone provide any examples or any ...
user avatar
0 votes
1 answer
19 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? (...
user avatar
0 votes
0 answers
180 views

Why am I getting an Internal JSON-RPC error for calling one state variable from my contract but not on another very similar variable?

I am using ethers.js in Svelte to communicate with my Vyper contract currently deployed to the Avalanche FUJI testnet for a basic social networking app. When I call this state variable from my ...
user avatar
0 votes
0 answers
18 views

How to deploy vyper contract with arguments using truffle?

I am trying to deploy a contract written in Vyper using Truffle migrations, but the parameters I am passing to deployer.deploy() are not being used in the vyper contract initialize() function. Is ...
user avatar
0 votes
0 answers
46 views

How to use vyper's external_interface in brownie?

An external interface can be generated by vyper as such: vyper -f external_interface contracts/CurveCryptoSwap.vy Doing that results in the following output: # External Interfaces interface ...
user avatar
0 votes
0 answers
55 views

Formulas behind liquidity pool (constant formula)

I'm trying to understand (implement) a liquidity pool. However, I have a hard time trying to understand how to calculate a provider's LP tokens (stakes). Reading Uniswap v1 whitepaper I see this ...
user avatar
1 vote
1 answer
29 views

Failing transaction [not out of gas] but error during execution of function

I am new on smart contracts and have been experimenting with vyper and deploying a smart contract to Ropsten network. I am calling a function on my contract and my transaction is failing. But I have ...
user avatar
0 votes
1 answer
77 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?
user avatar
  • 123
0 votes
1 answer
62 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....
user avatar
0 votes
1 answer
13 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" ...
user avatar
  • 123
1 vote
0 answers
14 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 ...
user avatar
  • 123
0 votes
0 answers
29 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 ...
user avatar
  • 123
1 vote
0 answers
46 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 ...
user avatar
0 votes
0 answers
52 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, ...
user avatar
0 votes
2 answers
95 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 ...
user avatar
0 votes
0 answers
29 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 ...
user avatar
1 vote
2 answers
443 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 ...
user avatar
0 votes
0 answers
378 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 ...
user avatar
1 vote
0 answers
47 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"...
user avatar
0 votes
0 answers
35 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/...
user avatar
2 votes
1 answer
118 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/...
user avatar
  • 33
1 vote
1 answer
68 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!
user avatar
0 votes
0 answers
55 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 ...
user avatar
1 vote
1 answer
509 views

How to input decimal parameter in web3.py?

I have a contract with this abi [ { "stateMutability": "nonpayable", "type": "constructor", "inputs": [ {"name": "...
user avatar
0 votes
0 answers
36 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 ...
user avatar
1 vote
1 answer
25 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!
user avatar
  • 9
3 votes
0 answers
65 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 ...
user avatar
  • 116
1 vote
1 answer
286 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 ...
user avatar
  • 111
1 vote
2 answers
109 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') ...
user avatar
1 vote
0 answers
75 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]) -> ...
user avatar
0 votes
2 answers
823 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?
user avatar
  • 19
2 votes
0 answers
242 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[...
user avatar
0 votes
1 answer
54 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 ...
user avatar
0 votes
1 answer
299 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'...
user avatar
  • 1,029
0 votes
0 answers
37 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 ? ...
user avatar
  • 1,029
0 votes
1 answer
36 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 ...
user avatar
  • 1,029
1 vote
1 answer
24 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: ...
user avatar
  • 1,029
1 vote
1 answer
75 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
user avatar
  • 1,029
0 votes
1 answer
132 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
user avatar
  • 1,029