Smart Contract Overview
Functions
All write functions emit an event which is traked on the graph to easily query this information.
Constructor
constructor(
address _governanceCouncil,
address _integrationCouncil,
address _nonProfitCouncil
) {
governanceCouncil = _governanceCouncil;
integrationCouncil = _integrationCouncil;
nonProfitCouncil = _nonProfitCouncil;
}
To deploy the contract you need to send the following parameters:
Parameters:
Name | Type | Description |
---|---|---|
governanceCouncil | IERC20 | The governance council multsig wallet |
integrationCouncil | address | The integration council multsig wallet |
nonProfitCouncil | address | The non profit council multsig wallet |
createPool
Non Profit Council
function createPool(address _token) external {
require(msg.sender == nonProfitCouncil, "You are not the non profit council");
address pool = address(new Pool(_token, msg.sender));
pools.push(pool);
emit PoolCreated(pool, _token);
}
Just the non profit council multsig wallet can call this function.
This function add a create a pool.
Parameters:
Name | Type | Description |
---|---|---|
token | address | The token that will be accepted |
fetchPools
Anyone
function fetchPools(uint256 _index, uint256 _length) external view returns (address[] memory _pools, uint256 _newIndex) {
if (_length > pools.length - _index) {
_length = pools.length - _index;
}
_pools = new address[](_length);
for (uint256 i = 0; i < _length; i++) {
_pools[i] = pools[_index + i];
}
return (_pools, _index + _length);
}
Anyone can call this method. You should send the length and the index to receive an array of address.
Parameters:
Name | Type | Description |
---|---|---|
index | uint256 | Index that will be the begin |
length | uint256 | How many pools you want |
addNonProfitToWhitelist
Non Profit Council
function addNonProfitToWhitelist(address _pool, address _nonProfit) external {
require(msg.sender == nonProfitCouncil, "You are not the non profit council");
IPool pool = IPool(_pool);
pool.addNonProfitToWhitelist(_nonProfit);
emit NonProfitAdded(_pool, _nonProfit);
}
Just the non profit council multsig wallet can call this function.
This function add a non profit to the whitelist map as true, this means that this non profit can receive funds in a specific pool.
Parameters:
Name | Type | Description |
---|---|---|
pool | address | The pool address |
nonProfit | address | The non profit wallet address |
removeNonProfitToWhitelist
Non Profit Council
function removeNonProfitFromWhitelist(address _pool, address _nonProfit) external {
require(msg.sender == nonProfitCouncil, "You are not the non profit council");
IPool pool = IPool(_pool);
pool.removeNonProfitFromWhitelist(_nonProfit);
emit NonProfitAdded(_pool, _nonProfit);
}
Just the non profit council multsig wallet can call this function.
This function remove a non profit from whitelist map setting as false, this means that this non profit cannot receive funds in a specific pool.
Parameters:
Name | Type | Description |
---|---|---|
pool | address | The pool address |
nonProfit | address | The non profit wallet address |
addPoolBalance
Promoter
function addPoolBalance(address _pool, uint256 _amount) external {
require(_amount > 0, "Amount must be greater than 0");
IPool pool = IPool(_pool);
IERC20 token = IERC20(pool.token());
token.safeTransferFrom(msg.sender, _pool, _amount);
emit PoolBalanceIncreased(msg.sender, _pool, _amount);
}
Anyone can call this function.
This function send the donation token from the promoter to the contract and increases the specified pool.
Parameters:
Name | Type | Description |
---|---|---|
pool | address | The pool address |
amount | uint256 | The amount of donation tokens that will be sent |
addIntegrationBalance
Integration council
function addIntegrationBalance(address _integration, uint256 _amount)
external
{
require(
msg.sender == integrationCouncil,
"You are not the integration council"
);
require(_amount > 0, "Amount must be greater than 0");
integrations[_integration] += _amount;
emit IntegrationBalanceAdded(_integration, _amount);
}
Just the integration council multsig wallet can call this function.
This function will give the power to integration to distribute the specified amount.
Parameters:
Name | Type | Description |
---|---|---|
integration | address | The integration address |
amount | uint256 | The amount that should be increased on balance |
removeIntegrationBalance
Integration council
function removeIntegrationBalance(address _integration, uint256 _amount)
external
{
require(
msg.sender == integrationCouncil,
"You are not the integration council"
);
require(
integrations[_integration] >= _amount,
"Balance must be greater than amount"
);
require(_amount > 0, "Amount must be greater than 0");
integrations[_integration] -= _amount;
emit IntegrationBalanceRemoved(_integration, _amount);
}
Just the integration council multsig wallet can call this function.
This function send the donation token from the promoter to the contract and increases the specified pool.
Parameters:
Name | Type | Description |
---|---|---|
integration | address | The integration address |
amount | uint256 | The amount that should be removed from balance |
removeIntegrationBalance
Integration council
function removeIntegrationBalance(address _integration, uint256 _amount)
external
{
require(
msg.sender == integrationCouncil,
"You are not the integration council"
);
require(
integrations[_integration] >= _amount,
"Balance must be greater than amount"
);
require(_amount > 0, "Amount must be greater than 0");
integrations[_integration] -= _amount;
emit IntegrationBalanceRemoved(_integration, _amount);
}
Just the integration council multsig wallet can call this function.
This function send the donation token from the promoter to the contract and increases the specified pool.
Parameters:
Name | Type | Description |
---|---|---|
integration | address | The integration address |
amount | uint256 | The amount that should be removed from balance |
donateThroughIntegration
Integration
function donateThroughIntegration(
address _pool,
address _nonProfit,
bytes32 _user,
uint256 _amount
) external {
require(
integrations[msg.sender] >= _amount,
"Balance must greater than amount"
);
require(_amount > 0, "Amount must be greater than 0");
integrations[msg.sender] -= _amount;
IPool pool = IPool(_pool);
pool.donateThroughIntegration(_nonProfit, msg.sender, _user, _amount);
emit DonationAdded(_pool, _user, msg.sender, _nonProfit, _amount);
}
Just the integration wallet can call this function.
This function send the token from the pool to the non profit stamping the user on the donation.
Parameters:
Name | Type | Description |
---|---|---|
pool | address | The pool address |
nonProfit | address | The non profit address |
user | bytes32 | The user hashed email with keccak256 |
amount | uint256 | The amount that should be sended to the non profit |
setNonProfitCouncil
Governance Council
function setNonProfitCouncil(address _nonProfitCouncil) external {
require(
msg.sender == governanceCouncil,
"You are not the governance council"
);
nonProfitCouncil = _nonProfitCouncil;
emit NonProfitCouncilChanged(nonProfitCouncil);
}
Just the governance council wallet can call this function.
This function change the non profit council
Parameters:
Name | Type | Description |
---|---|---|
nonProfitCouncil | address | The new nonProfitCouncil address |
setIntegrationCouncil
Governance Council
function setIntegrationCouncil(address _integrationCouncil) external {
require(
msg.sender == governanceCouncil,
"You are not the governance council"
);
integrationCouncil = _integrationCouncil;
emit IntegrationCouncilChanged(integrationCouncil);
}
Just the governance council wallet can call this function.
This function change the integration council
Parameters:
Name | Type | Description |
---|---|---|
integrationCouncil | address | The new integrationCouncil address |
setGovernanceCouncil
Governance Council
function setGovernanceCouncil(address _governanceCouncil) external {
require(
msg.sender == governanceCouncil,
"You are not the governance council"
);
governanceCouncil = _governanceCouncil;
emit GovernanceCouncilChanged(governanceCouncil);
}
Just the governance council wallet can call this function.
This function change the governanceCouncil council
Parameters:
Name | Type | Description |
---|---|---|
governanceCouncil | address | The new governanceCouncil address |
transferPoolBalance
Governance Council
function transferPoolBalance(address _pool, address _wallet) external {
require(
msg.sender == governanceCouncil,
"You are not the governance council"
);
IPool pool = IPool(_pool);
pool.transferBalance(_wallet);
emit PoolBalanceTransfered(_pool, _wallet);
}
Just the governance council wallet can call this function.
This function move funds from the pool to the specified wallet.
Parameters:
Name | Type | Description |
---|---|---|
pool | address | The pool address |
wallet | address | The wallet that will receive the funds |