Actualmente, los contratos inteligentes se dividen en tres: ImpactMarket, CommunityFactory e Community.
ImpactMarket
Su única función es aceptar nuevas comunidades. Esto será reemplazado por un mecanismo (ya en desarrollo) con votación para nuevas comunidades.
CommunityFactory
Su única función es implementar nuevos contratos comunitarios. Un contrato por comunidad. Este contrato está controlado por impactMarket.
Community
Este es el contrato que utilizan las comunidades. Existe un contrato por comunidad, que permite donaciones individuales a cada una de ellas.
A continuación se enumeran los métodos públicos que se pueden llamar para obtener información sobre el contrato.
// When the beneficiary can claim again (timestamp)mapping(address => uint256) public cooldown;// What was the last interval when the user claim.// This is used to calculate the next intervalmapping(address => uint256) public lastInterval;// How much has the beneficiary claimed so far.mapping(address => uint256) public claimed;// In what state is the beneficiary (enum BeneficiaryState {NONE, Valid, Locked, Removed})mapping(address => BeneficiaryState) public beneficiaries;// community amount per claim (in cUSD)uint256 public claimAmount;// community base interval (we have been using 1 day or 1 week) (in seconds)uint256 public baseInterval;// community increment interval (in seconds)uint256 public incrementInterval;// community maximun claim per beneficiary (in cUSD)uint256 public maxClaim;// if the community was migrated, will have here the addressaddress public previousCommunityContract;// impactMarket contract addressaddress public impactMarketAddress;// cUSD contract addressaddress public cUSDAddress;
Functions
Nota importante: para integraciones externas, cuando un gerente intenta agregar una dirección como gerente o beneficiario, esa dirección debe registrarse primero en el sistema, de lo contrario, aparecerá un error mencionado en la sección agregar beneficiario. Para evitar esto, use endpoint / api / user / auth. Para obtener más información, consulte la sección API.
/** * @dev Allow community managers to add other managers. */function addManager(address _account) external onlyManagers;/** * @dev Allow community managers to remove other managers. */function removeManager(address _account) external onlyManagers;/** * @dev Allow community managers to add beneficiaries. */function addBeneficiary(address _account) external onlyManagers;/** * @dev Allow community managers to lock beneficiaries. */function lockBeneficiary(address _account) external onlyManagers;/** * @dev Allow community managers to unlock locked beneficiaries. */function unlockBeneficiary(address _account) external onlyManagers;/** * @dev Allow community managers to remove beneficiaries. */function removeBeneficiary(address _account) external onlyManagers;/** * @dev Allow beneficiaries to claim. */function claim() external onlyValidBeneficiary;/** * @dev Allow community managers to edit community variables. */function edit( uint256 _claimAmount, uint256 _maxClaim, uint256 _baseInterval, uint256 _incrementInterval) external onlyManagers;