Skip to content

Commit

Permalink
Merge pull request #4 from RSSNext/feat/mint
Browse files Browse the repository at this point in the history
add dailyMint & daily limit
  • Loading branch information
iavl authored Oct 12, 2024
2 parents 5803db1 + dcaa70e commit 8bfb3c5
Show file tree
Hide file tree
Showing 16 changed files with 640 additions and 71 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ storage-layout:

# Lints
lint :; forge fmt

abi:
@echo " > \033[32mGenerating abi...\033[0m"
./tools/generateABI.sh
3 changes: 2 additions & 1 deletion deploy-config/local.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"proxyAdminOwner": "0x8AC80fa0993D95C9d6B8Cb494E561E6731038941",
"name": "POWER",
"symbol": "POWER",
"appAdmin": "0x844e38Fae147aE933b0a930fF8EfDFF3767cEA24"
"appAdmin": "0x844e38Fae147aE933b0a930fF8EfDFF3767cEA24",
"dailyMintLimit": "100000000000000000000000"
}
3 changes: 2 additions & 1 deletion deploy-config/rss3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"proxyAdminOwner": "0x8ac80fa0993d95c9d6b8cb494e561e6731038941",
"name": "POWER",
"symbol": "POWER",
"appAdmin": "0xf496eEeD857aA4709AC4D5B66b6711975623D355"
"appAdmin": "0xf496eEeD857aA4709AC4D5B66b6711975623D355",
"dailyMintLimit": "100000000000000000000000"
}
3 changes: 2 additions & 1 deletion deploy-config/testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"proxyAdminOwner": "0x8AC80fa0993D95C9d6B8Cb494E561E6731038941",
"name": "POWER",
"symbol": "POWER",
"appAdmin": "0x844e38Fae147aE933b0a930fF8EfDFF3767cEA24"
"appAdmin": "0xf57cb2d96f6Cd8415a501cCf2837Ca4274cF5Abc",
"dailyMintLimit": "10000000000000000000000"
}
216 changes: 207 additions & 9 deletions deployments/PowerToken.abi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "APP_USER_ROLE",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "DEFAULT_ADMIN_ROLE",
Expand All @@ -38,6 +51,68 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "addUser",
"inputs": [
{
"name": "account",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "addUsers",
"inputs": [
{
"name": "accounts",
"type": "address[]",
"internalType": "address[]"
}
],
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "admin",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "airdrop",
"inputs": [
{
"name": "to",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "taxBasisPoints",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "allowance",
Expand Down Expand Up @@ -143,6 +218,24 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "dailyMint",
"inputs": [
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "taxBasisPoints",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "decimals",
Expand All @@ -156,6 +249,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getDailyMintLimit",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getRoleAdmin",
Expand Down Expand Up @@ -278,35 +384,45 @@
"name": "admin_",
"type": "address",
"internalType": "address"
},
{
"name": "dailyMintLimit_",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "migrate",
"name": "mint",
"inputs": [
{
"name": "users",
"type": "address[]",
"internalType": "address[]"
"name": "to",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "feedIds",
"type": "bytes32[]",
"internalType": "bytes32[]"
"name": "taxBasisPoints",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "mint",
"name": "mintToTreasury",
"inputs": [
{
"name": "to",
"name": "treasuryAdmin",
"type": "address",
"internalType": "address"
},
Expand All @@ -332,6 +448,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "removeUser",
"inputs": [
{
"name": "account",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "renounceRole",
Expand Down Expand Up @@ -368,6 +497,19 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setDailyMintLimit",
"inputs": [
{
"name": "limit",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "supportsInterface",
Expand Down Expand Up @@ -418,6 +560,11 @@
"name": "feedId",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "taxBasisPoints",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
Expand Down Expand Up @@ -520,6 +667,25 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "event",
"name": "AirdropTokens",
"inputs": [
{
"name": "to",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"indexed": true,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "Approval",
Expand Down Expand Up @@ -779,6 +945,28 @@
}
]
},
{
"type": "error",
"name": "AddressInsufficientBalance",
"inputs": [
{
"name": "account",
"type": "address",
"internalType": "address"
}
]
},
{
"type": "error",
"name": "AlreadyMintedToday",
"inputs": [
{
"name": "account",
"type": "address",
"internalType": "address"
}
]
},
{
"type": "error",
"name": "ERC20InsufficientAllowance",
Expand Down Expand Up @@ -865,11 +1053,21 @@
}
]
},
{
"type": "error",
"name": "ExceedsDailyLimit",
"inputs": []
},
{
"type": "error",
"name": "ExceedsMaxSupply",
"inputs": []
},
{
"type": "error",
"name": "FailedInnerCall",
"inputs": []
},
{
"type": "error",
"name": "InsufficientBalanceAndPoints",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
"devDependencies": {
"husky": "^8.0.3",
"lint-staged": "^14.0.0",
"solhint": "^5.0.2"
"solhint": "^5.0.3"
},
"scripts": {
"setup": "make clean && make build",
"sync": "make install",
"test": "make foundry-test",
"snapshot": "make snapshot",
"lint": "make lint",
"abi": "make abi",
"solhint": "make solhint",
"upgradeable": "make upgradeable",
"mythril": "make mythril",
Expand Down
4 changes: 2 additions & 2 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract Deploy is Deployer {
}

function deployPowerToken() public broadcast returns (address addr_) {
PowerToken token = new PowerToken();
PowerToken token = new PowerToken(cfg.appAdmin());

// check states
save("PowerToken", address(token));
Expand All @@ -93,7 +93,7 @@ contract Deploy is Deployer {
function initializePowerToken() public broadcast {
PowerToken tokenProxy = PowerToken(mustGetAddress("PowerTokenProxy"));

tokenProxy.initialize(cfg.name(), cfg.symbol(), cfg.appAdmin());
tokenProxy.initialize(cfg.name(), cfg.symbol(), cfg.appAdmin(), cfg.dailyMintLimit());

// check states
require(tokenProxy.hasRole(APP_ADMIN_ROLE, cfg.appAdmin()), "check admin role error");
Expand Down
Loading

0 comments on commit 8bfb3c5

Please sign in to comment.