Commit 03289ebf authored by smartcontracts's avatar smartcontracts Committed by GitHub

feat: add ops drippie deployments (#10541)

Updates the periphery deploy to also deploy a Drippie contract to
be used for standard operational drips.
parent a533f524
......@@ -23,3 +23,6 @@
[submodule "packages/contracts-bedrock/lib/lib-keccak"]
path = packages/contracts-bedrock/lib/lib-keccak
url = https://github.com/ethereum-optimism/lib-keccak
[submodule "packages/contracts-bedrock/lib/automate"]
path = packages/contracts-bedrock/lib/automate
url = https://github.com/gelatodigital/automate
......@@ -20,6 +20,7 @@ remappings = [
'ds-test/=lib/forge-std/lib/ds-test/src',
'safe-contracts/=lib/safe-contracts/contracts',
'kontrol-cheatcodes/=lib/kontrol-cheatcodes/src',
'gelato/=lib/automate/contracts'
]
extra_output = ['devdoc', 'userdoc', 'metadata', 'storageLayout']
bytecode_hash = 'none'
......
Subproject commit 0117585fea20ff0cd24fd17bf74a6debaa4d57d2
{
"faucetAdmin": "0x212E789D4523D4BAF464f8Fb2A9B9dff2B36e5A6",
"create2DeploymentSalt": "0.0.2",
"gelatoAutomateContract": "0x2A6C106ae13B558BB9E2Ec64Bd2f1f7BEFF3A5E0",
"gelatoTreasuryContract": "0x7506C12a824d73D9b08564d5Afc22c949434755e",
"operationsDrippieOwner": "0x03C256F7Ae7518D0fe489F257ab4b928D37CBE16",
"operationsSequencerDripV1Target": "0x8F23BB38F531600e5d8FDDaAEC41F13FaB46E98c",
"operationsSequencerDripV1Value": 20000000000000000000,
"operationsSequencerDripV1Interval": 86400,
"operationsSequencerDripV1Threshold": 100000000000000000000,
"operationsGelatoDripV1Recipient": "0x03C256F7Ae7518D0fe489F257ab4b928D37CBE16",
"operationsGelatoDripV1Value": 1000000000000000000,
"operationsGelatoDripV1Interval": 86400,
"operationsGelatoDripV1Threshold": 500000000000000000,
"operationsSecretsDripV1Delay": 43200,
"operationsSecretsDripV1MustExist": "0x565fa8c7daa859353b5b328b97b12c7d66c5832b2a24d4e0f739a65ad266a46f",
"operationsSecretsDripV1MustNotExist": "0xbc362b01d69a85dff1793803dde67df1f338f37a36fdc73dddf27283d215e614",
"operationsSecretsDripV1Target": "0x03C256F7Ae7518D0fe489F257ab4b928D37CBE16",
"operationsSecretsDripV1Value": 1000000000000000000,
"operationsSecretsDripV1Interval": 3600,
"faucetDrippieOwner": "0x10ab157483dd308f8B38aCF2ad823dfD255F56b5",
"faucetDripV1Value": 20000000000000000000,
"faucetDripV1Interval": 3600,
"faucetDripV1Threshold": 100000000000000000000,
"faucetDripV2Value": 500000000000000000000,
"faucetDripV2Interval": 604800,
"faucetDripV2Threshold": 20000000000000000000,
"faucetDripV2Value": 500000000000000000000,
"faucetAdminDripV1Value": 1000000000000000000,
"faucetAdminDripV1Interval": 86400,
"faucetAdminDripV1Threshold": 100000000000000000,
"faucetAdminDripV1Value": 1000000000000000000,
"faucetGelatoTreasury": "0x644CB00854EDC55FE8CCC9c1967BABb22F08Ad2f",
"faucetGelatoRecipient": "0x0E9b4649eB0760A4F01646636E032D68cFDe58FF",
"faucetGelatoBalanceV1DripInterval": 86400,
"faucetGelatoBalanceV1Value": 1000000000000000000,
"faucetGelatoThreshold": 100000000000000000,
"smallOpChainFaucetDripValue": 34000000000000000000,
"smallOpChainFaucetDripInterval": 86400,
"largeOpChainFaucetDripValue": 34000000000000000000,
"largeOpChainFaucetDripInterval": 86400,
"opChainAdminWalletDripValue": 1000000000000000000,
"opChainAdminWalletDripInterval": 2592000,
"faucetAdmin": "0x212E789D4523D4BAF464f8Fb2A9B9dff2B36e5A6",
"faucetOnchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC",
"faucetOnchainAuthModuleTtl": 86400,
"faucetOnchainAuthModuleAmount": 1000000000000000000,
"faucetOffchainAuthModuleAdmin": "0xFe44Ae787A632c45ACea658492dDBebE39f002aC",
"faucetOffchainAuthModuleTtl": 86400,
"faucetOffchainAuthModuleAmount": 50000000000000000,
"opL1BridgeAddress": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1",
"baseL1BridgeAddress": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120",
"pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3",
"zoraL1BridgeAddress": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB",
"pgnL1BridgeAddress": "0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3",
"orderlyL1BridgeAddress": "0x1Af0494040d6904A9F3EE21921de4b359C736333",
"modeL1BridgeAddress": "0xbC5C679879B2965296756CD959C3C739769995E2",
"lyraL1BridgeAddress": "0x915f179A77FB2e1AeA8b56Ebc0D75A7e1A8a7A17",
"liskL1BridgeAddress": "0x1Fb30e446eA791cd1f011675E5F3f5311b70faF5",
"installOpChainFaucetsDrips": true,
"deployDripchecks": true,
"deployFaucetContracts": false,
"deployOperationsContracts": true,
"installOpChainFaucetsDrips": false,
"archivePreviousOpChainFaucetsDrips": false,
"dripVersion": 3,
"previousDripVersion": 2,
"smallOpChainFaucetDripValue": 34000000000000000000,
"smallOpChainFaucetDripInterval": 86400,
"largeOpChainFaucetDripValue": 34000000000000000000,
"largeOpChainFaucetDripInterval": 86400,
"opChainAdminWalletDripValue": 1000000000000000000,
"opChainAdminWalletDripInterval": 2592000
"previousDripVersion": 2
}
......@@ -249,6 +249,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "_name",
"type": "string"
}
],
"name": "getDripInterval",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
......
......@@ -251,4 +251,11 @@ contract Drippie is AssetReceiver {
function getDripStatus(string calldata _name) public view returns (DripStatus) {
return drips[_name].status;
}
/// @notice Returns the interval of a given drip.
/// @param _name Drip to check.
/// @return Interval of the given drip.
function getDripInterval(string calldata _name) public view returns (uint256) {
return drips[_name].config.interval;
}
}
......@@ -4,7 +4,8 @@ pragma solidity 0.8.15;
import { IDripCheck } from "../IDripCheck.sol";
interface IGelatoTreasury {
function userTokenBalance(address _user, address _token) external view returns (uint256);
function totalDepositedAmount(address _user, address _token) external view returns (uint256);
function totalWithdrawnAmount(address _user, address _token) external view returns (uint256);
}
/// @title CheckGelatoLow
......@@ -24,11 +25,19 @@ contract CheckGelatoLow is IDripCheck {
function check(bytes memory _params) external view returns (bool execute_) {
Params memory params = abi.decode(_params, (Params));
// Check GelatoTreasury ETH balance is below threshold.
execute_ = IGelatoTreasury(params.treasury).userTokenBalance(
params.recipient,
// Gelato represents ETH as 0xeeeee....eeeee
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
) < params.threshold;
// Gelato represents ETH as 0xeeeee....eeeee.
address eth = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
// Get the total deposited amount.
uint256 deposited = IGelatoTreasury(params.treasury).totalDepositedAmount(params.recipient, eth);
// Get the total withdrawn amount.
uint256 withdrawn = IGelatoTreasury(params.treasury).totalWithdrawnAmount(params.recipient, eth);
// Figure out the current balance.
uint256 balance = deposited - withdrawn;
// Check if the balance is below the threshold.
execute_ = balance < params.threshold;
}
}
......@@ -5,23 +5,26 @@ import { Test } from "forge-std/Test.sol";
import { CheckGelatoLow, IGelatoTreasury } from "src/periphery/drippie/dripchecks/CheckGelatoLow.sol";
/// @title MockGelatoTreasury
/// @notice Mocks the Gelato treasury for testing purposes. Allows arbitrary
/// setting of user balances.
/// @notice Mocks the Gelato treasury for testing purposes. Allows arbitrary setting of balances.
contract MockGelatoTreasury is IGelatoTreasury {
mapping(address => mapping(address => uint256)) private tokenBalances;
mapping(address => mapping(address => uint256)) private totalDeposited;
mapping(address => mapping(address => uint256)) private totalWithdrawn;
function setTokenBalance(address _user, address _token, uint256 _balance) external {
tokenBalances[_token][_user] = _balance;
function totalDepositedAmount(address _user, address _token) external view override returns (uint256) {
return totalDeposited[_token][_user];
}
function userTokenBalance(address _user, address _token) external view returns (uint256) {
return tokenBalances[_token][_user];
function totalWithdrawnAmount(address _user, address _token) external view override returns (uint256) {
return totalWithdrawn[_token][_user];
}
function setTotalDepositedAmount(address _user, address _token, uint256 _amount) external {
totalDeposited[_token][_user] = _amount;
}
}
/// @title CheckGelatoLowTest
/// @notice Tests the CheckGelatoLow contract via fuzzing both the success case
/// and the failure case.
/// @notice Tests the CheckGelatoLow contract via fuzzing both the success and failure cases.
contract CheckGelatoLowTest is Test {
/// @notice An instance of the CheckGelatoLow contract.
CheckGelatoLow c;
......@@ -44,7 +47,9 @@ contract CheckGelatoLowTest is Test {
CheckGelatoLow.Params memory p =
CheckGelatoLow.Params({ treasury: address(gelato), threshold: _threshold, recipient: _recipient });
vm.assume(gelato.userTokenBalance(_recipient, eth) < _threshold);
vm.assume(
gelato.totalDepositedAmount(_recipient, eth) - gelato.totalWithdrawnAmount(_recipient, eth) < _threshold
);
assertEq(c.check(abi.encode(p)), true);
}
......@@ -56,7 +61,7 @@ contract CheckGelatoLowTest is Test {
CheckGelatoLow.Params memory p =
CheckGelatoLow.Params({ treasury: address(gelato), threshold: _threshold, recipient: _recipient });
gelato.setTokenBalance(_recipient, eth, _threshold);
gelato.setTotalDepositedAmount(_recipient, eth, _threshold);
assertEq(c.check(abi.encode(p)), false);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment