Skip to content

Commit

Permalink
Godspeed Yoooou! stAUR 🪐
Browse files Browse the repository at this point in the history
  • Loading branch information
josemariasosa committed May 3, 2023
1 parent 88a57fa commit 8348588
Show file tree
Hide file tree
Showing 14 changed files with 274 additions and 175 deletions.
18 changes: 14 additions & 4 deletions .env-example
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
ALICE_PRIVATE_KEY = #The private key of the account you intend to use
BOB_PRIVATE_KEY =
CARL_PRIVATE_KEY =
INFURA_API_KEY = #Your Infura API key
# Testnet Networks
ALICE_PRIVATE_KEY =
BOB_PRIVATE_KEY =
CARL_PRIVATE_KEY =

# Mainnet AURORA
ADMIN_PRIVATE_KEY =
OPERATOR_PRIVATE_KEY =
LP_FEE_COLLECTOR_PRIVATE_KEY =
DEPOSITOR_FEE_COLLECTOR_PRIVATE_KEY =

# Nodes
INFURA_API_KEY =
ALCHEMY_API_KEY =
61 changes: 36 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
# Staking Pool Aurora

Meta Staking pool in Aurora.
Meta Staking pool in Aurora. The stAUR 🪐 token.

# Functions
# Versions

## Burn 🔥
The last version of the deployed contract, in AURORA `mainnet`, is in the `stable` branch.

The `burn()` function allows the redistribution of the underlying asset to all the stAUR holders.
Current stable version: [**v0.1.0**](https://github.com/Meta-Pool/staking-pool-aurora/releases/tag/v0.1.0)
Check all releases in [stAUR Releases](https://github.com/Meta-Pool/staking-pool-aurora/releases).

To get the stable version, run the commands:

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

git checkout tags/v0.1.0 -b stable
```

# Introduction

# Aurora Bounty ETHDenver2023
Finally, the `stAUR` 🪐 token is in the wild, live on AURORA `mainnet`.

We have been working on the stAUR, which is the liquid staking token that represent a proportion of the total Auroras staked into Aurora.plus by the N number of depositors. A good number of depositors to start with is with 3.
The `stAUR` 🪐 token is the **Liquid Staking** token that represents a proportion of the total AURORA tokens staked in the [**Aurora Plus**](https://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 smart contracts that deposit Aurora into the staking service. The objective of spliting the deposits into multiple depositors is to allow deposits from one depositor, keeping the other two of them without the redeem penalization.
The **Depositors** are independent smart contracts that deposit the delegated AURORA tokens into the Aurora Plus staking service. The objective of spliting 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.

Expand All @@ -26,31 +39,29 @@ Using the Aurora SDK, after the liquidity pool is developed, the stAUR token cou

Address for the Staking Pool in Aurora Mainnet.

```js
// These are the addresses of the Aurora Token and Aurora Plus in Mainnet.
const TokenAddress = "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79";
const AuroraStakingAddress = "0xccc2b1aD21666A5847A804a73a41F904C4a4A0Ec";

// These are the addresses of the contracts Meta Pool deployed.
const StakingManagerAddress = "0xd239cd3A5Dec2d2cb12fB8eC512Fe3790FA2cD0e";
const Depositor00Address = "0x6fA37581EBA252C08240c85f30fA8A5e3462c09d";
const Depositor01Address = "0x31e0752Deb99f1fCE9701Dc5611A1652189dEdC3";
const StakedAuroraVaultAddress = "0xA68118a4A067354A73C657300337d08E9753fB3D";
```bash
Addresses of the deployed contracts:
- AuroraToken 💚: ----- 0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79
- AuroraPlus: --------- 0xccc2b1aD21666A5847A804a73a41F904C4a4A0Ec
- StakingManager: ----- 0x69e3a362ffD379cB56755B142c2290AFbE5A6Cc8
- Depositor 00: ------- 0xf56Baf1EE71fD4d6938c88E1C4bd0422ee768932
- Depositor 01: ------- 0x7ca831De9E59D7414313a1F7a003cc7d011caFE2
- StakedAuroraVault: -- 0xb01d35D469703c6dc5B369A1fDfD7D6009cA397F
- LiquidityPool: ------ 0x2b22F6ae30DD752B5765dB5f2fE8eF5c5d2F154B
```

Try me in Aurora Mainnet:

We started with 100 Aurora tokens. 20 were sent to Alice and 40 to Bob. Alice deposited 20 Aurora and received 20 stAUR, since this was the first deposit the ratio is 1-by-1. The next deposit is for 35 Auroras and Bob received `34.999`.

```sh
npx hardhat run scripts/check_status.js --network aurora_mainnet
# Contract status: =================================
# alice stAUR: 20000000000000000000
# alice AUROR: 0
# bob stAUR: 34999923905739695523
# bob AUROR: 5000000000000000000
npx hardhat run scripts/mainnet/status/view_st_aur_status.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.
Expand Down
58 changes: 40 additions & 18 deletions scripts/mainnet/_config.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,62 @@
//////////////////////
// ROBOT 🤖 Config //
//////////////////////

// Goerli test addresses
const STAKED_AURORA_VAULT_ADDRESS = "0xD6a1BEB40523A91B8424C02517219875A5D95c01";
const LIQUIDITY_POOL_ADDRESS = "0x9156273eE2684BE1C9F1064cCE43f30E766c8496";
const STAKING_MANAGER_ADDRESS = "0xf8Cb922aBdb0a2d4478ADE41a493d9A11e0e6009";
/////////////////////////////
// Global stAUR 🪐 Config //
/////////////////////////////

const DECIMALS = ethers.BigNumber.from(10).pow(18);

// AURORA Mainnet addresses
const AURORA_PLUS_ADDRESS = "0xccc2b1aD21666A5847A804a73a41F904C4a4A0Ec";
const AURORA_TOKEN_ADDRESS = "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79";
const DEPOSITOR_00_ADDRESS = "0xf56Baf1EE71fD4d6938c88E1C4bd0422ee768932";
const DEPOSITOR_01_ADDRESS = "0x7ca831De9E59D7414313a1F7a003cc7d011caFE2";
const LIQUIDITY_POOL_ADDRESS = "0x2b22F6ae30DD752B5765dB5f2fE8eF5c5d2F154B";
const STAKED_AURORA_VAULT_ADDRESS = "0xb01d35D469703c6dc5B369A1fDfD7D6009cA397F";
const STAKING_MANAGER_ADDRESS = "0x69e3a362ffD379cB56755B142c2290AFbE5A6Cc8";

const DEPOSITORS_ADDRESS = [ DEPOSITOR_00_ADDRESS, DEPOSITOR_01_ADDRESS ];

// Accounts
async function generateAccounts() {
const [ owner, operator ] = await ethers.getSigners();
const [
admin,
operator,
lpFeeCollector,
depositorFeeCollector
] = await ethers.getSigners();

// Current Contracts Accounts
const VAULT_ADMIN_ACCOUNT = owner;
const MANAGER_ADMIN_ACCOUNT = owner;
const VAULT_ADMIN_ACCOUNT = admin;
const MANAGER_ADMIN_ACCOUNT = admin;
const LIQ_POOL_ADMIN_ACCOUNT = admin;
const DEPOSITOR_ADMIN_ACCOUNT = admin;

const VAULT_OPERATOR_ACCOUNT = operator;
const MANAGER_OPERATOR_ACCOUNT = operator;

const DEPOSITOR_ADMIN_ACCOUNT = operator;
const LP_FEE_COLLECTOR_ACCOUNT = lpFeeCollector;
const DEPOSITOR_FEE_COLLECTOR_ACCOUNT = depositorFeeCollector;

return {
VAULT_ADMIN_ACCOUNT,
DEPOSITOR_ADMIN_ACCOUNT,
DEPOSITOR_FEE_COLLECTOR_ACCOUNT,
LIQ_POOL_ADMIN_ACCOUNT,
LP_FEE_COLLECTOR_ACCOUNT,
MANAGER_ADMIN_ACCOUNT,
VAULT_OPERATOR_ACCOUNT,
MANAGER_OPERATOR_ACCOUNT,
DEPOSITOR_ADMIN_ACCOUNT
VAULT_ADMIN_ACCOUNT,
VAULT_OPERATOR_ACCOUNT
};
}

module.exports = {
generateAccounts,
STAKED_AURORA_VAULT_ADDRESS,
AURORA_PLUS_ADDRESS,
AURORA_TOKEN_ADDRESS,
DECIMALS,
DEPOSITORS_ADDRESS,
DEPOSITOR_00_ADDRESS,
DEPOSITOR_01_ADDRESS,
LIQUIDITY_POOL_ADDRESS,
STAKING_MANAGER_ADDRESS,
DECIMALS
STAKED_AURORA_VAULT_ADDRESS,
STAKING_MANAGER_ADDRESS
};
2 changes: 1 addition & 1 deletion scripts/mainnet/deploy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const DECIMALS = ethers.BigNumber.from(10).pow(18);
const { DECIMALS } = require("./_config");

async function main() {
// stAUR Vault and Liquidity Pool Params
Expand Down
15 changes: 15 additions & 0 deletions scripts/mainnet/operations/_accounts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const ACCOUNTS = {
"single": "0x9DF9F65bfcF4Bc6E0C891Eed41a9766f0bf5C319",
"bulk": [
"0x9DF9F65bfcF4Bc6E0C891Eed41a9766f0bf5C319",
"0x0B438De1DCa9FBa6D14F17c1F0969ECc73C8186F",
"0xf5597b4094058efe44fe61C8f2844823Fc566e3c",
"0x5b8Dc6c888cB5b553f12e6Dd27E5848874f545DE",
"0x88F5354b08B674E93439a2be83dc1fFa8D849564",
"0x56D994c08CdC5c9189B4d6863129e5F195C6E8F2",
"0x7D4962861A7EA9208B5059Bf7Cc169B5c918e74B",
"0x8DF3a720c7BDBCf47EFAd8F6158d9DB036b81349"
]
}

module.exports = { ACCOUNTS };
57 changes: 0 additions & 57 deletions scripts/mainnet/operations/config.js

This file was deleted.

45 changes: 45 additions & 0 deletions scripts/mainnet/operations/lp_add_liquidity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const hre = require("hardhat");
const { getCurrentTimestamp } = require("../_utils");
const {
AURORA_TOKEN_ADDRESS,
DECIMALS,
LIQUIDITY_POOL_ADDRESS,
generateAccounts
} = require("../_config");

// ⚠️ UPDATE the amount to deposit.
const liquidityDeposit = ethers.BigNumber.from(4_900).mul(DECIMALS);

console.log("Mr Robot 🤖");
console.log("Started at: %s", getCurrentTimestamp());
console.log("Network: %s", hre.network.name);
console.log("-------------------------")

async function main() {
const { LIQ_POOL_ADMIN_ACCOUNT } = await generateAccounts();
const LiquidityPool = await ethers.getContractFactory("LiquidityPool");
const Token = await ethers.getContractFactory("Token");
const LiquidityPoolContract = await LiquidityPool.attach(LIQUIDITY_POOL_ADDRESS);
const AuroraTokenContract = await Token.attach(AURORA_TOKEN_ADDRESS);

const request01 = await AuroraTokenContract
.connect(LIQ_POOL_ADMIN_ACCOUNT)
.approve(LiquidityPoolContract.address, liquidityDeposit);
console.log("Approve request: %s", request01);
await request01.wait();

const request02 = await LiquidityPoolContract
.connect(LIQ_POOL_ADMIN_ACCOUNT)
.deposit(liquidityDeposit, LIQ_POOL_ADMIN_ACCOUNT.address);
console.log("Deposit request: %s", request02);
await request02.wait();

console.log("%s AURORA tokens deposited 🎱.", liquidityDeposit);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
46 changes: 46 additions & 0 deletions scripts/mainnet/operations/vault_deposit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const hre = require("hardhat");
const { getCurrentTimestamp } = require("../_utils");
const {
AURORA_TOKEN_ADDRESS,
DECIMALS,
STAKED_AURORA_VAULT_ADDRESS,
generateAccounts
} = require("../_config");

// ⚠️ UPDATE the amount to deposit.
// const vaultDeposit = ethers.BigNumber.from(300).mul(DECIMALS);
const vaultDeposit = ethers.BigNumber.from("718062481880544989308");

console.log("Mr Robot 🤖");
console.log("Started at: %s", getCurrentTimestamp());
console.log("Network: %s", hre.network.name);
console.log("-------------------------")

async function main() {
const { VAULT_ADMIN_ACCOUNT } = await generateAccounts();
const StakedAuroraVault = await ethers.getContractFactory("StakedAuroraVault");
const Token = await ethers.getContractFactory("Token");
const StakedAuroraVaultContract = await StakedAuroraVault.attach(STAKED_AURORA_VAULT_ADDRESS);
const AuroraTokenContract = await Token.attach(AURORA_TOKEN_ADDRESS);

const request01 = await AuroraTokenContract
.connect(VAULT_ADMIN_ACCOUNT)
.approve(StakedAuroraVaultContract.address, vaultDeposit);
console.log("Approve request: %s", request01);
await request01.wait();

const request02 = await StakedAuroraVaultContract
.connect(VAULT_ADMIN_ACCOUNT)
.deposit(vaultDeposit, VAULT_ADMIN_ACCOUNT.address);
console.log("Deposit request: %s", request02);
await request02.wait();

console.log("%s AURORA tokens deposited 🔐.", vaultDeposit);
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Loading

0 comments on commit 8348588

Please sign in to comment.