dsa-connectors/contracts/connectors_old/curve_vesting.sol

55 lines
1.6 KiB
Solidity
Raw Normal View History

2021-02-07 16:40:28 +00:00
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;
}
2021-02-05 18:51:11 +00:00
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;
}
}
2021-02-05 18:51:11 +00:00
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";
}