Skip to content

Commit

Permalink
Merge pull request #1 from Moonsong-Labs/erc20-and-erc721-proposals
Browse files Browse the repository at this point in the history
Erc20 and erc721 proposals
  • Loading branch information
aon authored Dec 6, 2024
2 parents 02c98de + 1792697 commit 7aa617a
Show file tree
Hide file tree
Showing 11 changed files with 747 additions and 0 deletions.
43 changes: 43 additions & 0 deletions bash_scripts/deploy_tokens.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/env sh

set -e
set -o xtrace

forge create --zksync \
--rpc-url http://localhost:3050 \
--private-key 0x87ce66d9f787696d21af61750c1c3310099f27fb7e7259a193a8c514293a7c0c \
--verify \
--verifier zksync \
--verifier-url http://localhost:3070/contract_verification \
src/PublicScopedBalanceErc20.sol:PublicScopedBalanceErc20 \
--constructor-args "PublicScopedBalanceErc20-posta" "PEB20P";

forge create --zksync \
--rpc-url http://localhost:3050 \
--private-key 0x87ce66d9f787696d21af61750c1c3310099f27fb7e7259a193a8c514293a7c0c \
--verify \
--verifier zksync \
--verifier-url http://localhost:3070/contract_verification \
src/ShareBalanceErc20.sol:ShareBalanceErc20 \
--constructor-args "ShareBalanceErc20-posta" "SB20P";

forge create --zksync \
--rpc-url http://localhost:3050 \
--private-key 0x87ce66d9f787696d21af61750c1c3310099f27fb7e7259a193a8c514293a7c0c \
--verify \
--verifier zksync \
--verifier-url http://localhost:3070/contract_verification \
src/ShareScopedBalanceErc20.sol:ShareScopedBalanceErc20 \
--constructor-args "ShareScopedBalanceErc20-posta" "SSBE20P";


forge create --zksync \
--rpc-url http://localhost:3050 \
--private-key 0x87ce66d9f787696d21af61750c1c3310099f27fb7e7259a193a8c514293a7c0c \
--verify \
--verifier zksync \
--verifier-url http://localhost:3070/contract_verification \
src/PublicSelectionErc721.sol:PublicSelectionErc721 \
--constructor-args "PublicSelectionErc721-posta" "PC721P";


1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
src = "src"
out = "out"
libs = ["lib"]
solc="0.8.24"

[profile.default.zksync]
zksolc = "1.5.6"
106 changes: 106 additions & 0 deletions permission-templates/erc20-public-scoped-balance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
contracts:
- address: <addr>
methods:
# ERC20 standard
- signature: function totalSupply() public view returns (uint256)
read:
type: public
write:
type: public
- signature: function balanceOf(address account) public view returns (uint256)
read:
type: checkArgument
argIndex: 0
write:
type: closed
- signature: function allowance(address owner, address spender) public view returns (uint256)
read:
type: oneOf
rules:
- type: checkArgument
argIndex: 0
- type: checkArgument
argIndex: 1
write:
type: closed
- signature: function approve(address spender, uint256 value) public returns (bool)
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function transfer(address to, uint256 value) public returns (bool)
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function transferFrom(address from, address to, uint256 value) public returns (bool)
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public

#
# Open Zeppelion extended methods
#
- signature: function increaseAllowance(address spender, address addedValue) public
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function decreaseAllowance(address spender, address subtractedValue) public
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function symbol() public view returns (string memory)
read:
type: public
write:
type: public
- signature: function decimals() public view returns (uint8)
read:
type: public
write:
type: public

#
# IRC165
#
- signature: function supportsInterface(bytes4 interfaceID) external view returns (bool)
read:
type: public
write:
type: public

#
# Extended methods
#
- signature: function mint(address to, uint256 amount) public returns (bool)
read:
type: group
groups:
- admins
write:
type: group
groups:
- admins
- signature: function publicThreshold(address target) public view returns (uint256, bool)
read:
type: public
write:
type: closed
- signature: function changePublicThreshold(uint256 newThreshold) external
read:
type: public
write:
type: public
111 changes: 111 additions & 0 deletions permission-templates/erc20-share-balance-with-users.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
contracts:
- address: <addr>
methods:
# ERC20 standard
- signature: function totalSupply() public view returns (uint256)
read:
type: public
write:
type: public
- signature: function balanceOf(address account) public view returns (uint256)
read:
type: checkArgument
argIndex: 0
write:
type: closed
- signature: function allowance(address owner, address spender) public view returns (uint256)
read:
type: oneOf
rules:
- type: checkArgument
argIndex: 0
- type: checkArgument
argIndex: 1
write:
type: closed
- signature: function approve(address spender, uint256 value) public returns (bool)
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function transfer(address to, uint256 value) public returns (bool)
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function transferFrom(address from, address to, uint256 value) public returns (bool)
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public

#
# Open Zeppelion extended methods
#
- signature: function increaseAllowance(address spender, address addedValue) public
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function decreaseAllowance(address spender, address subtractedValue) public
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function symbol() public view returns (string memory)
read:
type: public
write:
type: public
- signature: function decimals() public view returns (uint8)
read:
type: public
write:
type: public

#
# IRC165
#
- signature: function supportsInterface(bytes4 interfaceID) external view returns (bool)
read:
type: public
write:
type: public

#
# Extended methods
#
- signature: function mint(address to, uint256 amount) public returns (bool)
read:
type: group
groups:
- admins
write:
type: group
groups:
- admins
- signature: function authorizedBalanceOf(address account) public view returns (uint256)
read:
type: public
write:
type: public
- signature: function shareBalanceWith(address reader) public
read:
type: public
write:
type: public
- signature: function hideBalanceFrom(address reader) public
read:
type: public
write:
type: public
111 changes: 111 additions & 0 deletions permission-templates/erc20-share-scoped-balance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
contracts:
- address: <addr>
methods:
# ERC20 standard
- signature: function totalSupply() public view returns (uint256)
read:
type: public
write:
type: public
- signature: function balanceOf(address account) public view returns (uint256)
read:
type: checkArgument
argIndex: 0
write:
type: closed
- signature: function allowance(address owner, address spender) public view returns (uint256)
read:
type: oneOf
rules:
- type: checkArgument
argIndex: 0
- type: checkArgument
argIndex: 1
write:
type: closed
- signature: function approve(address spender, uint256 value) public returns (bool)
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function transfer(address to, uint256 value) public returns (bool)
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function transferFrom(address from, address to, uint256 value) public returns (bool)
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public

#
# Open Zeppelion extended methods
#
- signature: function increaseAllowance(address spender, address addedValue) public
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function decreaseAllowance(address spender, address subtractedValue) public
# This doesn't leek information because we validate that current user
# is msg.sender.
read:
type: public
write:
type: public
- signature: function symbol() public view returns (string memory)
read:
type: public
write:
type: public
- signature: function decimals() public view returns (uint8)
read:
type: public
write:
type: public

#
# IRC165
#
- signature: function supportsInterface(bytes4 interfaceID) external view returns (bool)
read:
type: public
write:
type: public

#
# Extended methods
#
- signature: function mint(address to, uint256 amount) public returns (bool)
read:
type: group
groups:
- admins
write:
type: group
groups:
- admins
- signature: function authorizedBalanceOf(address account) public view returns (uint256)
read:
type: public
write:
type: public
- signature: function shareBalanceWith(address reader, uint256 amount) public
read:
type: public
write:
type: public
- signature: function hideBalanceFrom(address reader) public
read:
type: public
write:
type: public
Loading

0 comments on commit 7aa617a

Please sign in to comment.