Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ install-deps:
.PHONY: test
test:
@echo " > \033[32mTesting contracts... \033[0m "
npx truffle test
npx truffle test ./test/retry/retry.js

compile:
@echo " > \033[32mCompiling contracts... \033[0m "
Expand Down
24 changes: 24 additions & 0 deletions contracts/Retry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

pragma solidity 0.8.11;

import "@openzeppelin/contracts/access/Ownable.sol";

contract Retry is Ownable {

event Retry(uint8 sourceDomainID, uint8 destinationDomainID, uint256 blockHeight, bytes32 resourceID);

/**
@notice This method is used to trigger the process for retrying failed deposits on the MPC side.
@notice Only callable by admin.
@param sourceDomainID ID of the retry source.
@param destinationDomainID ID of the transfer destination.
@param blockHeight Block height on origin chain which contains failed deposits.
@param resourceID Resource ID of transfers that are to be retried.
*/
function retry(uint8 sourceDomainID, uint8 destinationDomainID, uint256 blockHeight, bytes32 resourceID) external onlyOwner {
emit Retry(sourceDomainID, destinationDomainID, blockHeight, resourceID);
}

}
42 changes: 42 additions & 0 deletions test/retry/retry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// The Licensed Work is (c) 2022 Sygma
// SPDX-License-Identifier: LGPL-3.0-only

const TruffleAssert = require("truffle-assertions");
const Retry = artifacts.require("Retry")

contract("Retry", (accounts) => {
let RetryInstance;

const sourceDomainID = 1;
const destinationDomainID = 2;
const blockHeight = 15;
const resourceID = "0x0000000000000000000000000000000000000000000000000000000000000300";

beforeEach(async () => {
RetryInstance = await Retry.new(accounts[0]);
});

it("should emit Retry event when retry is called by the owner", async () => {
const tx = await RetryInstance.retry(
sourceDomainID,
destinationDomainID,
blockHeight,
resourceID,
{from: accounts[0]})

TruffleAssert.eventEmitted(tx, "Retry", (event) => {
return (
event.sourceDomainID.toNumber() === sourceDomainID &&
event.destinationDomainID.toNumber() === destinationDomainID &&
event.blockHeight.toNumber() === blockHeight &&
event.resourceID === resourceID
);
});
});

it("should revert when startFROSTKeygen is not called by the owner", async () => {
Comment thread
mpetrun5 marked this conversation as resolved.
Outdated
await TruffleAssert.reverts(
RetryInstance.retry(sourceDomainID, destinationDomainID, blockHeight, resourceID, {from: accounts[1]}),
)
});
})