You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The near_contract_standards crate has a trait FungibleTokenReceiver, that should be implemented here. The signature of the function is slightly wrong, because it should return PromiseOrValue<U128>
For the Donation which is stored in the smart contract, you could use u128 instead of U128 to save on storage deposit, but I certainly understand, that this would involve a migration. For anything that is sent as cross contract data or as result of view function you would still have to use U128, so you have two Donation types. It is common to just convert them via From trait.
@Tarnadas thanks so much for taking the time to review! This is all really useful feedback. It's my first time integrating with FT so I appreciate it very much.
Re. your point You can certainly do the manual deserialization, but why not use serde with Deserialize? It's way more convenient imho. - I'm not sure where specifically you are referring to?
Hey,
plug has been asking for reviews for the donate-ft branch, so I looked into it. Here are my comments:
core/contracts/donation/src/donations.rs
Line 45 in 23b414a
The
near_contract_standards
crate has a traitFungibleTokenReceiver
, that should be implemented here. The signature of the function is slightly wrong, because it should returnPromiseOrValue<U128>
main...feat/donation-ft#diff-e8b8efb3ad30c822332ee8178ce282beed45dfb2789658fe1a34c39c0b613800R51
You can certainly do the manual deserialization, but why not use
serde
withDeserialize
? It's way more convenient imho.main...feat/donation-ft#diff-e8b8efb3ad30c822332ee8178ce282beed45dfb2789658fe1a34c39c0b613800R12
For the
Donation
which is stored in the smart contract, you could use u128 instead of U128 to save on storage deposit, but I certainly understand, that this would involve a migration. For anything that is sent as cross contract data or as result of view function you would still have to use U128, so you have twoDonation
types. It is common to just convert them viaFrom
trait.main...feat/donation-ft#diff-e8b8efb3ad30c822332ee8178ce282beed45dfb2789658fe1a34c39c0b613800R258-R260
You could use an enum instead of three distinct booleans.
main...feat/donation-ft#diff-e8b8efb3ad30c822332ee8178ce282beed45dfb2789658fe1a34c39c0b613800R279
You can use
ext_ft_core
fromnear-contract-standards
.main...feat/donation-ft#diff-6ba773d8f53c9e505b27bac12660cfad87257703fa80c72218643e47bcf75f51R4
Please implement
StorageManagement
fromnear-contract-standards
to be spec compliant with storage staking.https://nomicon.io/Standards/StorageManagement
The text was updated successfully, but these errors were encountered: