Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add context to SystemContract onDepositCall #64

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions contracts/zevm/SystemContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface SystemContractErrors {
error ZeroAddress();
}


andresaiello marked this conversation as resolved.
Show resolved Hide resolved
/**
* @dev The system contract it's called by the protocol to interact with the blockchain.
* Also includes a lot of tools to make easier to interact with ZetaChain.
Expand Down Expand Up @@ -65,12 +66,12 @@ contract SystemContract is SystemContractErrors {
* @param target, contract address to make a call after deposit.
* @param message, calldata for a call.
*/
function depositAndCall(address zrc20, uint256 amount, address target, bytes calldata message) external {
function depositAndCall(Context calldata context, address zrc20, uint256 amount, address target, bytes calldata message) external {
if (msg.sender != FUNGIBLE_MODULE_ADDRESS) revert CallerIsNotFungibleModule();
if (target == FUNGIBLE_MODULE_ADDRESS || target == address(this)) revert InvalidTarget();

IZRC20(zrc20).deposit(target, amount);
zContract(target).onCrossChainCall(zrc20, amount, message);
zContract(target).onCrossChainCall(context, zrc20, amount, message);
}

/**
Expand Down
10 changes: 9 additions & 1 deletion contracts/zevm/interfaces/zContract.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

struct Context {
bytes origin;
andresaiello marked this conversation as resolved.
Show resolved Hide resolved
address sender;
uint256 chainID;
}

interface zContract {
function onCrossChainCall(address zrc20, uint256 amount, bytes calldata message) external;
function onCrossChainCall(Context calldata context, address zrc20, uint256 amount, bytes calldata message) external;
}


5 changes: 2 additions & 3 deletions pkg/contracts/evm/erc20custody.sol/erc20custody.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions pkg/contracts/evm/interfaces/zetaerrors.sol/zetaerrors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading