-
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.
feat(cleanup): imports, natspec, init flow, params, etc
- Loading branch information
1 parent
9b6093c
commit b3fc749
Showing
55 changed files
with
892 additions
and
432 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
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
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
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
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
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
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,51 +1,25 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity 0.8.19; | ||
|
||
import { Module } from "@gnosis.pm/zodiac/contracts/core/Module.sol"; | ||
import { Enum } from "@gnosis.pm/safe-contracts/contracts/common/Enum.sol"; | ||
import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; | ||
|
||
import { CookieJarCore } from "src/core/CookieJarCore.sol"; | ||
import { GiverZodiac } from "src/core/givers/GiverZodiac.sol"; | ||
import { IPoster } from "@daohaus/baal-contracts/contracts/interfaces/IPoster.sol"; | ||
import { FactoryFriendly } from "@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol"; | ||
import { CookieUtils } from "src/lib/CookieUtils.sol"; | ||
|
||
contract ZodiacCookieJar is CookieJarCore, GiverZodiac { | ||
/** | ||
* @title ZodiacCookieJar | ||
* @dev This abstract contract extends GiverZodiac to provide a base for contracts that manage a cookie jar. | ||
*/ | ||
abstract contract ZodiacCookieJar is GiverZodiac { | ||
/** | ||
* @notice Sets up the contract with the given initialization parameters. | ||
* @dev The initialization parameters are decoded from a bytes array into the Safe target, period length, cookie | ||
* amount, and cookie token. | ||
* The Safe target is set as both the avatar and target for the module. This means that the module cannot be | ||
* chained in a series of modules. | ||
* A check is done to ensure the cookie amount is greater than the percentage points constant. | ||
* The period length, cookie amount, and cookie token are then set as per the parameters. | ||
* An event is emitted with the initialization parameters. | ||
* @param _initializationParams The initialization parameters, encoded as a bytes array. | ||
* @notice Sets up the ZodiacCookieJar contract. | ||
* @dev This function is public and virtual, and it overrides the base contract's setup function. | ||
* It first calls the base contract's setUp function with the provided initialization parameters, then transfers the | ||
* ownership to the target. | ||
* @param _initializationParams The initialization parameters as bytes. | ||
*/ | ||
function setUp(bytes memory _initializationParams) | ||
public | ||
virtual | ||
override(CookieJarCore, FactoryFriendly) | ||
initializer | ||
{ | ||
(address _safeTarget) = abi.decode(_initializationParams, (address)); | ||
function setUp(bytes memory _initializationParams) public virtual override { | ||
super.setUp(_initializationParams); | ||
|
||
setAvatar(_safeTarget); | ||
setTarget(_safeTarget); | ||
|
||
transferOwnership(_safeTarget); | ||
} | ||
|
||
/** | ||
* @notice Transfers the specified amount of cookies to a given address. | ||
* @dev Calculates the sustainability fee and deducts it from the amount. Then, depending on whether the cookie is | ||
* an ERC20 token or ether, it executes the transfer operation. Finally, it emits a GiveCookie event. | ||
* @param cookieMonster The address to receive the cookie. | ||
* @param amount The amount of cookie to be transferred. | ||
*/ | ||
function giveCookie(address cookieMonster, uint256 amount) internal override returns (bytes32 cookieUid) { | ||
cookieUid = GiverZodiac.giveCookie(cookieMonster, amount, cookieToken); | ||
transferOwnership(target); | ||
} | ||
} |
Oops, something went wrong.