This API retrieves information about all of the actions that occurred on the protocol within a certain timespan.
Time Range Limit
The maximum time range (difference between endDate and startDate) is 60 days.
Not specifying startDate and endDate
If the startDate and endDate query parameters are not provided, the API will return the data from the previous 24 hours.
Understanding Actions in Compound
There are many different types of actions in Compound, as you'll see in the action property for each item of the payload.data
array. The guide below will help you understand the possible actions.
Compound Actions |
---|
Deposit |
Repay |
Borrow |
Withdraw |
LiquidationCall |
All actions in the API response share the following data structure
property | type |
---|---|
action | string |
timestamp | string | number |
blockNumber | number |
transactionHash | string |
logIndex | number |
marketId | string |
market | string |
assetId | string |
assetSymbol | string |
amountNative | number |
amountUSD | number |
user | string |
Deposit
The user deposited amountNative of assetSymbol into the Compound Protocol. This deposit serves as collateral for any borrowing activity the user desires to engage in.
In other words, user deposited 13.16 USDC as collateral into the protocol.
{
"action": "Deposit",
"timestamp": 1656878027000,
"blockNumber": 15071590,
"transactionHash": "0xe5470a326b0d2e19d6ea1f6db6c3e69e86e607964058c2f9840215bca0ddfb8c",
"logIndex": 214,
"market": "Compound Maker",
"marketId": "0x95b4ef2869ebd94beb4eee400a99824bf5dc325b",
"amountNative": 13.165901378013261,
"amountUSD": 11849.235931256053,
"user": "0xacd20988c9ad9b1c2865c6c142cd6aeddfe72ad5",
"assetId": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
"assetSymbol": "MKR"
}
Borrow
The address user borrowed amountNative of assetSymbol.
In other words, user borrowed 0.03 MKR from the protocol.
{
"action": "Borrow",
"timestamp": 1656928153000,
"blockNumber": 15075298,
"transactionHash": "0x7da3fa94ec376cc928232266cc55ddb6554a8881a79cb7fac1d510d077dead54",
"logIndex": 505,
"market": "Compound Maker",
"marketId": "0x95b4ef2869ebd94beb4eee400a99824bf5dc325b",
"amountNative": 0.03,
"amountUSD": 26.88121572,
"user": "0x625d6d3f3b375e686642dc8d1d438ac58058d09c",
"assetId": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
"assetSymbol": "MKR"
}
Repay
The address user repaid their loan with amountNative of assetSymbol.
In other words, user repaid 0.5 MKR. This could be less than or equal to the total amount of MKR they have borrowed from the protocol.
{
"action": "Repay",
"timestamp": 1656899967000,
"blockNumber": 15073229,
"transactionHash": "0x6a80fd9ae0712192e5f3edc65fa3a5eac8d66adae1d927e996a24a151efb93ee",
"logIndex": 338,
"market": "Compound Maker",
"marketId": "0x95b4ef2869ebd94beb4eee400a99824bf5dc325b",
"amountNative": 0.5003510004401223,
"amountUSD": 450.6647616251999,
"user": "0x429801692ae55c2d706cf57276fe9f71abcce3cc",
"assetId": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
"assetSymbol": "MKR"
}
Withdraw
The address user is removing amountNative of assetSymbol from the protocol and therefore that amount will no longer be available as collateral for any borrowing activity the user desires to engage in.
In other words, user withdrew 0.751 AAVE from the protocol.
{
"action": "Withdraw",
"timestamp": "2022-07-04 10:56:29 000",
"blockNumber": 15075603,
"transactionHash": "0xfed23de8905fffb2b71fec4ce344fe78608929d2fba56fc1791a413f72023624",
"logIndex": 586,
"market": "Compound Aave Token",
"marketId": "0xe65cdb6479bac1e22340e4e755fae7e509ecd06c",
"amountNative": 0.7517872336114206,
"amountUSD": 43.921641492088554,
"user": "0xd5d6927eacbc5ed42b7537f9f9af871ef6b38f30",
"assetId": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
"assetSymbol": "AAVE"
}
LiquidationCall
The address liquidator has received collateralAmountNative of the cToken collateralAssetSymbol by liquidating address liquidatee.
The address liquidatee's borrow balance exceeded their borrowing capacity. So liquidator repaid the outstanding borrowed balance for the underlying asset of principalAssetSymbol.
In other words, liquidator received 108.769 cAAVE - valued at $163.89 USD at the time of this transaction - from liquidatee's wallet by repaying liquidatee's outstanding DAI (valued at $151.75 USD) in the Compound DAI (cDAI) market.
The liquidator made profitUSD ($12.14 USD) from initiating the liquidation.
{
"action": "LiquidationCall",
"timestamp": "2022-07-09 13:24:55 000",
"blockNumber": 15108621,
"transactionHash": "0xff4b355b03d6ffb7a9f4e5344b2a1e0798b9dda7489e31cf64f73e5c075e7cd9",
"logIndex": 36,
"collateralAssetSymbol": "cAAVE",
"collateralAssetId": "0xe65cdb6479bac1e22340e4e755fae7e509ecd06c",
"collateralAmountNative": 108.76954261,
"collateralAmountUSD": 163.89326510388082,
"profitUSD": 12.140240790880105,
"liquidator": "0x9a0ef593dcc6a77f80699c9fa00d1e138b67d832",
"liquidatee": "0x073dcd914a096586e2c12d3f5409d4848c50259a",
"principalAssetId": "0x5d3a536e4d6dbd6114cc1ead35777bab948e3643",
"principalAssetSymbol": "cDAI",
"principalAmountUSD": 151.7530243130007
}
property | type |
---|---|
liquidator | string |
liquidatee | string |
collateralAssetSymbol | string |
collateralAssetId | string |
collateralAmountNative | number |
collateralAmountUSD | number |
profitUSD | number |
principalAssetId | string |
principalAssetSymbol | string |
principalAmountUSD | number |