Skip to content

Commit

Permalink
feat: upgradable treasury (#42)
Browse files Browse the repository at this point in the history
upgradeable task treasury
  • Loading branch information
brandonchuah authored Apr 15, 2022
1 parent ede0c04 commit 9a9cde6
Show file tree
Hide file tree
Showing 124 changed files with 25,146 additions and 1,885 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ typechain
# yarn
yarn-error.log
package-lock.json

dist
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ artifacts
cache
dist
coverage
contracts/vendor
typechain
yarn.lock
yarn-error.log
8 changes: 1 addition & 7 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
{
"files": "*.sol",
"options": {
"compiler": "0.8.0"
}
},
{
"files": "contracts/dependencies/GelatoCoreImport.sol",
"options": {
"compiler": "0.6.10"
"compiler": "0.8.12"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"code-complexity": ["error", 5],
"function-max-lines": ["error", 40],
"max-line-length": ["error", 100],
"max-states-count": ["error", 3],
"max-states-count": ["warn", 3],
"no-empty-blocks": "error",
"no-unused-vars": "error",
"payable-fallback": "off",
Expand All @@ -32,7 +32,7 @@
"avoid-throw": "error",
"avoid-tx-origin": "off",
"check-send-result": "error",
"compiler-version": ["error", "0.8.0"],
"compiler-version": ["error", "^0.8.0"],
"mark-callable-contracts": "off",
"func-visibility": ["error", { "ignoreConstructors": true }],
"multiple-sends": "error",
Expand Down
9 changes: 2 additions & 7 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
node_modules/
contracts/dependencies
contracts/diamond/facets/standard
contracts/diamond/interfaces/standard
contracts/diamond/libraries/standard
contracts/functions
contracts/vendor
contracts/diamond/__mocks__/MockUniV3Oracle/libraries
contracts/interfaces
contracts/vendor
2 changes: 1 addition & 1 deletion contracts/Forwarder.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;
pragma solidity ^0.8.0;

contract Forwarder {
function checker(bytes memory execData)
Expand Down
20 changes: 9 additions & 11 deletions contracts/Ops.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;
pragma solidity 0.8.12;

import {Gelatofied} from "./gelato/Gelatofied.sol";
import {GelatoBytes} from "./gelato/GelatoBytes.sol";
import {Gelatofied} from "./vendor/gelato/Gelatofied.sol";
import {GelatoBytes} from "./vendor/gelato/GelatoBytes.sol";
import {
EnumerableSet
} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {
SafeERC20,
IERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {TaskTreasury} from "./taskTreasury/TaskTreasury.sol";
import {
ITaskTreasuryUpgradable
} from "./interfaces/ITaskTreasuryUpgradable.sol";

// solhint-disable max-line-length
// solhint-disable max-states-count
Expand All @@ -34,7 +36,7 @@ contract Ops is Gelatofied {
mapping(bytes32 => address) public taskCreator;
mapping(bytes32 => address) public execAddresses;
mapping(address => EnumerableSet.Bytes32Set) internal _createdTasks;
address public immutable taskTreasury;
ITaskTreasuryUpgradable public immutable taskTreasury;
uint256 public fee;
address public feeToken;
// Appended State
Expand Down Expand Up @@ -66,7 +68,7 @@ contract Ops is Gelatofied {
uint128 indexed interval
);

constructor(address payable _gelato, address _taskTreasury)
constructor(address payable _gelato, ITaskTreasuryUpgradable _taskTreasury)
Gelatofied(_gelato)
{
taskTreasury = _taskTreasury;
Expand Down Expand Up @@ -117,11 +119,7 @@ contract Ops is Gelatofied {
returnData.revertWithError("Ops.exec:");

if (_useTaskTreasuryFunds) {
TaskTreasury(taskTreasury).useFunds(
_feeToken,
_txFee,
_taskCreator
);
taskTreasury.useFunds(_taskCreator, _feeToken, _txFee);
} else {
delete fee;
delete feeToken;
Expand Down
4 changes: 2 additions & 2 deletions contracts/TaskTreasury/TaskTreasury.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;
pragma solidity ^0.8.0;

import {
EnumerableSet
Expand All @@ -13,7 +13,7 @@ import {
ReentrancyGuard
} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {_transfer, ETH} from "../gelato/FGelato.sol";
import {_transfer, ETH} from "../vendor/gelato/FGelato.sol";

contract TaskTreasury is Ownable, ReentrancyGuard {
using EnumerableSet for EnumerableSet.AddressSet;
Expand Down
4 changes: 2 additions & 2 deletions contracts/TaskTreasury/TaskTreasuryL2.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0;
pragma solidity ^0.8.0;

import {
EnumerableSet
Expand All @@ -13,7 +13,7 @@ import {
ReentrancyGuard
} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {_transfer, ETH} from "../gelato/FGelato.sol";
import {_transfer, ETH} from "../vendor/gelato/FGelato.sol";

// solhint-disable max-states-count
// solhint-disable max-line-length
Expand Down
Loading

0 comments on commit 9a9cde6

Please sign in to comment.