-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: improve existing tests and add new ones (#10)
* test: create tests draft for `YieldStreamerPrimary` contract * test: fix test failures * test: reorganize and improve existing tests * style: fix formatting issues in the Hardhat config file * test: improve tests and add new ones * test: fix a strange Codacy issue * test: fix a strange Codacy issue once again --------- Co-authored-by: Igor Senych <[email protected]>
- Loading branch information
1 parent
bc563f0
commit d10fd31
Showing
11 changed files
with
3,307 additions
and
1,420 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,72 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import { IYieldStreamerV1 } from "../interfaces/IYieldStreamerV1.sol"; | ||
|
||
/** | ||
* @title YieldStreamerV1Mock contract | ||
* @author CloudWalk Inc. (See https://www.cloudwalk.io) | ||
* @dev An implementation of the {YieldStreamerV1} contract for testing purposes. | ||
*/ | ||
contract YieldStreamerV1Mock is IYieldStreamerV1 { | ||
/** | ||
* @dev Emitted when an blocklist function is called. | ||
*/ | ||
event YieldStreamerV1Mock_BlocklistCalled(address account); | ||
|
||
// ------------------ Storage---- ----------------------------- // | ||
|
||
mapping(address => ClaimResult) private _claimAllPreview; | ||
mapping(address => bool) private _isBlocklister; | ||
|
||
// ------------------ IYieldStreamerV1 ------------------------ // | ||
|
||
/** | ||
* @inheritdoc IYieldStreamerV1 | ||
*/ | ||
function claimAllPreview(address account) external view returns (ClaimResult memory) { | ||
return _claimAllPreview[account]; | ||
} | ||
|
||
/** | ||
* @inheritdoc IYieldStreamerV1 | ||
*/ | ||
function blocklist(address account) external { | ||
emit YieldStreamerV1Mock_BlocklistCalled(account); | ||
} | ||
|
||
/** | ||
* @inheritdoc IYieldStreamerV1 | ||
*/ | ||
function isBlocklister(address account) external view returns (bool) { | ||
return _isBlocklister[account]; | ||
} | ||
|
||
/** | ||
* @inheritdoc IYieldStreamerV1 | ||
*/ | ||
function getAccountGroup(address account) external view returns (bytes32) { | ||
return bytes32(0); | ||
} | ||
|
||
// ------------------ Functions ------------------------------- // | ||
|
||
/** | ||
* @dev Sets the preview result for a given account. | ||
* @param account The address of the account to set the preview for. | ||
* @param preview The preview result to set for the account. | ||
*/ | ||
function setClaimAllPreview(address account, ClaimResult memory preview) external { | ||
_claimAllPreview[account] = preview; | ||
} | ||
|
||
/** | ||
* @dev Sets the blocklister status for a given account. | ||
* @param account The address of the account to set the blocklister status for. | ||
* @param isBlocklister_ The blocklister status to set for the account. | ||
*/ | ||
function setBlocklister(address account, bool isBlocklister_) external { | ||
_isBlocklister[account] = isBlocklister_; | ||
} | ||
} |
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
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
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.