-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/update amm v3 sdk #303
Conversation
WalkthroughThe recent updates introduce significant changes to the Oraiswap contract ecosystem, including a new version release for both the SDK and build packages. Key enhancements involve expanded incentive management functionalities within the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant OraiswapV3Interface
participant OraiswapV3ReadOnlyInterface
User->>OraiswapV3Interface: createIncentive(params)
OraiswapV3Interface-->>OraiswapV3ReadOnlyInterface: Incentive created
User->>OraiswapV3Interface: updateIncentive(params)
OraiswapV3Interface-->>OraiswapV3ReadOnlyInterface: Incentive updated
User->>OraiswapV3Interface: claimIncentive(index)
OraiswapV3Interface-->>User: Incentive claimed
User->>OraiswapV3ReadOnlyInterface: positionIncentives(index, ownerId)
OraiswapV3ReadOnlyInterface-->>User: Returns incentive details
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Code Coverage Summary
Diff against main
Results for commit: decdf29 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
packages/contracts-build/data/oraiswap-v3.wasm
is excluded by!**/*.wasm
Files selected for processing (5)
- packages/contracts-build/package.json (1 hunks)
- packages/contracts-build/src/index.ts (1 hunks)
- packages/contracts-sdk/package.json (1 hunks)
- packages/contracts-sdk/src/OraiswapV3.client.ts (7 hunks)
- packages/contracts-sdk/src/OraiswapV3.types.ts (7 hunks)
Files skipped from review due to trivial changes (2)
- packages/contracts-build/package.json
- packages/contracts-sdk/package.json
Additional context used
Biome
packages/contracts-sdk/src/OraiswapV3.client.ts
[error] 9-9: Do not shadow the global "Boolean" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
Additional comments not posted (25)
packages/contracts-build/src/index.ts (1)
18-19
: LGTM! Ensure consistency across the codebase.The addition of "oraiswap-v3" to the
ContractName
type is correct.Verify that all references to
ContractName
throughout the codebase are updated to handle this new contract name.Verification successful
Verification successful.
The
ContractName
type includes "oraiswap-v3", and the functions that useContractName
are designed to handle different contract names dynamically. No issues found with the handling of "oraiswap-v3".
packages/contracts-build/src/index.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to `ContractName` handle the new "oraiswap-v3" contract name. # Test: Search for `ContractName` usage. Expect: References to "oraiswap-v3". rg --type ts 'ContractName'Length of output: 277
Script:
#!/bin/bash # Extract and inspect lines around each reference to `ContractName` to verify if "oraiswap-v3" is handled appropriately. # Extract lines around the definition of `ContractName` rg --type ts -A 5 -B 5 'export type ContractName' packages/contracts-build/src/index.ts # Extract lines around the usage of `ContractName` in `getContractDir` rg --type ts -A 5 -B 5 'getContractDir' packages/contracts-build/src/index.ts # Extract lines around the usage of `ContractName` in the object with an optional `contractName` property rg --type ts -A 5 -B 5 'contractName?: ContractName' packages/contracts-build/src/index.tsLength of output: 1288
packages/contracts-sdk/src/OraiswapV3.types.ts (13)
114-121
: New incentive creation message type looks good.The
create_incentive
message type is well-defined and includes necessary fields for pool key, reward per second, reward token, and optional fields for start timestamp and total reward.
123-129
: New incentive update message type looks good.The
update_incentive
message type is well-defined and includes necessary fields for incentive ID, pool key, and optional fields for remaining reward, reward per second, and start timestamp.
131-133
: New incentive claim message type looks good.The
claim_incentive
message type is well-defined and includes necessary fields for the index.
149-157
: New AssetInfo type looks good.The
AssetInfo
type is well-defined and can represent either a token or a native token, enhancing asset handling flexibility.
301-304
: New position incentives query type looks good.The
position_incentives
query type is well-defined and includes necessary fields for index and owner ID.
Line range hint
327-336
:
Addition of incentives field to Position interface looks good.The
incentives
field in thePosition
interface is well-defined and allows tracking of incentives associated with each position.
337-341
: New PositionIncentives interface looks good.The
PositionIncentives
interface is well-defined and includes necessary fields for incentive growth, ID, and pending rewards.
367-372
: Addition of incentives field to Pool interface looks good.The
incentives
field in thePool
interface is well-defined and allows tracking of incentives related to the pool.
373-381
: New IncentiveRecord interface looks good.The
IncentiveRecord
interface is well-defined and includes necessary fields for incentive ID, growth metrics, and reward specifics.
418-421
: New TickIncentive interface looks good.The
TickIncentive
interface is well-defined and includes necessary fields for incentive growth and ID.
387-388
: New Uint128 type looks good.The
Uint128
type definition is simple and correct.
388-389
: New ArrayOfAsset type looks good.The
ArrayOfAsset
type definition is simple and correct.
389-392
: New Asset interface looks good.The
Asset
interface is well-defined and includes necessary fields for amount and asset info.packages/contracts-sdk/src/OraiswapV3.client.ts (11)
179-185
: New positionIncentives method in OraiswapV3ReadOnlyInterface looks good.The
positionIncentives
method is well-defined and includes necessary parameters for index and owner ID.
219-219
: Binding the positionIncentives method in OraiswapV3QueryClient looks good.The
positionIncentives
method is correctly bound in theOraiswapV3QueryClient
constructor.
560-573
: Implementation of positionIncentives method in OraiswapV3QueryClient looks good.The
positionIncentives
method is correctly implemented and queries the contract for position incentives.
733-745
: New createIncentive method in OraiswapV3Interface looks good.The
createIncentive
method is well-defined and includes necessary parameters for pool key, reward per second, reward token, start timestamp, and total reward.
746-752
: New updateIncentive method in OraiswapV3Interface looks good.The
updateIncentive
method is well-defined and includes necessary parameters for incentive ID, pool key, remaining reward, reward per second, and start timestamp.
753-758
: New updateIncentive method in OraiswapV3Interface looks good.The
updateIncentive
method is well-defined and includes necessary parameters for incentive ID, pool key, remaining reward, reward per second, and start timestamp.
759-763
: New claimIncentive method in OraiswapV3Interface looks good.The
claimIncentive
method is well-defined and includes necessary parameters for the index.
796-798
: Binding the new incentive methods in OraiswapV3Client looks good.The
createIncentive
,updateIncentive
, andclaimIncentive
methods are correctly bound in theOraiswapV3Client
constructor.
1107-1129
: Implementation of createIncentive method in OraiswapV3Client looks good.The
createIncentive
method is correctly implemented and sends the appropriate execute message to the contract.
1130-1152
: Implementation of updateIncentive method in OraiswapV3Client looks good.The
updateIncentive
method is correctly implemented and sends the appropriate execute message to the contract.
1153-1163
: Implementation of claimIncentive method in OraiswapV3Client looks good.The
claimIncentive
method is correctly implemented and sends the appropriate execute message to the contract.
@@ -6,7 +6,7 @@ | |||
|
|||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; | |||
import { Coin, StdFee } from "@cosmjs/amino"; | |||
import {Percentage, InstantiateMsg, ExecuteMsg, Addr, Liquidity, SqrtPrice, TokenAmount, Binary, Expiration, Timestamp, Uint64, PoolKey, FeeTier, SwapHop, NftExtensionMsg, QueryMsg, MigrateMsg, FeeGrowth, AllNftInfoResponse, OwnerOfResponse, Approval, NftInfoResponse, Position, TokensResponse, ApprovedForAllResponse, Boolean, ArrayOfFeeTier, ArrayOfLiquidityTick, LiquidityTick, Uint32, NumTokensResponse, Pool, ArrayOfPoolWithPoolKey, PoolWithPoolKey, ArrayOfPositionTick, PositionTick, ArrayOfPosition, QuoteResult, Tick, ArrayOfTupleOfUint16AndUint64} from "./OraiswapV3.types"; | |||
import {Percentage, InstantiateMsg, ExecuteMsg, Addr, Liquidity, SqrtPrice, TokenAmount, Binary, Expiration, Timestamp, Uint64, AssetInfo, PoolKey, FeeTier, SwapHop, NftExtensionMsg, QueryMsg, MigrateMsg, FeeGrowth, AllNftInfoResponse, OwnerOfResponse, Approval, NftInfoResponse, Position, PositionIncentives, TokensResponse, ApprovedForAllResponse, Boolean, ArrayOfFeeTier, ArrayOfLiquidityTick, LiquidityTick, Uint32, NumTokensResponse, Pool, IncentiveRecord, ArrayOfPoolWithPoolKey, PoolWithPoolKey, Uint128, ArrayOfAsset, Asset, ArrayOfPositionTick, PositionTick, ArrayOfPosition, QuoteResult, Tick, TickIncentive, ArrayOfTupleOfUint16AndUint64} from "./OraiswapV3.types"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming the Boolean
type to avoid shadowing the global Boolean
property.
Shadowing global properties can lead to confusion and potential bugs.
- Boolean
+ CustomBoolean
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import {Percentage, InstantiateMsg, ExecuteMsg, Addr, Liquidity, SqrtPrice, TokenAmount, Binary, Expiration, Timestamp, Uint64, AssetInfo, PoolKey, FeeTier, SwapHop, NftExtensionMsg, QueryMsg, MigrateMsg, FeeGrowth, AllNftInfoResponse, OwnerOfResponse, Approval, NftInfoResponse, Position, PositionIncentives, TokensResponse, ApprovedForAllResponse, Boolean, ArrayOfFeeTier, ArrayOfLiquidityTick, LiquidityTick, Uint32, NumTokensResponse, Pool, IncentiveRecord, ArrayOfPoolWithPoolKey, PoolWithPoolKey, Uint128, ArrayOfAsset, Asset, ArrayOfPositionTick, PositionTick, ArrayOfPosition, QuoteResult, Tick, TickIncentive, ArrayOfTupleOfUint16AndUint64} from "./OraiswapV3.types"; | |
import {Percentage, InstantiateMsg, ExecuteMsg, Addr, Liquidity, SqrtPrice, TokenAmount, Binary, Expiration, Timestamp, Uint64, AssetInfo, PoolKey, FeeTier, SwapHop, NftExtensionMsg, QueryMsg, MigrateMsg, FeeGrowth, AllNftInfoResponse, OwnerOfResponse, Approval, NftInfoResponse, Position, PositionIncentives, TokensResponse, ApprovedForAllResponse, CustomBoolean, ArrayOfFeeTier, ArrayOfLiquidityTick, LiquidityTick, Uint32, NumTokensResponse, Pool, IncentiveRecord, ArrayOfPoolWithPoolKey, PoolWithPoolKey, Uint128, ArrayOfAsset, Asset, ArrayOfPositionTick, PositionTick, ArrayOfPosition, QuoteResult, Tick, TickIncentive, ArrayOfTupleOfUint16AndUint64} from "./OraiswapV3.types"; |
Tools
Biome
[error] 9-9: Do not shadow the global "Boolean" property.
Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.
(lint/suspicious/noShadowRestrictedNames)
Summary by CodeRabbit
New Features
@oraichain/oraidex-contracts-build
and@oraichain/oraidex-contracts-sdk
packages.Bug Fixes