This repository was archived by the owner on Mar 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
feat: retry contract #259
Merged
Merged
feat: retry contract #259
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9b3731f
Add retry contract
mpetrun5 2749932
Add additional fields
mpetrun5 1a4c408
Change retry contract name
mpetrun5 1401431
Update docstrings
mpetrun5 d1a234d
Update test
mpetrun5 067057c
Fix test condition
mpetrun5 3f523e3
Fix retry test expectation
mpetrun5 be15f97
Improve retry tests
mpetrun5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 () => { | ||
| await TruffleAssert.reverts( | ||
| RetryInstance.retry(sourceDomainID, destinationDomainID, blockHeight, resourceID, {from: accounts[1]}), | ||
| ) | ||
| }); | ||
| }) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.