Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Donation match sender #241

Merged
merged 3 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contracts/accessory/gift-cards/GiftCards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ contract GiftCards is Storage, Initializable, OwnableUpgradeable, ReentrancyGuar
AccountMessages.DepositRequest({
id: endowmentId,
lockedPercentage: lockedPercentage,
liquidPercentage: liquidPercentage
liquidPercentage: liquidPercentage,
donationMatch: msg.sender
}),
tokenAddress,
amount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ contract AccountsDepositWithdrawEndowments is
uint256 liquidSplitPercent = details.liquidPercentage;

require(registrar_config.indexFundContract != address(0), "No Index Fund");

if (msg.sender != registrar_config.indexFundContract) {
if (tempEndowment.endowType == LibAccounts.EndowmentType.Charity) {
// use the Registrar default split for Charities
Expand All @@ -139,27 +138,28 @@ contract AccountsDepositWithdrawEndowments is
uint256 lockedAmount = (amount.mul(lockedSplitPercent)).div(LibAccounts.PERCENT_BASIS);
uint256 liquidAmount = (amount.mul(liquidSplitPercent)).div(LibAccounts.PERCENT_BASIS);

//donation matching flow
//execute donor match will always be called on an EOA
// donation matching flow
if (lockedAmount > 0) {
address donationMatch = details.donationMatch;
if (donationMatch == address(0)) {
donationMatch = msg.sender;
}

if (
tempEndowment.endowType == LibAccounts.EndowmentType.Charity &&
registrar_config.donationMatchCharitesContract != address(0)
) {
IDonationMatching(registrar_config.donationMatchCharitesContract).executeDonorMatch(
details.id,
lockedAmount,
tx.origin,
donationMatch,
registrar_config.haloToken
);
} else if (
tempEndowment.endowType == LibAccounts.EndowmentType.Normal &&
tempEndowment.donationMatchContract != address(0)
) {
} else if (tempEndowment.donationMatchContract != address(0)) {
IDonationMatching(tempEndowment.donationMatchContract).executeDonorMatch(
details.id,
lockedAmount,
tx.origin,
donationMatch,
tempEndowment.daoToken
);
}
Expand Down Expand Up @@ -330,7 +330,8 @@ contract AccountsDepositWithdrawEndowments is
AccountMessages.DepositRequest({
id: beneficiaryEndowId,
lockedPercentage: 0,
liquidPercentage: 100
liquidPercentage: 100,
donationMatch: address(this) // all liquid so won't trigger a match
}),
tokens[t].addr,
(amountLeftover - withdrawFeeEndow)
Expand Down
1 change: 1 addition & 0 deletions contracts/core/accounts/message.sol
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ library AccountMessages {
uint32 id;
uint256 lockedPercentage;
uint256 liquidPercentage;
address donationMatch;
}

struct InvestRequest {
Expand Down
3 changes: 2 additions & 1 deletion contracts/core/index-fund/IndexFund.sol
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ contract IndexFund is IIndexFund, Storage, ReentrancyGuard, Initializable {
AccountMessages.DepositRequest({
id: donationMessages.member_ids[i],
lockedPercentage: donationMessages.lockedSplit[i],
liquidPercentage: donationMessages.liquidSplit[i]
liquidPercentage: donationMessages.liquidSplit[i],
donationMatch: msg.sender
}),
tokenaddress,
donationMessages.locked_donation_amount[i] + donationMessages.liquid_donation_amount[i]
Expand Down
3 changes: 2 additions & 1 deletion contracts/multisigs/CharityApplications.sol
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ contract CharityApplications is MultiSigGeneric, StorageApplications, ICharityAp
AccountMessages.DepositRequest({
id: endowmentId,
lockedPercentage: 100 - config.seedSplitToLiquid,
liquidPercentage: config.seedSplitToLiquid
liquidPercentage: config.seedSplitToLiquid,
donationMatch: address(this)
}),
config.seedAsset,
config.seedAmount
Expand Down
Loading