-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1816 from Darruma/master
add fees for bcraft clans and mines
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Adapter, FetchV2 } from "../adapters/types"; | ||
import { CHAIN } from "../helpers/chains"; | ||
|
||
const adapter: Adapter = { | ||
adapter: { | ||
[CHAIN.BASE]: { | ||
fetch: (async ({ getLogs, createBalances }) => { | ||
const dailyFees = createBalances(); | ||
const dailyRevenue = createBalances(); | ||
const coinBuyLogs = await getLogs({ | ||
target: "0x7BaEA50509d5d742909592CF045101526b306bE4", | ||
eventAbi: | ||
"event MineUpgraded(address indexed user, uint256 newLevel, uint256 cost)", | ||
}); | ||
coinBuyLogs.map((e: any) => { | ||
dailyFees.addGasToken(e.cost); | ||
dailyRevenue.addGasToken(e.cost); | ||
}); | ||
const buySharesLogs = await getLogs({ | ||
target: "0x0De0D0cF717af57D2101F6Be0962fA890c1FBeC6", | ||
eventAbi: | ||
"event BuyClanShare(address indexed buyer, uint256 indexed clanId, uint256 amount, uint256 price, uint256 protocolFee, uint256 subjectFee)", | ||
}); | ||
buySharesLogs.map((e: any) => { | ||
dailyFees.addGasToken(e.protocolFee); | ||
dailyRevenue.addGasToken(e.protocolFee); | ||
}); | ||
|
||
const sellSharesLogs = await getLogs({ | ||
target: "0x0De0D0cF717af57D2101F6Be0962fA890c1FBeC6", | ||
eventAbi: | ||
"event SellClanShare(address indexed seller, uint256 indexed clanId, uint256 amount, uint256 price, uint256 protocolFee, uint256 subjectFee)", | ||
}); | ||
sellSharesLogs.map((e: any) => { | ||
dailyFees.addGasToken(e.protocolFee); | ||
dailyRevenue.addGasToken(e.protocolFee); | ||
}); | ||
|
||
return { dailyFees, dailyRevenue }; | ||
}) as FetchV2, | ||
start: 18607509, | ||
}, | ||
}, | ||
version: 2, | ||
}; | ||
|
||
export default adapter; |