The COOP Credits Protocol implements a flexible and upgradeable ERC1155 token system designed for Coop Records credit management. It enables the creation, distribution, and redemption of credit tokens within the Coop Records ecosystem.
| Contract | Address | Transaction |
|---|---|---|
| Implementation | 0xeaa7e0a7b85ec3e78c87a622d8bf4f61c00de1dc |
View |
| Proxy Admin | 0xd641932fd14fef39af7458b29c968182ae3ce768 |
View |
| Proxy | 0x867dd6ac7a8c0bd56f3fa028397b7693c41e14e1 |
View |
Latest Update (Aug-18-2025): The contract implementation has been improved to add methods for purchasing coins with credits. It also fixes a bug in our Proxy upgrades allowing the Proxy to be upgraded via the
upgradeAndCallmethod on theProxyAdmincontract.
| Contract | Address | Transaction |
|---|---|---|
| Implementation | 0xf079fF3347FfAEF71AD06953C229F9D5810fca28 |
View |
| Proxy Admin | 0x57c2cd477300e7ec80974b28fa55e34589627cb5 |
View |
| Proxy | 0xB3dd782FCe60BCFBBEF1eaD56eF3a24a9c330A38 |
View |
Latest Update (Aug-18-2025): The contract implementation has been improved to add methods for purchasing coins with credits. It also fixes a bug in our Proxy upgrades allowing the Proxy to be upgraded via the
upgradeAndCallmethod on theProxyAdmincontract.
- ERC1155 Multi-Token Standard: Support for multiple credit types within a single contract
- Upgradeable Architecture: Uses OpenZeppelin's transparent proxy pattern for future improvements
- Role-Based Access Control: Granular permissions for minting, burning, and admin functions
- Market Integration: Built-in support for credit redemption through integrated market contracts
- Gas Optimized: Efficient implementation for cost-effective operations on L2 networks
graph TD
A[Credits1155 Proxy] --> B[Credits1155 Implementation]
B --> C[ERC1155Upgradeable]
B --> D[AccessControlUpgradeable]
A --> E[ProxyAdmin]
B --> F[Market Contract]
style A fill:#f9f,stroke:#333,stroke-width:2px
style B fill:#bbf,stroke:#333,stroke-width:2px
style E fill:#fdb,stroke:#333,stroke-width:2px
The protocol uses a proxy pattern for upgradeability, with clear separation of concerns between credit management and market integration. The Credits1155 contract inherits from OpenZeppelin's battle-tested implementations while adding custom functionality for credit management.
- Clone the repository:
git clone https://github.com/voicefirstai/CoopCreditsProtocol.git
cd CoopCreditsProtocol- Install dependencies:
# Install Foundry dependencies
forge install
# Install Node.js dependencies
pnpm install- Set up your environment:
# Copy the example environment file
cp .env.example .env
# Update .env with your configuration
# - Add your private key (from your wallet)
# - Set your market contract address
# - Configure your token URI
# - Add your Basescan API key- Build the contracts:
forge buildTo deploy the Credits Protocol to a network, you'll need to:
-
Configure your deployment environment in
.envfile: -
Run the deployment script:
# Using pnpm
pnpm run deploy-credits
# Or directly with Foundry
forge clean && forge script script/Deploy.s.sol:DeployCredits --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $BASESCAN_API_KEY -vvvv-
After deployment, take note of the following addresses:
- Implementation contract address
- Proxy Admin address
- Proxy contract address (this is the main address you'll interact with)
-
Update contract configuration (if needed):
- Set the fixed price sale strategy (only if not provided during initialization):
cast send <PROXY_ADDRESS> "setFixedPriceSaleStrategy(address)" <STRATEGY_ADDRESS> --rpc-url $RPC_URL --private-key $PRIVATE_KEY
- Set the fixed price sale strategy (only if not provided during initialization):
-
Verify deployment by testing core functionality:
- Buy credits:
cast send <PROXY_ADDRESS> "buyCredits(address,uint256)" <RECIPIENT_ADDRESS> <AMOUNT> --value <ETH_AMOUNT> --rpc-url $RPC_URL --private-key $PRIVATE_KEY
- Buy credits:
Run the test suite to verify contract functionality:
# Run all tests
forge test
# Run tests with verbosity for more detailed output
forge test -vvv
# Run a specific test file
forge test --match-path test/Credits1155.t.sol
# Run a specific test function
forge test --match-test test_BuyCreditsSince the protocol uses the transparent proxy pattern, the implementation contract can be upgraded while preserving all state:
The easiest way to upgrade the contract is using the provided upgrade script:
- Configure your upgrade environment in
.envfile:
# Required for upgrades
CREDITS_PROXY_ADDRESS=<EXISTING_PROXY_ADDRESS>
CREDITS_PROXY_ADMIN=<EXISTING_PROXY_ADMIN_ADDRESS>
# Optional: Set doppler universal router for the new implementation
DOPPLER_UNIVERSAL_ROUTER=<DOPPLER_ROUTER_ADDRESS>- Run the upgrade script:
# Using pnpm
pnpm run upgrade-credits
# Or directly with Foundry
forge clean && forge script script/Upgrade.s.sol:UpgradeCredits --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $BASESCAN_API_KEY -vvvvThe upgrade script will:
- Deploy a new
Credits1155implementation contract - Use the ProxyAdmin's
upgradeAndCallmethod to upgrade the proxy