-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deploy scripts for rmm pendle tokens and pool
- Loading branch information
1 parent
93b43ab
commit 44fae61
Showing
4 changed files
with
83 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PRIVATE_KEY= | ||
ETHERSCAN_API_KEY= | ||
OP_SEPOLIA_RPC= |
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ libs = ["lib"] | |
|
||
[rpc_endpoints] | ||
mainnet = "${MAINNET_RPC_URL}" | ||
|
||
op_sepolia = "${OP_SEPOLIA_RPC_URL}" |
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,74 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import {Script, console2} from "forge-std/Script.sol"; | ||
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol"; | ||
import {PendleERC20SY} from "pendle/core/StandardizedYield/implementations/PendleERC20SY.sol"; | ||
import {SYBase} from "pendle/core/StandardizedYield/SYBase.sol"; | ||
import {IStandardizedYield} from "pendle/interfaces/IStandardizedYield.sol"; | ||
import {PendleYieldContractFactoryV2} from "pendle/core/YieldContractsV2/PendleYieldContractFactoryV2.sol"; | ||
import {PendleYieldTokenV2} from "pendle/core/YieldContractsV2/PendleYieldTokenV2.sol"; | ||
import {BaseSplitCodeFactory} from "pendle/core/libraries/BaseSplitCodeFactory.sol"; | ||
import {RMM} from "../src/RMM.sol"; | ||
import {ERC20} from "solmate/tokens/ERC20.sol"; | ||
|
||
contract DeployPool is Script { | ||
function setUp() public {} | ||
|
||
string public constant ENV_PRIVATE_KEY = "PRIVATE_KEY"; | ||
address payable public constant RMM_ADDRESS = payable(address(0)); | ||
address public constant SY_ADDRESS = address(0); | ||
address public constant PT_ADDRESS = address(0); | ||
uint256 public constant startPrice = 1 ether; | ||
uint256 public constant initialDepositX = 1 ether; | ||
uint256 public constant strike = 1 ether; | ||
uint256 public constant sigma = 1 ether; | ||
uint256 public constant tau = 365 days; | ||
uint256 public constant fee = 0; | ||
address public constant curator = address(0); | ||
|
||
function run() public { | ||
uint256 pk = vm.envUint(ENV_PRIVATE_KEY); | ||
address sender = vm.addr(pk); | ||
vm.startBroadcast(pk); | ||
|
||
require(RMM_ADDRESS != address(0), "RMM_ADDRESS not set"); | ||
require(SY_ADDRESS != address(0), "SY_ADDRESS not set"); | ||
require(PT_ADDRESS != address(0), "PT_ADDRESS not set"); | ||
|
||
uint256 maturity = tau + block.timestamp; | ||
|
||
(uint256 initialLiquidity, uint256 initialDepositY) = RMM(RMM_ADDRESS).prepareInit({ | ||
priceX: startPrice, | ||
amountX: initialDepositX, | ||
strike_: strike, | ||
sigma_: sigma, | ||
maturity_: maturity | ||
}); | ||
|
||
if (ERC20(SY_ADDRESS).allowance(msg.sender, address(this)) < initialDepositX) { | ||
ERC20(SY_ADDRESS).approve(RMM_ADDRESS, initialDepositX); | ||
} | ||
|
||
if (ERC20(PT_ADDRESS).allowance(msg.sender, address(this)) < initialDepositY) { | ||
ERC20(PT_ADDRESS).approve(RMM_ADDRESS, initialDepositY); | ||
} | ||
|
||
RMM(RMM_ADDRESS).init({ | ||
tokenX_: SY_ADDRESS, | ||
tokenY_: PT_ADDRESS, | ||
priceX: startPrice, | ||
amountX: initialDepositX, | ||
strike_: strike, | ||
sigma_: sigma, | ||
fee_: fee, | ||
maturity_: maturity, | ||
curator_: curator | ||
}); | ||
|
||
uint256 balance = ERC20(RMM_ADDRESS).balanceOf(sender); | ||
console2.log("RMM LPT balance: ", balance); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |