Skip to content
Open
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
2 changes: 1 addition & 1 deletion contracts/LimitOrderSwap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ contract LimitOrderSwap is ILimitOrderSwap, Ownable, TokenCollector, EIP712, Ree
// re-calculate the amount of taker willing to spend for this trade by the requested ratio
_takerTokenAmount = ((_takerTokenAmount * makerSpendingAmount) / _makerTokenAmount);
} else {
// the requested amount can be statisfied
// the requested amount can be satisfied
makerSpendingAmount = _makerTokenAmount;
}
uint256 minTakerTokenAmount = ((makerSpendingAmount * _order.takerTokenAmount) / _order.makerTokenAmount);
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IAllowanceTarget.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface IAllowanceTarget {
/// @dev Spend tokens on user's behalf. Only an authority can call this.
/// @param from The user to spend token from.
/// @param token The address of the token.
/// @param to The recipient of the trasnfer.
/// @param to The recipient of the transfer.
/// @param amount Amount to spend.
function spendFromUserTo(address from, address token, address to, uint256 amount) external;
}
4 changes: 2 additions & 2 deletions contracts/interfaces/IUniAgent.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ interface IUniAgent {
/// @param inputToken The input token address of the swap.
/// @param inputAmount The input amount of the swap.
/// @param payload The execution payload for uniswap router.
/// @param userPermit The permit of user for token transfering.
/// @param userPermit The permit of user for token transferring.
function approveAndSwap(RouterType routerType, address inputToken, uint256 inputAmount, bytes calldata payload, bytes calldata userPermit) external payable;

/// @notice Execute a swap
/// @param routerType The type of uniswap router should be used.
/// @param inputToken The input token address of the swap.
/// @param inputAmount The input amount of the swap.
/// @param payload The execution payload for uniswap router.
/// @param userPermit The permit of user for token transfering.
/// @param userPermit The permit of user for token transferring.
function swap(RouterType routerType, address inputToken, uint256 inputAmount, bytes calldata payload, bytes calldata userPermit) external payable;
}
2 changes: 1 addition & 1 deletion doc/CoordinatedTaker.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# CoordinatedTaker

CoordinatedTaker is a conditional taker contract of LimitOrderSwap. It adds a fill permission design on the top of it. A permission of fill is issued by a coordinator with signature. If a user wants to fill an order, he needs to apply for the fill permission and submit the fill with it. The coordinator will manage the avaliable amount of each orders and only issue fill permission when the pending avaliable amount is enough. It helps avoiding fill collision and makes off-chain order canceling possible.
CoordinatedTaker is a conditional taker contract of LimitOrderSwap. It adds a fill permission design on the top of it. A permission of fill is issued by a coordinator with signature. If a user wants to fill an order, he needs to apply for the fill permission and submit the fill with it. The coordinator will manage the available amount of each orders and only issue fill permission when the pending available amount is enough. It helps avoiding fill collision and makes off-chain order canceling possible.
2 changes: 1 addition & 1 deletion doc/LimitOrderSwap.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A taker can optionally provide extra action parameter in payload which will be e

## FullOrKill

The default `fillLimitOrder` function allows the settled taking amount is less than a taker requested. The reason is that it may not be sufficient for the whole request when a trade is actual executed and the rest available taking amout would be the actual taking amount in that case. If a taker wants a non-adjustable taking amount, then the `fillLimitOrderFullOrKill` function should be called instead.
The default `fillLimitOrder` function allows the settled taking amount is less than a taker requested. The reason is that it may not be sufficient for the whole request when a trade is actual executed and the rest available taking amount would be the actual taking amount in that case. If a taker wants a non-adjustable taking amount, then the `fillLimitOrderFullOrKill` function should be called instead.

## GroupFill

Expand Down
2 changes: 1 addition & 1 deletion doc/SmartOrderStrategy.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# SmartOrderStrategy

SmartOrderStrategy is a strategy executor of a generic swap. It should be called by GenericSwap contract and preform any swaps according to provided payload. This contract should not has any balance or token approval since it could perform any arbitary calls. Also the `executeStrategy` function is only allowed to be called by GenericSwap contract.
SmartOrderStrategy is a strategy executor of a generic swap. It should be called by GenericSwap contract and perform any swaps according to provided payload. This contract should not has any balance or token approval since it could perform any arbitrary calls. Also the `executeStrategy` function is only allowed to be called by GenericSwap contract.
2 changes: 1 addition & 1 deletion doc/TokenCollector.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TokenCollector

In Tokenlon V6, multiple schemes of token approval is supported. TokenCollector is an abstract contract that handles different ways of token transfering. When interacting with Tokenlon, user can choose one of supported approving scheme and prepare the corresponded Tokenlon permit parameter (in bytes). The first byte of the permit indicate the type and the rest are encoded data with type specific structure.
In Tokenlon V6, multiple schemes of token approval is supported. TokenCollector is an abstract contract that handles different ways of token transferring. When interacting with Tokenlon, user can choose one of supported approving scheme and prepare the corresponded Tokenlon permit parameter (in bytes). The first byte of the permit indicate the type and the rest are encoded data with type specific structure.

```
// ***********************************
Expand Down
2 changes: 1 addition & 1 deletion test/forkMainnet/LimitOrderSwap/Fill.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ contract FillTest is LimitOrderSwapTest {

function testFillWithBetterTakingAmountButGetAdjusted() public {
// fill with better price but the order doesn't have enough for the requested
// so the makingAmount == order's avaliable amount
// so the makingAmount == order's available amount
// takingAmount should be adjusted to keep the original price that taker provided
Snapshot memory takerTakerToken = BalanceSnapshot.take({ owner: taker, token: defaultOrder.takerToken });
Snapshot memory takerMakerToken = BalanceSnapshot.take({ owner: taker, token: defaultOrder.makerToken });
Expand Down