-
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.
- Loading branch information
Showing
109 changed files
with
8,114 additions
and
9,224 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,54 @@ | ||
// SPDX-License-Identifier: BlueOak-1.0.0 | ||
pragma solidity 0.8.17; | ||
|
||
interface IBalancerVault { | ||
enum SwapKind { | ||
GIVEN_IN, | ||
GIVEN_OUT | ||
} | ||
|
||
struct PoolTokenInfo { | ||
uint256 cash; | ||
uint256 managed; | ||
uint256 lastChangeBlock; | ||
address assetManager; | ||
} | ||
|
||
struct SingleSwap { | ||
bytes32 poolId; | ||
SwapKind kind; | ||
address assetIn; | ||
address assetOut; | ||
uint256 amount; | ||
bytes userData; | ||
} | ||
|
||
struct FundManagement { | ||
address sender; | ||
bool fromInternalBalance; | ||
address payable recipient; | ||
bool toInternalBalance; | ||
} | ||
|
||
function getPoolTokenInfo( | ||
bytes32 poolId, | ||
address token | ||
) external view returns (PoolTokenInfo memory); | ||
|
||
function swap( | ||
SingleSwap memory singleSwap, | ||
FundManagement memory funds, | ||
uint256 limit, | ||
uint256 deadline | ||
) | ||
external | ||
payable | ||
returns (uint256 amountCalculated); | ||
} | ||
|
||
interface IBalancerQueries { | ||
function querySwap( | ||
IBalancerVault.SingleSwap memory singleSwap, | ||
IBalancerVault.FundManagement memory funds | ||
) external returns (uint256); | ||
} |
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,39 @@ | ||
// SPDX-License-Identifier: BlueOak-1.0.0 | ||
pragma solidity 0.8.17; | ||
|
||
import { IBalancerVault } from "../Balancer.sol"; | ||
|
||
contract BalancerCall { | ||
struct StaticData { | ||
uint256 limit; | ||
address tokenIn; | ||
address tokenOut; | ||
bytes32 poolId; | ||
address payable recipient; | ||
uint256 deadline; | ||
IBalancerVault.SwapKind kind; | ||
} | ||
function swap( | ||
uint256 amountIn, | ||
bytes memory data | ||
) external returns (uint256) { | ||
StaticData memory staticData = abi.decode(data, (StaticData)); | ||
IBalancerVault.SingleSwap memory singleSwap = IBalancerVault.SingleSwap({ | ||
poolId: staticData.poolId, | ||
kind: staticData.kind, | ||
assetIn: staticData.tokenIn, | ||
assetOut: staticData.tokenOut, | ||
amount: amountIn, | ||
userData: "" | ||
}); | ||
IBalancerVault.FundManagement memory funds = IBalancerVault.FundManagement({ | ||
sender: address(this), | ||
fromInternalBalance: false, | ||
recipient: staticData.recipient, | ||
toInternalBalance: false | ||
}); | ||
return IBalancerVault( | ||
0xBA12222222228d8Ba445958a75a0704d566BF2C8 | ||
).swap(singleSwap, funds, staticData.limit, staticData.deadline); | ||
} | ||
} |
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
102 changes: 102 additions & 0 deletions
102
contracts/contracts/weiroll-helpers/UniV3RouterCall.sol
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
Oops, something went wrong.