Skip to content

Commit

Permalink
fix: resolve audit info f-2024-1190
Browse files Browse the repository at this point in the history
  • Loading branch information
LilaRest committed Mar 9, 2024
1 parent 26f2c61 commit 6fd9d21
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 48 deletions.
96 changes: 48 additions & 48 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"files.exclude": {
"renovate.json": false,
"tsconfig.json": false,
"vercel.json": false,
"postcss.config.js": false,
"next-env.d.ts": false,
"CHANGELOG.md": false,
".releaserc.json": false,
".next": false,
".github": false,
"node_modules": false,
".eslintrc.json": false,
"package.json": false,
".gitignore": false,
"next.config.mjs": false,
".env.local": false,
".env.local.template": false,
"README.md": false,
"LICENSE": false,
"hardhat.config.ts": false,
".prettierrc.js": false,
"typechain-types": false,
"hardhat/artifacts": false,
"hardhat/cache": false,
".graphclient": false,
".graphclientrc.yml": false,
"wagmi.config.ts": false,
"tailwind.config.js": false,
"hardhat/abis": false,
"build": false,
"foundry.toml": false,
".gitmodules": false,
"slither.config.json": false,
"slither.db.json": false,
"solc.json": false,
"contracts/foundry/cache": false,
"contracts/foundry/out": false,
"contracts/hardhat/artifacts": false,
"contracts/hardhat/cache": false,
"secrets.json": false,
".env": false,
"report.md": false,
"postcss.config.cjs": false,
"hardhat.config.cts": false,
"bun.lockb": false,
".prettierrc.cjs": false,
"env.mjs": false,
"docs/": false,
"scripts/": false
"renovate.json": true,
"tsconfig.json": true,
"vercel.json": true,
"postcss.config.js": true,
"next-env.d.ts": true,
"CHANGELOG.md": true,
".releaserc.json": true,
".next": true,
".github": true,
"node_modules": true,
".eslintrc.json": true,
"package.json": true,
".gitignore": true,
"next.config.mjs": true,
".env.local": true,
".env.local.template": true,
"README.md": true,
"LICENSE": true,
"hardhat.config.ts": true,
".prettierrc.js": true,
"typechain-types": true,
"hardhat/artifacts": true,
"hardhat/cache": true,
".graphclient": true,
".graphclientrc.yml": true,
"wagmi.config.ts": true,
"tailwind.config.js": true,
"hardhat/abis": true,
"build": true,
"foundry.toml": true,
".gitmodules": true,
"slither.config.json": true,
"slither.db.json": true,
"solc.json": true,
"contracts/foundry/cache": true,
"contracts/foundry/out": true,
"contracts/hardhat/artifacts": true,
"contracts/hardhat/cache": true,
"secrets.json": true,
".env": true,
"report.md": true,
"postcss.config.cjs": true,
"hardhat.config.cts": true,
"bun.lockb": true,
".prettierrc.cjs": true,
"env.mjs": true,
"docs/": true,
"scripts/": true
},
// Required because of a bug with pnpm and prettier plugins.
// See: https://github.com/prettier-solidity/prettier-plugin-solidity#pnpm
Expand Down
26 changes: 26 additions & 0 deletions contracts/abis/GlobalBlacklist.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@
"name": "BeaconUpgraded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Blacklisted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -68,6 +81,19 @@
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Unblacklisted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down
8 changes: 8 additions & 0 deletions contracts/src/GlobalBlacklist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ contract GlobalBlacklist is Initializable, UUPSUpgradeable, GlobalOwnableUpgrade
*/
mapping(address => bool) private _list;

/// @dev Emitted when `account` is blacklisted.
event Blacklisted(address account);

/// @dev Emitted when `account` is unblacklisted.
event Unblacklisted(address account);

/**
* @notice Prevents implementation contract from being initialized as recommended by
* OpenZeppelin.
Expand Down Expand Up @@ -63,6 +69,7 @@ contract GlobalBlacklist is Initializable, UUPSUpgradeable, GlobalOwnableUpgrade
function blacklist(address account) external onlyOwner {
require(account != address(0), "L20");
_list[account] = true;
emit Blacklisted(account);
}

/**
Expand All @@ -71,6 +78,7 @@ contract GlobalBlacklist is Initializable, UUPSUpgradeable, GlobalOwnableUpgrade
*/
function unBlacklist(address account) external onlyOwner {
_list[account] = false;
emit Unblacklisted(account);
}

/**
Expand Down
94 changes: 94 additions & 0 deletions src/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,19 @@ export const globalBlacklistAbi = [
],
name: 'BeaconUpgraded',
},
{
type: 'event',
anonymous: false,
inputs: [
{
name: 'account',
internalType: 'address',
type: 'address',
indexed: false,
},
],
name: 'Blacklisted',
},
{
type: 'event',
anonymous: false,
Expand Down Expand Up @@ -268,6 +281,19 @@ export const globalBlacklistAbi = [
],
name: 'OwnershipTransferred',
},
{
type: 'event',
anonymous: false,
inputs: [
{
name: 'account',
internalType: 'address',
type: 'address',
indexed: false,
},
],
name: 'Unblacklisted',
},
{
type: 'event',
anonymous: false,
Expand Down Expand Up @@ -3008,6 +3034,23 @@ export const useWatchGlobalBlacklistBeaconUpgradedEvent =
eventName: 'BeaconUpgraded',
})

/**
* Wraps __{@link useWatchContractEvent}__ with `abi` set to __{@link globalBlacklistAbi}__ and `eventName` set to `"Blacklisted"`
*
* - [__View Contract on X1 Testnet Ok Link__](https://www.oklink.com/x1-test/address/0xc44395eC149C6743A268A901a38e5b02dc87D10C)
* -
* - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcA55A2394876e7Cf52e99Ab36Fc9151a7d9CF350)
* - [__View Contract on Linea Goerli Testnet Etherscan__](https://goerli.lineascan.build/address/0x7fbE57dD4Ba76CACBFfBA821EE0B7faa240a11bf)
* - [__View Contract on Linea Mainnet Etherscan__](https://lineascan.build/address/0xcA55A2394876e7Cf52e99Ab36Fc9151a7d9CF350)
* - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io/address/0x1549647606A71B2a79b85AEb54631b8eA2a1939a)
*/
export const useWatchGlobalBlacklistBlacklistedEvent =
/*#__PURE__*/ createUseWatchContractEvent({
abi: globalBlacklistAbi,
address: globalBlacklistAddress,
eventName: 'Blacklisted',
})

/**
* Wraps __{@link useWatchContractEvent}__ with `abi` set to __{@link globalBlacklistAbi}__ and `eventName` set to `"Initialized"`
*
Expand Down Expand Up @@ -3042,6 +3085,23 @@ export const useWatchGlobalBlacklistOwnershipTransferredEvent =
eventName: 'OwnershipTransferred',
})

/**
* Wraps __{@link useWatchContractEvent}__ with `abi` set to __{@link globalBlacklistAbi}__ and `eventName` set to `"Unblacklisted"`
*
* - [__View Contract on X1 Testnet Ok Link__](https://www.oklink.com/x1-test/address/0xc44395eC149C6743A268A901a38e5b02dc87D10C)
* -
* - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcA55A2394876e7Cf52e99Ab36Fc9151a7d9CF350)
* - [__View Contract on Linea Goerli Testnet Etherscan__](https://goerli.lineascan.build/address/0x7fbE57dD4Ba76CACBFfBA821EE0B7faa240a11bf)
* - [__View Contract on Linea Mainnet Etherscan__](https://lineascan.build/address/0xcA55A2394876e7Cf52e99Ab36Fc9151a7d9CF350)
* - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io/address/0x1549647606A71B2a79b85AEb54631b8eA2a1939a)
*/
export const useWatchGlobalBlacklistUnblacklistedEvent =
/*#__PURE__*/ createUseWatchContractEvent({
abi: globalBlacklistAbi,
address: globalBlacklistAddress,
eventName: 'Unblacklisted',
})

/**
* Wraps __{@link useWatchContractEvent}__ with `abi` set to __{@link globalBlacklistAbi}__ and `eventName` set to `"Upgraded"`
*
Expand Down Expand Up @@ -7080,6 +7140,23 @@ export const watchGlobalBlacklistBeaconUpgradedEvent =
eventName: 'BeaconUpgraded',
})

/**
* Wraps __{@link watchContractEvent}__ with `abi` set to __{@link globalBlacklistAbi}__ and `eventName` set to `"Blacklisted"`
*
* - [__View Contract on X1 Testnet Ok Link__](https://www.oklink.com/x1-test/address/0xc44395eC149C6743A268A901a38e5b02dc87D10C)
* -
* - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcA55A2394876e7Cf52e99Ab36Fc9151a7d9CF350)
* - [__View Contract on Linea Goerli Testnet Etherscan__](https://goerli.lineascan.build/address/0x7fbE57dD4Ba76CACBFfBA821EE0B7faa240a11bf)
* - [__View Contract on Linea Mainnet Etherscan__](https://lineascan.build/address/0xcA55A2394876e7Cf52e99Ab36Fc9151a7d9CF350)
* - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io/address/0x1549647606A71B2a79b85AEb54631b8eA2a1939a)
*/
export const watchGlobalBlacklistBlacklistedEvent =
/*#__PURE__*/ createWatchContractEvent({
abi: globalBlacklistAbi,
address: globalBlacklistAddress,
eventName: 'Blacklisted',
})

/**
* Wraps __{@link watchContractEvent}__ with `abi` set to __{@link globalBlacklistAbi}__ and `eventName` set to `"Initialized"`
*
Expand Down Expand Up @@ -7114,6 +7191,23 @@ export const watchGlobalBlacklistOwnershipTransferredEvent =
eventName: 'OwnershipTransferred',
})

/**
* Wraps __{@link watchContractEvent}__ with `abi` set to __{@link globalBlacklistAbi}__ and `eventName` set to `"Unblacklisted"`
*
* - [__View Contract on X1 Testnet Ok Link__](https://www.oklink.com/x1-test/address/0xc44395eC149C6743A268A901a38e5b02dc87D10C)
* -
* - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcA55A2394876e7Cf52e99Ab36Fc9151a7d9CF350)
* - [__View Contract on Linea Goerli Testnet Etherscan__](https://goerli.lineascan.build/address/0x7fbE57dD4Ba76CACBFfBA821EE0B7faa240a11bf)
* - [__View Contract on Linea Mainnet Etherscan__](https://lineascan.build/address/0xcA55A2394876e7Cf52e99Ab36Fc9151a7d9CF350)
* - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io/address/0x1549647606A71B2a79b85AEb54631b8eA2a1939a)
*/
export const watchGlobalBlacklistUnblacklistedEvent =
/*#__PURE__*/ createWatchContractEvent({
abi: globalBlacklistAbi,
address: globalBlacklistAddress,
eventName: 'Unblacklisted',
})

/**
* Wraps __{@link watchContractEvent}__ with `abi` set to __{@link globalBlacklistAbi}__ and `eventName` set to `"Upgraded"`
*
Expand Down

0 comments on commit 6fd9d21

Please sign in to comment.