make definition of tokens name and symbol during the deployment
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
		
							parent
							
								
									07c752754b
								
							
						
					
					
						commit
						a41cef0dfe
					
				| @ -72,6 +72,18 @@ RESERVE_MINT_RATE= | |||||||
| RESERVE_TOKEN_NAME= | RESERVE_TOKEN_NAME= | ||||||
| RESERVE_TOKEN_SYMBOL= | RESERVE_TOKEN_SYMBOL= | ||||||
| 
 | 
 | ||||||
|  | ## Name and symbol for the base token of the ghostDAO protocol | ||||||
|  | FATSO_TOKEN_NAME= | ||||||
|  | FATSO_TOKEN_SYMBOL= | ||||||
|  | 
 | ||||||
|  | ## Name and symbol for the staking token of the ghostDAO protocol | ||||||
|  | STINKY_TOKEN_NAME= | ||||||
|  | STINKY_TOKEN_SYMBOL= | ||||||
|  | 
 | ||||||
|  | ## Name and symbol for the bridging token of the ghostDAO protocol | ||||||
|  | GHOST_TOKEN_NAME= | ||||||
|  | GHOST_TOKEN_SYMBOL= | ||||||
|  | 
 | ||||||
| SEPOLIA_TEST_RPC_URL= | SEPOLIA_TEST_RPC_URL= | ||||||
| SEPOLIA_TEST_API_KEY= | SEPOLIA_TEST_API_KEY= | ||||||
| SEPOLIA_TEST_ENDPOINT= | SEPOLIA_TEST_ENDPOINT= | ||||||
|  | |||||||
| @ -7,9 +7,9 @@ import "./interfaces/IFTSO.sol"; | |||||||
| import "./types/GhostAccessControlled.sol"; | import "./types/GhostAccessControlled.sol"; | ||||||
| 
 | 
 | ||||||
