mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
insta-automation-connector: polygon
Signed-off-by: pradyuman-verma <pradyumnverma27@gmail.com>
This commit is contained in:
parent
1e78276bb2
commit
dd7e907c33
11
contracts/polygon/connectors/insta-automation/events.sol
Normal file
11
contracts/polygon/connectors/insta-automation/events.sol
Normal file
|
@ -0,0 +1,11 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract Events {
|
||||
event LogCancelAutomation();
|
||||
|
||||
event LogSubmitAutomation(uint256 safeHF, uint256 thresholdHF);
|
||||
|
||||
event LogUpdateAutomation(uint256 safeHF, uint256 thresholdHF);
|
||||
}
|
17
contracts/polygon/connectors/insta-automation/interfaces.sol
Normal file
17
contracts/polygon/connectors/insta-automation/interfaces.sol
Normal file
|
@ -0,0 +1,17 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
interface InstaAaveAutomation {
|
||||
function submitAutomationRequest(
|
||||
uint256 safeHealthFactor,
|
||||
uint256 thresholdHealthFactor
|
||||
) external;
|
||||
|
||||
function cancelAutomationRequest() external;
|
||||
|
||||
function updateAutomation(
|
||||
uint256 safeHealthFactor,
|
||||
uint256 thresholdHealthFactor
|
||||
) external;
|
||||
}
|
64
contracts/polygon/connectors/insta-automation/main.sol
Normal file
64
contracts/polygon/connectors/insta-automation/main.sol
Normal file
|
@ -0,0 +1,64 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
/**
|
||||
* @title InstaAutomation
|
||||
* @dev Insta-Aave-v3-Automation
|
||||
*/
|
||||
|
||||
import "./events.sol";
|
||||
import "./interfaces.sol";
|
||||
|
||||
abstract contract Resolver is Events {
|
||||
InstaAaveAutomation internal immutable automation =
|
||||
InstaAaveAutomation(0x4dDc35489042db14434E19cE205963aa72Ecd722);
|
||||
|
||||
function submitAutomationRequest(
|
||||
uint256 safeHealthFactor,
|
||||
uint256 thresholdHealthFactor
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
automation.submitAutomationRequest(
|
||||
safeHealthFactor,
|
||||
thresholdHealthFactor
|
||||
);
|
||||
|
||||
(_eventName, _eventParam) = (
|
||||
"LogSubmitAutomation(uint256,uint256)",
|
||||
abi.encode(safeHealthFactor, thresholdHealthFactor)
|
||||
);
|
||||
}
|
||||
|
||||
function cancelAutomationRequest()
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
automation.cancelAutomationRequest();
|
||||
(_eventName, _eventParam) = ("LogCancelAutomation()", "0x");
|
||||
}
|
||||
|
||||
function updateAutomationRequest(
|
||||
uint256 safeHealthFactor,
|
||||
uint256 thresholdHealthFactor
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
automation.updateAutomation(safeHealthFactor, thresholdHealthFactor);
|
||||
|
||||
(_eventName, _eventParam) = (
|
||||
"LogUpdateAutomation(uint256,uint256)",
|
||||
abi.encode(safeHealthFactor, thresholdHealthFactor)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectV2InstaAaveAutomation is Resolver {
|
||||
string public constant name = "Insta-Aave-Automation-v1";
|
||||
}
|
Loading…
Reference in New Issue
Block a user