Address Contract Partially Verified
Address
0xdefac16715671b7b6aeeFE012125f1E19Ee4b7d7
Balance
0 ETH
Nonce
1
Code Size
17841 bytes
Creator
0xe4dbEAc7...f3C7 at tx 0x9eed9e14...0a047b
Indexed Transactions
0
Contract Bytecode
17841 bytes
0x608060405234801561001057600080fd5b506004361061049d5760003560e01c806370a082311161026b57806370a0823114610e435780637216086014610e695780637275f3c814610e715780637ad44d6014610f4a5780637c365c2c14610f875780637c7b0e6114610f8f5780638027d6cc14610f975780638456cb5914610f9f57806384955c8814610fa7578063851b6ef214610fcd57806389cf785a146110255780638ab1d6811461104b5780638d1fdf2f146110715780638d8f2adb146110975780638fad11bf1461109f57806391c3cbbb1461114f57806395d89b411461120357806397599fd91461120b57806399385006146112135780639b91293b146112395780639f9b58d31461126b578063a457c2d71461132c578063a694fc3a14611358578063a69df4b514611375578063a75d52541461137d578063a9059cbb146113a3578063ae1ccf2c146113cf578063b306f735146113d7578063b64230ba146113df578063bc9ac68c14611405578063c3f9ab581461142b578063c692586514611451578063c93dbc491461146e578063cb31b6cd14611476578063ce531ff114611544578063d157f8c81461156a578063d6fe7cb714611587578063d7e4f652146115ad578063d8fb9337146115d3578063dace4557146115f9578063dd62ed3e14611616578063de1be3c214611644578063e19e4349146116b2578063e43252d7146116ba578063e5839836146116e0578063e71bdf4114611706578063e87a7a591461172c578063edca8aa814611734578063efa1937d1461175a578063f1eddfd514611762578063f7af4a30146117d0578063ff981099146117f65761049d565b806306fdde03146104a2578063070892461461051f5780630777962714610539578063095ea7b314610573578063111c5bee1461059f57806313c3e409146105cb5780631785f53c146105f357806318160ddd146106195780631bb7cc99146106215780631e89d5451461063f57806323b872dd146106fd578063241084751461073357806324d7806c146107de578063251c1aa31461080457806325d998bb1461080c57806325db64c01461083257806326d2527c146108585780632a0acc6a146108915780632e17de7814610899578063313ce567146108b65780633192d50a146108be57806332a49578146108e457806333b15378146108ec57806333fd8b4e14610990578063373ccc5214610a34578063380a75bf14610a3c5780633950935114610a625780633af32abf14610a8e5780633b5764eb14610ab45780633f2d413114610abc5780633f4ba83a14610ae257806340abfe2614610aea57806340dce49a14610b105780634254582514610b185780634262336014610b4457806345c8b1a614610b6a5780634a2d5c9d14610b905780634c1b8ffd14610b985780634f2bf9d114610ba05780634f6218b814610ba857806353f74a7e14610bce578063551530d614610bd65780635be0606d14610bfc5780635c975abb14610cba578063633db62c14610cc257806367e7646f14610d0f5780636c76c2a114610d355780636d0b954314610de75780636f9336a914610def578063700d85ae14610e155780637048027514610e1d575b600080fd5b6104aa611813565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104e45781810151838201526020016104cc565b50505050905090810190601f1680156105115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105276118a1565b60408051918252519081900360200190f35b61055f6004803603602081101561054f57600080fd5b50356001600160a01b03166118a7565b604080519115158252519081900360200190f35b61055f6004803603604081101561058957600080fd5b506001600160a01b0381351690602001356118bc565b610527600480360360408110156105b557600080fd5b506001600160a01b038135169060200135611996565b6105f1600480360360208110156105e157600080fd5b50356001600160a01b03166119bd565b005b6105f16004803603602081101561060957600080fd5b50356001600160a01b0316611a16565b610527611a4f565b610629611a55565b6040805160ff9092168252519081900360200190f35b61055f6004803603604081101561065557600080fd5b810190602081018135600160201b81111561066f57600080fd5b82018360208201111561068157600080fd5b803590602001918460208302840111600160201b831117156106a257600080fd5b919390929091602081019035600160201b8111156106bf57600080fd5b8201836020820111156106d157600080fd5b803590602001918460208302840111600160201b831117156106f257600080fd5b509092509050611a5a565b61055f6004803603606081101561071357600080fd5b506001600160a01b03813581169160208101359091169060400135611b84565b6105f16004803603604081101561074957600080fd5b81359190810190604081016020820135600160201b81111561076a57600080fd5b82018360208201111561077c57600080fd5b803590602001918460018302840111600160201b8311171561079d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611c13945050505050565b61055f600480360360208110156107f457600080fd5b50356001600160a01b0316611c64565b610527611c71565b6105276004803603602081101561082257600080fd5b50356001600160a01b0316611c77565b6105f16004803603602081101561084857600080fd5b50356001600160a01b0316611cb6565b6108756004803603602081101561086e57600080fd5b5035611ccd565b604080516001600160a01b039092168252519081900360200190f35b610629611cf0565b61055f600480360360208110156108af57600080fd5b5035611cf5565b610629611f13565b6105f1600480360360208110156108d457600080fd5b50356001600160a01b0316611f1c565b610629611f43565b6105f16004803603602081101561090257600080fd5b810190602081018135600160201b81111561091c57600080fd5b82018360208201111561092e57600080fd5b803590602001918460018302840111600160201b8311171561094f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611f48945050505050565b6105f1600480360360208110156109a657600080fd5b810190602081018135600160201b8111156109c057600080fd5b8201836020820111156109d257600080fd5b803590602001918460018302840111600160201b831117156109f357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611f9b945050505050565b61055f611fbe565b6105f160048036036020811015610a5257600080fd5b50356001600160a01b0316611fcd565b61055f60048036036040811015610a7857600080fd5b506001600160a01b038135169060200135611ff4565b61055f60048036036020811015610aa457600080fd5b50356001600160a01b03166120c4565b6106296120d1565b6105f160048036036020811015610ad257600080fd5b50356001600160a01b03166120d6565b6105f16120ed565b6105f160048036036020811015610b0057600080fd5b50356001600160a01b0316612136565b61062961214b565b61055f60048036036040811015610b2e57600080fd5b506001600160a01b038135169060200135612150565b61052760048036036020811015610b5a57600080fd5b50356001600160a01b0316612179565b6105f160048036036020811015610b8057600080fd5b50356001600160a01b0316612194565b6106296121a9565b6105276121ae565b6105276121b4565b61055f60048036036020811015610bbe57600080fd5b50356001600160a01b03166121ba565b6105276121c7565b61055f60048036036020811015610bec57600080fd5b50356001600160a01b03166121cd565b61055f60048036036040811015610c1257600080fd5b810190602081018135600160201b811115610c2c57600080fd5b820183602082011115610c3e57600080fd5b803590602001918460208302840111600160201b83111715610c5f57600080fd5b919390929091602081019035600160201b811115610c7c57600080fd5b820183602082011115610c8e57600080fd5b803590602001918460208302840111600160201b83111715610caf57600080fd5b5090925090506121da565b61055f61232e565b61055f600480360360a0811015610cd857600080fd5b5080356001600160a01b031690602081013590604081013563ffffffff908116916060810135909116906080013561ffff16612337565b6105f160048036036020811015610d2557600080fd5b50356001600160a01b03166124f2565b6105f160048036036060811015610d4b57600080fd5b810190602081018135600160201b811115610d6557600080fd5b820183602082011115610d7757600080fd5b803590602001918460018302840111600160201b83111715610d9857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550506001600160a01b038335169350505060200135612509565b6106296126bc565b61052760048036036020811015610e0557600080fd5b50356001600160a01b03166126c1565b61062961280f565b6105f160048036036020811015610e3357600080fd5b50356001600160a01b0316612814565b61052760048036036020811015610e5957600080fd5b50356001600160a01b0316612839565b61055f612854565b61055f600480360360a0811015610e8757600080fd5b810190602081018135600160201b811115610ea157600080fd5b820183602082011115610eb357600080fd5b803590602001918460208302840111600160201b83111715610ed457600080fd5b919390929091602081019035600160201b811115610ef157600080fd5b820183602082011115610f0357600080fd5b803590602001918460208302840111600160201b83111715610f2457600080fd5b9193509150803563ffffffff908116916020810135909116906040013561ffff16612862565b6105f1600480360360a0811015610f6057600080fd5b5080351515906020810135151590604081013515159060608101359060800135151561297d565b61055f6129da565b6105276129e3565b6105276129e9565b6105f16129ef565b61052760048036036020811015610fbd57600080fd5b50356001600160a01b0316612a28565b610fd5612a55565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015611011578181015183820152602001610ff9565b505050509050019250505060405180910390f35b6105f16004803603602081101561103b57600080fd5b50356001600160a01b0316612ae0565b6105f16004803603602081101561106157600080fd5b50356001600160a01b0316612b2e565b6105f16004803603602081101561108757600080fd5b50356001600160a01b0316612b45565b6105f1612b5a565b6105f1600480360360608110156110b557600080fd5b813591602081013591810190606081016040820135600160201b8111156110db57600080fd5b8201836020820111156110ed57600080fd5b803590602001918460018302840111600160201b8311171561110e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550612b89945050505050565b6105f16004803603604081101561116557600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561118f57600080fd5b8201836020820111156111a157600080fd5b803590602001918460018302840111600160201b831117156111c257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550612bf1945050505050565b6104aa612cb0565b610629612d0b565b6105f16004803603602081101561122957600080fd5b50356001600160a01b0316612d10565b61055f6004803603606081101561124f57600080fd5b506001600160a01b038135169060208101359060400135612d25565b6105f1600480360360a081101561128157600080fd5b810190602081018135600160201b81111561129b57600080fd5b8201836020820111156112ad57600080fd5b803590602001918460018302840111600160201b831117156112ce57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550506001600160a01b038335811694506020840135169260408101359250606001359050612daa565b61055f6004803603604081101561134257600080fd5b506001600160a01b038135169060200135612e8e565b61055f6004803603602081101561136e57600080fd5b5035612f0b565b61055f613019565b6105f16004803603602081101561139357600080fd5b50356001600160a01b0316613029565b61055f600480360360408110156113b957600080fd5b506001600160a01b038135169060200135613077565b61055f6130b3565b610fd56130d0565b61055f600480360360208110156113f557600080fd5b50356001600160a01b0316613175565b61055f6004803603602081101561141b57600080fd5b50356001600160a01b0316613182565b610fd56004803603602081101561144157600080fd5b50356001600160a01b031661318f565b6105f16004803603602081101561146757600080fd5b5035613335565b61055f613346565b61055f6004803603606081101561148c57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156114b657600080fd5b8201836020820111156114c857600080fd5b803590602001918460208302840111600160201b831117156114e957600080fd5b919390929091602081019035600160201b81111561150657600080fd5b82018360208201111561151857600080fd5b803590602001918460208302840111600160201b8311171561153957600080fd5b50909250905061334f565b6105f16004803603602081101561155a57600080fd5b50356001600160a01b03166134a0565b6104aa6004803603602081101561158057600080fd5b50356134b7565b6105f16004803603602081101561159d57600080fd5b50356001600160a01b031661355e565b6104aa600480360360208110156115c357600080fd5b50356001600160a01b0316613575565b610527600480360360208110156115e957600080fd5b50356001600160a01b0316613582565b6105f16004803603602081101561160f57600080fd5b50356135f9565b6105276004803603604081101561162c57600080fd5b506001600160a01b0381358116916020013516613640565b6105f16004803603602081101561165a57600080fd5b810190602081018135600160201b81111561167457600080fd5b82018360208201111561168657600080fd5b803590602001918460208302840111600160201b831117156116a757600080fd5b50909250905061366b565b6105f16136bf565b6105f1600480360360208110156116d057600080fd5b50356001600160a01b03166136ca565b61055f600480360360208110156116f657600080fd5b50356001600160a01b03166136e1565b6105f16004803603602081101561171c57600080fd5b50356001600160a01b03166136ee565b610527613705565b6105f16004803603602081101561174a57600080fd5b50356001600160a01b031661370b565b6104aa613722565b6105f16004803603602081101561177857600080fd5b810190602081018135600160201b81111561179257600080fd5b8201836020820111156117a457600080fd5b803590602001918460208302840111600160201b831117156117c557600080fd5b50909250905061377d565b61055f600480360360208110156117e657600080fd5b50356001600160a01b03166137d1565b6105276004803603602081101561180c57600080fd5b50356137de565b600c805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156118995780601f1061186e57610100808354040283529160200191611899565b820191906000526020600020905b81548152906001019060200180831161187c57829003601f168201915b505050505081565b60165481565b60006118b46008836138b7565b90505b919050565b60006118d66118ca336136e1565b1561708160f11b6138c5565b60005460ff16156118e657600080fd5b611926600f544211806118fd57506118fd33611c64565b8061190c575061190c336137d1565b8061191b575061191b336120c4565b61708960f11b6138c5565b6119406001600160a01b038416151561e10360f01b6138c5565b336000818152600a602090815260408083206001600160a01b038816808552908352928190208690558051868152905192939260008051602061455c833981519152929181900390910190a35060015b92915050565b60009081526004602090815260408083206001600160a01b03949094168352929052205490565b6119d46119c933613182565b61e10960f01b6138c5565b6119df6002826138d4565b6040516001600160a01b038216907fd1150a5bd2b0e9576d0be9aca2590fe10d79688e2026d41c3eeaa22d72bba1c490600090a250565b60005460ff1615611a2657600080fd5b611a41611a3233611c64565b806119c957506119c9336137d1565b611a4c6001826138d4565b50565b60125490565b600481565b6000805460ff1615611a6b57600080fd5b611a776119c9336121cd565b611a8884151561e10760f01b6138c5565b611a99828514611c2160f31b6138c5565b60005b84811015611b7857611ac8868683818110611ab357fe5b905060200201356001600160a01b03166136e1565b611b0957611b0433878784818110611adc57fe5b905060200201356001600160a01b0316868685818110611af857fe5b9050602002013561391d565b611b70565b858582818110611b1557fe5b905060200201356001600160a01b03166001600160a01b0316336001600160a01b031660008051602061451c833981519152868685818110611b5357fe5b905060200201356040518082815260200191505060405180910390a35b600101611a9c565b50600195945050505050565b6000805460ff1615611b9557600080fd5b611bac600f544211806118fd57506118fd33611c64565b6001600160a01b0384166000908152600a60209081526040808320338452909152902054611bda9083613840565b6001600160a01b0385166000908152600a60209081526040808320338452909152902055611c0984848461391d565b5060019392505050565b601454610100900460ff1615611c3d57611c3d6000611c3133612839565b1161e10560f01b6138c5565b60155415611c5257611c52333060155461391d565b611c5f3383600184613a0f565b505050565b60006118b46001836138b7565b600f5481565b60006118b4611c85836126c1565b611cb0611c9185613582565b6001600160a01b03861660009081526008602052604090205490613840565b90613b8a565b611cc2611a3233611c64565b611a4c6003826138d4565b60009081526005602052604090206001015461010090046001600160a01b031690565b600181565b6000805460ff1615611d0657600080fd5b611d1d600f544211806118fd57506118fd33611c64565b611d296118ca336136e1565b33600090815260096020526040902054611d439083613840565b33600090815260096020908152604080832093909355600890522054611d699083613b8a565b3360009081526008602052604090205560165415611eaf576000611d9860165442613b8a90919063ffffffff16565b9050611da261441a565b506040805160a0810182528481526001600160401b0383811660208084018281526000858701818152606080880183815260016080808b0182815233808852600b8a528d8820805480860182559089528a89208e5160029092020190815598519890930180549651945191511515600160701b0260ff60701b1961ffff909316600160601b0261ffff60601b1963ffffffff909716600160401b0263ffffffff60401b199b909e166001600160401b031990991698909817999099169b909b179390931694909417919091169490941790965587518b815293840194909452828701819052938201939093529351929391926000805160206144fc8339815191529281900390910190a250505b60408051838152905133917f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd919081900360200190a2604080518381529051339160009160008051602061453c8339815191529181900360200190a3506001919050565b600e5460ff1681565b60005460ff1615611f2c57600080fd5b611f38611a3233611c64565b611a4c6002826138d4565b600381565b60145460ff1615611f7357611f6e611f5f33611c64565b806119c957506119c9336118a7565b611f92565b60145462010000900460ff1615611f9257611f926000611c3133612839565b611a4c81613b9c565b611fa7611a3233611c64565b8051611fba906011906020840190614448565b5050565b60145462010000900460ff1681565b60005460ff1615611fdd57600080fd5b611fe9611a3233611c64565b611a4c600282613cd5565b60006120026118ca336136e1565b60005460ff161561201257600080fd5b612029600f544211806118fd57506118fd33611c64565b6120436001600160a01b038416151561e10360f01b6138c5565b336000908152600a602090815260408083206001600160a01b03871684529091529020546120719083613b8a565b336000818152600a602090815260408083206001600160a01b03891680855290835292819020859055805194855251919360008051602061455c833981519152929081900390910190a350600192915050565b60006118b46004836138b7565b600581565b6120e2611a3233611c64565b611a4c6007826138d4565b60005460ff166120fc57600080fd5b612105336137d1565b61212c576121156119c933611c64565b61212c6121206130b3565b1561e11360f01b6138c5565b612134613d1e565b565b6121426119c933613182565b611a4c81613d5e565b600281565b60009081526004602090815260408083206001600160a01b039490941683529290522054151590565b6001600160a01b031660009081526009602052604090205490565b6121a0611a3233611c64565b611a4c81613d69565b600881565b60155481565b60035481565b60006118b4600b836138b7565b60135481565b60006118b46003836138b7565b6000805460ff16156121eb57600080fd5b6121f76119c9336121ba565b612208828514611c2160f31b6138c5565b60005b84811015611b7857600086868381811061222157fe5b905060200201356001600160a01b03169050600085858481811061224157fe5b905060200201359050612253826136e1565b612324576001600160a01b03821660009081526009602052604090205461227a9082613b8a565b6001600160a01b0383166000908152600960209081526040808320939093553382526008905220546122ac9082613840565b3360009081526008602090815260409182902092909255805183815290516001600160a01b038516927ffdb40631688a7579284e2f66bc5fd4fefeb5ff42e76828e3b307bdc4af2715bf928290030190a2604080518281529051600091339160008051602061453c8339815191529181900360200190a35b505060010161220b565b60005460ff1690565b60008061234d4263ffffffff80881690613b8a16565b905061235761441a565b6040518060a00160405280888152602001836001600160401b031681526020018663ffffffff1681526020018561ffff168152602001600015158152509050600b6000896001600160a01b03166001600160a01b031681526020019081526020016000208190806001815401808255809150506001900390600052602060002090600202016000909190919091506000820151816000015560208201518160010160006101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160010160086101000a81548163ffffffff021916908363ffffffff160217905550606082015181600101600c6101000a81548161ffff021916908361ffff160217905550608082015181600101600e6101000a81548160ff02191690831515021790555050506124928888613077565b50604080518881526001600160401b038416602082015263ffffffff87168183015261ffff8616606082015290516001600160a01b038a16916000805160206144fc833981519152919081900360800190a2506001979650505050505050565b6124fe611a3233611c64565b611a4c6008826138d4565b60005460ff161561251957600080fd5b612530600f544211806118fd57506118fd33611c64565b600061253a613d74565b338430878660405160200180878152602001866001600160a01b031660601b8152601401856001600160a01b031660601b8152601401846001600160a01b031660601b815260140183805190602001908083835b602083106125ad5780518252601f19909201916020918201910161258e565b6001836020036101000a038019825116818451168082178552505050505050905001828152602001965050505050505060405160208183030381529060405280519060200120905061260033308461391d565b80836001600160a01b0316336001600160a01b03167f6bc4afad47e010c4a48e00a6b9a230555e1c4e8420c1ede42f30b54ebb4c3fcd87866040518080602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561267b578181015183820152602001612663565b50505050905090810190601f1680156126a85780820380516001836020036101000a031916815260200191505b50935050505060405180910390a450505050565b600b81565b6001600160a01b0381166000908152600b6020526040812081805b82548110156128075760008382815481106126f357fe5b600091825260209091206002909102016001810154909150426001600160401b0390911610156127fe5760018101546002600160601b90910461ffff16101561274a578054612743908490613b8a565b92506127fe565b600181015460009081906127689042906001600160401b0316613840565b600184015490915060009061278f90839063ffffffff600160401b90910481169061381e16565b6001858101549101915061ffff600160601b909104811690821611156127c95750600183015483549250600160601b900461ffff166127ee565b6001840154845461ffff808416926127ea9291600160601b9091041661381e565b0292505b6127f88684613b8a565b95505050505b506001016126dc565b509392505050565b600781565b60005460ff161561282457600080fd5b612830611a3233611c64565b611a4c81613d82565b6001600160a01b031660009081526008602052604090205490565b601454610100900460ff1681565b6000805460ff161561287357600080fd5b61287f6119c9336121cd565b61289087151561e10760f01b6138c5565b6128a1858814611c2160f31b6138c5565b60005b8781101561296e576128bb898983818110611ab357fe5b6128ff576128f98989838181106128ce57fe5b905060200201356001600160a01b03168888848181106128ea57fe5b90506020020135878787612337565b50612966565b88888281811061290b57fe5b905060200201356001600160a01b03166001600160a01b0316336001600160a01b031660008051602061451c83398151915289898581811061294957fe5b905060200201356040518082815260200191505060405180910390a35b6001016128a4565b50600198975050505050505050565b612989611a3233611c64565b6014805460ff199081169615159690961761ff001916610100951515959095029490941762ff0000191662010000931515939093029290921790925560159190915560078054909216901515179055565b60145460ff1681565b60025481565b60065481565b60005460ff16156129ff57600080fd5b6000612a0a336137d1565b9050612a1f81806119c957506119c933611c64565b611a4c81613d8d565b60006118b4612a3683613582565b6001600160a01b03841660009081526008602052604090205490613840565b6060806006546001600160401b0381118015612a7057600080fd5b50604051908082528060200260200182016040528015612a9a578160200160208202803683370190505b50905060005b600654811015612ada576000818152600560205260409020548251839083908110612ac757fe5b6020908102919091010152600101612aa0565b50905090565b612aec6119c933613182565b612af7600282613cd5565b6040516001600160a01b038216907f31f2f473acc030385200df8dddbab6686d4287a2166d4fe59a1dc72e37c1d31290600090a250565b612b3a611a3233611c64565b611a4c6004826138d4565b612b51611a3233611c64565b611a4c81613ded565b60005460ff1615612b6a57600080fd5b612b766119c933611c64565b6121343033612b8430612839565b61391d565b600754612b9f9060ff161561708560f11b6138c5565b601454610100900460ff1615612bbd57612bbd6000611c3133612839565b60155415612bdf57612bdf3330612b84856015546137f090919063ffffffff16565b612beb33848484613a0f565b50505050565b612bfd611a3233611c64565b612c0960178383613df8565b816001600160a01b03167f96494610f3d7ae42a3de83051a16063a87b5be06845d935c3a9ef103d791a096826040518080602001828103825283818151815260200191508051906020019080838360005b83811015612c72578181015183820152602001612c5a565b50505050905090810190601f168015612c9f5780820380516001836020036101000a031916815260200191505b509250505060405180910390a25050565b600d805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156118995780601f1061186e57610100808354040283529160200191611899565b600681565b612d1c611a3233611c64565b611a4c81613e1f565b6000805460ff1615612d3657600080fd5b612d4d600f544211806118fd57506118fd33611c64565b612d5833858561391d565b604080518481526020810184905281516001600160a01b0387169233927f10258bfd896826cf69e885380049b1d1be0424a813d5117744373ec9f51bc86c929081900390910190a35060019392505050565b60005460ff1615612dba57600080fd5b612dc66119c933613175565b612dd130848361391d565b81836001600160a01b0316856001600160a01b03167f9403091f5664cd6d32ddbe58f2efce74b16b45841968713ab48a95da381203b188856040518080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015612e4c578181015183820152602001612e34565b50505050905090810190601f168015612e795780820380516001836020036101000a031916815260200191505b50935050505060405180910390a45050505050565b6000612e9c6118ca336136e1565b60005460ff1615612eac57600080fd5b612ec3600f544211806118fd57506118fd33611c64565b612edd6001600160a01b038416151561e10360f01b6138c5565b336000908152600a602090815260408083206001600160a01b03871684529091529020546120719083613840565b6000805460ff1615612f1c57600080fd5b612f33600f544211806118fd57506118fd33611c64565b612f3f6118ca336136e1565b612f4833613e2a565b50612f63612f5533612a28565b83111561e10560f01b6138c5565b33600090815260086020526040902054612f7d9083613840565b33600090815260086020908152604080832093909355600990522054612fa39083613b8a565b3360008181526009602090815260408083209490945583518681529351919360008051602061453c833981519152929081900390910190a360408051838152905133917febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a919081900360200190a2506001919050565b600061302433613e2a565b905090565b6130356119c933613182565b6130406001826138d4565b6040516001600160a01b038216907fdd03a410a9b379c5c31df9bbec14f14840e84bec6958bba98d9c5df9fe4d713d90600090a250565b6000805460ff161561308857600080fd5b61309f600f544211806118fd57506118fd33611c64565b6130aa33848461391d565b50600192915050565b6000805460ff168015613024575050600054610100900460ff1690565b6060806006546001600160401b03811180156130eb57600080fd5b50604051908082528060200260200182016040528015613115578160200160208202803683370190505b50905060005b600654811015612ada5760008181526005602052604090206001015482516101009091046001600160a01b03169083908390811061315557fe5b6001600160a01b039092166020928302919091019091015260010161311b565b60006118b46007836138b7565b60006118b46006836138b7565b6001600160a01b0381166000908152600b6020526040902080546060919082906004026001600160401b03811180156131c757600080fd5b506040519080825280602002602001820160405280156131f1578160200160208202803683370190505b50905060005b825481101561280757600081600402905083828154811061321457fe5b90600052602060002090600202016000015483828151811061323257fe5b60200260200101818152505083828154811061324a57fe5b906000526020600020906002020160010160009054906101000a90046001600160401b03166001600160401b031683826001018151811061328757fe5b60200260200101818152505083828154811061329f57fe5b906000526020600020906002020160010160089054906101000a900463ffffffff1663ffffffff168382600201815181106132d657fe5b6020026020010181815250508382815481106132ee57fe5b9060005260206000209060020201600101600c9054906101000a900461ffff1661ffff1683826003018151811061332157fe5b6020908102919091010152506001016131f7565b613341611a3233611c64565b601655565b60075460ff1681565b6000805460ff161561336057600080fd5b61336c6119c9336121cd565b61337d84151561e10760f01b6138c5565b61338e828514611c2160f31b6138c5565b60005b84811015613493576133a8868683818110611ab357fe5b613424576133eb8484838181106133bb57fe5b6001600160a01b038b166000908152600a6020908152604080832033845282529091205493910201359050613840565b6001600160a01b0388166000908152600a6020908152604080832033845290915290205561341f87878784818110611adc57fe5b61348b565b85858281811061343057fe5b905060200201356001600160a01b03166001600160a01b0316876001600160a01b031660008051602061451c83398151915286868581811061346e57fe5b905060200201356040518082815260200191505060405180910390a35b600101613391565b5060019695505050505050565b6134ac611a3233611c64565b611a4c600382613cd5565b6000818152600560209081526040918290206002908101805484516001821615610100026000190190911692909204601f810184900484028301840190945283825260609391929091908301828280156135525780601f1061352757610100808354040283529160200191613552565b820191906000526020600020905b81548152906001019060200180831161353557829003601f168201915b50505050509050919050565b61356a611a3233611c64565b611a4c600b826138d4565b60606118b46017836142b8565b600080805b6001600160a01b0384166000908152600b60205260409020548110156135f2576001600160a01b0384166000908152600b6020526040902080546135e89190839081106135d057fe5b60009182526020909120600290910201548390613b8a565b9150600101613587565b5092915050565b613605611a3233611c64565b600f8190556040805182815290517f285ed4cab839e54405276e9e5f06f35f2f12e1d626384e4632854919077f7c7a9181900360200190a150565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b613677611a3233611c64565b61368881151561e10760f01b6138c5565b60005b81811015611c5f576136b78383838181106136a257fe5b905060200201356001600160a01b0316613ded565b60010161368b565b6121346006336138d4565b6136d6611a3233611c64565b611a4c600482613cd5565b60006118b46005836138b7565b6136fa611a3233611c64565b611a4c600882613cd5565b60105481565b613717611a3233611c64565b611a4c600b82613cd5565b6011805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156118995780601f1061186e57610100808354040283529160200191611899565b613789611a3233611c64565b61379a81151561e10760f01b6138c5565b60005b81811015611c5f576137c98383838181106137b457fe5b905060200201356001600160a01b0316613d69565b60010161379d565b60006118b46002836138b7565b60009081526005602052604090205490565b6000826137ff57506000611990565b8282028284828161380c57fe5b041461381757600080fd5b9392505050565b600080821161382c57600080fd5b600082848161383757fe5b04949350505050565b60008282111561384f57600080fd5b50900390565b60ff821660009081526020849052604090206001600160a01b03821661387a57600080fd5b6138848183614362565b1561388e57600080fd5b6001600160a01b03909116600090815260209190915260409020805460ff191660011790555050565b600061381760018484614397565b81611fba578060405260026040fd5b6138e0600183836143bc565b6040516001600160a01b0382169060ff8416907f0e1900eb0958d3192c4824b787e78e8b534e429190d9d837ecbfb6257a8a1b1c90600090a35050565b6139376001600160a01b038316151561e10360f01b6138c5565b6139436118ca846136e1565b61394f6118ca836136e1565b61395883613e2a565b5061397361396584612a28565b82111561e10560f01b6138c5565b6001600160a01b0383166000908152600860205260409020546139969082613840565b6001600160a01b0380851660009081526008602052604080822093909355908416815220546139c59082613b8a565b6001600160a01b03808416600081815260086020908152604091829020949094558051858152905191939287169260008051602061453c83398151915292918290030190a3505050565b60075460009060ff1615613a3e57613a278585612150565b15613a3157600080fd5b82600114613a3e57600080fd5b6000848152600560205260409020600181015460ff16613a5d57600080fd5b60008581526004602090815260408083206001600160a01b038a168452909152902054613a8a9085613b8a565b60008681526004602090815260408083206001600160a01b038b1684529091529020558054613ab99085613b8a565b8160000181905550847f4fa7d628f07312402be45de3ce5d77059237591939a1154550b9a3166550ebcd878684600001548760405180856001600160a01b0316815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613b43578181015183820152602001613b2b565b50505050905090810190601f168015613b705780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a25495945050505050565b60008282018381101561381757600080fd5b600680546001808201909255604080516080810182526000808252602080830186815233848601908152606085018981528785526005845295909320845181559051968101805493516001600160a01b031661010002610100600160a81b031998151560ff199095169490941797909716929092179095559151805193949193613c2c9260028501920190614448565b509050507fbf516e0d163afacd132d846cf9538bcfc94834845151f27cdc9ba1ded8f063ad81836040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613c96578181015183820152602001613c7e565b50505050905090810190601f168015613cc35780820380516001836020036101000a031916815260200191505b50935050505060405180910390a15050565b613ce160018383613855565b6040516001600160a01b0382169060ff8416907f108cdba04fa22e3af2c83669b3a439bae9df498af451d1b1a0a7da5453c97bce90600090a35050565b6000805461ffff191690556040805133815290517f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9181900360200190a1565b611a4c600682613cd5565b611a4c6005826138d4565b601380546001019081905590565b611a4c600182613cd5565b60008054600160ff199091161761ff0019166101008315159081029190911790915560408051338152602081019290925280517fe8699cf681560fd07de85543bd994263f4557bdc5179dd702f256d15fd083e1d9281900390910190a150565b611a4c600582613cd5565b6001600160a01b0382166000908152602084815260409091208251612beb92840190614448565b611a4c600782613cd5565b6001600160a01b0381166000908152600b602052604081208054613e525760019150506118b7565b60005b8154811015611c09576000828281548110613e6c57fe5b600091825260209091206002909102016001810154909150426001600160401b0390911610156142ab5760018101546002600160601b90910461ffff161015613ff2578054604080519182526000602083015280516001600160a01b038816926000805160206144dc83398151915292908290030190a2825460001901821015613fb857825483906000198101908110613f0257fe5b9060005260206000209060020201838381548110613f1c57fe5b600091825260209091208254600290920201908155600191820180549290910180546001600160401b0319166001600160401b0390931692909217808355815463ffffffff600160401b91829004160263ffffffff60401b1990911617808355815461ffff600160601b91829004160261ffff60601b1990911617808355905460ff600160701b918290041615150260ff60701b199091161790555b82805480613fc257fe5b60008281526020812060026000199093019283020190815560010180546001600160781b031916905590556142a6565b600181015460009081906140109042906001600160401b0316613840565b600184015490915060009061403790839063ffffffff600160401b90910481169061381e16565b6001858101549101915061ffff600160601b9091048116908216106141b157506001830154835460408051828152600060208201528151929550600160601b90930461ffff16926001600160a01b038b16926000805160206144dc833981519152929181900390910190a2855460001901851015614177578554869060001981019081106140c157fe5b90600052602060002090600202018686815481106140db57fe5b600091825260209091208254600290920201908155600191820180549290910180546001600160401b0319166001600160401b0390931692909217808355815463ffffffff600160401b91829004160263ffffffff60401b1990911617808355815461ffff600160601b91829004160261ffff60601b1990911617808355905460ff600160701b918290041615150260ff60701b199091161790555b8580548061418157fe5b60008281526020812060026000199093019283020190815560010180546001600160781b031916905590556142a2565b6001840154845461ffff808416926141d29291600160601b9091041661381e565b60018601805461ffff600160601b80830482168790039091160261ffff60601b199091161790558554910293506142099084613840565b845560018401546142309063ffffffff600160401b90910481169061ffff8416906137f016565b6001850180546001600160401b0319811663ffffffff939093166001600160401b039182160116919091179081905560408051858152600160601b90920461ffff16602083015280516001600160a01b038b16926000805160206144dc83398151915292908290030190a26001909401935b5050505b6142b2565b6001909101905b50613e55565b6001600160a01b0381166000908152602083815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156143555780601f1061432a57610100808354040283529160200191614355565b820191906000526020600020905b81548152906001019060200180831161433857829003601f168201915b5050505050905092915050565b60006001600160a01b03821661437757600080fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b60ff821660009081526020849052604081206143b38184614362565b95945050505050565b60ff821660009081526020849052604090206001600160a01b0382166143e157600080fd5b6143eb8183614362565b6143f457600080fd5b6001600160a01b03909116600090815260209190915260409020805460ff191690555050565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061448957805160ff19168380011785556144b6565b828001600101855582156144b6579182015b828111156144b657825182559160200191906001019061449b565b506144c29291506144c6565b5090565b5b808211156144c257600081556001016144c756fe9a28dc0f48ec36a159106c19199977fe86124fd78cf91ebe0345a1e93ecaccf8ddbc17715b9953cb1c631284bf34bc1f01934caee8c4f89d47cec8732a2f149457b832b60cac2d336bd974f846b5d4c4af5aeeeb2dbd0f8cbd3ea89fc9078eeaddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a2646970667358221220234bdf13169b58325b2dd630f037b819b4b9e91ab17cbe2e75dfde6bda4e82f664736f6c634300060c0033
Verified Source Code Partial Match
Compiler: v0.6.12+commit.27d51765
EVM: istanbul
Optimization: Yes (10 runs)
_Type.sol 14 lines
// SPDX-License-Identifier: LicenseRef-Blockwell-Smart-License
pragma solidity >=0.4.25;
/**
* @dev Contract type mapping.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
contract Type {
uint256 constant PRIME = 1;
uint256 public bwtype;
uint256 public bwver;
}
_Groups.sol 71 lines
// SPDX-License-Identifier: LicenseRef-Blockwell-Smart-License
pragma solidity >=0.6.10;
/**
* @dev Unified system for arbitrary user groups.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
library Groups {
struct MemberMap {
mapping(address => bool) members;
}
struct GroupMap {
mapping(uint8 => MemberMap) groups;
}
/**
* @dev Add an account to a group
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function add(
GroupMap storage map,
uint8 groupId,
address account
) internal {
MemberMap storage group = map.groups[groupId];
require(account != address(0));
require(!groupContains(group, account));
group.members[account] = true;
}
/**
* @dev Remove an account from a group
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function remove(
GroupMap storage map,
uint8 groupId,
address account
) internal {
MemberMap storage group = map.groups[groupId];
require(account != address(0));
require(groupContains(group, account));
group.members[account] = false;
}
/**
* @dev Returns true if the account is in the group
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
* @return bool
*/
function contains(
GroupMap storage map,
uint8 groupId,
address account
) internal view returns (bool) {
MemberMap storage group = map.groups[groupId];
return groupContains(group, account);
}
function groupContains(MemberMap storage group, address account) internal view returns (bool) {
require(account != address(0));
return group.members[account];
}
}
_Voting.sol 157 lines
// SPDX-License-Identifier: LicenseRef-Blockwell-Smart-License
pragma solidity ^0.6.10;
import "./__SafeMath.sol";
/**
* @dev Suggestions and Voting for token-holders.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
contract Voting {
using SafeMath for uint256;
struct Suggestion {
uint256 votes;
bool created;
address creator;
string text;
}
// This stores how many votes a user has cast on a suggestion
mapping(uint256 => mapping(address => uint256)) private voted;
// This map stores the suggestions, and they're retrieved using their ID number
mapping(uint256 => Suggestion) internal suggestions;
// This keeps track of the number of suggestions in the system
uint256 public suggestionCount;
// If true, a wallet can only vote on a suggestion once
bool public oneVotePerAccount = true;
event SuggestionCreated(uint256 suggestionId, string text);
event Votes(
address voter,
uint256 indexed suggestionId,
uint256 votes,
uint256 totalVotes,
string comment
);
/**
* @dev Gets the number of votes a suggestion has received.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getVotes(uint256 suggestionId) public view returns (uint256) {
return suggestions[suggestionId].votes;
}
/**
* @dev Gets the number of votes for every suggestion in the contract.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getAllVotes() public view returns (uint256[] memory) {
uint256[] memory votes = new uint256[](suggestionCount);
for (uint256 i = 0; i < suggestionCount; i++) {
votes[i] = suggestions[i].votes;
}
return votes;
}
/**
* @dev Gets the text of a suggestion.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getSuggestionText(uint256 suggestionId) public view returns (string memory) {
return suggestions[suggestionId].text;
}
/**
* @dev Gets whether or not an account has voted for a suggestion.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function hasVoted(address account, uint256 suggestionId) public view returns (bool) {
return voted[suggestionId][account] > 0;
}
/**
* @dev Gets the number of votes an account has cast towards a suggestion.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getAccountVotes(address account, uint256 suggestionId) public view returns (uint256) {
return voted[suggestionId][account];
}
/**
* @dev Gets the creator of a suggestion.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getSuggestionCreator(uint256 suggestionId) public view returns (address) {
return suggestions[suggestionId].creator;
}
/**
* @dev Gets the creator for every suggestion in the contract.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getAllSuggestionCreators() public view returns (address[] memory) {
address[] memory creators = new address[](suggestionCount);
for (uint256 i = 0; i < suggestionCount; i++) {
creators[i] = suggestions[i].creator;
}
return creators;
}
/**
* @dev Internal logic for creating a suggestion.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function _createSuggestion(string memory text) internal {
// The ID is just based on the suggestion count, so the IDs go 0, 1, 2, etc.
uint256 suggestionId = suggestionCount++;
// Starts at 0 votes
suggestions[suggestionId] = Suggestion(0, true, msg.sender, text);
emit SuggestionCreated(suggestionId, text);
}
/**
* @dev Internal logic for voting.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function _vote(
address account,
uint256 suggestionId,
uint256 votes,
string memory comment
) internal returns (uint256) {
if (oneVotePerAccount) {
require(!hasVoted(account, suggestionId));
require(votes == 1);
}
Suggestion storage sugg = suggestions[suggestionId];
require(sugg.created);
voted[suggestionId][account] = voted[suggestionId][account].add(votes);
sugg.votes = sugg.votes.add(votes);
emit Votes(account, suggestionId, votes, sugg.votes, comment);
return sugg.votes;
}
}
__Erc20.sol 19 lines
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.6.10;
interface Erc20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
_Pausable.sol 68 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.10;
/**
* @dev Pausing logic that includes whether the pause was initiated by an attorney.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
contract Pausable {
struct PauseState {
bool paused;
bool pausedByAttorney;
}
PauseState private pauseState;
event Paused(address account, bool attorney);
event Unpaused(address account);
constructor() internal {
pauseState = PauseState(false, false);
}
modifier whenNotPaused() {
require(!pauseState.paused);
_;
}
modifier whenPaused() {
require(pauseState.paused);
_;
}
function paused() public view returns (bool) {
return pauseState.paused;
}
/**
* @dev Check if the pause was initiated by an attorney.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function pausedByAttorney() public view returns (bool) {
return pauseState.paused && pauseState.pausedByAttorney;
}
/**
* @dev Internal logic for pausing the contract.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function _pause(bool attorney) internal {
pauseState.paused = true;
pauseState.pausedByAttorney = attorney;
emit Paused(msg.sender, attorney);
}
/**
* @dev Internal logic for unpausing the contract.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function _unpause() internal {
pauseState.paused = false;
pauseState.pausedByAttorney = false;
emit Unpaused(msg.sender);
}
}
__SafeMath.sol 69 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.10;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*
* Originally from https://github.com/OpenZeppelin/openzeppelin-contracts
* Copyright (c) 2016-2020 zOS Global Limited
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
_ErrorCodes.sol 46 lines
// SPDX-License-Identifier: LicenseRef-Blockwell-Smart-License
pragma solidity >=0.4.25;
/**
* Gas-efficient error codes and replacement for require.
*
* This uses significantly less gas, and reduces the length of the contract bytecode.
*/
contract ErrorCodes {
bytes2 constant ERROR_RESERVED = 0xe100;
bytes2 constant ERROR_RESERVED2 = 0xe200;
bytes2 constant ERROR_MATH = 0xe101;
bytes2 constant ERROR_FROZEN = 0xe102;
bytes2 constant ERROR_INVALID_ADDRESS = 0xe103;
bytes2 constant ERROR_ZERO_VALUE = 0xe104;
bytes2 constant ERROR_INSUFFICIENT_BALANCE = 0xe105;
bytes2 constant ERROR_WRONG_TIME = 0xe106;
bytes2 constant ERROR_EMPTY_ARRAY = 0xe107;
bytes2 constant ERROR_LENGTH_MISMATCH = 0xe108;
bytes2 constant ERROR_UNAUTHORIZED = 0xe109;
bytes2 constant ERROR_DISALLOWED_STATE = 0xe10a;
bytes2 constant ERROR_TOO_HIGH = 0xe10b;
bytes2 constant ERROR_ERC721_CHECK = 0xe10c;
bytes2 constant ERROR_PAUSED = 0xe10d;
bytes2 constant ERROR_NOT_PAUSED = 0xe10e;
bytes2 constant ERROR_ALREADY_EXISTS = 0xe10f;
bytes2 constant ERROR_OWNER_MISMATCH = 0xe110;
bytes2 constant ERROR_LOCKED = 0xe111;
bytes2 constant ERROR_TOKEN_LOCKED = 0xe112;
bytes2 constant ERROR_ATTORNEY_PAUSE = 0xe113;
bytes2 constant ERROR_VALUE_MISMATCH = 0xe114;
bytes2 constant ERROR_TRANSFER_FAIL = 0xe115;
bytes2 constant ERROR_INDEX_RANGE = 0xe116;
bytes2 constant ERROR_PAYMENT = 0xe117;
function expect(bool pass, bytes2 code) internal pure {
if (!pass) {
assembly {
mstore(0x40, code)
revert(0x40, 0x02)
}
}
}
}
_PrimeToken.sol 796 lines
// SPDX-License-Identifier: LicenseRef-Blockwell-Smart-License
pragma solidity ^0.6.10;
import "./_TokenGroups.sol";
import "./__SafeMath.sol";
import "./_Voting.sol";
import "./__Erc20.sol";
import "./_BlockwellQuill.sol";
import "./_Type.sol";
/**
* Blockwell Prime Token
*/
contract PrimeToken is Erc20, TokenGroups, Type, Voting {
using SafeMath for uint256;
using BlockwellQuill for BlockwellQuill.Data;
/**
* @dev Stores data for individual token locks used by transferAndLock.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
struct Lock {
uint256 value;
uint64 expiration;
uint32 periodLength;
uint16 periods;
bool staking;
}
mapping(address => uint256) internal balances;
mapping(address => uint256) internal stakes;
mapping(address => mapping(address => uint256)) private allowed;
mapping(address => Lock[]) locks;
string public name;
string public symbol;
uint8 public decimals;
uint256 public unlockTime;
uint256 public transferLockTime;
string public attorneyEmail;
uint256 internal totalTokenSupply;
uint256 public swapNonce;
bool public suggestionsRestricted = false;
bool public requireBalanceForVote = false;
bool public requireBalanceForCreateSuggestion = false;
uint256 public voteCost;
uint256 public unstakingDelay = 1 hours;
BlockwellQuill.Data bwQuill1;
event SetNewUnlockTime(uint256 unlockTime);
event MultiTransferPrevented(address indexed from, address indexed to, uint256 value);
event Locked(
address indexed owner,
uint256 value,
uint64 expiration,
uint32 periodLength,
uint16 periodCount
);
event Unlocked(address indexed owner, uint256 value, uint16 periodsLeft);
event SwapToChain(
string toChain,
address indexed from,
address indexed to,
bytes32 indexed swapId,
uint256 value
);
event SwapFromChain(
string fromChain,
address indexed from,
address indexed to,
bytes32 indexed swapId,
uint256 value
);
event BwQuillSet(address indexed account, string value);
event Payment(address indexed from, address indexed to, uint256 value, uint256 order);
event Stake(address indexed account, uint256 value);
event Unstake(address indexed account, uint256 value);
event StakeReward(address indexed account, uint256 value);
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _totalSupply
) public {
require(_totalSupply > 0);
name = _name;
symbol = _symbol;
decimals = _decimals;
totalTokenSupply = _totalSupply;
init(msg.sender);
bwtype = PRIME;
bwver = 62;
}
function init(address sender) internal virtual {
_addBwAdmin(sender);
_addAdmin(sender);
balances[sender] = totalTokenSupply;
emit Transfer(address(0), sender, totalTokenSupply);
}
/**
* @dev Allow only when the contract is unlocked, or if the sender is an admin, an attorney, or whitelisted.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
modifier whenUnlocked() {
expect(
now > unlockTime || isAdmin(msg.sender) || isAttorney(msg.sender) || isWhitelisted(msg.sender),
ERROR_TOKEN_LOCKED
);
_;
}
/**
* @dev Set a quill 1 value for an account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function setBwQuill(address account, string memory value) public onlyAdminOrAttorney {
bwQuill1.setString(account, value);
emit BwQuillSet(account, value);
}
/**
* @dev Get a quill 1 value for any account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getBwQuill(address account) public view returns (string memory) {
return bwQuill1.getString(account);
}
/**
* @dev Configure how users can vote.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function configureVoting(
bool restrictSuggestions,
bool balanceForVote,
bool balanceForCreateSuggestion,
uint256 cost,
bool oneVote
) public onlyAdminOrAttorney {
suggestionsRestricted = restrictSuggestions;
requireBalanceForVote = balanceForVote;
requireBalanceForCreateSuggestion = balanceForCreateSuggestion;
voteCost = cost;
oneVotePerAccount = oneVote;
}
/**
* @dev Update the email address for this token's assigned attorney.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function setAttorneyEmail(string memory email) public onlyAdminOrAttorney {
attorneyEmail = email;
}
/**
* @dev Pause the contract, preventing transfers.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function pause() public whenNotPaused {
bool attorney = isAttorney(msg.sender);
expect(attorney || isAdmin(msg.sender), ERROR_UNAUTHORIZED);
_pause(attorney);
}
/**
* @dev Resume the contract.
*
* If the contract was originally paused by an attorney, only an attorney can resume.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function unpause() public whenPaused {
if (!isAttorney(msg.sender)) {
expect(isAdmin(msg.sender), ERROR_UNAUTHORIZED);
expect(!pausedByAttorney(), ERROR_ATTORNEY_PAUSE);
}
_unpause();
}
/**
* @dev Lock the contract if not already locked until the given time.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function setUnlockTime(uint256 timestamp) public onlyAdminOrAttorney {
unlockTime = timestamp;
emit SetNewUnlockTime(unlockTime);
}
/**
* @dev Total number of tokens.
*/
function totalSupply() public view override returns (uint256) {
return totalTokenSupply;
}
/**
* @dev Get account balance.
*/
function balanceOf(address account) public view override returns (uint256) {
return balances[account];
}
/**
* @dev Get allowance for an owner-spender pair.
*/
function allowance(address owner, address spender) public view override returns (uint256) {
return allowed[owner][spender];
}
/**
* @dev Transfer tokens.
*/
function transfer(address to, uint256 value) public override whenNotPaused whenUnlocked returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Make multiple token transfers with one transaction.
* @param to Array of addresses to transfer to.
* @param value Array of amounts to be transferred.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function multiTransfer(address[] calldata to, uint256[] calldata value)
public
whenNotPaused
onlyBundler
returns (bool)
{
expect(to.length > 0, ERROR_EMPTY_ARRAY);
expect(value.length == to.length, ERROR_LENGTH_MISMATCH);
for (uint256 i = 0; i < to.length; i++) {
if (!isFrozen(to[i])) {
_transfer(msg.sender, to[i], value[i]);
} else {
emit MultiTransferPrevented(msg.sender, to[i], value[i]);
}
}
return true;
}
/**
* @dev Approve a spender to transfer the given amount of the sender's tokens.
*/
function approve(address spender, uint256 value)
public
override
isNotFrozen
whenNotPaused
whenUnlocked
returns (bool)
{
expect(spender != address(0), ERROR_INVALID_ADDRESS);
allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from an account the sender has been approved to send from.
*/
function transferFrom(
address from,
address to,
uint256 value
) public override whenNotPaused whenUnlocked returns (bool) {
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Transfer tokens from one address to multiple others.
* @param from Address to send from.
* @param to Array of addresses to transfer to.
* @param value Array of amounts to be transferred.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function multiTransferFrom(
address from,
address[] calldata to,
uint256[] calldata value
) public whenNotPaused onlyBundler returns (bool) {
expect(to.length > 0, ERROR_EMPTY_ARRAY);
expect(value.length == to.length, ERROR_LENGTH_MISMATCH);
for (uint256 i = 0; i < to.length; i++) {
if (!isFrozen(to[i])) {
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value[i]);
_transfer(from, to[i], value[i]);
} else {
emit MultiTransferPrevented(from, to[i], value[i]);
}
}
return true;
}
/**
* @dev Increase the amount of tokens a spender can transfer from the sender's account.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
isNotFrozen
whenNotPaused
whenUnlocked
returns (bool)
{
expect(spender != address(0), ERROR_INVALID_ADDRESS);
allowed[msg.sender][spender] = allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens a spender can transfer from the sender's account.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
isNotFrozen
whenNotPaused
whenUnlocked
returns (bool)
{
expect(spender != address(0), ERROR_INVALID_ADDRESS);
allowed[msg.sender][spender] = allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
/**
* @dev Lists all the locks for the given account as an array, with [value1, expiration1, value2, expiration2, ...]
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function locksOf(address account) public view returns (uint256[] memory) {
Lock[] storage userLocks = locks[account];
uint256[] memory lockArray = new uint256[](userLocks.length * 4);
for (uint256 i = 0; i < userLocks.length; i++) {
uint256 pos = 4 * i;
lockArray[pos] = userLocks[i].value;
lockArray[pos + 1] = userLocks[i].expiration;
lockArray[pos + 2] = userLocks[i].periodLength;
lockArray[pos + 3] = userLocks[i].periods;
}
return lockArray;
}
/**
* @dev Unlocks all expired locks.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function unlock() public returns (bool) {
return _unlock(msg.sender);
}
/**
* @dev Base method for unlocking tokens.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function _unlock(address account) internal returns (bool) {
Lock[] storage list = locks[account];
if (list.length == 0) {
return true;
}
for (uint256 i = 0; i < list.length; ) {
Lock storage lock = list[i];
if (lock.expiration < block.timestamp) {
// Less than 2 means it's the last period (1), or periods are not used (0)
if (lock.periods < 2) {
emit Unlocked(account, lock.value, 0);
if (i < list.length - 1) {
list[i] = list[list.length - 1];
}
list.pop();
} else {
uint256 value;
uint256 diff = block.timestamp.sub(lock.expiration);
uint16 periodsPassed = 1 + uint16(diff.div(lock.periodLength));
if (periodsPassed >= lock.periods) {
periodsPassed = lock.periods;
value = lock.value;
emit Unlocked(account, value, 0);
if (i < list.length - 1) {
list[i] = list[list.length - 1];
}
list.pop();
} else {
value = lock.value.div(lock.periods) * periodsPassed;
lock.periods -= periodsPassed;
lock.value = lock.value.sub(value);
lock.expiration =
lock.expiration +
uint32(uint256(lock.periodLength).mul(periodsPassed));
emit Unlocked(account, value, lock.periods);
i++;
}
}
} else {
i++;
}
}
return true;
}
/**
* @dev Gets the unlocked balance of the specified address.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function unlockedBalanceOf(address account) public view returns (uint256) {
return balances[account].sub(totalLocked(account));
}
/**
* @dev Gets the total usable tokens for an account, including tokens that could be unlocked.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function availableBalanceOf(address account) external view returns (uint256) {
return balances[account].sub(totalLocked(account)).add(totalUnlockable(account));
}
/**
* @dev Transfers tokens and locks them for lockTime.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function transferAndLock(
address to,
uint256 value,
uint32 lockTime,
uint32 periodLength,
uint16 periods
) public returns (bool) {
uint64 expires = uint64(block.timestamp.add(lockTime));
Lock memory newLock = Lock(value, expires, periodLength, periods, false);
locks[to].push(newLock);
transfer(to, value);
emit Locked(to, value, expires, periodLength, periods);
return true;
}
/**
* @dev Transfer and lock to multiple accounts with a single transaction.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function multiTransferAndLock(
address[] calldata to,
uint256[] calldata value,
uint32 lockTime,
uint32 periodLength,
uint16 periods
) public whenNotPaused onlyBundler returns (bool) {
expect(to.length > 0, ERROR_EMPTY_ARRAY);
expect(value.length == to.length, ERROR_LENGTH_MISMATCH);
for (uint256 i = 0; i < to.length; i++) {
if (!isFrozen(to[i])) {
transferAndLock(to[i], value[i], lockTime, periodLength, periods);
} else {
emit MultiTransferPrevented(msg.sender, to[i], value[i]);
}
}
return true;
}
/**
* @dev Gets the total amount of locked tokens in the given account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function totalLocked(address account) public view returns (uint256) {
uint256 total = 0;
for (uint256 i = 0; i < locks[account].length; i++) {
total = total.add(locks[account][i].value);
}
return total;
}
/**
* @dev Gets the amount of tokens that can currently be unlocked.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function totalUnlockable(address account) public view returns (uint256) {
Lock[] storage userLocks = locks[account];
uint256 total = 0;
for (uint256 i = 0; i < userLocks.length; i++) {
Lock storage lock = userLocks[i];
if (lock.expiration < block.timestamp) {
if (lock.periods < 2) {
total = total.add(lock.value);
} else {
uint256 value;
uint256 diff = block.timestamp.sub(lock.expiration);
uint16 periodsPassed = 1 + uint16(diff.div(lock.periodLength));
if (periodsPassed > lock.periods) {
periodsPassed = lock.periods;
value = lock.value;
} else {
value = lock.value.div(lock.periods) * periodsPassed;
}
total = total.add(value);
}
}
}
return total;
}
/**
* @dev Withdraw any tokens the contract itself is holding.
*/
function withdrawTokens() public whenNotPaused {
expect(isAdmin(msg.sender), ERROR_UNAUTHORIZED);
_transfer(address(this), msg.sender, balanceOf(address(this)));
}
/**
* @dev Gets an incrementing nonce for generating swap IDs.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getSwapNonce() internal returns (uint256) {
return ++swapNonce;
}
/**
* @dev Initiates a swap to another chain. Transfers the tokens to this contract and emits an event
* indicating the request to swap.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function swapToChain(
string memory chain,
address to,
uint256 value
) public whenNotPaused whenUnlocked {
bytes32 swapId = keccak256(
abi.encodePacked(getSwapNonce(), msg.sender, to, address(this), chain, value)
);
_transfer(msg.sender, address(this), value);
emit SwapToChain(chain, msg.sender, to, swapId, value);
}
/**
* @dev Completes a swap from another chain, called by a swapper account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function swapFromChain(
string memory fromChain,
address from,
address to,
bytes32 swapId,
uint256 value
) public whenNotPaused onlySwapper {
_transfer(address(this), to, value);
emit SwapFromChain(fromChain, from, to, swapId, value);
}
/**
* @dev Create a new suggestion for voting.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function createSuggestion(string memory text) public {
if (suggestionsRestricted) {
expect(isAdmin(msg.sender) || isDelegate(msg.sender), ERROR_UNAUTHORIZED);
} else if (requireBalanceForCreateSuggestion) {
expect(balanceOf(msg.sender) > 0, ERROR_INSUFFICIENT_BALANCE);
}
_createSuggestion(text);
}
/**
* @dev Vote on a suggestion.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function vote(uint256 suggestionId, string memory comment) public {
if (requireBalanceForVote) {
expect(balanceOf(msg.sender) > 0, ERROR_INSUFFICIENT_BALANCE);
}
if (voteCost > 0) {
_transfer(msg.sender, address(this), voteCost);
}
_vote(msg.sender, suggestionId, 1, comment);
}
/**
* @dev Cast multiple votes on a suggestion.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function multiVote(
uint256 suggestionId,
uint256 votes,
string memory comment
) public {
expect(!oneVotePerAccount, ERROR_DISALLOWED_STATE);
if (requireBalanceForVote) {
expect(balanceOf(msg.sender) > 0, ERROR_INSUFFICIENT_BALANCE);
}
if (voteCost > 0) {
_transfer(msg.sender, address(this), voteCost.mul(votes));
}
_vote(msg.sender, suggestionId, votes, comment);
}
/**
* @dev Transfer tokens and include an order number for external reference.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function payment(
address to,
uint256 value,
uint256 order
) public whenNotPaused whenUnlocked returns (bool) {
_transfer(msg.sender, to, value);
emit Payment(msg.sender, to, value, order);
return true;
}
/**
* @dev Stake tokens, locking them for a minimum of unstakingDelay time.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function stake(uint256 value) public whenNotPaused whenUnlocked returns (bool) {
expect(!isFrozen(msg.sender), ERROR_FROZEN);
_unlock(msg.sender);
expect(value <= unlockedBalanceOf(msg.sender), ERROR_INSUFFICIENT_BALANCE);
balances[msg.sender] = balances[msg.sender].sub(value);
stakes[msg.sender] = stakes[msg.sender].add(value);
emit Transfer(msg.sender, address(0), value);
emit Stake(msg.sender, value);
return true;
}
/**
* @dev Get the total staked tokens for an account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function stakeOf(address account) public view returns (uint256) {
return stakes[account];
}
/**
* @dev Unstake tokens, which will lock them for unstakingDelay time.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function unstake(uint256 value) public whenNotPaused whenUnlocked returns (bool) {
expect(!isFrozen(msg.sender), ERROR_FROZEN);
stakes[msg.sender] = stakes[msg.sender].sub(value);
balances[msg.sender] = balances[msg.sender].add(value);
if (unstakingDelay > 0) {
uint64 expires = uint64(block.timestamp.add(unstakingDelay));
Lock memory newLock = Lock(value, expires, 0, 0, true);
locks[msg.sender].push(newLock);
emit Locked(msg.sender, value, expires, 0, 0);
}
emit Unstake(msg.sender, value);
emit Transfer(address(0), msg.sender, value);
return true;
}
/**
* @dev Configure staking parameters.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function configureStaking(uint256 unstakeDelay) public onlyAdminOrAttorney {
unstakingDelay = unstakeDelay;
}
/**
* @dev Reward tokens to account stake balances.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function stakeReward(address[] calldata to, uint256[] calldata value)
public
whenNotPaused
returns (bool)
{
expect(isAutomator(msg.sender), ERROR_UNAUTHORIZED);
expect(value.length == to.length, ERROR_LENGTH_MISMATCH);
for (uint256 i = 0; i < to.length; i++) {
address account = to[i];
uint256 val = value[i];
if (!isFrozen(account)) {
stakes[account] = stakes[account].add(val);
balances[msg.sender] = balances[msg.sender].sub(val);
emit StakeReward(account, val);
emit Transfer(msg.sender, address(0), val);
}
}
return true;
}
/**
* @dev Base method for transferring tokens.
*/
function _transfer(
address from,
address to,
uint256 value
) internal {
expect(to != address(0), ERROR_INVALID_ADDRESS);
expect(!isFrozen(from), ERROR_FROZEN);
expect(!isFrozen(to), ERROR_FROZEN);
_unlock(from);
expect(value <= unlockedBalanceOf(from), ERROR_INSUFFICIENT_BALANCE);
balances[from] = balances[from].sub(value);
balances[to] = balances[to].add(value);
emit Transfer(from, to, value);
}
}
_TokenGroups.sol 281 lines
// SPDX-License-Identifier: LicenseRef-Blockwell-Smart-License
pragma solidity ^0.6.10;
import "./_Pausable.sol";
import "./_ErrorCodes.sol";
import "./_Groups.sol";
/**
* @dev User groups for Prime Token.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
contract TokenGroups is Pausable, ErrorCodes {
uint8 public constant ADMIN = 1;
uint8 public constant ATTORNEY = 2;
uint8 public constant BUNDLER = 3;
uint8 public constant WHITELIST = 4;
uint8 public constant FROZEN = 5;
uint8 public constant BW_ADMIN = 6;
uint8 public constant SWAPPER = 7;
uint8 public constant DELEGATE = 8;
uint8 public constant AUTOMATOR = 11;
using Groups for Groups.GroupMap;
Groups.GroupMap groups;
event AddedToGroup(uint8 indexed groupId, address indexed account);
event RemovedFromGroup(uint8 indexed groupId, address indexed account);
event BwAddedAttorney(address indexed account);
event BwRemovedAttorney(address indexed account);
event BwRemovedAdmin(address indexed account);
modifier onlyAdminOrAttorney() {
expect(isAdmin(msg.sender) || isAttorney(msg.sender), ERROR_UNAUTHORIZED);
_;
}
// ATTORNEY
function _addAttorney(address account) internal {
_add(ATTORNEY, account);
}
function addAttorney(address account) public whenNotPaused onlyAdminOrAttorney {
_add(ATTORNEY, account);
}
/**
* @dev Allows BW admins to add an attorney to the contract in emergency cases.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function bwAddAttorney(address account) public onlyBwAdmin {
_add(ATTORNEY, account);
emit BwAddedAttorney(account);
}
function removeAttorney(address account) public whenNotPaused onlyAdminOrAttorney {
_remove(ATTORNEY, account);
}
/**
* @dev Allows BW admins to remove an attorney from the contract in emergency cases.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function bwRemoveAttorney(address account) public onlyBwAdmin {
_remove(ATTORNEY, account);
emit BwRemovedAttorney(account);
}
function isAttorney(address account) public view returns (bool) {
return _contains(ATTORNEY, account);
}
// ADMIN
function _addAdmin(address account) internal {
_add(ADMIN, account);
}
function addAdmin(address account) public whenNotPaused onlyAdminOrAttorney {
_addAdmin(account);
}
function removeAdmin(address account) public whenNotPaused onlyAdminOrAttorney {
_remove(ADMIN, account);
}
/**
* @dev Allows BW admins to remove an admin from the contract in emergency cases.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function bwRemoveAdmin(address account) public onlyBwAdmin {
_remove(ADMIN, account);
emit BwRemovedAdmin(account);
}
function isAdmin(address account) public view returns (bool) {
return _contains(ADMIN, account);
}
// BUNDLER
function addBundler(address account) public onlyAdminOrAttorney {
_add(BUNDLER, account);
}
function removeBundler(address account) public onlyAdminOrAttorney {
_remove(BUNDLER, account);
}
function isBundler(address account) public view returns (bool) {
return _contains(BUNDLER, account);
}
modifier onlyBundler() {
expect(isBundler(msg.sender), ERROR_UNAUTHORIZED);
_;
}
// SWAPPER
function addSwapper(address account) public onlyAdminOrAttorney {
_addSwapper(account);
}
function _addSwapper(address account) internal {
_add(SWAPPER, account);
}
function removeSwapper(address account) public onlyAdminOrAttorney {
_remove(SWAPPER, account);
}
function isSwapper(address account) public view returns (bool) {
return _contains(SWAPPER, account);
}
modifier onlySwapper() {
expect(isSwapper(msg.sender), ERROR_UNAUTHORIZED);
_;
}
// WHITELIST
function addToWhitelist(address account) public onlyAdminOrAttorney {
_add(WHITELIST, account);
}
function removeFromWhitelist(address account) public onlyAdminOrAttorney {
_remove(WHITELIST, account);
}
function isWhitelisted(address account) public view returns (bool) {
return _contains(WHITELIST, account);
}
// BW_ADMIN
function _addBwAdmin(address account) internal {
_add(BW_ADMIN, account);
}
function addBwAdmin(address account) public onlyBwAdmin {
_addBwAdmin(account);
}
function renounceBwAdmin() public {
_remove(BW_ADMIN, msg.sender);
}
function isBwAdmin(address account) public view returns (bool) {
return _contains(BW_ADMIN, account);
}
modifier onlyBwAdmin() {
expect(isBwAdmin(msg.sender), ERROR_UNAUTHORIZED);
_;
}
// FROZEN
function _freeze(address account) internal {
_add(FROZEN, account);
}
function freeze(address account) public onlyAdminOrAttorney {
_freeze(account);
}
function _unfreeze(address account) internal {
_remove(FROZEN, account);
}
function unfreeze(address account) public onlyAdminOrAttorney {
_unfreeze(account);
}
/**
* @dev Freeze multiple accounts with a single transaction.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function multiFreeze(address[] calldata account) public onlyAdminOrAttorney {
expect(account.length > 0, ERROR_EMPTY_ARRAY);
for (uint256 i = 0; i < account.length; i++) {
_freeze(account[i]);
}
}
/**
* @dev Unfreeze multiple accounts with a single transaction.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function multiUnfreeze(address[] calldata account) public onlyAdminOrAttorney {
expect(account.length > 0, ERROR_EMPTY_ARRAY);
for (uint256 i = 0; i < account.length; i++) {
_unfreeze(account[i]);
}
}
function isFrozen(address account) public view returns (bool) {
return _contains(FROZEN, account);
}
modifier isNotFrozen() {
expect(!isFrozen(msg.sender), ERROR_FROZEN);
_;
}
// DELEGATE
function addDelegate(address account) public onlyAdminOrAttorney {
_add(DELEGATE, account);
}
function removeDelegate(address account) public onlyAdminOrAttorney {
_remove(DELEGATE, account);
}
function isDelegate(address account) public view returns (bool) {
return _contains(DELEGATE, account);
}
// AUTOMATOR
function addAutomator(address account) public onlyAdminOrAttorney {
_add(AUTOMATOR, account);
}
function removeAutomator(address account) public onlyAdminOrAttorney {
_remove(AUTOMATOR, account);
}
function isAutomator(address account) public view returns (bool) {
return _contains(AUTOMATOR, account);
}
// Internal functions
function _add(uint8 groupId, address account) internal {
groups.add(groupId, account);
emit AddedToGroup(groupId, account);
}
function _remove(uint8 groupId, address account) internal {
groups.remove(groupId, account);
emit RemovedFromGroup(groupId, account);
}
function _contains(uint8 groupId, address account) internal view returns (bool) {
return groups.contains(groupId, account);
}
}
PrimeDeployable.sol 67 lines
// SPDX-License-Identifier: LicenseRef-Blockwell-Smart-License
/*
______ __ _
| _ \ / _| | |
| | | |___| |_ __ _ ___| |_ ___ _ __
| | | / _ \ _/ _` |/ __| __/ _ \| '__|
| |/ / __/ || (_| | (__| || (_) | |
|___/ \___|_| \__,_|\___|\__\___/|_|
Defactor provides a gateway for traditional businesses to access the billions
of dollars currently available in Decentralized Finance (DeFi) liquidity pools,
offering a pipeline of real-world assets that can bring enormous value to the
DeFi ecosystem. Defactor will spawn new business models and new financial
products and services based on DeFi. Defactor will help cement DeFi as a true
competitor to traditional finance.
For more information about the project visit https://www.defactor.com
*/
pragma solidity ^0.6.10;
import "./_PrimeToken.sol";
/**
* @dev Extended constructor for added user groups and deployment fees.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
contract PrimeDeployable is PrimeToken {
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals,
uint256 _totalSupply,
address owner,
address bwAdmin,
address feeAccount,
uint256 feePercentageTenths,
address attorney,
string memory _attorneyEmail
) public PrimeToken(_name, _symbol, _decimals, _totalSupply) {
_addBwAdmin(bwAdmin);
_addAdmin(owner);
if (attorney != address(0x0)) {
_addAttorney(attorney);
}
attorneyEmail = _attorneyEmail;
// Percentage should be in tenths, so 1% would be 10
if (feePercentageTenths > 0) {
uint256 fee = totalTokenSupply.mul(feePercentageTenths).div(1000);
balances[owner] = totalTokenSupply.sub(fee);
emit Transfer(address(0), owner, balances[owner]);
balances[feeAccount] = fee;
emit Transfer(address(0), feeAccount, fee);
} else {
balances[owner] = totalTokenSupply;
emit Transfer(address(0), owner, totalTokenSupply);
}
}
function init(address) internal override {
// Skip the original init function
}
}
_BlockwellQuill.sol 113 lines
// SPDX-License-Identifier: LicenseRef-Blockwell-Smart-License
pragma solidity ^0.6.10;
/**
* @dev Blockwell Quill, storing arbitrary data associated with accounts.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
library BlockwellQuill {
struct Data {
mapping(address => bytes) data;
}
/**
* @dev Set data on the account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function set(
Data storage data,
address account,
bytes memory value
) internal {
require(account != address(0));
data.data[account] = value;
}
/**
* @dev Get data on the account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function get(Data storage data, address account) internal view returns (bytes memory) {
require(account != address(0));
return data.data[account];
}
/**
* @dev Convert and set string data on the account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function setString(
Data storage data,
address account,
string memory value
) internal {
data.data[address(account)] = bytes(value);
}
/**
* @dev Get and convert string data on the account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getString(Data storage data, address account) internal view returns (string memory) {
return string(data.data[address(account)]);
}
/**
* @dev Convert and set uint256 data on the account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function setUint256(
Data storage data,
address account,
uint256 value
) internal {
data.data[address(account)] = abi.encodePacked(value);
}
/**
* @dev Get and convert uint256 data on the account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getUint256(Data storage data, address account) internal view returns (uint256) {
uint256 ret;
bytes memory source = data.data[address(account)];
assembly {
ret := mload(add(source, 32))
}
return ret;
}
/**
* @dev Convert and set address data on the account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function setAddress(
Data storage data,
address account,
address value
) internal {
data.data[address(account)] = abi.encodePacked(value);
}
/**
* @dev Get and convert address data on the account.
*
* Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License)
*/
function getAddress(Data storage data, address account) internal view returns (address) {
address ret;
bytes memory source = data.data[address(account)];
assembly {
ret := mload(add(source, 20))
}
return ret;
}
}
Read Contract
ADMIN 0x2a0acc6a → uint8
ATTORNEY 0x40dce49a → uint8
AUTOMATOR 0x6d0b9543 → uint8
BUNDLER 0x32a49578 → uint8
BW_ADMIN 0x97599fd9 → uint8
DELEGATE 0x4a2d5c9d → uint8
FROZEN 0x3b5764eb → uint8
SWAPPER 0x700d85ae → uint8
WHITELIST 0x1bb7cc99 → uint8
allowance 0xdd62ed3e → uint256
attorneyEmail 0xefa1937d → string
availableBalanceOf 0x25d998bb → uint256
balanceOf 0x70a08231 → uint256
bwtype 0x7c7b0e61 → uint256
bwver 0x4f2bf9d1 → uint256
decimals 0x313ce567 → uint8
getAccountVotes 0x111c5bee → uint256
getAllSuggestionCreators 0xb306f735 → address[]
getAllVotes 0x851b6ef2 → uint256[]
getBwQuill 0xd7e4f652 → string
getSuggestionCreator 0x26d2527c → address
getSuggestionText 0xd157f8c8 → string
getVotes 0xff981099 → uint256
hasVoted 0x42545825 → bool
isAdmin 0x24d7806c → bool
isAttorney 0xf7af4a30 → bool
isAutomator 0x4f6218b8 → bool
isBundler 0x551530d6 → bool
isBwAdmin 0xbc9ac68c → bool
isDelegate 0x07779627 → bool
isFrozen 0xe5839836 → bool
isSwapper 0xb64230ba → bool
isWhitelisted 0x3af32abf → bool
locksOf 0xc3f9ab58 → uint256[]
name 0x06fdde03 → string
oneVotePerAccount 0xc93dbc49 → bool
paused 0x5c975abb → bool
pausedByAttorney 0xae1ccf2c → bool
requireBalanceForCreateSuggestion 0x373ccc52 → bool
requireBalanceForVote 0x72160860 → bool
stakeOf 0x42623360 → uint256
suggestionCount 0x8027d6cc → uint256
suggestionsRestricted 0x7c365c2c → bool
swapNonce 0x53f74a7e → uint256
symbol 0x95d89b41 → string
totalLocked 0xd8fb9337 → uint256
totalSupply 0x18160ddd → uint256
totalUnlockable 0x6f9336a9 → uint256
transferLockTime 0xe87a7a59 → uint256
unlockTime 0x251c1aa3 → uint256
unlockedBalanceOf 0x84955c88 → uint256
unstakingDelay 0x07089246 → uint256
voteCost 0x4c1b8ffd → uint256
Write Contract 50 functions
These functions modify contract state and require a wallet transaction to execute.
addAdmin 0x70480275
address account
addAttorney 0x380a75bf
address account
addAutomator 0xedca8aa8
address account
addBundler 0xce531ff1
address account
addBwAdmin 0x40abfe26
address account
addDelegate 0xe71bdf41
address account
addSwapper 0x99385006
address account
addToWhitelist 0xe43252d7
address account
approve 0x095ea7b3
address spender
uint256 value
returns: bool
bwAddAttorney 0x89cf785a
address account
bwRemoveAdmin 0xa75d5254
address account
bwRemoveAttorney 0x13c3e409
address account
configureStaking 0xc6925865
uint256 unstakeDelay
configureVoting 0x7ad44d60
bool restrictSuggestions
bool balanceForVote
bool balanceForCreateSuggestion
uint256 cost
bool oneVote
createSuggestion 0x33b15378
string text
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
freeze 0x8d1fdf2f
address account
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
multiFreeze 0xde1be3c2
address[] account
multiTransfer 0x1e89d545
address[] to
uint256[] value
returns: bool
multiTransferAndLock 0x7275f3c8
address[] to
uint256[] value
uint32 lockTime
uint32 periodLength
uint16 periods
returns: bool
multiTransferFrom 0xcb31b6cd
address from
address[] to
uint256[] value
returns: bool
multiUnfreeze 0xf1eddfd5
address[] account
multiVote 0x8fad11bf
uint256 suggestionId
uint256 votes
string comment
pause 0x8456cb59
No parameters
payment 0x9b91293b
address to
uint256 value
uint256 order
returns: bool
removeAdmin 0x1785f53c
address account
removeAttorney 0x3192d50a
address account
removeAutomator 0xd6fe7cb7
address account
removeBundler 0x25db64c0
address account
removeDelegate 0x67e7646f
address account
removeFromWhitelist 0x8ab1d681
address account
removeSwapper 0x3f2d4131
address account
renounceBwAdmin 0xe19e4349
No parameters
setAttorneyEmail 0x33fd8b4e
string email
setBwQuill 0x91c3cbbb
address account
string value
setUnlockTime 0xdace4557
uint256 timestamp
stake 0xa694fc3a
uint256 value
returns: bool
stakeReward 0x5be0606d
address[] to
uint256[] value
returns: bool
swapFromChain 0x9f9b58d3
string fromChain
address from
address to
bytes32 swapId
uint256 value
swapToChain 0x6c76c2a1
string chain
address to
uint256 value
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferAndLock 0x633db62c
address to
uint256 value
uint32 lockTime
uint32 periodLength
uint16 periods
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
unfreeze 0x45c8b1a6
address account
unlock 0xa69df4b5
No parameters
returns: bool
unpause 0x3f4ba83a
No parameters
unstake 0x2e17de78
uint256 value
returns: bool
vote 0x24108475
uint256 suggestionId
string comment
withdrawTokens 0x8d8f2adb
No parameters
Token Balances (2)
View Transfers →Recent Transactions
No transactions found for this address