MCPcopy Index your code
hub / github.com/SmarDex-Dev/smart-contracts

github.com/SmarDex-Dev/smart-contracts @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
296 symbols 1,100 edges 136 files 1 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SmarDex Contracts

Tests

Description

Uniswap-like dex protocol that allow a better incentivization for liquidity providers. This repo includes an SDEX pool (rewards comes from the dex) and farming capabilities (rewards requires external income source).

Website

https://smardex.io

Documentation

See the link to the technical paper or visit the Smardex Developer docs

  • https://www.academia.edu/98332701/The_SMARDEX_Protocol_A_Novel_Solution_to_Impermanent_Loss_in_Decentralized_Finance
  • https://docs.smardex.io

Getting Started

Installation

Install dependencies:

yarn install

Compile

yarn compile

To rebuild typechain specifically:

yarn typechain

Run tests

yarn test                           # run tests without traces

yarn test --traceError              # prints calls for failed txs
yarn test --fulltraceError          # prints calls and storage ops for failed txs
yarn test --trace                   # prints calls for all txs
yarn test --fulltrace               # prints calls and storage ops for all txs

yarn test --v                       # same as --traceError
yarn test --vv                      # same as --fulltraceError
yarn test --vvv                     # same as --trace
yarn test --vvvv                    # same as --fulltrace

# specify opcode
yarn test --v --opcodes ADD,SUB     # shows any opcode specified for only failed txs
yarn test --vvv --opcodes ADD,SUB   # shows any opcode specified for all txs

Deploy

Testnet (mumbai)

yarn deploy_testnet

Hardhat (test deploy script)

yarn deploy

Prettier

Run linter (required before each commit):

yarn prettier

Check code is properly linted:

yarn prettier:check

Slither

For quick and automatic syntaxic analysis, you can use Slither tool : Slither is a Solidity static analysis framework. It runs a suite of vulnerability detectors, prints visual information about contract details. [...] Slither enables developers to find vulnerabilities, enhance their code comprehension, and quickly prototype custom analyses.

Install

See for options : https://github.com/crytic/slither#how-to-install

Run

At project level (where package.json is):

slither . --json slither_output.json
#slither is called system wide, but an absolute or relative binary call can also be used

Better run with yarn to avoid errors & with config to choose printers_to_run : yarn slither

Contributors

Implemented by Stéphane Ballmer, Paul-Alexandre Tessier, Côme Pecorari, Léo Fasano, Yoan Capron, Sami Darnaud

Licensing

The primary license for Smardex is the Business Source License 1.1 (BUSL-1.1), see LICENSE. However, smart-contract files imported from other projects do respect their original license (GPL-3, GPL-2, MIT, ...)

  • All files under periphery are GPL-2
  • All files under core except core/libraries/SmardexLibrary.sol are GPL-2
  • contracts/rewards/FarmingRange.sol is licensed under MIT, fork from Alpaca Finance

Extension points exported contracts — how you extend this code

Context (Interface)
(no doc)
test/types.ts
DoubleMint (Interface)
(no doc)
test/SmardexPair/utils.ts
GetAmountTrade (Interface)
(no doc)
test/SmardexLibrary/utils.ts
MintTestData (Interface)
(no doc)
test/SmardexRouter/utils.ts
CampaignInfo (Interface)
(no doc)
test/FarmingRange/utils.ts
Contracts (Interface)
(no doc)
test/types.ts
BurnTestData (Interface)
(no doc)
test/SmardexPair/utils.ts
GetAmountParametersStruct (Interface)
(no doc)
test/SmardexLibrary/utils.ts

Core symbols most depended-on inside this repo

advanceBlockTo
called by 141
test/helpers/time.ts
latestBlockNumber
called by 74
test/helpers/time.ts
parseShare
called by 73
test/Staking/utils.ts
isInRange
called by 41
test/SmardexLibrary/utils.ts
unitFixtureCampaignWith2rewards
called by 32
test/fixtures.ts
getPermitSignature
called by 18
test/utils.ts
unitFixtureCommon
called by 13
test/fixtures.ts
deployERC20Test
called by 11
test/deployers.ts

Shape

Function 277
Interface 19

Languages

TypeScript100%

Modules by API surface

test/deployers.ts41 symbols
test/fixtures.ts34 symbols
test/FarmingRange/utils.ts27 symbols
test/SmardexRouter/specs/BestTrade.spec.ts9 symbols
script/generateSwapGasCost.ts8 symbols
test/SmardexPair/utils.ts7 symbols
test/helpers/time.ts6 symbols
test/SmardexPair/specs/swapWithValues.spec.ts6 symbols
deploy/utils.ts6 symbols
test/utils.ts5 symbols
test/SmardexRouter/utils.ts5 symbols
test/types.ts4 symbols

For agents

$ claude mcp add smart-contracts \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact