-
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 #1 from onchainification/feat/tests
test: initial structure for covering all key scenarios
- Loading branch information
Showing
7 changed files
with
393 additions
and
21 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 @@ | ||
{ "solidity.formatter": "forge" } |
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,109 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.25; | ||
|
||
interface IKeeperRegistrar { | ||
type AutoApproveType is uint8; | ||
|
||
struct InitialTriggerConfig { | ||
uint8 triggerType; | ||
AutoApproveType autoApproveType; | ||
uint32 autoApproveMaxAllowed; | ||
} | ||
|
||
struct RegistrationParams { | ||
string name; | ||
bytes encryptedEmail; | ||
address upkeepContract; | ||
uint32 gasLimit; | ||
address adminAddress; | ||
uint8 triggerType; | ||
bytes checkData; | ||
bytes triggerConfig; | ||
bytes offchainConfig; | ||
uint96 amount; | ||
} | ||
|
||
struct TriggerRegistrationStorage { | ||
AutoApproveType autoApproveType; | ||
uint32 autoApproveMaxAllowed; | ||
uint32 approvedCount; | ||
} | ||
|
||
error AmountMismatch(); | ||
error FunctionNotPermitted(); | ||
error HashMismatch(); | ||
error InsufficientPayment(); | ||
error InvalidAdminAddress(); | ||
error InvalidDataLength(); | ||
error LinkTransferFailed(address to); | ||
error OnlyAdminOrOwner(); | ||
error OnlyLink(); | ||
error RegistrationRequestFailed(); | ||
error RequestNotFound(); | ||
error SenderMismatch(); | ||
|
||
event AutoApproveAllowedSenderSet(address indexed senderAddress, bool allowed); | ||
event ConfigChanged(address keeperRegistry, uint96 minLINKJuels); | ||
event OwnershipTransferRequested(address indexed from, address indexed to); | ||
event OwnershipTransferred(address indexed from, address indexed to); | ||
event RegistrationApproved(bytes32 indexed hash, string displayName, uint256 indexed upkeepId); | ||
event RegistrationRejected(bytes32 indexed hash); | ||
event RegistrationRequested( | ||
bytes32 indexed hash, | ||
string name, | ||
bytes encryptedEmail, | ||
address indexed upkeepContract, | ||
uint32 gasLimit, | ||
address adminAddress, | ||
uint8 triggerType, | ||
bytes triggerConfig, | ||
bytes offchainConfig, | ||
bytes checkData, | ||
uint96 amount | ||
); | ||
event TriggerConfigSet(uint8 triggerType, AutoApproveType autoApproveType, uint32 autoApproveMaxAllowed); | ||
|
||
function LINK() external view returns (address); | ||
function acceptOwnership() external; | ||
function approve( | ||
string memory name, | ||
address upkeepContract, | ||
uint32 gasLimit, | ||
address adminAddress, | ||
uint8 triggerType, | ||
bytes memory checkData, | ||
bytes memory triggerConfig, | ||
bytes memory offchainConfig, | ||
bytes32 hash | ||
) external; | ||
function cancel(bytes32 hash) external; | ||
function getAutoApproveAllowedSender(address senderAddress) external view returns (bool); | ||
function getConfig() external view returns (address keeperRegistry, uint256 minLINKJuels); | ||
function getPendingRequest(bytes32 hash) external view returns (address, uint96); | ||
function getTriggerRegistrationDetails(uint8 triggerType) | ||
external | ||
view | ||
returns (TriggerRegistrationStorage memory); | ||
function onTokenTransfer(address sender, uint256 amount, bytes memory data) external; | ||
function owner() external view returns (address); | ||
function register( | ||
string memory name, | ||
bytes memory encryptedEmail, | ||
address upkeepContract, | ||
uint32 gasLimit, | ||
address adminAddress, | ||
uint8 triggerType, | ||
bytes memory checkData, | ||
bytes memory triggerConfig, | ||
bytes memory offchainConfig, | ||
uint96 amount, | ||
address sender | ||
) external; | ||
function registerUpkeep(RegistrationParams memory requestParams) external returns (uint256); | ||
function setAutoApproveAllowedSender(address senderAddress, bool allowed) external; | ||
function setConfig(address keeperRegistry, uint96 minLINKJuels) external; | ||
function setTriggerConfig(uint8 triggerType, AutoApproveType autoApproveType, uint32 autoApproveMaxAllowed) | ||
external; | ||
function transferOwnership(address to) external; | ||
function typeAndVersion() external view returns (string memory); | ||
} |
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 |
---|---|---|
@@ -1,29 +1,106 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.25; | ||
pragma solidity ^0.8.4; | ||
|
||
interface IGnosisSafe { | ||
event DisabledModule(address module); | ||
event EnabledModule(address module); | ||
|
||
enum Operation { | ||
Call, | ||
DelegateCall | ||
} | ||
|
||
/// @dev Allows a Module to execute a Safe transaction without any further confirmations. | ||
/// @param to Destination address of module transaction. | ||
/// @param value Ether value of module transaction. | ||
/// @param data Data payload of module transaction. | ||
/// @param operation Operation type of module transaction. | ||
function execTransactionFromModule(address to, uint256 value, bytes calldata data, Operation operation) | ||
external | ||
returns (bool success); | ||
event AddedOwner(address owner); | ||
event ApproveHash(bytes32 indexed approvedHash, address indexed owner); | ||
event ChangedMasterCopy(address masterCopy); | ||
event ChangedThreshold(uint256 threshold); | ||
event DisabledModule(address module); | ||
event EnabledModule(address module); | ||
event ExecutionFailure(bytes32 txHash, uint256 payment); | ||
event ExecutionFromModuleFailure(address indexed module); | ||
event ExecutionFromModuleSuccess(address indexed module); | ||
event ExecutionSuccess(bytes32 txHash, uint256 payment); | ||
event RemovedOwner(address owner); | ||
event SignMsg(bytes32 indexed msgHash); | ||
|
||
function enableModule(address module) external; | ||
fallback() external payable; | ||
|
||
function NAME() external view returns (string memory); | ||
function VERSION() external view returns (string memory); | ||
function addOwnerWithThreshold(address owner, uint256 _threshold) external; | ||
function approveHash(bytes32 hashToApprove) external; | ||
function approvedHashes(address, bytes32) external view returns (uint256); | ||
function changeMasterCopy(address _masterCopy) external; | ||
function changeThreshold(uint256 _threshold) external; | ||
function disableModule(address prevModule, address module) external; | ||
|
||
function domainSeparator() external view returns (bytes32); | ||
function enableModule(address module) external; | ||
function encodeTransactionData( | ||
address to, | ||
uint256 value, | ||
bytes memory data, | ||
Operation operation, | ||
uint256 safeTxGas, | ||
uint256 baseGas, | ||
uint256 gasPrice, | ||
address gasToken, | ||
address refundReceiver, | ||
uint256 _nonce | ||
) external view returns (bytes memory); | ||
function execTransaction( | ||
address to, | ||
uint256 value, | ||
bytes memory data, | ||
Operation operation, | ||
uint256 safeTxGas, | ||
uint256 baseGas, | ||
uint256 gasPrice, | ||
address gasToken, | ||
address payable refundReceiver, | ||
bytes memory signatures | ||
) external returns (bool success); | ||
function execTransactionFromModule(address to, uint256 value, bytes memory data, Operation operation) | ||
external | ||
returns (bool success); | ||
function execTransactionFromModuleReturnData(address to, uint256 value, bytes memory data, Operation operation) | ||
external | ||
returns (bool success, bytes memory returnData); | ||
function getMessageHash(bytes memory message) external view returns (bytes32); | ||
function getModules() external view returns (address[] memory); | ||
|
||
function isModuleEnabled(address module) external view returns (bool); | ||
function getModulesPaginated(address start, uint256 pageSize) | ||
external | ||
view | ||
returns (address[] memory array, address next); | ||
function getOwners() external view returns (address[] memory); | ||
function getThreshold() external view returns (uint256); | ||
function getTransactionHash( | ||
address to, | ||
uint256 value, | ||
bytes memory data, | ||
Operation operation, | ||
uint256 safeTxGas, | ||
uint256 baseGas, | ||
uint256 gasPrice, | ||
address gasToken, | ||
address refundReceiver, | ||
uint256 _nonce | ||
) external view returns (bytes32); | ||
function isOwner(address owner) external view returns (bool); | ||
function isValidSignature(bytes memory _data, bytes memory _signature) external returns (bytes4); | ||
function nonce() external view returns (uint256); | ||
function removeOwner(address prevOwner, address owner, uint256 _threshold) external; | ||
function requiredTxGas(address to, uint256 value, bytes memory data, Operation operation) | ||
external | ||
returns (uint256); | ||
function setFallbackHandler(address handler) external; | ||
function setup( | ||
address[] memory _owners, | ||
uint256 _threshold, | ||
address to, | ||
bytes memory data, | ||
address fallbackHandler, | ||
address paymentToken, | ||
uint256 payment, | ||
address payable paymentReceiver | ||
) external; | ||
function signMessage(bytes memory _data) external; | ||
function signedMessages(bytes32) external view returns (uint256); | ||
function swapOwner(address prevOwner, address oldOwner, address newOwner) external; | ||
} |
Oops, something went wrong.