@pendle/core-v2 6.6.0 → 6.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/cross-chain/FixedPricePTAMMV2.sol/FixedPricePTAMMV2.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/FixedPricePTAMMV2.sol/FixedPricePTAMMV2.json +766 -0
- package/build/artifacts/contracts/cross-chain/PendleSwapHelper.sol/PendleSwapHelper.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/PendleSwapHelper.sol/PendleSwapHelper.json +99 -0
- package/build/artifacts/contracts/cross-chain/funder/BridgeFunder.sol/BridgeFunder.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/funder/BridgeFunder.sol/BridgeFunder.json +210 -0
- package/build/artifacts/contracts/cross-chain/oftImpl/hub/OFTAdapterAltImpl.sol/OFTAdapterAltImpl.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/oftImpl/hub/OFTAdapterAltImpl.sol/OFTAdapterAltImpl.json +1294 -0
- package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalTokenAlt.sol/PendleBridgedPrincipalTokenAlt.dbg.json +4 -0
- package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalTokenAlt.sol/PendleBridgedPrincipalTokenAlt.json +1602 -0
- package/build/artifacts/contracts/interfaces/IMarketSweed.sol/IMarketSweed.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiqV3.sol/IPActionAddRemoveLiqV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCallbackV3.sol/IPActionCallbackV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSimple.sol/IPActionSimple.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageV4.sol/IPActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTV3.sol/IPActionSwapPTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYTV3.sol/IPActionSwapYTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.json +0 -88
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionAddRemoveLiqV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionMiscV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionStorageEvents.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapPTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapYTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPAllEventsV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBridgeFunder.sol/IPBridgeFunder.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPBridgeFunder.sol/IPBridgeFunder.json +85 -0
- package/build/artifacts/contracts/interfaces/IPFixedPricePTAMMV2.sol/IPFixedPricePTAMMSwapCallback.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPFixedPricePTAMM.sol → IPFixedPricePTAMMV2.sol}/IPFixedPricePTAMMSwapCallback.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFixedPricePTAMMV2.sol/IPFixedPricePTAMMV2.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPFixedPricePTAMM.sol/IPFixedPricePTAMM.json → IPFixedPricePTAMMV2.sol/IPFixedPricePTAMMV2.json} +285 -93
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitOrderType.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitRouter.json +156 -0
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitRouterCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPSwapHelper.sol/IPSwapHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPActionCrossChain.sol/IPActionCrossChain.json → IPSwapHelper.sol/IPSwapHelper.json} +2 -2
- package/build/artifacts/contracts/limit/LimitMathCore.sol/LimitMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/limit/LimitMathCore.sol/LimitMathCore.json +2 -2
- package/build/artifacts/contracts/limit/LimitRouterBase.sol/LimitRouterBase.dbg.json +1 -1
- package/build/artifacts/contracts/limit/LimitRouterBase.sol/LimitRouterBase.json +258 -1
- package/build/artifacts/contracts/limit/PendleLimitRouter.sol/PendleLimitRouter.dbg.json +1 -1
- package/build/artifacts/contracts/limit/PendleLimitRouter.sol/PendleLimitRouter.json +265 -3
- package/build/artifacts/contracts/limit/helpers/MintSyHelper.sol/MintSyHelper.dbg.json +4 -0
- package/build/artifacts/contracts/limit/helpers/MintSyHelper.sol/MintSyHelper.json +156 -0
- package/build/artifacts/contracts/offchain-helpers/ExpiredLpPtRedeemer.sol/ExpiredLpPtRedeemer.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/ExpiredLpPtRedeemer.sol/ExpiredLpPtRedeemer.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/LimitBackendHelperV2.sol/LimitBackendHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/LimitBackendHelperV2.sol/LimitBackendHelperV2.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/MarketSweed.sol/MarketSweed.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketSweed.sol/MarketSweed.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/PendleFeeSetter.sol/PendleFeeSetter.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleFeeSetter.sol/PendleFeeSetter.json +33 -2
- package/build/artifacts/contracts/offchain-helpers/PendleProxyAdmin.sol/PendleProxyAdmin.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/PendleProxyAdmin.sol/PendleProxyAdmin.json +171 -0
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol/PendleCommonPoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol/PendleCommonPoolDeployHelperV2.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol/PendlePoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol/PendlePoolDeployHelperV2.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtInLibV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtInLibV1.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtOutLibV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtOutLibV1.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiqV3.sol/ActionAddRemoveLiqV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiqV3.sol/ActionAddRemoveLiqV3.json +2 -2
- package/build/artifacts/contracts/router/ActionCallbackV3.sol/ActionCallbackV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionCallbackV3.sol/ActionCallbackV3.json +2 -2
- package/build/artifacts/contracts/router/ActionMiscV3.sol/ActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMiscV3.sol/ActionMiscV3.json +2 -2
- package/build/artifacts/contracts/router/ActionSimple.sol/ActionSimple.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSimple.sol/ActionSimple.json +2 -2
- package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapPTV3.sol/ActionSwapPTV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPTV3.sol/ActionSwapPTV3.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYTV3.sol/ActionSwapYTV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYTV3.sol/ActionSwapYTV3.json +2 -2
- package/build/artifacts/contracts/router/PendleRouterV4.sol/PendleRouterV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterV4.sol/PendleRouterV4.json +2 -2
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.dbg.json +1 -1
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.json +2 -2
- package/build/artifacts/contracts/router/base/ActionBase.sol/ActionBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.json +2 -2
- package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtInLibV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtInLibV2.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtOutLibV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtOutLibV2.json +2 -2
- package/contracts/cross-chain/FixedPricePTAMMV2.sol +162 -0
- package/contracts/{router/ActionCrossChain.sol → cross-chain/PendleSwapHelper.sol} +11 -7
- package/contracts/cross-chain/funder/BridgeFunder.sol +61 -0
- package/contracts/cross-chain/oftImpl/hub/OFTAdapterAltImpl.sol +55 -0
- package/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalTokenAlt.sol +64 -0
- package/contracts/interfaces/IPAllActionTypeV3.sol +1 -0
- package/contracts/interfaces/IPAllActionV3.sol +1 -3
- package/contracts/interfaces/IPBridgeFunder.sol +17 -0
- package/contracts/interfaces/IPFixedPricePTAMMV2.sol +58 -0
- package/contracts/interfaces/IPLimitRouter.sol +22 -0
- package/contracts/interfaces/{IPActionCrossChain.sol → IPSwapHelper.sol} +1 -1
- package/contracts/limit/LimitRouterBase.sol +101 -47
- package/contracts/limit/PendleLimitRouter.sol +1 -1
- package/contracts/limit/helpers/MintSyHelper.sol +114 -0
- package/contracts/offchain-helpers/PendleFeeSetter.sol +19 -1
- package/contracts/offchain-helpers/PendleProxyAdmin.sol +11 -0
- package/contracts/router/base/ActionBase.sol +16 -2
- package/deployments/1-core.json +1 -0
- package/deployments/1-offchain-helper.json +1 -1
- package/deployments/10-core.json +1 -0
- package/deployments/10-offchain-helper.json +1 -1
- package/deployments/130-core.json +1 -0
- package/deployments/143-core.json +1 -0
- package/deployments/146-core.json +1 -0
- package/deployments/146-offchain-helper.json +1 -1
- package/deployments/42161-core.json +1 -0
- package/deployments/42161-offchain-helper.json +1 -1
- package/deployments/4217-core.json +14 -0
- package/deployments/43114-core.json +1 -0
- package/deployments/5000-core.json +1 -0
- package/deployments/5000-offchain-helper.json +1 -1
- package/deployments/56-core.json +1 -0
- package/deployments/56-offchain-helper.json +1 -1
- package/deployments/57073-core.json +1 -0
- package/deployments/747474-core.json +1 -0
- package/deployments/80094-core.json +1 -0
- package/deployments/80094-offchain-helper.json +1 -1
- package/deployments/8453-core.json +1 -0
- package/deployments/8453-offchain-helper.json +1 -1
- package/deployments/9745-core.json +1 -0
- package/deployments/9745-offchain-helper.json +1 -1
- package/deployments/999-core.json +1 -0
- package/deployments/999-offchain-helper.json +1 -1
- package/package.json +1 -1
- package/typechain-types/BridgeFunder.ts +344 -0
- package/typechain-types/FixedPricePTAMMV2.ts +1104 -0
- package/typechain-types/IPAllActionV3.ts +0 -54
- package/typechain-types/IPBridgeFunder.ts +165 -0
- package/typechain-types/IPFixedPricePTAMMV2.ts +864 -0
- package/typechain-types/IPLimitRouter.ts +104 -0
- package/typechain-types/IPSwapHelper.ts +161 -0
- package/typechain-types/LimitRouterBase.ts +233 -5
- package/typechain-types/MintSyHelper.ts +230 -0
- package/typechain-types/OFTAdapterAltImpl.ts +1350 -0
- package/typechain-types/PendleBridgedPrincipalTokenAlt.ts +1708 -0
- package/typechain-types/PendleFeeSetter.ts +53 -0
- package/typechain-types/PendleLimitRouter.ts +233 -5
- package/typechain-types/PendleProxyAdmin.ts +341 -0
- package/typechain-types/PendleSwapHelper.ts +161 -0
- package/typechain-types/ProxyAdmin.ts +341 -0
- package/typechain-types/factories/ActionAddRemoveLiqV3__factory.ts +1 -1
- package/typechain-types/factories/ActionCallbackV3__factory.ts +1 -1
- package/typechain-types/factories/ActionInfoStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMiscV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSimple__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageV4__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionVePendleStatic__factory.ts +1 -1
- package/typechain-types/factories/BridgeFunder__factory.ts +265 -0
- package/typechain-types/factories/ExpiredLpPtRedeemer__factory.ts +1 -1
- package/typechain-types/factories/FixedPricePTAMMV2__factory.ts +824 -0
- package/typechain-types/factories/IPAllActionV3__factory.ts +0 -88
- package/typechain-types/factories/IPBridgeFunder__factory.ts +100 -0
- package/typechain-types/factories/IPFixedPricePTAMMV2__factory.ts +621 -0
- package/typechain-types/factories/IPLimitRouter__factory.ts +156 -0
- package/typechain-types/factories/IPSwapHelper__factory.ts +111 -0
- package/typechain-types/factories/LimitBackendHelperV2__factory.ts +1 -1
- package/typechain-types/factories/LimitRouterBase__factory.ts +258 -1
- package/typechain-types/factories/MarketSweed__factory.ts +1 -1
- package/typechain-types/factories/MintSyHelper__factory.ts +168 -0
- package/typechain-types/factories/OFTAdapterAltImpl__factory.ts +1363 -0
- package/typechain-types/factories/PendleBridgedPrincipalTokenAlt__factory.ts +1702 -0
- package/typechain-types/factories/PendleCommonPoolDeployHelperV2__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeSetter__factory.ts +36 -1
- package/typechain-types/factories/PendleLimitRouter__factory.ts +268 -3
- package/typechain-types/factories/PendlePoolDeployHelperV2__factory.ts +1 -1
- package/typechain-types/factories/PendlePoolDeployHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleProxyAdmin__factory.ts +229 -0
- package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterV4__factory.ts +1 -1
- package/typechain-types/factories/PendleSwapHelper__factory.ts +152 -0
- package/typechain-types/factories/ProxyAdmin__factory.ts +210 -0
- package/typechain-types/factories/Reflector__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +108 -0
- package/typechain-types/index.ts +22 -0
- package/build/artifacts/contracts/cross-chain/FixedPricePTAMM.sol/FixedPricePTAMM.dbg.json +0 -4
- package/build/artifacts/contracts/cross-chain/FixedPricePTAMM.sol/FixedPricePTAMM.json +0 -667
- package/build/artifacts/contracts/interfaces/IPActionCrossChain.sol/IPActionCrossChain.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMM.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMMSwapCallback.dbg.json +0 -4
- package/build/artifacts/contracts/router/ActionCrossChain.sol/ActionCrossChain.dbg.json +0 -4
- package/build/artifacts/contracts/router/ActionCrossChain.sol/ActionCrossChain.json +0 -99
- package/contracts/cross-chain/FixedPricePTAMM.sol +0 -200
- package/contracts/interfaces/IPFixedPricePTAMM.sol +0 -69
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-artifact-1",
|
|
3
|
-
"contractName": "ActionCrossChain",
|
|
4
|
-
"sourceName": "contracts/router/ActionCrossChain.sol",
|
|
5
|
-
"abi": [
|
|
6
|
-
{
|
|
7
|
-
"inputs": [
|
|
8
|
-
{
|
|
9
|
-
"internalType": "address",
|
|
10
|
-
"name": "receiver",
|
|
11
|
-
"type": "address"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"internalType": "address",
|
|
15
|
-
"name": "fixedPricePTAMM",
|
|
16
|
-
"type": "address"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"internalType": "address",
|
|
20
|
-
"name": "PT",
|
|
21
|
-
"type": "address"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"internalType": "uint256",
|
|
25
|
-
"name": "exactPtIn",
|
|
26
|
-
"type": "uint256"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"components": [
|
|
30
|
-
{
|
|
31
|
-
"internalType": "address",
|
|
32
|
-
"name": "tokenOut",
|
|
33
|
-
"type": "address"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"internalType": "uint256",
|
|
37
|
-
"name": "minTokenOut",
|
|
38
|
-
"type": "uint256"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"internalType": "address",
|
|
42
|
-
"name": "tokenRedeemSy",
|
|
43
|
-
"type": "address"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"internalType": "address",
|
|
47
|
-
"name": "pendleSwap",
|
|
48
|
-
"type": "address"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"components": [
|
|
52
|
-
{
|
|
53
|
-
"internalType": "enum SwapType",
|
|
54
|
-
"name": "swapType",
|
|
55
|
-
"type": "uint8"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"internalType": "address",
|
|
59
|
-
"name": "extRouter",
|
|
60
|
-
"type": "address"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"internalType": "bytes",
|
|
64
|
-
"name": "extCalldata",
|
|
65
|
-
"type": "bytes"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"internalType": "bool",
|
|
69
|
-
"name": "needScale",
|
|
70
|
-
"type": "bool"
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
"internalType": "struct SwapData",
|
|
74
|
-
"name": "swapData",
|
|
75
|
-
"type": "tuple"
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
"internalType": "struct TokenOutput",
|
|
79
|
-
"name": "out",
|
|
80
|
-
"type": "tuple"
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
"name": "swapWithFixedPricePTAMM",
|
|
84
|
-
"outputs": [
|
|
85
|
-
{
|
|
86
|
-
"internalType": "uint256",
|
|
87
|
-
"name": "netTokenOut",
|
|
88
|
-
"type": "uint256"
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"stateMutability": "nonpayable",
|
|
92
|
-
"type": "function"
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
"bytecode": "0x6080604052348015600e575f5ffd5b50610ba28061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063a58f46c61461002d575b5f5ffd5b61004061003b36600461088e565b610052565b60405190815260200160405180910390f35b5f61005f84338786610115565b5f856001600160a01b031663df0fe2eb6100798986610136565b878761008b6060890160408a01610907565b604080515f815260208101918290526001600160e01b031960e088901b169091526100bd94939291906024810161096d565b6020604051808303815f875af11580156100d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100fd91906109a7565b905061010a8782856101b2565b979650505050505050565b8015610130576101306001600160a01b038516848484610360565b50505050565b5f8061014560808401846109be565b6101539060208101906109ea565b90505f81600a81111561016857610168610a03565b0361017657839150506101ac565b600381600a81111561018a5761018a610a03565b0361019857309150506101ac565b6101a86080840160608501610907565b9150505b92915050565b5f806101c160808401846109be565b6101cf9060208101906109ea565b90505f81600a8111156101e4576101e4610a03565b036101f1578391506102ff565b600381600a81111561020557610205610a03565b0361024f578391506102336102206060850160408601610907565b61022d6020860186610907565b846103cb565b61024a6102436020850185610907565b8684610489565b6102ff565b61025f6080840160608501610907565b6001600160a01b0316632bdb823c61027d6060860160408701610907565b8661028b60808801886109be565b6040518463ffffffff1660e01b81526004016102a993929190610a5a565b5f604051808303815f87803b1580156102c0575f5ffd5b505af11580156102d2573d5f5f3e3d5ffd5b506102ed92506102e89150506020850185610907565b61055b565b91506102ff6102436020850185610907565b82602001358210156103585760405162461bcd60e51b815260206004820181905260248201527f536c6970706167653a20494e53554646494349454e545f544f4b454e5f4f555460448201526064015b60405180910390fd5b509392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526101309085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610566565b6001600160a01b03831661042e57816001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004015f604051808303818588803b158015610412575f5ffd5b505af1158015610424573d5f5f3e3d5ffd5b5050505050505050565b604051632e1a7d4d60e01b8152600481018290526001600160a01b03841690632e1a7d4d906024015f604051808303815f87803b15801561046d575f5ffd5b505af115801561047f573d5f5f3e3d5ffd5b505050505b505050565b80158061049e57506001600160a01b03821630145b156104a857505050565b6001600160a01b038316610547575f826001600160a01b0316826040515f6040518083038185875af1925050503d805f81146104ff576040519150601f19603f3d011682016040523d82523d5f602084013e610504565b606091505b50509050806101305760405162461bcd60e51b815260206004820152600f60248201526e195d1a081cd95b990819985a5b1959608a1b604482015260640161034f565b6104846001600160a01b0384168383610639565b5f6101ac3083610669565b5f6105ba826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106f99092919063ffffffff16565b905080515f14806105da5750808060200190518101906105da9190610b2e565b6104845760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161034f565b6040516001600160a01b03831660248201526044810182905261048490849063a9059cbb60e01b90606401610394565b5f6001600160a01b038216156106e6576040516370a0823160e01b81526001600160a01b0384811660048301528316906370a0823190602401602060405180830381865afa1580156106bd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106e191906109a7565b6106f2565b826001600160a01b0316315b9392505050565b606061070784845f8561070f565b949350505050565b6060824710156107705760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161034f565b5f5f866001600160a01b0316858760405161078b9190610b49565b5f6040518083038185875af1925050503d805f81146107c5576040519150601f19603f3d011682016040523d82523d5f602084013e6107ca565b606091505b509150915061010a87838387606083156108445782515f0361083d576001600160a01b0385163b61083d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161034f565b5081610707565b61070783838151156108595781518083602001fd5b8060405162461bcd60e51b815260040161034f9190610b5a565b80356001600160a01b0381168114610889575f5ffd5b919050565b5f5f5f5f5f60a086880312156108a2575f5ffd5b6108ab86610873565b94506108b960208701610873565b93506108c760408701610873565b92506060860135915060808601356001600160401b038111156108e8575f5ffd5b860160a081890312156108f9575f5ffd5b809150509295509295909350565b5f60208284031215610917575f5ffd5b6106f282610873565b5f5b8381101561093a578181015183820152602001610922565b50505f910152565b5f8151808452610959816020860160208601610920565b601f01601f19169290920160200192915050565b6001600160a01b0386811682528581166020830152604082018590528316606082015260a0608082018190525f9061010a90830184610942565b5f602082840312156109b7575f5ffd5b5051919050565b5f8235607e198336030181126109d2575f5ffd5b9190910192915050565b8035600b8110610889575f5ffd5b5f602082840312156109fa575f5ffd5b6106f2826109dc565b634e487b7160e01b5f52602160045260245ffd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b8015158114610a4c575f5ffd5b50565b803561088981610a3f565b6001600160a01b038416815260208101839052606060408201525f610a7e836109dc565b600b8110610a9a57634e487b7160e01b5f52602160045260245ffd5b60608301526001600160a01b03610ab360208501610873565b1660808301526040830135601e19843603018112610acf575f5ffd5b83016020810190356001600160401b03811115610aea575f5ffd5b803603821315610af8575f5ffd5b608060a0850152610b0d60e085018284610a17565b915050610b1c60608501610a4f565b80151560c08501525095945050505050565b5f60208284031215610b3e575f5ffd5b81516106f281610a3f565b5f82516109d2818460208701610920565b602081525f6106f2602083018461094256fea264697066735822122065a5c637c0e014ea29acdc2d80d74e83a4069474e566762d60082f15f76a08b864736f6c634300081e0033",
|
|
96
|
-
"deployedBytecode": "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063a58f46c61461002d575b5f5ffd5b61004061003b36600461088e565b610052565b60405190815260200160405180910390f35b5f61005f84338786610115565b5f856001600160a01b031663df0fe2eb6100798986610136565b878761008b6060890160408a01610907565b604080515f815260208101918290526001600160e01b031960e088901b169091526100bd94939291906024810161096d565b6020604051808303815f875af11580156100d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100fd91906109a7565b905061010a8782856101b2565b979650505050505050565b8015610130576101306001600160a01b038516848484610360565b50505050565b5f8061014560808401846109be565b6101539060208101906109ea565b90505f81600a81111561016857610168610a03565b0361017657839150506101ac565b600381600a81111561018a5761018a610a03565b0361019857309150506101ac565b6101a86080840160608501610907565b9150505b92915050565b5f806101c160808401846109be565b6101cf9060208101906109ea565b90505f81600a8111156101e4576101e4610a03565b036101f1578391506102ff565b600381600a81111561020557610205610a03565b0361024f578391506102336102206060850160408601610907565b61022d6020860186610907565b846103cb565b61024a6102436020850185610907565b8684610489565b6102ff565b61025f6080840160608501610907565b6001600160a01b0316632bdb823c61027d6060860160408701610907565b8661028b60808801886109be565b6040518463ffffffff1660e01b81526004016102a993929190610a5a565b5f604051808303815f87803b1580156102c0575f5ffd5b505af11580156102d2573d5f5f3e3d5ffd5b506102ed92506102e89150506020850185610907565b61055b565b91506102ff6102436020850185610907565b82602001358210156103585760405162461bcd60e51b815260206004820181905260248201527f536c6970706167653a20494e53554646494349454e545f544f4b454e5f4f555460448201526064015b60405180910390fd5b509392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526101309085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610566565b6001600160a01b03831661042e57816001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004015f604051808303818588803b158015610412575f5ffd5b505af1158015610424573d5f5f3e3d5ffd5b5050505050505050565b604051632e1a7d4d60e01b8152600481018290526001600160a01b03841690632e1a7d4d906024015f604051808303815f87803b15801561046d575f5ffd5b505af115801561047f573d5f5f3e3d5ffd5b505050505b505050565b80158061049e57506001600160a01b03821630145b156104a857505050565b6001600160a01b038316610547575f826001600160a01b0316826040515f6040518083038185875af1925050503d805f81146104ff576040519150601f19603f3d011682016040523d82523d5f602084013e610504565b606091505b50509050806101305760405162461bcd60e51b815260206004820152600f60248201526e195d1a081cd95b990819985a5b1959608a1b604482015260640161034f565b6104846001600160a01b0384168383610639565b5f6101ac3083610669565b5f6105ba826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106f99092919063ffffffff16565b905080515f14806105da5750808060200190518101906105da9190610b2e565b6104845760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161034f565b6040516001600160a01b03831660248201526044810182905261048490849063a9059cbb60e01b90606401610394565b5f6001600160a01b038216156106e6576040516370a0823160e01b81526001600160a01b0384811660048301528316906370a0823190602401602060405180830381865afa1580156106bd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106e191906109a7565b6106f2565b826001600160a01b0316315b9392505050565b606061070784845f8561070f565b949350505050565b6060824710156107705760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161034f565b5f5f866001600160a01b0316858760405161078b9190610b49565b5f6040518083038185875af1925050503d805f81146107c5576040519150601f19603f3d011682016040523d82523d5f602084013e6107ca565b606091505b509150915061010a87838387606083156108445782515f0361083d576001600160a01b0385163b61083d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161034f565b5081610707565b61070783838151156108595781518083602001fd5b8060405162461bcd60e51b815260040161034f9190610b5a565b80356001600160a01b0381168114610889575f5ffd5b919050565b5f5f5f5f5f60a086880312156108a2575f5ffd5b6108ab86610873565b94506108b960208701610873565b93506108c760408701610873565b92506060860135915060808601356001600160401b038111156108e8575f5ffd5b860160a081890312156108f9575f5ffd5b809150509295509295909350565b5f60208284031215610917575f5ffd5b6106f282610873565b5f5b8381101561093a578181015183820152602001610922565b50505f910152565b5f8151808452610959816020860160208601610920565b601f01601f19169290920160200192915050565b6001600160a01b0386811682528581166020830152604082018590528316606082015260a0608082018190525f9061010a90830184610942565b5f602082840312156109b7575f5ffd5b5051919050565b5f8235607e198336030181126109d2575f5ffd5b9190910192915050565b8035600b8110610889575f5ffd5b5f602082840312156109fa575f5ffd5b6106f2826109dc565b634e487b7160e01b5f52602160045260245ffd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b8015158114610a4c575f5ffd5b50565b803561088981610a3f565b6001600160a01b038416815260208101839052606060408201525f610a7e836109dc565b600b8110610a9a57634e487b7160e01b5f52602160045260245ffd5b60608301526001600160a01b03610ab360208501610873565b1660808301526040830135601e19843603018112610acf575f5ffd5b83016020810190356001600160401b03811115610aea575f5ffd5b803603821315610af8575f5ffd5b608060a0850152610b0d60e085018284610a17565b915050610b1c60608501610a4f565b80151560c08501525095945050505050565b5f60208284031215610b3e575f5ffd5b81516106f281610a3f565b5f82516109d2818460208701610920565b602081525f6106f2602083018461094256fea264697066735822122065a5c637c0e014ea29acdc2d80d74e83a4069474e566762d60082f15f76a08b864736f6c634300081e0033",
|
|
97
|
-
"linkReferences": {},
|
|
98
|
-
"deployedLinkReferences": {}
|
|
99
|
-
}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
|
|
2
|
-
pragma solidity ^0.8.19;
|
|
3
|
-
|
|
4
|
-
import {IPChainlinkOracleEssential} from "../interfaces/IPChainlinkOracleEssential.sol";
|
|
5
|
-
import {IPFixedPricePTAMM, IPFixedPricePTAMMSwapCallback} from "../interfaces/IPFixedPricePTAMM.sol";
|
|
6
|
-
|
|
7
|
-
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
|
|
8
|
-
|
|
9
|
-
import {BoringOwnableUpgradeableV2} from "../core/libraries/BoringOwnableUpgradeableV2.sol";
|
|
10
|
-
import {TokenHelper} from "../core/libraries/TokenHelper.sol";
|
|
11
|
-
import {PMath} from "../core/libraries/math/PMath.sol";
|
|
12
|
-
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
13
|
-
|
|
14
|
-
contract FixedPricePTAMM is
|
|
15
|
-
IPFixedPricePTAMM,
|
|
16
|
-
BoringOwnableUpgradeableV2,
|
|
17
|
-
ReentrancyGuardUpgradeable,
|
|
18
|
-
TokenHelper,
|
|
19
|
-
UUPSUpgradeable
|
|
20
|
-
{
|
|
21
|
-
// cast index-erc7201 "pendle.FixedPricePTAMM.storage"
|
|
22
|
-
uint256 internal constant STORAGE_SLOT = 0xbbf04d9aae855c6bd76c8f4ba7a918994ad0d002f537323e58c83cbfe5249000;
|
|
23
|
-
|
|
24
|
-
error OracleNotSet(address PT, address token);
|
|
25
|
-
error InsufficientTokenForTrade(address token, uint256 actualAmount, uint256 requiredAmount);
|
|
26
|
-
error InsufficientPtReceived(address PT, uint256 actualAmount, uint256 requiredAmount);
|
|
27
|
-
|
|
28
|
-
using PMath for uint256;
|
|
29
|
-
using PMath for int256;
|
|
30
|
-
|
|
31
|
-
constructor() {
|
|
32
|
-
_disableInitializers();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function initialize(address _owner) external initializer {
|
|
36
|
-
__BoringOwnableV2_init(_owner);
|
|
37
|
-
__UUPSUpgradeable_init();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
struct OracleData {
|
|
41
|
-
address oracle;
|
|
42
|
-
// @notice This can be seen as the price at maturity.
|
|
43
|
-
// @notice This can help with decimals conversion.
|
|
44
|
-
uint256 multiplier;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
struct Storage {
|
|
48
|
-
mapping(address PT => mapping(address token => OracleData)) priceOracle;
|
|
49
|
-
mapping(address token => uint256) totalToken;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function $() internal pure returns (Storage storage res) {
|
|
53
|
-
assembly ("memory-safe") {
|
|
54
|
-
res.slot := STORAGE_SLOT
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function priceOracle(address PT, address token)
|
|
59
|
-
public
|
|
60
|
-
view
|
|
61
|
-
returns (IPChainlinkOracleEssential oracle, uint256 multiplier)
|
|
62
|
-
{
|
|
63
|
-
oracle = IPChainlinkOracleEssential($().priceOracle[PT][token].oracle);
|
|
64
|
-
multiplier = $().priceOracle[PT][token].multiplier;
|
|
65
|
-
|
|
66
|
-
if (address(oracle) == address(0)) revert OracleNotSet(PT, token);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function previewSwapPtForExactToken(address PT, address token, uint256 exactTokenOut)
|
|
70
|
-
public
|
|
71
|
-
view
|
|
72
|
-
returns (uint256 amountPtIn)
|
|
73
|
-
{
|
|
74
|
-
(IPChainlinkOracleEssential oracle, uint256 multiplier) = priceOracle(PT, token);
|
|
75
|
-
(, int256 rawPrice,,,) = oracle.latestRoundData();
|
|
76
|
-
|
|
77
|
-
// ceil(exactTokenOut / (rawPrice * multiplier))
|
|
78
|
-
return (exactTokenOut * PMath.ONE * PMath.ONE).rawDivUp(rawPrice.Uint() * multiplier);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function previewSwapExactPtForToken(address PT, uint256 exactPtIn, address token)
|
|
82
|
-
public
|
|
83
|
-
view
|
|
84
|
-
returns (uint256 amountTokenOut)
|
|
85
|
-
{
|
|
86
|
-
(IPChainlinkOracleEssential oracle, uint256 multiplier) = priceOracle(PT, token);
|
|
87
|
-
(, int256 rawPrice,,,) = oracle.latestRoundData();
|
|
88
|
-
|
|
89
|
-
// exactPtIn * rawPrice * multiplier
|
|
90
|
-
return (exactPtIn * rawPrice.Uint() * multiplier) / (PMath.ONE * PMath.ONE);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function swapPtForExactToken(
|
|
94
|
-
address receiver,
|
|
95
|
-
address PT,
|
|
96
|
-
address token,
|
|
97
|
-
uint256 exactTokenOut,
|
|
98
|
-
bytes calldata data
|
|
99
|
-
) external nonReentrant returns (uint256 netPtIn) {
|
|
100
|
-
return _swapPtForExactToken(receiver, PT, token, exactTokenOut, data, false);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function swapExactPtForToken(address receiver, address PT, uint256 exactPtIn, address token, bytes calldata data)
|
|
104
|
-
external
|
|
105
|
-
nonReentrant
|
|
106
|
-
returns (uint256 netTokenOut)
|
|
107
|
-
{
|
|
108
|
-
return _swapExactPtForToken(receiver, PT, exactPtIn, token, data, false);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function transferInThenSwapPtForExactToken(address receiver, address PT, address token, uint256 exactTokenOut)
|
|
112
|
-
external
|
|
113
|
-
nonReentrant
|
|
114
|
-
returns (uint256 netPtIn)
|
|
115
|
-
{
|
|
116
|
-
return _swapPtForExactToken(receiver, PT, token, exactTokenOut, "", true);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function transferInThenSwapExactPtForToken(address receiver, address PT, uint256 exactPtIn, address token)
|
|
120
|
-
external
|
|
121
|
-
nonReentrant
|
|
122
|
-
returns (uint256 netPtIn)
|
|
123
|
-
{
|
|
124
|
-
return _swapExactPtForToken(receiver, PT, exactPtIn, token, "", true);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function _swapPtForExactToken(
|
|
128
|
-
address receiver,
|
|
129
|
-
address PT,
|
|
130
|
-
address token,
|
|
131
|
-
uint256 exactTokenOut,
|
|
132
|
-
bytes memory data,
|
|
133
|
-
bool doTransferIn
|
|
134
|
-
) internal returns (uint256 netPtIn) {
|
|
135
|
-
netPtIn = previewSwapPtForExactToken(PT, token, exactTokenOut);
|
|
136
|
-
if (doTransferIn) _transferIn(PT, msg.sender, netPtIn);
|
|
137
|
-
_swap(receiver, PT, netPtIn, token, exactTokenOut, data);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function _swapExactPtForToken(
|
|
141
|
-
address receiver,
|
|
142
|
-
address PT,
|
|
143
|
-
uint256 exactPtIn,
|
|
144
|
-
address token,
|
|
145
|
-
bytes memory data,
|
|
146
|
-
bool doTransferIn
|
|
147
|
-
) internal returns (uint256 netTokenOut) {
|
|
148
|
-
netTokenOut = previewSwapExactPtForToken(PT, exactPtIn, token);
|
|
149
|
-
if (doTransferIn) _transferIn(PT, msg.sender, exactPtIn);
|
|
150
|
-
_swap(receiver, PT, exactPtIn, token, netTokenOut, data);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function _swap(
|
|
154
|
-
address receiver,
|
|
155
|
-
address PT,
|
|
156
|
-
uint256 exactPtIn,
|
|
157
|
-
address token,
|
|
158
|
-
uint256 exactTokenOut,
|
|
159
|
-
bytes memory data
|
|
160
|
-
) internal {
|
|
161
|
-
if ($().totalToken[token] < exactTokenOut) {
|
|
162
|
-
revert InsufficientTokenForTrade(token, $().totalToken[token], exactTokenOut);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
_transferOut(token, receiver, exactTokenOut);
|
|
166
|
-
$().totalToken[token] -= exactTokenOut;
|
|
167
|
-
|
|
168
|
-
if (data.length > 0) {
|
|
169
|
-
IPFixedPricePTAMMSwapCallback(msg.sender).swapCallback(exactTokenOut, exactPtIn, data);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
$().totalToken[PT] += exactPtIn;
|
|
173
|
-
if (_selfBalance(PT) < $().totalToken[PT]) {
|
|
174
|
-
revert InsufficientPtReceived(PT, _selfBalance(PT), $().totalToken[PT]);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
emit Swap(msg.sender, receiver, PT, exactPtIn, token, exactTokenOut);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Admin functions
|
|
181
|
-
|
|
182
|
-
function setPriceOracle(address PT, address token, address _priceOracle, uint256 _multiplier) external onlyOwner {
|
|
183
|
-
$().priceOracle[PT][token] = OracleData(_priceOracle, _multiplier);
|
|
184
|
-
emit PriceOracleUpdated(PT, token, _priceOracle);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function addFund(address token, uint256 amount) external payable onlyOwner {
|
|
188
|
-
_transferIn(token, owner, amount);
|
|
189
|
-
$().totalToken[token] += amount;
|
|
190
|
-
emit Seeded(token, amount);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function removeFund(address token, uint256 amount) external onlyOwner {
|
|
194
|
-
_transferOut(token, owner, amount);
|
|
195
|
-
$().totalToken[token] -= amount;
|
|
196
|
-
emit Unseeded(token, amount);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function _authorizeUpgrade(address) internal override onlyOwner {}
|
|
200
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
|
|
2
|
-
pragma solidity ^0.8.19;
|
|
3
|
-
|
|
4
|
-
import {IPChainlinkOracleEssential} from "../interfaces/IPChainlinkOracleEssential.sol";
|
|
5
|
-
import {IPBridgedPrincipalToken} from "./IPBridgedPrincipalToken.sol";
|
|
6
|
-
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
7
|
-
|
|
8
|
-
interface IPFixedPricePTAMM {
|
|
9
|
-
event Swap(
|
|
10
|
-
address indexed caller,
|
|
11
|
-
address indexed receiver,
|
|
12
|
-
address PT,
|
|
13
|
-
uint256 netPtIn,
|
|
14
|
-
address token,
|
|
15
|
-
uint256 netTokenOut
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
event PriceOracleUpdated(address indexed PT, address indexed token, address indexed priceOracle);
|
|
19
|
-
|
|
20
|
-
event Seeded(address indexed token, uint256 amount);
|
|
21
|
-
event Unseeded(address indexed token, uint256 amount);
|
|
22
|
-
|
|
23
|
-
function priceOracle(address PT, address token)
|
|
24
|
-
external
|
|
25
|
-
view
|
|
26
|
-
returns (IPChainlinkOracleEssential, uint256 multiplier);
|
|
27
|
-
|
|
28
|
-
function previewSwapPtForExactToken(address PT, address token, uint256 exactTokenOut)
|
|
29
|
-
external
|
|
30
|
-
view
|
|
31
|
-
returns (uint256 amountPtIn);
|
|
32
|
-
|
|
33
|
-
function previewSwapExactPtForToken(address PT, uint256 exactPtIn, address token)
|
|
34
|
-
external
|
|
35
|
-
view
|
|
36
|
-
returns (uint256 amountTokenOut);
|
|
37
|
-
|
|
38
|
-
function swapPtForExactToken(
|
|
39
|
-
address receiver,
|
|
40
|
-
address PT,
|
|
41
|
-
address token,
|
|
42
|
-
uint256 exactTokenOut,
|
|
43
|
-
bytes calldata data
|
|
44
|
-
) external returns (uint256 netPtIn);
|
|
45
|
-
|
|
46
|
-
function swapExactPtForToken(address receiver, address PT, uint256 exactPtIn, address token, bytes calldata data)
|
|
47
|
-
external
|
|
48
|
-
returns (uint256 netTokenOut);
|
|
49
|
-
|
|
50
|
-
function transferInThenSwapPtForExactToken(address receiver, address PT, address token, uint256 exactTokenOut)
|
|
51
|
-
external
|
|
52
|
-
returns (uint256 netPtIn);
|
|
53
|
-
|
|
54
|
-
function transferInThenSwapExactPtForToken(address receiver, address PT, uint256 exactPtIn, address token)
|
|
55
|
-
external
|
|
56
|
-
returns (uint256 netPtIn);
|
|
57
|
-
|
|
58
|
-
// Admin functions
|
|
59
|
-
|
|
60
|
-
function setPriceOracle(address PT, address token, address priceOracle, uint256 multiplier) external;
|
|
61
|
-
|
|
62
|
-
function addFund(address token, uint256 amount) external payable;
|
|
63
|
-
|
|
64
|
-
function removeFund(address token, uint256 amount) external;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface IPFixedPricePTAMMSwapCallback {
|
|
68
|
-
function swapCallback(uint256 exactTokenOut, uint256 netPtIn, bytes calldata data) external;
|
|
69
|
-
}
|