Skip to content

Commit

Permalink
(fix) Actually transfer funds. Still doesn't work, but we're getting …
Browse files Browse the repository at this point in the history
…closer.
  • Loading branch information
rrw-zilliqa committed Jul 12, 2024
1 parent d956983 commit 4c57d7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ contract LockProxyTokenManagerUpgradeableV3 is TokenManagerUpgradeableV3, ILockP
LockProxy lp = LockProxy(payable(lockProxyAddress));
// Sadly, extensionTransfer() takes the same arguments as the withdrawn event but in a
// different order. This will automagically transfer native token if token==0.
lp.extensionTransfer(recipient, token, amount);

// Native tokens are transferred by the call; for everyone else, it sets an allowance and we
// then do the transfer from here.
if (token == address(0)) {
lp.extensionTransfer(recipient, address(0), amount);
} else {
lp.extensionTransfer(address(this), token, amount);
IERC20 erc20token = IERC20(token);
erc20token.transferFrom(address(lp), recipient, amount);
}
emit WithdrawnFromLockProxy(token, recipient, amount);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ contract ZilBridgeTokenBridgeIntegrationTest is ZilBridgeTokenBridgeIntegrationF
// To
abi.encode(ITokenManagerStructs.AcceptArgs(address(remoteNativelyOnSource), remoteUser, amount)));

// approval goes to the token manager, which will transfer value to/from the lock proxy for you.
nativelyOnSource.approve(address(sourceTokenManager), amount);

// Ask the source token manager to take the source tokens and emit a relayed event
Expand Down

0 comments on commit 4c57d7a

Please sign in to comment.