Charged Particles Contract (V2)

Charged Particles Contract. The primary contract for interfacing with the Charged Particles protocol.

Get Contract Info

Get Info about the contract, its settings, and its state.

getStateAddress

  function getStateAddress() 
    external 
    view 
    returns (address stateAddress);

Gets the address of the ChargedState contract, which can be used for setting and retrieving additional information about a Particle (NFT) contract. E.g. time locks on particle mass (principal) or charge (interest).

getStateAddress

  function getSettingsAddress() 
    external 
    view 
    returns (address settingsAddress);

Gets the address of the ChargedSettings contract, which can be used for setting and retrieving the settings of the ChargedParticles contract. E.g. Creator annuity.

When Custom Contracts are registered, only the "owner" or operator of the Contract is allowed to register them and define custom rules for how their tokens are "Charged". Otherwise, any token can be "Charged" according to the default rules of Charged Particles.

getManagersAddress

  function getManagersAddress() 
    external 
    view 
    returns (address managersAddress);

Gets the address of the ChargedManagers contract. To learn more about how the ChargedManagers contract functions and what purpose it serves, look here. In V1 of the protocol, each manager had their own contract, but in V2, all are contained within a single ChargedManagers contract. In both versions of the protocol, the managers serve the same purpose.

onERC721Received

Part of the ERC721 standard. Required for any contract that receives ERC-721 tokens. See Open Zeppelin for more detail.

function onERC721Received(
  address,
  address,
  uint256,
  bytes calldata
) external virtual override returns (bytes4);

onERC1155Received

Part of the ERC1155 standard. Required for any contract that receives ERC-1155 tokens. See Open Zeppelin for more detail.

function onERC1155Received(
  address,
  address,
  uint256,
  bytes calldata
) external virtual override returns (bytes4);

getFeesForDeposit

Calculates the amount of fees to be paid for a specific deposit amount.

function getFeesForDeposit(
  uint256 assetAmount
) external view returns (uint256 protocolFee);

Get Particle Info

baseParticleMass

Gets the amount of asset tokens that have been deposited into the Particle, which represent the Mass of the Particle.

 function baseParticleMass(
  address contractAddress, 
  uint256 tokenId, 
  string calldata walletManagerId, 
  address assetToken
) external returns (uint256);

currentParticleCharge

Gets the amount of interest that the Particle has generated representing the Charge of the Particle.

function currentParticleCharge(
  address contractAddress, 
  uint256 tokenId, 
  string calldata walletManagerId, 
  address assetToken
) external returns (uint256);

currentParticleKinetics

Gets the amount of LP Tokens that the Particle has generated representing the Kinetics of the Particle.

 function currentParticleKinetics(
  address contractAddress, 
  uint256 tokenId, 
  string calldata walletManagerId, 
  address assetToken
) external returns (uint256);

currentParticleCovalentBonds

Gets the total amount of ERC721 Tokens that the Particle holds.

function currentParticleCovalentBonds(
  address contractAddress, 
  uint256 tokenId, 
  string calldata basketManagerId
) external view returns (uint256);

Particle Mechanics

Interact with Particles

energizeParticle

Fund a Particle with an asset token (ERC20). Must be called by the account providing the asset. The account must approve THIS (ChargedParticles.sol) contract as operator of the asset.

 function energizeParticle(
  address contractAddress,
  uint256 tokenId,
  string calldata walletManagerId,
  address assetToken,
  uint256 assetAmount,
  address referrer
) external returns (uint256 yieldTokensAmount);

dischargeParticle

Allows the owner or operator of the token (Particle) to collect or transfer the interest generated from the token without removing the underlying asset.

function dischargeParticle(
  address receiver,
  address contractAddress,
  uint256 tokenId,
  string calldata walletManagerId,
  address assetToken
) external returns (
  uint256 creatorAmount, 
  uint256 receiverAmount
);

dischargeParticleAmount

Allows the owner or operator of the token (Particle) to collect or transfer a specific amount of the interest generated from the token without removing the principal.

function dischargeParticleAmount(
  address receiver,
  address contractAddress,
  uint256 tokenId,
  string calldata walletManagerId,
  address assetToken,
  uint256 assetAmount
) external returns (
  uint256 creatorAmount, 
  uint256 receiverAmount
);

dischargeParticleForCreator

Allows the creator of the token (Particle) to collect or transfer a their portion of the interest generated from the token without removing the principal.

function dischargeParticleForCreator(
  address receiver,
  address contractAddress,
  uint256 tokenId,
  string calldata walletManagerId,
  address assetToken,
  uint256 assetAmount
) external returns (uint256 receiverAmount);

releaseParticle

Releases the full amount of asset + interest held within the Particle by LP of the assets.

function releaseParticle(
  address receiver,
  address contractAddress,
  uint256 tokenId,
  string calldata walletManagerId,
  address assetToken
) external returns (
  uint256 creatorAmount, 
  uint256 receiverAmount
);

releaseParticleAmount

Releases a partial amount of principal + interest held within the Particle by LP of the assets.

function releaseParticleAmount(
  address receiver,
  address contractAddress,
  uint256 tokenId,
  string calldata walletManagerId,
  address assetToken,
  uint256 assetAmount
) external returns (
  uint256 creatorAmount, 
  uint256 receiverAmount
);

covalentBond

Deposit other NFTs into the Particle. Must be called by the account providing the NFT.Depositing account must approve this (ChargedParticles.sol) contract as NFT's operator.

function covalentBond(
  address contractAddress,
  uint256 tokenId,
  string calldata basketManagerId,
  address nftTokenAddress,
  uint256 nftTokenId
) external returns (bool success);

breakCovalentBond

Withdraw an NFT from a Particle.

Other

Events

  event Initialized(address indexed initiator);
  event ControllerSet(address indexed controllerAddress, string controllerId);
  event DepositFeeSet(uint256 depositFee);
  event ProtocolFeesCollected(address indexed assetToken, uint256 depositAmount, uint256 feesCollected);

Last updated