Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ TokenStream:

#[starknet::contract]
pub mod ERC4626Mock {
use openzeppelin_token::erc20::ERC20HooksEmptyImpl;
use openzeppelin_token::erc20::extensions::erc4626::{
DefaultConfig, ERC4626DefaultNoFees, ERC4626DefaultNoLimits, ERC4626EmptyHooks,
ERC4626SelfAssetsManagement,
};
use openzeppelin_token::erc20::{DefaultConfig as ERC20DefaultConfig, ERC20HooksEmptyImpl};
use starknet::ContractAddress;

// ERC4626
Expand Down Expand Up @@ -70,14 +70,7 @@ pub mod ERC4626Mock {

Diagnostics:

====
Warning: The ERC20 component requires an ImmutableConfig implementation in scope and
it looks like it is missing.

You can use the default implementation by importing it:

`use openzeppelin_token::erc20::DefaultConfig;`
====
None

AuxData:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
source: src/tests/test_with_components.rs
expression: result
snapshot_kind: text
---
TokenStream:

#[starknet::contract]
pub mod ERC4626Mock {
use openzeppelin_token::erc20::extensions::erc4626::{
DefaultConfig, ERC4626DefaultNoFees, ERC4626DefaultNoLimits, ERC4626EmptyHooks,
};
use openzeppelin_token::erc20::{DefaultConfig as ERC20DefaultConfig, ERC20HooksEmptyImpl};
use starknet::ContractAddress;

// ERC4626
#[abi(embed_v0)]
impl ERC4626ComponentImpl = ERC4626Component::ERC4626Impl<ContractState>;
// ERC4626MetadataImpl is a custom impl of IERC20Metadata
#[abi(embed_v0)]
impl ERC4626MetadataImpl = ERC4626Component::ERC4626MetadataImpl<ContractState>;

// ERC20
#[abi(embed_v0)]
impl ERC20Impl = ERC20Component::ERC20Impl<ContractState>;
#[abi(embed_v0)]
impl ERC20CamelOnlyImpl = ERC20Component::ERC20CamelOnlyImpl<ContractState>;

#[storage]
pub struct Storage {
#[substorage(v0)]
pub erc20: ERC20Component::Storage,
#[substorage(v0)]
pub erc4626: ERC4626Component::Storage,
}

#[constructor]
fn constructor(
ref self: ContractState,
name: ByteArray,
symbol: ByteArray,
underlying_asset: ContractAddress,
initial_supply: u256,
recipient: ContractAddress,
) {
self.erc20.initializer(name, symbol);
self.erc20.mint(recipient, initial_supply);
self.erc4626.initializer(underlying_asset);
}
use openzeppelin_token::erc20::ERC20Component;
use openzeppelin_token::erc20::extensions::erc4626::ERC4626Component;

component!(path: ERC20Component, storage: erc20, event: ERC20Event);
component!(path: ERC4626Component, storage: erc4626, event: ERC4626Event);

impl ERC20InternalImpl = ERC20Component::InternalImpl<ContractState>;
impl ERC4626InternalImpl = ERC4626Component::InternalImpl<ContractState>;

#[event]
#[derive(Drop, starknet::Event)]
enum Event {
#[flat]
ERC20Event: ERC20Component::Event,
#[flat]
ERC4626Event: ERC4626Component::Event,
}
}


Diagnostics:

====
Warning: The ERC4626 component requires an implementation of the AssetsManagementTrait in scope and
it looks like it is missing.

You can use the ERC4626SelfAssetsManagement implementation by importing it:

`use openzeppelin_token::erc20::extensions::erc4626::ERC4626SelfAssetsManagement;`
====

AuxData:

None
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
source: src/tests/test_with_components.rs
expression: result
snapshot_kind: text
---
TokenStream:

#[starknet::contract]
pub mod ERC4626Mock {
use openzeppelin_token::erc20::extensions::erc4626::{
ERC4626DefaultNoFees, ERC4626DefaultNoLimits, ERC4626EmptyHooks,
ERC4626SelfAssetsManagement,
};
use openzeppelin_token::erc20::{DefaultConfig as ERC20DefaultConfig, ERC20HooksEmptyImpl};
use starknet::ContractAddress;

// ERC4626
#[abi(embed_v0)]
impl ERC4626ComponentImpl = ERC4626Component::ERC4626Impl<ContractState>;
// ERC4626MetadataImpl is a custom impl of IERC20Metadata
#[abi(embed_v0)]
impl ERC4626MetadataImpl = ERC4626Component::ERC4626MetadataImpl<ContractState>;

// ERC20
#[abi(embed_v0)]
impl ERC20Impl = ERC20Component::ERC20Impl<ContractState>;
#[abi(embed_v0)]
impl ERC20CamelOnlyImpl = ERC20Component::ERC20CamelOnlyImpl<ContractState>;

#[storage]
pub struct Storage {
#[substorage(v0)]
pub erc20: ERC20Component::Storage,
#[substorage(v0)]
pub erc4626: ERC4626Component::Storage,
}

#[constructor]
fn constructor(
ref self: ContractState,
name: ByteArray,
symbol: ByteArray,
underlying_asset: ContractAddress,
initial_supply: u256,
recipient: ContractAddress,
) {
self.erc20.initializer(name, symbol);
self.erc20.mint(recipient, initial_supply);
self.erc4626.initializer(underlying_asset);
}
use openzeppelin_token::erc20::ERC20Component;
use openzeppelin_token::erc20::extensions::erc4626::ERC4626Component;

component!(path: ERC20Component, storage: erc20, event: ERC20Event);
component!(path: ERC4626Component, storage: erc4626, event: ERC4626Event);

impl ERC20InternalImpl = ERC20Component::InternalImpl<ContractState>;
impl ERC4626InternalImpl = ERC4626Component::InternalImpl<ContractState>;

#[event]
#[derive(Drop, starknet::Event)]
enum Event {
#[flat]
ERC20Event: ERC20Component::Event,
#[flat]
ERC4626Event: ERC4626Component::Event,
}
}


Diagnostics:

====
Warning: The ERC4626 component requires an ImmutableConfig implementation in scope and
it looks like it is missing.

You can use the default implementation by importing it:

`use openzeppelin_token::erc20::extensions::erc4626::DefaultConfig;`
====

AuxData:

None
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
source: src/tests/test_with_components.rs
expression: result
snapshot_kind: text
---
TokenStream:

#[starknet::contract]
pub mod ERC4626Mock {
use openzeppelin_token::erc20::extensions::erc4626::{
DefaultConfig, ERC4626DefaultNoLimits, ERC4626EmptyHooks, ERC4626SelfAssetsManagement,
};
use openzeppelin_token::erc20::{DefaultConfig as ERC20DefaultConfig, ERC20HooksEmptyImpl};
use starknet::ContractAddress;

// ERC4626
#[abi(embed_v0)]
impl ERC4626ComponentImpl = ERC4626Component::ERC4626Impl<ContractState>;
// ERC4626MetadataImpl is a custom impl of IERC20Metadata
#[abi(embed_v0)]
impl ERC4626MetadataImpl = ERC4626Component::ERC4626MetadataImpl<ContractState>;

// ERC20
#[abi(embed_v0)]
impl ERC20Impl = ERC20Component::ERC20Impl<ContractState>;
#[abi(embed_v0)]
impl ERC20CamelOnlyImpl = ERC20Component::ERC20CamelOnlyImpl<ContractState>;

#[storage]
pub struct Storage {
#[substorage(v0)]
pub erc20: ERC20Component::Storage,
#[substorage(v0)]
pub erc4626: ERC4626Component::Storage,
}

#[constructor]
fn constructor(
ref self: ContractState,
name: ByteArray,
symbol: ByteArray,
underlying_asset: ContractAddress,
initial_supply: u256,
recipient: ContractAddress,
) {
self.erc20.initializer(name, symbol);
self.erc20.mint(recipient, initial_supply);
self.erc4626.initializer(underlying_asset);
}
use openzeppelin_token::erc20::ERC20Component;
use openzeppelin_token::erc20::extensions::erc4626::ERC4626Component;

component!(path: ERC20Component, storage: erc20, event: ERC20Event);
component!(path: ERC4626Component, storage: erc4626, event: ERC4626Event);

impl ERC20InternalImpl = ERC20Component::InternalImpl<ContractState>;
impl ERC4626InternalImpl = ERC4626Component::InternalImpl<ContractState>;

#[event]
#[derive(Drop, starknet::Event)]
enum Event {
#[flat]
ERC20Event: ERC20Component::Event,
#[flat]
ERC4626Event: ERC4626Component::Event,
}
}


Diagnostics:

====
Warning: The ERC4626 component requires an implementation of the FeeConfigTrait in scope and
it looks like it is missing.

You can use the ERC4626DefaultNoFees implementation by importing it:

`use openzeppelin_token::erc20::extensions::erc4626::ERC4626DefaultNoFees;`
====

AuxData:

None
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
source: src/tests/test_with_components.rs
expression: result
snapshot_kind: text
---
TokenStream:

#[starknet::contract]
pub mod ERC4626Mock {
use openzeppelin_token::erc20::extensions::erc4626::{
DefaultConfig, ERC4626DefaultNoFees, ERC4626DefaultNoLimits, ERC4626SelfAssetsManagement,
};
use openzeppelin_token::erc20::{DefaultConfig as ERC20DefaultConfig, ERC20HooksEmptyImpl};
use starknet::ContractAddress;

// ERC4626
#[abi(embed_v0)]
impl ERC4626ComponentImpl = ERC4626Component::ERC4626Impl<ContractState>;
// ERC4626MetadataImpl is a custom impl of IERC20Metadata
#[abi(embed_v0)]
impl ERC4626MetadataImpl = ERC4626Component::ERC4626MetadataImpl<ContractState>;

// ERC20
#[abi(embed_v0)]
impl ERC20Impl = ERC20Component::ERC20Impl<ContractState>;
#[abi(embed_v0)]
impl ERC20CamelOnlyImpl = ERC20Component::ERC20CamelOnlyImpl<ContractState>;

#[storage]
pub struct Storage {
#[substorage(v0)]
pub erc20: ERC20Component::Storage,
#[substorage(v0)]
pub erc4626: ERC4626Component::Storage,
}

#[constructor]
fn constructor(
ref self: ContractState,
name: ByteArray,
symbol: ByteArray,
underlying_asset: ContractAddress,
initial_supply: u256,
recipient: ContractAddress,
) {
self.erc20.initializer(name, symbol);
self.erc20.mint(recipient, initial_supply);
self.erc4626.initializer(underlying_asset);
}
use openzeppelin_token::erc20::ERC20Component;
use openzeppelin_token::erc20::extensions::erc4626::ERC4626Component;

component!(path: ERC20Component, storage: erc20, event: ERC20Event);
component!(path: ERC4626Component, storage: erc4626, event: ERC4626Event);

impl ERC20InternalImpl = ERC20Component::InternalImpl<ContractState>;
impl ERC4626InternalImpl = ERC4626Component::InternalImpl<ContractState>;

#[event]
#[derive(Drop, starknet::Event)]
enum Event {
#[flat]
ERC20Event: ERC20Component::Event,
#[flat]
ERC4626Event: ERC4626Component::Event,
}
}


Diagnostics:

====
Warning: The ERC4626 component requires an implementation of the ERC4626HooksTrait in scope and
it looks like it is missing.

You can use the ERC4626EmptyHooks implementation by importing it:

`use openzeppelin_token::erc20::extensions::erc4626::ERC4626EmptyHooks;`
====

AuxData:

None
Loading