Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
8051a84
add initial files
onurinanc Jun 5, 2025
a6a3be9
implement erc6909 add one mint test
onurinanc Jun 5, 2025
d0ee57e
complete erc6909 unit tests
onurinanc Jun 6, 2025
58c07e5
finish supply extension and related motsu tests
onurinanc Jun 6, 2025
4140384
remove redundant
onurinanc Jun 9, 2025
5b45733
add Erc6909Example and Erc6909TokenSupplyExample
onurinanc Jun 9, 2025
b56e569
fmt
onurinanc Jun 9, 2025
513781c
add abi for erc6909 and erc6909-supply example and a mint test
onurinanc Jun 9, 2025
6463d84
fix mint test and add mints_invalid_receiver
onurinanc Jun 9, 2025
de57e8d
typo name
onurinanc Jun 9, 2025
e6761f5
complete erc6909 integration tests
onurinanc Jun 9, 2025
058c82d
add erc6909-supply integrations tests
onurinanc Jun 9, 2025
d859809
add comment & fmt all
onurinanc Jun 9, 2025
6781c92
fix errors
onurinanc Jun 9, 2025
dfe4e7f
fix
onurinanc Jun 9, 2025
de65d99
fix tests
onurinanc Jun 9, 2025
c0f55d5
fix test
onurinanc Jun 9, 2025
e395d59
fix erc6909-supply tests
onurinanc Jun 9, 2025
d354361
fix
onurinanc Jun 9, 2025
4c7fdb2
fix test
onurinanc Jun 9, 2025
23b6d83
add bench for erc6909
onurinanc Jun 9, 2025
976569b
add bench for erc6909 token supply
onurinanc Jun 9, 2025
fdadc2a
update cargo for CI
onurinanc Aug 7, 2025
e09cc02
Merge branch 'main' into feature/ERC6909
bidzyyys Aug 7, 2025
e05e7d0
apply requested changes
onurinanc Aug 7, 2025
a2e3fcd
merge changelog
onurinanc Aug 7, 2025
25220f1
fmt
onurinanc Aug 7, 2025
0b6266f
change FixedBytes<4> to B32
onurinanc Aug 7, 2025
d80ea4a
fix ancora
onurinanc Aug 7, 2025
2bd8e3a
add a test case covering ERC6909InvalidReceiver
onurinanc Aug 13, 2025
7f5926c
fix CHANGELOG
onurinanc Aug 13, 2025
13bbd20
update ERC-6909 ancora
onurinanc Aug 13, 2025
a509961
fmt
onurinanc Aug 13, 2025
1faf35e
remove unnecessary files
onurinanc Aug 13, 2025
2801d86
fix erc6909 ancora
onurinanc Aug 13, 2025
d2c0d06
Merge branch 'main' into feature/ERC6909
bidzyyys Aug 20, 2025
6f2df5c
Merge branch 'main' into feature/ERC6909
bidzyyys Sep 2, 2025
c60c89d
Merge branch 'main' into feature/ERC6909
bidzyyys Nov 6, 2025
ea7ae4a
Merge branch 'main' into feature/ERC6909
bidzyyys Nov 6, 2025
a2d792f
fix clippy lints
qalisander Nov 11, 2025
831732b
remove unused imports
qalisander Nov 11, 2025
a4fb409
fix clippy lints
qalisander Nov 11, 2025
7dc0876
Merge remote-tracking branch 'origin/main' into feature/ERC6909
qalisander Nov 18, 2025
33a8a94
update documentation link
qalisander Nov 18, 2025
a1f3486
exclude method error from codecov
qalisander Nov 19, 2025
e57db14
update docs of token_supply
qalisander Nov 19, 2025
8e3b527
add llm mcp generated unit tests
qalisander Nov 19, 2025
335102a
fix mints_rejects_overflow test
qalisander Nov 20, 2025
813831b
Merge remote-tracking branch 'origin/main' into feature/ERC6909
qalisander Nov 25, 2025
04440c5
revert Cargo.lock
qalisander Nov 26, 2025
9c7ebe6
ref: apply suggestions from code review
bidzyyys Nov 26, 2025
01b7f68
update erc6909 docs
qalisander Nov 27, 2025
8713f1a
use 0.3.0 version for ERC6909 docs
qalisander Nov 27, 2025
9dd9798
update erc6909.adoc example
qalisander Nov 27, 2025
d6bfec3
update styling and docs
qalisander Nov 27, 2025
48933ef
add panic check for _update function and related panic docs
qalisander Nov 27, 2025
48c23f9
add link to ERC-6909 standard
qalisander Nov 27, 2025
ea1619e
remove unused import
qalisander Nov 27, 2025
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- **Erc6909**: `Erc6909` contract and `Erc6909TokenSupply` extension. #777

