Skip to content

Commit

Permalink
Add timestamps on evnets
Browse files Browse the repository at this point in the history
  • Loading branch information
sydneyitguy committed Oct 30, 2020
1 parent b5f1286 commit f92e5b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions contracts/LockUpPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ contract LockUpPool is Initializable, OwnableUpgradeSafe {
// Token => Account => UserLockUps
mapping (address => mapping (address => UserLockUp)) public userLockUps;

event LockedUp(address indexed token, address indexed account, uint256 amount, uint256 totalLockUp, uint256 durationInMonths);
event Exited(address indexed token, address indexed account, uint256 amount, uint256 refundAmount, uint256 penalty, uint256 fee, uint256 remainingTotal);
event BonusClaimed(address indexed token, address indexed account, uint256 amount);
event LockedUp(address indexed token, address indexed account, uint256 amount, uint256 totalLockUp, uint256 durationInMonths, uint256 timestamp);
event Exited(address indexed token, address indexed account, uint256 amount, uint256 refundAmount, uint256 penalty, uint256 fee, uint256 remainingTotal, uint256 timestamp);
event BonusClaimed(address indexed token, address indexed account, uint256 amount, uint256 timestamp);

// Fancy math here:
// - userLockUp.bonusDebt: Amount that should be deducted (the amount accumulated before I join the pool)
Expand Down Expand Up @@ -172,7 +172,7 @@ contract LockUpPool is Initializable, OwnableUpgradeSafe {

_updateBonusDebt(tokenAddress, msg.sender);

emit LockedUp(tokenAddress, msg.sender, amount, tokenStat.totalLockUp, durationInMonths);
emit LockedUp(tokenAddress, msg.sender, amount, tokenStat.totalLockUp, durationInMonths, block.timestamp);
}

// Update user's bonus debt as current accumulated bonus value (accBonusPerShare * effectiveTotal)
Expand Down Expand Up @@ -234,7 +234,7 @@ contract LockUpPool is Initializable, OwnableUpgradeSafe {
token.safeTransfer(msg.sender, refundAmount);
token.safeTransfer(owner(), fee); // Platform fee

emit Exited(tokenAddress, msg.sender, lockUp.amount, refundAmount, penalty, fee, userLockUp.total);
emit Exited(tokenAddress, msg.sender, lockUp.amount, refundAmount, penalty, fee, userLockUp.total, block.timestamp);
}

function earnedBonus(address tokenAddress) public view returns (uint256) {
Expand Down Expand Up @@ -267,7 +267,7 @@ contract LockUpPool is Initializable, OwnableUpgradeSafe {

IERC20(tokenAddress).safeTransfer(msg.sender, amount);

emit BonusClaimed(tokenAddress, msg.sender, amount);
emit BonusClaimed(tokenAddress, msg.sender, amount, block.timestamp);
}

// MARK: - Utility view functions
Expand Down
12 changes: 6 additions & 6 deletions contracts/WRNRewardPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ contract WRNRewardPool is LockUpPool {
// Dev address for WRN disrtribution
address public devAddress;

event PoolAdded(address indexed tokenAddress, uint256 multiplier);
event WRNMinted(address indexed tokenAddress, uint256 amount);
event WRNClaimed(address indexed tokenAddress, address indexed account, uint256 amount);
event PoolAdded(address indexed tokenAddress, uint256 multiplier, uint256 timestamp);
event WRNMinted(address indexed tokenAddress, uint256 amount, uint256 timestamp);
event WRNClaimed(address indexed tokenAddress, address indexed account, uint256 amount, uint256 timestamp);

function initialize(address WRNAddress) public initializer {
LockUpPool.initialize();
Expand Down Expand Up @@ -84,7 +84,7 @@ contract WRNRewardPool is LockUpPool {
wrnStats[tokenAddress].multiplier = multiplier;
totalMultiplier = totalMultiplier.add(multiplier);

emit PoolAdded(tokenAddress, multiplier);
emit PoolAdded(tokenAddress, multiplier, block.timestamp);
}

function updatePoolMultiplier(address tokenAddress, uint256 multiplier, bool shouldUpdate) external onlyOwner {
Expand Down Expand Up @@ -172,7 +172,7 @@ contract WRNRewardPool is LockUpPool {
wrnToMint.mul(1e18).div(tokenStat.effectiveTotalLockUp)
);

emit WRNMinted(tokenAddress, wrnToMint);
emit WRNMinted(tokenAddress, wrnToMint, block.timestamp);
}

wrnStat.lastRewardBlock = block.number;
Expand Down Expand Up @@ -221,7 +221,7 @@ contract WRNRewardPool is LockUpPool {

WRNToken.safeTransfer(msg.sender, amount);

emit WRNClaimed(tokenAddress, msg.sender, amount);
emit WRNClaimed(tokenAddress, msg.sender, amount, block.timestamp);
}

function setDevAddress(address _devAddress) external onlyOwner {
Expand Down

0 comments on commit f92e5b3

Please sign in to comment.