Skip to content

Commit

Permalink
Merge pull request #1816 from Darruma/master
Browse files Browse the repository at this point in the history
add fees for bcraft clans and mines
  • Loading branch information
dtmkeng committed Aug 25, 2024
2 parents 772184f + 399a4d7 commit 979e35f
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions fees/bcraft.ts
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;

0 comments on commit 979e35f

Please sign in to comment.