Skip to content

Commit

Permalink
fix: operator (#63)
Browse files Browse the repository at this point in the history
* fix: operator

* fix: msg sender fix

* fix: change access

* chore: deployments

* fix: comments
  • Loading branch information
Picodes authored May 14, 2024
1 parent b5cdbe7 commit 2609b16
Show file tree
Hide file tree
Showing 42 changed files with 23,959 additions and 10 deletions.
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 @@ -183,8 +183,8 @@ contract Distributor is UUPSHelper {
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();

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

/// @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 @@ contract Distributor is UUPSHelper {
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

0 comments on commit 2609b16

Please sign in to comment.