| contract Fatso is ERC20Permit, IFTSO, GhostAccessControlled { | contract Fatso is ERC20Permit, IFTSO, GhostAccessControlled { | ||||||
|     constructor(address _authority) |     constructor(address _authority, string memory name, string memory symbol) | ||||||
|         ERC20("Fatso", "FTSO") |         ERC20(name, symbol) | ||||||
|         ERC20Permit("Fatso") |         ERC20Permit(name) | ||||||
|         GhostAccessControlled(IGhostAuthority(_authority)) |         GhostAccessControlled(IGhostAuthority(_authority)) | ||||||
|     {} |     {} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -13,7 +13,10 @@ contract Ghost is IGHST, ERC20, ERC20Permit, ERC20Votes { | |||||||
|     address public override stnk; |     address public override stnk; | ||||||
|     address private _initializer; |     address private _initializer; | ||||||
| 
 | 
 | ||||||
|     constructor(address _stnk) ERC20("Ghost", "GHST") ERC20Permit("Ghost") { |     constructor(address _stnk, string memory name, string memory symbol) | ||||||
|  |         ERC20(name, symbol) | ||||||
|  |         ERC20Permit(name) | ||||||
|  |     { | ||||||
|         stnk = _stnk; |         stnk = _stnk; | ||||||
|         _initializer = msg.sender; |         _initializer = msg.sender; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -27,7 +27,10 @@ contract Stinky is ISTNK, ERC20Permit { | |||||||
|     mapping(address => uint256) private _shares; |     mapping(address => uint256) private _shares; | ||||||
|     mapping(address => mapping(address => uint256)) private _allowedValue; |     mapping(address => mapping(address => uint256)) private _allowedValue; | ||||||
| 
 | 
 | ||||||
|     constructor(uint256 usedIndex) ERC20("Stinky", "STNK") ERC20Permit("Stinky") { |     constructor(uint256 usedIndex, string memory name, string memory symbol) | ||||||
|  |         ERC20(name, symbol) | ||||||
|  |         ERC20Permit(name) | ||||||
|  |     { | ||||||
|         _initializer = msg.sender; |         _initializer = msg.sender; | ||||||
|         _internalIndex = usedIndex; |         _internalIndex = usedIndex; | ||||||
|         _totalSupply = INITIAL_SHARES_SUPPLY; |         _totalSupply = INITIAL_SHARES_SUPPLY; | ||||||
|  | |||||||
| @ -16,9 +16,9 @@ contract GhostBondDepositoryTest is Test { | |||||||
|     uint256 public constant TOTAL_INITIAL_SUPPLY = 5000000000000000; |     uint256 public constant TOTAL_INITIAL_SUPPLY = 5000000000000000; | ||||||
|     uint256 public constant LARGE_APPROVAL   = 100000000000000000000000000000000; |     uint256 public constant LARGE_APPROVAL   = 100000000000000000000000000000000; | ||||||
|     uint256 public constant INITIAL_INDEX    = 10819917194513808e56; |     uint256 public constant INITIAL_INDEX    = 10819917194513808e56; | ||||||
|     uint48 public constant EPOCH_LENGTH     = 2200; |     uint48 public constant EPOCH_LENGTH      = 2200; | ||||||
|     uint48 public constant EPOCH_NUMBER     = 1; |     uint48 public constant EPOCH_NUMBER      = 1; | ||||||
|     uint48 public constant EPOCH_END_TIME   = 1337; |     uint48 public constant EPOCH_END_TIME    = 1337; | ||||||
| 
 | 
 | ||||||
|     uint256 public constant initialMint      = 10000000000000000000000000; |     uint256 public constant initialMint      = 10000000000000000000000000; | ||||||
|     uint256 public constant initialDeposit   = 1000000000000000000000000; |     uint256 public constant initialDeposit   = 1000000000000000000000000; | ||||||
| @ -59,9 +59,9 @@ contract GhostBondDepositoryTest is Test { | |||||||
|             vault |             vault | ||||||
|         ); |         ); | ||||||
|         reserve = new ERC20Mock("Reserve Token", "RET"); |         reserve = new ERC20Mock("Reserve Token", "RET"); | ||||||
|         ftso = new Fatso(address(authority)); |         ftso = new Fatso(address(authority), "Fatso", "FTSO"); | ||||||
|         stnk = new Stinky(INITIAL_INDEX); |         stnk = new Stinky(INITIAL_INDEX, "Stinky", "STNK"); | ||||||
|         ghst = new Ghost(address(stnk)); |         ghst = new Ghost(address(stnk), "Ghost", "GHST"); | ||||||
|         staking = new GhostStaking( |         staking = new GhostStaking( | ||||||
|             address(ftso), |             address(ftso), | ||||||
|             address(stnk), |             address(stnk), | ||||||
|  | |||||||
| @ -47,9 +47,9 @@ contract StakingTest is Test { | |||||||
|             policy, |             policy, | ||||||
|             vault |             vault | ||||||
|         ); |         ); | ||||||
|         ftso = new Fatso(address(authority)); |         ftso = new Fatso(address(authority), "Fatso", "FTSO"); | ||||||
|         stnk = new Stinky(INITIAL_INDEX); |         stnk = new Stinky(INITIAL_INDEX, "Stinky", "STNK"); | ||||||
|         ghst = new Ghost(address(stnk)); |         ghst = new Ghost(address(stnk), "Ghost", "GHST"); | ||||||
|         staking = new GhostStaking( |         staking = new GhostStaking( | ||||||
|             address(ftso), |             address(ftso), | ||||||
|             address(stnk), |             address(stnk), | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ contract StakingDistributorTest is Test { | |||||||
|     uint48 public constant EPOCH_LENGTH   = 2200; |     uint48 public constant EPOCH_LENGTH   = 2200; | ||||||
|     uint48 public constant EPOCH_NUMBER   = 1; |     uint48 public constant EPOCH_NUMBER   = 1; | ||||||
|     uint48 public constant EPOCH_END_TIME = 1337; |     uint48 public constant EPOCH_END_TIME = 1337; | ||||||
|      | 
 | ||||||
|     uint256 public constant INITIAL_INDEX  = 10819917194513808e56; |     uint256 public constant INITIAL_INDEX  = 10819917194513808e56; | ||||||
|     uint256 public constant amount = 69 * 1e18; |     uint256 public constant amount = 69 * 1e18; | ||||||
| 
 | 
 | ||||||
| @ -47,9 +47,9 @@ contract StakingDistributorTest is Test { | |||||||
|             owner |             owner | ||||||
|         ); |         ); | ||||||
|         reserve = new ERC20Mock("Reserve Token", "RET"); |         reserve = new ERC20Mock("Reserve Token", "RET"); | ||||||
|         ftso = new Fatso(address(authority)); |         ftso = new Fatso(address(authority), "Fatso", "FTSO"); | ||||||
|         stnk = new Stinky(INITIAL_INDEX); |         stnk = new Stinky(INITIAL_INDEX, "Stinky", "STNK"); | ||||||
|         ghst = new Ghost(address(stnk)); |         ghst = new Ghost(address(stnk), "Ghost", "GHST"); | ||||||
|         staking = new GhostStaking( |         staking = new GhostStaking( | ||||||
|             address(ftso), |             address(ftso), | ||||||
|             address(stnk), |             address(stnk), | ||||||
|  | |||||||
| @ -20,6 +20,9 @@ contract FatsoTest is Test, ERC20PermitTest, ERC20AllowanceTest, ERC20TransferTe | |||||||
|     uint256 constant amount            = 69; |     uint256 constant amount            = 69; | ||||||
|     uint256 constant maxAmount         = type(uint256).max; |     uint256 constant maxAmount         = type(uint256).max; | ||||||
| 
 | 
 | ||||||
|  |     string constant name               = "Fatso Test Name"; | ||||||
|  |     string constant symbol             = "FTSOTST"; | ||||||
|  | 
 | ||||||
|     function setUp() public { |     function setUp() public { | ||||||
|         authority = new GhostAuthority( |         authority = new GhostAuthority( | ||||||
|             deployer, |             deployer, | ||||||
| @ -27,7 +30,7 @@ contract FatsoTest is Test, ERC20PermitTest, ERC20AllowanceTest, ERC20TransferTe | |||||||
|             deployer, |             deployer, | ||||||
|             vault |             vault | ||||||
|         ); |         ); | ||||||
|         token = new Fatso(address(authority)); |         token = new Fatso(address(authority), name, symbol); | ||||||
|         initializePermit(address(token), amount, maxAmount); |         initializePermit(address(token), amount, maxAmount); | ||||||
|         initializeAllowance(alice, bob, address(token), amount, maxAmount, amount); |         initializeAllowance(alice, bob, address(token), amount, maxAmount, amount); | ||||||
|         initializeTransfer(alice, bob, address(token), amount, 0); |         initializeTransfer(alice, bob, address(token), amount, 0); | ||||||
| @ -48,8 +51,8 @@ contract FatsoTest is Test, ERC20PermitTest, ERC20AllowanceTest, ERC20TransferTe | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function test_correctlyConstructsAnERC20() public view { |     function test_correctlyConstructsAnERC20() public view { | ||||||
|         assertEq(token.name(), "Fatso"); |         assertEq(token.name(), name); | ||||||
|         assertEq(token.symbol(), "FTSO"); |         assertEq(token.symbol(), symbol); | ||||||
|         assertEq(token.decimals(), 9); |         assertEq(token.decimals(), 9); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -28,6 +28,9 @@ contract GhostTest is | |||||||
|     uint256 constant amount            = 69; |     uint256 constant amount            = 69; | ||||||
|     uint256 constant maxAmount         = type(uint256).max; |     uint256 constant maxAmount         = type(uint256).max; | ||||||
| 
 | 
 | ||||||
|  |     string constant name               = "Ghost Test Name"; | ||||||
|  |     string constant symbol             = "GHSTTST"; | ||||||
|  | 
 | ||||||
|     Stinky stnk; |     Stinky stnk; | ||||||
|     Ghost ghst; |     Ghost ghst; | ||||||
|     GhostAuthority public authority; |     GhostAuthority public authority; | ||||||
| @ -41,8 +44,8 @@ contract GhostTest is | |||||||
|             initializer, |             initializer, | ||||||
|             initializer |             initializer | ||||||
|         ); |         ); | ||||||
|         stnk = new Stinky(INITIAL_INDEX); |         stnk = new Stinky(INITIAL_INDEX, "Stinky", "STNK"); | ||||||
|         ghst = new Ghost(address(stnk)); |         ghst = new Ghost(address(stnk), name, symbol); | ||||||
|         staking = new GhostStaking( |         staking = new GhostStaking( | ||||||
|             address(0), |             address(0), | ||||||
|             address(stnk), |             address(stnk), | ||||||
| @ -63,8 +66,8 @@ contract GhostTest is | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function test_isConstructedCorrectly() public view { |     function test_isConstructedCorrectly() public view { | ||||||
|         assertEq(ghst.name(), "Ghost"); |         assertEq(ghst.name(), name); | ||||||
|         assertEq(ghst.symbol(), "GHST"); |         assertEq(ghst.symbol(), symbol); | ||||||
|         assertEq(ghst.decimals(), 18); |         assertEq(ghst.decimals(), 18); | ||||||
|         assertEq(ghst.staking(), address(staking)); |         assertEq(ghst.staking(), address(staking)); | ||||||
|         assertEq(ghst.stnk(), address(stnk)); |         assertEq(ghst.stnk(), address(stnk)); | ||||||
|  | |||||||
| @ -35,6 +35,9 @@ contract StinkyTest is Test, ERC20PermitTest, ERC20AllowanceTest, ERC20TransferT | |||||||
|     uint256 constant amount            = 69; |     uint256 constant amount            = 69; | ||||||
|     uint256 constant maxAmount         = type(uint256).max; |     uint256 constant maxAmount         = type(uint256).max; | ||||||
| 
 | 
 | ||||||
|  |     string constant name               = "Stinky Test Name"; | ||||||
|  |     string constant symbol             = "STNKTST"; | ||||||
|  | 
 | ||||||
|     event Transfer(address indexed from, address indexed to, uint256 value); |     event Transfer(address indexed from, address indexed to, uint256 value); | ||||||
|     event LogStakingContractUpdated(address stakingContract); |     event LogStakingContractUpdated(address stakingContract); | ||||||
| 
 | 
 | ||||||
| @ -46,9 +49,9 @@ contract StinkyTest is Test, ERC20PermitTest, ERC20AllowanceTest, ERC20TransferT | |||||||
|             initializer, |             initializer, | ||||||
|             initializer |             initializer | ||||||
|         ); |         ); | ||||||
|         ftso = new Fatso(address(authority)); |         ftso = new Fatso(address(authority), "Fatso", "FTSO"); | ||||||
|         stnk = new Stinky(INITIAL_INDEX); |         stnk = new Stinky(INITIAL_INDEX, name, symbol); | ||||||
|         ghst = new Ghost(address(stnk)); |         ghst = new Ghost(address(stnk), "Ghost", "GHST"); | ||||||
|         staking = new GhostStaking( |         staking = new GhostStaking( | ||||||
|             address(ftso), |             address(ftso), | ||||||
|             address(stnk), |             address(stnk), | ||||||
| @ -67,8 +70,8 @@ contract StinkyTest is Test, ERC20PermitTest, ERC20AllowanceTest, ERC20TransferT | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function test_isConstructedCorrectly() public view { |     function test_isConstructedCorrectly() public view { | ||||||
|         assertEq(stnk.name(), "Stinky"); |         assertEq(stnk.name(), name); | ||||||
|         assertEq(stnk.symbol(), "STNK"); |         assertEq(stnk.symbol(), symbol); | ||||||
|         assertEq(stnk.decimals(), 9); |         assertEq(stnk.decimals(), 9); | ||||||
|         assertEq(stnk.totalSupply(), TOTAL_INITIAL_SUPPLY); |         assertEq(stnk.totalSupply(), TOTAL_INITIAL_SUPPLY); | ||||||
|         assertEq(stnk.index(), INITIAL_INDEX / (TOTAL_SHARES / INITIAL_SHARES_SUPPLY)); |         assertEq(stnk.index(), INITIAL_INDEX / (TOTAL_SHARES / INITIAL_SHARES_SUPPLY)); | ||||||
| @ -246,7 +249,7 @@ contract StinkyTest is Test, ERC20PermitTest, ERC20AllowanceTest, ERC20TransferT | |||||||
|         uint256 prevIndex = stnk.index(); |         uint256 prevIndex = stnk.index(); | ||||||
|         _mintTokens(alice, amount); |         _mintTokens(alice, amount); | ||||||
|         assertEq(stnk.balanceOf(alice), amount); |         assertEq(stnk.balanceOf(alice), amount); | ||||||
|          | 
 | ||||||
|         vm.prank(address(staking)); |         vm.prank(address(staking)); | ||||||
|         stnk.rebase(0, epoch); |         stnk.rebase(0, epoch); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ contract GhostTreasuryTest is Test { | |||||||
|         ); |         ); | ||||||
|         reserve = new ERC20Mock("Reserve Token", "RET"); |         reserve = new ERC20Mock("Reserve Token", "RET"); | ||||||
|         liquidity = new ERC20Mock("Liquidity Token", "LDT"); |         liquidity = new ERC20Mock("Liquidity Token", "LDT"); | ||||||
|         ftso = new Fatso(address(authority)); |         ftso = new Fatso(address(authority), "Fatso", "FTSO"); | ||||||
|         treasury = new GhostTreasury(address(ftso), 69, address(authority)); |         treasury = new GhostTreasury(address(ftso), 69, address(authority)); | ||||||
|         calculator = new GhostBondingCalculator(address(ftso)); |         calculator = new GhostBondingCalculator(address(ftso)); | ||||||
|         vm.stopPrank(); |         vm.stopPrank(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user