Skip to content

Commit

Permalink
fix: fix typo's variable naming, add params in event
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Sep 5, 2023
1 parent 9338338 commit 474fae5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions contracts/Bridge/BaseXVSProxyOFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract contract BaseXVSProxyOFT is Pausable, ExponentialNoError, BaseOFTV2 {
/**
* @notice Emitted when the maximum limit for a single transaction from local chain is modified.
*/
event SetMaxSingleTransactionLimit(uint256 oldMaxLimit, uint256 newMaxLimit);
event SetMaxSingleTransactionLimit(uint16 chainId, uint256 oldMaxLimit, uint256 newMaxLimit);
/**
* @notice Emitted when the maximum daily limit of transactions from local chain is modified.
*/
Expand Down Expand Up @@ -115,7 +115,7 @@ abstract contract BaseXVSProxyOFT is Pausable, ExponentialNoError, BaseOFTV2 {
* @param limit_ Amount in USD.
*/
function setMaxSingleTransactionLimit(uint16 chainId_, uint256 limit_) external onlyOwner {
emit SetMaxSingleTransactionLimit(chainIdToMaxSingleTransactionLimit[chainId_], limit_);
emit SetMaxSingleTransactionLimit(chainId_, chainIdToMaxSingleTransactionLimit[chainId_], limit_);
chainIdToMaxSingleTransactionLimit[chainId_] = limit_;
}

Expand Down Expand Up @@ -197,11 +197,11 @@ abstract contract BaseXVSProxyOFT is Pausable, ExponentialNoError, BaseOFTV2 {

// Calculate the amount in USD using the oracle price
uint256 amountInUsd;
Exp memory oraclePrice = Exp({ mantissa: oracle.getPrice(address(token())) });
Exp memory oraclePrice = Exp({ mantissa: oracle.getPrice(token()) });
amountInUsd = mul_ScalarTruncate(oraclePrice, amount_);

// Load values for the 24-hour window checks
uint256 currentBlock = block.timestamp;
uint256 currentBlockTimestamp = block.timestamp;
uint256 lastDayWindowStart = chainIdToLast24HourWindowStart[dstChainId_];
uint256 transferredInWindow = chainIdToLast24HourTransferred[dstChainId_];
uint256 maxSingleTransactionLimit = chainIdToMaxSingleTransactionLimit[dstChainId_];
Expand All @@ -211,9 +211,9 @@ abstract contract BaseXVSProxyOFT is Pausable, ExponentialNoError, BaseOFTV2 {
require(amountInUsd <= maxSingleTransactionLimit || isWhiteListedUser, "Single Transaction Limit Exceed");

// Check if the time window has changed (more than 24 hours have passed)
if (currentBlock - lastDayWindowStart > 1 days) {
if (currentBlockTimestamp - lastDayWindowStart > 1 days) {
transferredInWindow = amountInUsd;
chainIdToLast24HourWindowStart[dstChainId_] = currentBlock;
chainIdToLast24HourWindowStart[dstChainId_] = currentBlockTimestamp;
} else {
transferredInWindow += amountInUsd;
}
Expand All @@ -226,15 +226,15 @@ abstract contract BaseXVSProxyOFT is Pausable, ExponentialNoError, BaseOFTV2 {
}

function _isEligibleToReceive(uint16 srcChainId, uint256 receivedAmount) internal {
// Check if the recipient's address is whitelisted
// Check if the sender's address is whitelisted
bool isWhiteListedUser = whitelist[msg.sender];

// Calculate the received amount in USD using the oracle price
uint256 receivedAmountInUsd;
Exp memory oraclePrice = Exp({ mantissa: oracle.getPrice(address(token())) });
receivedAmountInUsd = mul_ScalarTruncate(oraclePrice, receivedAmount);

uint256 currentBlock = block.timestamp;
uint256 currentBlockTimestamp = block.timestamp;

// Load values for the 24-hour window checks for receiving
uint256 lastDayReceiveWindowStart = chainIdToLast24HourReceiveWindowStart[srcChainId];
Expand All @@ -249,9 +249,9 @@ abstract contract BaseXVSProxyOFT is Pausable, ExponentialNoError, BaseOFTV2 {
);

// Check if the time window has changed (more than 24 hours have passed)
if (currentBlock - lastDayReceiveWindowStart > 1 days) {
if (currentBlockTimestamp - lastDayReceiveWindowStart > 1 days) {
receivedInWindow = receivedAmountInUsd;
chainIdToLast24HourReceiveWindowStart[srcChainId] = currentBlock;
chainIdToLast24HourReceiveWindowStart[srcChainId] = currentBlockTimestamp;
} else {
receivedInWindow += receivedAmountInUsd;
}
Expand Down

0 comments on commit 474fae5

Please sign in to comment.