SpartanDev: July 2021
July saw major steps in rebuilding Sparta with the codeArena contest and the beginning of post-contest edits
Summary
Is it just us, or did July fly past at the speed of a Spartan Spear thrown in defence of SPARTA?
Focus this month has been on the codeArena audit contest. Contributors have been working tirelessly to ensure that the security wardens have all the information and context to effectively audit the V2 SpartanProtocol. This has been instrumental in ensuring the distributed involvement from as many wardens as possible— which has been reflected in the record activity derived from the Spartan Protocol <> C4 contest.
Contributors have completed the post-contest triage (sorting/prioritizing) and already started addressing issues raised improving the code, check out the GitHub activity summarized in the ‘Github activity’ sections lower in this article!
Forward together relentlessly.
You know the now, how about the road to v2? Read our update below.
We still need your support
We still need your support. All donations help ensure the V2 Protocol contracts get a thorough review from many angles.
If you can donate, big or small, every contribution helps this community project achieve its full goal of $96k as soon as possible to ensure that Spartan Protocol is in a prime position to release the V2 contracts and DApp onto mainnet.
Donate Here: — https://dapp.spartanprotocol.org/codearena
Its time to upgrade your tokens
No problems; upgrade today
You can use the Spartan Protocol Upgrade DApp to upgrade your SPARTAv1 tokens to SPARTAv2 yourself.
Upgrade DApp — https://dapp.spartanprotocol.org/upgrade
Bit-Rush Crypto has created a video guide on using the SpartanProtocol Upgrade DApp — timestamp 3:20. Nice work SPARTANS!!
feeBurn Update
Previous week — We cannot wait for V2 of the protocol to go live to see this really fire up the furnace!!
Spartan Socials — Twitter
July has been a busy month for people engaging with Spartan Protocol with followers passing 18 000. This is nice to see during a consolidation phase of the overall crypto ecosystem.
Top Impressions:
Top Engagement:
Top Community Mention:
SpartanSocials — Medium
SpartanSocials — Telegram
Crossed over the 6000 members in telegram milestone this month.
Contributor’s Focus
Phase 1 — SPARTA V2 (Token) — Completed!
Phase 2 — Spartan Protocol V2 (Protocol) — In Progress
SPARTA V2 (Token)
- COMPLETED & ONGOING — Work with the centralised exchanges (CEX) listing SPARTA to ensure that SPARTA holders all have their tokens upgraded as simply as possible. It is expected that CEX holders will not need to perform any specific actions to have their tokens exchanged for V2 tokens (Binance, BKEX, MXC etc)
- ONGOING — Work with DEXs & aggregators to ensure the new SPARTA token address is added to their lists as the primary address for SPARTA (retiring the previous contract address) (1inch, PancakeSwap etc)
- COMPLETED & ONGOING — Work with token-tracking informational websites to ensure new token info is added and verified (BSCscan, CoinGecko, CoinMarketCap etc)
SpartanContracts
- COMPLETED & ONGOING — Continued updating and stringent testing of V2 contracts to suit the changes made against the base token contract, and ensure the V2 contract suite is in a complete and stable position ready for a CodeArena community review and bounty period
- COMPLETED: 15/07/2021 — Put the contracts through a code review process on CodeArena
- COMMENCED — Review all codeArena feedback, prioritise and action relevant recommendations
- COMPLETED & ONGOING — Continue the code review process within the community
DAppV2
- COMPLETED — Update the V2 DApp to suit any required contract changes/upgrades
- COMPLETED — Create DAO hub for proposal management (This was extended to a complete DAO instead of simple-DAO)
- COMPLETED — Test bond process from start to finish via UI (propose bond allocation, vote it in, finalise it, and then proceed to bond assets and test the weight from that in the DAOVault, and other proposals)
- COMPLETED — Rip out all the old libraries and rebuild using one component library; refactor and cleanup style sheets as we go to reduce the overall project size ready for larger-scale community contribution on mainnet
- COMPLETED — Add a calculable APY figure to the SynthVault
- COMPLETED & ONGOING — Set up a reliable index of history scoped to contracts (use this for positions page etc)
- IN PROGRESS — Use the new testnet subgraph to build a more lightweight positions page for V2
Phase 3 — Deploy & Iterate
- IN PROGRESS — Assess codeArena audit feedback and make changes where required
- Fresh deploy of the V2 protocol to testnet for community stress testing
- Deploy Protocol V2 to Binance Smart Chain mainnet
- Enable Bond allocations to replenish TVL into the V2 pools
- March onwards with our original goals of building the decentralised, yield-generating synthetics protocol on Binance Smart Chain
GitHub Activity
Issue triaging for both C4 and the contributors has been completed. Discussions and contract changes are now in progress by the SP contributors which will ramp up into full swing 1st week of August.
GitHub Activity — SpartanContracts
contracts/Pool.sol
- Added OpenZeppelin’s ReentrancyGuard
- Changed MintSynth & BurnSynth events to suit subgraph needs
- _SYNTH() — added function to get the synth address relating to the pool
- onlyDAO() — added a modifier to permission functions to the DAO only
- burnFrom() — removed this function to reduce possible attack vectors (make it so that LP tokens can only be burnt in the intended ways; POOL.removeForMember, SYNTH.realise etc)
- sync() — permissioned to DAO only
- mintSynth() function changes:
- Removed the synthOut argument; derive the address internally instead (safer & cheaper)
- Changed the require-check for ‘isSynth’ to instead get the specific synth address relevant to this pool and *then* check that it’s valid (safer)
- Fixed the output / outputAmount mistake handed to the event (for subgraph)
8. burnSynth() function changes:
- Removed the synthIN argument; derive the address internally instead (safer & cheaper)
- Changed the require-check for ‘isSynth’ to instead get the specific synth address relevant to this pool and *then* check that it’s valid (safer)
- Refactor the synth unit & LP unit burn logic (cheaper)
9. Refactor metrics/revenue tracking logic:
- _addPoolMetrics() —removed the unneeded ‘0’ assign
- addRevenue() — changed to archiveRevenue() and refactored in addFee() logic inside
- addFee() — removed; refactored into archiveRevenue()
10. Remove un-used BEP677 logic:
- Removed iBEP677 interface
- approveAndCall() — removed function
- transferAndCall() — removed function
11. Standardise to BEP20:
- _approve() — updated; removed conditional
- transferFrom() — updated; removed conditional
12. Permission pool interactions to the ROUTER only:
- onlyROUTER() — added a modifier
- mintSynth() — applied onlyROUTER modifier
- add() — removed this function
- addForMember() — applied onlyROUTER modifier
- remove() — removed this function
- removeForMember() — applied onlyROUTER modifier
- swap() — removed this function
- swapTo() — applied onlyROUTER modifier
- mintSynth() — applied onlyROUTER modifier
- burnSynth() — applied onlyROUTER modifier
13. Gas & compile optimizations:
- DEPLOYER variable — removed
- decimals variable — changed to immutable
- genesis variable — changed to immutable
- lastMonth — removed the assignment to ‘0’ in the constructor
- addForMember() — changed to external
- removeForMember() — changed to external
- removeForMember() — refactored out the re-used iUTILS(_DAO().UTILS()) code to a local variable
- swapTo() — changed to external
- mintSynth() — refactored out the re-used iUTILS(_DAO().UTILS()) code to a local variable
- burnSynth() — refactored out the re-used iUTILS(_DAO().UTILS()) code to a local variable
- _swapBaseToToken() — refactored out the re-used iUTILS(_DAO().UTILS()) code to a local variable
- _swapTokenToBase() — refactored out the re-used iUTILS(_DAO().UTILS()) code to a local variable
contracts/Router.sol
- Added minimum amount handling to the router:
- This was slated to be added to the router later with an upgrade; however, has been added during the post-C4 changes seeing as the router code was being updated anyway
- The ‘minAmount’ will be handed in from the user interface based on the ‘minimum amount’ the user selects when performing a swap via the dapp to protect them if the rate changes dramatically between seeing the rate in the dapp and confirming the txn in their wallet (will revert if the resulting swap is lower than their minAmount, will probably default to 5% below the estimated output)
- buyTo() — added minAmount argument
- sellTo() — added minAmount argument
- swap() — added minAmount argument
- swapTo() — added minAmount argument
2. revenueDetails() — removed ‘0’ assignment; not required
contracts/Synth.sol
- _POOL() — added function to derive the relevant pool underlying a synth contract
- onlyPool() — changed modifier to check if the msg.sender is the correct underlying pool (rather than just checking that it is *a* valid pool)
3. Changes to burnSynth():
- Added _syntheticAmount argument handed in from pools instead of checking balance on synth contract
- Remove LP burn logic (handled in pool contract now)
- Return the LP units being burnt (for pool to handle burning the LP units; and also to accurately track LP unit supply in subgraph via events)
4. Permission mintSynth() to relevant ‘curated’ pool:
- onlyCuratedPool() — added modifier to check if pool is curated
- mintSynth() —onlyCuratedPool modifier applied to function
5. Remove BEP677 unused logic:
- approveAndCall() — removed function
- transferAndCall() — removed function
6. Standardise to BEP20:
- _approve() — updated; removed conditional
- transferFrom() — updated; removed conditional
contracts/iSYNTH.sol
- Updated synth interface to handle the changed burnSynth() arguments
contracts/poolFactory.sol
- createPoolADD() — emit the CreatePool event *before* adding liquidity (for subgraph accuracy)
contracts/synthVault.sol
- _addVaultMetrics() — remove the unneeded ‘0’ assignment (save gas)
Project Information
Official Links
- Website: https://spartanprotocol.org/
- DApp: https://dapp.spartanprotocol.org/
- GitBook (Docs): https://docs.spartanprotocol.org/
- GitHub: https://github.com/spartan-protocol
Community Contribution
Spartan Protocol is at its core, a community-driven and led project. In this vein, the more contributors the better. There is a great opportunity for community members to contribute by making LP reward analysis tools, etc.
Recently, community members have been graciously funnelling in to contribute to explainer articles, ideas and even $SPARTA donations to support the growth of the platform.
Engage with the community and contributors
Where to find out about all the latest updates or suggest improvements — get involved.
- Medium: https://medium.com/spartanprotocol
- Twitter: https://twitter.com/spartanprotocol
- Telegram Community: https://t.me/spartanprotocolorg
- Telegram Announcements: https://t.me/spartanprotocolann
- Community-Built Discord: https://discord.gg/wQggvntnGk
Community Bounty Wallet
Whilst there is no treasury nor contributor allocations, there was a public community bounty wallet set up a while ago to help handle donations from the community and other incentive programs (BNB from the Binance BUIDl program was sent here) which can be viewed here: