dsa-connectors/contracts/arbitrum/connectors/arb-claim/main.sol

47 lines
1.3 KiB
Solidity
Raw Permalink Normal View History

2023-04-19 16:06:43 +00:00
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
2023-04-19 17:13:05 +00:00
import "./helpers.sol";
2023-04-19 16:06:43 +00:00
import { Events } from "./events.sol";
import { IArbitrumTokenDistributor } from "./interface.sol";
2023-04-19 17:13:05 +00:00
abstract contract ArbitrumAirdrop is Events, Helpers {
2023-04-19 21:27:07 +00:00
/**
* @dev DSA Arbitrum airdrop claim function.
* @param setId ID to set the claimable amount in the DSA
*/
2023-04-19 17:13:05 +00:00
function claimAirdrop(uint256 setId)
2023-04-19 16:06:43 +00:00
public
returns (string memory eventName_, bytes memory eventParam_)
{
uint256 claimable = claimableArbTokens(address(this));
2023-04-20 12:55:57 +00:00
// If claimable <= 0, ARB TokenDistributor will revert on claim.
2023-04-19 16:06:43 +00:00
ARBITRUM_TOKEN_DISTRIBUTOR.claim();
setUint(setId, claimable);
eventName_ = "LogArbAirdropClaimed(address,uint256,uint256)";
eventParam_ = abi.encode(address(this), claimable, setId);
}
2023-04-19 21:27:07 +00:00
/**
* @dev Delegates votes from signer to `delegatee`.
* @param delegatee The address to delegate the ARB tokens to.
*/
2023-04-19 17:13:05 +00:00
function delegate(address delegatee)
2023-04-19 16:06:43 +00:00
public
returns (string memory eventName_, bytes memory eventParam_)
{
ARB_TOKEN_CONTRACT.delegate(delegatee);
2023-04-19 17:13:05 +00:00
eventName_ = "LogArbTokensDelegated(address,address)";
eventParam_ = abi.encode(address(this), delegatee);
2023-04-19 16:06:43 +00:00
}
}
contract ConnectV2ArbitrumAirdrop is ArbitrumAirdrop {
2023-04-19 17:13:05 +00:00
string public constant name = "ArbitrumAirdrop-v1";
2023-04-19 16:06:43 +00:00
}