Skip to content

Instantly share code, notes, and snippets.

@mxjxn
Created August 11, 2022 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mxjxn/4c7e831766d470be8bb513ef46839ec7 to your computer and use it in GitHub Desktop.
Save mxjxn/4c7e831766d470be8bb513ef46839ec7 to your computer and use it in GitHub Desktop.
import Charged from '@charged-particles/sdk'
const charged = new Charged({providers: window.ethereum});
const contractAddress = '0x...';
const tokenId = '123';
const nft = charged.NFT(contractAddress, tokenId);
// This energizes our nft with 47 DAI tokens.
const txReceipt = await nft.energize(
'aave.B',
daiContractAddress,
ethers.utils.parseEther('47')
);
// Get the energized mass
const massBN = await nft.getMass('aave.B', '0xDAI');
// Discharges all of the interest accrued by the DAI tokens to my wallet.
const txReceipt2 = await nft.discharge(myAddress, 'aave.B', daiContractAddress);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment