-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Uniswap can not work with 256bit unsigned int tokens #7825
Comments
Update: Manually creating the pool and depositing works however doing so completelty breaks the interface and renders uniswap unusable. Error
|
Closing the pools restores functionality. |
@JABirchall thanks for the report, can you provide a contract for testing? |
Sure, here is a 77-digit pi ERC20 contract i was going to do which requires the full 265bit UINT space. // SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.22;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import {ERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
contract PI77Coin is ERC20, ERC20Permit, ERC20Burnable {
constructor()
ERC20("PI", "PI")
ERC20Permit("PI77DIGITS") {
_mint(msg.sender, 31415926535897932384626433832795028841971693993751058209749445923078164062862);
}
function decimals() public override virtual pure returns(uint8) {
return 76;
}
} |
Do you have one already deployed? |
Ive been playing around with some tokens and tried making a token where the total supply is 1 with 76 decimal places. (The maxium amount that can be stored in a 256 uint)
10000000000000000000000000000000000000000000000000000000000000000000000000000
Upon attempting to create a pool on uniswap for this, it would not work, kept giving invalid price errors, price out of range or just unknown error.
I did some further investigating and found 38 decimal places worked find, this convineantly is the maximum amount in a 128 bit uint.
100000000000000000000000000000000000000
As smart contracts and the ERC20 token standard uses the 256uint, uniswap should fully support 256bit uints. But it looks like you guys decided to only support 128bit uints.
I checked V2 and V3 both cant handle a full 256bit uint token.
The text was updated successfully, but these errors were encountered: