Skip to content

Commit

Permalink
Take token symbol from constructor args in TestERC20 contract (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
prathamesh0 authored Aug 9, 2023
1 parent 5180a78 commit 96d6a60
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contracts/test/TestERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity =0.7.6;
import '@openzeppelin/contracts/drafts/ERC20Permit.sol';

contract TestERC20 is ERC20Permit {
constructor(uint256 amountToMint) ERC20('Test ERC20', 'TEST') ERC20Permit('Test ERC20') {
constructor(uint256 amountToMint, string memory symbol) ERC20('Test ERC20', symbol) ERC20Permit('Test ERC20') {
_mint(msg.sender, amountToMint);
}
}
2 changes: 1 addition & 1 deletion contracts/test/TestERC20PermitAllowed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../interfaces/external/IERC20PermitAllowed.sol';

// has a fake permit that just uses the other signature type for type(uint256).max
contract TestERC20PermitAllowed is TestERC20, IERC20PermitAllowed {
constructor(uint256 amountToMint) TestERC20(amountToMint) {}
constructor(uint256 amountToMint) TestERC20(amountToMint, "TEST") {}

function permit(
address holder,
Expand Down
3 changes: 2 additions & 1 deletion deploy/TestERC20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ const func: DeployFunction = async function ({
const existingDeployments = await deployments.all()
const n = Object.keys(existingDeployments).filter(key => key.startsWith('TestERC20')).length;
const nextDeployment = `TestERC20-${n}`
const tokenSymbol = `TEST-${n}`

await deploy(nextDeployment, {
from: deployer,
// args from test/shared/completeFixture.ts
args: [ethers.constants.MaxUint256.div(2)],
args: [ethers.constants.MaxUint256.div(2), tokenSymbol],
log: true,
deterministicDeployment: false,
contract: 'TestERC20'
Expand Down

0 comments on commit 96d6a60

Please sign in to comment.