-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
cf_pool_swap_rate_v3
with broker fee and DCA support (#5386)
* Add a V3 for `cf_pool_swap_rate_v3` call that will consider broker and affiliate fees as well as DCA. WIP: Need to write tests * Removed Affiliate fees Used `try_execute_without_violations` instead of `swap_with_network_fee` to estimate swap result. * fix: - remove v3 types/methods - add versioning to runtime api - avoid clone --------- Co-authored-by: Daniel <daniel@chainflip.io>
- Loading branch information
Showing
5 changed files
with
163 additions
and
51 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
4 changes: 2 additions & 2 deletions
4
state-chain/custom-rpc/src/snapshots/custom_rpc__test__swap_output_serialization.snap
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
source: state-chain/custom-rpc/src/lib.rs | ||
expression: "serde_json::to_value(swap_output).unwrap()" | ||
expression: "serde_json::to_value(RpcSwapOutputV2\n{\n output: 1_000_000_000_000_000_000u128.into(), intermediary:\n Some(1_000_000u128.into()), network_fee: RpcFee\n { asset: Asset::Usdc, amount: 1_000u128.into() }, ingress_fee: RpcFee\n { asset: Asset::Flip, amount: 500u128.into() }, egress_fee: RpcFee\n { asset: Asset::Eth, amount: 1_000_000u128.into() }, broker_commission:\n RpcFee { asset: Asset::Usdc, amount: 100u128.into() },\n}).unwrap()" | ||
--- | ||
{"egress_fee":{"amount":"0xf4240","asset":"ETH","chain":"Ethereum"},"ingress_fee":{"amount":"0x1f4","asset":"FLIP","chain":"Ethereum"},"intermediary":"0xf4240","network_fee":{"amount":"0x3e8","asset":"USDC","chain":"Ethereum"},"output":"0xde0b6b3a7640000"} | ||
{"broker_commission":{"amount":"0x64","asset":"USDC","chain":"Ethereum"},"egress_fee":{"amount":"0xf4240","asset":"ETH","chain":"Ethereum"},"ingress_fee":{"amount":"0x1f4","asset":"FLIP","chain":"Ethereum"},"intermediary":"0xf4240","network_fee":{"amount":"0x3e8","asset":"USDC","chain":"Ethereum"},"output":"0xde0b6b3a7640000"} |
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.