-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from aurora-is-near/feat/propose-streams
Feat/propose streams
- Loading branch information
Showing
7 changed files
with
295 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const hre = require("hardhat"); | ||
|
||
async function main() { | ||
const { | ||
SCHEDULE_PERIOD, | ||
TAU_PER_STREAM, | ||
SCHEDULE_START_TIME, | ||
AURORA_TOKEN, | ||
} = process.env | ||
const STREAM_AURORA_AMOUNT = hre.ethers.utils.parseUnits("510000", 18) | ||
const auroraAddress = AURORA_TOKEN ? AURORA_TOKEN : (await hre.ethers.getContract("Token")).address | ||
const startTime = SCHEDULE_START_TIME ? parseInt(SCHEDULE_START_TIME) : Math.floor(Date.now()/ 1000) + 60 | ||
const STREAM_TOKEN_ADDRESS = "0x9f1f933c660a1dc856f0e0fe058435879c5ccef0" | ||
const STREAM_TOKEN_DECIMALS = 18 | ||
const STREAM_OWNER = "0x7DB96909Da3fAbaB6c7Ee2c97c4F98221d583530" | ||
const scheduleTimes = [ | ||
startTime, | ||
startTime + parseInt(SCHEDULE_PERIOD), | ||
startTime + 2 * parseInt(SCHEDULE_PERIOD), | ||
startTime + 3 * parseInt(SCHEDULE_PERIOD), | ||
startTime + 4 * parseInt(SCHEDULE_PERIOD) | ||
] | ||
const scheduleRewards = [ | ||
hre.ethers.utils.parseUnits("150000000", STREAM_TOKEN_DECIMALS), // 100% | ||
hre.ethers.utils.parseUnits("127500000", STREAM_TOKEN_DECIMALS), // 85% | ||
hre.ethers.utils.parseUnits("97500000", STREAM_TOKEN_DECIMALS), // 65% | ||
hre.ethers.utils.parseUnits("52500000", STREAM_TOKEN_DECIMALS), // 35% | ||
// Last amount should be 0 so scheduleTimes[4] marks the end of the stream schedule. | ||
hre.ethers.utils.parseUnits("0", STREAM_TOKEN_DECIMALS), // 0M | ||
] | ||
const MAX_DEPOSIT_AMOUNT = scheduleRewards[0] | ||
const MIN_DEPOSIT_AMOUNT = scheduleRewards[0].div(2) // or something less | ||
|
||
const [ streamManager ] = await hre.ethers.getSigners() | ||
|
||
const jetStakingV1 = await hre.ethers.getContract("JetStakingV1") | ||
const streamManagerRole = await jetStakingV1.STREAM_MANAGER_ROLE() | ||
if(!await jetStakingV1.hasRole(streamManagerRole, streamManager.address)) { | ||
throw new Error(`Signer '${streamManager.address}' doesn't have STREAM_MANAGER_ROLE`) | ||
} | ||
|
||
// ^^^^^ TODO: Edit above parameters ^^^^^ | ||
// ======================================= | ||
|
||
const auroraToken = new hre.ethers.Contract( | ||
auroraAddress, | ||
["function approve(address spender, uint value)"], | ||
streamManager | ||
) | ||
const approvalTx = await auroraToken.approve(jetStakingV1.address, STREAM_AURORA_AMOUNT) | ||
console.log("Approving AURORA: ", approvalTx.hash) | ||
await approvalTx.wait() | ||
|
||
const proposalTx = await jetStakingV1.proposeStream( | ||
STREAM_OWNER, | ||
STREAM_TOKEN_ADDRESS, | ||
STREAM_AURORA_AMOUNT, | ||
MAX_DEPOSIT_AMOUNT, | ||
MIN_DEPOSIT_AMOUNT, | ||
scheduleTimes, | ||
scheduleRewards, | ||
parseInt(TAU_PER_STREAM), | ||
) | ||
console.log("Proposing stream: ", proposalTx.hash) | ||
await proposalTx.wait() | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const hre = require("hardhat"); | ||
|
||
async function main() { | ||
const { | ||
SCHEDULE_PERIOD, | ||
TAU_PER_STREAM, | ||
SCHEDULE_START_TIME, | ||
AURORA_TOKEN, | ||
} = process.env | ||
const STREAM_AURORA_AMOUNT = hre.ethers.utils.parseUnits("300000", 18) | ||
const auroraAddress = AURORA_TOKEN ? AURORA_TOKEN : (await hre.ethers.getContract("Token")).address | ||
const startTime = SCHEDULE_START_TIME ? parseInt(SCHEDULE_START_TIME) : Math.floor(Date.now()/ 1000) + 60 | ||
const STREAM_TOKEN_ADDRESS = "0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f" | ||
const STREAM_TOKEN_DECIMALS = 18 | ||
const STREAM_OWNER = "0x2D05FfFE70CE64c5954710D4C308dB31C8dBd8dE" | ||
const scheduleTimes = [ | ||
startTime, | ||
startTime + parseInt(SCHEDULE_PERIOD), | ||
startTime + 2 * parseInt(SCHEDULE_PERIOD), | ||
startTime + 3 * parseInt(SCHEDULE_PERIOD), | ||
startTime + 4 * parseInt(SCHEDULE_PERIOD) | ||
] | ||
const scheduleRewards = [ | ||
hre.ethers.utils.parseUnits("377500000", STREAM_TOKEN_DECIMALS), // 100% | ||
hre.ethers.utils.parseUnits("320875000", STREAM_TOKEN_DECIMALS), // 85% | ||
hre.ethers.utils.parseUnits("245375000", STREAM_TOKEN_DECIMALS), // 65% | ||
hre.ethers.utils.parseUnits("132125000", STREAM_TOKEN_DECIMALS), // 35% | ||
// Last amount should be 0 so scheduleTimes[4] marks the end of the stream schedule. | ||
hre.ethers.utils.parseUnits("0", STREAM_TOKEN_DECIMALS), // 0M or 0% | ||
] | ||
const MAX_DEPOSIT_AMOUNT = scheduleRewards[0] | ||
const MIN_DEPOSIT_AMOUNT = scheduleRewards[0].div(2) // or something less | ||
|
||
const [ streamManager ] = await hre.ethers.getSigners() | ||
|
||
const jetStakingV1 = await hre.ethers.getContract("JetStakingV1") | ||
const streamManagerRole = await jetStakingV1.STREAM_MANAGER_ROLE() | ||
if(!await jetStakingV1.hasRole(streamManagerRole, streamManager.address)) { | ||
throw new Error(`Signer '${streamManager.address}' doesn't have STREAM_MANAGER_ROLE`) | ||
} | ||
|
||
// ^^^^^ TODO: Edit above parameters ^^^^^ | ||
// ======================================= | ||
|
||
const auroraToken = new hre.ethers.Contract( | ||
auroraAddress, | ||
["function approve(address spender, uint value)"], | ||
streamManager | ||
) | ||
const approvalTx = await auroraToken.approve(jetStakingV1.address, STREAM_AURORA_AMOUNT) | ||
console.log("Approving AURORA: ", approvalTx.hash) | ||
await approvalTx.wait() | ||
|
||
const proposalTx = await jetStakingV1.proposeStream( | ||
STREAM_OWNER, | ||
STREAM_TOKEN_ADDRESS, | ||
STREAM_AURORA_AMOUNT, | ||
MAX_DEPOSIT_AMOUNT, | ||
MIN_DEPOSIT_AMOUNT, | ||
scheduleTimes, | ||
scheduleRewards, | ||
parseInt(TAU_PER_STREAM), | ||
) | ||
console.log("Proposing stream: ", proposalTx.hash) | ||
await proposalTx.wait() | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const hre = require("hardhat"); | ||
|
||
async function main() { | ||
const { | ||
SCHEDULE_PERIOD, | ||
TAU_PER_STREAM, | ||
SCHEDULE_START_TIME, | ||
AURORA_TOKEN, | ||
} = process.env | ||
const STREAM_AURORA_AMOUNT = hre.ethers.utils.parseUnits("30000", 18) | ||
const auroraAddress = AURORA_TOKEN ? AURORA_TOKEN : (await hre.ethers.getContract("Token")).address | ||
const startTime = SCHEDULE_START_TIME ? parseInt(SCHEDULE_START_TIME) : Math.floor(Date.now()/ 1000) + 60 | ||
const STREAM_TOKEN_ADDRESS = "0xFa94348467f64D5A457F75F8bc40495D33c65aBB" | ||
const STREAM_TOKEN_DECIMALS = 18 | ||
const STREAM_OWNER = "0x1232726DA91B25D22239C5707FE85E8F078F3532" | ||
const scheduleTimes = [ | ||
startTime, | ||
startTime + parseInt(SCHEDULE_PERIOD), | ||
startTime + 2 * parseInt(SCHEDULE_PERIOD), | ||
startTime + 3 * parseInt(SCHEDULE_PERIOD), | ||
startTime + 4 * parseInt(SCHEDULE_PERIOD) | ||
] | ||
const scheduleRewards = [ | ||
hre.ethers.utils.parseUnits("1000000", STREAM_TOKEN_DECIMALS), // 100% | ||
hre.ethers.utils.parseUnits("850000", STREAM_TOKEN_DECIMALS), // 85% | ||
hre.ethers.utils.parseUnits("650000", STREAM_TOKEN_DECIMALS), // 65% | ||
hre.ethers.utils.parseUnits("350000", STREAM_TOKEN_DECIMALS), // 35% | ||
// Last amount should be 0 so scheduleTimes[4] marks the end of the stream schedule. | ||
hre.ethers.utils.parseUnits("0", STREAM_TOKEN_DECIMALS), // 0M | ||
] | ||
const MAX_DEPOSIT_AMOUNT = scheduleRewards[0] | ||
const MIN_DEPOSIT_AMOUNT = scheduleRewards[0].div(2) // or something less | ||
|
||
const [ streamManager ] = await hre.ethers.getSigners() | ||
|
||
const jetStakingV1 = await hre.ethers.getContract("JetStakingV1") | ||
const streamManagerRole = await jetStakingV1.STREAM_MANAGER_ROLE() | ||
if(!await jetStakingV1.hasRole(streamManagerRole, streamManager.address)) { | ||
throw new Error(`Signer '${streamManager.address}' doesn't have STREAM_MANAGER_ROLE`) | ||
} | ||
|
||
// ^^^^^ TODO: Edit above parameters ^^^^^ | ||
// ======================================= | ||
|
||
const auroraToken = new hre.ethers.Contract( | ||
auroraAddress, | ||
["function approve(address spender, uint value)"], | ||
streamManager | ||
) | ||
const approvalTx = await auroraToken.approve(jetStakingV1.address, STREAM_AURORA_AMOUNT) | ||
console.log("Approving AURORA: ", approvalTx.hash) | ||
await approvalTx.wait() | ||
|
||
const proposalTx = await jetStakingV1.proposeStream( | ||
STREAM_OWNER, | ||
STREAM_TOKEN_ADDRESS, | ||
STREAM_AURORA_AMOUNT, | ||
MAX_DEPOSIT_AMOUNT, | ||
MIN_DEPOSIT_AMOUNT, | ||
scheduleTimes, | ||
scheduleRewards, | ||
parseInt(TAU_PER_STREAM), | ||
) | ||
console.log("Proposing stream: ", proposalTx.hash) | ||
await proposalTx.wait() | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const hre = require("hardhat"); | ||
|
||
async function main() { | ||
const { | ||
SCHEDULE_PERIOD, | ||
TAU_PER_STREAM, | ||
SCHEDULE_START_TIME, | ||
AURORA_TOKEN, | ||
} = process.env | ||
const STREAM_AURORA_AMOUNT = hre.ethers.utils.parseUnits("0", 18) // zero arora reward for the USN stream | ||
// const auroraAddress = AURORA_TOKEN ? AURORA_TOKEN : (await hre.ethers.getContract("Token")).address | ||
const startTime = SCHEDULE_START_TIME ? parseInt(SCHEDULE_START_TIME) : Math.floor(Date.now()/ 1000) + 60 | ||
const STREAM_TOKEN_ADDRESS = "0x5183e1b1091804bc2602586919e6880ac1cf2896" | ||
const STREAM_TOKEN_DECIMALS = 18 | ||
const STREAM_OWNER = "0x290FF2b6Ea23F9c8D18F63449Cc38F8dDa02CE6d" | ||
const scheduleTimes = [ | ||
startTime, | ||
startTime + parseInt(SCHEDULE_PERIOD) | ||
] | ||
const scheduleRewards = [ | ||
hre.ethers.utils.parseUnits("1800000", STREAM_TOKEN_DECIMALS), // 100% | ||
// Last amount should be 0 so scheduleTimes[4] marks the end of the stream schedule. | ||
hre.ethers.utils.parseUnits("0", STREAM_TOKEN_DECIMALS), // 0M | ||
] | ||
|
||
const MAX_DEPOSIT_AMOUNT = scheduleRewards[0] | ||
const MIN_DEPOSIT_AMOUNT = scheduleRewards[0].div(2) // or something less | ||
|
||
const [ streamManager ] = await hre.ethers.getSigners() | ||
|
||
const jetStakingV1 = await hre.ethers.getContract("JetStakingV1") | ||
const streamManagerRole = await jetStakingV1.STREAM_MANAGER_ROLE() | ||
if(!await jetStakingV1.hasRole(streamManagerRole, streamManager.address)) { | ||
throw new Error(`Signer '${streamManager.address}' doesn't have STREAM_MANAGER_ROLE`) | ||
} | ||
|
||
// ^^^^^ TODO: Edit above parameters ^^^^^ | ||
// ======================================= | ||
|
||
// FOR this stream we don't have approval for AURORA rewards | ||
|
||
// const auroraToken = new hre.ethers.Contract( | ||
// auroraAddress, | ||
// ["function approve(address spender, uint value)"], | ||
// streamManager | ||
// ) | ||
// const approvalTx = await auroraToken.approve(jetStakingV1.address, STREAM_AURORA_AMOUNT) | ||
// console.log("Approving AURORA: ", approvalTx.hash) | ||
// await approvalTx.wait() | ||
|
||
const proposalTx = await jetStakingV1.proposeStream( | ||
STREAM_OWNER, | ||
STREAM_TOKEN_ADDRESS, | ||
STREAM_AURORA_AMOUNT, | ||
MAX_DEPOSIT_AMOUNT, | ||
MIN_DEPOSIT_AMOUNT, | ||
scheduleTimes, | ||
scheduleRewards, | ||
parseInt(TAU_PER_STREAM), | ||
) | ||
console.log("Proposing stream: ", proposalTx.hash) | ||
await proposalTx.wait() | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |