jtriley-eth / erc6909-examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example Implementations For ERC-6909

TODO: write tests lol

Wraps ERC-20, ERC-721, and ERC-1155 tokens under a single unified contract.

flowchart TD
    %% -- AnyWrapper --

    AnyWrapper --> ERC20
    ERC20 --> id0{Token ID:\naddress}
    id0 --> bn([balanceOf])
    id0 --> an([allowance])
    id0 --> tsn([totalSupply])
    id0 --> dn([decimals])

    AnyWrapper --> ERC721
    ERC721 --> idn1{"Token ID:\n hash(address + id )"}
    idn1 --> balanceOf1([balanceOf])
    idn1 --> allowance1([allowance])
    idn1 --> total_supply1([totalSupply])
    idn1 --> decimals1([decimals])

    AnyWrapper --> ERC1155
    ERC1155 --> idn2{"Token ID:\n hash(address + id )"}
    idn2 --> balanceOf([balanceOf])
    idn2 --> allowance([allowance])
    idn2 --> total_supply([totalSupply])
    idn2 --> decimals([decimals])
Loading

Maintains multiple fungible and non-fungible game assets at fixed swap rates.

Item / Currency Heirarchy

flowchart TD
    %% -- In Game Items --
    mainCurrency[Main Currency\nid: 0] --> sc0[Sub Currency\nid: 1]
    mainCurrency --> it0[Game Item\nid: 2]
    mainCurrency --> it1[Game Item\nid: 3]
Loading

Admin System

flowchart TD
    a[Admin]
    ps[Price Setter]
    sh[Supply Handler]
    s[Supply]
    p[Price]

    a --> ps
    a --> sh
    a --> s
    a --> p

    ps --> p
    sh --> s
Loading

Transfer Helper Library

API:

Transfer an amount of an id on an erc6909 contract to the receiver from the current address.

function transfer(
    address erc6909,
    address receiver,
    uint256 id,
    uint256 amount
);

Transfer an amount of an id on an erc6909 contract from the sender to the receiver.

function transferFrom(
    address erc6909,
    address sender,
    address receiver,
    uint256 id,
    uint256 amount
);

About


Languages

Language:Solidity 100.0%