Smart Contracts

Xion Finance is driven by smart contracts running on the xDai chain and Ethereum Mainnet - powering the whole Xion ecosystem-

We embrace the ethos of decentralization and want to be as transparent as possible. You can find the code of our smart contracts in our GitHub repository as well as on Blockscout (see the links below).

Xion Global Token - XGT

The Xion Global Token (XGT) is a standard ERC20 token based on the OpenZeppelin contracts. It combines the classic features of ERC20 tokens while combining some advanced mechanisms that we introduced. There is a fixed supply of 3,000,000,000 XGT.

The following features were added on top:

  • Protection against sending tokens to the token address itself, e.g.:

    • require(recipient != address(this), "XGT-CANT-TRANSFER-TO-CONTRACT");

  • A function that burns XGT for our subscription contract (we intend to burn a certain amount of XGT in the future)

  • Native and cost-efficient swaps between Ethereum Mainnet

  • Two functions facilitating transfers between Mainnet and the xDai Chain via the Arbitrary Message Bridge

There is also a mainnet version of this contract, which follows the same logic.

Deployed at 0xf1738912ae7439475712520797583ac784ea9033 on the xDai Chain and at 0xf1738912ae7439475712520797583ac784ea9033 on Ethereum mainnet. The code for this contract can be found here.

XGT Generator

1,200,000,000 XGT have been dedicated to rewarding and incetivizing the users of the Xion community, which amounts to 40% of the overall token supply. This process is being handled in the so-called XGT Generator contract since it "generates" XGT for our users. Users can generate XGT through earning, farming or cash-backs. Having an own contract that can be leveraged via our backend processor allows us to reward our users, even if they are providing liquidity (farming) on pools that are not ours (such as the Honeyswap Pool) or even on other chains (such as on Uniswap on Ethereum Mainnet)

Deployed at 0xa294A842A34ab045ddb1E6eE07c417a1e13c2eDf. The code for this contract can be found here.

Earning

Leveraging the Arbitrary Message Bridge, we know how much users provided to our lending protocol on Ethereum Mainnet, such that we can start the generation of XGT for them on the xDai chain. This process doesn't require additional transactions from the user. When withdrawing their DAI on mainnet, the xDai contract is notified through the bridge to stop XGT generation.

For example, the corresponding function (called by the bridge on xDai) after a deposit looks like this:

function tokensStaked(uint256 _amount, address _user) external {
  require(msg.sender == address(bridge), "XGTGEN-NOT-BRIDGE");
  require(stakingContractsMainnet[bridge.messageSender()], "XGTGEN-NOT-MAINNET-CONTRACT");
  userDAITokens[_user] = userDAITokens[_user].add(_amount);
  _startGeneration(_amount, _user, xgtGenerationRateStake);
}

Farming

As soon as a user is involved in a transfer of Pool tokens (either through minting, burning, or simply sending them to another user), our backend node picks this up and calls the XGT generator contract to indicate that a certain users balance was updated. The corresponding function works in a trustless manner, such that the contract itself verifies how many XGT LP tokens the user has. Based on this, the generator of XGT starts (or ends). With our latest promotions in the world of NFTs, we are now also able to grant so-called "boosts", where users may earn a certain percentage of XGT on top for a limited time.

Cashbacks

In the future, Xion will also offer cash-backs for users making use of their e-commerce platform. This functionality will be part of a later update.

XGT Stake

This contract facilitates "earning" on Xion Finance. Users can stake their DAI, which is currently converted into cDAI and thus generating interest. Leveraging the Arbitrary Message Bridge, we notify the xDai XGT Generator contract to start generating XGT for the user, which they can claim at any time. Being rewarded with XGT tokens, a small percentage of the interest.

Users can deposit tokens through this function:

function depositTokens(uint256 _amount) external

and subsequently, withdraw them with this function:

function withdrawTokens(uint256 _amount) external

Deployed at 0xa294A842A34ab045ddb1E6eE07c417a1e13c2eDf. The code for this contract can be found here.

Vesting

In order to incentivize the team and investors of Xion over the long-term and also maintaining the ability to facilitate airdrops, we are making use of a standard vesting contract, that distributes the allocated tokens over a period of 24 months. In order to protect the community, any unallocated XGT amounts will also be unlocked throughout the same period, such that the Xion team does not have access to excessive amounts of XGT.

Deployed at 0x080Dd0D9A441FA76f67A59260229dBce897148a4. The code for this contract can be found here.

Upgradeability

We are leveraging the Upgradeability features by OpenZeppelin, allowing us to introduce features without changing the contract's address as well as fixing any unforeseen bugs that could lead to a financial loss for our users. The safety of our users and consequently their funds is of utmost importance to us!

Over time, the admin and upgradeability mechanisms will be distributed to the community via a governance mechanism.

Meta-Transactions

We are very aware, that working with a different chain than the Ethereum Mainnet still requires some effort on the user's side, while some wallets don't even allow to define custom RPC endpoints. This is mainly the reason, why we are working with establishes mechanisms to bring meta-transactions to our users. Ultimately, we want our users to have very swift and smooth interactions with our system and thus our contracts, without needing to switch between networks or be subject to the hassle of knowing which chain requires which tokens or fees.

This is why we are making use of a gas-cost efficient EIP712 Meta Tx standard like this one.

License

GNU Affero General Public License v3.0

Última actualización