Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to aludel create-aludel task, hardhat config, packages & documentation #18

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,25 @@ u in ?
Voting: https://cast.alchemist.wtf/
Discord: http://discord.alchemist.wtf/
FAQ: https://docs.alchemist.wtf/
GitHub: https://github.com/alchemistcoin/crucible-frontend
Crucible/Aludel Rewards: https://crucible.alchemist.wtf
GitHub: https://github.com/alchemistcoin
Crucible/Aludel Rewards: https://crucible.wtf
MistX FlashDEX: https://mistx.io/
Copper Fair Launch: https://copperlaunch.com/
Copper Launch: https://copperlaunch.com/

## Addresses

The Crucible NFT and Aludel LP reward contracts are forks of [Ampleforth](https://github.com/ampleforth)'s upcoming token geyser v2 and UniversalVault NFT contracts. This is a test in prod. _Use at your own risk._

### Mainnet

| Contract | Address | Description |
| ------------------ | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| Alchemist | [alchemistcoin.eth](https://etherscan.io/address/alchemistcoin.eth) | ERC20 token |
| Crucible NFT | [crucible.alchemistcoin.eth](https://etherscan.io/address/crucible.alchemistcoin.eth) | crucible nft contract |
| Aludel v1 | [aludel.alchemistcoin.eth](https://etherscan.io/address/aludel.alchemistcoin.eth) | ⚗️/WETH LP (Uniswap v2) reward program |
| Aludel v1.5 | [0x93c31fc68E613f9A89114f10B38F9fd2EA5de6BC](https://etherscan.io/address/0x93c31fc68E613f9A89114f10B38F9fd2EA5de6BC) | ⚗️/WETH LP (Uniswap v2) reward program |
| Aludel v1 | [aludel.alchemistcoin.eth](https://etherscan.io/address/aludel.alchemistcoin.eth) | ⚗️/WETH LP (Uniswap v2) reward program |
| Aludel v1.5 | [0x93c31fc68E613f9A89114f10B38F9fd2EA5de6BC](https://etherscan.io/address/0x93c31fc68E613f9A89114f10B38F9fd2EA5de6BC) | ⚗️/WETH LP (Uniswap v2) reward program |
| Multisig | [multisig.alchemistcoin.eth](https://etherscan.io/address/multisig.alchemistcoin.eth) | community multisig |
| UniswapV2Pair | [uniswap.alchemistcoin.eth](https://etherscan.io/address/uniswap.alchemistcoin.eth) | [⚗️/WETH uniswap pair](https://lp.mist.alchemist.wtf/) |
| UniswapV2Pair | [uniswap.alchemistcoin.eth](https://etherscan.io/address/uniswap.alchemistcoin.eth) | [⚗️/WETH uniswap pair](https://lp.mist.alchemist.wtf/) |
| TransmuterV1 | [transmuter.alchemistcoin.eth](https://etherscan.io/address/transmuter.alchemistcoin.eth) | router contract for batched transactions |
| StreamV1 | [0x979e2FdE487534be3f8a41cD57f11EF9E71cDC1A](https://etherscan.io/address/0x979e2FdE487534be3f8a41cD57f11EF9E71cDC1A) | inflation streaming |
| StreamV2 | [0xebf421c83069143f3bd29A5C690Df97CC261E49c](https://etherscan.io/address/0xebf421c83069143f3bd29A5C690Df97CC261E49c) | inflation streaming |
Expand All @@ -62,6 +64,28 @@ The Crucible NFT and Aludel LP reward contracts are forks of [Ampleforth](https:
| RewardPoolFactory | [0xF016fa84D5f3a252409a63b5cb89B555A0d27Ccf](https://etherscan.io/address/0xF016fa84D5f3a252409a63b5cb89B555A0d27Ccf) | factory contract |
| mistX Tip Jar | [mistx.eth](https://etherscan.io/address/mistx.eth) | mistX tip jar |
| MistXRouter | [0xA58f22e0766B3764376c92915BA545d583c19DBc](https://etherscan.io/address/0xA58f22e0766B3764376c92915BA545d583c19DBc) | mistX transaction router |
| Crucible pro minter| [0x075d940Fa6878c6164f3F44CFc584923c4F5654C](https://etherscan.io/address/0x075d940Fa6878c6164f3F44CFc584923c4F5654C) | crucible pro minter |

### Polygon
| Contract | Address | Description |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| Crucible NFT | [0xE2dD7930d8cA478d9aA38Ae0F5483B8A3B331C40](https://polygonscan.com/address/0xE2dD7930d8cA478d9aA38Ae0F5483B8A3B331C40)| crucible nft contract |
| TransmuterV1 | [0x4F91Ba2A5e6079f6fC929d062699e279bF85bBF7](https://polygonscan.com/address/0x4F91Ba2A5e6079f6fC929d062699e279bF85bBF7)| router contract for batched transactions |
| RewardPoolFactory | [0xf3D4b566ecEF776d44Aba803306480Ef634CB1Da](https://polygonscan.com/address/0xf3D4b566ecEF776d44Aba803306480Ef634CB1Da)| factory contract |
| PowerSwitchFactory | [0x1625b84D233dF4b131da7B49c2b540890aBA0E96](https://polygonscan.com/address/0x1625b84D233dF4b131da7B49c2b540890aBA0E96)| factory contract |
| Crucible template | [0x5D35445Ae5b57bEF0235CadAd78292F8baBDba23](https://polygonscan.com/address/0x5D35445Ae5b57bEF0235CadAd78292F8baBDba23)| crucible template |
| Crucible pro minter| [0x8971dac20F6061fD487555242748061e7c34B42E](https://polygonscan.com/address/0x8971dac20F6061fD487555242748061e7c34B42E)| crucible pro minter |

### Avalanche
| Contract | Address | Description |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| Crucible NFT | [0x6D07709A30fcE07901B2a6D8e1D6E6ac17eb96De](https://snowtrace.io/address/0x6D07709A30fcE07901B2a6D8e1D6E6ac17eb96De) | crucible nft contract |
| TransmuterV1 | [0xF18f0485e1dBC7f1Cea8620ddbf16187A40E6520](https://snowtrace.io/address/0xF18f0485e1dBC7f1Cea8620ddbf16187A40E6520) | router contract for batched transactions |
| RewardPoolFactory | [0x77d086FFB4e8E66288a73eAcF94bE603a0197dbb](https://snowtrace.io/address/0x77d086FFB4e8E66288a73eAcF94bE603a0197dbb) | factory contract |
| PowerSwitchFactory | [0xF6c1210Aca158bBD453A12604A03AeD2659ac0ef](https://snowtrace.io/address/0xF6c1210Aca158bBD453A12604A03AeD2659ac0ef) | factory contract |
| Crucible template | [0x5D15d226303cB96AC2EA7f760a313eA6bB36C508](https://snowtrace.io/address/0x5D15d226303cB96AC2EA7f760a313eA6bB36C508) | crucible template |
| Crucible pro minter| [0x6ec19EF96C569ac1B6c4Fe7404c5a948a9bB7416](https://snowtrace.io/address/0x6ec19EF96C569ac1B6c4Fe7404c5a948a9bB7416) | crucible pro minter |


## Check system status

Expand Down
15 changes: 14 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import './tasks/stream'
import './tasks/incentive'

import { HardhatUserConfig } from 'hardhat/config'
import { parseUnits } from 'ethers/lib/utils'

require('dotenv').config()

Expand Down Expand Up @@ -44,6 +43,20 @@ export default {
mnemonic,
},
},
avalanche: {
url:
'https://api.avax.network/ext/bc/C/rpc',
accounts: {
mnemonic,
},
},
polygon: {
url:
'https://polygon-mainnet.infura.io/v3/' + process.env.INFURA_ID,
accounts: {
mnemonic,
},
},
alchemist: {
url:
'https://eth-mainnet.gateway.pokt.network/v1/607839d619a5c80034fba9d8',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.1",
"@nomiclabs/hardhat-etherscan": "^2.1.1",
"@nomiclabs/hardhat-etherscan": "^3.0.3",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@openzeppelin/contracts": "^3.4.0-solc-0.7",
"@types/chai": "^4.2.14",
Expand Down
110 changes: 77 additions & 33 deletions tasks/aludel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,41 @@ task('create-aludel', 'Create an Aludel instance and deposit funds')
.addParam('owner', 'the admin of the system')
.addFlag('verify', 'verify contracts on etherscan')
.setAction(async (args, { ethers, run, network }) => {

// CLI Example - Polygon

// yarn hardhat create-aludel \
// --staking-token 0x0000000000000000000000000000000000000000 \
// --reward-token 0x0000000000000000000000000000000000000000 \
// --reward-amount 0 \
// --unlock-days 0 \
// --scaling-floor 1 \
// --scaling-ceiling 10 \
// --scaling-days 40 \
// --reward-pool-factory 0xf3D4b566ecEF776d44Aba803306480Ef634CB1Da \
// --power-switch-factory 0x1625b84D233dF4b131da7B49c2b540890aBA0E96 \
// --crucible-factory 0xE2dD7930d8cA478d9aA38Ae0F5483B8A3B331C40 \
// --owner 0x0000000000000000000000000000000000000000 \
// --network polygon \
// --verify

// CLI Example - Mainnet

// yarn hardhat create-aludel \
// --staking-token 0x0000000000000000000000000000000000000000 \
// --reward-token 0x0000000000000000000000000000000000000000 \
// --reward-amount 0 \
// --unlock-days 0 \
// --scaling-floor 1 \
// --scaling-ceiling 14 \
// --scaling-days 7 \
// --reward-pool-factory 0xF016fa84D5f3a252409a63b5cb89B555A0d27Ccf \
// --power-switch-factory 0x89d2D92eaCE71977dD0b159062f8ec90EA64fc24 \
// --crucible-factory 0x54e0395CFB4f39beF66DBCd5bD93Cca4E9273D56 \
// --owner 0x0000000000000000000000000000000000000000 \
// --network mainnet \
// --verify

// log config

console.log('Network')
Expand All @@ -84,12 +119,12 @@ task('create-aludel', 'Create an Aludel instance and deposit funds')

await run('compile')

// get signer
// // get signer

const signer = (await ethers.getSigners())[0]
console.log('Signer')
console.log(' at', signer.address)
console.log(' ETH', formatEther(await signer.getBalance()))
console.log(' balance', formatEther(await signer.getBalance()))

// load contracts

Expand All @@ -103,13 +138,19 @@ task('create-aludel', 'Create an Aludel instance and deposit funds')

console.log('Validate balances')

const rewardAmount = parseUnits(
args.rewardAmount,
await rewardToken.decimals(),
)
let rewardAmount;
// reward token balance check
if (Number(args.rewardAmount) > 0) {
rewardAmount = parseUnits(
args.rewardAmount,
await rewardToken.decimals(),
)

expect(await rewardToken.balanceOf(signer.address)).to.be.gte(rewardAmount)
}

expect(await rewardToken.balanceOf(signer.address)).to.be.gte(rewardAmount)
expect(await signer.getBalance()).to.be.gte(parseEther('1'))
// native token balance check
expect(await signer.getBalance()).to.be.gte(parseEther('0.5'))

// deploy instance

Expand All @@ -132,23 +173,25 @@ task('create-aludel', 'Create an Aludel instance and deposit funds')
aludelArgs,
)

// fund aludel
if (Number(args.rewardAmount) > 0) {
// fund aludel

console.log('Approve reward deposit')
console.log('Approve reward deposit')

const approveTx = await rewardToken.approve(
aludel.address,
constants.MaxUint256,
)
await approveTx.wait()
const approveTx = await rewardToken.approve(
aludel.address,
constants.MaxUint256,
)
await approveTx.wait()

console.log(' in', approveTx.hash)
console.log(' in', approveTx.hash)

console.log('Deposit reward')
console.log('Deposit reward')

const depositTx = await aludel.fund(rewardAmount, args.unlockDays * DAY)
const depositTx = await aludel.fund(rewardAmount, args.unlockDays * DAY)

console.log(' in', depositTx.hash)
console.log(' in', depositTx.hash)
}

// add crucible factory

Expand All @@ -159,26 +202,27 @@ task('create-aludel', 'Create an Aludel instance and deposit funds')
console.log(' in', registerTx.hash)

// transfer ownership
if (args.owner !== '', args.owner.toLowerCase() != signer.address.toLowerCase()) {
const powerSwitch = await ethers.getContractAt(
'PowerSwitch',
await aludel.getPowerSwitch(),
signer,
)

const powerSwitch = await ethers.getContractAt(
'PowerSwitch',
await aludel.getPowerSwitch(),
signer,
)

console.log('Transfer admin')
console.log('Transfer admin')

const transferAdminTx = await aludel.transferOwnership(args.owner)
const transferAdminTx = await aludel.transferOwnership(args.owner)

console.log(' to', await aludel.owner())
console.log(' in', transferAdminTx.hash)
console.log(' to', await aludel.owner())
console.log(' in', transferAdminTx.hash)

console.log('Transfer power controller')
console.log('Transfer power controller')

const transferPowerTx = await powerSwitch.transferOwnership(args.owner)
const transferPowerTx = await powerSwitch.transferOwnership(args.owner)

console.log(' to', await powerSwitch.owner())
console.log(' in', transferPowerTx.hash)
console.log(' to', await powerSwitch.owner())
console.log(' in', transferPowerTx.hash)
}

// verify source

Expand Down
Loading