-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add pheasant network #87
Open
arkeysun
wants to merge
1
commit into
DefiLlama:master
Choose a base branch
from
arkeysun:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,102 @@ | ||
import { Chain } from "@defillama/sdk/build/general"; | ||
import { BridgeAdapter, ContractEventParams, PartialContractEventParams } from "../../helpers/bridgeAdapter.type"; | ||
import { getTxDataFromEVMEventLogs } from "../../helpers/processTransactions"; | ||
|
||
const contractAddresses = { | ||
// ethereum: "", | ||
polygon: "0x84F90083e4aA00B5FD4DAaaEEc75bdF8978EDCD2", | ||
optimism: "0x558F7547A472a6897126e20440453e57AC320794", | ||
arbitrum: "0xb9ACb5601C091B39960a6c4974b979483132B30A", | ||
scroll: "0x27cb8546F60fD5d7869a223F40b8036a9eBe3a4f", | ||
era: "0x77201FC74123Ea148C836418a08Da3322B3201D3", | ||
base: "0x0890f8A7b193A3eEE810DE3AdcFAd181b9ce294E", | ||
polygon_zkevm: "0x9F28AC2c1a2A82db54DFED6B9784a7A950EfEc08", | ||
linea: "0x9E7FCb2c0b8a5461BCc7078a2E37886f254B060b" | ||
} as any; | ||
|
||
const ethTokenAddresses = { | ||
// ethereum: "", | ||
polygon: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", | ||
optimism: "0x558F7547A472a6897126e20440453e57AC320794", | ||
arbitrum: "0xb9ACb5601C091B39960a6c4974b979483132B30A", | ||
scroll: "0x27cb8546F60fD5d7869a223F40b8036a9eBe3a4f", | ||
era: "0x77201FC74123Ea148C836418a08Da3322B3201D3", | ||
base: "0x0890f8A7b193A3eEE810DE3AdcFAd181b9ce294E", | ||
polygon_zkevm: "0x9F28AC2c1a2A82db54DFED6B9784a7A950EfEc08", | ||
linea: "0x9E7FCb2c0b8a5461BCc7078a2E37886f254B060b" | ||
} as any; | ||
|
||
const depositParams: PartialContractEventParams = { | ||
target: "", | ||
topic: "Accept(address,bytes32,uint256)", | ||
abi: [ | ||
"event Accept(address indexed userAddress, bytes32 indexed txHash, uint256 index)", | ||
], | ||
argKeys: { | ||
from: "userAddress", | ||
amount: "index", | ||
}, | ||
isDeposit: true, | ||
}; | ||
|
||
const withdrawalParams: ContractEventParams = { | ||
target: "", | ||
topic: "NewTrade(address,uint256)", | ||
abi: ["event NewTrade(address indexed userAddress, uint256 index)"], | ||
argKeys: { | ||
from: "userAddress", | ||
}, | ||
inputDataExtraction: { | ||
inputDataABI: [ | ||
"function newTrade(uint256 _amount,address _to,uint256 _fee,uint8 _tokenTypeIndex,uint256 _destCode)", | ||
], | ||
inputDataFnName: "newTrade", | ||
inputDataKeys: { | ||
amount: "_amount", | ||
}, | ||
}, | ||
isDeposit: false, | ||
}; | ||
|
||
const constructParams = (chain: Chain) => { | ||
let eventParams = [] as any; | ||
const contractAddress = contractAddresses[chain]; | ||
|
||
// We don't use amount in deposit function as an argument and event, so we can not show deposit amount in this time. | ||
// const finalDepositParams = { | ||
// ...depositParams, | ||
// target: contractAddress, | ||
// fixedEventData: { | ||
// token: "0x0000000000000000000000000000000000000000", | ||
// to: contractAddress, | ||
// amount: 0 | ||
// }, | ||
// }; | ||
|
||
const finalWithdrawalParams = { | ||
...withdrawalParams, | ||
target: contractAddress, | ||
fixedEventData: { | ||
token: "0x0000000000000000000000000000000000000000", | ||
to: contractAddress | ||
}, | ||
}; | ||
eventParams.push(finalWithdrawalParams); | ||
|
||
return async (fromBlock: number, toBlock: number) => | ||
getTxDataFromEVMEventLogs("pheasantnetwork", chain, fromBlock, toBlock, eventParams); | ||
}; | ||
|
||
const adapter: BridgeAdapter = { | ||
// ethereum: constructParams("ethereum"), | ||
polygon: constructParams("polygon"), | ||
optimism: constructParams("optimism"), | ||
arbitrum: constructParams("arbitrum"), | ||
scroll: constructParams("scroll"), | ||
era: constructParams("era"), | ||
base: constructParams("base"), | ||
polygon_zkevm: constructParams("polygon_zkevm"), | ||
linea: constructParams("linea") | ||
}; | ||
|
||
export default adapter; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u need to list your protocol on defillama