Skip to content

Commit

Permalink
Light quest (#23)
Browse files Browse the repository at this point in the history
* Tests for Light Quest

* Tests LightQuest & Controller

* Deploy LightQuest on test fork

* Reduce protocol fee ratio to 4%

* Fork test re-deploy

* Deploy Light Quest contracts
  • Loading branch information
Kogaroshi authored Dec 2, 2022
1 parent aae1559 commit 70c6c94
Show file tree
Hide file tree
Showing 20 changed files with 6,418 additions and 15 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ Dark Quest Board: 0xF9F6F5F2250Bd151797DDF2e02644123b0c4A114

Dark MultiMerkleDistributor:
0xce6dc32252d85e2e955Bfd3b85660917F040a933


Light Quest Board - vlCVX: 0x05CaDb2CCC5bE3f6BF8592B9be39c78FF03Cc0DB

Light MultiMerkleDistributor - vlCVX:
0xE329134C2384cF59c34c98B0ABD0C70aB524e335

**veBAL:**
Quest Board: 0x8b2ba835056965808aD88e7Ad7866BD57aE75839
Expand All @@ -42,6 +48,12 @@ Dark Quest Board: 0x609FB23b9EA7CB3eDaF56DB5dAF07C8E94C155De

Dark MultiMerkleDistributor:
0x358549D4Cb7f97f389812B86673a6cf8c1FF59D2


Light Quest Board - vlAURA: 0x653D8f14292A1C5239d6183b333De1F2e8669310

Light MultiMerkleDistributor - vlAURA:
0xbc269b4e4D056821edDa92D936b8EC8979b1129C


## Dependencies & Installation
Expand Down
1,066 changes: 1,066 additions & 0 deletions contracts/LightQuestBoard.sol

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions contracts/test/MockGaugeController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ pragma solidity ^0.8.0;
* @dev Mock GaugeController used for tests
*/
contract MockGaugeController {

uint256 constant private MAXTIME = 4 * 365 * 86400; // 4 years
uint256 constant public MAXTIME = 4 * 365 * 86400; // 4 years

struct VotedSlope {
uint slope;
uint power;
uint end;
}

struct Point {
uint bias;
uint slope;
Expand Down Expand Up @@ -69,7 +69,7 @@ contract MockGaugeController {

userVotes[gauge][user] = VotedSlope(
slope,
10000,
10000, //We don't care about the percent of balance here, can put all to 100%, since we can put multiple votes per voters
end
);

Expand Down
102 changes: 102 additions & 0 deletions scripts/deploy/deploy_all_light.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
export { };
const hre = require("hardhat");

const ethers = hre.ethers;

const network = hre.network.name;

const {
GAUGE_CONTROLLER,
CONVEX_VOTER_ADDRESS
} = require('./utils/constant');

const params_path = () => {
if (network === 'fork') {
return './utils/fork_params'
}
else {
return './utils/main_params'
}
}

const param_file_path = params_path();

const {
CHEST_ADDRESS
} = require(param_file_path);

async function main() {

const deployer = (await hre.ethers.getSigners())[0];

const LightQuestBoard = await ethers.getContractFactory("LightQuestBoard");
const MultiMerkleDistributor = await ethers.getContractFactory("MultiMerkleDistributor");


console.log('Deploying LightQuestBoard ...')

const board = await LightQuestBoard.deploy(
GAUGE_CONTROLLER,
CONVEX_VOTER_ADDRESS,
CHEST_ADDRESS
)
await board.deployed()

console.log('LightQuestBoard : ', board.address)

await board.deployTransaction.wait(15);

console.log()
console.log('Deploying Distributor ...')

const distributor = await MultiMerkleDistributor.deploy(
board.address
)
await distributor.deployed()

console.log('Distributor : ', distributor.address)

await distributor.deployTransaction.wait(15);

console.log()
console.log('Initiate Distributor ...')

let tx;

tx = await board.connect(deployer).initiateDistributor(distributor.address)
await tx.wait(10)

console.log()
console.log('Approve Manager ...')

tx = await board.connect(deployer).approveManager(deployer.address)
await tx.wait(10)
/*tx = await chest.connect(deployer).approveManager(deployer.address)
await tx.wait(10)*/


if(network === 'mainnet') {
await hre.run("verify:verify", {
address: distributor.address,
constructorArguments: [
board.address
],
});

await hre.run("verify:verify", {
address: board.address,
constructorArguments: [
GAUGE_CONTROLLER,
CONVEX_VOTER_ADDRESS,
CHEST_ADDRESS
],
});
}
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
52 changes: 52 additions & 0 deletions scripts/deploy/deploy_light_board_aura.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export { };
const hre = require("hardhat");

const ethers = hre.ethers;

const network = hre.network.name;

const {
GAUGE_CONTROLLER_BALANCER,
AURA_VOTER_ADDRESS
} = require('./utils/constant');

const {
CHEST_ADDRESS
} = require('./utils/main_params');

async function main() {

const deployer = (await hre.ethers.getSigners())[0];

const LightQuestBoard = await ethers.getContractFactory("LightQuestBoard");

console.log('Deploying LightQuestBoard ...')

const board = await LightQuestBoard.deploy(
GAUGE_CONTROLLER_BALANCER,
AURA_VOTER_ADDRESS,
CHEST_ADDRESS
)
await board.deployed()

console.log('LightQuestBoard : ', board.address)

await board.deployTransaction.wait(15);


await hre.run("verify:verify", {
address: board.address,
constructorArguments: [
GAUGE_CONTROLLER_BALANCER,
AURA_VOTER_ADDRESS,
CHEST_ADDRESS
],
});
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
52 changes: 52 additions & 0 deletions scripts/deploy/deploy_light_board_cvx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export { };
const hre = require("hardhat");

const ethers = hre.ethers;

const network = hre.network.name;

const {
GAUGE_CONTROLLER,
CONVEX_VOTER_ADDRESS
} = require('./utils/constant');

const {
CHEST_ADDRESS
} = require('./utils/main_params');

async function main() {

const deployer = (await hre.ethers.getSigners())[0];

const LightQuestBoard = await ethers.getContractFactory("LightQuestBoard");

console.log('Deploying LightQuestBoard ...')

const board = await LightQuestBoard.deploy(
GAUGE_CONTROLLER,
CONVEX_VOTER_ADDRESS,
CHEST_ADDRESS
)
await board.deployed()

console.log('LightQuestBoard : ', board.address)

await board.deployTransaction.wait(15);


await hre.run("verify:verify", {
address: board.address,
constructorArguments: [
GAUGE_CONTROLLER,
CONVEX_VOTER_ADDRESS,
CHEST_ADDRESS
],
});
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
43 changes: 43 additions & 0 deletions scripts/deploy/deploy_light_distributor_aura.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
export { };
const hre = require("hardhat");

const ethers = hre.ethers;

const network = hre.network.name;


const {
LIGHT_BOARD_AURA_ADDRESS
} = require('./utils/main_params');

async function main() {

const deployer = (await hre.ethers.getSigners())[0];

const MultiMerkleDistributor = await ethers.getContractFactory("MultiMerkleDistributor");
console.log('Deploying Light Distributor ...')

const distributor = await MultiMerkleDistributor.deploy(
LIGHT_BOARD_AURA_ADDRESS
)
await distributor.deployed()

console.log('Light Distributor : ', distributor.address)

await distributor.deployTransaction.wait(15);


await hre.run("verify:verify", {
address: distributor.address,
constructorArguments: [
LIGHT_BOARD_AURA_ADDRESS
],
});
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
43 changes: 43 additions & 0 deletions scripts/deploy/deploy_light_distributor_cvx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
export { };
const hre = require("hardhat");

const ethers = hre.ethers;

const network = hre.network.name;


const {
LIGHT_BOARD_CONVEX_ADDRESS
} = require('./utils/main_params');

async function main() {

const deployer = (await hre.ethers.getSigners())[0];

const MultiMerkleDistributor = await ethers.getContractFactory("MultiMerkleDistributor");
console.log('Deploying Light Distributor ...')

const distributor = await MultiMerkleDistributor.deploy(
LIGHT_BOARD_CONVEX_ADDRESS
)
await distributor.deployed()

console.log('Light Distributor : ', distributor.address)

await distributor.deployTransaction.wait(15);


await hre.run("verify:verify", {
address: distributor.address,
constructorArguments: [
LIGHT_BOARD_CONVEX_ADDRESS
],
});
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});
Loading

0 comments on commit 70c6c94

Please sign in to comment.