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

script set asset manager for a given pair #215

Draft
wants to merge 6 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amm-core",
"version": "0.1.0",
"version": "1.0.0",
"description": "Core AMM contracts for Reservoir Finance",
"eslintConfig": {
"parserOptions": {
Expand Down Expand Up @@ -33,6 +33,7 @@
"coverage": "export FOUNDRY_PROFILE=coverage && script/coverage_patch_deployer.sh && forge coverage --report lcov",
"deploy:avax:test": "forge script script/DeployScript.s.sol --target-contract DeployScript --fork-url \"http://127.0.0.1:8545\" --broadcast -vvvv --verify --ledger --mnemonic-derivation-paths \"m/44'/60'/0'/0/1\" --sender 0x2508b97B8041960ccA8AaBC7662F07EC8e285F6d",
"deploy:avax": "forge script script/DeployScript.s.sol --target-contract DeployScript --fork-url https://api.avax.network/ext/bc/C/rpc --broadcast -vvvv --verify --ledger --mnemonic-derivation-paths \"m/44'/60'/0'/0/1\" --sender 0x2508b97B8041960ccA8AaBC7662F07EC8e285F6d",
"setManager:avax": "forge script script/SetAssetManagerForPair.s.sol --target-contract SetAssetManagerForPair --fork-url https://api.avax.network/ext/bc/C/rpc --broadcast -vvvv --verify --ledger --mnemonic-derivation-paths \"m/44'/60'/0'/0/1\" --sender 0x2508b97B8041960ccA8AaBC7662F07EC8e285F6d",
"eslint": "npm run eslint:check",
"eslint:check": "eslint scripts",
"eslint:fix": "eslint scripts --fix",
Expand Down
29 changes: 29 additions & 0 deletions script/SetAssetManagerForPair.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "forge-std/Script.sol";

import { GenericFactory } from "src/ReservoirDeployer.sol";
import { AaveManager, IAssetManagedPair} from "src/asset-management/AaveManager.sol";
import { ReservoirTimelock } from "src/ReservoirTimelock.sol";

contract SetAssetManagerForPair is Script {

GenericFactory internal _factory = GenericFactory(0xDd723D9273642D82c5761a4467fD5265d94a22da);
ReservoirTimelock internal _timelock = ReservoirTimelock(payable(0xF820eCe0eaaeF4AF1535865Fb6F230f576e586c0));
AaveManager internal _assetManager = AaveManager(0xbe8A6DDDA2D2AA6BC88972801Be1119BD228f55e);

function run() external {
_queueSetManagerForPair(IAssetManagedPair(0x146D00567Cef404c1c0aAF1dfD2abEa9F260B8C7));
}

function _queueSetManagerForPair(IAssetManagedPair aPair) internal {
vm.startBroadcast(msg.sender);

bytes memory lCalldataForFactory = abi.encodeCall(IAssetManagedPair.setManager, (_assetManager));
bytes memory lCalldataForTimelock = abi.encodeCall(_factory.rawCall, (address(aPair) , lCalldataForFactory, 0));
_timelock.queueTransaction(address(_factory), 0, "rawCall(address,bytes,uint256)", lCalldataForTimelock, 1687452720);

vm.stopBroadcast();
}
}