-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update contracts for coordinator test
- Loading branch information
Showing
2 changed files
with
96 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "../threshold/ITACoChildApplication.sol"; | ||
|
||
/** | ||
* @notice Contract for testing Coordinator contract | ||
*/ | ||
contract ChildApplicationForCoordinatorMock is ITACoChildApplication { | ||
mapping(address => uint96) public authorizedStake; | ||
mapping(address => address) public operatorFromStakingProvider; | ||
mapping(address => address) public stakingProviderFromOperator; | ||
mapping(address => bool) public confirmations; | ||
|
||
function updateOperator(address _stakingProvider, address _operator) external { | ||
address oldOperator = operatorFromStakingProvider[_stakingProvider]; | ||
stakingProviderFromOperator[oldOperator] = address(0); | ||
operatorFromStakingProvider[_stakingProvider] = _operator; | ||
stakingProviderFromOperator[_operator] = _stakingProvider; | ||
} | ||
|
||
function updateAuthorization(address _stakingProvider, uint96 _amount) external { | ||
authorizedStake[_stakingProvider] = _amount; | ||
} | ||
|
||
function confirmOperatorAddress(address _operator) external { | ||
confirmations[_operator] = true; | ||
} | ||
} | ||
|
||
// /** | ||
// * @notice Intermediary contract for testing operator | ||
// */ | ||
// contract Intermediary { | ||
// TACoApplication public immutable application; | ||
|
||
// constructor(TACoApplication _application) { | ||
// application = _application; | ||
// } | ||
|
||
// function bondOperator(address _operator) external { | ||
// application.bondOperator(address(this), _operator); | ||
// } | ||
|
||
// function confirmOperatorAddress() external { | ||
// application.confirmOperatorAddress(); | ||
// } | ||
// } |
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,47 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "../contracts/coordination/ITACoRootToChild.sol"; | ||
import "../contracts/coordination/ITACoChildToRoot.sol"; | ||
|
||
/** | ||
* @notice Contract for testing TACo child application contract | ||
*/ | ||
contract RootApplicationForTACoChildApplicationMock { | ||
ITACoRootToChild public childApplication; | ||
|
||
mapping(address => bool) public confirmations; | ||
|
||
function setChildApplication(ITACoRootToChild _childApplication) external { | ||
childApplication = _childApplication; | ||
} | ||
|
||
function updateOperator(address _stakingProvider, address _operator) external { | ||
childApplication.updateOperator(_stakingProvider, _operator); | ||
} | ||
|
||
function updateAuthorization(address _stakingProvider, uint96 _amount) external { | ||
childApplication.updateAuthorization(_stakingProvider, _amount); | ||
} | ||
|
||
function confirmOperatorAddress(address _operator) external { | ||
confirmations[_operator] = true; | ||
} | ||
|
||
function resetConfirmation(address _operator) external { | ||
confirmations[_operator] = false; | ||
} | ||
} | ||
|
||
contract CoordinatorForTACoChildApplicationMock { | ||
ITACoChildToRoot public immutable application; | ||
|
||
constructor(ITACoChildToRoot _application) { | ||
application = _application; | ||
} | ||
|
||
function confirmOperatorAddress(address _operator) external { | ||
application.confirmOperatorAddress(_operator); | ||
} | ||
} |