A Safe Presale

UTXODAO (₿,₿)
5 min readFeb 5, 2022

In the following blog post, we will outline the presale implementation that will protect our community and give certainty on how the funds will be used. In turbulent times such as this, it is paramount that UTXODAO builds trust with the community by developing amazing code, fomenting an inclusive environment, empowering ambassadors, and creating processes where transparency is paramount.

For context, our private presale is the first part of our fair launch strategy, and aims to distribute the initial supply of UTXO as fairly as possible. All the funds raised will enable UTXODAO to bootstrap liquidity and kickstart the protocol.

This post will be more technically oriented. If you are trying to find a high level of the sale process, this is the blog post for you: https://utxodao.medium.com/utxo-the-path-to-launch-2bab3544838c

What are the presale contracts and how are they related?

The presale contracts are designed to increase the security of the funds and diminish the viability of a rug pull. Our aim was to avoid relying on humans as much as possible and leverage code to increase the certainty for our community.

We strongly believe that good code should be readable, understandable, covered by unit tests, and well documented in order to allow independent reviewers and the community at large to be able to easily review our contracts and methodology.

Therefore, in order to keep things tidy, we decided to encompass logic into three different contracts: aUTXO contract, Presale contract, & Finalizer contract.

aUTXO Contract

aUTXO is a standard ERC20 token that holders will be able to swap aUTXO to UTXO at a 1:1 ratio via a dedicated user interface. The contract prohibits minting, which means that the entire supply will be minted upon deployment in order to guarantee that nobody can dilute the community’s ownership by any means.

We leverage OpenZeppelin ERC20 contract via inheritance in order to avoid reinventing the wheel and to leverage all the hard work that the community has done in order to validate this standard.

Presale Contract

The Presale contract contains more logic, which ties into three different stages of the process: presale, public sale, and after public sale.

Presale Stage

During the presale stage, the contract will only allow whitelisted addresses to purchase aUTXO. The whitelist functionality is achieve with a simple mapping that is defined below along with the respective helpers methods:

mapping(address => bool) public whitelisted;

We were initially leveraging a Merkle Tree to implement the whitelist, which included an address and the respective bonus. However, per IndyZa’s suggestion, we opted against it because the approach is less transparent since users need to be aware of the bonus amount in order to check whether their address is in the Merkle Tree. Another problem with the Merkle Tree approach is that users will not be able to inspect how many addresses are in the whitelist and what their respective bonuses are. We believe that having the ability to inspect and validate facts is key to increasing trust in the process.

Additionally, the contract dictates that:

  • each user will only be able to buy once
  • contributions will only be accepted in USDC
  • contribution must be an amount between $200 and $2,000

The contract also dictates that users will get the X amount of aUTXO tokens following this formula:

aUTXO = (contributionAmount / PRESALE_PRICE) * (1 + bonus)

Public Sale Stage

For the public sale stage, the contract enables the creation of the Copper Launch Auction using the collected USDC and the remaining aUTXO along with the conditions to prevent any humans from tempering with it.

Copper Launch is a platform for open, transparent, and user-friendly Token Launch Auctions, powered by Balancer Liquidity Bootstrapping Pools and made by the Alchemist team. Copper Launch will enable us to distribute tokens fairly to our community in a capital efficient manner.

The contract is able to programmatically create the auction and pass some useful parameters as seen below. Some of the parameters include the initial weight of the launch, the tokens, the duration of the auction, etc.

Moreover, the contract enable the MultiSign to close the auction after the public sale has been completed and enable withdrawing the whole amount of UDSC and aUTXO to the finalizer contract.

In this contract, we also take into account some edge cases. For example, in case that the MultiSig did not close the auction after the defined duration, contributors can call the emergencyExitPool that will withdraw USDC + aUTXO. This way we guarantee contributors that they can recover their funds if we are not following what we define.

After Public Sale Stage

Once the auction is completed, a separate ERC20 UTXO contract will be created, and the MultiSig will mint the same amount of used aUTXO to presale contract. Afterwards, the MultiSig will create the Finalizer contract address and provide the UTXO contract address. Once we have completed all of this, the Finalizer contract will run the following calls in the following order:

  • approvalsForDEX(amountUsdcToSwap, 0, 0)
  • swapUsdcToWbtc( amountUsdc, amountWbtc)
  • approvalsForDEX(0, amountWbtcForLP, amountUtxoForLP)
  • addLiquidity(amountWbtcForLP, amountUtxoForLP)
  • approvalsForTreasury(amountWbtc, amountUtxoWbtcLP)
  • depositTreasury(amountWbtc, amountLP)

If all the calls are successful up to the depositTreasury function, then depositTreasury will enable the community to redeem their aUTXO for UTXO.

Finalizer Contract

Once we have finalized the presale and sale, the Finalizer contract will enable the MultiSig to do the following steps in a limited and secure manner:

  • Swapping all the USDC collected from the presale for WBTC
  • Creating the initial liquidity pool for the pair UTXO/WBTC
  • Depositing the UTXO-WBTC LP tokens to UTXO treasury

With this procedure we can reassure our contributors that their funds are never leaving the smart contract. Our MultiSig is there only for starting those steps.

Emergency calls

Multiple emergency functions are implemented in case something unexpected happens. The probability of that event is really low as we rely 99% on the smart contract code. But in order to preserve the investors money, we had to implement a way to recover/refund procedure to avoid locking the funds in the smart contract forever.

Conclusion

We hope that you can appreciate the amount of effort and attention to detail that we are bringing into this. We would love if you participate on our project and contribute to our community. We will make sure to the best for the community at every step of the process!

Please let us know if you have any feedback.

--

--

UTXODAO (₿,₿)

The decentralized reserve currency backed by the Bitcoin Standard