Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: operator #63

Merged
merged 5 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ To update libraries:
forge update
```

## Verifying

Blast: `yarn etherscan blast --api-url https://api.blastscan.io --solc-input --license BUSL-1.1`
Mantle: `yarn etherscan mantle --api-url https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan/api --solc-input --license BUSL-1.1`
Mode: `yarn etherscan mode --api-url https://api.routescan.io/v2/network/mainnet/evm/34443/etherscan/api --solc-input --license BUSL-1.1`
ImmutableZKEVM: `yarn etherscan immutablezkevm --api-url https://explorer.immutable.com/api --solc-input --license BUSL-1.1`
Scroll:`yarn etherscan scroll --api-url https://api.scrollscan.com --solc-input --license BUSL-1.1`
Gnosis:`yarn etherscan gnosis --api-url https://api.gnosisscan.io --solc-input --license BUSL-1.1`
Linea:`yarn etherscan linea --api-url https://api.lineascan.build --solc-input --license BUSL-1.1`

## Audits

The Merkl smart contracts have been audited by Code4rena, find the audit report [here](https://code4rena.com/reports/2023-06-angle).
Expand Down
11 changes: 6 additions & 5 deletions contracts/Distributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";

import "./utils/UUPSHelper.sol";

Check warning on line 42 in contracts/Distributor.sol

View workflow job for this annotation

GitHub Actions / lint

global import of path ./utils/UUPSHelper.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)

struct MerkleTree {
// Root of a Merkle tree which leaves are `(address user, address token, uint amount)`
Expand Down Expand Up @@ -183,8 +183,8 @@
address token = tokens[i];
uint256 amount = amounts[i];

// Checking if only an approved operator can claim for `user`
if (onlyOperatorCanClaim[user] == 1 && operators[user][msg.sender] == 0) revert NotWhitelisted();
// Only approved operator can claim for `user`
if (msg.sender != user && operators[user][msg.sender] == 0) revert NotWhitelisted();
Picodes marked this conversation as resolved.
Show resolved Hide resolved

// Verifying proof
bytes32 leaf = keccak256(abi.encode(user, token, amount));
Expand Down Expand Up @@ -248,7 +248,7 @@

/// @notice Resolve the ongoing dispute, if any
/// @param valid Whether the dispute was valid
function resolveDispute(bool valid) external onlyGovernorOrGuardian {
function resolveDispute(bool valid) external onlyGovernor {
if (disputer == address(0)) revert NoDispute();
if (valid) {
IERC20(disputeToken).safeTransfer(disputer, disputeAmount);
Expand All @@ -262,14 +262,15 @@
emit DisputeResolved(valid);
}

/// @notice Allows the governor or the guardian of this contract to fallback to the last version of the tree
/// @notice Allows the governor of this contract to fallback to the last version of the tree
/// immediately
function revokeTree() external onlyGovernorOrGuardian {
function revokeTree() external onlyGovernor {
if (disputer != address(0)) revert UnresolvedDispute();
_revokeTree();
}

/// @notice Toggles permissioned claiming for a given user
/// @dev deprecated
function toggleOnlyOperatorCanClaim(address user) external onlyTrustedOrUser(user) {
uint256 oldValue = onlyOperatorCanClaim[user];
onlyOperatorCanClaim[user] = 1 - oldValue;
Expand Down
6 changes: 3 additions & 3 deletions deploy/0_distributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
console.log('Now deploying Distributor');
console.log('Starting with the implementation');

await deploy('Distributor_Implementation_V2_0', {
await deploy('Distributor_Implementation_V2_1', {
contract: 'Distributor',
from: deployer.address,
log: !argv.ci,
});

const implementationAddress = (await ethers.getContract('Distributor_Implementation_V2_0')).address;

const implementationAddress = (await ethers.getContract('Distributor_Implementation_V2_1')).address;
console.log(`Successfully deployed the implementation for Distributor at ${implementationAddress}`);
console.log('');

Expand Down
Loading
Loading