-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
325a471
commit 99ebbf7
Showing
1 changed file
with
2 additions
and
66 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 |
---|---|---|
@@ -1,73 +1,9 @@ | ||
const sdk = require("@defillama/sdk"); | ||
import { sumSingleBalance } from "../helper/generalUtil"; | ||
import { | ||
Balances, | ||
ChainBlocks, | ||
PeggedIssuanceAdapter, | ||
} from "../peggedAsset.type"; | ||
|
||
const chainContracts = { | ||
fraxtal: { | ||
issued: "0x788D96f655735f52c676A133f4dFC53cEC614d4A", | ||
amoManager: "0x49a0c8030Ca199f6F246517aE689E3cC0775271a", | ||
issuer: "0x1ec13EF0b22C53298A00b23b03203E03D999b7a2", | ||
}, | ||
}; | ||
|
||
async function dUSDMinted(chain: string, decimals: number) { | ||
return async function ( | ||
_timestamp: number, | ||
_ethBlock: number, | ||
_chainBlocks: ChainBlocks, | ||
) { | ||
let balances = {} as Balances; | ||
const circulatingSupply = ( | ||
await sdk.api.abi.call({ | ||
abi: { | ||
inputs: [], | ||
name: "circulatingDusd", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
target: chainContracts[chain as keyof typeof chainContracts].issuer, | ||
chain: chain, | ||
block: _chainBlocks?.[chain], | ||
}) | ||
).output; | ||
|
||
const amoSupply = ( | ||
await sdk.api.abi.call({ | ||
abi: { | ||
inputs: [], | ||
name: "totalAmoSupply", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
target: chainContracts[chain as keyof typeof chainContracts].amoManager, | ||
chain: chain, | ||
block: _chainBlocks?.[chain], | ||
}) | ||
).output; | ||
|
||
|
||
sumSingleBalance( | ||
balances, | ||
"peggedUSD", | ||
Number((BigInt(circulatingSupply) + BigInt(amoSupply))/ BigInt(10 ** decimals)), | ||
"issued", | ||
false, | ||
); | ||
|
||
return balances; | ||
}; | ||
} | ||
|
||
const adapter: PeggedIssuanceAdapter = { | ||
fraxtal: { | ||
minted: dUSDMinted("fraxtal", 6), | ||
}, | ||
}; | ||
|
||
import { addChainExports } from "../helper/getSupply"; | ||
const adapter = addChainExports(chainContracts); | ||
export default adapter; |