Inspiration
More and more people are getting familiar with Crypto. However, many newcomers still find it difficult to navigate the immense number of projects that are available and being built. We have already built a token that tracks a basket of cryptocurrencies using an allocation that is decided by the holders.
The project mentioned above covers the mass adoption part. However, by discussing with crypto natives we have come to the conclusion that a more sophisticated solution is needed. A decentralized fully non-custodial personal asset manager bot that could maintain a portfolio of cryptocurrencies. This is the objective of this project.
In the NEAR protocol, there is something UNIQUE that cannot be built on other main chains out there. It is the fact that you can deploy smart contracts into your own account. Like installing software in your own personal computer that handles all operations for you.
As a byproduct, we also think that it is important to highlight this feature as competition may also come harder and harder in the future between the different ecosystems.
What it does
By using the dApp you can deploy a smart contract into your own wallet address and choose an asset allocation on a portfolio of highly liquid tokens listed in Ref.finance. At the moment we have fixed the tokens to BTC, ETH, SOL, NEAR, and USDC, but in the future, you can also choose them yourself. The performance of the portfolio will be tracked by the SERX token that you can see in your wallet. Note: since we are working on testnet the tokens shown on the front-end do not correspond to their name to the ones being traded in the ref.finance exchange.
Once you buy SERX tokens, the smart contract takes the sent NEAR and swaps it into the coins in the portfolio by using cross-contract calls to the ref.finance smart contract, according to the allocation chosen by the owner.
Since prices change over time, rebalancing is needed. At the moment rebalancing can be triggered by an admin account or the owner itself. The admin account has only the right to do rebalancing but has no power to change anything else in the contract. We offer the service of rebalancing the portfolio for the users if they wish. In the future, this feature will be decentralized in the sense that any user could trigger that call for anyone and earn some rewards.
The current dApp can only manage a portfolio of cryptocurrencies. However, the idea could be extended to borrowing/lending and staking protocols.
As a small perk, owners could also use this token as cheques because they could transfer them to other users who could interact with their smart contract and redeem them into NEAR tokens.
How we built it
The project is composed of two parts. The front-end is written using javascript and the back-end is written in Rust enhancing with new features the NEP-141 token contract, e.g. buy/sell functions, voting strategy, and rebalancing function.
Challenges we ran into
Deploying a contract from web3 is not an easy task and took us a while to figure it out. Also, the fact that it is required to log in with full access to your wallet carried some challenges as to authorize access to a contract that does not exist yet, among other cases.
There are still a few bugs to be fixed, e.g. one should trigger the buy function twice before the correct price and allocation can be seen in the dApp. The UX needs also polishing since one should first unlock the wallet with full access and then deploy the contract with the deploy button.
Accomplishments that we're proud of
Being able to deploy a smart contract into your own wallet address by using simply web3. No console or complex commands are required.
Showcase the unique features of the NEAR protocol that other larger ecosystems do not have and highlight this competitive advantage in the world of DeFi and mass adoption. Finally getting one step closer to the mass adoption of DeFi products.
What we learned
A deeper understanding of how the account key system works in NEAR and the interaction between wallets and smart contracts using javascript.
What's next for Serpius
Integration with the parent product Serpius and provide a full suite of decentralized investment opportunities for newbies and crypto natives to reach opportunities to everyone.
Very important is to keep building the circular economy around science and development where funding for an idea incubator comes from DeFi services.
Built With
- html5
- javascript
- near-api-js
- near-cli
- rust


Log in or sign up for Devpost to join the conversation.