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

Dropper #53

Open
wants to merge 58 commits into
base: main
Choose a base branch
from
Open

Dropper #53

wants to merge 58 commits into from

Conversation

mrk-hub
Copy link
Contributor

@mrk-hub mrk-hub commented Aug 27, 2024

Migration of dropper v0.2.0 from Moonstream
Migration of Terminus from Moonstream
Migration of Diamonds from Moonstream
Creation of Dropper v0.3.0

}
}

contract ERC1155CompatibleClaimProxy is ClaimProxy {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: ClaimProxy is always ERC721 or ERC1155? Is there a scenario in which it needs to be both?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for tests @karacurt .

web3/contracts/drops/dropper-V3/DropperV3Facet.sol Outdated Show resolved Hide resolved
LibDiamond.enforceIsContractOwner();

// Set up server side signing parameters for EIP712
LibSignatures._setEIP712Parameters("Game7 Dropper", "0.3.0");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): Shouldn't those values be received in init as parameters? That way, we can reuse this dropper code with other customers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how the dropper from Moonstream was set. The Naming has no prevention. I see the EIP712Parameters in this case as the stamp of creation. Giving another location in the contract that says the contract is from Game7.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karacurt : I prefer to do it this way - keeps things simple and I have been using versions to key storage migrations on other diamonds so I'd prefer to have a bit more control on these.

We do have users who have made customizations to DropperV2 - they simply wrote their own init function.


DroppableToken memory tokenMetadata;
tokenMetadata.tokenType = tokenType;
tokenMetadata.tokenAddress = tokenAddress;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): Shouldn't we enforce a tokenAddress in case of a native token? maybe address(0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add in a statement requiring it set to address(0)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't matter to me either way. It is a nice user protection, as long as you put a useful error message @mrk-hub .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood

return LibDropper.dropperStorage().DropRequestClaimed[dropId][requestId];
}

function withdrawERC20(address tokenAddress, uint256 amount) public onlyTerminusAdmin {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (non-blocking): Would it be good to add the recipient parameter in case we are withdrawing to another account? I don't know if we will have this use case, but that can be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we do not have the ability for someone else to claim a drop for someone else, or for you to send your drop to someone else. This would need to be discussed with the original devs on this part. I would suggest against it just incase of a frontend hack where the hackers just send everything to a hardcoded address. This happened on quickswap(uniswap clone) on matic a few years ago. The hackers just sent the tokens to be received to their address.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a claim - this is an admin function used to manage funds on the contract. I like @karacurt 's suggestion, but I also don't think it's a high priority.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The easiest way to take funds off of the contract as an admin is to sign a message authorizing yourself to claim those tokens. In that sense, I don't even think the withdraw* functionality is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove all the withdraw functions then?

Comment on lines 19 to 20
//todo: Check if "game7dao.eth" wanted or something else
bytes32 constant DROPPERV3_STORAGE_POSITION = keccak256("game7dao.eth.storage.Dropper");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: Just leaving this comment to help you remember if this needs to be changed before merge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to ask Neeraj if this is what should be here or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did we decide upon?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it was remove the .eth portion will push that change

@@ -0,0 +1,41 @@
// SPDX-License-Identifier: Apache-2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion:
Please double-check in other places to change our licenses to MIT

Suggested change
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I need go through and complete this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Moonstream contracts were Apache-2.0 but we are using MIT for the protocol contracts.


#### `DropperV3Facet-1`: Anybody should be able to deploy a Dropper contract.

Any account should be able to deploy a `DropperV3Facet` contract. The constructor should not revert.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is this gonna be filled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Comment on lines 24 to 44
overrides: {
"contracts/security/terminus/TerminusFacet.sol": {
version: "0.8.24",
settings:{
optimizer: {
enabled: true,
runs: 200
},
},
},
"contracts/drops/dropper-V3/DropperV3Facet.sol" : {
version: "0.8.24",
settings: {
optimizer: {
enabled:true,
runs:200
},
},
},
},
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (blocking): I think we can add an optimizer globally instead for just two files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't recommended for default since optimizing can introduce bugs in seemingly correct code. So our default shouldn't be to optimize contracts. The Terminus Contract and DropperV3Facet need the optimization do to contract size.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really prefer not having the optimizer enabled. Do we need the optimizer for these facets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optimizer is needed for the terminus contract. I can look into the terminus to see if there is any changes I could make.

Copy link
Contributor

@karacurt karacurt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your branch has conflicts. Please remember to rebase it before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants