Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
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
28 changes: 12 additions & 16 deletions contracts/root/predicates/ERC20PredicateBurnOnly.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ contract ERC20PredicateBurnOnly is IErcPredicate {
ExitPayloadReader.ExitPayload memory payload = data.toExitPayload();
ExitPayloadReader.Receipt memory receipt = payload.getReceipt();
uint256 logIndex = payload.getReceiptLogIndex();
require(logIndex < MAX_LOGS, "Supporting a max of 10 logs");
//require(logIndex < MAX_LOGS, "Supporting a max of 10 logs");
// Alternative example :
//require(logIndex < 50, "Supporting a max of 50 logs");

uint256 age = withdrawManager.verifyInclusion(
data,
0, /* offset */
Expand All @@ -48,24 +51,17 @@ contract ERC20PredicateBurnOnly is IErcPredicate {
ExitPayloadReader.LogTopics memory topics = log.getTopics();
// now, inputItems[i] refers to i-th (0-based) topic in the topics array
// event Withdraw(address indexed token, address indexed from, uint256 amountOrTokenId, uint256 input1, uint256 output1)
require(
bytes32(topics.getField(0).toUint()) == WITHDRAW_EVENT_SIG,
"Not a withdraw event signature"
);
require(
msg.sender == address(topics.getField(2).toUint()), // from
"Withdrawer and burn exit tx do not match"
);
require(bytes32(topics.getField(0).toUint()) == WITHDRAW_EVENT_SIG, "Not a withdraw event signature");
// Need to skip this check because we aren't the exitor
// require(
// msg.sender == address(topics.getField(2).toUint()), // from
// "Withdrawer and burn exit tx do not match"
// );
address rootToken = address(topics.getField(1).toUint());
uint256 exitAmount = BytesLib.toUint(log.getData(), 0); // amountOrTokenId
// Need to pass in the actual exitor here, not msg.sender
withdrawManager.addExitToQueue(
msg.sender,
childToken,
rootToken,
exitAmount,
bytes32(0x0),
true, /* isRegularExit */
age << 1
address(topics.getField(2).toUint()), childToken, rootToken, exitAmount, bytes32(0x0), true, /* isRegularExit */ age << 1
);
}

Expand Down
Loading