mirror of
				https://github.com/Instadapp/dsa-connectors.git
				synced 2024-07-29 22:37:00 +00:00 
			
		
		
		
	Euler reward claim contracts added
This commit is contained in:
		
							parent
							
								
									c13e78294c
								
							
						
					
					
						commit
						6c88c0e063
					
				
							
								
								
									
										13
									
								
								contracts/mainnet/connectors/euler/euler-rewards/events.sol
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								contracts/mainnet/connectors/euler/euler-rewards/events.sol
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
//SPDX-License-Identifier: MIT
 | 
			
		||||
pragma solidity ^0.7.0;
 | 
			
		||||
 | 
			
		||||
contract Events {
 | 
			
		||||
    event LogClaimed(
 | 
			
		||||
        address user,
 | 
			
		||||
        address token,
 | 
			
		||||
        uint256 amt,
 | 
			
		||||
        bytes32[] proof,
 | 
			
		||||
        uint256 getId,
 | 
			
		||||
        uint256 setId
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								contracts/mainnet/connectors/euler/euler-rewards/helpers.sol
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								contracts/mainnet/connectors/euler/euler-rewards/helpers.sol
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
//SPDX-License-Identifier: MIT
 | 
			
		||||
pragma solidity ^0.7.0;
 | 
			
		||||
import "./interface.sol";
 | 
			
		||||
import { Basic } from "../../../common/basic.sol";
 | 
			
		||||
 | 
			
		||||
contract Helpers is Basic {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @dev Euler Incentives Distributor
 | 
			
		||||
     */
 | 
			
		||||
    IEulerDistributor internal constant eulerDistribute = IEulerDistributor(0xd524E29E3BAF5BB085403Ca5665301E94387A7e2);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
//SPDX-License-Identifier: MIT
 | 
			
		||||
pragma solidity ^0.7.0;
 | 
			
		||||
 | 
			
		||||
interface IEulerDistributor {
 | 
			
		||||
    function claim(address account, address token, uint claimable, bytes32[] calldata proof, address stake) external;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										46
									
								
								contracts/mainnet/connectors/euler/euler-rewards/main.sol
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								contracts/mainnet/connectors/euler/euler-rewards/main.sol
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,46 @@
 | 
			
		|||
//SPDX-License-Identifier: MIT
 | 
			
		||||
pragma solidity ^0.7.0;
 | 
			
		||||
import "./helpers.sol";
 | 
			
		||||
import "./events.sol";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @title Euler Rewards.
 | 
			
		||||
 * @dev Claim Euler rewards.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
contract EulerIncentives is Helpers, Events {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @dev Claim Pending Rewards.
 | 
			
		||||
     * @notice Claim Pending Rewards from Euler incentives contract.
 | 
			
		||||
     * @param user Address that should receive tokens.
 | 
			
		||||
     * @param token Address of token being claimed (ie EUL)
 | 
			
		||||
     * @param amt The amount of reward to claim.
 | 
			
		||||
     * @param proof Merkle proof that validates this claim.
 | 
			
		||||
     * @param getId ID to retrieve amt.
 | 
			
		||||
     * @param setId ID stores the amount of rewards claimed.
 | 
			
		||||
    */
 | 
			
		||||
    function claim(
 | 
			
		||||
        address user,
 | 
			
		||||
        address token,
 | 
			
		||||
        uint256 amt,
 | 
			
		||||
        bytes32[] memory proof,
 | 
			
		||||
        uint256 getId,
 | 
			
		||||
        uint256 setId
 | 
			
		||||
    ) external payable returns (string memory _eventName, bytes memory _eventParam) {
 | 
			
		||||
        uint _amt = getUint(getId, amt);
 | 
			
		||||
 | 
			
		||||
        require(proof.length > 0, "invalid-assets");
 | 
			
		||||
 | 
			
		||||
        eulerDistribute.claim(user, token, _amt, proof, address(0));
 | 
			
		||||
 | 
			
		||||
        setUint(setId, _amt);
 | 
			
		||||
 | 
			
		||||
        _eventName = "LogClaimed(address,address,uint256,bytes32[],uint256,uint256)";
 | 
			
		||||
        _eventParam = abi.encode(user, token, _amt, proof, getId, setId);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
contract ConnectV2EulereIncentives is EulerIncentives {
 | 
			
		||||
    string public constant name = "Euler-Incentives-v1";
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user