Write protocol for uniswap v2 and v3 swaps. Require protocol for all future swaps. Write protocols to arbitrages
This commit is contained in:
parent
3f2daee6a9
commit
9ce82a36de
@ -103,6 +103,7 @@ UNISWAP_V3_CONTRACT_SPECS = [
|
|||||||
UNISWAP_V3_GENERAL_SPECS = [
|
UNISWAP_V3_GENERAL_SPECS = [
|
||||||
ClassifierSpec(
|
ClassifierSpec(
|
||||||
abi_name=UNISWAP_V3_POOL_ABI_NAME,
|
abi_name=UNISWAP_V3_POOL_ABI_NAME,
|
||||||
|
protocol=Protocol.uniswap_v3,
|
||||||
classifiers={
|
classifiers={
|
||||||
"swap(address,bool,int256,uint160,bytes)": UniswapV3SwapClassifier,
|
"swap(address,bool,int256,uint160,bytes)": UniswapV3SwapClassifier,
|
||||||
},
|
},
|
||||||
@ -134,6 +135,7 @@ UNISWAPPY_V2_CONTRACT_SPECS = [
|
|||||||
|
|
||||||
UNISWAPPY_V2_PAIR_SPEC = ClassifierSpec(
|
UNISWAPPY_V2_PAIR_SPEC = ClassifierSpec(
|
||||||
abi_name=UNISWAP_V2_PAIR_ABI_NAME,
|
abi_name=UNISWAP_V2_PAIR_ABI_NAME,
|
||||||
|
protocol=Protocol.uniswap_v2,
|
||||||
classifiers={
|
classifiers={
|
||||||
"swap(uint256,uint256,address,bytes)": UniswapV2SwapClassifier,
|
"swap(uint256,uint256,address,bytes)": UniswapV2SwapClassifier,
|
||||||
},
|
},
|
||||||
|
@ -41,6 +41,7 @@ def write_arbitrages(
|
|||||||
end_amount=arbitrage.end_amount,
|
end_amount=arbitrage.end_amount,
|
||||||
profit_amount=arbitrage.profit_amount,
|
profit_amount=arbitrage.profit_amount,
|
||||||
error=arbitrage.error,
|
error=arbitrage.error,
|
||||||
|
protocols={swap.protocol.value for swap in arbitrage.swaps},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from sqlalchemy import Column, Numeric, String
|
from sqlalchemy import ARRAY, Column, Numeric, String
|
||||||
|
|
||||||
from .base import Base
|
from .base import Base
|
||||||
|
|
||||||
@ -15,3 +15,4 @@ class ArbitrageModel(Base):
|
|||||||
end_amount = Column(Numeric, nullable=False)
|
end_amount = Column(Numeric, nullable=False)
|
||||||
profit_amount = Column(Numeric, nullable=False)
|
profit_amount = Column(Numeric, nullable=False)
|
||||||
error = Column(String, nullable=True)
|
error = Column(String, nullable=True)
|
||||||
|
protocols = Column(ARRAY(String))
|
||||||
|
@ -18,5 +18,5 @@ class Swap(BaseModel):
|
|||||||
token_in_amount: int
|
token_in_amount: int
|
||||||
token_out_address: str
|
token_out_address: str
|
||||||
token_out_amount: int
|
token_out_amount: int
|
||||||
protocol: Optional[Protocol]
|
protocol: Protocol
|
||||||
error: Optional[str]
|
error: Optional[str]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user