Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix review - require funder equals issuer #116

Merged
merged 37 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2eb4bae
removes all traces of Ongoing and TieredPercentage bounties, includin…
FlacoJones Feb 25, 2023
5206d9a
updates BountyFactory test to operate without Ongoing or TieredPercen…
FlacoJones Feb 25, 2023
67155c2
updates ClaimManager tests to pass without Ongoing or TieredPercentage
FlacoJones Feb 25, 2023
9c56e95
updates DepositManager test to run without Ongoing or TieredPercentag…
FlacoJones Feb 25, 2023
71ed979
updates OpenQ test to pass without Ongoing or TieredPercentage bounty…
FlacoJones Feb 25, 2023
4300bae
udpates TieredBountyCore tests to pass without Ongoing or TieredPerce…
FlacoJones Feb 25, 2023
6fb823c
updates deploy scripts to operate without Ongoing or TieredPercentage
FlacoJones Feb 25, 2023
321c8d7
removes TOKEN_ADDRESS_LIMIT from TokenWhitelist.sol
FlacoJones Feb 25, 2023
834cdb8
removes the check of token address limit on DepositManager. simply re…
FlacoJones Feb 25, 2023
dc2364a
removes tokenAddressLimitReached in DepositManager
FlacoJones Feb 25, 2023
5b11bb6
updates OpenQTokenWhitelist tests to pass without TOKEN_ADDRESS_LIMIT
FlacoJones Feb 25, 2023
29cb98e
updates deploy script for OpenQTokenWhitelist being initialized witho…
FlacoJones Feb 25, 2023
ea60cb4
removes deprecated tests in DepositManager.test.js related to TOKEN_A…
FlacoJones Feb 25, 2023
9bde618
updates OpenQ.test.js to deploy OpenQTokenWhitelist without TOKEN_ADD…
FlacoJones Feb 25, 2023
b32f0b2
further updates tests to deploy OpenQTokenWhitelist without TOKEN_ADD…
FlacoJones Feb 25, 2023
3630be4
removes nft logic from AtomicBountyV1.sol
FlacoJones Feb 25, 2023
f67a4ca
removes nft logic from BountyCore.sol
FlacoJones Feb 25, 2023
fd0fae1
removes NFT logic from TieredBountyCore
FlacoJones Feb 25, 2023
d7845b6
removes nftDepositLimit from TieredFixedBountyV1.sol
FlacoJones Feb 25, 2023
89d6386
removes nft interface methods from IBountyCore.sol
FlacoJones Feb 25, 2023
cb23808
removes logic that looped over nft deposits to transfer on claims
FlacoJones Feb 25, 2023
b25f6a6
removes nft funding logic from DepositManagerV1
FlacoJones Feb 25, 2023
69fdb97
removes unused NFT related error messages from Errors.sol
FlacoJones Feb 25, 2023
3dd7ae2
removes MockNFT contract
FlacoJones Feb 25, 2023
3d7f4f5
updates DepositManager.test.js to remove nft related tests
FlacoJones Feb 25, 2023
01d67be
removes nft related tests from ClaimManager.test.js
FlacoJones Feb 25, 2023
f7db4c9
removes nft related tests from OpenQ.test.js
FlacoJones Feb 25, 2023
983c1c4
updates deploy contract script to remove nft related logic
FlacoJones Feb 25, 2023
b6767a8
removes MockNFt from fund_bounties script
FlacoJones Feb 25, 2023
54a4500
removes nft logic from AtomicBountyV1.test.js
FlacoJones Feb 25, 2023
a10a1df
removes nft logic from BountyCore and TieredBountyCore tests
FlacoJones Feb 25, 2023
a75a383
removes nft logic from all tests
FlacoJones Feb 25, 2023
64b9284
removes ERC721Receiver imports from BountyStorageCore.sol
FlacoJones Feb 25, 2023
f7b42b9
allows for funding of contracts even after close in the case that fur…
FlacoJones Feb 25, 2023
82e68f9
removes bountyIsOpen method from DepositManager
FlacoJones Feb 25, 2023
2e6f1c8
removes test in DepositManager that formerly prevented funding after …
FlacoJones Feb 25, 2023
3c75e5d
adds require(isWhitelisted(_tokenAddress), Errors.TOKEN_NOT_ACCEPTED)…
FlacoJones Feb 26, 2023
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
30 changes: 14 additions & 16 deletions .env.contracts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
OPENQ_PROXY_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707
OPENQ_IMPLEMENTATION_ADDRESS=0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9
CLAIM_MANAGER_PROXY_ADDRESS=0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
CLAIM_MANAGER_IMPLEMENTATION_ADDRESS=0xa513E6E4b8f2a923D98304ec87F64353C4D5C853
DEPOSIT_MANAGER_PROXY_ADDRESS=0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e
DEPOSIT_MANAGER_IMPLEMENTATION_ADDRESS=0x610178dA211FEF7D417bC0e6FeD39F05609AD788
OPENQ_BOUNTY_FACTORY_ADDRESS=0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44
ATOMIC_BOUNTY_BEACON_ADDRESS=0x3Aa5ebB10DC797CAC828524e59A333d0A371443c
ONGOING_BOUNTY_BEACON_ADDRESS=0xc6e7DF5E7b4f2A278906862b61205850344D4e7d
TIERED_BOUNTY_BEACON_ADDRESS=0x59b670e9fA9D0A427751Af201D676719a970857b
TIERED_FIXED_BOUNTY_BEACON_ADDRESS=0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1
OPENQ_TOKEN_WHITELIST_ADDRESS=0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82
OPENQ_PROXY_ADDRESS=0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E
OPENQ_IMPLEMENTATION_ADDRESS=0x67d269191c92Caf3cD7723F116c85e6E9bf55933
CLAIM_MANAGER_PROXY_ADDRESS=0x9E545E3C0baAB3E08CdfD552C960A1050f373042
CLAIM_MANAGER_IMPLEMENTATION_ADDRESS=0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB
DEPOSIT_MANAGER_PROXY_ADDRESS=0x851356ae760d987E095750cCeb3bC6014560891C
DEPOSIT_MANAGER_IMPLEMENTATION_ADDRESS=0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8
OPENQ_BOUNTY_FACTORY_ADDRESS=0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf
ATOMIC_BOUNTY_BEACON_ADDRESS=0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf
TIERED_FIXED_BOUNTY_BEACON_ADDRESS=0x0E801D84Fa97b50751Dbf25036d067dCf18858bF
OPENQ_TOKEN_WHITELIST_ADDRESS=0x95401dc811bb5740090279Ba06cfA8fcF6113778
OPENQ_DEPLOY_BLOCK_NUMBER=1
MOCK_LINK_TOKEN_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
MOCK_DAI_TOKEN_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
MOCK_NFT_TOKEN_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
MOCK_DAI_BLACKLISTED_TOKEN_ADDRESS=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
MOCK_LINK_TOKEN_ADDRESS=0x4A679253410272dd5232B3Ff7cF5dbB88f295319
MOCK_DAI_TOKEN_ADDRESS=0x09635F643e140090A9A8Dcd712eD6285858ceBef
MOCK_NFT_TOKEN_ADDRESS=0x7a2088a1bFc9d81c55368AE168C2C02570cB814F
MOCK_DAI_BLACKLISTED_TOKEN_ADDRESS=0xc5a5C42992dECbae36851359345FE25997F5C42d
36 changes: 0 additions & 36 deletions contracts/Bounty/Implementations/AtomicBountyV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ contract AtomicBountyV1 is AtomicBountyStorageV1 {
issuer = _issuer;
organization = _organization;
bountyCreatedTime = block.timestamp;
nftDepositLimit = 5;

(
bool _hasFundingGoal,
Expand Down Expand Up @@ -116,41 +115,6 @@ contract AtomicBountyV1 is AtomicBountyStorageV1 {
closerData = _closerData;
}

/// @notice Receives an NFT for this contract
/// @param _sender Sender of the NFT
/// @param _tokenAddress NFT token address
/// @param _tokenId NFT token id
/// @param _expiration How long before this deposit becomes refundable
/// @return bytes32 the deposit id
function receiveNft(
address _sender,
address _tokenAddress,
uint256 _tokenId,
uint256 _expiration,
bytes calldata
) external onlyDepositManager nonReentrant returns (bytes32) {
require(
nftDeposits.length < nftDepositLimit,
Errors.NFT_DEPOSIT_LIMIT_REACHED
);
require(_expiration > 0, Errors.EXPIRATION_NOT_GREATER_THAN_ZERO);
_receiveNft(_tokenAddress, _sender, _tokenId);

bytes32 depositId = _generateDepositId();

funder[depositId] = _sender;
tokenAddress[depositId] = _tokenAddress;
depositTime[depositId] = block.timestamp;
tokenId[depositId] = _tokenId;
expiration[depositId] = _expiration;
isNFT[depositId] = true;

deposits.push(depositId);
nftDeposits.push(depositId);

return depositId;
}

/// @notice Whether or not invoice has been completed
/// @param _data ABI encoded data
/// @dev see IBountyCore.setInvoiceComplete.(_data) for _data ABI encoding schema
Expand Down
63 changes: 4 additions & 59 deletions contracts/Bounty/Implementations/BountyCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,17 @@ abstract contract BountyCore is BountyStorageCore {
volume[depositId] = volumeReceived;
depositTime[depositId] = block.timestamp;
expiration[depositId] = _expiration;
isNFT[depositId] = false;

deposits.push(depositId);
tokenAddresses.add(_tokenAddress);

return (depositId, volumeReceived);
}

/// @notice Transfers volume of deposit or NFT of deposit from bounty to funder
/// @notice Transfers volume of deposit from bounty to funder
/// @param _depositId The deposit to refund
/// @param _funder The initial funder of the deposit
/// @param _volume The volume to be refunded (only relevant if deposit is not an NFT, otherwise is zero)
/// @param _volume The volume to be refunded
function refundDeposit(
bytes32 _depositId,
address _funder,
Expand All @@ -77,12 +76,6 @@ abstract contract BountyCore is BountyStorageCore {

if (tokenAddress[_depositId] == address(0)) {
_transferProtocolToken(funder[_depositId], _volume);
} else if (isNFT[_depositId]) {
_transferNft(
tokenAddress[_depositId],
funder[_depositId],
tokenId[_depositId]
);
} else {
_transferERC20(
tokenAddress[_depositId],
Expand Down Expand Up @@ -119,22 +112,6 @@ abstract contract BountyCore is BountyStorageCore {
return expiration[_depositId];
}

/// @notice Transfers NFT from bounty address to _payoutAddress
/// @param _payoutAddress The destination address for the NFT
/// @param _depositId The payout address of the bounty
function claimNft(address _payoutAddress, bytes32 _depositId)
external
virtual
onlyClaimManager
nonReentrant
{
_transferNft(
tokenAddress[_depositId],
_payoutAddress,
tokenId[_depositId]
);
}

/// @notice Sets the funding goal
/// @param _fundingToken Token address for funding goal
/// @param _fundingGoal Token volume for funding goal
Expand Down Expand Up @@ -237,32 +214,6 @@ abstract contract BountyCore is BountyStorageCore {
payable(_payoutAddress).sendValue(_volume);
}

/// @notice Receives NFT of _tokenId on _tokenAddress from _funder to bounty address
/// @param _tokenAddress The ERC721 token address
/// @param _sender The sender of the NFT
/// @param _tokenId The tokenId
function _receiveNft(
address _tokenAddress,
address _sender,
uint256 _tokenId
) internal virtual {
IERC721Upgradeable nft = IERC721Upgradeable(_tokenAddress);
nft.safeTransferFrom(_sender, address(this), _tokenId);
}

/// @notice Transfers NFT of _tokenId on _tokenAddress from bounty address to _payoutAddress
/// @param _tokenAddress The ERC721 token address
/// @param _payoutAddress The sender of the NFT
/// @param _tokenId The tokenId
function _transferNft(
address _tokenAddress,
address _payoutAddress,
uint256 _tokenId
) internal virtual {
IERC721Upgradeable nft = IERC721Upgradeable(_tokenAddress);
nft.safeTransferFrom(address(this), _payoutAddress, _tokenId);
}

/// @notice Generates a unique deposit ID from bountyId and the current length of deposits
function _generateDepositId() internal view virtual returns (bytes32) {
return keccak256(abi.encode(bountyId, deposits.length));
Expand Down Expand Up @@ -298,18 +249,12 @@ abstract contract BountyCore is BountyStorageCore {
return token.balanceOf(address(this));
}

/// @notice Returns an array of all deposits (ERC20, protocol token, and NFT) for this bounty
/// @return deposits The array of deposits including ERC20, protocol token, and NFT
/// @notice Returns an array of all deposits for this bounty
/// @return deposits The array of deposits including ERC20 and protocol token
function getDeposits() external view virtual returns (bytes32[] memory) {
return deposits;
}

/// @notice Returns an array of ONLY NFT deposits for this bounty
/// @return nftDeposits The array of NFT deposits
function getNftDeposits() external view virtual returns (bytes32[] memory) {
return nftDeposits;
}

/// @notice Returns an array of all ERC20 token addresses which have funded this bounty
/// @return tokenAddresses An array of all ERC20 token addresses which have funded this bounty
function getTokenAddresses()
Expand Down
Loading