SpartanDev:07/06/21–13/06/21

DAppV2 — Dao Proposals | CreatePool | CreateSynth

Summary

The SpartanProtocol contributors have been forging ahead with GitHub commits this week; putting the finishing touches onto the DAO contract, updating the internal testing structure whilst waiting for a testing slot with codeArena.

If you havn’t already, it might be worth your time to check out the test net version of the DApp to see whats to come for the updated ProtocolV2.

SpartanProtocol.org

Community contributors have been putting in the time to update and refine the main webpage for Spartan Protocol. Feedback, suggestions and contributions are welcome, reach out in the telegram channels if you want to help out.

docs.SpartanProtocol.org

Some new & old community members have put their hands up recently to help get the Spartan Protocol GitBook to reflect current progress and iterations of the protocol — head over and check it out to learn more.

This will be an ongoing focus for the wider community to contribute towards.

Spartan Socials

Spartan Socials — Twitter

Top Impressions:

Top Engagement:

Top Community Mention:

SpartanSocials — Medium

SpartanSocials — Telegram

Contributor’s Focus

Phase 1 — SPARTA V2 (Token) — Completed!

Phase 2 — Spartan Protocol V2 (Protocol) — In Progress

SPARTA V2 (Token)

  • IN PROGRESS— 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 (1inch, PancakeSwap etc)
  • COMPLETED & ONGOING— Work with token-tracking information websites to ensure new token info is added and verified (BSCscan, CoinGecko, CoinMarketCap etc)

SpartanContracts

  • COMPLETED & ONGOING— Continue 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 bounty period
  • CONTRACTS READY; CAMPAIGN BEING ORGANISED— Put the contracts through a code review process on CodeArena
  • COMPLETED & ONGOING— Continue the code review process within the community

DAppV2

  • COMPLETED & ONGOING— 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)

Phase 3 — Deploy & Iterate (Dependent on CodeArena Completion)

  • Deploy Protocol V2 to Binance Smart Chain mainnet
  • Enable Bond allocations to replenish TVL into the V2 pools
  • Deploy Lending to testnet
  • March onwards with our original goals of building the decentralised, yield-generating, solo staking, leveraged synthetics and derivatives + lending protocol on Binance Smart Chain

GitHub Activity — SpartanContractsV2

contracts/Dao.sol

  • Changed ‘timeStart’ to ‘coolOffTime’ (More understandable)
  • Added ‘startTime’ for a genesis timestamp of the proposal creation
  • Set proposalCount to 0 on constructor
  • withdraw() — no longer needs to loop all proposals to remove weight; just removes from the current open proposal
  • listBondAsset() — changed to external and removed the unrequired return
  • delistBondAsset() — changed to external and removed the unrequired return
  • checkProposal() — created to handle ‘open’ & ‘startTime’ mappings
  • checkProposal() — added at the start of all newProposal functions
  • voteProposal() — no longer requires any args, as only 1 proposal can be open at a time
  • removeVote() — no longer requires any args, as only 1 proposal can be open at a time
  • _finalise() — no longer requires any args, as only 1 proposal can be open at a time
  • cancelProposal() — this no longer requires any args, nor a new proposal to be made. It simple allows any caller to cancel a proposal if it hasn’t finalised successfully after 14 days
  • finaliseProposal() — no longer requires any args, as only 1 proposal can be open at a time
  • countVotes() — no longer requires any args, as only 1 proposal can be open at a time

contracts/DaoVault.sol

DAOVault withdraw() function has been modified so that there is now a 24 hour lockout after a wallet makes a deposit. This should help deter any whales doing a fast ‘in-out’ for the purpose of trying to manipulate proposal weight

  • Add ‘depositTime’ mapping for a timestamp to calc the 24hrs (86400 seconds) lockup
  • withdraw() — check added for currentTime to be greater than depositTime + 86400 (24hr)

contracts/poolFactory.sol

  • createPoolADD() — changed to ‘payable’ to account for an extremely unlikely edge-case where the DAO removes BNB from curated and then needs to re-add it after
  • curatedPoolCount() — added to ‘view’

contracts/synthVault.sol

  • Added comments for clarity on the deposit times
  • Changed mintSynths() to mintSynth()

test/3_dao.js

  • Updated automated tests

test/4_SynthFarm.js

  • Updated automated tests

GitHub Activity — SpartanDAppV2

Workflow

  • Split up the actions into their own steps instead of ‘&&’. We can also make some of these concurrent to save compile time on ‘merge’
  • Updated env

ABIs

  • All ABIs updated to match the most recent Testnet deploy

src/components/AssetSelect/AssetSelect.js

  • Checks for whether to show some assets moved up to a higher level to clean up the code inside the component; more can simplified here but not high priority

src/components/Common/WrongNetwork.js

  • ‘Wrong Network’ message updated to include a link to the testnet faucet
  • We should also add an info page for testnet in the DApp and/or GitBook to help onboard Testnet Spartans

src/components/DataManager/DataManager.js

  • spartaFeeBurnTally() — moved to it’s own useEffect to only load on initial page load as originally intended (less calls to the external API for the feeBurn history grab)

src/components/Sidebar/Sidebar.js

  • Added a hack for ‘hide’ from the routes to only display intended routes in the menu
  • This whole component needs a rebuild into something more simple at some point; maybe wait for MDBbootstrap to be integrated and for the old libs to be removed

src/components/Supply/Supply.js

  • Changed formatting to 2 decimals

src/locales/en/translation.json

  • Added in most of the new terms to make it easier for copy/paste/change in other locales