### Changed (Breaking)

- `IErc721Wrapper` returns `Vec<u8>` instead of typed `Error`. #822
Expand Down
26 changes: 26 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ members = [
"examples/erc1155-metadata-uri",
"examples/erc1155-supply",
"examples/erc4626",
"examples/erc6909",
"examples/erc6909-supply",
"examples/safe-erc20",
"examples/merkle-proofs",
"examples/ownable",
Expand Down Expand Up @@ -62,6 +64,8 @@ default-members = [
"examples/erc1155-metadata-uri",
"examples/erc1155-supply",
"examples/erc4626",
"examples/erc6909",
"examples/erc6909-supply",
"examples/safe-erc20",
"examples/merkle-proofs",
"examples/ownable",
Expand Down
84 changes: 84 additions & 0 deletions benches/src/erc6909.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
use alloy::{
network::{AnyNetwork, EthereumWallet},
primitives::Address,
providers::ProviderBuilder,
sol,
sol_types::SolCall,
uint,
};
use e2e::{receipt, Account};

use crate::{
report::{ContractReport, FunctionReport},
Opt,
};

sol!(
#[sol(rpc)]
contract Erc6909 {
function balanceOf(address owner, uint256 id) external view returns (uint256 balance);
function allowance(address owner, address spender, uint256 id) external view returns (uint256 allowance);
function isOperator(address owner, address spender) external view returns (bool approved);
function approve(address spender, uint256 id, uint256 amount) external returns (bool);
function setOperator(address spender, bool approved) external returns (bool);
function transfer(address receiver, uint256 id, uint256 amount) external returns (bool);
function transferFrom(address sender, address receiver, uint256 id, uint256 amount) external returns (bool);
function mint(address to, uint256 id, uint256 amount) external;
function burn(address from, uint256 id, uint256 amount) external;
}
);

pub async fn bench() -> eyre::Result<ContractReport> {
ContractReport::generate("Erc6909", run).await
}

pub async fn run(cache_opt: Opt) -> eyre::Result<Vec<FunctionReport>> {
let alice = Account::new().await?;
let alice_addr = alice.address();
let alice_wallet = ProviderBuilder::new()
.network::<AnyNetwork>()
.with_recommended_fillers()
.wallet(EthereumWallet::from(alice.signer.clone()))
.on_http(alice.url().parse()?);

let bob = Account::new().await?;
let bob_addr = bob.address();
let bob_wallet = ProviderBuilder::new()
.network::<AnyNetwork>()
.with_recommended_fillers()
.wallet(EthereumWallet::from(bob.signer.clone()))
.on_http(bob.url().parse()?);

let contract_addr = deploy(&alice, cache_opt).await?;

let contract = Erc6909::new(contract_addr, &alice_wallet);
let contract_bob = Erc6909::new(contract_addr, &bob_wallet);

let token_id = uint!(1_U256);
let amount = uint!(100_U256);
let one = uint!(1_U256);

// IMPORTANT: Order matters!
use Erc6909::*;
#[rustfmt::skip]
let receipts = vec![
(mintCall::SIGNATURE, receipt!(contract.mint(alice_addr, token_id, amount))?),
(balanceOfCall::SIGNATURE, receipt!(contract.balanceOf(alice_addr, token_id))?),
(allowanceCall::SIGNATURE, receipt!(contract.allowance(alice_addr, bob_addr, token_id))?),
(isOperatorCall::SIGNATURE, receipt!(contract.isOperator(alice_addr, bob_addr))?),
(setOperatorCall::SIGNATURE, receipt!(contract.setOperator(bob_addr, true))?),
(transferCall::SIGNATURE, receipt!(contract.transfer(bob_addr, token_id, one))?),
(approveCall::SIGNATURE, receipt!(contract.approve(bob_addr, token_id, one))?),
(transferFromCall::SIGNATURE, receipt!(contract_bob.transferFrom(alice_addr, bob_addr, token_id, one))?),
(burnCall::SIGNATURE, receipt!(contract.burn(alice_addr, token_id, one))?),
];

receipts
.into_iter()
.map(FunctionReport::new)
.collect::<eyre::Result<Vec<_>>>()
}

async fn deploy(account: &Account, cache_opt: Opt) -> eyre::Result<Address> {
crate::deploy(account, "erc6909", None, cache_opt).await
}
62 changes: 62 additions & 0 deletions benches/src/erc6909_supply.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
use alloy::{
network::{AnyNetwork, EthereumWallet},
primitives::Address,
providers::ProviderBuilder,
sol,
sol_types::SolCall,
uint,
};
use e2e::{receipt, Account};

use crate::{
report::{ContractReport, FunctionReport},
Opt,
};

sol!(
#[sol(rpc)]
contract Erc6909TokenSupply {
function totalSupply(uint256 id) external view returns (uint256 totalSupply);
function mint(address to, uint256 id, uint256 amount) external;
function burn(address from, uint256 id, uint256 amount) external;
}
);

pub async fn bench() -> eyre::Result<ContractReport> {
ContractReport::generate("Erc6909TokenSupply", run).await
}

pub async fn run(cache_opt: Opt) -> eyre::Result<Vec<FunctionReport>> {
let alice = Account::new().await?;
let alice_addr = alice.address();
let alice_wallet = ProviderBuilder::new()
.network::<AnyNetwork>()
.with_recommended_fillers()
.wallet(EthereumWallet::from(alice.signer.clone()))
.on_http(alice.url().parse()?);

let contract_addr = deploy(&alice, cache_opt).await?;

let contract = Erc6909TokenSupply::new(contract_addr, &alice_wallet);

let token_id = uint!(1_U256);
let amount = uint!(100_U256);

// IMPORTANT: Order matters!
use Erc6909TokenSupply::*;
#[rustfmt::skip]
let receipts = vec![
(mintCall::SIGNATURE, receipt!(contract.mint(alice_addr, token_id, amount))?),
(totalSupplyCall::SIGNATURE, receipt!(contract.totalSupply(token_id))?),
(burnCall::SIGNATURE, receipt!(contract.burn(alice_addr, token_id, amount))?),
];

receipts
.into_iter()
.map(FunctionReport::new)
.collect::<eyre::Result<Vec<_>>>()
}

async fn deploy(account: &Account, cache_opt: Opt) -> eyre::Result<Address> {
crate::deploy(account, "erc6909-supply", None, cache_opt).await
}
2 changes: 2 additions & 0 deletions benches/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pub mod erc1155;
pub mod erc1155_metadata_uri;
pub mod erc1155_supply;
pub mod erc20;
pub mod erc6909;
pub mod erc6909_supply;
pub mod erc721;
pub mod merkle_proofs;
pub mod ownable;
Expand Down
8 changes: 5 additions & 3 deletions benches/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use benches::{
access_control, eddsa, erc1155, erc1155_metadata_uri, erc20, erc721,
merkle_proofs, ownable, pedersen, poseidon, poseidon_asm_sol, poseidon_sol,
report::BenchmarkReport,
access_control, eddsa, erc1155, erc1155_metadata_uri, erc20, erc6909,
erc6909_supply, erc721, merkle_proofs, ownable, pedersen, poseidon,
poseidon_asm_sol, poseidon_sol, report::BenchmarkReport,
};
use futures::FutureExt;
use itertools::Itertools;
Expand All @@ -16,6 +16,8 @@ async fn main() -> eyre::Result<()> {
ownable::bench().boxed(),
erc1155::bench().boxed(),
erc1155_metadata_uri::bench().boxed(),
erc6909::bench().boxed(),
erc6909_supply::bench().boxed(),
pedersen::bench().boxed(),
poseidon_sol::bench().boxed(),
poseidon_asm_sol::bench().boxed(),
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/token/erc1155/extensions/supply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl Erc1155Supply {
/// # Panics
///
/// * If updated balance and/or supply exceeds [`U256::MAX`], may happen
/// during the `mint` operation.
/// during the [`Self::_mint`] operation.
fn _update(
&mut self,
from: Address,
Expand Down
4 changes: 4 additions & 0 deletions contracts/src/token/erc6909/extensions/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//! Common extensions to the ERC-6909 standard.
pub mod token_supply;

pub use token_supply::{Erc6909TokenSupply, IErc6909TokenSupply};
Loading
Loading