285 txs
354 calls
constructor
constructor(address _twabController)
functions
getCurrentEpochId
viewfunction getCurrentEpochId(uint256 _promotionId) view returns (uint256)
getPromotion
viewfunction getPromotion(uint256 _promotionId) view returns (tuple)
getRemainingRewards
viewfunction getRemainingRewards(uint256 _promotionId) view returns (uint256)
getRewardsAmount
viewfunction getRewardsAmount(address _user, uint256 _promotionId, uint8[] _epochIds) view returns (uint256[])
GRACE_PERIOD
viewfunction GRACE_PERIOD() view returns (uint32)
twabController
viewfunction twabController() view returns (address)
claimRewards
nonpayablefunction claimRewards(address _user, uint256 _promotionId, uint8[] _epochIds) returns (uint256)
createPromotion
nonpayablefunction createPromotion(address _vault, address _token, uint64 _startTimestamp, uint256 _tokensPerEpoch, uint48 _epochDuration, uint8 _numberOfEpochs) returns (uint256)
destroyPromotion
nonpayablefunction destroyPromotion(uint256 _promotionId, address _to) returns (bool)
endPromotion
nonpayablefunction endPromotion(uint256 _promotionId, address _to) returns (bool)
extendPromotion
nonpayablefunction extendPromotion(uint256 _promotionId, uint8 _numberOfEpochs) returns (bool)
multicall
nonpayablefunction multicall(bytes[] data) returns (bytes[] results)
events
PromotionCreated
event PromotionCreated(uint256 indexed promotionId, address indexed vault, address indexed token, uint64 startTimestamp, uint256 tokensPerEpoch, uint48 epochDuration, uint8 initialNumberOfEpochs)
PromotionDestroyed
event PromotionDestroyed(uint256 indexed promotionId, address indexed recipient, uint256 amount)
PromotionEnded
event PromotionEnded(uint256 indexed promotionId, address indexed recipient, uint256 amount, uint8 epochNumber)
PromotionExtended
event PromotionExtended(uint256 indexed promotionId, uint256 numberOfEpochs)
RewardsClaimed
event RewardsClaimed(uint256 indexed promotionId, uint8[] epochIds, address indexed user, uint256 amount)
errors
EpochDurationNotMultipleOfTwabPeriod
error EpochDurationNotMultipleOfTwabPeriod(uint48 epochDuration, uint32 twabPeriodLength)
EpochNotOver
error EpochNotOver(uint64 epochEndTimestamp)
ExceedsMaxEpochs
error ExceedsMaxEpochs(uint8 epochExtension, uint8 currentEpochs, uint8 maxEpochs)
GracePeriodActive
error GracePeriodActive(uint256 gracePeriodEndTimestamp)
InvalidEpochId
error InvalidEpochId(uint8 epochId, uint8 numberOfEpochs)
InvalidPromotion
error InvalidPromotion(uint256 promotionId)
OnlyPromotionCreator
error OnlyPromotionCreator(address sender, address creator)
PayeeZeroAddress
error PayeeZeroAddress()
PromotionInactive
error PromotionInactive(uint256 promotionId)
RewardsAlreadyClaimed
error RewardsAlreadyClaimed(uint256 promotionId, address user, uint8 epochId)
StartTimeNotAlignedWithTwabPeriod
error StartTimeNotAlignedWithTwabPeriod(uint64 startTimePeriodOffset)
TokensReceivedLessThanExpected
error TokensReceivedLessThanExpected(uint256 received, uint256 expected)
TwabControllerZeroAddress
error TwabControllerZeroAddress()
ZeroEpochDuration
error ZeroEpochDuration()
ZeroEpochs
error ZeroEpochs()
ZeroTokensPerEpoch
error ZeroTokensPerEpoch()
creation bytecode
0x60a060405234801561001057600080fd5b5060405162001fe638038062001fe68339810160408190526100319161006c565b6001600160a01b03811660000361005b576040516319b9815760e11b815260040160405180910390fd5b6001600160a01b031660805261009c565b60006020828403121561007e57600080fd5b81516001600160a01b038116811461009557600080fd5b9392505050565b608051611f12620000d4600039600081816101a0015281816107a30152818161087c0152818161124001526112f10152611f126000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a495884511610071578063a495884514610168578063ac9650d81461017b578063b0812d7b1461019b578063b2456c3a146101da578063c1a287e2146101ed578063f824d0fb1461020c57600080fd5b8063096fe668146100b95780630b011a16146100e1578063120468a01461010157806314fdecca1461011457806320555db1146101345780636cc9a79a14610147575b600080fd5b6100cc6100c7366004611815565b61021f565b60405190151581526020015b60405180910390f35b6100f46100ef3660046118a1565b61035d565b6040516100d891906118fc565b6100cc61010f366004611940565b6104a9565b610127610122366004611970565b6105c8565b6040516100d89190611989565b6100cc610142366004611940565b6105d9565b61015a610155366004611a4a565b61074a565b6040519081526020016100d8565b61015a610176366004611970565b610d01565b61018e610189366004611ad6565b610d14565b6040516100d89190611b67565b6101c27f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100d8565b61015a6101e83660046118a1565b610dfb565b6101f7624f1a0081565b60405163ffffffff90911681526020016100d8565b61015a61021a366004611970565b610f86565b600061022a82610f99565b600061023584610fc0565b9050610241848261108c565b60408101516102518160ff611be1565b60ff168460ff16111561028f5760405163a5bd653560e01b815260ff8086166004830152808316602483015260448201526064015b60405180910390fd5b6102998482611bfa565b6000868152602081905260408120805460ff60e01b1916600160e01b60ff9485160217905560e084015190916102d191908716611c13565b90508060008088815260200190815260200160002060040160008282546102f89190611c2a565b909155505060c0830151610317906001600160a01b03163330846110da565b60405160ff8616815286907fa9527ed49c1c2ab5449cfef5b611076ce228a0a0de4534874963b83abb6e7b469060200160405180910390a2600193505050505b92915050565b6060600061036a85610fc0565b9050826000816001600160401b0381111561038757610387611c3d565b6040519080825280602002602001820160405280156103b0578160200160208202803683370190505b50905060005b8281101561049b5760008881526002602090815260408083206001600160a01b038d168452909152902054610419908888848181106103f7576103f7611c53565b905060200201602081019061040c9190611c69565b60ff161c60019081161490565b1561044357600082828151811061043257610432611c53565b602002602001018181525050610493565b610474898589898581811061045a5761045a611c53565b905060200201602081019061046f9190611c69565b61114b565b82828151811061048657610486611c53565b6020026020010181815250505b6001016103b6565b50925050505b949350505050565b60006001600160a01b03821681036104d4576040516307b6dbc760e01b815260040160405180910390fd5b60006104df84610fc0565b90506104ea81611395565b6104f4848261108c565b60006104ff826113d3565b6000868152602081905260408120805460ff60e01b1916600160e01b60ff85160217905590915061052f8361141d565b90508060008088815260200190815260200160002060040160008282546105569190611c84565b909155505060c0830151610574906001600160a01b0316868361147f565b6040805182815260ff841660208201526001600160a01b0387169188917f98f89153fa6ee40b2edcd2e1ce4a5a9edfb2f74818016fc24e6cfe7b6fcd12a9910160405180910390a350600195945050505050565b6105d06117b3565b61035782610fc0565b60006001600160a01b0382168103610604576040516307b6dbc760e01b815260040160405180910390fd5b600061060f84610fc0565b905061061a81611395565b60408101516080820151602083015160009260ff1690910265ffffffffffff16016001600160401b031660a083015190915065ffffffffffff166000624f1a008284106106675783610669565b825b6106739190611c2a565b90508042101561069957604051634a47d39f60e11b815260048101829052602401610286565b610100840151600088815260208190526040812080546001600160e81b0319168155600181018290556002810180546001600160a01b0319169055600381018290556004015560c08501516106f8906001600160a01b0316888361147f565b866001600160a01b0316887f6f804f2ef186cd4b2a6740c084b86f557a497a1fcf3a6b073068a55c51187b6f8360405161073491815260200190565b60405180910390a3506001979650505050505050565b60008360000361076d57604051639e0bcf1b60e01b815260040160405180910390fd5b8265ffffffffffff16600003610796576040516366128a9760e01b815260040160405180910390fd5b61079f82610f99565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e7a891b96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108239190611c97565b905061083563ffffffff821685611cd3565b65ffffffffffff1615610871576040516315fc707160e31b815265ffffffffffff8516600482015263ffffffff82166024820152604401610286565b60008163ffffffff167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634c08d8e86040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fc9190611c97565b61090c9063ffffffff1689611cf8565b6109169190611d1f565b90506001600160401b0381161561094b576040516378eb63b360e01b81526001600160401b0382166004820152602401610286565b6000600154600161095c9190611c2a565b60018190559050600061097260ff871689611c13565b9050604051806101200160405280336001600160a01b031681526020018a6001600160401b031681526020018760ff1681526020018c6001600160a01b031681526020018865ffffffffffff1681526020014265ffffffffffff1681526020018b6001600160a01b031681526020018981526020018281525060008084815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a8154816001600160401b0302191690836001600160401b03160217905550604082015181600001601c6101000a81548160ff021916908360ff16021790555060608201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160010160146101000a81548165ffffffffffff021916908365ffffffffffff16021790555060a082015181600101601a6101000a81548165ffffffffffff021916908365ffffffffffff16021790555060c08201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060e08201518160030155610100820151816004015590505060008a6001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610b7d91906001600160a01b0391909116815260200190565b602060405180830381865afa158015610b9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bbe9190611d39565b9050610bd56001600160a01b038c163330856110da565b6040516370a0823160e01b81523060048201526000906001600160a01b038d16906370a0823190602401602060405180830381865afa158015610c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c409190611d39565b9050610c4c8383611c2a565b811015610c8157610c5d8282611c84565b604051634512ed9560e01b8152600481019190915260248101849052604401610286565b604080516001600160401b038d168152602081018c905265ffffffffffff8b169181019190915260ff891660608201526001600160a01b03808e1691908f169086907fa33287bf444f16b8bea8c0fb00467be4904cf487fe7a6264fdc361fc79dd2ca69060800160405180910390a450919b9a5050505050505050505050565b6000610357610d0f83610fc0565b61141d565b604080516000815260208101909152606090826001600160401b03811115610d3e57610d3e611c3d565b604051908082528060200260200182016040528015610d7157816020015b6060815260200190600190039081610d5c5790505b50915060005b83811015610df357610dce30868684818110610d9557610d95611c53565b9050602002810190610da79190611d52565b85604051602001610dba93929190611d98565b6040516020818303038152906040526114b4565b838281518110610de057610de0611c53565b6020908102919091010152600101610d77565b505092915050565b600080610e0785610fc0565b60008681526002602090815260408083206001600160a01b038b1684529091528120549192509084825b81811015610ed3576000888883818110610e4d57610e4d611c53565b9050602002016020810190610e629190611c69565b9050600160ff821685901c811603610ea857604051630157cce560e41b8152600481018b90526001600160a01b038c16602482015260ff82166044820152606401610286565b610eb38b878361114b565b610ebd9086611c2a565b9450600160ff82161b8417935050600101610e31565b5060008881526002602090815260408083206001600160a01b038d16845282528083208590558a83529082905281206004018054859290610f15908490611c84565b909155505060c0840151610f33906001600160a01b03168a8561147f565b886001600160a01b0316887f446a5bb69110f4fa9a5802e85237a4281d1d27dbe989b22da4a75d9deae8c778898987604051610f7193929190611dbf565b60405180910390a35090979650505050505050565b6000610357610f9483610fc0565b6113d3565b8060ff16600003610fbd5760405163a36a16cf60e01b815260040160405180910390fd5b50565b610fc86117b3565b60008281526020818152604080832081516101208101835281546001600160a01b03808216808452600160a01b8084046001600160401b031697850197909752600160e01b90920460ff16948301949094526001830154808516606084015294850465ffffffffffff9081166080840152600160d01b90950490941660a0820152600282015490921660c0830152600381015460e08301526004015461010082015291036103575760405163549e9ddf60e11b815260048101849052602401610286565b604081015160808201516020830151429260ff1690910265ffffffffffff16016001600160401b0316116110d657604051631bffb76360e01b815260048101839052602401610286565b5050565b6040516001600160a01b03808516602483015283166044820152606481018290526111459085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526114d9565b50505050565b608082015160009065ffffffffffff168161116960ff851683611e0d565b85602001516111789190611e30565b905060006111868383611e30565b9050806001600160401b03164210156111bd5760405163acb91bdb60e01b81526001600160401b0382166004820152602401610286565b856040015160ff168560ff16106111fa5760408087015190516317d8b5d560e21b815260ff80881660048301529091166024820152604401610286565b6060860151604051635d9abccd60e11b81526001600160a01b03918216600482015288821660248201526001600160401b038085166044830152831660648201526000917f0000000000000000000000000000000000000000000000000000000000000000169063bb35799a90608401602060405180830381865afa158015611287573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ab9190611d39565b9050801561138557606087015160405163e7d7b22560e01b81526001600160a01b0391821660048201526001600160401b038086166024830152841660448201526000917f0000000000000000000000000000000000000000000000000000000000000000169063e7d7b22590606401602060405180830381865afa158015611338573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135c9190611d39565b905080828960e0015161136f9190611c13565b6113799190611e50565b9550505050505061138e565b60009450505050505b9392505050565b80516001600160a01b03163314610fbd578051604051630e9d5e7b60e41b81523360048201526001600160a01b039091166024820152604401610286565b60008082602001516001600160401b031642111561035757826080015165ffffffffffff1683602001516001600160401b031642038161141557611415611cbd565b049392505050565b60408101516080820151602083015160009260ff1690910265ffffffffffff16016001600160401b0316421061145557506000919050565b61145e826113d3565b826040015160ff166114709190611c84565b8260e001516103579190611c13565b6040516001600160a01b0383166024820152604481018290526114af90849063a9059cbb60e01b9060640161110e565b505050565b606061138e8383604051806060016040528060278152602001611eb6602791396115ae565b600061152e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116269092919063ffffffff16565b905080516000148061154f57508080602001905181019061154f9190611e64565b6114af5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610286565b6060600080856001600160a01b0316856040516115cb9190611e86565b600060405180830381855af49150503d8060008114611606576040519150601f19603f3d011682016040523d82523d6000602084013e61160b565b606091505b509150915061161c86838387611635565b9695505050505050565b60606104a184846000856116ae565b606083156116a457825160000361169d576001600160a01b0385163b61169d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610286565b50816104a1565b6104a18383611789565b60608247101561170f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610286565b600080866001600160a01b0316858760405161172b9190611e86565b60006040518083038185875af1925050503d8060008114611768576040519150601f19603f3d011682016040523d82523d6000602084013e61176d565b606091505b509150915061177e87838387611635565b979650505050505050565b8151156117995781518083602001fd5b8060405162461bcd60e51b81526004016102869190611ea2565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081019190915290565b803560ff8116811461181057600080fd5b919050565b6000806040838503121561182857600080fd5b82359150611838602084016117ff565b90509250929050565b6001600160a01b0381168114610fbd57600080fd5b60008083601f84011261186857600080fd5b5081356001600160401b0381111561187f57600080fd5b6020830191508360208260051b850101111561189a57600080fd5b9250929050565b600080600080606085870312156118b757600080fd5b84356118c281611841565b93506020850135925060408501356001600160401b038111156118e457600080fd5b6118f087828801611856565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b8181101561193457835183529284019291840191600101611918565b50909695505050505050565b6000806040838503121561195357600080fd5b82359150602083013561196581611841565b809150509250929050565b60006020828403121561198257600080fd5b5035919050565b81516001600160a01b031681526020808301516001600160401b0316908201526040808301516101208301916119c39084018260ff169052565b5060608301516119de60608401826001600160a01b03169052565b5060808301516119f8608084018265ffffffffffff169052565b5060a0830151611a1260a084018265ffffffffffff169052565b5060c0830151611a2d60c08401826001600160a01b03169052565b5060e083015160e083015261010080840151818401525092915050565b60008060008060008060c08789031215611a6357600080fd5b8635611a6e81611841565b95506020870135611a7e81611841565b945060408701356001600160401b0381168114611a9a57600080fd5b935060608701359250608087013565ffffffffffff81168114611abc57600080fd5b9150611aca60a088016117ff565b90509295509295509295565b60008060208385031215611ae957600080fd5b82356001600160401b03811115611aff57600080fd5b611b0b85828601611856565b90969095509350505050565b60005b83811015611b32578181015183820152602001611b1a565b50506000910152565b60008151808452611b53816020860160208601611b17565b601f01601f19169290920160200192915050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b82811015611bbe57603f19888603018452611bac858351611b3b565b94509285019290850190600101611b90565b5092979650505050505050565b634e487b7160e01b600052601160045260246000fd5b60ff828116828216039081111561035757610357611bcb565b60ff818116838216019081111561035757610357611bcb565b808202811582820484141761035757610357611bcb565b8082018082111561035757610357611bcb565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060208284031215611c7b57600080fd5b61138e826117ff565b8181038181111561035757610357611bcb565b600060208284031215611ca957600080fd5b815163ffffffff8116811461138e57600080fd5b634e487b7160e01b600052601260045260246000fd5b600065ffffffffffff80841680611cec57611cec611cbd565b92169190910692915050565b6001600160401b03828116828216039080821115611d1857611d18611bcb565b5092915050565b60006001600160401b0380841680611cec57611cec611cbd565b600060208284031215611d4b57600080fd5b5051919050565b6000808335601e19843603018112611d6957600080fd5b8301803591506001600160401b03821115611d8357600080fd5b60200191503681900382131561189a57600080fd5b828482376000838201600081528351611db5818360208801611b17565b0195945050505050565b6040808252810183905260008460608301825b86811015611dfa5760ff611de5846117ff565b16825260209283019290910190600101611dd2565b5060209390930193909352509392505050565b6001600160401b03818116838216028082169190828114610df357610df3611bcb565b6001600160401b03818116838216019080821115611d1857611d18611bcb565b600082611e5f57611e5f611cbd565b500490565b600060208284031215611e7657600080fd5b8151801515811461138e57600080fd5b60008251611e98818460208701611b17565b9190910192915050565b60208152600061138e6020830184611b3b56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220ccc76c0273e6f6811614b24f1776a756ee3541a5a42325c2939d2c35d9d161f564736f6c634300081800330000000000000000000000004d5f2cd31701f3e5de77b3f89ee7b80eb87b4acc