src/routes.js

  • Added PU dashboard & tested the ‘hide’ functionality
  • Changed DAO icon to colosseum icon

src/store/bond/actions.js

  • allListedAssets() — added step after allListedAssets() to actually check if the asset is listed as bond *right now* rather than *at some point in the past* for a more accurate user experience

src/store/dao/actions.js

  • daoProposalDetails() — added/changed startTime & coolOffTime & open to suit the adjusted DAO contract
  • voteProposal() — proposalID arg removed
  • removeVote() — proposalID arg removed
  • cancelProposal() — oldProposalID & newProposalID args removed
  • finaliseProposal() — proposalID arg removed

src/store/pool/actions.js

  • getListedPools() — added checks to apply a ‘hide’ status if the pool has no SPARTA depth (the check excludes SPARTAv2 to avoid that disappearing from UI)
  • createPoolADD() — added action to create a new pool. Whoever calls this must add 10,000 SPARTA liquidity at the same time (to resist spam-pools)
  • The caller of the above will also be paying for the deploy gas costs (only ~0.015BNB at time of test)

src/store/synth/actions.js

  • createSynth() — added action to create a new synth. Note that this can’t be done with any old asset; the underlying base asset must have a listed pool with ‘curated’ status to be eligible for having a synth counter-part created
  • The caller of the above will also be paying for the deploy gas costs (only ~0.015BNB at time of test)

src/utils/web3.js

  • Updated contracts to newest testnet deploys
  • Added comments with commits to help track down ABIs on old deploys
  • Cleaned up unused code

src/utils/web3Utils.js

  • calcLiquidityUnits() — changed to use math ‘≤’ instead of ‘===’ so that ‘b’ is returned if the BigNumber’s int value is 0

src/views/pages/Dao/NewProposal.js

  • Extended/improved to MVP level ready for merge
  • Check network and handle accordingly if not testnet

src/views/pages/Dao/Overview.js

  • Check network and handle accordingly if not testnet
  • Added simple filter to show ‘current/open’, ‘completed’ and ‘failed’ proposals

src/views/pages/Dao/ProposalItem.js

  • getSecondsCancel() — handle time left until proposal can be cancelled
  • getSecondsCooloff() — handle time left until proposal can be finalised
  • status() — revamped to handle ‘successful’ & ‘failed’ & new [time, desc] format

src/views/pages/Home/NewPool.js

  • ‘Create new pool’ component to interface with the new functionality mentioned above
  • Validates address to make sure it's a BEP20 standard 18 decimal token. Also checks if it's in the TrustWallet repo and if so; retrieves the relevant token icon etc
  • Checks if the user’s SPARTA input is at least 10,000 units (requirement to create a pool)
  • Shows the ratio underneath in SPARTA, TOKEN and ~USD to ensure the user double/triple checks before adding liquidity

src/views/pages/Home/Overview.js

  • Filtered pools to only include pools that are not empty (listed pools with 0 BASE-depth will not be shown here)

src/views/pages/PU/Overview.js

  • Added a PU dashboard for edge-case functionality from the community
  • This will be a public dashboard that anyone can visit, however, it will not be linked in any menu
  • The idea is that the more advanced and integrated community members can perform any functions that normally an ‘admin’ would handle in a centralised project
  • This is a place for functions that are non-destructive for the protocol itself (that's what the DAO is for) but only dangerous for users who do not know what they are doing

src/views/pages/PU/EmptyPools.js

  • The empty pool functionality is to provide an interface to set the initial liquidity/ratio in the event that a pool is created but all liquidity is then removed, leaving us with an ‘empty pool’. Setting the initial liquidity is dangerous for those who don’t understand how AMMs work; hence checks have been put in place to ensure these pools *only* show up in this PU dashboard
  • This is unlikely to ever be required, however a good opportunity to put in place the first of many edge-case user interface functions to ensure the community can manage all scenarios in the future

src/views/pages/Pools/LiqBond.js

  • Only show assets that are available for bonding
  • If the count is 0; show a message about enabling a bond asset thru the DAO proposals

src/views/pages/Pools/Overview.js

  • Add NewPool component button

src/views/pages/Swap/Swap.js

  • Add NewPool component button

src/views/pages/Synths/NewSynth.js

  • ‘Create new synth’ component to interface with the new functionality mentioned above
  • This is a bit more simple than the NewPool component; the user is presented with a list of ‘curated’ pools that do not have a synth token yet deployed
  • The user can select a synth and choose to get it deployed straight away by paying the deploy gas fees

src/views/pages/Synths/Overview.js

  • Add NewSynth component button
  • Changed terminology from ‘burn’ to ‘melt’

src/views/pages/Synths/components/AssetSelect.js

  • Component for handling the list of ‘curated’ but not deployed synths list as mentioned above

src/views/pages/Vault/Components/DaoDepositModal.js

  • Added in ‘withdraw lockout’ info to the DAOVault deposit modal
  • Lists all existing LPs that will be locked and also the new deposit
  • Modal handling moved to local scope instead of parent

src/views/pages/Vault/DaoVault.js

  • Modal handling moved to child scope (less prop drilling)
  • Show amount of time remaining until withdraw is unlocked for user
  • Disable withdraw button based on that check
  • Added in bond weight for the harvest calculation (bond weight is now included in DAO weight for proposals and harvest rewards)

src/views/pages/Vault/SynthVault.js

  • Terminology of ‘mint’ changed to ‘forge’

Project Information

Official Links

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.

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:

0x588f82a66eE31E59B88114836D11e3d00b3A7916

Incentivized liquidity and synthetic asset generation for Binance Smart Chain. https://SpartanProtocol.org