Skip to content

Commit

Permalink
Get Examples compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
topocount committed Jun 28, 2022
1 parent a1c1dfb commit 4aa2f76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
9 changes: 5 additions & 4 deletions src/HatsConditions/SampleHatsConditions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pragma solidity >=0.8.13;

import "./IHatsConditions.sol";
import "../IHats.sol";
import "solmate/auth/Auth.sol";

abstract contract ExpiringHatsConditions is IHatsConditions {
Expand All @@ -18,11 +19,11 @@ abstract contract ExpiringHatsConditions is IHatsConditions {
virtual
returns (bool)
{
return (now < expiries[_hatId]);
return (block.timestamp < expiries[_hatId]);
}

function setExpiry(uint256 _hatId, uint256 _expiry) public virtual {
if (now > _expiry) {
if (block.timestamp > _expiry) {
revert ExpiryInPast();
}

Expand All @@ -32,7 +33,7 @@ abstract contract ExpiringHatsConditions is IHatsConditions {
}
}

abstract contract OwnableHatsConditions is IHats, IHatsConditions, Auth {
abstract contract OwnableHatsConditions is IHatsConditions, Auth {
event HatStatusSet(uint256 _hatId, bool _status);

IHats public HATS;
Expand Down Expand Up @@ -63,7 +64,7 @@ abstract contract OwnableHatsConditions is IHats, IHatsConditions, Auth {
emit HatStatusSet(_hatId, _status);
}

function _updateHatStatus(_uint256 _hatId, bool _status) internal virtual {
function _updateHatStatus(uint256 _hatId, bool _status) internal virtual {
HATS.changeHatStatus(_hatId, _status);
}
}
23 changes: 12 additions & 11 deletions src/HatsOracles/SampleHatsOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pragma solidity >=0.8.13;

import "./IHatsOracle.sol";
import "../IHats.sol";
import "solmate/auth/Auth.sol";

abstract contract ExpiringHatsOracle is IHatsOracle {
Expand All @@ -17,27 +18,27 @@ abstract contract ExpiringHatsOracle is IHatsOracle {
}

// key1: wearer => key2: hatId => value: token expiry timestamp
mapping(address => mapping(uint256 => uint256)) public tokenExpiries;
mapping(address => mapping(uint256 => uint256)) public tokenExpiries;

function ruleOnWearerStanding(address _wearer, uint64 _hatId)
external
virtual
{
bool ruling = checkWearerStanding(_wearer, _hatId);

HATS.ruleOnHatWearerStanding(_hatId, _wearer, ruling);
}

function checkWearerStanding(address _wearer, uint64 _hatId)
external
public
view
returns (bool);
returns (bool)
{
return (now < tokenExpiries[_wearer][_hatId]);
return (block.timestamp < tokenExpiries[_wearer][_hatId]);
}

function setTokenExpiry(address _wearer, uint256 _hatId, uint256 _expiry) public virtual {
if (now > _expiry) {
if (block.timestamp > _expiry) {
revert TokenExpiryInPast();
}

Expand All @@ -59,17 +60,17 @@ abstract contract OwnableHatsOracle is IHats, IHatsOracle, Auth {
}

// do we want to standardize this function / add to the interface?
function _ruleOnWearerStanding(address _wearer, uint64 _hatId, bool _ruling)
function _ruleOnWearerStanding(address _wearer, uint256 _hatId, bool _ruling)
internal
virtual
{
{
HATS.ruleOnHatWearerStanding(_hatId, _wearer, _ruling);
}

function checkWearerStanding(address _wearer, uint64 _hatId)
external
public
view
returns (bool);
returns (bool)
{
return standing[_wearer][_hatId];
}
Expand All @@ -84,4 +85,4 @@ abstract contract OwnableHatsOracle is IHats, IHatsOracle, Auth {

emit HatStandingSet(_wearer, _hatId, _standing);
}
}
}

0 comments on commit 4aa2f76

Please sign in to comment.