Drakkor

Drakkor Smart Contract Audit Report

Share
Share
BaseBase
DeFiPresaleERC 20 Token Contract
BaseBase
DeFiPresale+1

QuillAudits audited the Drakkor smart contracts on Base between Apr 1, 2025 and Apr 30, 2025. The audit found 25 issues: 13 high, 1 medium, 6 low, 5 informational, of which 23 resolved and 2 acknowledged.

Project Description

The Presale contract manages multiple presale stages for the Drakkor token, handling whitelisting, pricing, and token purchases.

Timeline

S1
Apr 1, 2025
IA
Apr 29, 2025
S2
Apr 30, 2025

Scope of Audit

The Scope of the Audit is to Analyse Security,Code Quality and Correctness of Drakkor Smart Contracts

Methodology: the QuillAudits smart contract audit process.

speedometer
0
50%
60%
70%
90%
100%
85.9%
AUDIT SCORE
icon

High

Medium

Low

Informational

open0000
acknowledged0011
partially resolved0000
resolved13154

High Severity Issues

Incorrect Stablecoin Payment Calculation

Resolved
arrow-right
Description

The buy() function contains a critical mathematical error in its payment calculation that systematically undercharges users paying with stablecoins (USDT/USDC). Due to improper decimal handling:

WETH: 18 decimals (correctly handled via /1e18)

USDT/USDC: 6 decimals (incorrectly uses same /1e18 division)

Contract

Presale.sol

Recommendation

priceDiscounted * rate * _mintAmount) / 10**18 — this is okay.
For the rest of the tokens:
(priceDiscounted * rate * _mintAmount) / dividen

Incorrect Discount Calculation in buy Function

Resolved
arrow-right
Description

In the buy function of the Presale contract, the calculation for the discounted price is implemented incorrectly. The current logic computes the discount amount, rather than subtracting it from the base price to derive the discounted price.

priceDiscounted = presales[_presaleID].price * uint128(discount) / uint128(100);

For example, if the base price is 100 and the discount is 5%, the above code sets the price to 5, rather than the correct discounted price of 95. This results in users being charged only the discount portion, instead of the correct discounted total. this would cause significant underpayment by users, leading to financial loss or token mispricing.

Contract

Presale.sol

Recommendation

Update the discount calculation logic in the buy function to correctly reflect the discounted price:

priceDiscounted = presales[_presaleID].price * (100 - uint128(discount)) / 100;

This ensures that users pay the correct amount after the discount is applied.

Mint Amount Not Accounted in Payment Calculation.

Resolved
arrow-right
Description

The buy() function does not multiply the discounted price by _mintAmount before transferring tokens from the user. As a result, a malicious user can pass a very high _mintAmount and only pay for one token at the discounted rate, effectively minting multiple tokens for the price of one.

Contract

Presale.sol

Recommendation

Include _mintAmount in the price calculation before performing the token transfer:

IERC20(tokens[_token]).transferFrom( msg.sender, reserveAddress, uint256(priceDiscounted) * _mintAmount * rate );

Incorrect Rate Calculation for USDT in buy() Function Results in Excessive Token Transfer

Resolved
arrow-right
Description

The buy() function incorrectly calculates the conversion rate when _token == 1 (USDT), leading to an unreasonably high token amount being required for minting drakkor tokens. The issue lies in the way sqrtPriceX96 is processed to compute the rate, resulting in a value that's orders of magnitude larger than expected.
The current logic:

rate = ((sqrtPriceX96 * 1e18)>>96) * ((sqrtPriceX96 * 1e18)>>96);
rate = rate * 10**12 / 10**36;

 
For sqrtPriceX96 = 2001948226849368737922989573497318 (WETH/USDC pool), the computed rate becomes:

638478850898924304780 (≈ 638e18) https://etherscan.io/address/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640#readContract
This leads to users needing to send 638478850898924.304780 USDT for _mintAmount of drakkor token, which is clearly incorrect. This creates loss of user's funds.

Contract

Presale.sol

Recommendation

Replace the flawed calculation with a correct formula for converting sqrtPriceX96 to a token rate.
https://etherscan.io/address/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640

Inconsistent Exchange Rate Calculation for USDC and USDT in buy Function

Resolved
arrow-right
Description

In the buy function, the contract uses different logic to calculate the exchange rate for USDC and USDT, even though both tokens are dollar-pegged stablecoins. While the theoretical price of USDC and USDT should be the same, the contract performs different mathematical operations for each, including bit-shifting and inversion, which can result in inconsistent rate values. This could cause users to pay different amounts for the same token purchase depending on whether they use USDC or USDT.

Contract

Presale.sol

Recommendation

Add single logic for stable coin

Decimal Mismatch Vulnerability in buy Function

Resolved
arrow-right
Description

The buy function supports purchasing with WETH (18 decimals), USDC (6 decimals), and USDT (6 decimals). However, it does not adjust for decimal mismatches between the presale token price and the payment token. If price is set in 18 decimals (WETH-style), then users paying with USDC/USDT (6 decimals) will be overcharged by a factor of 1e12. Conversely, if price is set in 6 decimals (for USDC/USDT-style), then users paying with WETH (18 decimals) will be undercharged by 1e12.

IERC20(tokens[_token]).transferFrom(msg.sender, reserveAddress, priceDiscounted * rate);

There is no scaling logic here to normalize between token decimals, leading to incorrect transfer amounts. A proper fix would involve adjusting the final transfer amount based on the token's actual decimal places relative to the price unit.

Contract

Presale.sol

Recommendation

Handle decimals accordingly.

Protocol is not able to mint more than 100,000 (due to decimals misunderstanding)

Resolved
arrow-right
Description

mint() function in the Drakkor token contract enforces that _mintAmount must be between 1000 and 100000. However, since the token uses the standard 18 decimals (via OpenZeppelin’s ERC20), these numeric values represent sub-token denominations, not full tokens. This effectively restricts minting to extremely small amounts — less than a fraction of a single token, which is likely unintended.

function mint(uint128 _mintAmount, address _buyer) external onlyOwner {
require(_mintAmount > 1000 && _mintAmount <= 100000, "Cannot mint more than 100000 and less then 1000 tokens at once");
...
}

The ERC20 contract uses 18 decimals, meaning that 1 full token = 1 * 10^18 units. The current check allows minting only

if _mintAmount is between 1000 and 100000: 1000 = 0.000000000000001 tokens 100000 = 0.0000000000001 tokens.

Contract

Presale.sol

Recommendation

Improve the decimals handling.

Reliance on Manipulable Uniswap V3 slot0 Price Data in buy() Function

Resolved
arrow-right
Description

The buy() function retrieves the current price (sqrtPriceX96) directly from Uniswap V3’s slot0 to calculate the exchange rate. slot0 provides the instantaneous price of the pool, which is vulnerable to manipulation via MEV bots, flash loans, or sandwich attacks. This allows attackers to artificially inflate or deflate the calculated rate, leading to incorrect payment amounts for minted tokens.

Contract

Presale.sol

Recommendation

Use the TWAP function instead of slot0 to get the value of sqrtPriceX96.

Insecure Uniswap V3 Factory Address Handling in Buy Function

Resolved
arrow-right
Description

The buy() function allows users to provide any address as the _factoryAddress parameter. This parameter is used to interact with a Uniswap V3 factory contract for price calculations. Accepting an arbitrary address from user input creates a significant security vulnerability, as malicious actors could supply addresses of fake factory contracts that return manipulated price data. This could result in users underpaying or overpaying, or the protocol losing funds due to inaccurate rate calculations.

Contract

Presale.sol

Recommendation

Hardcode or securely configure the factoryAddress (e.g., through a constructor or setter restricted to the owner or admin).

Incorrect drakkor.isLocked() Logic in Critical Functions

Resolved
arrow-right
Description

The functions kill(), modifyWhitelist(), modifyDiscount(), and modifyPrice() contain a logic flaw in their access control condition. According to the function documentation these functions are intended to be called only when the Drakkor contract is not locked However, the implementation currently uses the condition:
require(drakkor.isLocked(), "..."); 
This enforces that the contract must be locked, which contradicts the intended access restriction described in the comments.

Contract

Presale.sol

Recommendation

Update the require() statements in the affected functions to properly reflect the intended logic.

Missing Interface Imports

Resolved
arrow-right
Description

The buy() function references the interfaces: IUniswapV3Factory and IUniswapV3Pool. However, these interfaces are not imported in the contract, making the buy() function unusable. This will cause the contract to fail to compile.

Contract

Presale.sol

Recommendation

Import the required interfaces at the top of the contract

Unauthorized Access Control in Critical Functions

Resolved
arrow-right
Description

In the Drakkor contract the pause() and unpause() functions lack proper access control mechanisms. These functions can be called by any address, allowing any user to halt or resume token purchases at will. The buy() function in the Presale contract explicitly checks if the Drakkor contract is paused:

function buy(uint64 _presaleID, uint128 _mintAmount, uint8 _token, address _factoryAddress) public { require(!drakkor.isLocked(), "Drakkor is locked"); require(!drakkor.isPaused(), "Drakkor is paused"); // ... }
Any malicious actor can call pause() on the Drakkor contract at any time, which will set isPaused to true. This will cause all subsequent calls to buy() to revert because of the
require(!drakkor.isPaused(), "Drakkor is paused") check.
This effectively allows any user to completely disable the token sale functionality at will, preventing legitimate users from participating in the presale. Even if the contract owner notices this and calls unpause(), a malicious actor can immediately call pause() again, creating an ongoing denial of service situation.

In Presale contract, modifyWhitelist(), modifyDiscount(), and modifyPrice(), lack the onlyOwner modifier, allowing anyone to modify presale parameters. Any address could call these functions and alter presale parameters, potentially resulting in loss of funds or manipulation of token economics.

Contract

Drakkor.sol, Presale.sol

Recommendation


1. Add access control modifiers to the pause and unpause functions to restrict their usage to authorized roles only. Since the Presale contract is the owner of the Drakkor contract. Implement pause() and unpause() functions in the Presale with authorized roles  to call the pause() and unpause() functions in the Drakkor contract respectively.

2. Add the onlyOwner modifier to the functions  modifyWhitelist(), modifyDiscount(), and modifyPrice()  to restrict access.

Unrestricted Access to Kill Function Enables Permanent DoS Attack

Resolved
arrow-right
Description

The Presale contract contains a critical vulnerability where the kill() function sets the isKilled state variable to true with no mechanism to revert this state. Once executed, this permanently blocks core contract functionality, specifically the createPresale() and unlockPresale() functions, as both contain a require(!isKilled, "Contract is killed") check.

The kill() function can be called by anyone, not just the contract owner, as it lacks access control modifiers.

The only requirement to call kill() is that the Drakkor contract must be in a locked state (drakkor.isLocked()).

Since the Drakkor contract initializes with isLocked = true in its constructor, the kill condition is immediately satisfied upon deployment.

There is no function to reset the isKilled flag back to false once it has been set.

Once triggered, the contract permanently loses the ability to create new presales or unlock existing ones, rendering the entire presale mechanism useless.

Contract

Drakkor.sol

Recommendation

Modify the kill() function to include the onlyOwner modifier to ensure only the contract owner can trigger this critical function.

Medium Severity Issues

Low Severity Issues

Informational Issues

Appendix

Disclaimer

Drakkor

Drakkor

High Severity Issues
Medium Severity Issues
Low Severity Issues
Informational Issues
Appendix
Disclaimer
View Report PDF

Get an Audit done today for your Smart Contract

Join 1500+ leaders who secured themselves from losing Billion Dollars

cta-banner
cta-banner-bgcta-banner-bg-mobile

Related audits

WE SECURE EVERYTHING YOU BUILD.

From day-zero risk mapping to exchange-ready audits, QuillAudits helps projects grow with confidence. Smart contracts, dApps, infrastructure, compliance: secured end to end.

QuillAudits Logo


ISO 27001Circle Alliance Program
Uniswap FoundationAethiropt-collectivePolygon SPNBNB Chain Kickstart

All Rights Reserved. © 2026. QuillAudits - LLC