mirror of
				https://github.com/Instadapp/dsa-connectors.git
				synced 2024-07-29 22:37:00 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Solidity
		
	
	
	
	
	
pragma solidity ^0.7.0;
 | 
						|
 | 
						|
// import files from common directory
 | 
						|
import { Stores } from "../common/stores.sol";
 | 
						|
import { DSMath } from "../common/math.sol";
 | 
						|
import { TokenInterface } from "../common/interfaces.sol";
 | 
						|
 | 
						|
interface ICurve {
 | 
						|
  function claim(address addr) external;
 | 
						|
}
 | 
						|
 | 
						|
abstract contract CurveVestingHelpers is Stores, DSMath {
 | 
						|
  /**
 | 
						|
  * @dev Return Curve Token Address
 | 
						|
  */
 | 
						|
  function getCurveTokenAddr() virtual internal view returns (address) {
 | 
						|
    return 0xD533a949740bb3306d119CC777fa900bA034cd52;
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
  * @dev Return Curve Vesting Address
 | 
						|
  */
 | 
						|
  function getCurveVestingAddr() virtual internal view returns (address) {
 | 
						|
    return 0x575CCD8e2D300e2377B43478339E364000318E2c;
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
abstract contract CurveVestingProtocol is CurveVestingHelpers {
 | 
						|
  event LogClaim(address account, uint256 claimAmount, uint256 getId, uint256 setId);
 | 
						|
 | 
						|
  /**
 | 
						|
  * @dev Claim Curve DAO Token.
 | 
						|
  * @param getId Get token amount at this ID from `InstaMemory` Contract.
 | 
						|
  * @param setId Set token amount at this ID in `InstaMemory` Contract.
 | 
						|
  */
 | 
						|
  function claim(uint getId, uint setId) external{
 | 
						|
    TokenInterface curveTokenContract = TokenInterface(getCurveTokenAddr());
 | 
						|
 | 
						|
    uint initialCurveBal = curveTokenContract.balanceOf(address(this));
 | 
						|
    ICurve(getCurveVestingAddr()).claim(address(this));
 | 
						|
    uint finalCurveBal = curveTokenContract.balanceOf(address(this));
 | 
						|
 | 
						|
    uint claimedAmt = sub(finalCurveBal, initialCurveBal);
 | 
						|
 | 
						|
    setUint(setId, claimedAmt);
 | 
						|
 | 
						|
    emit LogClaim(address(this), claimedAmt, getId, setId);
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
contract ConnectCurveVesting is CurveVestingProtocol {
 | 
						|
  string public name = "Curve-vesting-v1";
 | 
						|
}
 | 
						|
 |