diff --git a/docs/governance/1IPs.mdx b/docs/governance/1IPs.mdx index 3d69bd654..cc532025a 100644 --- a/docs/governance/1IPs.mdx +++ b/docs/governance/1IPs.mdx @@ -17,6 +17,140 @@ All 1IPs that have successfully passed the Phase-4 vote. These 1IPs have already
+### [1IP-09] Collect 1inch DAO Treasury Revenue in 1INCH Token in Addition to USDC + + +
+ + + +- **[Phase-3: Temperature Check](https://gov.1inch.io/t/1ip-09-collect-1inch-dao-treasury-revenue-in-1inch-token-in-addition-to-usdc/3292)** + +- **[Phase-4: Snapshot Vote](https://snapshot.org/#/1inch.eth/proposal/0xf232c7f50925954d32f2def1d64d31905346dd96a0fc8bcb6f029d29d0e6208e)** + + + +
+ +
+ + +**Full Proposal Description** + + + +

Simple Summary

+

This proposal seeks to modify the 1inch Network DAO Treasury’s revenue collection strategy by enacting the following changes:

+
    +
  • Switch from buying USDC with Swap Surplus revenue to buying 1INCH when the price is lower than $1.30.
  • +
  • Switch from buying 1INCH with Swap Surplus revenue to buying USDC the price of 1INCH is greater than or equal to $1.70.
  • +
+

Abstract

+

Currently, the Swap Surplus revenue stream is collected in varying tokens and swapped to USDC before it is then sent to the 1inch DAO Treasury. Once enacted, this proposal will instead swap these tokens to 1INCH as long as the market price of 1INCH is below the $1.30 to $1.70 range (see the Specification section for a detailed explanation). All swaps will be done using the 1inch Aggregation Protocol to ensure the best pricing.

+

Motivation

+

Benefits to the 1inch Network DAO include:

+
    +
  • Investing the DAO’s revenue stream into the protocol’s governance token while the governance token is lower than it was previously valued.
  • +
  • Potential upward pressure on the 1INCH token as the DAO Treasury will be a net buyer of cheap 1INCH.
  • +
  • When the token is trading at higher valuations, the Treasury will automatically de-risk by collecting revenue in stable coins.
  • +
  • Holding 1INCH within the 1inch DAO Treasury will allow the Treasury to scale its value with the performance of the token.
  • +
+

Specification

+

This proposal serves as a signal from the 1inch Network DAO to 1inch Labs. Once passed, the 1inch Network DAO calls for 1inch Labs to modify the fee collection strategy with the following changes:

+
    +
  • When the price of 1INCH moves is below $1.30, Swap Surplus revenue shall start to be collected in 1INCH.
  • +
  • When the price of 1INCH moves above $1.70, Swap Surplus revenue shall be collected in USDC.
  • +
+

Once the modifications have been made and tested, 1inch Labs shall deploy them. All future modifications to these will need to be done by a 1inch DAO Governance vote.

+

Rationale

+

This proposal aims to purchase 1INCH with treasury revenue when the price is lower than ~$1.50. $0.20 bands are used on either side of this buying point in order to dampen the impact that market volatility could have.

+

This price point of 1INCH that triggers the switch can be changed in the future via a governance vote.

+

Considerations

+

Market Risk

+

The USDC stablecoin composition of the 1inch DAO Treasury puts the Treasury in a very good position during any bearish market cycles — the Treasury constantly grows in dollar value while, in contrast, projects that primarily hold their own token, have had the real value of their Treasury shrink in the last 6 months.

+

Adding 1INCH to the Treasury composition will increase both the potential risk and potential returns. This proposal dampens the volatility by maintaining a mix of risk-on and risk-off assets.

+

Added Complexity

+

If enacted, this proposal will add complexity to the Treasury Revenue collection strategy.

+
+
+ +
+ +
+ +
+ + +### [1IP-08] Simple diversification mechanism for 1inch DAO Treasury + + +
+ + + +- **[Phase-3: Temperature Check](https://gov.1inch.io/t/1ip-08-simple-diversification-mechanism-for-1inch-dao-treasury/3289)** + +- **[Phase-4: Snapshot Vote](https://snapshot.org/#/1inch.eth/proposal/0xddcbeb800fb1ba01c4a4963ab25dc702245c97e10e5c6f74a36e1f5e18e2f97a)** + + + +
+ +
+ + +**Full Proposal Description** + + + +

Simple Summary

+

This proposal seeks to diversify the 1inch Network DAO’s Treasury composition be enacting the following strategy:

+
    +
  • Do not exchange a whitelisted set of tokens for USDC before sending to the 1inch DAO Treasury.
  • +
  • These whitelisted tokens shall be: ETH, WETH, WBTC, DAI, and USDT.
  • +
+

Abstract

+

Currently, all of the Swap Surplus revenue stream is collected in varying tokens and swapped to USDC before being sent to the 1inch DAO Treasury. To start the diversification process of the treasury funds, the protocol can keep some incoming Swap Surplus tokens as collected (not swapping them for USDC).

+

This proposal aims to whitelist the following tokens for this treasury collection strategy:

+
    +
  • ETH
  • +
  • WETH
  • +
  • WBTC
  • +
  • DAI
  • +
  • USDT
  • +
+

Motivation

+

The 1inch DAO Treasury is 100% composed of USDC. USDC is a fiat-backed stablecoin pegged to USD managed by Circle.

+

USD experienced record inflation over the last 12 months, and will experience some degree of inflation for perpetuity. As such, the marginal spending power of the 1inch DAO Treasury is weakened unless the DAO deploys the funds in a manner that can outpace inflation.

+

These assets are viewed as risk-on diversification assets for the treasury:

+
    +
  • ETH – the native asset of the Ethereum blockchain
  • +
  • WETH – ETH wrapped in an ERC20 wrapper
  • +
  • WBTC – Bitcoin (BTC) is the oldest and largest digital asset. WBTC is Bitcoin wrapped in an ERC20 wrapper
  • +
+

Stablecoins also have inherent risks such as smart contract risks and centralization risks. Diversifying the stable coin holdings of the 1inch DAO Treasury aims to hedge against these risks. These assets are viewed as risk-off assets for the treasury:

+
    +
  • DAI – the decentralized collateral-backed stablecoin issued by the Maker Protocol. DAI is soft-pegged to USD
  • +
  • USDT – the fiat-backed stablecoin pegged to USD and managed by Tether
  • +
+

Specification

+

To implement this proposal, GovernanceLeftoverExchanger should transfer ETH, WETH, WBTC, DAI and USDT directly to the treasury the same way it transfers USDC. All other tokens should still be converted to USDC as they are now.

+

Rationale

+

The crypto market cap took a decline in recent months. With token valuations depressed, it may be a good time to start accumulating non-stable tokens to grow the treasury.

+

Since exchange transactions cost some Ether to pay for the gas fees, eliminating the swapping step for these whitelisted tokens will increase the capital efficiency of this operation. It is also for this reason that large stable coins such as DAI and USDT, should be sent directly to the treasury.

+

Considerations

+

The current stablecoin composition of the 1inch DAO Treasury ensures that the Treasury is insulated from bearish market cycles. However, this also means the treasury’s funds have no way to keep pace with the rise in inflation. Adding ETH, WETH and WBTC increase both the risk and the potential rewards.

+

This proposal does not call for any actions to be taken with the funds currently held by the 1inch DAO Treasury.

+
+
+ +
+ +
+ +
+ + ### [1IP-07] Integrate Balancer Boosted Pools in the 1inch Aggregation Protocol diff --git a/docs/governance/Glossary.mdx b/docs/governance/Glossary.mdx index bb7218eea..4ba223bcd 100644 --- a/docs/governance/Glossary.mdx +++ b/docs/governance/Glossary.mdx @@ -9,7 +9,10 @@ An ERC-20 token that is used to participate in the 1inch DAO governance process. * **v1INCH:** An ERC-20 which represents 1INCH tokens that are currently locked in the vesting contract. These tokens are not yet fully-vested and have reduced voting weight (20%) compared to st1INCH. ### 1IP -1inch Improvement Proposal, 1IP, is the formalization of a proposal. +1inch Improvement Proposal, 1IP, is the title given to proposals that have reached the Phase 4 Snapshot vote. + +### 1RC +1inch Request for Comment, 1RC, is the title given to formalized proposals. ### DAO A decentralized autonomous organization. diff --git a/docs/governance/improvement-proposal-template.mdx b/docs/governance/improvement-proposal-template.mdx index bed6932aa..1e488fb28 100644 --- a/docs/governance/improvement-proposal-template.mdx +++ b/docs/governance/improvement-proposal-template.mdx @@ -6,7 +6,7 @@ sidebar_position: 6 ## Title Title should reflect the content of the 1IP. -For the forum post, prefix “[1IP-#]” to the title (replace # with the lowest available proposal number) and set the tag on the post to Phase-2. + For the forum post, prefix “[1RC]” to the title and set the tag on the post to `phase-2`. Proposals will be assigned an 1IP-# at the time of Phase 4 Snapshot creation. ## Simple Summary A brief, high-level summary of what changes are being suggested. Summary should be a single sentence, or a bulleted list. diff --git a/docs/governance/proposal-lifecycle.mdx b/docs/governance/proposal-lifecycle.mdx index 7c2b37f2b..d227990c2 100644 --- a/docs/governance/proposal-lifecycle.mdx +++ b/docs/governance/proposal-lifecycle.mdx @@ -7,6 +7,8 @@ The 1inch Network DAO governance process takes place in the governance forum at ## Phase 1: Discussion The purpose of this phase is to vet ideas with the broader 1inch community. Each unique idea should have its own thread so that the conversation can stay on topic, it should be as narrowly focused as possible. Anyone can participate in this phase of governance, and it occurs entirely off-chain. The goal of Phase 1 discussion is to gain a rough community consensus, and refine the idea so that it can be formalized. The thread author should make an effort to address all comments and take them into consideration. +**Forum tag:** `phase-1` + **Duration:** Open-Ended ## Phase 2: 1IP Formalization @@ -19,32 +21,38 @@ Phase 2 is where the idea is formalized into an 1IP that includes all of the cri * **Considerations** -The forum is the formal arena to debate the merits of each 1IP. Once the 1IP has been drafted, the author must post it on the 1inch governance forum and use the tag: Phase-2. +The forum is the formal arena to debate the merits of each 1IP. Once the 1IP has been drafted, the author must post it on the 1inch governance forum and use the tag: `phase-2`. While the 1IP is in a draft state, the 1IP author is free to make modifications to the proposal based on feedback from the community's review. +To preserve the number sequencing of 1IPs, proposals should use the 1RC (1inch Request for Comment) prefix for both Phase 2 and Phase 3. The 1IP number will be assigned once the proposal enters the Phase-4 Snapshot vote. + +**Forum tag:** `phase-2` + **Duration**: Open-Ended ## Phase 3: 1IP Temperature Check -At any point during Phase-2, the author may finalize the 1IP by initiating a community temperature check. To do this, the author must change the tag of the forum post to Phase-3, and add a forum poll to gauge the community’s sentiment. +At any point during Phase 2, the author may finalize the 1IP by initiating a community temperature check. To do this, the author must change the tag of the forum post to `phase-3`, and add a forum poll to gauge the community’s sentiment. 1IPs should only be progressed to Phase 3 once the author has considered all community comments and believes the 1IP is prepared for incorporation. -Phase-3 represents the final proposal. Other than correcting errata, 1IPs in Phase 3 may not be edited. +Phase 3 represents the final proposal. Other than correcting errata, 1IPs in Phase 3 may not be edited. The poll must be open for 5 days and only have the following options: * (Yes) In favor of this proposal. * (No) Against this proposal. -Note: This process is irreversible, i.e., an author may not revert an 1IP back to Stage-2 if it fails the temperature check vote. +Only successful Phase 3 proposals may progress to Phase 4. In order for a Phase 3 vote to be considered successful a majority of the temperature check votes cast must be in favor. There is no minimum quorum required for this phase. + +**Forum tag:** `phase-3` **Duration:** Exactly 5 days ## Phase 4: Snapshot Vote -All 1IPs are confirmed, or rejected, by the 1inch Network DAO via an off-chain [Snapshot](https://snapshot.org/#/1inch.eth) vote. The Snapshot vote must link to the results of the successful Phase-3 forum poll and include the full text of the finalized 1IP. Anyone can initiate the Snapshot vote as long as all requirements of Phase-3 were met (it does not have to be the 1IP author). +All 1IPs are confirmed, or rejected, by the 1inch Network DAO via an off-chain [Snapshot](https://snapshot.org/#/1inch.eth) vote. The Snapshot vote must link to the results of the successful Phase-3 forum poll and include the full text of the finalized 1IP. Anyone can initiate the Snapshot vote as long as all requirements of Phase-3 were met (it does not have to be the 1IP author). Once the Snaphsot vote has been created, the forum tag should be changed to `phase-4` and the title of the post should have the next 1IP-# added as the prefix. -The Snapshot voting period must last exactly seven days. During this period, addresses with voting power may vote for or against the proposal using the same two voting options as the Phase-2 poll: +The Snapshot voting period must last exactly seven days. During this period, addresses with voting power may vote for or against the proposal using the same two voting options as the Phase 3 poll: * (Yes) In favor of this proposal. * (No) Against this proposal. @@ -56,6 +64,8 @@ In order for a vote to be considered successful, both of the following must be m See [Voting Process](./voting-process.mdx) for a detailed description of how Voting Weight is calculated and how Vote Delegation works. +**Forum tag:** `phase-4` + **Duration:** Exactly 7 days ## Phase 5: Implementation diff --git a/docs/limit-order-protocol/smart-contract/LimitOrderProtocol.md b/docs/limit-order-protocol/smart-contract/LimitOrderProtocol.md index d0dd43065..63e347758 100644 --- a/docs/limit-order-protocol/smart-contract/LimitOrderProtocol.md +++ b/docs/limit-order-protocol/smart-contract/LimitOrderProtocol.md @@ -1,9 +1,20 @@ # LimitOrderProtocol + 1inch Limit Order Protocol v2 +## Derives +- [OrderRFQMixin](OrderRFQMixin.md) +- [OrderMixin](OrderMixin.md) +- [Permitable](libraries/Permitable.md) +- [PredicateHelper](helpers/PredicateHelper.md) +- [NonceManager](helpers/NonceManager.md) +- [ChainlinkCalculator](helpers/ChainlinkCalculator.md) +- [AmountCalculator](helpers/AmountCalculator.md) +- [EIP712](https://docs.openzeppelin.com/contracts/3.x/api/utils/cryptography#draft-EIP712) + ## Functions ### DOMAIN_SEPARATOR ```solidity diff --git a/docs/limit-order-protocol/smart-contract/LimitOrderProtocolPro.md b/docs/limit-order-protocol/smart-contract/LimitOrderProtocolPro.md new file mode 100644 index 000000000..d014831f8 --- /dev/null +++ b/docs/limit-order-protocol/smart-contract/LimitOrderProtocolPro.md @@ -0,0 +1,26 @@ +# LimitOrderProtocolPro + + +1inch Pro Limit Order Protocol + + + +## Derives +- [OrderMixin](OrderMixin.md) +- [Permitable](libraries/Permitable.md) +- [PredicateHelper](helpers/PredicateHelper.md) +- [NonceManager](helpers/NonceManager.md) +- [ChainlinkCalculator](helpers/ChainlinkCalculator.md) +- [AmountCalculator](helpers/AmountCalculator.md) +- [EIP712](https://docs.openzeppelin.com/contracts/3.x/api/utils/cryptography#draft-EIP712) + +## Functions +### DOMAIN_SEPARATOR +```solidity +function DOMAIN_SEPARATOR( +) external returns (bytes32) +``` + + + + diff --git a/docs/limit-order-protocol/smart-contract/OrderLib.md b/docs/limit-order-protocol/smart-contract/OrderLib.md new file mode 100644 index 000000000..d7180dca7 --- /dev/null +++ b/docs/limit-order-protocol/smart-contract/OrderLib.md @@ -0,0 +1,135 @@ +# OrderLib + + + + + + + +## Functions +### makerAssetData +```solidity +function makerAssetData( + struct OrderLib.Order order +) internal returns (bytes) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + +### takerAssetData +```solidity +function takerAssetData( + struct OrderLib.Order order +) internal returns (bytes) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + +### getMakingAmount +```solidity +function getMakingAmount( + struct OrderLib.Order order +) internal returns (bytes) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + +### getTakingAmount +```solidity +function getTakingAmount( + struct OrderLib.Order order +) internal returns (bytes) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + +### predicate +```solidity +function predicate( + struct OrderLib.Order order +) internal returns (bytes) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + +### permit +```solidity +function permit( + struct OrderLib.Order order +) internal returns (bytes) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + +### preInteraction +```solidity +function preInteraction( + struct OrderLib.Order order +) internal returns (bytes) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + +### postInteraction +```solidity +function postInteraction( + struct OrderLib.Order order +) internal returns (bytes) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + +### hash +```solidity +function hash( + struct OrderLib.Order order +) internal returns (bytes32 result) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + diff --git a/docs/limit-order-protocol/smart-contract/OrderMixin.md b/docs/limit-order-protocol/smart-contract/OrderMixin.md index 302c4c36e..354b7d82a 100644 --- a/docs/limit-order-protocol/smart-contract/OrderMixin.md +++ b/docs/limit-order-protocol/smart-contract/OrderMixin.md @@ -1,15 +1,24 @@ # OrderMixin -Order Limits v1 mixin +Regular Limit Order mixin + +## Derives +- [Permitable](libraries/Permitable.md) +- [PredicateHelper](helpers/PredicateHelper.md) +- [NonceManager](helpers/NonceManager.md) +- [ChainlinkCalculator](helpers/ChainlinkCalculator.md) +- [AmountCalculator](helpers/AmountCalculator.md) +- [EIP712](https://docs.openzeppelin.com/contracts/3.x/api/utils/cryptography#draft-EIP712) + ## Functions ### remaining ```solidity function remaining( bytes32 orderHash -) external returns (uint256 amount) +) external returns (uint256) ``` Returns unfilled amount for order. Throws if order does not exist @@ -42,7 +51,7 @@ Returns unfilled amount for order ```solidity function remainingsRaw( bytes32[] orderHashes -) external returns (uint256[] results) +) external returns (uint256[]) ``` Same as `remainingRaw` but for multiple orders @@ -52,20 +61,6 @@ Same as `remainingRaw` but for multiple orders |`orderHashes` | bytes32[] | -### checkPredicate -```solidity -function checkPredicate( - struct OrderMixin.Order order -) public returns (bool) -``` -Checks order predicate - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`order` | struct OrderMixin.Order | - - ### simulateCalls ```solidity function simulateCalls( @@ -87,7 +82,7 @@ denote failure or success of the corresponding call ### cancelOrder ```solidity function cancelOrder( - struct OrderMixin.Order order + struct OrderLib.Order order ) external ``` Cancels order by setting remaining amount to zero @@ -95,14 +90,15 @@ Cancels order by setting remaining amount to zero #### Parameters: | Name | Type | Description | | :--- | :--- | :------------------------------------------------------------------- | -|`order` | struct OrderMixin.Order | +|`order` | struct OrderLib.Order | ### fillOrder ```solidity function fillOrder( - struct OrderMixin.Order order, + struct OrderLib.Order order, bytes signature, + bytes interaction, uint256 makingAmount, uint256 takingAmount, uint256 thresholdAmount @@ -114,18 +110,20 @@ Fills an order. If one doesn't exist (first fill) it will be created using order #### Parameters: | Name | Type | Description | | :--- | :--- | :------------------------------------------------------------------- | -|`order` | struct OrderMixin.Order | Order quote to fill +|`order` | struct OrderLib.Order | Order quote to fill |`signature` | bytes | Signature to confirm quote ownership -|`makingAmount` | uint256 | Making amount -|`takingAmount` | uint256 | Taking amount -|`thresholdAmount` | uint256 | Specifies maximum allowed takingAmount it's zero. Otherwise minimum allowed makingAmount +|`interaction` | bytes | Making amount +|`makingAmount` | uint256 | Taking amount +|`takingAmount` | uint256 | Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount +|`thresholdAmount` | uint256 | ### fillOrderToWithPermit ```solidity function fillOrderToWithPermit( - struct OrderMixin.Order order, + struct OrderLib.Order order, bytes signature, + bytes interaction, uint256 makingAmount, uint256 takingAmount, uint256 thresholdAmount, @@ -137,24 +135,26 @@ Same as `fillOrder` but calls permit first, allowing to approve token spending and make a swap in one transaction. Also allows to specify funds destination instead of `msg.sender` - +See tests for examples #### Parameters: | Name | Type | Description | | :--- | :--- | :------------------------------------------------------------------- | -|`order` | struct OrderMixin.Order | Order quote to fill +|`order` | struct OrderLib.Order | Order quote to fill |`signature` | bytes | Signature to confirm quote ownership -|`makingAmount` | uint256 | Making amount -|`takingAmount` | uint256 | Taking amount -|`thresholdAmount` | uint256 | Specifies maximum allowed takingAmount it's zero. Otherwise minimum allowed makingAmount -|`target` | address | Address that will receive swap funds -|`permit` | bytes | Should consist of abiencoded token address and encoded `IERC20Permit.permit` call. See tests for examples +|`interaction` | bytes | Making amount +|`makingAmount` | uint256 | Taking amount +|`takingAmount` | uint256 | Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount +|`thresholdAmount` | uint256 | Address that will receive swap funds +|`target` | address | Should consist of abiencoded token address and encoded `IERC20Permit.permit` call. +|`permit` | bytes | ### fillOrderTo ```solidity function fillOrderTo( - struct OrderMixin.Order order, + struct OrderLib.Order order_, bytes signature, + bytes interaction, uint256 makingAmount, uint256 takingAmount, uint256 thresholdAmount, @@ -167,12 +167,41 @@ Same as `fillOrder` but allows to specify funds destination instead of `msg.send #### Parameters: | Name | Type | Description | | :--- | :--- | :------------------------------------------------------------------- | -|`order` | struct OrderMixin.Order | Order quote to fill +|`order_` | struct OrderLib.Order | Order quote to fill |`signature` | bytes | Signature to confirm quote ownership -|`makingAmount` | uint256 | Making amount -|`takingAmount` | uint256 | Taking amount -|`thresholdAmount` | uint256 | Specifies maximum allowed takingAmount it's zero. Otherwise minimum allowed makingAmount -|`target` | address | Address that will receive swap funds +|`interaction` | bytes | Making amount +|`makingAmount` | uint256 | Taking amount +|`takingAmount` | uint256 | Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount +|`thresholdAmount` | uint256 | Address that will receive swap funds +|`target` | address | + + +### checkPredicate +```solidity +function checkPredicate( + struct OrderLib.Order order +) public returns (bool) +``` +Checks order predicate + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | + + +### hashOrder +```solidity +function hashOrder( + struct OrderLib.Order order +) public returns (bytes32) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`order` | struct OrderLib.Order | ## Events @@ -197,7 +226,8 @@ Emitted every time order gets filled, including partial fills ```solidity event OrderCanceled( address maker, - bytes32 orderHash + bytes32 orderHash, + uint256 remainingRaw ) ``` Emitted when order gets cancelled @@ -207,4 +237,5 @@ Emitted when order gets cancelled | :--- | :--- | :------------------------------------------------------------------- | |`maker` | address | |`orderHash` | bytes32 | +|`remainingRaw` | uint256 | diff --git a/docs/limit-order-protocol/smart-contract/OrderRFQMixin.md b/docs/limit-order-protocol/smart-contract/OrderRFQMixin.md index c8312ea05..bdb5b06e7 100644 --- a/docs/limit-order-protocol/smart-contract/OrderRFQMixin.md +++ b/docs/limit-order-protocol/smart-contract/OrderRFQMixin.md @@ -1,9 +1,15 @@ # OrderRFQMixin -Order RFQ Limits v1 mixin +RFQ Limit Order mixin + +## Derives +- [Permitable](libraries/Permitable.md) +- [AmountCalculator](helpers/AmountCalculator.md) +- [EIP712](https://docs.openzeppelin.com/contracts/3.x/api/utils/cryptography#draft-EIP712) + ## Functions ### invalidatorForOrderRFQ ```solidity @@ -24,7 +30,7 @@ Returns bitmask for double-spend invalidators based on lowest byte of order.info #### Return Values: | Name | Type | Description | | :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`Result`| uint256 | Each bit represents whenever corresponding quote was filled +|`Result`| uint256 | Each bit represents whether corresponding was already invalidated ### cancelOrderRFQ ```solidity @@ -76,7 +82,7 @@ Fills Same as `fillOrderRFQ` but calls permit first, allowing to approve token spending and make a swap in one transaction. Also allows to specify funds destination instead of `msg.sender` - +See tests for examples #### Parameters: | Name | Type | Description | | :--- | :--- | :------------------------------------------------------------------- | @@ -85,7 +91,7 @@ Also allows to specify funds destination instead of `msg.sender` |`makingAmount` | uint256 | Making amount |`takingAmount` | uint256 | Taking amount |`target` | address | Address that will receive swap funds -|`permit` | bytes | Should consist of abiencoded token address and encoded `IERC20Permit.permit` call. See tests for examples +|`permit` | bytes | Should consist of abiencoded token address and encoded `IERC20Permit.permit` call. ### fillOrderRFQTo diff --git a/docs/limit-order-protocol/smart-contract/SUMMARY.md b/docs/limit-order-protocol/smart-contract/SUMMARY.md index fe183540b..f9403c06a 100644 --- a/docs/limit-order-protocol/smart-contract/SUMMARY.md +++ b/docs/limit-order-protocol/smart-contract/SUMMARY.md @@ -10,21 +10,29 @@ * [ImmutableOwner](helpers/ImmutableOwner.md) * [NonceManager](helpers/NonceManager.md) * [PredicateHelper](helpers/PredicateHelper.md) + * [SeriesNonceManager](helpers/SeriesNonceManager.md) + * [WethUnwrapper](helpers/WethUnwrapper.md) + * [WhitelistChecker](helpers/WhitelistChecker.md) * [interfaces](interfaces/README.md) - * [AggregatorInterface](interfaces/AggregatorInterface.md) * [IDaiLikePermit](interfaces/IDaiLikePermit.md) - * [InteractiveNotificationReceiver](interfaces/InteractiveNotificationReceiver.md) + * [IWhitelistRegistry](interfaces/IWhitelistRegistry.md) + * [IWithdrawable](interfaces/IWithdrawable.md) + * [InteractionNotificationReceiver](interfaces/InteractionNotificationReceiver.md) + * [PostInteractionNotificationReceiver](interfaces/PostInteractionNotificationReceiver.md) + * [PreInteractionNotificationReceiver](interfaces/PreInteractionNotificationReceiver.md) * [libraries](libraries/README.md) * [ArgumentsDecoder](libraries/ArgumentsDecoder.md) * [Permitable](libraries/Permitable.md) * [RevertReasonParser](libraries/RevertReasonParser.md) * [mocks](mocks/README.md) - * [interfaces](mocks/interfaces/README.md) - * [IWithdrawable](mocks/interfaces/IWithdrawable.md) * [AggregatorMock](mocks/AggregatorMock.md) - * [InteractiveNotificationReceiverMock](mocks/InteractiveNotificationReceiverMock.md) * [TokenMock](mocks/TokenMock.md) + * [WhitelistRegistryMock](mocks/WhitelistRegistryMock.md) * [WrappedTokenMock](mocks/WrappedTokenMock.md) +* [tests](tests/README.md) + * [ArgumentsDecoderTest](tests/ArgumentsDecoderTest.md) * [LimitOrderProtocol](LimitOrderProtocol.md) +* [LimitOrderProtocolPro](LimitOrderProtocolPro.md) +* [OrderLib](OrderLib.md) * [OrderMixin](OrderMixin.md) * [OrderRFQMixin](OrderRFQMixin.md) \ No newline at end of file diff --git a/docs/limit-order-protocol/smart-contract/helpers/AmountCalculator.md b/docs/limit-order-protocol/smart-contract/helpers/AmountCalculator.md index 40821bfa8..8fb1fd14a 100644 --- a/docs/limit-order-protocol/smart-contract/helpers/AmountCalculator.md +++ b/docs/limit-order-protocol/smart-contract/helpers/AmountCalculator.md @@ -1,13 +1,15 @@ # AmountCalculator + A helper contract for calculations related to order amounts + ## Functions -### getMakerAmount +### getMakingAmount ```solidity -function getMakerAmount( +function getMakingAmount( uint256 orderMakerAmount, uint256 orderTakerAmount, uint256 swapTakerAmount @@ -28,9 +30,9 @@ Calculates maker amount | :----------------------------- | :------------ | :--------------------------------------------------------------------------- | |`Result`| uint256 | Floored maker amount -### getTakerAmount +### getTakingAmount ```solidity -function getTakerAmount( +function getTakingAmount( uint256 orderMakerAmount, uint256 orderTakerAmount, uint256 swapMakerAmount diff --git a/docs/limit-order-protocol/smart-contract/helpers/ChainlinkCalculator.md b/docs/limit-order-protocol/smart-contract/helpers/ChainlinkCalculator.md index aa4a65f9f..62d68e50d 100644 --- a/docs/limit-order-protocol/smart-contract/helpers/ChainlinkCalculator.md +++ b/docs/limit-order-protocol/smart-contract/helpers/ChainlinkCalculator.md @@ -1,39 +1,42 @@ # ChainlinkCalculator + A helper contract for interactions with https://docs.chain.link + ## Functions ### singlePrice ```solidity function singlePrice( - contract AggregatorInterface oracle, + contract AggregatorV3Interface oracle, uint256 inverseAndSpread, uint256 amount ) external returns (uint256) ``` -Calculates price of token relative to ETH scaled by 1e18 +Calculates price of token relative to oracle unit (ETH or USD) #### Parameters: | Name | Type | Description | | :--- | :--- | :------------------------------------------------------------------- | -|`oracle` | contract AggregatorInterface | concatenated inverse flag and spread. Lowest 254 bits specify spread amount. Spread is scaled by 1e9, i.e. 101% = 1.01e9, 99% = 0.99e9. Highest bit is set when oracle price should be inverted, e.g. for DAI-ETH oracle, inverse=false means that we request DAI price in ETH and inverse=true means that we request ETH price in DAI +|`oracle` | contract AggregatorV3Interface | concatenated inverse flag and spread. Lowest 254 bits specify spread amount. Spread is scaled by 1e9, i.e. 101% = 1.01e9, 99% = 0.99e9. Highest bit is set when oracle price should be inverted, e.g. for DAI-ETH oracle, inverse=false means that we request DAI price in ETH and inverse=true means that we request ETH price in DAI |`inverseAndSpread` | uint256 | |`amount` | uint256 | #### Return Values: | Name | Type | Description | | :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`Result`| uint256 | Token price times amount +|`Amount`| uint256 | * spread * oracle price ### doublePrice ```solidity function doublePrice( - contract AggregatorInterface oracle1, - contract AggregatorInterface oracle2, + contract AggregatorV3Interface oracle1, + contract AggregatorV3Interface oracle2, uint256 spread, + int256 decimalsScale, uint256 amount ) external returns (uint256) ``` @@ -43,9 +46,10 @@ Calculates price of token A relative to token B. Note that order is important #### Parameters: | Name | Type | Description | | :--- | :--- | :------------------------------------------------------------------- | -|`oracle1` | contract AggregatorInterface | -|`oracle2` | contract AggregatorInterface | +|`oracle1` | contract AggregatorV3Interface | +|`oracle2` | contract AggregatorV3Interface | |`spread` | uint256 | +|`decimalsScale` | int256 | |`amount` | uint256 | #### Return Values: diff --git a/docs/limit-order-protocol/smart-contract/helpers/ERC1155Proxy.md b/docs/limit-order-protocol/smart-contract/helpers/ERC1155Proxy.md index 1c0f587cc..dfd900326 100644 --- a/docs/limit-order-protocol/smart-contract/helpers/ERC1155Proxy.md +++ b/docs/limit-order-protocol/smart-contract/helpers/ERC1155Proxy.md @@ -4,6 +4,10 @@ + +## Derives +- [ImmutableOwner](helpers/ImmutableOwner.md) + ## Functions ### constructor ```solidity diff --git a/docs/limit-order-protocol/smart-contract/helpers/ERC721Proxy.md b/docs/limit-order-protocol/smart-contract/helpers/ERC721Proxy.md index 1f655d8b7..515f8de26 100644 --- a/docs/limit-order-protocol/smart-contract/helpers/ERC721Proxy.md +++ b/docs/limit-order-protocol/smart-contract/helpers/ERC721Proxy.md @@ -4,6 +4,10 @@ + +## Derives +- [ImmutableOwner](helpers/ImmutableOwner.md) + ## Functions ### constructor ```solidity @@ -19,23 +23,25 @@ function constructor( |`_immutableOwner` | address | -### func_602HzuS +### func_60iHVgK ```solidity -function func_602HzuS( +function func_60iHVgK( address from, address to, + uint256 , uint256 tokenId, contract IERC721 token ) external ``` Proxy transfer method for `IERC721.transferFrom`. Selector must match `IERC20.transferFrom`. -Note that `uint256` encodes token id unlike `IERC20` which expects amount there. +Note that `amount` is unused for security reasons to prevent unintended ERC-721 token sale via partial fill #### Parameters: | Name | Type | Description | | :--- | :--- | :------------------------------------------------------------------- | |`from` | address | |`to` | address | +|`` | uint256 | |`tokenId` | uint256 | |`token` | contract IERC721 | diff --git a/docs/limit-order-protocol/smart-contract/helpers/ERC721ProxySafe.md b/docs/limit-order-protocol/smart-contract/helpers/ERC721ProxySafe.md index 298028e61..a5695414c 100644 --- a/docs/limit-order-protocol/smart-contract/helpers/ERC721ProxySafe.md +++ b/docs/limit-order-protocol/smart-contract/helpers/ERC721ProxySafe.md @@ -4,6 +4,10 @@ + +## Derives +- [ImmutableOwner](helpers/ImmutableOwner.md) + ## Functions ### constructor ```solidity @@ -19,23 +23,25 @@ function constructor( |`_immutableOwner` | address | -### func_602HzuS +### func_60iHVgK ```solidity -function func_602HzuS( +function func_60iHVgK( address from, address to, + uint256 , uint256 tokenId, contract IERC721 token ) external ``` Proxy transfer method for `IERC721.transferFrom`. Selector must match `IERC20.transferFrom`. -Note that `uint256` encodes token id unlike `IERC20` which expects amount there. +Note that `amount` is unused for security reasons to prevent unintended ERC-721 token sale via partial fill #### Parameters: | Name | Type | Description | | :--- | :--- | :------------------------------------------------------------------- | |`from` | address | |`to` | address | +|`` | uint256 | |`tokenId` | uint256 | |`token` | contract IERC721 | diff --git a/docs/limit-order-protocol/smart-contract/helpers/ImmutableOwner.md b/docs/limit-order-protocol/smart-contract/helpers/ImmutableOwner.md index 28fa3eceb..a9cfd2bb7 100644 --- a/docs/limit-order-protocol/smart-contract/helpers/ImmutableOwner.md +++ b/docs/limit-order-protocol/smart-contract/helpers/ImmutableOwner.md @@ -1,9 +1,11 @@ # ImmutableOwner + A helper contract with helper modifiers to allow access to original contract creator only + ## Functions ### constructor ```solidity diff --git a/docs/limit-order-protocol/smart-contract/helpers/NonceManager.md b/docs/limit-order-protocol/smart-contract/helpers/NonceManager.md index 18a50797b..42e271dc5 100644 --- a/docs/limit-order-protocol/smart-contract/helpers/NonceManager.md +++ b/docs/limit-order-protocol/smart-contract/helpers/NonceManager.md @@ -1,9 +1,11 @@ # NonceManager + A helper contract for managing nonce of tx sender + ## Functions ### increaseNonce ```solidity diff --git a/docs/limit-order-protocol/smart-contract/helpers/PredicateHelper.md b/docs/limit-order-protocol/smart-contract/helpers/PredicateHelper.md index 44a8c8d1e..907a8fadb 100644 --- a/docs/limit-order-protocol/smart-contract/helpers/PredicateHelper.md +++ b/docs/limit-order-protocol/smart-contract/helpers/PredicateHelper.md @@ -1,9 +1,11 @@ # PredicateHelper + A helper contract for executing boolean functions on arbitrary target call results + ## Functions ### or ```solidity diff --git a/docs/limit-order-protocol/smart-contract/helpers/SeriesNonceManager.md b/docs/limit-order-protocol/smart-contract/helpers/SeriesNonceManager.md new file mode 100644 index 000000000..fb4ee73af --- /dev/null +++ b/docs/limit-order-protocol/smart-contract/helpers/SeriesNonceManager.md @@ -0,0 +1,80 @@ +# SeriesNonceManager + + +A helper contract to manage nonce with the series + + + + +## Functions +### increaseNonce +```solidity +function increaseNonce( + uint8 series +) external +``` +Advances nonce by one + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`series` | uint8 | + + +### advanceNonce +```solidity +function advanceNonce( + uint8 series, + uint8 amount +) public +``` +Advances nonce by specified amount + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`series` | uint8 | +|`amount` | uint8 | + + +### nonceEquals +```solidity +function nonceEquals( + uint8 series, + address makerAddress, + uint256 makerNonce +) external returns (bool) +``` +Checks if `makerAddress` has specified `makerNonce` for `series` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`series` | uint8 | +|`makerAddress` | address | +|`makerNonce` | uint256 | + +#### Return Values: +| Name | Type | Description | +| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | +|`Result`| bool | True if `makerAddress` has specified nonce. Otherwise, false + +## Events +### NonceIncreased +```solidity +event NonceIncreased( + address maker, + uint8 series, + uint256 newNonce +) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`maker` | address | +|`series` | uint8 | +|`newNonce` | uint256 | + diff --git a/docs/limit-order-protocol/smart-contract/mocks/InteractiveNotificationReceiverMock.md b/docs/limit-order-protocol/smart-contract/helpers/WethUnwrapper.md similarity index 58% rename from docs/limit-order-protocol/smart-contract/mocks/InteractiveNotificationReceiverMock.md rename to docs/limit-order-protocol/smart-contract/helpers/WethUnwrapper.md index f57f5a271..752849a51 100644 --- a/docs/limit-order-protocol/smart-contract/mocks/InteractiveNotificationReceiverMock.md +++ b/docs/limit-order-protocol/smart-contract/helpers/WethUnwrapper.md @@ -1,9 +1,13 @@ -# InteractiveNotificationReceiverMock +# WethUnwrapper + +## Derives +- PostInteractionNotificationReceiver + ## Functions ### receive ```solidity @@ -14,9 +18,9 @@ function receive( -### notifyFillOrder +### fillOrderPostInteraction ```solidity -function notifyFillOrder( +function fillOrderPostInteraction( address , address , address takerAsset, @@ -38,19 +42,3 @@ function notifyFillOrder( |`interactiveData` | bytes | -## Events -### Received -```solidity -event Received( - address , - uint256 -) -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`` | address | -|`` | uint256 | - diff --git a/docs/limit-order-protocol/smart-contract/helpers/WhitelistChecker.md b/docs/limit-order-protocol/smart-contract/helpers/WhitelistChecker.md new file mode 100644 index 000000000..c57744c38 --- /dev/null +++ b/docs/limit-order-protocol/smart-contract/helpers/WhitelistChecker.md @@ -0,0 +1,49 @@ +# WhitelistChecker + + + + + + +## Derives +- PreInteractionNotificationReceiver + +## Functions +### constructor +```solidity +function constructor( + contract IWhitelistRegistry _whitelistRegistry +) public +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`_whitelistRegistry` | contract IWhitelistRegistry | + + +### fillOrderPreInteraction +```solidity +function fillOrderPreInteraction( + address taker, + address makerAsset, + address takerAsset, + uint256 makingAmount, + uint256 takingAmount, + bytes nextInteractiveData +) external +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`taker` | address | +|`makerAsset` | address | +|`takerAsset` | address | +|`makingAmount` | uint256 | +|`takingAmount` | uint256 | +|`nextInteractiveData` | bytes | + + diff --git a/docs/limit-order-protocol/smart-contract/interfaces/AggregatorInterface.md b/docs/limit-order-protocol/smart-contract/interfaces/AggregatorInterface.md deleted file mode 100644 index e0da53501..000000000 --- a/docs/limit-order-protocol/smart-contract/interfaces/AggregatorInterface.md +++ /dev/null @@ -1,25 +0,0 @@ -# AggregatorInterface - -Interface for oracles that provide token prices and timestamp information - - - -## Functions -### latestAnswer -```solidity -function latestAnswer( -) external returns (int256) -``` - - - - -### latestTimestamp -```solidity -function latestTimestamp( -) external returns (uint256) -``` - - - - diff --git a/docs/limit-order-protocol/smart-contract/interfaces/IDaiLikePermit.md b/docs/limit-order-protocol/smart-contract/interfaces/IDaiLikePermit.md index 5d4a1655b..ba5432e42 100644 --- a/docs/limit-order-protocol/smart-contract/interfaces/IDaiLikePermit.md +++ b/docs/limit-order-protocol/smart-contract/interfaces/IDaiLikePermit.md @@ -1,9 +1,11 @@ # IDaiLikePermit + Interface for DAI-style permits + ## Functions ### permit ```solidity diff --git a/docs/limit-order-protocol/smart-contract/interfaces/IWhitelistRegistry.md b/docs/limit-order-protocol/smart-contract/interfaces/IWhitelistRegistry.md new file mode 100644 index 000000000..5e1943882 --- /dev/null +++ b/docs/limit-order-protocol/smart-contract/interfaces/IWhitelistRegistry.md @@ -0,0 +1,23 @@ +# IWhitelistRegistry + + + + + + + +## Functions +### status +```solidity +function status( + address addr +) external returns (uint256) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`addr` | address | + + diff --git a/docs/limit-order-protocol/smart-contract/mocks/interfaces/IWithdrawable.md b/docs/limit-order-protocol/smart-contract/interfaces/IWithdrawable.md similarity index 99% rename from docs/limit-order-protocol/smart-contract/mocks/interfaces/IWithdrawable.md rename to docs/limit-order-protocol/smart-contract/interfaces/IWithdrawable.md index 3351e9f2e..ef8d27275 100644 --- a/docs/limit-order-protocol/smart-contract/mocks/interfaces/IWithdrawable.md +++ b/docs/limit-order-protocol/smart-contract/interfaces/IWithdrawable.md @@ -4,6 +4,8 @@ + + ## Functions ### withdraw ```solidity diff --git a/docs/limit-order-protocol/smart-contract/interfaces/InteractionNotificationReceiver.md b/docs/limit-order-protocol/smart-contract/interfaces/InteractionNotificationReceiver.md new file mode 100644 index 000000000..0a13b7c74 --- /dev/null +++ b/docs/limit-order-protocol/smart-contract/interfaces/InteractionNotificationReceiver.md @@ -0,0 +1,33 @@ +# InteractionNotificationReceiver + + + + + + + +## Functions +### fillOrderInteraction +```solidity +function fillOrderInteraction( + address taker, + address makerAsset, + address takerAsset, + uint256 makingAmount, + uint256 takingAmount, + bytes interactiveData +) external +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`taker` | address | +|`makerAsset` | address | +|`takerAsset` | address | +|`makingAmount` | uint256 | +|`takingAmount` | uint256 | +|`interactiveData` | bytes | + + diff --git a/docs/limit-order-protocol/smart-contract/interfaces/InteractiveNotificationReceiver.md b/docs/limit-order-protocol/smart-contract/interfaces/PostInteractionNotificationReceiver.md similarity index 78% rename from docs/limit-order-protocol/smart-contract/interfaces/InteractiveNotificationReceiver.md rename to docs/limit-order-protocol/smart-contract/interfaces/PostInteractionNotificationReceiver.md index e3dde73c3..005937f9f 100644 --- a/docs/limit-order-protocol/smart-contract/interfaces/InteractiveNotificationReceiver.md +++ b/docs/limit-order-protocol/smart-contract/interfaces/PostInteractionNotificationReceiver.md @@ -1,13 +1,15 @@ -# InteractiveNotificationReceiver +# PostInteractionNotificationReceiver + + + -Interface for interactor which acts between `maker => taker` and `taker => maker` transfers. ## Functions -### notifyFillOrder +### fillOrderPostInteraction ```solidity -function notifyFillOrder( +function fillOrderPostInteraction( address taker, address makerAsset, address takerAsset, diff --git a/docs/limit-order-protocol/smart-contract/interfaces/PreInteractionNotificationReceiver.md b/docs/limit-order-protocol/smart-contract/interfaces/PreInteractionNotificationReceiver.md new file mode 100644 index 000000000..6dae245a8 --- /dev/null +++ b/docs/limit-order-protocol/smart-contract/interfaces/PreInteractionNotificationReceiver.md @@ -0,0 +1,33 @@ +# PreInteractionNotificationReceiver + + +Interface for interactor which acts between `maker => taker` and `taker => maker` transfers. + + + + +## Functions +### fillOrderPreInteraction +```solidity +function fillOrderPreInteraction( + address taker, + address makerAsset, + address takerAsset, + uint256 makingAmount, + uint256 takingAmount, + bytes interactiveData +) external +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`taker` | address | +|`makerAsset` | address | +|`takerAsset` | address | +|`makingAmount` | uint256 | +|`takingAmount` | uint256 | +|`interactiveData` | bytes | + + diff --git a/docs/limit-order-protocol/smart-contract/libraries/ArgumentsDecoder.md b/docs/limit-order-protocol/smart-contract/libraries/ArgumentsDecoder.md index 649a939de..59b8fe690 100644 --- a/docs/limit-order-protocol/smart-contract/libraries/ArgumentsDecoder.md +++ b/docs/limit-order-protocol/smart-contract/libraries/ArgumentsDecoder.md @@ -1,10 +1,26 @@ # ArgumentsDecoder + Library with gas efficient alternatives to `abi.decode` + ## Functions +### decodeUint256Memory +```solidity +function decodeUint256Memory( + bytes data +) internal returns (uint256 value) +``` + + +#### Parameters: +| Name | Type | Description | +| :--- | :--- | :------------------------------------------------------------------- | +|`data` | bytes | + + ### decodeUint256 ```solidity function decodeUint256( @@ -19,9 +35,9 @@ function decodeUint256( |`data` | bytes | -### decodeBool +### decodeBoolMemory ```solidity -function decodeBool( +function decodeBoolMemory( bytes data ) internal returns (bool value) ``` @@ -33,11 +49,11 @@ function decodeBool( |`data` | bytes | -### decodeTargetAndCalldata +### decodeBool ```solidity -function decodeTargetAndCalldata( +function decodeBool( bytes data -) internal returns (address target, bytes args) +) internal returns (bool value) ``` @@ -47,9 +63,9 @@ function decodeTargetAndCalldata( |`data` | bytes | -### decodeTargetAndData +### decodeTargetAndCalldata ```solidity -function decodeTargetAndData( +function decodeTargetAndCalldata( bytes data ) internal returns (address target, bytes args) ``` diff --git a/docs/limit-order-protocol/smart-contract/libraries/Permitable.md b/docs/limit-order-protocol/smart-contract/libraries/Permitable.md index 32998f190..63aa4e5e6 100644 --- a/docs/limit-order-protocol/smart-contract/libraries/Permitable.md +++ b/docs/limit-order-protocol/smart-contract/libraries/Permitable.md @@ -1,9 +1,11 @@ # Permitable + Base contract with common permit handling logics + ## Functions ### _permit ```solidity @@ -21,19 +23,3 @@ function _permit( |`permit` | bytes | -### _permitMemory -```solidity -function _permitMemory( - address token, - bytes permit -) internal -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | address | -|`permit` | bytes | - - diff --git a/docs/limit-order-protocol/smart-contract/libraries/RevertReasonParser.md b/docs/limit-order-protocol/smart-contract/libraries/RevertReasonParser.md index ff0f9437d..aef80a55b 100644 --- a/docs/limit-order-protocol/smart-contract/libraries/RevertReasonParser.md +++ b/docs/limit-order-protocol/smart-contract/libraries/RevertReasonParser.md @@ -1,5 +1,6 @@ # RevertReasonParser + Library that allows to parse unsuccessful arbitrary calls revert reasons. See https://solidity.readthedocs.io/en/latest/control-structures.html#revert for details. Note that we assume revert reason being abi-encoded as Error(string) so it may fail to parse reason @@ -9,6 +10,7 @@ All unsuccessful parsings get encoded as Unknown(data) string + ## Functions ### parse ```solidity diff --git a/docs/limit-order-protocol/smart-contract/mocks/AggregatorMock.md b/docs/limit-order-protocol/smart-contract/mocks/AggregatorMock.md deleted file mode 100644 index b0632c7d3..000000000 --- a/docs/limit-order-protocol/smart-contract/mocks/AggregatorMock.md +++ /dev/null @@ -1,39 +0,0 @@ -# AggregatorMock - -Mock oracle that always returns specified token price - - - -## Functions -### constructor -```solidity -function constructor( - int256 answer -) public -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`answer` | int256 | - - -### latestAnswer -```solidity -function latestAnswer( -) external returns (int256) -``` - - - - -### latestTimestamp -```solidity -function latestTimestamp( -) external returns (uint256) -``` - - - - diff --git a/docs/limit-order-protocol/smart-contract/mocks/README.md b/docs/limit-order-protocol/smart-contract/mocks/README.md deleted file mode 100644 index 61a722307..000000000 --- a/docs/limit-order-protocol/smart-contract/mocks/README.md +++ /dev/null @@ -1 +0,0 @@ -# mocks diff --git a/docs/limit-order-protocol/smart-contract/mocks/TokenMock.md b/docs/limit-order-protocol/smart-contract/mocks/TokenMock.md deleted file mode 100644 index 755c45a41..000000000 --- a/docs/limit-order-protocol/smart-contract/mocks/TokenMock.md +++ /dev/null @@ -1,64 +0,0 @@ -# TokenMock - -Generic token for testing purposes - - - -## Functions -### constructor -```solidity -function constructor( - string name, - string symbol -) public -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`name` | string | -|`symbol` | string | - - -### mint -```solidity -function mint( - address account, - uint256 amount -) external -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`account` | address | -|`amount` | uint256 | - - -### burn -```solidity -function burn( - address account, - uint256 amount -) external -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`account` | address | -|`amount` | uint256 | - - -### getChainId -```solidity -function getChainId( -) external returns (uint256) -``` - - - - diff --git a/docs/limit-order-protocol/smart-contract/mocks/WrappedTokenMock.md b/docs/limit-order-protocol/smart-contract/mocks/WrappedTokenMock.md deleted file mode 100644 index 9c050a89a..000000000 --- a/docs/limit-order-protocol/smart-contract/mocks/WrappedTokenMock.md +++ /dev/null @@ -1,127 +0,0 @@ -# WrappedTokenMock - -Generic token for testing purposes with deposit/withdraw capabilities - - - -## Functions -### constructor -```solidity -function constructor( - string name, - string symbol -) public -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`name` | string | -|`symbol` | string | - - -### receive -```solidity -function receive( -) external -``` - - - - -### mint -```solidity -function mint( - address account, - uint256 amount -) external -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`account` | address | -|`amount` | uint256 | - - -### burn -```solidity -function burn( - address account, - uint256 amount -) external -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`account` | address | -|`amount` | uint256 | - - -### getChainId -```solidity -function getChainId( -) external returns (uint256) -``` - - - - -### deposit -```solidity -function deposit( -) public -``` - - - - -### withdraw -```solidity -function withdraw( - uint256 wad -) public -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`wad` | uint256 | - - -## Events -### Deposit -```solidity -event Deposit( - address dst, - uint256 wad -) -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`dst` | address | -|`wad` | uint256 | - -### Withdrawal -```solidity -event Withdrawal( - address src, - uint256 wad -) -``` - - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`src` | address | -|`wad` | uint256 | - diff --git a/docs/limit-order-protocol/smart-contract/mocks/interfaces/README.md b/docs/limit-order-protocol/smart-contract/mocks/interfaces/README.md deleted file mode 100644 index abd20f462..000000000 --- a/docs/limit-order-protocol/smart-contract/mocks/interfaces/README.md +++ /dev/null @@ -1 +0,0 @@ -# interfaces diff --git a/git-submodules/limit-order-protocol b/git-submodules/limit-order-protocol index 50690643b..c6ff7f6f7 160000 --- a/git-submodules/limit-order-protocol +++ b/git-submodules/limit-order-protocol @@ -1 +1 @@ -Subproject commit 50690643b7d4ae4d0d7f071f12f2201a6d7b4b60 +Subproject commit c6ff7f6f7fadf26ce0ad4a2f69d0035d7b99fa99