-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from RootstockCollective/dao-709
I'm merging this branch to immediately open a new pull request based on it, which will include the upgrade of the stRif contract to the code presented in this branch/PR.
- Loading branch information
Showing
7 changed files
with
280 additions
and
2 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,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
interface ICollectiveRewardsCheck { | ||
function canWithdraw(address targetAddress, uint256 value) external view returns (bool); | ||
} |
11 changes: 11 additions & 0 deletions
11
contracts/test/ContractDoesNotSupportERC165andIBIMcheck.sol
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,11 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
contract ContractDoesNotSupportERC165andICollectiveRewardscheck { | ||
constructor() {} | ||
|
||
function foo() internal pure returns (string memory) { | ||
return "foo"; | ||
} | ||
} |
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,17 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts/interfaces/IERC165.sol"; | ||
|
||
contract ContractDoesNotSupportICollectiveRewardsCheck is IERC165 { | ||
constructor() {} | ||
|
||
function foo() internal pure returns (string memory) { | ||
return "foo"; | ||
} | ||
|
||
function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { | ||
return interfaceId == type(IERC165).interfaceId; | ||
} | ||
} |
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,32 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts/interfaces/IERC165.sol"; | ||
|
||
import {ICollectiveRewardsCheck} from "../interfaces/ICollectiveRewardsCheck.sol"; | ||
|
||
contract ContractSupportsERC165andICollectiveRewardscheck is IERC165, ICollectiveRewardsCheck { | ||
address public blockedAddress; | ||
|
||
constructor(address _blockedAddress) { | ||
blockedAddress = _blockedAddress; | ||
} | ||
|
||
function setBlockedAddress(address _blockedAddress) external { | ||
blockedAddress = _blockedAddress; | ||
} | ||
|
||
function canWithdraw(address target, uint256 value) external view returns (bool) { | ||
if (target == blockedAddress || value < 0) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} | ||
|
||
function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { | ||
return | ||
interfaceId == type(IERC165).interfaceId || interfaceId == type(ICollectiveRewardsCheck).interfaceId; | ||
} | ||
} |
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,33 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
import "@openzeppelin/contracts/interfaces/IERC165.sol"; | ||
|
||
import {ICollectiveRewardsCheck} from "../interfaces/ICollectiveRewardsCheck.sol"; | ||
|
||
contract ContractWithErrorInCanWithdraw is IERC165, ICollectiveRewardsCheck { | ||
address public blockedAddress; | ||
|
||
constructor(address _blockedAddress) { | ||
blockedAddress = _blockedAddress; | ||
} | ||
|
||
function setBlockedAddress(address _blockedAddress) external { | ||
blockedAddress = _blockedAddress; | ||
} | ||
|
||
function canWithdraw(address target, uint256 value) external view returns (bool) { | ||
require(target == address(0), "JUST A DUMMY ERROR IS TARGET IS NOT A ZERO ADDRESS"); | ||
if (target == blockedAddress || value < 0) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} | ||
|
||
function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { | ||
return | ||
interfaceId == type(IERC165).interfaceId || interfaceId == type(ICollectiveRewardsCheck).interfaceId; | ||
} | ||
} |
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