Skip to content

Meta-Pool/staking-pool-aurora

Repository files navigation

Staking Pool Aurora

Meta Staking pool in Aurora. The stAUR πŸͺ token.

Versions

The last version of the deployed contract, in AURORA mainnet, is in the stable branch.

Current stable version: v0.2.1 Check all releases in stAUR Releases.

To get the stable version, run the commands:

git clone https://github.com/Meta-Pool/staking-pool-aurora.git
cd staking-pool-aurora
git fetch origin --tags

git checkout tags/v0.2.1 -b stable

Addresses in AURORA 🈯️ mainnet

Address for the Staking Pool in Aurora Mainnet. Version v0.2.1, post-audits:

 - AuroraToken πŸ’š: ----- 0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79
 - AuroraPlus: --------- 0xccc2b1aD21666A5847A804a73a41F904C4a4A0Ec
 - StakingManager: ----- 0xfbC1423a2A4453E162cDd535991bCC4143E5d336
 - Depositor 00: ------- 0x158eFd7b742ac77922F6dcC5CA6e0dFD0c375eeC
 - Depositor 01: ------- 0x1CC2f3A24F5c826af7F98A91b98BeC2C05115d01
 - StakedAuroraVault: -- 0x8A7feB26ee5b202804AC11Dd5a739A945C5De11d
 - LiquidityPool: ------ 0x98d45f7D4FcF992cb62fb439A889320400186AE0
 - ERC4626Router: ------ 0x3750Be57761707e3dEEdAb9F888996F61376fd37

Legacy addresses for DEPRECATED stAUR (whitelisted) token. Version-Beta v0.1:

Addresses of the deployed contracts:
 - StakingManager: ----- 0x69e3a362ffD379cB56755B142c2290AFbE5A6Cc8
 - Depositor 00: ------- 0xf56Baf1EE71fD4d6938c88E1C4bd0422ee768932
 - Depositor 01: ------- 0x7ca831De9E59D7414313a1F7a003cc7d011caFE2
 - StakedAuroraVault: -- 0xb01d35D469703c6dc5B369A1fDfD7D6009cA397F
 - LiquidityPool: ------ 0x2b22F6ae30DD752B5765dB5f2fE8eF5c5d2F154B

Use the Router πŸ›œ

The ERC4626Router help the user to avoid slippage issues.

Quick run

If you already have all the dependencies installed.

# Using the Makefile
make buld
make test

Introduction

Finally, the stAUR πŸͺ token is in the wild, live on AURORA mainnet.

The stAUR πŸͺ token is the Liquid Staking token that represents a proportion of the total AURORA tokens staked in the Aurora Plus staking service. The staking is done through an additional smart contracts called Depositors. A good number of depositors to start with is two.

The Depositors are independent smart contracts that deposit the delegated AURORA tokens into the Aurora Plus staking service. The objective of splitting the deposits into multiple depositors is to allow deposits from one depositor, keeping the others of them without the redeem penalization.

Three different contracts are needed to be deployed.

  • The stAUR fungible token: ERC20, ERC4626.
  • The staking manager is the contract than contains all the logic to stake, unstake and the stAUR-AURORA liquidity pool.
  • The depositors are separated smart contracts that have the logic to deposit and withdraw from the Aurora plus staking service.

Using the Aurora SDK, after the liquidity pool is developed, the stAUR token could be used directly in Meta Yield.

Architecture

Operation

Get a status of the contracts in Aurora mainnet.

npx hardhat run scripts/mainnet/status/view_st_aur_status.js --network aurora_mainnet

Run the Mr Robot πŸ€– operation clean orders.

npx hardhat run scripts/mainnet/bot/clean_orders.js --network aurora_mainnet

Functions

Burn πŸ”₯

The burn() function allows the redistribution of the underlying asset to all the stAUR holders.

Deployment in Goerli

First, the contracts will be deployed in ETH Goerli, using the two testing/ contracts for the Aurora Staking service and the Aurora token.

Addresses of the deployed contracts:
 - AuroraToken πŸ’š: ----- 0xCca0C26Be4169d7963fEC984F6EAd5F6e630B288
 - CentauriToken πŸͺ: --- 0x6f2c4ee43D89b904e62f5F0acF68A37100C968D0
 - AuroraStaking: ------ 0x8e6aA7a602042879074334bB6c02c40A9385F522
 - StakingManager: ----- [DEPRECATED] 0xd44b2eC72C39538294d6e2735DcAc7BB5Ebf2cC6
 - Depositor 00: ------- 0xF01d1060Fe27D69D143EB237dbC8235ED3e4FA4f
 - Depositor 01: ------- 0x0C32f3824B02EC9B82598Cfe487162463579242F
 - StakedAuroraVault: -- 0xD6a1BEB40523A91B8424C02517219875A5D95c01
 - LiquidityPool: ------ 0x9156273eE2684BE1C9F1064cCE43f30E766c8496

  # Updated Manager
 - NEW StakingManager: - [DEPRECATED] 0xf8Cb922aBdb0a2d4478ADE41a493d9A11e0e6009
 - NEW StakingManager: - 0x2da4A45AE7f78EABce1E3206c85383E9a98529d2

Install Foundry on top of Hardhat

Source: https://book.getfoundry.sh/getting-started/installation

  1. Install the Foundry CLI:
curl -L https://foundry.paradigm.xyz | bash
  1. Create a new Foundry project:
  1. Deal with the remappings
forge remappings > remappings.txt
## Running the test in verbose mode.
$ forge test -vvv
[β †] Compiling...
No files changed, compilation skipped

Running 2 tests for test/foundry/TestStakingPool.sol:TestStakingPool
[PASS] testInflationAttack() (gas: 931329)
Logs:
  [-] Initial balances:
  	- Attacker AUR balance:  200000000000000000000
  	- Attacker stAUR balance:  0
  	- stAUR total supply:  0
  	- Alice AUR balance:  200000000000000000000
  	- Alice stAUR balance:  0

  [*] After ATTACKER's deposit:
  	- Attacker AUR balance:  99999999999999999999
  	- Attacker stAUR balance:  100000000000000000001
  	- stAUR total supply:  100000000000000000001
  	- Alice AUR balance:  200000000000000000000
  	- Alice stAUR balance:  0

  [*] After ATTACKER's inflation:
  	- Attacker AUR balance:  99999999999999999999
  	- Attacker stAUR balance:  1
  	- stAUR total supply:  1
  	- Alice AUR balance:  200000000000000000000
  	- Alice stAUR balance:  0

  [+] Victim deposit tokens:
  	- Attacker AUR balance:  99999999999999999999
  	- Attacker stAUR balance:  1
  	- stAUR total supply:  2
  	- Alice AUR balance:  0
  	- Alice stAUR balance:  1

  [*] After ATTACKER's withdraw:
  	- Attacker AUR balance:  249999999999999999999
  	- Attacker stAUR balance:  0
  	- stAUR total supply:  1
  	- Alice AUR balance:  0
  	- Alice stAUR balance:  1


[PASS] test_NumberIs42() (gas: 2412)
Test result: ok. 2 passed; 0 failed; finished in 2.97ms