feat: update non-token contracts to SDK v0.9#659
feat: update non-token contracts to SDK v0.9#6590xNeshi merged 42 commits intosdk-v0.9-and-ctorsfrom
Conversation
| } | ||
|
|
||
| #[public] | ||
| #[implements(IOwnable2Step<Error = ownable::Error>, IErc165)] |
There was a problem hiding this comment.
Based on Solidity Ownable2Step is Ownable and with some features.
I think we should implement both IOwnable and change IOwnable2Step.
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.3.0/contracts/access/Ownable2Step.sol
There was a problem hiding this comment.
IMHO you should remove all the fns from IOwnable2Step trait that exist in IOwnable trait and apply #[implements(IOwnable2Step<Error = ownable::Error>, IOwnable<Error = ownable::Error>, IErc165)]
There was a problem hiding this comment.
This is the same situation as for IVestingWallet:
The problem with that is that devs who inherit
IVestingWalletmight forget to inheritIOwnabletoo.What you suggested would be the right approach if it were possible to define:
pub trait IVestingWallet: IOwnable
Until the above is possible, IOwnable2Step should include IOwnable functions
|
|
||
| #[public] | ||
| #[inherit(Erc20, Ownable2Step)] | ||
| #[implements(IErc20<Error = Error>, IOwnable2Step<Error = Error>)] |
There was a problem hiding this comment.
Based on my previous comment, it should implement also IOwnable trait.
There was a problem hiding this comment.
We should do that once IOwnable2Step can be defined as:
pub trait IOwnable2Step: IOwnable {
// we should remove IOwnable function definitions from this trait now
}Until then, we have this issue
There was a problem hiding this comment.
Should implement both IOwnable and IOwnable2Step traits. You should remove fns from IOwnable2Step that exist in IOwnable trait IMHO.
There was a problem hiding this comment.
What is there to be gained by it? It would just duplicate functions existing in IVestingWallet.
It will make sense to implement IOwnable once this is addressed
examples/ownable-two-step/src/lib.rs
Outdated
| from: Address, | ||
| to: Address, | ||
| value: U256, | ||
| ) -> Result<bool, <Self as IErc20>::Error> { |
There was a problem hiding this comment.
Why not using just Error?
Applies to all examples.
There was a problem hiding this comment.
It works as per your suggestion.
I was just playing around, reverted all <Self as Interface>::Error back to Self::Error - cargo stylus export-abi and cargo check --features export-abi now works 🤔
There was a problem hiding this comment.
We should check if we can revert this in traits before final merge into branch v0.2
|
|
||
| #[public] | ||
| #[inherit(VestingWallet)] | ||
| #[implements(IVestingWallet<Error = vesting_wallet::Error>)] |
There was a problem hiding this comment.
Based on my previous comment, it should implement also IOwnable trait.
There was a problem hiding this comment.
What is there to be gained by it? It would just duplicate functions existing in IVestingWallet.
It will make sense to implement IOwnable once this is addressed
|
|
||
| #[public] | ||
| #[inherit(Erc20, Ownable2Step)] | ||
| #[implements(IErc20<Error = Error>, IOwnable2Step<Error = Error>)] |
There was a problem hiding this comment.
Should implement both IOwnable and IOwnable2Step traits. You should remove fns from IOwnable2Step that exist in IOwnable trait IMHO.
|
|
||
| #[public] | ||
| #[inherit(VestingWallet)] | ||
| #[implements(IVestingWallet<Error = vesting_wallet::Error>)] |
bidzyyys
left a comment
There was a problem hiding this comment.
Left an approval in advance.
a57031f to
5b64a55
Compare
No description provided.