Onchain Trade Centralized Risk in Smart Contracts, Is Token Trading Still Safe?

avatar
AgentLayer
1 years ago
This article is approximately 447 words,and reading the entire article takes about 1 minutes
The Onchain Trade smart contract on the ZkChain brings a centralized risk that may jeopardize token staking and rewards.

This security analysis report mainly focuses on the potential vulnerabilities and centralization risks of the Onchain Trade project in token staking, rewards, and trading, as well as the potential threats to the platform's stability and security.

Centralization Risks of the Contract

The smart contract of Onchain Trade covers multiple functions related to token staking, rewards, and platform management. The following is our analysis result on centralization, including some core functions of the contract:

  1. addRevenueToken(): This function is responsible for adding a new token as revenue token, and then adding token details to the 'RevenueInfo' mapping and 'revenueInfoList'.

  2. addRevenue(): This function allows the contract owner to add revenue tokens and their quantities, and updates the boost point while ensuring the latest state of staked tokens and reward balances.

  3. updateScore(): This function is used to update the user's score, which is calculated based on the reward quantity obtained by the user per unit of time.

  4. addToken(): This function allows the contract owner to add a new token to the mining token pool, and the token details, including the per-second rewards and start time, will be added to 'PoolInfo'.

  5. setPoolInfo(): This function allows the contract owner to set and update the pool information of a specific LP token, including per-second rewards and end time.

  6. addMintPool(), updateMintPool(): These functions allow the contract owner to add new minting pools or update existing ones, including detailed information such as reward tokens, per-second rewards, start time, and end time.

  7. setUpdater(), setFastPriceEvents(), setPriceDuration(), setMinBlockInterval(), setMaxTimeDeviation(), setLastUpdatedAt(), setMaxDeviationBasisPoints(), setTokens(), setPrice(), setPrices(), setCompactedPrices(): These functions allow the contract owner to set various parameters related to price events, timing, tokens, and token prices.

  8. setOracle(), setRouter(): These functions enable the contract owner to specify the Oracle and Router addresses.

  9. setMinExecFee(), setSystemRouter(): These functions allow the contract owner to set the minimum execution fee and specify the system router.

  10. listPair(), setMaxTotalSize(), setPairStatus(), setTradingFeeRate(), setMaxLeverage(), setMarginRatio(): These functions allow the contract owner to manage token pairs, maximum size, pair status, trading fee rate, maximum leverage, and margin ratio.

  11. setPriceFeed(), setFutureUtil(), setProtocolFeeTo(): These functions enable the contract owner to set the price feed address, utility address, and protocol fee receiver address.

  12. realizePairProtocoFee(), decreaseInsuranceFund(): These functions enable the contract owner or protocol fee receiver to realize pair protocol fees and decrease the insurance fund.

Conclusion

The contract of Onchain Trade covers multiple functionalities related to token staking and reward platform management. It is evident that the contract owner has extensive control over platform parameters, token pools, reward rates, price feeds, etc. We have conducted a security assessment of the contract code and analyzed potential vulnerabilities and risks that may affect platform security and functionality. It is recommended that the project team takes measures to address these issues promptly in order to enhance the quality and stability of the contract.

Original article, author:AgentLayer。Reprint/Content Collaboration/For Reporting, Please Contact report@odaily.email;Illegal reprinting must be punished by law.

ODAILY reminds readers to establish correct monetary and investment concepts, rationally view blockchain, and effectively improve risk awareness; We can actively report and report any illegal or criminal clues discovered to relevant departments.

Recommended Reading
Editor’s Picks