-
Notifications
You must be signed in to change notification settings - Fork 188
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 #149 from Define101/master
Draft PR adding support UAH
- Loading branch information
Showing
5 changed files
with
78 additions
and
4 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
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,50 @@ | ||
const sdk = require("@defillama/sdk"); | ||
import { sumSingleBalance } from "../helper/generalUtil"; | ||
import { | ||
ChainBlocks, | ||
PeggedIssuanceAdapter, | ||
Balances, | ||
} from "../peggedAsset.type"; | ||
|
||
type ChainContracts = { | ||
[chain: string]: { | ||
[contract: string]: string[]; | ||
}; | ||
}; | ||
|
||
const chainContracts: ChainContracts = { | ||
polygon: { | ||
issued: ["0x0d9447e16072b636b4a1e8f2b8c644e58f3eaa6a"], | ||
}, | ||
}; | ||
|
||
async function chainMinted(chain: string, decimals: number) { | ||
return async function ( | ||
_timestamp: number, | ||
_ethBlock: number, | ||
_chainBlocks: ChainBlocks | ||
) { | ||
let balances = {} as Balances; | ||
for (let issued of chainContracts[chain].issued) { | ||
const totalSupply = ( | ||
await sdk.api.abi.call({ | ||
abi: "erc20:totalSupply", | ||
target: issued, | ||
block: _chainBlocks?.[chain], | ||
chain: chain, | ||
}) | ||
).output; | ||
sumSingleBalance(balances, "peggedUAH", totalSupply / 10 ** decimals, "issued", false); | ||
} | ||
return balances; | ||
}; | ||
} | ||
|
||
const adapter: PeggedIssuanceAdapter = { | ||
polygon: { | ||
minted: chainMinted("polygon", 2), | ||
unreleased: async () => ({}), | ||
}, | ||
}; | ||
|
||
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
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