Skip to content

Commit 605d50e

Browse files
committed
dispatcher in storage
1 parent 9b1b2d5 commit 605d50e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/usdc_migration/src/usdc_migration.cairo

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ pub mod USDCMigration {
99
#[storage]
1010
struct Storage {
1111
/// The phased out token being swapped for the new one.
12-
// TODO: Consider change to dispatcher.
13-
legacy_token: ContractAddress,
12+
legacy_token_dispatcher: IERC20Dispatcher,
1413
/// The new token swapping the legacy one.
15-
// TODO: Consider change to dispatcher.
16-
new_token: ContractAddress,
14+
new_token_dispatcher: IERC20Dispatcher,
1715
/// Ethereum address to which the legacy token is bridged.
1816
l1_recipient: EthAddress,
1917
/// Address in L2 that gets the remaining USDC.
@@ -36,14 +34,14 @@ pub mod USDCMigration {
3634
owner_l2_address: ContractAddress,
3735
starkgate_address: ContractAddress,
3836
) {
39-
self.legacy_token.write(legacy_token);
40-
self.new_token.write(new_token);
37+
let legacy_dispatcher = IERC20Dispatcher { contract_address: legacy_token };
38+
let new_dispatcher = IERC20Dispatcher { contract_address: new_token };
39+
self.legacy_token_dispatcher.write(legacy_dispatcher);
40+
self.new_token_dispatcher.write(new_dispatcher);
4141
self.l1_recipient.write(l1_recipient);
4242
self.owner_l2_address.write(owner_l2_address);
4343
self.starkgate_address.write(starkgate_address);
4444
// Infinite approval to l2 address for both legacy and new tokens.
45-
let legacy_dispatcher = IERC20Dispatcher { contract_address: legacy_token };
46-
let new_dispatcher = IERC20Dispatcher { contract_address: new_token };
4745
legacy_dispatcher.approve(spender: owner_l2_address, amount: MAX_U256);
4846
new_dispatcher.approve(spender: owner_l2_address, amount: MAX_U256);
4947
}

0 commit comments

Comments
 (0)