diff --git a/README.md b/README.md index 03638ff23..121f73a7d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@
So, in other words, Patron is an all-in-one contracts platform, which allows you to build and verify ink! smart contracts inside of an isolated environment, explore contract verification details. -## Important! ![OpenBrush](https://user-images.githubusercontent.com/88630083/218825486-accc2d8c-bc5c-4b92-a278-a5b9009fd6f5.png) [![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-blue)](https://Brushfam.github.io/openbrush-contracts) @@ -133,10 +132,6 @@ but it must be fixed with this [issue](https://github.com/paritytech/ink/issues/ ### Issues to be resolved before the library becomes production-ready: * [Event's identifiers are based on the naming of the storage structure](https://github.com/Brushfam/openbrush-contracts/issues/2) -## Roadmap 🚗 - -Current OpenBrush Roadmap includes: https://docs.google.com/document/d/1b49juyKJN0W-UBHoJ4iS3P_I0Z5a94YoNLxylIf-As8 - ## Installation & Testing To work with project you need to install ink! toolchain and NodeJS's dependencies. @@ -166,8 +161,7 @@ After you can run tests by `npm run test` command. It will build all contracts r ### Was it audited? -Contracts in this repository have not yet been audited and contain several vulnerabilities due to the specific of the ink!. -Since ink! is audited now, OpenBrush is going to be audited after major breaking changes regarding switching to stable toolchain and adapting to latest ink! will be released. +OpenBrush was audited by OpenZeppelin team. ## License diff --git a/contracts/src/access/access_control/access_control.rs b/contracts/src/access/access_control/access_control.rs index bcff90f42..5f9b40d93 100644 --- a/contracts/src/access/access_control/access_control.rs +++ b/contracts/src/access/access_control/access_control.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ access_control, diff --git a/contracts/src/access/access_control/extensions/enumerable.rs b/contracts/src/access/access_control/extensions/enumerable.rs index 9a1dbe8ca..f02ac5707 100644 --- a/contracts/src/access/access_control/extensions/enumerable.rs +++ b/contracts/src/access/access_control/extensions/enumerable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ access_control, diff --git a/contracts/src/access/access_control/mod.rs b/contracts/src/access/access_control/mod.rs index e61febf78..81b86aae0 100644 --- a/contracts/src/access/access_control/mod.rs +++ b/contracts/src/access/access_control/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod extensions { pub mod enumerable; diff --git a/contracts/src/access/mod.rs b/contracts/src/access/mod.rs index 3fa3ed4f4..dd82eeebc 100644 --- a/contracts/src/access/mod.rs +++ b/contracts/src/access/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[cfg(feature = "access_control")] pub mod access_control; diff --git a/contracts/src/access/ownable/mod.rs b/contracts/src/access/ownable/mod.rs index 6bc7ff646..0ee05cd7b 100644 --- a/contracts/src/access/ownable/mod.rs +++ b/contracts/src/access/ownable/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ ownable, @@ -68,10 +51,13 @@ pub trait OwnableImpl: Storage + Internal { } #[modifiers(only_owner)] - fn transfer_ownership(&mut self, new_owner: AccountId) -> Result<(), OwnableError> { + fn transfer_ownership(&mut self, new_owner: Option) -> Result<(), OwnableError> { let old_owner = self.data().owner.get_or_default(); - self.data().owner.set(&Some(new_owner)); - self._emit_ownership_transferred_event(old_owner, Some(new_owner)); + if new_owner == None { + return Err(OwnableError::NewOwnerIsNotSet) + } + self.data().owner.set(&new_owner); + self._emit_ownership_transferred_event(old_owner, new_owner); Ok(()) } } diff --git a/contracts/src/upgradeability/diamond/diamond.rs b/contracts/src/diamond/diamond.rs similarity index 85% rename from contracts/src/upgradeability/diamond/diamond.rs rename to contracts/src/diamond/diamond.rs index c5a6f4218..a4a82a7ca 100644 --- a/contracts/src/upgradeability/diamond/diamond.rs +++ b/contracts/src/diamond/diamond.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT. // Delegate calls were marked as a possible attack vector in ink! // Therefore the proxy and diamond contracts will be disabled within OpenBrush until this is reimplemented in ink! 4. diff --git a/contracts/src/upgradeability/diamond/extensions/diamond_loupe.rs b/contracts/src/diamond/extensions/diamond_loupe.rs similarity index 73% rename from contracts/src/upgradeability/diamond/extensions/diamond_loupe.rs rename to contracts/src/diamond/extensions/diamond_loupe.rs index 622397d3f..d7474444b 100644 --- a/contracts/src/upgradeability/diamond/extensions/diamond_loupe.rs +++ b/contracts/src/diamond/extensions/diamond_loupe.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ diamond, diff --git a/contracts/src/diamond/mod.rs b/contracts/src/diamond/mod.rs new file mode 100644 index 000000000..a609018a0 --- /dev/null +++ b/contracts/src/diamond/mod.rs @@ -0,0 +1,10 @@ +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT + +pub mod diamond; + +pub use diamond::*; +pub mod extensions { + pub mod diamond_loupe; +} diff --git a/contracts/src/finance/mod.rs b/contracts/src/finance/mod.rs index 93ad23e27..d554778e6 100644 --- a/contracts/src/finance/mod.rs +++ b/contracts/src/finance/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[cfg(feature = "payment_splitter")] pub mod payment_splitter; diff --git a/contracts/src/finance/payment_splitter/mod.rs b/contracts/src/finance/payment_splitter/mod.rs index 24e22288d..0aa9ef67d 100644 --- a/contracts/src/finance/payment_splitter/mod.rs +++ b/contracts/src/finance/payment_splitter/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ payment_splitter, @@ -56,6 +39,10 @@ pub trait PaymentSplitterImpl: Storage + Internal { self.data().total_released.get_or_default() } + fn releasable(&self, account: AccountId) -> Balance { + self._releasable(account) + } + fn shares(&self, account: AccountId) -> Balance { self.data().shares.get(&account).unwrap_or(0) } @@ -69,7 +56,7 @@ pub trait PaymentSplitterImpl: Storage + Internal { } fn receive(&mut self) { - self._emit_payee_added_event(Self::env().caller(), Self::env().transferred_value()) + self._emit_payment_received_event(Self::env().caller(), Self::env().transferred_value()) } fn release(&mut self, account: AccountId) -> Result<(), PaymentSplitterError> { @@ -88,7 +75,7 @@ pub trait Internal { /// Inits an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at /// the matching position in the `shares` array. /// - /// All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no + /// All addresses in `payees` must be set. Both arrays must have the same non-zero length, and there must be no /// duplicates in `payees`. /// /// Emits `PayeeAdded` on each account. @@ -96,8 +83,7 @@ pub trait Internal { fn _add_payee(&mut self, payee: AccountId, share: Balance) -> Result<(), PaymentSplitterError>; - /// Calls the `release` method for each `AccountId` in the `payees` vec. - fn _release_all(&mut self) -> Result<(), PaymentSplitterError>; + fn _releasable(&self, account: AccountId) -> Balance; fn _release(&mut self, account: AccountId) -> Result<(), PaymentSplitterError>; } @@ -141,15 +127,18 @@ pub trait InternalImpl: Storage + Internal { Ok(()) } - fn _release_all(&mut self) -> Result<(), PaymentSplitterError> { - let payees = self.data().payees.get_or_default(); - let len = payees.len(); + fn _releasable(&self, account: AccountId) -> Balance { + let total_received = Self::env() + .balance() + .checked_sub(Self::env().minimum_balance()) + .unwrap_or_default(); + let total_shares = self.data().total_shares.get_or_default(); + let released = self.data().released.get(&account).unwrap_or_default(); + let shares = self.data().shares.get(&account).unwrap_or_default(); - for account in payees.iter().take(len) { - Internal::_release(self, *account)?; - } + let payment = total_received * shares / total_shares - released; - Ok(()) + payment } fn _release(&mut self, account: AccountId) -> Result<(), PaymentSplitterError> { diff --git a/contracts/src/governance/extensions/governor_counting/data.rs b/contracts/src/governance/extensions/governor_counting/data.rs index cc9508991..d957fb81a 100644 --- a/contracts/src/governance/extensions/governor_counting/data.rs +++ b/contracts/src/governance/extensions/governor_counting/data.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::governance::{ ProposalId, diff --git a/contracts/src/governance/extensions/governor_counting/impls.rs b/contracts/src/governance/extensions/governor_counting/impls.rs index 582f0c4cc..ff494f745 100644 --- a/contracts/src/governance/extensions/governor_counting/impls.rs +++ b/contracts/src/governance/extensions/governor_counting/impls.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::governance::extensions::governor_counting::{ CountingInternal, diff --git a/contracts/src/governance/extensions/governor_counting/internal.rs b/contracts/src/governance/extensions/governor_counting/internal.rs index b8530e74c..9645587af 100644 --- a/contracts/src/governance/extensions/governor_counting/internal.rs +++ b/contracts/src/governance/extensions/governor_counting/internal.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::{ governance::{ diff --git a/contracts/src/governance/extensions/governor_counting/mod.rs b/contracts/src/governance/extensions/governor_counting/mod.rs index 63dc3df7f..0cece8f73 100644 --- a/contracts/src/governance/extensions/governor_counting/mod.rs +++ b/contracts/src/governance/extensions/governor_counting/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT mod data; mod impls; diff --git a/contracts/src/governance/extensions/governor_quorum/data.rs b/contracts/src/governance/extensions/governor_quorum/data.rs index 32e983b0b..e47b198a0 100644 --- a/contracts/src/governance/extensions/governor_quorum/data.rs +++ b/contracts/src/governance/extensions/governor_quorum/data.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use openbrush::utils::checkpoints::Checkpoints; diff --git a/contracts/src/governance/extensions/governor_quorum/events.rs b/contracts/src/governance/extensions/governor_quorum/events.rs index 74e2d23f7..cfb1243b5 100644 --- a/contracts/src/governance/extensions/governor_quorum/events.rs +++ b/contracts/src/governance/extensions/governor_quorum/events.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub trait QuorumEvents { /// Emitted when the quorum denominator is updated diff --git a/contracts/src/governance/extensions/governor_quorum/impls.rs b/contracts/src/governance/extensions/governor_quorum/impls.rs index 0e39191b0..084f43c93 100644 --- a/contracts/src/governance/extensions/governor_quorum/impls.rs +++ b/contracts/src/governance/extensions/governor_quorum/impls.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ governance::extensions::governor_quorum, diff --git a/contracts/src/governance/extensions/governor_quorum/mod.rs b/contracts/src/governance/extensions/governor_quorum/mod.rs index 1eb9eeb5b..7a99b09a2 100644 --- a/contracts/src/governance/extensions/governor_quorum/mod.rs +++ b/contracts/src/governance/extensions/governor_quorum/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT mod data; mod events; diff --git a/contracts/src/governance/extensions/governor_settings/data.rs b/contracts/src/governance/extensions/governor_settings/data.rs index 603840298..bae8ec188 100644 --- a/contracts/src/governance/extensions/governor_settings/data.rs +++ b/contracts/src/governance/extensions/governor_settings/data.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[derive(Default, Debug)] #[openbrush::storage_item] diff --git a/contracts/src/governance/extensions/governor_settings/events.rs b/contracts/src/governance/extensions/governor_settings/events.rs index a7452a4ef..ac0095cb9 100644 --- a/contracts/src/governance/extensions/governor_settings/events.rs +++ b/contracts/src/governance/extensions/governor_settings/events.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub trait GovernorSettingsEvents { /// Emits this event when the voting delay is set diff --git a/contracts/src/governance/extensions/governor_settings/impls.rs b/contracts/src/governance/extensions/governor_settings/impls.rs index b66e3a4f9..3572c57f8 100644 --- a/contracts/src/governance/extensions/governor_settings/impls.rs +++ b/contracts/src/governance/extensions/governor_settings/impls.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::governance::{ extensions::governor_settings::{ diff --git a/contracts/src/governance/extensions/governor_settings/internal.rs b/contracts/src/governance/extensions/governor_settings/internal.rs index 3b7c29af4..c4d773d47 100644 --- a/contracts/src/governance/extensions/governor_settings/internal.rs +++ b/contracts/src/governance/extensions/governor_settings/internal.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::{ governance::extensions::governor_settings::{ diff --git a/contracts/src/governance/extensions/governor_settings/mod.rs b/contracts/src/governance/extensions/governor_settings/mod.rs index e276383ef..8de621d1f 100644 --- a/contracts/src/governance/extensions/governor_settings/mod.rs +++ b/contracts/src/governance/extensions/governor_settings/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT mod data; mod events; diff --git a/contracts/src/governance/extensions/governor_votes/data.rs b/contracts/src/governance/extensions/governor_votes/data.rs index 1ac209e9c..1285dd3c4 100644 --- a/contracts/src/governance/extensions/governor_votes/data.rs +++ b/contracts/src/governance/extensions/governor_votes/data.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use openbrush::traits::AccountId; diff --git a/contracts/src/governance/extensions/governor_votes/internal.rs b/contracts/src/governance/extensions/governor_votes/internal.rs index 28e8cafa8..13d7373ab 100644 --- a/contracts/src/governance/extensions/governor_votes/internal.rs +++ b/contracts/src/governance/extensions/governor_votes/internal.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ governance::extensions::governor_votes, diff --git a/contracts/src/governance/extensions/governor_votes/mod.rs b/contracts/src/governance/extensions/governor_votes/mod.rs index 5a282d8b3..8335b8fdf 100644 --- a/contracts/src/governance/extensions/governor_votes/mod.rs +++ b/contracts/src/governance/extensions/governor_votes/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT mod data; mod internal; diff --git a/contracts/src/governance/extensions/mod.rs b/contracts/src/governance/extensions/mod.rs index e86f84fd5..ee8fc73dd 100644 --- a/contracts/src/governance/extensions/mod.rs +++ b/contracts/src/governance/extensions/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod governor_counting; pub mod governor_quorum; diff --git a/contracts/src/governance/extensions/timelock_controller/mod.rs b/contracts/src/governance/extensions/timelock_controller/mod.rs index 69c23f3a7..0efb746df 100644 --- a/contracts/src/governance/extensions/timelock_controller/mod.rs +++ b/contracts/src/governance/extensions/timelock_controller/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ access_control, @@ -77,8 +60,8 @@ pub struct Data { } /// Modifier to make a function callable only by a certain role. In -/// addition to checking the sender's role, zero account's role is also -/// considered. Granting a role to zero account is equivalent to enabling +/// addition to checking the sender's role, if account is set to None, then role is also +/// considered. Granting a role to None is equivalent to enabling /// this role for everyone. #[modifier_definition] pub fn only_role_or_open_role(instance: &mut T, body: F, role: RoleType) -> Result @@ -445,8 +428,9 @@ pub trait InternalImpl: Internal + Storage + access_control::Internal { result?.unwrap(); Internal::_emit_call_executed_event(self, id, i, transaction); return Ok(()) + } else { + Err(TimelockControllerError::CalleeIsNotSet) } - Err(TimelockControllerError::CalleeMustExist) } fn _timelock_admin_role() -> RoleType { diff --git a/contracts/src/governance/governor/data.rs b/contracts/src/governance/governor/data.rs index 8bdebaf4b..c626b5894 100644 --- a/contracts/src/governance/governor/data.rs +++ b/contracts/src/governance/governor/data.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::{ errors::GovernanceError, diff --git a/contracts/src/governance/governor/events.rs b/contracts/src/governance/governor/events.rs index 2cc3fdf6f..ba2c1a975 100644 --- a/contracts/src/governance/governor/events.rs +++ b/contracts/src/governance/governor/events.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::governance::{ ProposalId, diff --git a/contracts/src/governance/governor/impls.rs b/contracts/src/governance/governor/impls.rs index 543392c51..136bcb28a 100644 --- a/contracts/src/governance/governor/impls.rs +++ b/contracts/src/governance/governor/impls.rs @@ -1,24 +1,7 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT + use crate::governance::{ extensions::{ governor_settings::{ diff --git a/contracts/src/governance/governor/internal.rs b/contracts/src/governance/governor/internal.rs index 667e8cd27..463bf2792 100644 --- a/contracts/src/governance/governor/internal.rs +++ b/contracts/src/governance/governor/internal.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::{ governance::{ diff --git a/contracts/src/governance/governor/mod.rs b/contracts/src/governance/governor/mod.rs index e276383ef..8de621d1f 100644 --- a/contracts/src/governance/governor/mod.rs +++ b/contracts/src/governance/governor/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT mod data; mod events; diff --git a/contracts/src/governance/mod.rs b/contracts/src/governance/mod.rs index 6df748c2c..906037210 100644 --- a/contracts/src/governance/mod.rs +++ b/contracts/src/governance/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[cfg(feature = "timelock_controller")] pub use extensions::timelock_controller; diff --git a/contracts/src/governance/utils/mod.rs b/contracts/src/governance/utils/mod.rs index fda658561..508c9e187 100644 --- a/contracts/src/governance/utils/mod.rs +++ b/contracts/src/governance/utils/mod.rs @@ -1,23 +1,5 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod votes; diff --git a/contracts/src/lib.rs b/contracts/src/lib.rs index 3ea097f9b..7e89416e5 100644 --- a/contracts/src/lib.rs +++ b/contracts/src/lib.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #![cfg_attr(not(feature = "std"), no_std, no_main)] @@ -32,6 +14,9 @@ pub mod utils; pub mod traits; +#[cfg(feature = "diamond")] +pub mod diamond; + // Modules with implementation of traits above #[cfg(feature = "access_control")] pub use access::access_control; @@ -55,8 +40,6 @@ pub use token::psp22_pallet; pub use token::psp34; #[cfg(feature = "psp37")] pub use token::psp37; -#[cfg(feature = "diamond")] -pub use upgradeability::diamond; #[cfg(feature = "proxy")] pub use upgradeability::proxy; #[cfg(feature = "upgradeable")] diff --git a/contracts/src/security/mod.rs b/contracts/src/security/mod.rs index 85b517995..2f1e020a4 100644 --- a/contracts/src/security/mod.rs +++ b/contracts/src/security/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[cfg(feature = "pausable")] pub mod pausable; diff --git a/contracts/src/security/pausable/mod.rs b/contracts/src/security/pausable/mod.rs index c1814f5d6..21b297092 100644 --- a/contracts/src/security/pausable/mod.rs +++ b/contracts/src/security/pausable/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ pausable, diff --git a/contracts/src/security/reentrancy_guard/mod.rs b/contracts/src/security/reentrancy_guard/mod.rs index fc4971606..374f5a629 100644 --- a/contracts/src/security/reentrancy_guard/mod.rs +++ b/contracts/src/security/reentrancy_guard/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ reentrancy_guard, @@ -33,19 +16,16 @@ use openbrush::{ #[openbrush::storage_item] pub struct Data { #[lazy] - pub status: u8, + pub status: bool, } -const NOT_ENTERED: u8 = 0; -const ENTERED: u8 = 1; - /// Prevents a contract from calling itself, directly or indirectly. /// Calling a `non_reentrant` function from another `non_reentrant` /// function is not supported. It is possible to prevent this from happening /// by making the `non_reentrant` function external, and make it call a /// `private` function that does the actual work. /// -/// This modifier flushes the struct into storage with `ENTERED` +/// This modifier flushes the struct into storage with `true` /// status before calling the original method. #[modifier_definition] pub fn non_reentrant(instance: &mut T, body: F) -> Result @@ -54,14 +34,15 @@ where F: FnOnce(&mut T) -> Result, E: From, { - if instance.data().status.get_or_default() == ENTERED { + if instance.data().status.get_or_default() { return Err(From::from(ReentrancyGuardError::ReentrantCall)) } // Any calls to nonReentrant after this point will fail - instance.data().status.set(&ENTERED); + instance.data().status.set(&true); let result = body(instance); - instance.data().status.set(&NOT_ENTERED); + + instance.data().status.set(&false); result } diff --git a/contracts/src/token/mod.rs b/contracts/src/token/mod.rs index e9f31355c..b46348bb2 100644 --- a/contracts/src/token/mod.rs +++ b/contracts/src/token/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[cfg(feature = "psp22")] pub mod psp22; diff --git a/contracts/src/token/psp22/extensions/burnable.rs b/contracts/src/token/psp22/extensions/burnable.rs index b008d2cee..7b97f28a8 100644 --- a/contracts/src/token/psp22/extensions/burnable.rs +++ b/contracts/src/token/psp22/extensions/burnable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22, diff --git a/contracts/src/token/psp22/extensions/capped.rs b/contracts/src/token/psp22/extensions/capped.rs index c2fe12390..384b0dba9 100644 --- a/contracts/src/token/psp22/extensions/capped.rs +++ b/contracts/src/token/psp22/extensions/capped.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22, @@ -29,6 +12,7 @@ pub use crate::{ }; pub use capped::Internal as _; use openbrush::traits::{ + AccountId, Balance, Storage, String, @@ -81,3 +65,27 @@ pub trait InternalImpl: Storage + Internal + PSP22 { self.data().cap.get_or_default() } } + +pub trait PSP22TransferImpl: Internal { + fn _before_token_transfer( + &mut self, + _from: Option<&AccountId>, + _to: Option<&AccountId>, + _amount: &Balance, + ) -> Result<(), PSP22Error> { + if _from.is_none() && _to.is_some() && Internal::_is_cap_exceeded(self, _amount) { + return Err(PSP22Error::Custom(String::from("Cap exceeded"))) + } + + Ok(()) + } + + fn _after_token_transfer( + &mut self, + _from: Option<&AccountId>, + _to: Option<&AccountId>, + _amount: &Balance, + ) -> Result<(), PSP22Error> { + Ok(()) + } +} diff --git a/contracts/src/token/psp22/extensions/flashmint.rs b/contracts/src/token/psp22/extensions/flashmint.rs index 00305bca2..d723a4b92 100644 --- a/contracts/src/token/psp22/extensions/flashmint.rs +++ b/contracts/src/token/psp22/extensions/flashmint.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22, @@ -30,7 +13,10 @@ pub use crate::{ pub use flashmint::Internal as _; use ink::{ env::CallFlags, - prelude::vec::Vec, + prelude::{ + vec, + vec::Vec, + }, }; use openbrush::traits::{ AccountId, @@ -47,7 +33,7 @@ pub use psp22::{ pub trait FlashLenderImpl: Storage + psp22::Internal + PSP22 + Internal { fn max_flashloan(&mut self, token: AccountId) -> Balance { if token == Self::env().account_id() { - Balance::MAX - self.total_supply() + psp22::Internal::_max_supply(self) - self.total_supply() } else { 0 } @@ -76,7 +62,16 @@ pub trait FlashLenderImpl: Storage + psp22::Internal + PSP22 + Inte return Err(FlashLenderError::AllowanceDoesNotAllowRefund) } psp22::Internal::_approve_from_to(self, receiver_account, this, current_allowance - amount - fee)?; - psp22::Internal::_burn_from(self, receiver_account, amount + fee)?; + + let flash_fee_receiver = self._flash_fee_receiver(); + + if fee == 0 || flash_fee_receiver.is_none() { + psp22::Internal::_burn_from(self, receiver_account, amount + fee)?; + } else { + psp22::Internal::_burn_from(self, receiver_account, amount)?; + psp22::Internal::_transfer_from_to(self, receiver_account, flash_fee_receiver.unwrap(), fee, vec![])?; + } + Ok(()) } } @@ -92,6 +87,8 @@ pub trait Internal { amount: Balance, data: Vec, ) -> Result<(), FlashLenderError>; + + fn _flash_fee_receiver(&self) -> Option; } pub trait InternalImpl: Storage + Internal { @@ -128,4 +125,8 @@ pub trait InternalImpl: Storage + Internal { result } + + fn _flash_fee_receiver(&self) -> Option { + None + } } diff --git a/contracts/src/token/psp22/extensions/metadata.rs b/contracts/src/token/psp22/extensions/metadata.rs index 381b70b38..edb8000d5 100644 --- a/contracts/src/token/psp22/extensions/metadata.rs +++ b/contracts/src/token/psp22/extensions/metadata.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22, diff --git a/contracts/src/token/psp22/extensions/mintable.rs b/contracts/src/token/psp22/extensions/mintable.rs index b78be3825..94e0752fc 100644 --- a/contracts/src/token/psp22/extensions/mintable.rs +++ b/contracts/src/token/psp22/extensions/mintable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22, diff --git a/contracts/src/token/psp22/extensions/permit.rs b/contracts/src/token/psp22/extensions/permit.rs index 5be379028..7fd4fba4e 100644 --- a/contracts/src/token/psp22/extensions/permit.rs +++ b/contracts/src/token/psp22/extensions/permit.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ nonces::*, diff --git a/contracts/src/token/psp22/extensions/wrapper.rs b/contracts/src/token/psp22/extensions/wrapper.rs index 0de566775..7d05dbc94 100644 --- a/contracts/src/token/psp22/extensions/wrapper.rs +++ b/contracts/src/token/psp22/extensions/wrapper.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22, @@ -53,11 +36,19 @@ pub struct Data { pub trait PSP22WrapperImpl: Storage + Internal + psp22::Internal { fn deposit_for(&mut self, account: AccountId, amount: Balance) -> Result<(), PSP22Error> { + if Some(account) == self.data().underlying.get_or_default() { + return Err(PSP22Error::Custom(String::from("Cannot deposit to underlying"))) + } + self._deposit(amount)?; psp22::Internal::_mint_to(self, account, amount) } fn withdraw_to(&mut self, account: AccountId, amount: Balance) -> Result<(), PSP22Error> { + if Some(account) == self.data().underlying.get_or_default() { + return Err(PSP22Error::Custom(String::from("Cannot withdraw to underlying"))) + } + psp22::Internal::_burn_from(self, Self::env().caller(), amount)?; self._withdraw(account, amount) } diff --git a/contracts/src/token/psp22/mod.rs b/contracts/src/token/psp22/mod.rs index 2a4722726..5fa3581aa 100644 --- a/contracts/src/token/psp22/mod.rs +++ b/contracts/src/token/psp22/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod psp22; diff --git a/contracts/src/token/psp22/psp22.rs b/contracts/src/token/psp22/psp22.rs index 55fdcea4a..08316858c 100644 --- a/contracts/src/token/psp22/psp22.rs +++ b/contracts/src/token/psp22/psp22.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22, @@ -94,12 +77,6 @@ pub trait PSP22Impl: Storage + Internal { Ok(()) } - fn approve(&mut self, spender: AccountId, value: Balance) -> Result<(), PSP22Error> { - let owner = Self::env().caller(); - self._approve_from_to(owner, spender, value)?; - Ok(()) - } - fn increase_allowance(&mut self, spender: AccountId, delta_value: Balance) -> Result<(), PSP22Error> { let owner = Self::env().caller(); self._approve_from_to(owner, spender, self._allowance(&owner, &spender) + delta_value) @@ -125,6 +102,8 @@ pub trait Internal { fn _total_supply(&self) -> Balance; + fn _max_supply(&self) -> Balance; + fn _balance_of(&self, owner: &AccountId) -> Balance; fn _allowance(&self, owner: &AccountId, spender: &AccountId) -> Balance; @@ -142,23 +121,9 @@ pub trait Internal { fn _mint_to(&mut self, account: AccountId, amount: Balance) -> Result<(), PSP22Error>; fn _burn_from(&mut self, account: AccountId, amount: Balance) -> Result<(), PSP22Error>; - - fn _before_token_transfer( - &mut self, - _from: Option<&AccountId>, - _to: Option<&AccountId>, - _amount: &Balance, - ) -> Result<(), PSP22Error>; - - fn _after_token_transfer( - &mut self, - _from: Option<&AccountId>, - _to: Option<&AccountId>, - _amount: &Balance, - ) -> Result<(), PSP22Error>; } -pub trait InternalImpl: Storage + Internal { +pub trait InternalImpl: Storage + Internal + PSP22Transfer { fn _emit_transfer_event(&self, _from: Option, _to: Option, _amount: Balance) {} fn _emit_approval_event(&self, _owner: AccountId, _spender: AccountId, _amount: Balance) {} @@ -167,6 +132,10 @@ pub trait InternalImpl: Storage + Internal { self.data().supply.get_or_default() } + fn _max_supply(&self) -> Balance { + Balance::MAX + } + fn _balance_of(&self, owner: &AccountId) -> Balance { self.data().balances.get(owner).unwrap_or(0) } @@ -188,14 +157,14 @@ pub trait InternalImpl: Storage + Internal { return Err(PSP22Error::InsufficientBalance) } - Internal::_before_token_transfer(self, Some(&from), Some(&to), &amount)?; + PSP22Transfer::_before_token_transfer(self, Some(&from), Some(&to), &amount)?; self.data().balances.insert(&from, &(from_balance - amount)); let to_balance = Internal::_balance_of(self, &to); self.data().balances.insert(&to, &(to_balance + amount)); - Internal::_after_token_transfer(self, Some(&from), Some(&to), &amount)?; + PSP22Transfer::_after_token_transfer(self, Some(&from), Some(&to), &amount)?; Internal::_emit_transfer_event(self, Some(from), Some(to), amount); Ok(()) @@ -208,7 +177,7 @@ pub trait InternalImpl: Storage + Internal { } fn _mint_to(&mut self, account: AccountId, amount: Balance) -> Result<(), PSP22Error> { - Internal::_before_token_transfer(self, None, Some(&account), &amount)?; + PSP22Transfer::_before_token_transfer(self, None, Some(&account), &amount)?; let mut new_balance = Internal::_balance_of(self, &account); new_balance += amount; self.data().balances.insert(&account, &new_balance); @@ -216,7 +185,7 @@ pub trait InternalImpl: Storage + Internal { let new_supply = self.data().supply.get_or_default() + amount; self.data().supply.set(&new_supply); - Internal::_after_token_transfer(self, None, Some(&account), &amount)?; + PSP22Transfer::_after_token_transfer(self, None, Some(&account), &amount)?; Internal::_emit_transfer_event(self, None, Some(account), amount); Ok(()) @@ -229,7 +198,7 @@ pub trait InternalImpl: Storage + Internal { return Err(PSP22Error::InsufficientBalance) } - Internal::_before_token_transfer(self, Some(&account), None, &amount)?; + PSP22Transfer::_before_token_transfer(self, Some(&account), None, &amount)?; from_balance -= amount; self.data().balances.insert(&account, &from_balance); @@ -237,12 +206,30 @@ pub trait InternalImpl: Storage + Internal { let new_supply = self.data().supply.get_or_default() - amount; self.data().supply.set(&new_supply); - Internal::_after_token_transfer(self, Some(&account), None, &amount)?; + PSP22Transfer::_after_token_transfer(self, Some(&account), None, &amount)?; Internal::_emit_transfer_event(self, Some(account), None, amount); Ok(()) } +} + +pub trait PSP22Transfer { + fn _before_token_transfer( + &mut self, + _from: Option<&AccountId>, + _to: Option<&AccountId>, + _amount: &Balance, + ) -> Result<(), PSP22Error>; + + fn _after_token_transfer( + &mut self, + _from: Option<&AccountId>, + _to: Option<&AccountId>, + _amount: &Balance, + ) -> Result<(), PSP22Error>; +} +pub trait PSP22TransferImpl { fn _before_token_transfer( &mut self, _from: Option<&AccountId>, diff --git a/contracts/src/token/psp22/utils/token_timelock.rs b/contracts/src/token/psp22/utils/token_timelock.rs index e6c72d8c0..38983d245 100644 --- a/contracts/src/token/psp22/utils/token_timelock.rs +++ b/contracts/src/token/psp22/utils/token_timelock.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP22`] which allows the beneficiary to extract tokens after given time pub use crate::{ @@ -120,10 +103,10 @@ pub trait InternalImpl: Storage + Internal { .unwrap()?; Ok(()) } else { - Err(PSP22TokenTimelockError::TokenZeroAddress) + Err(PSP22TokenTimelockError::TokenIsNotSet) } } else { - Err(PSP22TokenTimelockError::BeneficiaryZeroAddress) + Err(PSP22TokenTimelockError::BeneficiaryIsNotSet) } } diff --git a/contracts/src/token/psp22_pallet/extensions/burnable.rs b/contracts/src/token/psp22_pallet/extensions/burnable.rs index 53e0e3cfe..559520023 100644 --- a/contracts/src/token/psp22_pallet/extensions/burnable.rs +++ b/contracts/src/token/psp22_pallet/extensions/burnable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22_pallet, diff --git a/contracts/src/token/psp22_pallet/extensions/metadata.rs b/contracts/src/token/psp22_pallet/extensions/metadata.rs index db5b23647..69fb82874 100644 --- a/contracts/src/token/psp22_pallet/extensions/metadata.rs +++ b/contracts/src/token/psp22_pallet/extensions/metadata.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22_pallet, @@ -28,6 +11,7 @@ pub use crate::{ }, }; pub use ink::env::DefaultEnvironment; +use ink::prelude::vec::*; use openbrush::traits::Storage; pub use openbrush::traits::String; pub use pallet_assets_chain_extension::traits::{ @@ -41,13 +25,9 @@ pub use psp22_pallet::{ PSP22PalletImpl, }; -pub trait PSP22PalletMetadataImpl: Storage { +pub trait PSP22PalletMetadataImpl: PSP22PalletMetadataInternal { fn token_name(&self) -> Option { - let self_ = self.data(); - let name = self_ - .pallet_assets - .get_or_default() - .metadata_name(self_.asset_id.get_or_default()); + let name = self._name(); if name.is_empty() { None @@ -57,11 +37,7 @@ pub trait PSP22PalletMetadataImpl: Storage { } fn token_symbol(&self) -> Option { - let self_ = self.data(); - let symbol = self_ - .pallet_assets - .get_or_default() - .metadata_symbol(self_.asset_id.get_or_default()); + let symbol = self._symbol(); if symbol.is_empty() { None @@ -71,10 +47,29 @@ pub trait PSP22PalletMetadataImpl: Storage { } fn token_decimals(&self) -> u8 { - let self_ = self.data(); - self_ + self._decimals() + } +} + +pub trait PSP22PalletMetadataInternal: Storage { + fn _name(&self) -> Vec { + self.data() + .pallet_assets + .get_or_default() + .metadata_name(self.data().asset_id.get_or_default()) + } + + fn _symbol(&self) -> Vec { + self.data() + .pallet_assets + .get_or_default() + .metadata_symbol(self.data().asset_id.get_or_default()) + } + + fn _decimals(&self) -> u8 { + self.data() .pallet_assets .get_or_default() - .metadata_decimals(self_.asset_id.get_or_default()) + .metadata_decimals(self.data().asset_id.get_or_default()) } } diff --git a/contracts/src/token/psp22_pallet/extensions/mintable.rs b/contracts/src/token/psp22_pallet/extensions/mintable.rs index 8bfa3caba..252f4ac6e 100644 --- a/contracts/src/token/psp22_pallet/extensions/mintable.rs +++ b/contracts/src/token/psp22_pallet/extensions/mintable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22_pallet, diff --git a/contracts/src/token/psp22_pallet/mod.rs b/contracts/src/token/psp22_pallet/mod.rs index e103e886a..6441bb8f7 100644 --- a/contracts/src/token/psp22_pallet/mod.rs +++ b/contracts/src/token/psp22_pallet/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod psp22_pallet; diff --git a/contracts/src/token/psp22_pallet/psp22_pallet.rs b/contracts/src/token/psp22_pallet/psp22_pallet.rs index ab4428d48..10c98aee6 100644 --- a/contracts/src/token/psp22_pallet/psp22_pallet.rs +++ b/contracts/src/token/psp22_pallet/psp22_pallet.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp22_pallet, diff --git a/contracts/src/token/psp34/extensions/burnable.rs b/contracts/src/token/psp34/extensions/burnable.rs index 8df63c134..31187012e 100644 --- a/contracts/src/token/psp34/extensions/burnable.rs +++ b/contracts/src/token/psp34/extensions/burnable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp34, diff --git a/contracts/src/token/psp34/extensions/enumerable.rs b/contracts/src/token/psp34/extensions/enumerable.rs index 51f6986b3..7ca13d831 100644 --- a/contracts/src/token/psp34/extensions/enumerable.rs +++ b/contracts/src/token/psp34/extensions/enumerable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::psp34::ApprovalsKey; pub use crate::{ diff --git a/contracts/src/token/psp34/extensions/metadata.rs b/contracts/src/token/psp34/extensions/metadata.rs index 1536f1e7b..ce0d562a5 100644 --- a/contracts/src/token/psp34/extensions/metadata.rs +++ b/contracts/src/token/psp34/extensions/metadata.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp34, diff --git a/contracts/src/token/psp34/extensions/mintable.rs b/contracts/src/token/psp34/extensions/mintable.rs index e82855042..6589e70cb 100644 --- a/contracts/src/token/psp34/extensions/mintable.rs +++ b/contracts/src/token/psp34/extensions/mintable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp34, diff --git a/contracts/src/token/psp34/mod.rs b/contracts/src/token/psp34/mod.rs index 20ef7c6c2..daaf03ba8 100755 --- a/contracts/src/token/psp34/mod.rs +++ b/contracts/src/token/psp34/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use openbrush::traits::AccountId; diff --git a/contracts/src/token/psp34/psp34.rs b/contracts/src/token/psp34/psp34.rs index 43e1ccfb9..d264fe720 100644 --- a/contracts/src/token/psp34/psp34.rs +++ b/contracts/src/token/psp34/psp34.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp34, diff --git a/contracts/src/token/psp37/extensions/batch.rs b/contracts/src/token/psp37/extensions/batch.rs index 0a23be93e..08ca67066 100644 --- a/contracts/src/token/psp37/extensions/batch.rs +++ b/contracts/src/token/psp37/extensions/batch.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp37, diff --git a/contracts/src/token/psp37/extensions/burnable.rs b/contracts/src/token/psp37/extensions/burnable.rs index 31a7a0f15..45734d847 100644 --- a/contracts/src/token/psp37/extensions/burnable.rs +++ b/contracts/src/token/psp37/extensions/burnable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp37, diff --git a/contracts/src/token/psp37/extensions/enumerable.rs b/contracts/src/token/psp37/extensions/enumerable.rs index fe8eda17c..b3bae3097 100644 --- a/contracts/src/token/psp37/extensions/enumerable.rs +++ b/contracts/src/token/psp37/extensions/enumerable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::psp37::{ ApprovalsKey, diff --git a/contracts/src/token/psp37/extensions/metadata.rs b/contracts/src/token/psp37/extensions/metadata.rs index 8604b4db5..36d03f7c2 100644 --- a/contracts/src/token/psp37/extensions/metadata.rs +++ b/contracts/src/token/psp37/extensions/metadata.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp37, diff --git a/contracts/src/token/psp37/extensions/mintable.rs b/contracts/src/token/psp37/extensions/mintable.rs index 5d93c8598..e8c95c914 100644 --- a/contracts/src/token/psp37/extensions/mintable.rs +++ b/contracts/src/token/psp37/extensions/mintable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp37, diff --git a/contracts/src/token/psp37/mod.rs b/contracts/src/token/psp37/mod.rs index ab036aa94..46ab7797a 100644 --- a/contracts/src/token/psp37/mod.rs +++ b/contracts/src/token/psp37/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod psp37; diff --git a/contracts/src/token/psp37/psp37.rs b/contracts/src/token/psp37/psp37.rs index c729537da..a33e6150b 100644 --- a/contracts/src/token/psp37/psp37.rs +++ b/contracts/src/token/psp37/psp37.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp37, @@ -128,7 +111,7 @@ pub trait Internal { /// /// # Errors /// - /// Returns with `TransferToZeroAddress` error if `to` is zero account. + /// Returns with `TransferToNonSetAddress` error if `to` is non set address. fn _mint_to(&mut self, to: AccountId, ids_amounts: Vec<(Id, Balance)>) -> Result<(), PSP37Error>; /// Destroys `amount` tokens of token type `id` from `from`. diff --git a/contracts/src/traits/access_control/access_control.rs b/contracts/src/traits/access_control/access_control.rs index dd26cd7f2..55ae7f2fe 100644 --- a/contracts/src/traits/access_control/access_control.rs +++ b/contracts/src/traits/access_control/access_control.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::AccessControlError; use openbrush::traits::AccountId; diff --git a/contracts/src/traits/access_control/extensions/enumerable.rs b/contracts/src/traits/access_control/extensions/enumerable.rs index ebbe66771..a354c42bf 100644 --- a/contracts/src/traits/access_control/extensions/enumerable.rs +++ b/contracts/src/traits/access_control/extensions/enumerable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::access_control::*; use openbrush::traits::AccountId; diff --git a/contracts/src/traits/access_control/mod.rs b/contracts/src/traits/access_control/mod.rs index 973ecc4ac..fb28ad2b0 100644 --- a/contracts/src/traits/access_control/mod.rs +++ b/contracts/src/traits/access_control/mod.rs @@ -1,23 +1,7 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT + #[allow(clippy::module_inception)] mod access_control; diff --git a/contracts/src/traits/diamond/diamond.rs b/contracts/src/traits/diamond/diamond.rs index 02a408c6e..d66328e7d 100644 --- a/contracts/src/traits/diamond/diamond.rs +++ b/contracts/src/traits/diamond/diamond.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::{ errors::{ diff --git a/contracts/src/traits/diamond/extensions/diamond_loupe.rs b/contracts/src/traits/diamond/extensions/diamond_loupe.rs index 3e1e57454..6a22c9eb4 100644 --- a/contracts/src/traits/diamond/extensions/diamond_loupe.rs +++ b/contracts/src/traits/diamond/extensions/diamond_loupe.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::diamond::*; use ink::prelude::vec::Vec; diff --git a/contracts/src/traits/diamond/mod.rs b/contracts/src/traits/diamond/mod.rs index 24fa92a13..0b9146374 100644 --- a/contracts/src/traits/diamond/mod.rs +++ b/contracts/src/traits/diamond/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[allow(clippy::module_inception)] mod diamond; diff --git a/contracts/src/traits/errors/access_control.rs b/contracts/src/traits/errors/access_control.rs index e98ecf3c0..7b3f18f21 100644 --- a/contracts/src/traits/errors/access_control.rs +++ b/contracts/src/traits/errors/access_control.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// The AccessControl error type. Contract will throw one of this errors. /// Modifier returns `MissingRole`. diff --git a/contracts/src/traits/errors/diamond.rs b/contracts/src/traits/errors/diamond.rs index 0f6bdd18c..ae83712bf 100644 --- a/contracts/src/traits/errors/diamond.rs +++ b/contracts/src/traits/errors/diamond.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use super::OwnableError; use openbrush::traits::Hash; diff --git a/contracts/src/traits/errors/flashloan.rs b/contracts/src/traits/errors/flashloan.rs index 01688ae40..8d8a000eb 100644 --- a/contracts/src/traits/errors/flashloan.rs +++ b/contracts/src/traits/errors/flashloan.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use super::{ AccessControlError, @@ -41,7 +24,9 @@ impl From for FlashBorrowerError { OwnableError::CallerIsNotOwner => { FlashBorrowerError::FlashloanRejected(String::from("O::CallerIsNotOwner")) } - OwnableError::NewOwnerIsZero => FlashBorrowerError::FlashloanRejected(String::from("O::NewOwnerIsZero")), + OwnableError::NewOwnerIsNotSet => { + FlashBorrowerError::FlashloanRejected(String::from("O::NewOwnerIsNotSet")) + } } } } @@ -107,8 +92,10 @@ impl From for FlashLenderError { PSP22Error::InsufficientAllowance => { FlashLenderError::Custom(String::from("PSP22: Insufficient Allowance")) } - PSP22Error::ZeroRecipientAddress => FlashLenderError::Custom(String::from("PSP22: Zero Recipient Address")), - PSP22Error::ZeroSenderAddress => FlashLenderError::Custom(String::from("PSP22: Zero Sender Address")), + PSP22Error::RecipientIsNotSet => { + FlashLenderError::Custom(String::from("PSP22: Recipient Address is not set")) + } + PSP22Error::SenderIsNotSet => FlashLenderError::Custom(String::from("PSP22: Sender Address in not set")), PSP22Error::SafeTransferCheckFailed(message) => FlashLenderError::Custom(message), PSP22Error::PermitInvalidSignature => { FlashLenderError::Custom(String::from("PSP22: Permit Invalid Signature")) @@ -131,7 +118,7 @@ impl From for FlashLenderError { fn from(ownable: OwnableError) -> Self { match ownable { OwnableError::CallerIsNotOwner => FlashLenderError::Custom(String::from("O::CallerIsNotOwner")), - OwnableError::NewOwnerIsZero => FlashLenderError::Custom(String::from("O::NewOwnerIsZero")), + OwnableError::NewOwnerIsNotSet => FlashLenderError::Custom(String::from("O::NewOwnerIsNotSet")), } } } diff --git a/contracts/src/traits/errors/governance.rs b/contracts/src/traits/errors/governance.rs index 7ab5e539c..6acea9fdf 100644 --- a/contracts/src/traits/errors/governance.rs +++ b/contracts/src/traits/errors/governance.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::traits::errors::NoncesError; use openbrush::utils::{ diff --git a/contracts/src/traits/errors/mod.rs b/contracts/src/traits/errors/mod.rs index df817bcdc..1e9af41bb 100644 --- a/contracts/src/traits/errors/mod.rs +++ b/contracts/src/traits/errors/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT mod access_control; mod diamond; diff --git a/contracts/src/traits/errors/nonces.rs b/contracts/src/traits/errors/nonces.rs index d97afbbcb..69f2e6532 100644 --- a/contracts/src/traits/errors/nonces.rs +++ b/contracts/src/traits/errors/nonces.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use openbrush::traits::AccountId; diff --git a/contracts/src/traits/errors/ownable.rs b/contracts/src/traits/errors/ownable.rs index aaf608256..13ee0f3c5 100644 --- a/contracts/src/traits/errors/ownable.rs +++ b/contracts/src/traits/errors/ownable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// The Ownable error type. Contract will throw one of this errors. /// Modifier returns `CallerIsNotOwner`. @@ -25,5 +8,5 @@ #[cfg_attr(feature = "std", derive(scale_info::TypeInfo))] pub enum OwnableError { CallerIsNotOwner, - NewOwnerIsZero, + NewOwnerIsNotSet, } diff --git a/contracts/src/traits/errors/pausable.rs b/contracts/src/traits/errors/pausable.rs index ec8595fc0..77dffbf26 100644 --- a/contracts/src/traits/errors/pausable.rs +++ b/contracts/src/traits/errors/pausable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// The Pausable error type. Contract will throw one of this errors. #[derive(Debug, PartialEq, Eq, scale::Encode, scale::Decode)] diff --git a/contracts/src/traits/errors/payment_splitter.rs b/contracts/src/traits/errors/payment_splitter.rs index 1b8fccd86..2eee6608b 100644 --- a/contracts/src/traits/errors/payment_splitter.rs +++ b/contracts/src/traits/errors/payment_splitter.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use super::{ AccessControlError, @@ -35,7 +18,7 @@ pub enum PaymentSplitterError { NoPayees, AccountHasNoShares, AccountIsNotDuePayment, - AccountZeroAddress, + AccountIsNotSet, SharesAreZero, AlreadyHasShares, TransferFailed, @@ -55,7 +38,7 @@ impl From for PaymentSplitterError { fn from(ownable: OwnableError) -> Self { match ownable { OwnableError::CallerIsNotOwner => PaymentSplitterError::Custom(String::from("O::CallerIsNotOwner")), - OwnableError::NewOwnerIsZero => PaymentSplitterError::Custom(String::from("O::NewOwnerIsZero")), + OwnableError::NewOwnerIsNotSet => PaymentSplitterError::Custom(String::from("O::NewOwnerIsNotSet")), } } } diff --git a/contracts/src/traits/errors/psp22.rs b/contracts/src/traits/errors/psp22.rs index 2d4cd6421..b1f01316e 100644 --- a/contracts/src/traits/errors/psp22.rs +++ b/contracts/src/traits/errors/psp22.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use super::{ AccessControlError, @@ -38,10 +21,10 @@ pub enum PSP22Error { InsufficientBalance, /// Returned if not enough allowance to fulfill a request is available. InsufficientAllowance, - /// Returned if recipient's address is zero. - ZeroRecipientAddress, - /// Returned if sender's address is zero. - ZeroSenderAddress, + /// Returned if recipient's address is not set. + RecipientIsNotSet, + /// Returned if sender's address is not set. + SenderIsNotSet, /// Returned if safe transfer check fails SafeTransferCheckFailed(String), /// Returned if permit signature is invalid @@ -56,7 +39,7 @@ impl From for PSP22Error { fn from(ownable: OwnableError) -> Self { match ownable { OwnableError::CallerIsNotOwner => PSP22Error::Custom(String::from("O::CallerIsNotOwner")), - OwnableError::NewOwnerIsZero => PSP22Error::Custom(String::from("O::NewOwnerIsZero")), + OwnableError::NewOwnerIsNotSet => PSP22Error::Custom(String::from("O::NewOwnerIsNotSet")), } } } @@ -113,9 +96,9 @@ pub enum PSP22TokenTimelockError { /// Returned if the timestamp provided is before the current time ReleaseTimeIsBeforeCurrentTime, /// Returned if the token is not initialized - TokenZeroAddress, + TokenIsNotSet, /// Returned if the beneficiary is not initialized - BeneficiaryZeroAddress, + BeneficiaryIsNotSet, } impl From for PSP22TokenTimelockError { diff --git a/contracts/src/traits/errors/psp34.rs b/contracts/src/traits/errors/psp34.rs index ece92c4a5..fd5cf68c5 100644 --- a/contracts/src/traits/errors/psp34.rs +++ b/contracts/src/traits/errors/psp34.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use super::{ AccessControlError, @@ -49,7 +32,7 @@ impl From for PSP34Error { fn from(ownable: OwnableError) -> Self { match ownable { OwnableError::CallerIsNotOwner => PSP34Error::Custom(String::from("O::CallerIsNotOwner")), - OwnableError::NewOwnerIsZero => PSP34Error::Custom(String::from("O::NewOwnerIsZero")), + OwnableError::NewOwnerIsNotSet => PSP34Error::Custom(String::from("O::NewOwnerIsNotSet")), } } } diff --git a/contracts/src/traits/errors/psp37.rs b/contracts/src/traits/errors/psp37.rs index 63ebf61f4..2db986d5d 100644 --- a/contracts/src/traits/errors/psp37.rs +++ b/contracts/src/traits/errors/psp37.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use super::{ AccessControlError, @@ -35,8 +18,8 @@ pub enum PSP37Error { Custom(String), /// Returned if the account doesn't contain enough funds. InsufficientBalance, - /// Returned if recipient is zero account. - TransferToZeroAddress, + /// Returned if recipient address is not set. + TransferToNonSetAddress, /// Returned if token doesn't exist TokenNotExists, /// Returned if the caller is not allowed. @@ -51,7 +34,7 @@ impl From for PSP37Error { fn from(ownable: OwnableError) -> Self { match ownable { OwnableError::CallerIsNotOwner => PSP37Error::Custom(String::from("O::CallerIsNotOwner")), - OwnableError::NewOwnerIsZero => PSP37Error::Custom(String::from("O::NewOwnerIsZero")), + OwnableError::NewOwnerIsNotSet => PSP37Error::Custom(String::from("O::NewOwnerIsNotSet")), } } } diff --git a/contracts/src/traits/errors/reentrancy_guard.rs b/contracts/src/traits/errors/reentrancy_guard.rs index a7a9bfed8..23a5854c8 100644 --- a/contracts/src/traits/errors/reentrancy_guard.rs +++ b/contracts/src/traits/errors/reentrancy_guard.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// The PSP1155Receiver error types. #[derive(Debug, PartialEq, Eq, scale::Encode, scale::Decode)] diff --git a/contracts/src/traits/errors/timelock_controller.rs b/contracts/src/traits/errors/timelock_controller.rs index 04d0f7a2c..99c61db09 100644 --- a/contracts/src/traits/errors/timelock_controller.rs +++ b/contracts/src/traits/errors/timelock_controller.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use super::{ AccessControlError, @@ -40,7 +23,7 @@ pub enum TimelockControllerError { MissingDependency, UnderlyingTransactionReverted, CallerMustBeTimeLock, - CalleeMustExist, + CalleeIsNotSet, } impl From for TimelockControllerError { @@ -63,7 +46,7 @@ impl From for TimelockControllerError { fn from(ownable: OwnableError) -> Self { match ownable { OwnableError::CallerIsNotOwner => TimelockControllerError::Custom(String::from("O::CallerIsNotOwner")), - OwnableError::NewOwnerIsZero => TimelockControllerError::Custom(String::from("O::NewOwnerIsZero")), + OwnableError::NewOwnerIsNotSet => TimelockControllerError::Custom(String::from("O::NewOwnerIsNotSet")), } } } diff --git a/contracts/src/traits/errors/upgradeable.rs b/contracts/src/traits/errors/upgradeable.rs index c7bf03e36..66bab04a0 100644 --- a/contracts/src/traits/errors/upgradeable.rs +++ b/contracts/src/traits/errors/upgradeable.rs @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT + use super::{ AccessControlError, OwnableError, diff --git a/contracts/src/traits/flashloan/mod.rs b/contracts/src/traits/flashloan/mod.rs index 129b2c783..bdb14a135 100644 --- a/contracts/src/traits/flashloan/mod.rs +++ b/contracts/src/traits/flashloan/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::{ FlashBorrowerError, diff --git a/contracts/src/traits/governance/extensions/governor_counting/mod.rs b/contracts/src/traits/governance/extensions/governor_counting/mod.rs index 05aafb5da..f8665bbaa 100644 --- a/contracts/src/traits/governance/extensions/governor_counting/mod.rs +++ b/contracts/src/traits/governance/extensions/governor_counting/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::{ errors::GovernanceError, diff --git a/contracts/src/traits/governance/extensions/governor_quorum/mod.rs b/contracts/src/traits/governance/extensions/governor_quorum/mod.rs index 86aaff995..d4629556f 100644 --- a/contracts/src/traits/governance/extensions/governor_quorum/mod.rs +++ b/contracts/src/traits/governance/extensions/governor_quorum/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::GovernanceError; use openbrush::traits::Timestamp; diff --git a/contracts/src/traits/governance/extensions/governor_settings/mod.rs b/contracts/src/traits/governance/extensions/governor_settings/mod.rs index 58892b6e4..66c302703 100644 --- a/contracts/src/traits/governance/extensions/governor_settings/mod.rs +++ b/contracts/src/traits/governance/extensions/governor_settings/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::GovernanceError; diff --git a/contracts/src/traits/governance/extensions/mod.rs b/contracts/src/traits/governance/extensions/mod.rs index 32a5875be..859f6084b 100644 --- a/contracts/src/traits/governance/extensions/mod.rs +++ b/contracts/src/traits/governance/extensions/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod governor_counting; pub mod governor_quorum; diff --git a/contracts/src/traits/governance/extensions/timelock_controller/mod.rs b/contracts/src/traits/governance/extensions/timelock_controller/mod.rs index ad84eaa8f..3b6f4e3d9 100644 --- a/contracts/src/traits/governance/extensions/timelock_controller/mod.rs +++ b/contracts/src/traits/governance/extensions/timelock_controller/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::{ access_control::*, diff --git a/contracts/src/traits/governance/governor/mod.rs b/contracts/src/traits/governance/governor/mod.rs index 8b5aa468c..7714ec00e 100644 --- a/contracts/src/traits/governance/governor/mod.rs +++ b/contracts/src/traits/governance/governor/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::{ errors::GovernanceError, diff --git a/contracts/src/traits/governance/mod.rs b/contracts/src/traits/governance/mod.rs index 4f639a536..40ab45522 100644 --- a/contracts/src/traits/governance/mod.rs +++ b/contracts/src/traits/governance/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use ink::prelude::vec::Vec; use openbrush::traits::{ diff --git a/contracts/src/traits/governance/utils/mod.rs b/contracts/src/traits/governance/utils/mod.rs index db370277e..ec86edd32 100644 --- a/contracts/src/traits/governance/utils/mod.rs +++ b/contracts/src/traits/governance/utils/mod.rs @@ -1,25 +1,7 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod votes; -pub use votes::*; \ No newline at end of file +pub use votes::*; diff --git a/contracts/src/traits/governance/utils/votes.rs b/contracts/src/traits/governance/utils/votes.rs index ed3ba6ebf..3edd2397e 100644 --- a/contracts/src/traits/governance/utils/votes.rs +++ b/contracts/src/traits/governance/utils/votes.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::{ errors::GovernanceError, diff --git a/contracts/src/traits/mod.rs b/contracts/src/traits/mod.rs index 10e90dc3b..f4058fbf0 100644 --- a/contracts/src/traits/mod.rs +++ b/contracts/src/traits/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod access_control; pub mod diamond; diff --git a/contracts/src/traits/nonces/mod.rs b/contracts/src/traits/nonces/mod.rs index 53c180e9d..2ce8f6d23 100644 --- a/contracts/src/traits/nonces/mod.rs +++ b/contracts/src/traits/nonces/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::NoncesError; use openbrush::traits::AccountId; diff --git a/contracts/src/traits/ownable/mod.rs b/contracts/src/traits/ownable/mod.rs index 179830d08..8f280c3df 100644 --- a/contracts/src/traits/ownable/mod.rs +++ b/contracts/src/traits/ownable/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::OwnableError; use openbrush::traits::AccountId; @@ -59,5 +42,5 @@ pub trait Ownable { /// /// Panics with `NewOwnerIsZero` error if new owner's address is zero. #[ink(message)] - fn transfer_ownership(&mut self, new_owner: AccountId) -> Result<(), OwnableError>; + fn transfer_ownership(&mut self, new_owner: Option) -> Result<(), OwnableError>; } diff --git a/contracts/src/traits/pausable/mod.rs b/contracts/src/traits/pausable/mod.rs index 0d1f7d490..8e7b03e50 100644 --- a/contracts/src/traits/pausable/mod.rs +++ b/contracts/src/traits/pausable/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::PausableError; diff --git a/contracts/src/traits/payment_splitter/mod.rs b/contracts/src/traits/payment_splitter/mod.rs index 178f200db..48d67f7c8 100644 --- a/contracts/src/traits/payment_splitter/mod.rs +++ b/contracts/src/traits/payment_splitter/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::PaymentSplitterError; use openbrush::traits::{ @@ -48,6 +31,10 @@ pub trait PaymentSplitter { #[ink(message)] fn total_released(&self) -> Balance; + /// Getter for the amount of tokens that can be released for account + #[ink(message)] + fn releasable(&self, account: AccountId) -> Balance; + /// Getter for the amount of shares held by an account. #[ink(message)] fn shares(&self, account: AccountId) -> Balance; @@ -65,7 +52,7 @@ pub trait PaymentSplitter { /// without triggering this function. This only affects the reliability of the events /// and not the actual splitting of the native token. /// - /// On success a `PayeeAdded` event is emitted. + /// On success a `PaymentReceived` event is emitted. #[ink(message, payable)] fn receive(&mut self); diff --git a/contracts/src/traits/proxy/mod.rs b/contracts/src/traits/proxy/mod.rs index a0ad8d4c1..460dabae6 100644 --- a/contracts/src/traits/proxy/mod.rs +++ b/contracts/src/traits/proxy/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::{ errors::OwnableError, diff --git a/contracts/src/traits/psp22/extensions/burnable.rs b/contracts/src/traits/psp22/extensions/burnable.rs index b42b28758..c2b003168 100644 --- a/contracts/src/traits/psp22/extensions/burnable.rs +++ b/contracts/src/traits/psp22/extensions/burnable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP22`] that allows token holders to destroy both their own /// tokens and those that they have an allowance for. diff --git a/contracts/src/traits/psp22/extensions/capped.rs b/contracts/src/traits/psp22/extensions/capped.rs index 034662192..7a2281cc6 100644 --- a/contracts/src/traits/psp22/extensions/capped.rs +++ b/contracts/src/traits/psp22/extensions/capped.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP22`] that allows to set a limit on the total funding use openbrush::traits::Balance; diff --git a/contracts/src/traits/psp22/extensions/metadata.rs b/contracts/src/traits/psp22/extensions/metadata.rs index ecdc30f1a..31f8050ab 100644 --- a/contracts/src/traits/psp22/extensions/metadata.rs +++ b/contracts/src/traits/psp22/extensions/metadata.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use openbrush::traits::String; diff --git a/contracts/src/traits/psp22/extensions/mintable.rs b/contracts/src/traits/psp22/extensions/mintable.rs index a1d691f30..c12eaec6f 100644 --- a/contracts/src/traits/psp22/extensions/mintable.rs +++ b/contracts/src/traits/psp22/extensions/mintable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP22`] that allows create `amount` tokens /// and assigns them to `account`, increasing the total supply diff --git a/contracts/src/traits/psp22/extensions/permit.rs b/contracts/src/traits/psp22/extensions/permit.rs index d3c603d3f..1bbb26b20 100644 --- a/contracts/src/traits/psp22/extensions/permit.rs +++ b/contracts/src/traits/psp22/extensions/permit.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2023 727-ventures -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP22`] that allows create `amount` tokens /// and assigns them to `account`, increasing the total supply diff --git a/contracts/src/traits/psp22/extensions/votes.rs b/contracts/src/traits/psp22/extensions/votes.rs index acaedfd25..0486fc40a 100644 --- a/contracts/src/traits/psp22/extensions/votes.rs +++ b/contracts/src/traits/psp22/extensions/votes.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::traits::{ errors::GovernanceError, diff --git a/contracts/src/traits/psp22/extensions/wrapper.rs b/contracts/src/traits/psp22/extensions/wrapper.rs index c49261154..f9caf6b28 100644 --- a/contracts/src/traits/psp22/extensions/wrapper.rs +++ b/contracts/src/traits/psp22/extensions/wrapper.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP22`] which supports token wrapping pub use crate::traits::errors::PSP22Error; diff --git a/contracts/src/traits/psp22/mod.rs b/contracts/src/traits/psp22/mod.rs index 628ad3a72..09481ccfe 100644 --- a/contracts/src/traits/psp22/mod.rs +++ b/contracts/src/traits/psp22/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[allow(clippy::module_inception)] mod psp22; diff --git a/contracts/src/traits/psp22/psp22.rs b/contracts/src/traits/psp22/psp22.rs index 44ffd6778..9e4275d3a 100644 --- a/contracts/src/traits/psp22/psp22.rs +++ b/contracts/src/traits/psp22/psp22.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::{ PSP22Error, @@ -95,21 +78,6 @@ pub trait PSP22 { data: Vec, ) -> Result<(), PSP22Error>; - /// Allows `spender` to withdraw from the caller's account multiple times, up to - /// the `value` amount. - /// - /// If this function is called again it overwrites the current allowance with `value`. - /// - /// An `Approval` event is emitted. - /// - /// # Errors - /// - /// Returns `ZeroSenderAddress` error if sender's address is zero. - /// - /// Returns `ZeroRecipientAddress` error if recipient's address is zero. - #[ink(message)] - fn approve(&mut self, spender: AccountId, value: Balance) -> Result<(), PSP22Error>; - /// Atomically increases the allowance granted to `spender` by the caller. /// /// An `Approval` event is emitted. diff --git a/contracts/src/traits/psp22/utils/token_timelock.rs b/contracts/src/traits/psp22/utils/token_timelock.rs index 71d10a672..8e5b0742d 100644 --- a/contracts/src/traits/psp22/utils/token_timelock.rs +++ b/contracts/src/traits/psp22/utils/token_timelock.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::PSP22TokenTimelockError; use openbrush::traits::{ diff --git a/contracts/src/traits/psp34/extensions/burnable.rs b/contracts/src/traits/psp34/extensions/burnable.rs index 3c3d880aa..5e30599ba 100644 --- a/contracts/src/traits/psp34/extensions/burnable.rs +++ b/contracts/src/traits/psp34/extensions/burnable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP34`] that allows token holders to destroy their tokens pub use crate::traits::errors::PSP34Error; diff --git a/contracts/src/traits/psp34/extensions/enumerable.rs b/contracts/src/traits/psp34/extensions/enumerable.rs index d95830641..c2b5b3bcb 100644 --- a/contracts/src/traits/psp34/extensions/enumerable.rs +++ b/contracts/src/traits/psp34/extensions/enumerable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP34`] that adds enumerability of all the token ids in the contract as well /// as all token ids owned by each account. diff --git a/contracts/src/traits/psp34/extensions/metadata.rs b/contracts/src/traits/psp34/extensions/metadata.rs index 8d19bc79a..f57bb42d8 100644 --- a/contracts/src/traits/psp34/extensions/metadata.rs +++ b/contracts/src/traits/psp34/extensions/metadata.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Metadata for PSP34 pub use crate::traits::errors::PSP34Error; diff --git a/contracts/src/traits/psp34/extensions/mintable.rs b/contracts/src/traits/psp34/extensions/mintable.rs index c34bb9eb3..d49fffad3 100644 --- a/contracts/src/traits/psp34/extensions/mintable.rs +++ b/contracts/src/traits/psp34/extensions/mintable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP34`] that exposes the mint function pub use crate::traits::errors::PSP34Error; diff --git a/contracts/src/traits/psp34/mod.rs b/contracts/src/traits/psp34/mod.rs index 8eb9efc83..82d7a4821 100644 --- a/contracts/src/traits/psp34/mod.rs +++ b/contracts/src/traits/psp34/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[allow(clippy::module_inception)] mod psp34; diff --git a/contracts/src/traits/psp34/psp34.rs b/contracts/src/traits/psp34/psp34.rs index f3dcc8f12..305105f62 100644 --- a/contracts/src/traits/psp34/psp34.rs +++ b/contracts/src/traits/psp34/psp34.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::{ errors::{ diff --git a/contracts/src/traits/psp37/extensions/batch.rs b/contracts/src/traits/psp37/extensions/batch.rs index 14d8f269e..4d72b9754 100644 --- a/contracts/src/traits/psp37/extensions/batch.rs +++ b/contracts/src/traits/psp37/extensions/batch.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP37`] that allows to transfer a batch of tokens use crate::traits::psp37::{ diff --git a/contracts/src/traits/psp37/extensions/burnable.rs b/contracts/src/traits/psp37/extensions/burnable.rs index b9625996c..09e23d910 100644 --- a/contracts/src/traits/psp37/extensions/burnable.rs +++ b/contracts/src/traits/psp37/extensions/burnable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP37`] that allows token holders to destroy their tokens use crate::traits::psp37::{ diff --git a/contracts/src/traits/psp37/extensions/enumerable.rs b/contracts/src/traits/psp37/extensions/enumerable.rs index 65e3e172c..2e85c0a88 100644 --- a/contracts/src/traits/psp37/extensions/enumerable.rs +++ b/contracts/src/traits/psp37/extensions/enumerable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP37`] that adds enumerability of all the token ids in the contract as well /// as all token ids owned by each account. diff --git a/contracts/src/traits/psp37/extensions/metadata.rs b/contracts/src/traits/psp37/extensions/metadata.rs index 9825ced2b..e8fc2b246 100644 --- a/contracts/src/traits/psp37/extensions/metadata.rs +++ b/contracts/src/traits/psp37/extensions/metadata.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Metadata for PSP37 pub use crate::traits::psp37::Id; diff --git a/contracts/src/traits/psp37/extensions/mintable.rs b/contracts/src/traits/psp37/extensions/mintable.rs index 8766ae884..8a28cc9a8 100644 --- a/contracts/src/traits/psp37/extensions/mintable.rs +++ b/contracts/src/traits/psp37/extensions/mintable.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Extension of [`PSP37`] that allows minting of new tokens use crate::traits::psp37::{ diff --git a/contracts/src/traits/psp37/mod.rs b/contracts/src/traits/psp37/mod.rs index 717f3baae..f2d6b552d 100644 --- a/contracts/src/traits/psp37/mod.rs +++ b/contracts/src/traits/psp37/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[allow(clippy::module_inception)] mod psp37; diff --git a/contracts/src/traits/psp37/psp37.rs b/contracts/src/traits/psp37/psp37.rs index 206c89843..5ba6dd24a 100644 --- a/contracts/src/traits/psp37/psp37.rs +++ b/contracts/src/traits/psp37/psp37.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::{ errors::{ diff --git a/contracts/src/traits/psp61/mod.rs b/contracts/src/traits/psp61/mod.rs index 7b3fb0020..265f607e6 100644 --- a/contracts/src/traits/psp61/mod.rs +++ b/contracts/src/traits/psp61/mod.rs @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT + use ink::prelude::vec::Vec; #[openbrush::trait_definition] diff --git a/contracts/src/traits/types.rs b/contracts/src/traits/types.rs index f33e58206..1e3178827 100644 --- a/contracts/src/traits/types.rs +++ b/contracts/src/traits/types.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use ink::prelude::vec::Vec; diff --git a/contracts/src/traits/upgradeable/mod.rs b/contracts/src/traits/upgradeable/mod.rs index 4ba3fb6d5..62c0e1e01 100644 --- a/contracts/src/traits/upgradeable/mod.rs +++ b/contracts/src/traits/upgradeable/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::traits::errors::UpgradeableError; use openbrush::traits::Hash; diff --git a/contracts/src/upgradeability/diamond/mod.rs b/contracts/src/upgradeability/diamond/mod.rs deleted file mode 100644 index 59538e5c6..000000000 --- a/contracts/src/upgradeability/diamond/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -pub mod diamond; - -pub use diamond::*; -pub mod extensions { - pub mod diamond_loupe; -} diff --git a/contracts/src/upgradeability/mod.rs b/contracts/src/upgradeability/mod.rs index 1f7183e1f..641d13846 100644 --- a/contracts/src/upgradeability/mod.rs +++ b/contracts/src/upgradeability/mod.rs @@ -1,25 +1,7 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -#[cfg(feature = "diamond")] -pub mod diamond; +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT + #[cfg(feature = "proxy")] pub mod proxy; diff --git a/contracts/src/upgradeability/proxy/mod.rs b/contracts/src/upgradeability/proxy/mod.rs index 98b7df812..2fcee9b41 100644 --- a/contracts/src/upgradeability/proxy/mod.rs +++ b/contracts/src/upgradeability/proxy/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT // Delegate calls were marked as a possible attack vector in ink! // Therefore the proxy and diamond contracts will be disabled within OpenBrush until this is reimplemented in ink! 4. diff --git a/contracts/src/upgradeability/upgradeable/mod.rs b/contracts/src/upgradeability/upgradeable/mod.rs index d947eac51..849a4f254 100644 --- a/contracts/src/upgradeability/upgradeable/mod.rs +++ b/contracts/src/upgradeability/upgradeable/mod.rs @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT + pub use crate::{ ownable::*, traits::upgradeable::*, diff --git a/contracts/src/utils/mod.rs b/contracts/src/utils/mod.rs index ba79439f0..c49ceafaa 100644 --- a/contracts/src/utils/mod.rs +++ b/contracts/src/utils/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[cfg(feature = "nonces")] pub mod nonces; diff --git a/contracts/src/utils/nonces/mod.rs b/contracts/src/utils/nonces/mod.rs index 0524e3301..39c940d48 100644 --- a/contracts/src/utils/nonces/mod.rs +++ b/contracts/src/utils/nonces/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod nonces; diff --git a/contracts/src/utils/nonces/nonces.rs b/contracts/src/utils/nonces/nonces.rs index 67a03a350..c2bafaa04 100644 --- a/contracts/src/utils/nonces/nonces.rs +++ b/contracts/src/utils/nonces/nonces.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ nonces, diff --git a/contracts/src/utils/psp61/mod.rs b/contracts/src/utils/psp61/mod.rs index c142bbc94..e005b0039 100644 --- a/contracts/src/utils/psp61/mod.rs +++ b/contracts/src/utils/psp61/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2023 727-ventures -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub use crate::{ psp61, diff --git a/examples/ownable/lib.rs b/examples/ownable/lib.rs index 96de20ac6..f6eba81f7 100644 --- a/examples/ownable/lib.rs +++ b/examples/ownable/lib.rs @@ -145,7 +145,7 @@ pub mod ownable { let transfer_ownership_tx = { let _msg = build_message::(address.clone()) - .call(|contract| contract.transfer_ownership(address_of!(Bob))); + .call(|contract| contract.transfer_ownership(Some(address_of!(Bob)))); client .call(&ink_e2e::alice(), _msg, 0, None) .await diff --git a/examples/payment_splitter/lib.rs b/examples/payment_splitter/lib.rs index a308e9ef2..3fb8f33a6 100644 --- a/examples/payment_splitter/lib.rs +++ b/examples/payment_splitter/lib.rs @@ -19,14 +19,6 @@ pub mod my_payment_splitter { payment_splitter::Internal::_init(&mut instance, payees_and_shares).expect("Should init"); instance } - - /// Payout all payees at once. - /// Delete this method if you don't want this functionality in your version of the payment splitter. - #[ink(message)] - pub fn release_all(&mut self) -> Result<(), PaymentSplitterError> { - // `_release_all()` is an internal method defined by the `payment_splitter::Internal` trait - payment_splitter::Internal::_release_all(self) - } } #[cfg(all(test, feature = "e2e-tests"))] @@ -38,7 +30,11 @@ pub mod my_payment_splitter { #[rustfmt::skip] use ink_e2e::{build_message, PolkadotConfig}; - use test_helpers::{address_of, get_shares, method_call}; + use test_helpers::{ + address_of, + get_shares, + method_call, + }; type E2EResult = Result>; @@ -162,62 +158,5 @@ pub mod my_payment_splitter { Ok(()) } - - #[ink_e2e::test] - async fn release_native_token_using_release_all(mut client: ink_e2e::Client) -> E2EResult<()> { - let constructor = ContractRef::new(vec![(address_of!(Bob), 40), (address_of!(Alice), 60)]); - let address = client - .instantiate("my_payment_splitter", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - let total_released_before = method_call!(client, address, total_released); - - assert_eq!(total_released_before, 0); - - let _receive_tx = { - let _msg = build_message::(address.clone()).call(|contract| contract.receive()); - client - .call(&ink_e2e::alice(), _msg, 1000000000000, None) - .await - .expect("call failed") - .return_value() - }; - - let release_all = method_call!(client, address, release_all); - - assert!(release_all.is_ok()); - - let total_released = method_call!(client, address, total_released); - - let bob_released = { - let _msg = - build_message::(address.clone()).call(|contract| contract.released(address_of!(Bob))); - client - .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - .return_value() - }; - - let alice_released = { - let _msg = build_message::(address.clone()) - .call(|contract| contract.released(address_of!(Alice))); - client - .call_dry_run(&ink_e2e::alice(), &_msg, 0, None) - .await - .return_value() - }; - - assert!(alice_released > bob_released); - - assert_eq!(bob_released, (total_released * 40) / 100); - - assert_eq!(alice_released, (total_released * 60) / 100); - - assert_eq!(alice_released + bob_released, total_released); - - Ok(()) - } } } diff --git a/examples/psp22/lib.rs b/examples/psp22/lib.rs index cb5aa873a..1fc472e9f 100644 --- a/examples/psp22/lib.rs +++ b/examples/psp22/lib.rs @@ -1,7 +1,10 @@ #![cfg_attr(not(feature = "std"), no_std, no_main)] // pub use my_psp22::*; -pub use openbrush::traits::{AccountId, Storage}; +pub use openbrush::traits::{ + AccountId, + Storage, +}; // we need to expand this struct before the contract macro is expanded // that is why we declare it here for this example @@ -29,15 +32,15 @@ pub mod my_psp22 { hated_storage: HatedStorage, } - #[overrider(psp22::Internal)] + #[overrider(psp22::PSP22Transfer)] fn _before_token_transfer( &mut self, _from: Option<&AccountId>, to: Option<&AccountId>, _amount: &Balance, ) -> Result<(), PSP22Error> { - if to == Some(&self.hated_storage.hated_account) { - return Err(PSP22Error::Custom(String::from("I hate this account!"))); + if _to == Some(&self.hated_storage.hated_account) { + return Err(PSP22Error::Custom(String::from("I hate this account!"))) } Ok(()) } @@ -64,9 +67,15 @@ pub mod my_psp22 { pub mod tests { use super::*; use crate::hatedstorageaccessors_external::HatedStorageAccessors; - use ink_e2e::{build_message, PolkadotConfig}; + use ink_e2e::{ + build_message, + PolkadotConfig, + }; use openbrush::contracts::psp22::psp22_external::PSP22; - use test_helpers::{address_of, balance_of}; + use test_helpers::{ + address_of, + balance_of, + }; type E2EResult = Result>; diff --git a/examples/psp22_extensions/capped/lib.rs b/examples/psp22_extensions/capped/lib.rs index 00eca7ef5..72090f406 100644 --- a/examples/psp22_extensions/capped/lib.rs +++ b/examples/psp22_extensions/capped/lib.rs @@ -3,10 +3,7 @@ #[openbrush::implementation(PSP22, PSP22Capped, PSP22Mintable)] #[openbrush::contract] pub mod my_psp22_capped { - use openbrush::traits::{ - Storage, - String, - }; + use openbrush::traits::Storage; #[ink(storage)] #[derive(Default, Storage)] @@ -17,20 +14,6 @@ pub mod my_psp22_capped { cap: capped::Data, } - #[overrider(psp22::Internal)] - fn _before_token_transfer( - &mut self, - from: Option<&AccountId>, - _: Option<&AccountId>, - amount: &Balance, - ) -> Result<(), PSP22Error> { - // `is_none` means that it is minting - if from.is_none() && capped::Internal::_is_cap_exceeded(self, amount) { - return Err(PSP22Error::Custom(String::from("Cap exceeded"))) - } - Ok(()) - } - impl Contract { /// Constructor which mints `initial_supply` of the token to sender /// Will set the token's cap to `cap` diff --git a/examples/psp34_extensions/burnable/lib.rs b/examples/psp34_extensions/burnable/lib.rs index 330e9a692..81c0a5f0f 100644 --- a/examples/psp34_extensions/burnable/lib.rs +++ b/examples/psp34_extensions/burnable/lib.rs @@ -49,7 +49,7 @@ pub mod my_psp34_burnable { type E2EResult = Result>; #[ink_e2e::test] - async fn burn_wokrs(mut client: ink_e2e::Client) -> E2EResult<()> { + async fn burn_works(mut client: ink_e2e::Client) -> E2EResult<()> { let constructor = ContractRef::new(); let address = client .instantiate("my_psp34_burnable", &ink_e2e::alice(), constructor, 0, None) diff --git a/examples/upgradeable/v2/lib.rs b/examples/upgradeable/v2/lib.rs index 38c73fb83..c751e3472 100644 --- a/examples/upgradeable/v2/lib.rs +++ b/examples/upgradeable/v2/lib.rs @@ -38,7 +38,7 @@ pub mod contract_v2 { return Err(PSP22Error::InsufficientBalance) } - psp22::Internal::_before_token_transfer(self, Some(&from), Some(&to), &amount)?; + psp22::PSP22Transfer::_before_token_transfer(self, Some(&from), Some(&to), &amount)?; self.psp22.balances.insert(&from, &(from_balance - amount)); @@ -57,7 +57,7 @@ pub mod contract_v2 { let to_balance = psp22::Internal::_balance_of(self, &to); self.psp22.balances.insert(&to, &(to_balance + new_amount)); - psp22::Internal::_after_token_transfer(self, Some(&from), Some(&to), &amount)?; + psp22::PSP22Transfer::_after_token_transfer(self, Some(&from), Some(&to), &amount)?; psp22::Internal::_emit_transfer_event(self, Some(from), Some(to), new_amount); Ok(()) diff --git a/lang/codegen/src/accessors.rs b/lang/codegen/src/accessors.rs index 044506ac1..9a486d0ef 100644 --- a/lang/codegen/src/accessors.rs +++ b/lang/codegen/src/accessors.rs @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT + use proc_macro2::TokenStream; use quote::{ format_ident, @@ -12,9 +16,7 @@ use syn::{ Fields, }; -pub fn accessors(attrs: TokenStream, s: synstructure::Structure) -> TokenStream { - let trait_ident = attrs; - +pub fn accessors(trait_ident: TokenStream, s: synstructure::Structure) -> TokenStream { let struct_ident = s.ast().ident.clone(); let item = match s.ast().data.clone() { @@ -22,7 +24,7 @@ pub fn accessors(attrs: TokenStream, s: synstructure::Structure) -> TokenStream _ => panic!("Only structs are supported"), }; - let fields: Vec<_> = extract_get_fields(s.clone()); + let fields: Vec<_> = extract_fields(s.clone(), "get"); let get_impls = fields.iter().map(|field| { let field_ident = field.ident.clone().unwrap(); @@ -38,7 +40,7 @@ pub fn accessors(attrs: TokenStream, s: synstructure::Structure) -> TokenStream } }); - let fields: Vec<_> = extract_set_fields(s.clone()); + let fields: Vec<_> = extract_fields(s.clone(), "set"); let set_impls = fields.iter().map(|field| { let field_ident = field.ident.clone().unwrap(); @@ -54,7 +56,7 @@ pub fn accessors(attrs: TokenStream, s: synstructure::Structure) -> TokenStream } }); - let result = quote! { + quote! { #item #[openbrush::trait_definition] @@ -62,9 +64,7 @@ pub fn accessors(attrs: TokenStream, s: synstructure::Structure) -> TokenStream #(#get_impls)* #(#set_impls)* } - }; - - result + } } fn generate_struct(s: &synstructure::Structure, struct_item: DataStruct) -> TokenStream { @@ -113,21 +113,7 @@ fn consume_attrs(field: &mut syn::Field) -> Field { field.clone() } -fn extract_get_fields(s: synstructure::Structure) -> Vec { - let struct_item = match s.ast().data.clone() { - Data::Struct(struct_item) => struct_item, - _ => panic!("Only structs are supported"), - }; - - struct_item - .fields - .iter() - .filter(|field| field.attrs.iter().any(|a| a.path.is_ident("get"))) - .cloned() - .collect::>() -} - -fn extract_set_fields(s: synstructure::Structure) -> Vec { +fn extract_fields(s: synstructure::Structure, attr: &str) -> Vec { let struct_item = match s.ast().data.clone() { Data::Struct(struct_item) => struct_item, _ => panic!("Only structs are supported"), @@ -136,7 +122,7 @@ fn extract_set_fields(s: synstructure::Structure) -> Vec { struct_item .fields .iter() - .filter(|field| field.attrs.iter().any(|a| a.path.is_ident("set"))) + .filter(|field| field.attrs.iter().any(|a| a.path.is_ident(attr))) .cloned() .collect::>() } diff --git a/lang/codegen/src/contract.rs b/lang/codegen/src/contract.rs index 5d62b3590..c2beff7e4 100644 --- a/lang/codegen/src/contract.rs +++ b/lang/codegen/src/contract.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::{ internal, @@ -32,12 +15,12 @@ use quote::{ }; use syn::Item; -pub fn generate(_attrs: TokenStream, ink_module: TokenStream) -> TokenStream { +pub fn generate(attrs: TokenStream, ink_module: TokenStream) -> TokenStream { if internal::skip() { return quote! {} } let input: TokenStream = ink_module; - let attrs: TokenStream = _attrs; + let attrs: TokenStream = attrs; let mut module = syn::parse2::(input).expect("Can't parse contract module"); let (braces, mut items) = match module.content { Some((brace, items)) => (brace, items), diff --git a/lang/codegen/src/implementation.rs b/lang/codegen/src/implementation.rs index b4187d83b..3c4a1768b 100644 --- a/lang/codegen/src/implementation.rs +++ b/lang/codegen/src/implementation.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::{ implementations::*, @@ -35,12 +18,10 @@ use syn::{ Path, }; -pub fn generate(attrs: TokenStream, ink_module: TokenStream) -> TokenStream { +pub fn generate(attrs: TokenStream, input: TokenStream) -> TokenStream { if internal::skip() { return quote! {} } - let input: TokenStream = ink_module; - // map attribute args to default contract names let args = syn::parse2::(attrs) .expect("No default contracts to implement provided") @@ -48,7 +29,7 @@ pub fn generate(attrs: TokenStream, ink_module: TokenStream) -> TokenStream { .map(|arg| { match arg { NestedMeta::Path(method) => method.to_token_stream().to_string().replace(' ', ""), - _ => panic!("Expected names of OpenBrush traits to implement in the contract!"), + _ => panic!("Can't parse naming of default contract to implement"), } }) .collect::>(); @@ -75,10 +56,11 @@ pub fn generate(attrs: TokenStream, ink_module: TokenStream) -> TokenStream { let mut overriden_traits = HashMap::<&str, syn::Item>::default(); let mut impl_args = ImplArgs::new(&map, &mut items, &mut imports, &mut overriden_traits, ident); + let is_capped = args.contains(&"PSP22Capped".to_string()); - for to_implement in &args { + for to_implement in args.clone() { match to_implement.as_str() { - "PSP22" => impl_psp22(&mut impl_args), + "PSP22" => impl_psp22(&mut impl_args, is_capped), "PSP22Mintable" => impl_psp22_mintable(&mut impl_args), "PSP22Burnable" => impl_psp22_burnable(&mut impl_args), "PSP22Permit" => impl_psp22_permit(&mut impl_args), diff --git a/lang/codegen/src/implementations.rs b/lang/codegen/src/implementations.rs index 04ea7c045..193c66754 100644 --- a/lang/codegen/src/implementations.rs +++ b/lang/codegen/src/implementations.rs @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT + use quote::{ format_ident, quote, @@ -54,12 +58,23 @@ impl<'a> ImplArgs<'a> { } } -pub(crate) fn impl_psp22(impl_args: &mut ImplArgs) { +pub(crate) fn impl_psp22(impl_args: &mut ImplArgs, capped: bool) { let storage_struct_name = impl_args.contract_name(); - let internal_impl = syn::parse2::(quote!( - impl psp22::InternalImpl for #storage_struct_name {} - )) - .expect("Should parse"); + let internal_impl = if capped { + syn::parse2::(quote!( + impl psp22::InternalImpl for #storage_struct_name { + fn _max_supply(&self) -> Balance { + capped::Internal::_cap(self) + } + } + )) + .expect("Should parse") + } else { + syn::parse2::(quote!( + impl psp22::InternalImpl for #storage_struct_name {} + )) + .expect("Should parse") + }; let mut internal = syn::parse2::(quote!( impl psp22::Internal for #storage_struct_name { @@ -75,6 +90,10 @@ pub(crate) fn impl_psp22(impl_args: &mut ImplArgs) { psp22::InternalImpl::_total_supply(self) } + fn _max_supply(&self) -> Balance { + psp22::InternalImpl::_max_supply(self) + } + fn _balance_of(&self, owner: &AccountId) -> Balance { psp22::InternalImpl::_balance_of(self, owner) } @@ -109,24 +128,6 @@ pub(crate) fn impl_psp22(impl_args: &mut ImplArgs) { fn _burn_from(&mut self, account: AccountId, amount: Balance) -> Result<(), PSP22Error> { psp22::InternalImpl::_burn_from(self, account, amount) } - - fn _before_token_transfer( - &mut self, - from: Option<&AccountId>, - to: Option<&AccountId>, - amount: &Balance, - ) -> Result<(), PSP22Error> { - psp22::InternalImpl::_before_token_transfer(self, from, to, amount) - } - - fn _after_token_transfer( - &mut self, - from: Option<&AccountId>, - to: Option<&AccountId>, - amount: &Balance, - ) -> Result<(), PSP22Error> { - psp22::InternalImpl::_after_token_transfer(self, from, to, amount) - } } )) .expect("Should parse"); @@ -169,11 +170,6 @@ pub(crate) fn impl_psp22(impl_args: &mut ImplArgs) { PSP22Impl::transfer_from(self, from, to, value, data) } - #[ink(message)] - fn approve(&mut self, spender: AccountId, value: Balance) -> Result<(), PSP22Error> { - PSP22Impl::approve(self, spender, value) - } - #[ink(message)] fn increase_allowance(&mut self, spender: AccountId, delta_value: Balance) -> Result<(), PSP22Error> { PSP22Impl::increase_allowance(self, spender, delta_value) @@ -191,6 +187,7 @@ pub(crate) fn impl_psp22(impl_args: &mut ImplArgs) { use openbrush::contracts::psp22::*; )) .expect("Should parse"); + impl_args.imports.insert("PSP22", import); impl_args.vec_import(); @@ -201,6 +198,54 @@ pub(crate) fn impl_psp22(impl_args: &mut ImplArgs) { impl_args.items.push(syn::Item::Impl(internal)); impl_args.items.push(syn::Item::Impl(psp22_impl)); impl_args.items.push(syn::Item::Impl(psp22)); + + // Implement PSP22Transfer + + let implementation = if capped { + syn::parse2::(quote!( + impl capped::PSP22TransferImpl for #storage_struct_name {} + )) + .expect("Should parse") + } else { + syn::parse2::(quote!( + impl psp22::PSP22TransferImpl for #storage_struct_name {} + )) + .expect("Should parse") + }; + + let trait_ident = if capped { + quote! {capped::PSP22TransferImpl} + } else { + quote! {psp22::PSP22TransferImpl} + }; + + let mut transfer = syn::parse2::(quote!( + impl psp22::PSP22Transfer for #storage_struct_name { + fn _before_token_transfer( + &mut self, + _from: Option<&AccountId>, + _to: Option<&AccountId>, + _amount: &Balance, + ) -> Result<(), PSP22Error> { + #trait_ident::_before_token_transfer(self, _from, _to, _amount) + } + + fn _after_token_transfer( + &mut self, + _from: Option<&AccountId>, + _to: Option<&AccountId>, + _amount: &Balance, + ) -> Result<(), PSP22Error> { + #trait_ident::_after_token_transfer(self, _from, _to, _amount) + } + } + )) + .expect("Should parse"); + + override_functions("psp22::PSP22Transfer", &mut transfer, impl_args.map); + + impl_args.items.push(syn::Item::Impl(implementation)); + impl_args.items.push(syn::Item::Impl(transfer)); } pub(crate) fn impl_psp22_mintable(impl_args: &mut ImplArgs) { @@ -270,7 +315,7 @@ pub(crate) fn impl_psp22_permit(impl_args: &mut ImplArgs) { )) .expect("Should parse"); - let permit_internal = syn::parse2::(quote!( + let mut permit_internal = syn::parse2::(quote!( impl permit::Internal for #storage_struct_name { fn _permit( &mut self, @@ -294,7 +339,7 @@ pub(crate) fn impl_psp22_permit(impl_args: &mut ImplArgs) { )) .expect("Should parse"); - let permit = syn::parse2::(quote!( + let mut permit = syn::parse2::(quote!( impl permit::PSP22Permit for #storage_struct_name { #[ink(message)] fn permit( @@ -325,8 +370,8 @@ pub(crate) fn impl_psp22_permit(impl_args: &mut ImplArgs) { impl_args.signature_import(); impl_args.vec_import(); - // TODO - // override_functions("PSP22Permit", &mut burnable, impl_args.map); + override_functions("PSP22Permit", &mut permit, impl_args.map); + override_functions("permit::Internal", &mut permit_internal, impl_args.map); impl_args.items.push(syn::Item::Impl(permit_internal_impl)); impl_args.items.push(syn::Item::Impl(permit_internal)); @@ -525,6 +570,10 @@ pub(crate) fn impl_flashmint(impl_args: &mut ImplArgs) { ) -> Result<(), FlashLenderError> { flashmint::InternalImpl::_on_flashloan(self, receiver_account, token, fee, amount, data) } + + fn _flash_fee_receiver(&self) -> Option { + flashmint::InternalImpl::_flash_fee_receiver(self) + } } )) .expect("Should parse"); @@ -842,11 +891,6 @@ pub(crate) fn impl_psp22_pallet(impl_args: &mut ImplArgs) { PSP22PalletImpl::transfer_from(self, from, to, value, data) } - #[ink(message)] - fn approve(&mut self, spender: AccountId, value: Balance) -> Result<(), PSP22Error> { - PSP22PalletImpl::approve(self, spender, value) - } - #[ink(message)] fn increase_allowance(&mut self, spender: AccountId, delta_value: Balance) -> Result<(), PSP22Error> { PSP22PalletImpl::increase_allowance(self, spender, delta_value) @@ -913,7 +957,12 @@ pub(crate) fn impl_psp22_pallet_metadata(impl_args: &mut ImplArgs) { )) .expect("Should parse"); - let mut burnable = syn::parse2::(quote!( + let internal_impl = syn::parse2::(quote!( + impl PSP22PalletMetadataInternal for #storage_struct_name {} + )) + .expect("Should parse"); + + let mut metadata = syn::parse2::(quote!( impl PSP22Metadata for #storage_struct_name { #[ink(message)] fn token_name(&self) -> Option { @@ -940,10 +989,11 @@ pub(crate) fn impl_psp22_pallet_metadata(impl_args: &mut ImplArgs) { impl_args.imports.insert("PSP22PalletMetadata", import); impl_args.vec_import(); - override_functions("PSP22Metadata", &mut burnable, impl_args.map); + override_functions("PSP22Metadata", &mut metadata, impl_args.map); impl_args.items.push(syn::Item::Impl(metadata_impl)); - impl_args.items.push(syn::Item::Impl(burnable)); + impl_args.items.push(syn::Item::Impl(metadata)); + impl_args.items.push(syn::Item::Impl(internal_impl)); } pub(crate) fn impl_psp22_pallet_mintable(impl_args: &mut ImplArgs) { @@ -1917,7 +1967,7 @@ pub(crate) fn impl_ownable(impl_args: &mut ImplArgs) { } #[ink(message)] - fn transfer_ownership(&mut self, new_owner: AccountId) -> Result<(), OwnableError> { + fn transfer_ownership(&mut self, new_owner: Option) -> Result<(), OwnableError> { OwnableImpl::transfer_ownership(self, new_owner) } } @@ -1968,8 +2018,8 @@ pub(crate) fn impl_payment_splitter(impl_args: &mut ImplArgs) { payment_splitter::InternalImpl::_add_payee(self, payee, share) } - fn _release_all(&mut self) -> Result<(), PaymentSplitterError> { - payment_splitter::InternalImpl::_release_all(self) + fn _releasable(&self, account: AccountId) -> Balance { + payment_splitter::InternalImpl::_releasable(self, account) } fn _release(&mut self, account: AccountId) -> Result<(), PaymentSplitterError> { @@ -1996,6 +2046,11 @@ pub(crate) fn impl_payment_splitter(impl_args: &mut ImplArgs) { PaymentSplitterImpl::total_released(self) } + #[ink(message)] + fn releasable(&self, account: AccountId) -> Balance { + PaymentSplitterImpl::releasable(self, account) + } + #[ink(message)] fn shares(&self, account: AccountId) -> Balance { PaymentSplitterImpl::shares(self, account) diff --git a/lang/codegen/src/internal.rs b/lang/codegen/src/internal.rs index 2ee4de27a..64ab4b0c8 100644 --- a/lang/codegen/src/internal.rs +++ b/lang/codegen/src/internal.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT extern crate proc_macro; diff --git a/lang/codegen/src/lib.rs b/lang/codegen/src/lib.rs index 8b58a68cd..d7c43eeae 100644 --- a/lang/codegen/src/lib.rs +++ b/lang/codegen/src/lib.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT pub mod accessors; pub mod contract; diff --git a/lang/codegen/src/metadata.rs b/lang/codegen/src/metadata.rs index c0b9009f5..2ff6ce3c1 100644 --- a/lang/codegen/src/metadata.rs +++ b/lang/codegen/src/metadata.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use cargo_metadata::camino::Utf8PathBuf; use fs2::FileExt; diff --git a/lang/codegen/src/modifier_definition.rs b/lang/codegen/src/modifier_definition.rs index 4b75dd9af..bc19f7297 100644 --- a/lang/codegen/src/modifier_definition.rs +++ b/lang/codegen/src/modifier_definition.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use proc_macro2::TokenStream; use quote::{ @@ -31,8 +14,8 @@ use syn::{ ItemFn, }; -pub fn generate(_: TokenStream, _input: TokenStream) -> TokenStream { - let fn_item: ItemFn = parse2(_input).unwrap(); +pub fn generate(_: TokenStream, input: TokenStream) -> TokenStream { + let fn_item: ItemFn = parse2(input).unwrap(); if fn_item.sig.inputs.len() < 2 { return quote_spanned! { @@ -172,7 +155,7 @@ pub fn generate(_: TokenStream, _input: TokenStream) -> TokenStream { } } } - } else if let syn::FnArg::Receiver(rec) = first { + } else if let syn::FnArg::Receiver(rec) = second { return quote_spanned! { rec.span() => compile_error!("Second argument of modifier can't be `self`"); diff --git a/lang/codegen/src/modifiers.rs b/lang/codegen/src/modifiers.rs index da5e65e87..5512c6692 100644 --- a/lang/codegen/src/modifiers.rs +++ b/lang/codegen/src/modifiers.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::internal::{ AttributeArgs, @@ -42,10 +25,10 @@ use syn::{ const INSTANCE: &str = "__openbrush_instance_modifier"; -pub fn generate(_attrs: TokenStream, _input: TokenStream) -> TokenStream { - let modifiers: AttributeArgs = parse2(_attrs).unwrap(); +pub fn generate(attrs: TokenStream, input: TokenStream) -> TokenStream { + let modifiers: AttributeArgs = parse2(attrs).unwrap(); let mut impl_item = - syn::parse2::(_input).expect("Can't parse input of `modifiers` macro like a method."); + syn::parse2::(input).expect("Can't parse input of `modifiers` macro like a method."); if impl_item.sig.inputs.is_empty() { return quote_spanned! { diff --git a/lang/codegen/src/storage_derive.rs b/lang/codegen/src/storage_derive.rs index 46c867db5..513bc2a8f 100644 --- a/lang/codegen/src/storage_derive.rs +++ b/lang/codegen/src/storage_derive.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use proc_macro2::TokenStream; use quote::quote; diff --git a/lang/codegen/src/storage_item.rs b/lang/codegen/src/storage_item.rs index 30a5322ec..6ee98486b 100644 --- a/lang/codegen/src/storage_item.rs +++ b/lang/codegen/src/storage_item.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::internal::is_attr; use proc_macro2::TokenStream; diff --git a/lang/codegen/src/trait_definition.rs b/lang/codegen/src/trait_definition.rs index 7841be04c..e29b62403 100644 --- a/lang/codegen/src/trait_definition.rs +++ b/lang/codegen/src/trait_definition.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::{ internal::{ @@ -43,12 +26,12 @@ use syn::{ ItemTrait, }; -pub fn generate(_attrs: TokenStream, _input: TokenStream) -> TokenStream { +pub fn generate(attrs: TokenStream, input: TokenStream) -> TokenStream { if crate::internal::skip() { return quote! {} } - let attrs: proc_macro2::TokenStream = _attrs; - let mut trait_item: ItemTrait = parse2(_input).unwrap(); + let attrs: proc_macro2::TokenStream = attrs; + let mut trait_item: ItemTrait = parse2(input).unwrap(); let trait_without_ink_attrs; let ink_code; diff --git a/lang/codegen/src/wrapper.rs b/lang/codegen/src/wrapper.rs index 894a1b800..04addc3a1 100644 --- a/lang/codegen/src/wrapper.rs +++ b/lang/codegen/src/wrapper.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use proc_macro2::TokenStream; use quote::{ diff --git a/lang/macro/src/lib.rs b/lang/macro/src/lib.rs index db3e6c03b..cc44d9321 100644 --- a/lang/macro/src/lib.rs +++ b/lang/macro/src/lib.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #![cfg_attr(not(feature = "std"), no_std, no_main)] @@ -44,8 +27,8 @@ use openbrush_lang_codegen::{ /// /// This macro consumes impl section for traits defined with [`#[openbrush::trait_definition]`](`macro@crate::trait_definition`). #[proc_macro_attribute] -pub fn contract(_attrs: TokenStream, ink_module: TokenStream) -> TokenStream { - contract::generate(_attrs.into(), ink_module.into()).into() +pub fn contract(attrs: TokenStream, ink_module: TokenStream) -> TokenStream { + contract::generate(attrs.into(), ink_module.into()).into() } /// Defines extensible trait in the scope of `openbrush::contract`. @@ -166,8 +149,8 @@ pub fn contract(_attrs: TokenStream, ink_module: TokenStream) -> TokenStream { /// } /// ``` #[proc_macro_attribute] -pub fn trait_definition(_attrs: TokenStream, _input: TokenStream) -> TokenStream { - trait_definition::generate(_attrs.into(), _input.into()).into() +pub fn trait_definition(attrs: TokenStream, input: TokenStream) -> TokenStream { + trait_definition::generate(attrs.into(), input.into()).into() } /// This macro only checks that some free-standing function satisfies a set of rules. @@ -338,8 +321,8 @@ pub fn modifier_definition(_attrs: TokenStream, _input: TokenStream) -> TokenStr /// } /// ``` #[proc_macro_attribute] -pub fn modifiers(_attrs: TokenStream, method: TokenStream) -> TokenStream { - modifiers::generate(_attrs.into(), method.into()).into() +pub fn modifiers(attrs: TokenStream, method: TokenStream) -> TokenStream { + modifiers::generate(attrs.into(), method.into()).into() } /// This macro allows you to define a wrapper type for traits defined via diff --git a/lang/src/lib.rs b/lang/src/lib.rs index eb710792f..1e8b1836b 100644 --- a/lang/src/lib.rs +++ b/lang/src/lib.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #![cfg_attr(not(feature = "std"), no_std)] diff --git a/lang/src/macros.rs b/lang/src/macros.rs index ccdef93ce..bf90de803 100644 --- a/lang/src/macros.rs +++ b/lang/src/macros.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT /// Return the hash of the format!("{}::{}", ::core::module_path!(), struct_name). /// Also, if field naming is provided, it will return the hash of the format!("{}::{}::{}", ::core::module_path!(), struct_name, field_name). diff --git a/lang/src/storage/mapping.rs b/lang/src/storage/mapping.rs index 548e5e67f..c22f8d23a 100644 --- a/lang/src/storage/mapping.rs +++ b/lang/src/storage/mapping.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use super::{ RawMapping, diff --git a/lang/src/storage/mod.rs b/lang/src/storage/mod.rs index 6a96c901d..50265f18c 100644 --- a/lang/src/storage/mod.rs +++ b/lang/src/storage/mod.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use core::marker::PhantomData; mod mapping; diff --git a/lang/src/storage/multi_mapping.rs b/lang/src/storage/multi_mapping.rs index fb123bd60..d5cdce940 100644 --- a/lang/src/storage/multi_mapping.rs +++ b/lang/src/storage/multi_mapping.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use super::{ RefGuard, diff --git a/lang/src/storage/raw_mapping.rs b/lang/src/storage/raw_mapping.rs index 396ffad59..5029cd68c 100644 --- a/lang/src/storage/raw_mapping.rs +++ b/lang/src/storage/raw_mapping.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use core::marker::PhantomData; use ink::{ diff --git a/lang/src/test_utils.rs b/lang/src/test_utils.rs index 7081bd1a0..99c10eabe 100644 --- a/lang/src/test_utils.rs +++ b/lang/src/test_utils.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use ink::env::hash::{ Blake2x256, diff --git a/lang/src/traits.rs b/lang/src/traits.rs index ab38b9aa2..0705f52be 100644 --- a/lang/src/traits.rs +++ b/lang/src/traits.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use ::ink::env::{ DefaultEnvironment, diff --git a/lang/src/utils/checkpoints.rs b/lang/src/utils/checkpoints.rs index 389197fe5..75aaec16b 100644 --- a/lang/src/utils/checkpoints.rs +++ b/lang/src/utils/checkpoints.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use ink::prelude::vec::Vec; diff --git a/lang/src/utils/crypto.rs b/lang/src/utils/crypto.rs index 9cd8c2b62..41cbe7adb 100644 --- a/lang/src/utils/crypto.rs +++ b/lang/src/utils/crypto.rs @@ -1,23 +1,6 @@ -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT use crate::traits::String; use ink::env::hash; diff --git a/lang/src/utils/mod.rs b/lang/src/utils/mod.rs index 46af1b0a6..30c47bdff 100644 --- a/lang/src/utils/mod.rs +++ b/lang/src/utils/mod.rs @@ -1,24 +1,6 @@ -// Copyright (c) 2023 Brushfam -// Copyright (c) 2012-2022 Supercolony -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the"Software"), -// to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright (c) 2012-2022 Supercolony. All Rights Reserved. +// Copyright (c) 2023 Brushfam. All Rights Reserved. +// SPDX-License-Identifier: MIT #[cfg(feature = "checkpoints")] pub mod checkpoints; diff --git a/tests/e2e/example_project_structure/lending_contract.tests.ts b/tests/e2e/example_project_structure/lending_contract.tests.ts index d1bdc3e50..99d48479c 100644 --- a/tests/e2e/example_project_structure/lending_contract.tests.ts +++ b/tests/e2e/example_project_structure/lending_contract.tests.ts @@ -181,20 +181,20 @@ describe('LENDING_CONTRACT', () => { price ) { // collateralToken approves amount of tokens for lending contact - await collateralToken.tx.approve(lendingContract.address, approveAmount) + await collateralToken.tx.increaseAllowance(lendingContract.address, approveAmount) // Allow collateral await lendingContract.withSigner(user).tx.allowCollateral(collateralToken.address) // user approves amount of tokens for lending contact - await borrowedToken.withSigner(user).tx.approve(lendingContract.address, approveAmount) + await borrowedToken.withSigner(user).tx.increaseAllowance(lendingContract.address, approveAmount) // Allow new asset await lendingContract.tx.allowAsset(borrowedToken.address) // Alice lends tokens into lending await lendingContract.withSigner(user).tx.lendAssets(borrowedToken.address, approveAmount) // user approves amount of tokens for lending contact - await borrowedToken.withSigner(user).tx.approve(lendingContract.address, approveAmount) + await borrowedToken.withSigner(user).tx.increaseAllowance(lendingContract.address, approveAmount) // Set the price of collateralToken for borrowedToken await lendingContract.withSigner(user).tx.setAssetPrice(collateralToken.address, borrowedToken.address, price) @@ -285,7 +285,7 @@ describe('LENDING_CONTRACT', () => { assert(alice_balance.gte(new BN(amount))) // Act - Stablecoin contract approves amount for lending contact - await stablecoin.tx.approve(lending.address, amount) + await stablecoin.tx.increaseAllowance(lending.address, amount) // Act - Allow stablecoin for lending await lending.tx.allowAsset(stablecoin.address) @@ -360,7 +360,7 @@ describe('LENDING_CONTRACT', () => { const amount = 100 // Act - Stablecoin contract approves amount for lending contact - await stablecoin.tx.approve(lending.address, amount) + await stablecoin.tx.increaseAllowance(lending.address, amount) // Act - Allow stablecoin for lending await lending.tx.allowAsset(stablecoin.address) // Act - Alice lends the amount of stablecoin tokens diff --git a/tests/e2e/upgradeablity/diamond.tests.ts b/tests/e2e/upgradeablity/diamond.tests.ts index ff72a616a..14ecf831a 100644 --- a/tests/e2e/upgradeablity/diamond.tests.ts +++ b/tests/e2e/upgradeablity/diamond.tests.ts @@ -553,7 +553,7 @@ describe('DIAMOND_PSP22', () => { await expect(diamondCaller.query.balanceOf(diamondContract.address, defaultSigner.address)).to.bnToNumber(1000) // we will give allowance to caller contract - await proxy.withSigner(defaultSigner).tx.approve(diamondCaller.address, 1000) + await proxy.withSigner(defaultSigner).tx.increaseAllowance(diamondCaller.address, 1000) // calling transfer via diamondCaller should transfer balance await expect(diamondCaller.withSigner(defaultSigner).tx.transfer(diamondContract.address, alice.address, 1000)).to.eventually.be.fulfilled diff --git a/tests/ownable.rs b/tests/ownable.rs index e89ab67b5..659664614 100644 --- a/tests/ownable.rs +++ b/tests/ownable.rs @@ -133,7 +133,7 @@ mod ownable { let creator = Ownable::owner(&mut my_ownable); assert_eq!(creator, Some(caller)); let new_owner = AccountId::from([5u8; 32]); - assert!(Ownable::transfer_ownership(&mut my_ownable, new_owner).is_ok()); + assert!(Ownable::transfer_ownership(&mut my_ownable, Some(new_owner)).is_ok()); assert_eq!(Ownable::owner(&mut my_ownable), Some(new_owner)); let emitted_events = ink::env::test::recorded_events().collect::>(); assert_eq!(2, emitted_events.len()); @@ -148,7 +148,7 @@ mod ownable { change_caller(AccountId::from([0x13; 32])); let new_owner = AccountId::from([5u8; 32]); assert_eq!( - Ownable::transfer_ownership(&mut my_ownable, new_owner), + Ownable::transfer_ownership(&mut my_ownable, Some(new_owner)), Err(OwnableError::CallerIsNotOwner) ); } diff --git a/tests/payment_splitter.rs b/tests/payment_splitter.rs index bc3f50c2c..1b4478523 100644 --- a/tests/payment_splitter.rs +++ b/tests/payment_splitter.rs @@ -242,34 +242,6 @@ mod payment_splitter { ); } - #[ink::test] - fn correct_release_all() { - let accounts = accounts(); - let mut instance = MySplitter::new(vec![(accounts.charlie, 100), (accounts.bob, 200)]); - ink::env::test::set_account_balance::(accounts.charlie, 0); - ink::env::test::set_account_balance::(accounts.bob, 0); - let amount = 1000000; - add_funds(instance.env().account_id(), amount); - - assert_eq!(100 + 200, PaymentSplitter::total_shares(&mut instance,)); - assert!(payment_splitter::Internal::_release_all(&mut instance,).is_ok()); - assert_eq!(999999, PaymentSplitter::total_released(&mut instance,)); - assert_eq!(333333, PaymentSplitter::released(&mut instance, accounts.charlie)); - assert_eq!( - 333333, - ink::env::test::get_account_balance::(accounts.charlie).unwrap() - ); - assert_eq!(2 * 333333, PaymentSplitter::released(&mut instance, accounts.bob)); - assert_eq!( - 2 * 333333, - ink::env::test::get_account_balance::(accounts.bob).unwrap() - ); - - let emitted_events = ink::env::test::recorded_events().collect::>(); - assert_payment_released_event(&emitted_events[2], accounts.charlie, 333333); - assert_payment_released_event(&emitted_events[3], accounts.bob, 2 * 333333); - } - fn add_funds(account: AccountId, amount: Balance) { let balance = ink::env::balance::(); ink::env::test::set_account_balance::(account, balance + amount); diff --git a/tests/psp22.rs b/tests/psp22.rs index bd527e033..851291dbc 100644 --- a/tests/psp22.rs +++ b/tests/psp22.rs @@ -89,7 +89,7 @@ mod psp22_test { }); } - #[overrider(psp22::Internal)] + #[overrider(psp22::PSP22Transfer)] fn _before_token_transfer( &mut self, _from: Option<&AccountId>, @@ -102,7 +102,7 @@ mod psp22_test { Ok(()) } - #[overrider(psp22::Internal)] + #[overrider(psp22::PSP22Transfer)] fn _after_token_transfer( &mut self, _from: Option<&AccountId>, @@ -278,7 +278,7 @@ mod psp22_test { let accounts = accounts(); // Alice approves Bob for token transfers on her behalf. - assert!(PSP22::approve(&mut psp22, accounts.bob, 10).is_ok()); + assert!(PSP22::increase_allowance(&mut psp22, accounts.bob, 10).is_ok()); // The approve event takes place. assert_eq!(ink::env::test::recorded_events().count(), 2); @@ -312,7 +312,7 @@ mod psp22_test { // Alice approves Bob for token transfers on her behalf. let alice_balance = PSP22::balance_of(&psp22, accounts.alice); let initial_allowance = alice_balance + 2; - assert!(PSP22::approve(&mut psp22, accounts.bob, initial_allowance).is_ok()); + assert!(PSP22::increase_allowance(&mut psp22, accounts.bob, initial_allowance).is_ok()); change_caller(accounts.bob); assert_eq!( diff --git a/tests/psp22_burnable.rs b/tests/psp22_burnable.rs index 4b275adf6..68cbc9538 100644 --- a/tests/psp22_burnable.rs +++ b/tests/psp22_burnable.rs @@ -69,7 +69,7 @@ mod psp22_burnable { }); } - #[overrider(psp22::Internal)] + #[overrider(psp22::PSP22Transfer)] fn _before_token_transfer( &mut self, _from: Option<&AccountId>, @@ -82,7 +82,7 @@ mod psp22_burnable { Ok(()) } - #[overrider(psp22::Internal)] + #[overrider(psp22::PSP22Transfer)] fn _after_token_transfer( &mut self, _from: Option<&AccountId>, diff --git a/tests/psp22_flashmint.rs b/tests/psp22_flashmint.rs index 9a0d69419..c175afa32 100644 --- a/tests/psp22_flashmint.rs +++ b/tests/psp22_flashmint.rs @@ -100,7 +100,7 @@ mod psp22_flashmint { let loan_amount = 100; let fee = flashmint::Internal::_get_fee(&instance, loan_amount); - assert!(PSP22::approve(&mut instance, token, loan_amount + fee).is_ok()); + assert!(PSP22::increase_allowance(&mut instance, token, loan_amount + fee).is_ok()); assert!(FlashLender::flashloan(&mut instance, receiver, token, loan_amount, Vec::::new()).is_ok()); assert_eq!(PSP22::total_supply(&instance), total_supply - fee); assert_eq!(PSP22::balance_of(&instance, accounts().alice), total_supply - fee); diff --git a/tests/psp22_mintable.rs b/tests/psp22_mintable.rs index 754ee7ab1..332d54d2e 100644 --- a/tests/psp22_mintable.rs +++ b/tests/psp22_mintable.rs @@ -68,7 +68,7 @@ mod psp22_mintable { }); } - #[overrider(psp22::Internal)] + #[overrider(psp22::PSP22Transfer)] fn _before_token_transfer( &mut self, _from: Option<&AccountId>, @@ -81,7 +81,7 @@ mod psp22_mintable { Ok(()) } - #[overrider(psp22::Internal)] + #[overrider(psp22::PSP22Transfer)] fn _after_token_transfer( &mut self, _from: Option<&AccountId>, diff --git a/tests/psp22_wrapper.rs b/tests/psp22_wrapper.rs index aa83df335..8fd736230 100644 --- a/tests/psp22_wrapper.rs +++ b/tests/psp22_wrapper.rs @@ -79,12 +79,12 @@ mod psp22_wrapper { #[ink::test] fn deposit_for_works() { let accounts = accounts(); - let mut wrapper = PSP22WrapperStruct::new(AccountId::from([0x1; 32])); + let mut wrapper = PSP22WrapperStruct::new(AccountId::from([0x0; 32])); assert_eq!(PSP22::balance_of(&mut wrapper, accounts.alice), 0); assert_eq!(PSP22::total_supply(&mut wrapper), 0); - assert!(PSP22Wrapper::deposit_for(&mut wrapper, accounts.alice, 100).is_ok()); + assert_eq!(PSP22Wrapper::deposit_for(&mut wrapper, accounts.alice, 100), Ok(())); assert_eq!(PSP22::balance_of(&mut wrapper, accounts.alice), 100); assert_eq!(PSP22::total_supply(&mut wrapper), 100); @@ -93,9 +93,9 @@ mod psp22_wrapper { #[ink::test] fn withdraw_to_works() { let accounts = accounts(); - let mut wrapper = PSP22WrapperStruct::new(AccountId::from([0x1; 32])); + let mut wrapper = PSP22WrapperStruct::new(AccountId::from([0x0; 32])); - assert!(PSP22Wrapper::deposit_for(&mut wrapper, accounts.alice, 100).is_ok()); + assert_eq!(PSP22Wrapper::deposit_for(&mut wrapper, accounts.alice, 100), Ok(())); assert_eq!(PSP22::balance_of(&mut wrapper, accounts.alice), 100); assert_eq!(PSP22::total_supply(&mut wrapper), 100); assert!(PSP22Wrapper::withdraw_to(&mut wrapper, accounts.alice, 100).is_ok()); @@ -107,9 +107,9 @@ mod psp22_wrapper { #[ink::test] fn recover_works() { let accounts = accounts(); - let mut wrapper = PSP22WrapperStruct::new(AccountId::from([0x1; 32])); + let mut wrapper = PSP22WrapperStruct::new(AccountId::from([0x0; 32])); - assert!(PSP22Wrapper::deposit_for(&mut wrapper, accounts.alice, 100).is_ok()); + assert_eq!(PSP22Wrapper::deposit_for(&mut wrapper, accounts.alice, 100), Ok(())); assert!(wrapper.burn(100).is_ok()); assert_eq!(PSP22::balance_of(&mut wrapper, accounts.alice), 0); assert_eq!(PSP22::total_supply(&mut wrapper), 0);