Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions contracts/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ contract Bridge is Pausable, AccessControl {

event KeyRefresh();

event Retry(string txHash);

modifier onlyAdmin() {
_onlyAdmin();
_;
Expand Down Expand Up @@ -301,6 +303,14 @@ contract Bridge is Pausable, AccessControl {
emit KeyRefresh();
}

/**
@notice This method is used to trigger the process for retrying failed deposits on the MPC side.
@param txHash Transaction hash which contains deposit that should be retried
*/
function retry(string memory txHash) external {
emit Retry(txHash);
}

/**
@notice Returns a boolean value.
@param domainID ID of chain deposit originated from.
Expand Down
38 changes: 38 additions & 0 deletions test/contractBridge/publicMethods.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright 2020 ChainSafe Systems
* SPDX-License-Identifier: LGPL-3.0-only
*/
const TruffleAssert = require('truffle-assertions');
const Ethers = require('ethers');

const Helpers = require('../helpers');

const BridgeContract = artifacts.require("Bridge");

// This test does NOT include all getter methods, just
// getters that should work with only the constructor called
contract('Bridge - [public]', async (accounts) => {
const domainID = 1;

const txHash = "0x59d881e01ca682130e550e3576b6de760951fb45b1d5dd81342132f57920bbfa";

let BridgeInstance;


beforeEach(async () => {
BridgeInstance = await BridgeContract.new(domainID);

// set MPC address to unpause the Bridge
await BridgeInstance.endKeygen(Helpers.mpcAddress);
});

// Testing public methods

it('Should successfully emit Retry event', async () => {
const eventTx = await BridgeInstance.retry(txHash);

TruffleAssert.eventEmitted(eventTx, 'Retry', (event) => {
return event.txHash === txHash
});
});
});