-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds script for calculating rebalance params (#23)
* script for calculating rebalance params * pretty * add tests --------- Co-authored-by: Pranav Bhardwaj <[email protected]>
- Loading branch information
Showing
8 changed files
with
171 additions
and
23 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
MAINNET_RPC_URL= | ||
RATED_API_URL= | ||
RATED_API_ACCESS_TOKEN= | ||
MOCK_RATED_API= |
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,38 @@ | ||
import { AuctionRebalanceProposer } from "../src/auctionRebalanceProposer"; | ||
import { eligibleSetTokens } from "../src/addresses"; | ||
import { DEFAULT_AUCTION_CONFIG } from "../src/auctionConfig"; | ||
import { getEnvVars } from "../src/utils"; | ||
import { setupMockRatedApi, getDefaultSigner } from "./utils"; | ||
|
||
async function main() { | ||
let mockedRatedApi = process.env.MOCK_RATED_API == "true"; | ||
if (mockedRatedApi) { | ||
setupMockRatedApi(); | ||
} | ||
|
||
const proposerSigner = await getDefaultSigner(); | ||
const { ratedAccessToken, ratedApiUrl } = getEnvVars(); | ||
|
||
console.log("Rated API URL: ", mockedRatedApi ? "LOCAL MOCK" : ratedApiUrl); | ||
|
||
const dsEthProposer = new AuctionRebalanceProposer( | ||
eligibleSetTokens.dsEth, | ||
ratedAccessToken, | ||
ratedApiUrl, | ||
DEFAULT_AUCTION_CONFIG, | ||
proposerSigner, | ||
); | ||
|
||
console.log("Calculating target units for dsEth"); | ||
let targetUnits = await dsEthProposer.getTargetUnits(); | ||
|
||
console.log("Getting rebalance proposal params for dsEth"); | ||
const params = await dsEthProposer.getProposeRebalanceParams(targetUnits); | ||
|
||
console.log("Propose rebalance params: ", params); | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 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
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
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