-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
820 additions
and
277 deletions.
There are no files selected for viewing
This file contains 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 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,55 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.9; | ||
|
||
import "../interfaces/IBridgeTracking.sol"; | ||
import "../interfaces/collections/IHasBridgeTrackingContract.sol"; | ||
|
||
contract MockGatewayForTracking is IHasBridgeTrackingContract { | ||
/// @dev The bridge tracking contract | ||
IBridgeTracking internal _bridgeTrackingContract; | ||
|
||
constructor(address __bridgeTrackingContract) { | ||
_setBridgeTrackingContract(__bridgeTrackingContract); | ||
} | ||
|
||
/** | ||
* @inheritdoc IHasBridgeTrackingContract | ||
*/ | ||
function bridgeTrackingContract() external view returns (address) { | ||
return address(_bridgeTrackingContract); | ||
} | ||
|
||
/** | ||
* @inheritdoc IHasBridgeTrackingContract | ||
*/ | ||
function setBridgeTrackingContract(address _addr) external { | ||
require(_addr.code.length > 0, "RoninGatewayV2: set to non-contract"); | ||
_setBridgeTrackingContract(_addr); | ||
} | ||
|
||
/** | ||
* @dev Sets the bridge tracking contract. | ||
* | ||
* Emits the event `BridgeTrackingContractUpdated`. | ||
* | ||
*/ | ||
function _setBridgeTrackingContract(address _addr) internal { | ||
_bridgeTrackingContract = IBridgeTracking(_addr); | ||
emit BridgeTrackingContractUpdated(_addr); | ||
} | ||
|
||
function sendBallot( | ||
IBridgeTracking.VoteKind _kind, | ||
uint256 _id, | ||
address[] memory _voters | ||
) external { | ||
for (uint256 _i; _i < _voters.length; _i++) { | ||
_bridgeTrackingContract.recordVote(_kind, _id, _voters[_i]); | ||
} | ||
} | ||
|
||
function sendApprovedVote(IBridgeTracking.VoteKind _kind, uint256 _id) external { | ||
_bridgeTrackingContract.handleVoteApproved(_kind, _id); | ||
} | ||
} |
This file contains 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 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
Oops, something went wrong.