Address Contract Verified
Address
0x24eA9c1cfD77A8DB3fB707F967309cF013CC1078
Balance
0 ETH
Nonce
3
Code Size
10394 bytes
Creator
0x381657fd...ACB7 at tx 0xe983e2cc...3490dc
Indexed Transactions
0
Contract Bytecode
10394 bytes
0x6080604052600436106102025760003560e01c80635ceb139b1161011d5780639c89a10a116100b0578063cb7423581161007f578063dd62ed3e11610064578063dd62ed3e14610a24578063ea44539614610a6c578063f2ae927414610aac57610413565b8063cb742358146109cf578063d6a42d8514610a0f57610413565b80639c89a10a1461091f578063a9059cbb14610934578063c4d66de81461097a578063c836a489146109ba57610413565b806370a08231116100ec57806370a08231146108b5578063861a48dd146108f557806390996b2d1461090a57806395d89b411461049e57610413565b80635ceb139b146108375780636656d736146108615780636b2b3bf3146108765780636cb74849146108a057610413565b80632929abe61161019557806332cb6b0c1161016457806332cb6b0c14610772578063371139581461078757806340c10f19146107b15780635ca2a92d146107f757610413565b80632929abe61461064e5780632a455d791461071d5780632d13535714610732578063313ce5671461074757610413565b8063095ea7b3116101d1578063095ea7b31461054f57806318160ddd146105a957806319aef059146105be57806323b872dd146105fe57610413565b806302d05d3f14610418578063065e6eb71461045657806306fdde031461049e57806308ab59761461052857610413565b36610413576002600054141561027957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560095443108015906102a357506008546009546102a09163ffffffff610ac116565b43105b61030e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5075626c696350726573616c653a20494e414354495645000000000000000000604482015290519081900360640190fd5b6000610332603261032634606463ffffffff610b3916565b9063ffffffff610bbf16565b60405190915073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ab96c12881a2e9ffa6706ae68bcfa4ecd1a8bf2116903480156108fc02916000818181858888f19350505050158015610397573d6000803e3d6000fd5b506103a23082610c40565b336000908152600b60205260409020546103c2908263ffffffff610ac116565b336000818152600b6020908152604091829020939093558051848152905191927fc397d7d9ef7c1875b142a11050c810d23e0965e3c5ea3bb28dc1c9d2032e146592918290030190a2506001600055005b600080fd5b34801561042457600080fd5b5061042d610d28565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561046257600080fd5b5061049c6004803603604081101561047957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610d4c565b005b3480156104aa57600080fd5b506104b3611007565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104ed5781810151838201526020016104d5565b50505050905090810190601f16801561051a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053457600080fd5b5061053d611040565b60408051918252519081900360200190f35b34801561055b57600080fd5b506105956004803603604081101561057257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611046565b604080519115158252519081900360200190f35b3480156105b557600080fd5b5061053d61105c565b3480156105ca57600080fd5b5061053d600480360360208110156105e157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611062565b34801561060a57600080fd5b506105956004803603606081101561062157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135909116906040013561107d565b34801561065a57600080fd5b5061049c6004803603604081101561067157600080fd5b81019060208101813564010000000081111561068c57600080fd5b82018360208201111561069e57600080fd5b803590602001918460208302840111640100000000831117156106c057600080fd5b9193909290916020810190356401000000008111156106de57600080fd5b8201836020820111156106f057600080fd5b8035906020019184602083028401116401000000008311171561071257600080fd5b50909250905061115c565b34801561072957600080fd5b5061053d61156e565b34801561073e57600080fd5b5061042d61157b565b34801561075357600080fd5b5061075c611597565b6040805160ff9092168252519081900360200190f35b34801561077e57600080fd5b5061053d61159c565b34801561079357600080fd5b5061049c600480360360208110156107aa57600080fd5b50356115aa565b3480156107bd57600080fd5b5061049c600480360360408110156107d457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611670565b34801561080357600080fd5b5061053d6004803603602081101561081a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611780565b34801561084357600080fd5b5061049c6004803603602081101561085a57600080fd5b5035611793565b34801561086d57600080fd5b5061053d611859565b34801561088257600080fd5b5061049c6004803603602081101561089957600080fd5b503561185f565b3480156108ac57600080fd5b5061049c611925565b3480156108c157600080fd5b5061053d600480360360208110156108d857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166119ad565b34801561090157600080fd5b5061049c6119bf565b34801561091657600080fd5b5061053d611af1565b34801561092b57600080fd5b5061042d611af7565b34801561094057600080fd5b506105956004803603604081101561095757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611b1b565b34801561098657600080fd5b5061049c6004803603602081101561099d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611b28565b3480156109c657600080fd5b5061042d611e24565b3480156109db57600080fd5b5061053d600480360360208110156109f257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611e40565b348015610a1b57600080fd5b5061049c611ebc565b348015610a3057600080fd5b5061053d60048036036040811015610a4757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611fcd565b348015610a7857600080fd5b5061053d60048036036020811015610a8f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611fea565b348015610ab857600080fd5b5061049c611ffd565b80820182811015610b3357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b92915050565b6000811580610b5457505080820282828281610b5157fe5b04145b610b3357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b6000808211610c2f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381610c3857fe5b049392505050565b610c49826120da565b6000610c7382610c6e60035469d3c21bcecceda100000061214690919063ffffffff16565b6121b8565b600354909150610c89908263ffffffff610ac116565b60035573ffffffffffffffffffffffffffffffffffffffff8316600090815260046020526040902054610cc2908263ffffffff610ac116565b73ffffffffffffffffffffffffffffffffffffffff841660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3505050565b7f000000000000000000000000381657fde9bfe7558837757ac54249ef748cacb781565b60026000541415610dbe57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055601054158015610e5b57503073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e1657600080fd5b505af1158015610e2a573d6000803e3d6000fd5b505050506040513d6020811015610e4057600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633145b610ec657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5072697661746550726573616c653a20464f5242494444454e00000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82166000908152600f6020526040812054601354610f10918491610f049163ffffffff61214616565b9063ffffffff610ac116565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600f60205260409020839055601254909150811115610fac57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072697661746550726573616c653a204c494d49545f45584345454445440000604482015290519081900360640190fd5b601381905560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fbe03476e65e5189c31bd84cd775900e0b2cd200157a96ac8dfbdef41ebde5111919081900360200190a25050600160005550565b6040518060400160405280600481526020017f4341564f0000000000000000000000000000000000000000000000000000000081525081565b60145481565b60006110533384846121d0565b50600192915050565b60035481565b6000611075600a8363ffffffff61223f16565b90505b919050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146111475773ffffffffffffffffffffffffffffffffffffffff84166000908152600560209081526040808320338452909152902054611115908363ffffffff61214616565b73ffffffffffffffffffffffffffffffffffffffff851660009081526005602090815260408083203384529091529020555b6111528484846123a4565b5060019392505050565b600260005414156111ce57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000819055503073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561121e57600080fd5b505af1158015611232573d6000803e3d6000fd5b505050506040513d602081101561124857600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633146112cd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5072697661746550726573616c653a20464f5242494444454e00000000000000604482015290519081900360640190fd5b82811461133b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072697661746550726573616c653a20494e56414c49445f4c454e4754480000604482015290519081900360640190fd5b60135460005b848110156114ee5760006113da85858481811061135a57fe5b90506020020135600e60010160008a8a8781811061137457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ac190919063ffffffff16565b905080600f60008989868181106113ed57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061146d85858481811061145757fe5b9050602002013584610ac190919063ffffffff16565b925086868381811061147b57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fbe03476e65e5189c31bd84cd775900e0b2cd200157a96ac8dfbdef41ebde5111826040518082815260200191505060405180910390a250600101611341565b5060125481111561156057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072697661746550726573616c653a204c494d49545f45584345454445440000604482015290519081900360640190fd5b601355505060016000555050565b681158e460913d00000081565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b601281565b69d3c21bcecceda100000081565b6002600054141561161c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055611632600e8263ffffffff61249716565b60408051828152905133917fb03c8c81bb6d72dee6ebce4af4bb86d2e26c4bca834f3336ad1ab65bcb106501919081900360200190a2506001600055565b600260005414156116e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560015473ffffffffffffffffffffffffffffffffffffffff16331461176d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f45786361766f3a20464f5242494444454e000000000000000000000000000000604482015290519081900360640190fd5b6117778282610c40565b50506001600055565b600061107560158363ffffffff61223f16565b6002600054141561180557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005561181b600a8263ffffffff61249716565b60408051828152905133917f1f003ee3725820392d2b4856070622ffd741edb3e27990d39f2a187f4dc0170b919081900360200190a2506001600055565b60135481565b600260005414156118d157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000556118e760158263ffffffff61249716565b60408051828152905133917fdb368e38c472e99d6c54fb15b254413b586036601f2031cf705d2b488a25f850919081900360200190a2506001600055565b6002600054141561199757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000556119a66015612552565b6001600055565b60046020526000908152604090205481565b60026000541415611a3157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055600954158015611a7b57503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000381657fde9bfe7558837757ac54249ef748cacb716145b611ae657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5075626c696350726573616c653a20464f5242494444454e0000000000000000604482015290519081900360640190fd5b436009556001600055565b60125481565b7f000000000000000000000000ab96c12881a2e9ffa6706ae68bcfa4ecd1a8bf2181565b60006110533384846123a4565b60026000541415611b9a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000553373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000381657fde9bfe7558837757ac54249ef748cacb716148015611c8e5750600254604080517fc45a0155000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163c45a0155916004808301926020929190829003018186803b158015611c4a57600080fd5b505afa158015611c5e573d6000803e3d6000fd5b505050506040513d6020811015611c7457600080fd5b505173ffffffffffffffffffffffffffffffffffffffff16145b611cf957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f455843563a20464f5242494444454e0000000000000000000000000000000000604482015290519081900360640190fd5b600254604080517fc4d66de800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301529151919092169163c4d66de891602480830192600092919082900301818387803b158015611d6d57600080fd5b505af1158015611d81573d6000803e3d6000fd5b5050600154600254604080517f485cc95500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301529283166024820152905191909216935063485cc9559250604480830192600092919082900301818387803b158015611e0457600080fd5b505af1158015611e18573d6000803e3d6000fd5b50506001600055505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460209081526040808320546007909252822054430315611e7f579050611078565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020526040902054808210611eb25780611eb4565b815b949350505050565b60026000541415611f2e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260005560095415801590611f585750600854600954611f549163ffffffff610ac116565b4310155b611fc357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5075626c696350726573616c653a20494e56414c49445f504152414d53000000604482015290519081900360640190fd5b6119a6600a612552565b600560209081526000928352604080842090915290825290205481565b6000611075600e8363ffffffff61223f16565b6002600054141561206f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055601254601354146120d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061283e6027913960400191505060405180910390fd5b6119a6600e612552565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600760205260409020544303156121435773ffffffffffffffffffffffffffffffffffffffff81166000908152600460209081526040808320546006835281842055600790915290204390555b50565b80820382811115610b3357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b60008183106121c757816121c9565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000826002015460001480612258575082600201544311155b80612288575073ffffffffffffffffffffffffffffffffffffffff82166000908152600184016020526040902054155b1561229557506000610b33565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001840160205260408120546122d59060649061032690600a63ffffffff610b3916565b600385015473ffffffffffffffffffffffffffffffffffffffff851660009081526001870160205260408120549293509161232b9163ffffffff9081169161231f918690610bbf16565b9063ffffffff610b3916565b73ffffffffffffffffffffffffffffffffffffffff85166000908152602087905260409020546003870154600288015492935061239b9261238f91869161231f9163ffffffff908116916103269186906123899083908c90610ac116565b436121b8565b9063ffffffff61214616565b95945050505050565b6123ad836120da565b6123b6826120da565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600460205260409020546123ec908263ffffffff61214616565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260046020526040808220939093559084168152205461242e908263ffffffff610ac116565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6124a1823361223f565b81111561250f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f446973747269627574696f6e4c6962726172793a204f56455244524146540000604482015290519081900360640190fd5b3360009081526020839052604090205461252f908263ffffffff610ac116565b3360008181526020859052604090209190915561254e90309083612660565b5050565b60028101541580156125ec57503073ffffffffffffffffffffffffffffffffffffffff166302d05d3f6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156125a757600080fd5b505af11580156125bb573d6000803e3d6000fd5b505050506040513d60208110156125d157600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1633145b61265757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f446973747269627574696f6e4c6962726172793a20464f5242494444454e0000604482015290519081900360640190fd5b43600290910155565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b6020831061273657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016126f9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612798576040519150601f19603f3d011682016040523d82523d6000602084013e61279d565b606091505b50915091508180156127cb5750805115806127cb57508080602001905160208110156127c857600080fd5b50515b61283657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b505050505056fe5072697661746550726573616c653a20444953545249425554494f4e5f554e46494e4953484544a2646970667358221220ba9fcfb51b0b0aed1f6f38b2dbddbb608fe5ecd1e385b1b61e5829dd8e57966664736f6c63430006060033
Verified Source Code Full Match
Compiler: v0.6.6+commit.6c089d02
EVM: istanbul
Optimization: Yes (999999 runs)
CAVO.sol 61 lines
pragma solidity >=0.6.6;
import './PublicPresale.sol';
import './xCAVO.sol';
import './EXCV.sol';
import './TeamDistribution.sol';
import './PrivatePresale.sol';
contract CAVO is PublicPresale, PrivatePresale, TeamDistribution {
uint private constant PUBLIC_PRESALE_DURATION_IN_BLOCKS = 7 * 6500;
uint32 private constant PRESALE_VESTING_PERIOD_IN_BLOCKS = 7 * 6500;
uint private constant PRIVATE_PRESALE_DISTRIBUTED_CAVO_IN_WEI = 1460.769 ether;
address private constant PUBLIC_PRESALE_OWNER = 0xAb96C12881A2E9Ffa6706Ae68bCFA4EcD1A8bf21;
address[] private teamAddresses = [
0x381657fdE9bfE7558837757aC54249Ef748CACB7, // A.M.
0x564569020c298D2487445CCa5C5ef3eD8cd408A3, // Y.O.
0xDfe2abc3d395a87a1476f5B707E77f5F23B1d88b, // A.
0x8CF3329E378c6196F35f5cB7eea5040873f8AC8C, // D.B.
0x8B9a2b2d9a41909D613C81F2f344E364cD62b63C, // Z.
0x57B93A6b8954938DE455BE95c9AA7843b99D7DEa, // V.
0xf0393FB1e988317ca6E3fb986874D019dE712c7d, // M.
0x698f4a1f42c3601579A3E40a9e4D90C2032C443a // X.
];
uint[] private teamAmounts = [
40000 ether, // A.M.
40000 ether, // Y.O.
15000 ether, // A.
10000 ether, // D.B.
50000 ether, // Z.
30000 ether, // V.
10000 ether, // M.
5000 ether // X.
];
constructor()
public
PublicPresale(PUBLIC_PRESALE_OWNER, PRESALE_VESTING_PERIOD_IN_BLOCKS, PUBLIC_PRESALE_DURATION_IN_BLOCKS)
PrivatePresale(PRESALE_VESTING_PERIOD_IN_BLOCKS, PRIVATE_PRESALE_DISTRIBUTED_CAVO_IN_WEI)
TeamDistribution(PRESALE_VESTING_PERIOD_IN_BLOCKS, teamAddresses, teamAmounts)
{
address _xCAVO;
address _EXCV;
bytes memory xCAVOBytecode = type(xCAVO).creationCode;
bytes memory EXCVBytecode = type(EXCV).creationCode;
bytes32 xCAVOSalt = keccak256(abi.encodePacked("xCAVO"));
bytes32 EXCVSalt = keccak256(abi.encodePacked("EXCV"));
assembly {
_xCAVO := create2(0, add(xCAVOBytecode, 32), mload(xCAVOBytecode), xCAVOSalt)
_EXCV := create2(0, add(EXCVBytecode, 32), mload(EXCVBytecode), EXCVSalt)
}
xCAVOToken = _xCAVO;
EXCVToken = _EXCV;
_mint(address(this), totalTeamDistribution.add(totalPrivatePresaleDistribution));
}
}
EXCV.sol 88 lines
pragma solidity >=0.6.6;
import './interfaces/IExcavoERC20.sol';
import './interfaces/ICAVO.sol';
import './libraries/Math.sol';
import "./xEXCV.sol";
contract EXCV is IEXCV, IExcavoERC20, ReentrancyGuard {
using SafeMath for uint;
string public constant override name = 'EXCV';
string public constant override symbol = 'EXCV';
uint8 public constant override decimals = 18;
uint public constant override MAX_SUPPLY = 10**9 * 10**18;
// TODO: make sure, it's OK
uint public constant override CREATOR_SUPPLY = 600 * 5 * 10**18;
address public override immutable xEXCVToken;
address public override factory;
uint public override totalSupply;
mapping(address => uint) public override balanceOf;
mapping(address => mapping(address => uint)) public override allowance;
address private immutable creator;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
creator = msg.sender;
address _xEXCV;
bytes memory bytecode = type(xEXCV).creationCode;
bytes32 salt = keccak256(abi.encodePacked("xEXCV"));
assembly {
_xEXCV := create2(0, add(bytecode, 32), mload(bytecode), salt)
}
xEXCVToken = _xEXCV;
}
function initialize(address _factory) external override nonReentrant {
require(factory == address(0) && msg.sender == creator, "EXCV: FORBIDDEN");
factory = _factory;
IxEXCV(xEXCVToken).initialize(_factory);
_mint(ICAVO(creator).creator(), CREATOR_SUPPLY);
}
function _mint(address to, uint value) internal {
uint _value = Math.min(value, MAX_SUPPLY.sub(totalSupply));
totalSupply = totalSupply.add(_value);
balanceOf[to] = balanceOf[to].add(_value);
emit Transfer(address(0), to, _value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function mint(address to, uint value) external override nonReentrant {
require(msg.sender == xEXCVToken, "EXCV: FORBIDDEN");
_mint(to, value);
}
function approve(address spender, uint value) external virtual override nonReentrant returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external virtual override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external virtual override nonReentrant returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
}
xCAVO.sol 131 lines
pragma solidity >=0.6.6;
import './interfaces/IxCAVO.sol';
import './interfaces/ICAVO.sol';
import "./interfaces/IERC20.sol";
import "./interfaces/IEXCV.sol";
import "./interfaces/IExcavoPair.sol";
import "./interfaces/IExcavoFactory.sol";
import './libraries/SafeMath.sol';
import "./libraries/ExcavoLibrary.sol";
import './libraries/UQ112x112.sol';
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
contract xCAVO is IxCAVO, IERC20, ReentrancyGuard {
using SafeMath for uint;
event Redeem(address indexed sender, address indexed recipient, uint amount);
string public constant override name = 'xCAVO';
string public constant override symbol = 'xCAVO';
uint8 public constant override decimals = 18;
uint private constant Q112 = 2**112;
uint private constant WEI_IN_CAVO = 10**18;
uint private constant VESTING_PERIOD = 7020000; // 36 * 30 * 6500 = 7020000 = 36 months in blocks
address public immutable override getCAVO;
address public override excvEthPair;
address public override cavoEthPair;
address public override getEXCV;
mapping(address => uint) private lastAccumulatedMintableCAVOAmount;
mapping(address => uint) private lastAccumulatedUnclaimedLiquidity;
uint public override accumulatedMintableCAVOAmount;
uint private firstBlockNumber;
uint private lastBlockNumber;
uint internal expectedPriceInUQ;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
getCAVO = msg.sender;
}
function initialize(address _factory, address _EXCV) external override nonReentrant {
require(getEXCV == address(0) && excvEthPair == address(0) && cavoEthPair == address(0) && msg.sender == getCAVO, "xCAVO: FORBIDDEN");
getEXCV = _EXCV;
address WETH = IExcavoFactory(_factory).WETHToken();
excvEthPair = ExcavoLibrary.pairFor(_factory, getEXCV, WETH);
cavoEthPair = ExcavoLibrary.pairFor(_factory, getCAVO, WETH);
}
function registerPairCreation() external override nonReentrant {
require(firstBlockNumber == 0 && msg.sender == cavoEthPair, "xCAVO: FORBIDDEN");
firstBlockNumber = block.number;
lastBlockNumber = block.number;
}
function totalSupply() external view override returns (uint) {
return IERC20(getCAVO).totalSupply();
}
function balanceOf(address owner) external view override returns (uint) {
uint totalUnclaimedLiquidity = IExcavoPair(excvEthPair).accumulatedLiquidityGrowth() - lastAccumulatedUnclaimedLiquidity[owner];
if (totalUnclaimedLiquidity == 0) {
return 0;
}
uint totalMintableCAVO = accumulatedMintableCAVOAmount - lastAccumulatedMintableCAVOAmount[owner];
uint liquidity = IExcavoPair(excvEthPair).unclaimedLiquidityOf(owner);
return liquidity.mul(totalMintableCAVO) / totalUnclaimedLiquidity;
}
function redeem(address recipient) external override nonReentrant {
uint liquidity = IExcavoPair(excvEthPair).claimAllLiquidity(msg.sender);
uint accumulatedUnclaimedLiquidity = IExcavoPair(excvEthPair).accumulatedUnclaimedLiquidity();
uint totalUnclaimedLiquidity = accumulatedUnclaimedLiquidity - lastAccumulatedUnclaimedLiquidity[msg.sender]; // overflow desired
if (totalUnclaimedLiquidity == 0) {
revert('xCAVO: INSUFFICIENT_MINTED_AMOUNT');
}
uint totalMintableCAVO = accumulatedMintableCAVOAmount - lastAccumulatedMintableCAVOAmount[msg.sender]; // overflow desired
uint mintedAmount = liquidity.mul(totalMintableCAVO) / totalUnclaimedLiquidity;
require(mintedAmount > 0, 'xCAVO: INSUFFICIENT_MINTED_AMOUNT');
lastAccumulatedUnclaimedLiquidity[msg.sender] = accumulatedUnclaimedLiquidity;
lastAccumulatedMintableCAVOAmount[msg.sender] = accumulatedMintableCAVOAmount;
ICAVO(getCAVO).mint(recipient, mintedAmount);
emit Redeem(msg.sender, recipient, mintedAmount);
}
function mint(uint priceInUQ) external override nonReentrant {
require(msg.sender == cavoEthPair, "xCAVO: FORBIDDEN");
if (block.number - firstBlockNumber >= VESTING_PERIOD || block.number == lastBlockNumber) {
return;
}
uint priceChangeInUQ = Q112.mul(block.number.sub(lastBlockNumber)).mul(3).div(6500000);
if (expectedPriceInUQ + priceChangeInUQ < expectedPriceInUQ) {
return; // overflow: stop minting
}
expectedPriceInUQ += priceChangeInUQ; // cannot overflow
if (priceInUQ >= expectedPriceInUQ) {
// mintedAmount = 10^6 * (N - Nprev) * (N + Nprev - 2 * N0) / ((36 * 30 * 6500)^2)
// ((36 * 30 * 6500)**2) = 49280400000000
// 10**6 = 1000000
uint mintedAmount = block.number.sub(lastBlockNumber).mul(1000000)
.mul(block.number.add(lastBlockNumber).sub(firstBlockNumber.mul(2)))
.mul(WEI_IN_CAVO)
.div(49280400000000);
if (mintedAmount > 0) {
accumulatedMintableCAVOAmount = accumulatedMintableCAVOAmount + mintedAmount; // overflow desired
}
}
lastBlockNumber = block.number;
}
function allowance(address /*owner*/, address /*spender*/) external view override returns (uint) {
revert("xCAVO: FORBIDDEN");
}
function approve(address /*spender*/, uint /*value*/) external override returns (bool) {
revert("xCAVO: FORBIDDEN");
}
function transfer(address /*to*/, uint /*value*/) external override returns (bool) {
revert("xCAVO: FORBIDDEN");
}
function transferFrom(address /*from*/, address /*to*/, uint /*value*/) external override returns (bool) {
revert("xCAVO: FORBIDDEN");
}
}
xEXCV.sol 136 lines
pragma solidity >=0.6.6;
import "./interfaces/IxEXCV.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IEXCV.sol";
import "./interfaces/IExcavoFactory.sol";
import "./interfaces/IExcavoPair.sol";
import "./libraries/ExcavoLibrary.sol";
import './libraries/Math.sol';
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
contract xEXCV is IxEXCV, IERC20, ReentrancyGuard {
// each time user adds liquidity to EXCV generating pairs, add active pair address
// each time user removes liquidity to EXCV generating pairs, remove active pair address
using SafeMath for uint;
event Redeem(address indexed sender, address indexed recipient, uint amount);
uint constant MIN_LIQUIDITY_PAIR_COUNT = 3;
address public immutable override getEXCV;
address public override factory;
address public override excvEthPair;
address[] private _liquidityPairs;
string public constant override symbol = "xEXCV";
string public constant override name = "xEXCV";
uint8 public constant override decimals = 18;
constructor() public {
getEXCV = msg.sender;
}
function initialize(address _factory) external override nonReentrant {
require(msg.sender == getEXCV && factory == address(0) && excvEthPair == address(0), "xEXCV: FORBIDDEN");
factory = _factory;
address WETH = IExcavoFactory(_factory).WETHToken();
excvEthPair = ExcavoLibrary.pairFor(_factory, getEXCV, WETH);
}
function addPair(address tokenA, address tokenB) external override nonReentrant {
require(ExcavoLibrary.pairFor(factory, tokenA, tokenB) == msg.sender, "xEXCV: FORBIDDEN");
if (!_pairExists(msg.sender)) {
_liquidityPairs.push(msg.sender);
}
}
function redeem(address recipient) external override nonReentrant {
address[] memory pairs = _liquidityPairs;
uint _circulatingSupply = circulatingSupply();
uint excvQuantity;
for (uint i = 0; i < pairs.length; i++) {
uint lastK = IExcavoPair(pairs[i]).totalSupply();
uint claimedLiquidity = IExcavoPair(pairs[i]).claimAllLiquidity(msg.sender);
excvQuantity = excvQuantity.add(claimedLiquidity.mul(_circulatingSupply).div(lastK));
}
IEXCV(getEXCV).mint(recipient, excvQuantity);
emit Redeem(msg.sender, recipient, excvQuantity);
}
function redeemPair(address recipient, address pair, uint claimedLiquidityAmount) external override nonReentrant {
require(_pairExists(pair), "xEXCV: unknown pair");
uint _circulatingSupply = circulatingSupply();
uint lastK = IExcavoPair(pair).totalSupply();
IExcavoPair(pair).claimLiquidity(msg.sender, claimedLiquidityAmount);
uint excvQuantity = claimedLiquidityAmount.mul(_circulatingSupply).div(lastK);
IEXCV(getEXCV).mint(recipient, excvQuantity);
emit Redeem(msg.sender, recipient, excvQuantity);
}
function totalSupply() external view override returns (uint) {
return IERC20(getEXCV).totalSupply();
}
function balanceOf(address owner) external view override returns (uint) {
address[] memory pairs = _liquidityPairs;
uint _circulatingSupply = circulatingSupply();
uint excvQuantity;
for (uint i = 0; i < pairs.length; i++) {
uint accumulatedLiquidity = IExcavoPair(pairs[i]).unclaimedLiquidityOf(owner);
uint lastK = IExcavoPair(pairs[i]).totalSupply();
excvQuantity = excvQuantity.add(accumulatedLiquidity.mul(_circulatingSupply).div(lastK));
}
return excvQuantity;
}
function liquidityPairs() external view override returns (address[] memory) {
return _liquidityPairs;
}
function pairBalanceOf(address owner, address pair) external view override returns (uint) {
if (!_pairExists(pair)) {
return 0;
}
uint lastK = IExcavoPair(pair).totalSupply();
if (lastK == 0) {
return 0;
}
uint _circulatingSupply = circulatingSupply();
uint accumulatedLiquidity = IExcavoPair(pair).unclaimedLiquidityOf(owner);
return accumulatedLiquidity.mul(_circulatingSupply) / lastK;
}
function circulatingSupply() private view returns (uint) {
(uint reserve0, uint reserve1, ) = IExcavoPair(excvEthPair).getReserves();
return IExcavoPair(excvEthPair).token0() == getEXCV ? reserve0 : reserve1;
}
function _pairExists(address pair) private view returns (bool) {
address[] memory pairs = _liquidityPairs;
for (uint i = 0; i < pairs.length; ++i) {
if (pairs[i] == pair) {
return true;
}
}
return false;
}
function allowance(address /*owner*/, address /*spender*/) external view override returns (uint) {
revert("xEXCV: FORBIDDEN");
}
function approve(address /*spender*/, uint /*value*/) external override returns (bool) {
revert("xEXCV: FORBIDDEN");
}
function transfer(address /*to*/, uint /*value*/) external override returns (bool) {
revert("xEXCV: FORBIDDEN");
}
function transferFrom(address /*from*/, address /*to*/, uint /*value*/) external override returns (bool) {
revert("xEXCV: FORBIDDEN");
}
}
BaseCAVO.sol 105 lines
pragma solidity >=0.6.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import './libraries/SafeMath.sol';
import './libraries/Math.sol';
import './interfaces/ICAVO.sol';
import './interfaces/IExcavoERC20.sol';
import './interfaces/IxCAVO.sol';
import './interfaces/IEXCV.sol';
import './interfaces/IExcavoFactory.sol';
contract BaseCAVO is ICAVO, IExcavoERC20, ReentrancyGuard {
using SafeMath for uint;
string public constant override name = 'CAVO';
string public constant override symbol = 'CAVO';
uint8 public constant override decimals = 18;
uint public constant override MAX_SUPPLY = 10**6 * 10**18;
uint public constant override CREATOR_SUPPLY = 200 ether + 120 ether;
address public override xCAVOToken;
address public immutable override creator;
address public override EXCVToken;
uint public override totalSupply;
mapping(address => uint) public override balanceOf;
mapping(address => mapping(address => uint)) public override allowance;
mapping(address => uint) private lastBalanceOf;
mapping(address => uint) private lastBalanceBlockOf;
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
constructor() public {
creator = msg.sender;
_mint(msg.sender, CREATOR_SUPPLY);
}
function initialize(address _factory) external override nonReentrant {
require(msg.sender == creator && IEXCV(EXCVToken).factory() == address(0), 'EXCV: FORBIDDEN');
IEXCV(EXCVToken).initialize(_factory);
IxCAVO(xCAVOToken).initialize(_factory, EXCVToken);
}
function virtualBalanceOf(address account) external view override returns (uint) {
uint balance = balanceOf[account];
if (block.number - lastBalanceBlockOf[account] > 0) {
return balance;
}
uint lastBalance = lastBalanceOf[account];
return balance < lastBalance ? balance : lastBalance;
}
function mint(address account, uint256 amount) external override nonReentrant {
require(msg.sender == xCAVOToken, 'Excavo: FORBIDDEN');
_mint(account, amount);
}
function _mint(address to, uint value) internal {
_saveLastBalance(to);
uint _value = Math.min(value, MAX_SUPPLY.sub(totalSupply));
totalSupply = totalSupply.add(_value);
balanceOf[to] = balanceOf[to].add(_value);
emit Transfer(address(0), to, _value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) internal {
_saveLastBalance(from);
_saveLastBalance(to);
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external virtual override returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external virtual override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external virtual override returns (bool) {
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function _saveLastBalance(address account) private {
if (block.number - lastBalanceBlockOf[account] > 0) {
lastBalanceOf[account] = balanceOf[account];
lastBalanceBlockOf[account] = block.number;
}
}
}
PublicPresale.sol 62 lines
pragma solidity >=0.6.6;
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import './libraries/TransferHelper.sol';
import './libraries/Math.sol';
import './libraries/SafeMath.sol';
import './libraries/DistributionLibrary.sol';
import './interfaces/ICAVO.sol';
import './interfaces/IExcavoERC20.sol';
import './interfaces/IxCAVO.sol';
import './interfaces/IPublicPresale.sol';
import './BaseCAVO.sol';
contract PublicPresale is BaseCAVO, IPublicPresale {
using SafeMath for uint;
using DistributionLibrary for DistributionLibrary.Data;
event PublicPresalePurchase(address indexed recipient, uint amount);
event PublicDistributed(address indexed recipient, uint amount);
address public immutable override presaleOwner;
uint private presaleDurationInBlocks;
uint private presaleStartBlock;
DistributionLibrary.Data private distribution;
constructor(address _presaleOwner, uint32 _vestingBlocksInPeriod, uint _presaleDurationInBlocks) public {
presaleOwner = _presaleOwner;
distribution.blocksInPeriod = _vestingBlocksInPeriod;
presaleDurationInBlocks = _presaleDurationInBlocks;
}
function availablePublicPresaleAmountOf(address account) external view override returns (uint) {
return distribution.availableAmountOf(account);
}
function publicPresaleClaim(uint amount) external override nonReentrant {
distribution.claim(amount);
emit PublicDistributed(msg.sender, amount);
}
function startPublicPresaleDistribution() external override nonReentrant {
require(presaleStartBlock != 0 && block.number >= presaleStartBlock.add(presaleDurationInBlocks), 'PublicPresale: INVALID_PARAMS');
distribution.start();
}
function startPublicPresale() external override nonReentrant {
require(presaleStartBlock == 0 && msg.sender == creator, 'PublicPresale: FORBIDDEN');
presaleStartBlock = block.number;
}
receive() external payable nonReentrant {
require(block.number >= presaleStartBlock && block.number < presaleStartBlock.add(presaleDurationInBlocks), 'PublicPresale: INACTIVE');
// P = 0.5 ETH/CAVO
uint mintedCAVO = msg.value.mul(100).div(50);
payable(presaleOwner).transfer(msg.value);
_mint(address(this), mintedCAVO);
distribution.maxAmountOf[msg.sender] = distribution.maxAmountOf[msg.sender].add(mintedCAVO);
emit PublicPresalePurchase(msg.sender, mintedCAVO);
}
}
PrivatePresale.sol 66 lines
pragma solidity >=0.6.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import './libraries/TransferHelper.sol';
import './libraries/SafeMath.sol';
import './libraries/DistributionLibrary.sol';
import './interfaces/ICAVO.sol';
import './interfaces/IExcavoERC20.sol';
import './interfaces/IxCAVO.sol';
import './interfaces/IPrivatePresale.sol';
abstract contract PrivatePresale is IPrivatePresale, ICAVO, IExcavoERC20, ReentrancyGuard {
using SafeMath for uint;
using DistributionLibrary for DistributionLibrary.Data;
event PrivateDistributionInitialized(address indexed recipient, uint amount);
event PrivateDistributed(address indexed recipient, uint amount);
DistributionLibrary.Data private distribution;
uint public override totalPrivatePresaleDistribution;
uint public override privatePresaleDistributed;
constructor(uint32 _blocksInPeriod, uint _totalPrivatePresaleDistribution) public {
distribution.blocksInPeriod = _blocksInPeriod;
totalPrivatePresaleDistribution = _totalPrivatePresaleDistribution;
}
function distribute(address[] calldata _accounts, uint[] calldata _amounts) external override nonReentrant {
require(msg.sender == ICAVO(address(this)).creator(), 'PrivatePresale: FORBIDDEN');
require(_accounts.length == _amounts.length, 'PrivatePresale: INVALID_LENGTH');
uint _distributed = privatePresaleDistributed;
for (uint i = 0; i < _accounts.length; ++i) {
uint max = distribution.maxAmountOf[_accounts[i]].add(_amounts[i]);
distribution.maxAmountOf[_accounts[i]] = max;
_distributed = _distributed.add(_amounts[i]);
emit PrivateDistributionInitialized(_accounts[i], max);
}
require(_distributed <= totalPrivatePresaleDistribution, 'PrivatePresale: LIMIT_EXCEEDED');
privatePresaleDistributed = _distributed;
}
function editDistributed(address _account, uint _amount) external override nonReentrant {
// disabled if admin has started the private presale distribution
require(distribution.unlockBlock == 0 && msg.sender == ICAVO(address(this)).creator(), 'PrivatePresale: FORBIDDEN');
uint _distributed = privatePresaleDistributed.sub(distribution.maxAmountOf[_account]).add(_amount);
distribution.maxAmountOf[_account] = _amount;
require(_distributed <= totalPrivatePresaleDistribution, 'PrivatePresale: LIMIT_EXCEEDED');
privatePresaleDistributed = _distributed;
emit PrivateDistributionInitialized(_account, _amount);
}
function availablePrivatePresaleAmountOf(address account) external view override returns (uint) {
return distribution.availableAmountOf(account);
}
function privatePresaleClaim(uint amount) external override nonReentrant {
distribution.claim(amount);
emit PrivateDistributed(msg.sender, amount);
}
function startPrivatePresaleDistribution() external override nonReentrant {
// called, once admin has distributed all of the presale tokens
require(privatePresaleDistributed == totalPrivatePresaleDistribution, 'PrivatePresale: DISTRIBUTION_UNFINISHED');
distribution.start();
}
}
Math.sol 23 lines
pragma solidity >=0.6.6;
// a library for performing various math operations
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
TeamDistribution.sol 45 lines
pragma solidity >=0.6.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import './libraries/TransferHelper.sol';
import './libraries/Math.sol';
import './libraries/SafeMath.sol';
import './libraries/DistributionLibrary.sol';
import './interfaces/ICAVO.sol';
import './interfaces/IExcavoERC20.sol';
import './interfaces/IxCAVO.sol';
import './interfaces/ITeamDistribution.sol';
abstract contract TeamDistribution is ITeamDistribution, ICAVO, IExcavoERC20, ReentrancyGuard {
using SafeMath for uint;
using DistributionLibrary for DistributionLibrary.Data;
event TeamDistributed(address indexed recipient, uint amount);
uint public override totalTeamDistribution;
DistributionLibrary.Data private distribution;
constructor(uint32 _blocksInPeriod, address[] memory _team, uint[] memory _amounts) public {
require(_team.length == _amounts.length, 'TeamDistribution: INVALID_PARAMS');
uint total;
for (uint i = 0; i < _team.length; ++i) {
distribution.maxAmountOf[_team[i]] = _amounts[i];
total = total.add(_amounts[i]);
}
totalTeamDistribution = total;
distribution.blocksInPeriod = _blocksInPeriod;
}
function availableTeamMemberAmountOf(address account) external view override returns (uint) {
return distribution.availableAmountOf(account);
}
function teamMemberClaim(uint amount) external override nonReentrant {
distribution.claim(amount);
emit TeamDistributed(msg.sender, amount);
}
function startTeamDistribution() external override nonReentrant {
distribution.start();
}
}
ICAVO.sol 12 lines
pragma solidity >=0.6.6;
interface ICAVO {
function MAX_SUPPLY() external pure returns(uint);
function CREATOR_SUPPLY() external pure returns(uint);
function creator() external returns (address);
function xCAVOToken() external view returns (address);
function EXCVToken() external view returns (address);
function mint(address to, uint value) external;
function initialize(address _factory) external;
function virtualBalanceOf(address account) external view returns (uint);
}
IEXCV.sol 11 lines
pragma solidity >=0.6.6;
interface IEXCV {
function MAX_SUPPLY() external pure returns(uint);
function CREATOR_SUPPLY() external pure returns(uint);
function xEXCVToken() external view returns (address);
function factory() external view returns (address);
function mint(address to, uint value) external;
function initialize(address _factory) external;
}
IERC20.sol 17 lines
pragma solidity >=0.6.6;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
IxCAVO.sol 14 lines
pragma solidity >=0.6.6;
interface IxCAVO {
function excvEthPair() external view returns (address);
function cavoEthPair() external view returns (address);
function getEXCV() external view returns (address);
function getCAVO() external view returns (address);
function redeem(address recipient) external;
function initialize(address _factory, address _EXCV) external;
function registerPairCreation() external;
function mint(uint price) external;
function accumulatedMintableCAVOAmount() external view returns (uint);
}
IxEXCV.sol 14 lines
pragma solidity >=0.6.6;
interface IxEXCV {
function liquidityPairs() external view returns (address[] memory);
function factory() external view returns (address);
function excvEthPair() external view returns (address);
function getEXCV() external view returns (address);
function initialize(address _factory) external;
function redeem(address recipient) external;
function redeemPair(address recipient, address pair, uint claimedLiquidityAmount) external;
function addPair(address tokenA, address tokenB) external;
function pairBalanceOf(address owner, address pair) external view returns (uint);
}
SafeMath.sol 22 lines
pragma solidity >=0.6.6;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
function div(uint x, uint y) internal pure returns (uint z) {
require(y > 0, "SafeMath: division by zero");
z = x / y;
}
}
UQ112x112.sol 20 lines
pragma solidity >=0.6.6;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
IExcavoPair.sol 44 lines
pragma solidity >=0.6.6;
import './IExcavoERC20.sol';
interface IExcavoPair is IExcavoERC20 {
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function router() external view returns (address);
function accumulatedLiquidityGrowth() external view returns (uint);
function accumulatedUnclaimedLiquidity() external view returns (uint);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata _data, uint discount) external;
function skim(address to) external;
function sync() external;
function initialize(address, address, address) external;
function setxEXCV(address) external;
function unclaimedLiquidityOf(address) external view returns (uint);
function claimLiquidity(address account, uint256 amount) external returns (uint claimAmount);
function claimAllLiquidity(address account) external returns (uint claimAmount);
function compoundLiquidity() external;
function setCAVO(address _CAVO, address _xCAVO) external;
}
IExcavoERC20.sol 17 lines
pragma solidity >=0.6.6;
interface IExcavoERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
ExcavoLibrary.sol 82 lines
pragma solidity >=0.6.6;
import '../interfaces/IExcavoPair.sol';
import "./SafeMath.sol";
import './Math.sol';
library ExcavoLibrary {
using SafeMath for uint;
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'ExcavoLibrary: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'ExcavoLibrary: ZERO_ADDRESS');
}
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'3b4596e5d4f0ba0faf3c029e2a152a4931e4da86804417810c5960569e839f1e' // init code hash
))));
}
// fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IExcavoPair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
}
// given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'ExcavoLibrary: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'ExcavoLibrary: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA;
}
// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut, uint discount) internal pure returns (uint amountOut) {
require(amountIn > 0, 'ExcavoLibrary: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'ExcavoLibrary: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(10000 - 4 * discount);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(10000).add(amountInWithFee);
amountOut = numerator / denominator;
}
// given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut, uint discount) internal pure returns (uint amountIn) {
require(amountOut > 0, 'ExcavoLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'ExcavoLibrary: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amountOut).mul(10000);
uint denominator = reserveOut.sub(amountOut).mul(10000 - 4 * discount);
amountIn = (numerator / denominator).add(1);
}
// performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path, uint discount) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'ExcavoLibrary: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut, discount);
}
}
// performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path, uint discount) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'ExcavoLibrary: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut, discount);
}
}
}
TransferHelper.sol 29 lines
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.6;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
}
function safeTransfer(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint value) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
function safeTransferETH(address to, uint value) internal {
(bool success,) = to.call{value:value}(new bytes(0));
require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
}
}
IExcavoFactory.sol 19 lines
pragma solidity >=0.6.6;
interface IExcavoFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function EXCVToken() external view returns (address);
function CAVOToken() external view returns (address);
function WETHToken() external view returns (address);
function feeToSetter() external view returns (address);
function router() external view returns(address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function initialize(address) external;
}
IPublicPresale.sol 10 lines
pragma solidity >=0.6.6;
interface IPublicPresale {
function presaleOwner() external view returns (address);
function availablePublicPresaleAmountOf(address account) external view returns (uint);
function publicPresaleClaim(uint amount) external;
function startPublicPresaleDistribution() external;
function startPublicPresale() external;
}
IPrivatePresale.sol 12 lines
pragma solidity >=0.6.6;
interface IPrivatePresale {
function totalPrivatePresaleDistribution() external view returns (uint);
function privatePresaleDistributed() external view returns (uint);
function availablePrivatePresaleAmountOf(address account) external view returns (uint);
function distribute(address[] calldata _accounts, uint[] calldata _amounts) external;
function editDistributed(address _account, uint _amount) external;
function privatePresaleClaim(uint amount) external;
function startPrivatePresaleDistribution() external;
}
ITeamDistribution.sol 9 lines
pragma solidity >=0.6.6;
interface ITeamDistribution {
function totalTeamDistribution() external view returns (uint);
function availableTeamMemberAmountOf(address account) external view returns (uint);
function teamMemberClaim(uint amount) external;
function startTeamDistribution() external;
}
DistributionLibrary.sol 42 lines
pragma solidity >=0.6.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import './TransferHelper.sol';
import './Math.sol';
import './SafeMath.sol';
import '../interfaces/ICAVO.sol';
library DistributionLibrary {
using SafeMath for uint;
struct Data {
mapping(address => uint) claimedAmountOf;
mapping(address => uint) maxAmountOf;
uint unlockBlock;
uint32 blocksInPeriod;
}
function availableAmountOf(Data storage self, address account) internal view returns (uint) {
if (self.unlockBlock == 0 || block.number <= self.unlockBlock || self.maxAmountOf[account] == 0) {
return 0;
}
uint unlockedAmountPerPeriod = self.maxAmountOf[account].mul(10).div(100);
uint unlockPeriodInBlocks = self.maxAmountOf[account].div(unlockedAmountPerPeriod).mul(self.blocksInPeriod);
return Math.min(self.unlockBlock.add(unlockPeriodInBlocks), block.number)
.sub(self.unlockBlock)
.div(self.blocksInPeriod)
.mul(unlockedAmountPerPeriod)
.sub(self.claimedAmountOf[account]);
}
function start(Data storage self) internal {
require(self.unlockBlock == 0 && msg.sender == ICAVO(address(this)).creator(), 'DistributionLibrary: FORBIDDEN');
self.unlockBlock = block.number;
}
function claim(Data storage self, uint amount) internal {
require(amount <= availableAmountOf(self, msg.sender), 'DistributionLibrary: OVERDRAFT');
self.claimedAmountOf[msg.sender] = self.claimedAmountOf[msg.sender].add(amount);
TransferHelper.safeTransfer(address(this), msg.sender, amount);
}
}
ReentrancyGuard.sol 62 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () internal {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
Read Contract
CREATOR_SUPPLY 0x2a455d79 → uint256
EXCVToken 0x2d135357 → address
MAX_SUPPLY 0x32cb6b0c → uint256
allowance 0xdd62ed3e → uint256
availablePrivatePresaleAmountOf 0xea445396 → uint256
availablePublicPresaleAmountOf 0x19aef059 → uint256
availableTeamMemberAmountOf 0x5ca2a92d → uint256
balanceOf 0x70a08231 → uint256
creator 0x02d05d3f → address
decimals 0x313ce567 → uint8
name 0x06fdde03 → string
presaleOwner 0x9c89a10a → address
privatePresaleDistributed 0x6656d736 → uint256
symbol 0x95d89b41 → string
totalPrivatePresaleDistribution 0x90996b2d → uint256
totalSupply 0x18160ddd → uint256
totalTeamDistribution 0x08ab5976 → uint256
virtualBalanceOf 0xcb742358 → uint256
xCAVOToken 0xc836a489 → address
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 value
returns: bool
distribute 0x2929abe6
address[] _accounts
uint256[] _amounts
editDistributed 0x065e6eb7
address _account
uint256 _amount
initialize 0xc4d66de8
address _factory
mint 0x40c10f19
address account
uint256 amount
privatePresaleClaim 0x37113958
uint256 amount
publicPresaleClaim 0x5ceb139b
uint256 amount
startPrivatePresaleDistribution 0xf2ae9274
No parameters
startPublicPresale 0x861a48dd
No parameters
startPublicPresaleDistribution 0xd6a42d85
No parameters
startTeamDistribution 0x6cb74849
No parameters
teamMemberClaim 0x6b2b3bf3
uint256 amount
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
Recent Transactions
No transactions found for this address