Skip to content

Commit

Permalink
fix(protocol): add address manager to taiko token (#16394)
Browse files Browse the repository at this point in the history
Co-authored-by: Keszey Dániel <[email protected]>
  • Loading branch information
adaki2004 and Keszey Dániel authored Mar 11, 2024
1 parent 713bef3 commit c64ec19
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
6 changes: 4 additions & 2 deletions packages/protocol/contracts/L1/TaikoToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp
/// @param _name The name of the token.
/// @param _symbol The symbol of the token.
/// @param _recipient The address to receive initial token minting.
/// @param _addressManager The AddressManager address.
function init(
address _owner,
string calldata _name,
string calldata _symbol,
address _recipient
address _recipient,
address _addressManager
)
public
initializer
{
__Essential_init(_owner);
__Essential_init(_owner, _addressManager);
__ERC20_init(_name, _symbol);
__ERC20Snapshot_init();
__ERC20Votes_init();
Expand Down
3 changes: 2 additions & 1 deletion packages/protocol/script/DeployOnL1.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ contract DeployOnL1 is DeployCapability {
timelock,
vm.envString("TAIKO_TOKEN_NAME"),
vm.envString("TAIKO_TOKEN_SYMBOL"),
vm.envAddress("TAIKO_TOKEN_PREMINT_RECIPIENT")
vm.envAddress("TAIKO_TOKEN_PREMINT_RECIPIENT"),
address(sharedAddressManager)
)
),
registerTo: sharedAddressManager
Expand Down
3 changes: 2 additions & 1 deletion packages/protocol/test/L1/TaikoL1TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ abstract contract TaikoL1TestBase is TaikoTest {
name: "taiko_token",
impl: address(new TaikoToken()),
data: abi.encodeCall(
TaikoToken.init, (address(0), "Taiko Token", "TTKOk", address(this))
TaikoToken.init,
(address(0), "Taiko Token", "TTKOk", address(this), address(addressManager))
),
registerTo: address(addressManager)
})
Expand Down
19 changes: 10 additions & 9 deletions packages/protocol/test/tokenvault/ERC20Vault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,25 @@ contract TestERC20Vault is TaikoTest {
vm.deal(Carol, 1 ether);
vm.deal(Bob, 1 ether);

addressManager = AddressManager(
deployProxy({
name: "address_manager",
impl: address(new AddressManager()),
data: abi.encodeCall(AddressManager.init, (address(0)))
})
);

tko = TaikoToken(
deployProxy({
name: "taiko_token",
impl: address(new TaikoToken()),
data: abi.encodeCall(
TaikoToken.init, (address(0), "Taiko Token", "TTKOk", address(this))
TaikoToken.init,
(address(0), "Taiko Token", "TTKOk", address(this), address(addressManager))
)
})
);

addressManager = AddressManager(
deployProxy({
name: "address_manager",
impl: address(new AddressManager()),
data: abi.encodeCall(AddressManager.init, (address(0)))
})
);

addressManager.setAddress(uint64(block.chainid), "taiko_token", address(tko));

erc20Vault = ERC20Vault(
Expand Down

0 comments on commit c64ec19

Please sign in to comment.