Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x8d2AC6Ba2f4340cf53B879FF0dB90382D441A3bA
Balance 0 ETH
Nonce 1
Code Size 15640 bytes
Indexed Transactions 0 (1 on-chain, 1.3% indexed)
External Etherscan · Sourcify

Contract Bytecode

15640 bytes
0x608060405234801561000f575f5ffd5b506004361061023a575f3560e01c8063945e0a4c11610139578063eb6cc010116100b6578063fbfecaa31161007a578063fbfecaa3146106a0578063fc5cc73b146106d7578063fccc281314610707578063fd6cb61314610725578063fd8c32ef146107415761023a565b8063eb6cc0101461060c578063ef035cd51461062a578063f01f20df14610648578063f2fde38b14610666578063fb8b51a0146106825761023a565b8063b83392a8116100fd578063b83392a814610566578063c3f0d32714610596578063ca27cf04146105b2578063ce7e2847146105d0578063e0269505146105ee5761023a565b8063945e0a4c146104bd5780639ad34845146104ee578063a62cc6eb1461050c578063abe8386b1461052a578063b0a32c7a146105485761023a565b80634b769654116101c7578063715018a61161018b578063715018a61461043b578063833ad0ff1461044557806389fb8760146104615780638da5cb5b146104835780638fe02300146104a15761023a565b80634b7696541461038257806354b43e62146103a05780635a9baf37146103d15780635af87fdb146103ef578063662b517d1461041f5761023a565b80632784de601161020e5780632784de60146102b65780632950a47f146102e6578063412bd34814610316578063439d8f4e146103465780634a079215146103645761023a565b80629ae45e1461023e5780630ba51d091461025c5780631058299d1461027a57806320fd678014610298575b5f5ffd5b61024661075d565b6040516102539190612610565b60405180910390f35b610264610763565b6040516102719190612610565b60405180910390f35b61028261076b565b60405161028f9190612610565b60405180910390f35b6102a0610773565b6040516102ad9190612610565b60405180910390f35b6102d060048036038101906102cb9190612a5c565b610779565b6040516102dd9190612bb7565b60405180910390f35b61030060048036038101906102fb9190612bd7565b610b8b565b60405161030d9190612610565b60405180910390f35b610330600480360381019061032b9190612c1e565b610beb565b60405161033d9190612bb7565b60405180910390f35b61034e610ea4565b60405161035b9190612610565b60405180910390f35b61036c610eaa565b6040516103799190612610565b60405180910390f35b61038a610eb0565b6040516103979190612610565b60405180910390f35b6103ba60048036038101906103b59190612c49565b610eb6565b6040516103c8929190612d01565b60405180910390f35b6103d961102d565b6040516103e69190612610565b60405180910390f35b61040960048036038101906104049190612d2f565b611036565b6040516104169190612610565b60405180910390f35b61043960048036038101906104349190612d9b565b61104b565b005b6104436111b6565b005b61045f600480360381019061045a9190612dc6565b6111c9565b005b6104696112a3565b60405161047a959493929190612e3d565b60405180910390f35b61048b6112c8565b6040516104989190612e9d565b60405180910390f35b6104bb60048036038101906104b69190612d9b565b6112ef565b005b6104d760048036038101906104d29190612d9b565b611314565b6040516104e5929190612eb6565b60405180910390f35b6104f661151f565b6040516105039190612610565b60405180910390f35b610514611527565b6040516105219190612610565b60405180910390f35b61053261152f565b60405161053f9190612f3f565b60405180910390f35b610550611554565b60405161055d9190612610565b60405180910390f35b610580600480360381019061057b9190612d9b565b61155c565b60405161058d9190613072565b60405180910390f35b6105b060048036038101906105ab9190612d9b565b6117df565b005b6105ba611835565b6040516105c79190612610565b60405180910390f35b6105d8611841565b6040516105e59190612e9d565b60405180910390f35b6105f6611859565b6040516106039190612e9d565b60405180910390f35b61061461187e565b6040516106219190613092565b60405180910390f35b61063261189e565b60405161063f9190612610565b60405180910390f35b6106506118a4565b60405161065d9190612610565b60405180910390f35b610680600480360381019061067b9190612c1e565b6118aa565b005b61068a61192e565b6040516106979190612610565b60405180910390f35b6106ba60048036038101906106b59190612d9b565b611934565b6040516106ce9897969594939291906130b2565b60405180910390f35b6106f160048036038101906106ec919061313c565b611add565b6040516106fe919061317a565b60405180910390f35b61070f611e30565b60405161071c9190612e9d565b60405180910390f35b61073f600480360381019061073a9190612c1e565b611e36565b005b61075b60048036038101906107569190612d9b565b611e81565b005b60065481565b634000000081565b638000000081565b60085481565b606082518451146107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b6906131dd565b60405180910390fd5b8151845114610803576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107fa906131dd565b60405180910390fd5b5f5f90505f5f90505b8451811015610858575f61083986838151811061082c5761082b6131fb565b5b6020026020010151611314565b50905080836108489190613255565b925050808060010191505061080c565b505f811115610a9e57600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016108bf93929190613288565b6020604051808303815f875af11580156108db573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108ff91906132e7565b505f6064600754836109119190613312565b61091b9190613380565b90505f8111156109c557600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb61dead836040518363ffffffff1660e01b81526004016109839291906133b0565b6020604051808303815f875af115801561099f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c391906132e7565b505b5f81836109d291906133d7565b90505f811115610a9b57600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610a599291906133b0565b6020604051808303815f875af1158015610a75573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a9991906132e7565b505b50505b5f855167ffffffffffffffff811115610aba57610ab961264e565b5b604051908082528060200260200182016040528015610ae85781602001602082028036833780820191505090505b5090505f5f90505b8651811015610b7e57610b52878281518110610b0f57610b0e6131fb565b5b6020026020010151878381518110610b2a57610b296131fb565b5b6020026020010151878481518110610b4557610b446131fb565b5b6020026020010151611e93565b828281518110610b6557610b646131fb565b5b6020026020010181815250508080600101915050610af0565b5080925050509392505050565b5f5f5f90505f5f90505b8351811015610be1575f610bc2858381518110610bb557610bb46131fb565b5b6020026020010151611314565b5090508083610bd19190613255565b9250508080600101915050610b95565b5080915050919050565b60605f5f90505f5f90505b600b80549050811015610d0c578373ffffffffffffffffffffffffffffffffffffffff16600b8281548110610c2e57610c2d6131fb565b5b905f5260205f2090600802015f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610ceb57508373ffffffffffffffffffffffffffffffffffffffff16600b8281548110610ca457610ca36131fb565b5b905f5260205f2090600802016001015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610cff578180610cfb9061340a565b9250505b8080600101915050610bf6565b505f8167ffffffffffffffff811115610d2857610d2761264e565b5b604051908082528060200260200182016040528015610d565781602001602082028036833780820191505090505b5090505f5f90505f5f90505b600b80549050811015610e98578573ffffffffffffffffffffffffffffffffffffffff16600b8281548110610d9a57610d996131fb565b5b905f5260205f2090600802015f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610e5757508573ffffffffffffffffffffffffffffffffffffffff16600b8281548110610e1057610e0f6131fb565b5b905f5260205f2090600802016001015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610e8b5780838381518110610e7057610e6f6131fb565b5b6020026020010181815250508180610e879061340a565b9250505b8080600101915050610d62565b50819350505050919050565b60045481565b60035481565b60095481565b5f60605f600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401610f149190612e9d565b602060405180830381865afa158015610f2f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f539190613465565b90505f5f610f6086611314565b915091505f8203610fc8576008548310610fa257600181604051602001610f879190613514565b60405160208183030381529060405294509450505050611026565b5f6040518060600160405280602b8152602001613cb8602b913994509450505050611026565b818310610ffd57600181604051602001610fe2919061357f565b60405160208183030381529060405294509450505050611026565b5f8160405160200161100f91906135ea565b604051602081830303815290604052945094505050505b9250929050565b64014000000081565b5f611042848484611ebb565b90509392505050565b600b805490508110611092576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108990613655565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16600b82815481106110bd576110bc6131fb565b5b905f5260205f2090600802015f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611141576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611138906136bd565b60405180910390fd5b5f600b8281548110611156576111556131fb565b5b905f5260205f2090600802016007015f6101000a81548160ff021916908315150217905550807f15560d137de3eaedb24a0cb6f12852d6e78a62a0c994988450abe96c819873d2336040516111ab9190612e9d565b60405180910390a250565b6111be612251565b6111c75f6122d8565b565b6111d1612251565b670de0b6b3a7640000856111e59190613312565b600281905550670de0b6b3a7640000846111ff9190613312565b600381905550670de0b6b3a7640000836112199190613312565b600481905550670de0b6b3a7640000826112339190613312565b600581905550670de0b6b3a76400008161124d9190613312565b6006819055507f7e39e71e820d7ea3b5beedc2de48a9712a3d398aa7c0709933c9d73390fbdef0600254600354600454600554600654604051611294959493929190612e3d565b60405180910390a15050505050565b5f5f5f5f5f600254600354600454600554600654945094509450945094509091929394565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6112f7612251565b670de0b6b3a76400008161130b9190613312565b60088190555050565b5f606064014000000083111561135f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113569061374b565b60405180910390fd5b60095483116113a8575f6040518060400160405280600481526020017f46524545000000000000000000000000000000000000000000000000000000008152509150915061151a565b630fa0000083116113f5576002546040518060400160405280600581526020017f54494552310000000000000000000000000000000000000000000000000000008152509150915061151a565b631f4000008311611442576003546040518060400160405280600581526020017f54494552320000000000000000000000000000000000000000000000000000008152509150915061151a565b6340000000831161148f576004546040518060400160405280600581526020017f54494552330000000000000000000000000000000000000000000000000000008152509150915061151a565b638000000083116114dc576005546040518060400160405280600581526020017f54494552340000000000000000000000000000000000000000000000000000008152509150915061151a565b6006546040518060400160405280600581526020017f5449455235000000000000000000000000000000000000000000000000000000815250915091505b915091565b631f40000081565b630fa0000081565b600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b630640000081565b61156461258b565b600b8054905082106115ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a2906137b3565b60405180910390fd5b600b82815481106115bf576115be6131fb565b5b905f5260205f209060080201604051806101000160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282018054611690906137fe565b80601f01602080910402602001604051908101604052809291908181526020018280546116bc906137fe565b80156117075780601f106116de57610100808354040283529160200191611707565b820191905f5260205f20905b8154815290600101906020018083116116ea57829003601f168201915b5050505050815260200160038201548152602001600482015481526020016005820154815260200160068201805461173e906137fe565b80601f016020809104026020016040519081016040528092919081815260200182805461176a906137fe565b80156117b55780601f1061178c576101008083540402835291602001916117b5565b820191905f5260205f20905b81548152906001019060200180831161179857829003601f168201915b50505050508152602001600782015f9054906101000a900460ff1615151515815250509050919050565b6117e7612251565b606481111561182b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182290613878565b60405180910390fd5b8060078190555050565b5f600b80549050905090565b73de496a902836601e86e79d5b10e713c95580640b81565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060604051806080016040528060588152602001613c6060589139905090565b60055481565b60075481565b6118b2612251565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611922575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016119199190612e9d565b60405180910390fd5b61192b816122d8565b50565b60025481565b600b8181548110611943575f80fd5b905f5260205f2090600802015f91509050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020180546119ac906137fe565b80601f01602080910402602001604051908101604052809291908181526020018280546119d8906137fe565b8015611a235780601f106119fa57610100808354040283529160200191611a23565b820191905f5260205f20905b815481529060010190602001808311611a0657829003601f168201915b505050505090806003015490806004015490806005015490806006018054611a4a906137fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611a76906137fe565b8015611ac15780601f10611a9857610100808354040283529160200191611ac1565b820191905f5260205f20905b815481529060010190602001808311611aa457829003601f168201915b505050505090806007015f9054906101000a900460ff16905088565b5f600b805490508310611b25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1c90613655565b60405180910390fd5b5f600b8481548110611b3a57611b396131fb565b5b905f5260205f209060080201604051806101000160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282018054611c0b906137fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611c37906137fe565b8015611c825780601f10611c5957610100808354040283529160200191611c82565b820191905f5260205f20905b815481529060010190602001808311611c6557829003601f168201915b50505050508152602001600382015481526020016004820154815260200160058201548152602001600682018054611cb9906137fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611ce5906137fe565b8015611d305780601f10611d0757610100808354040283529160200191611d30565b820191905f5260205f20905b815481529060010190602001808311611d1357829003601f168201915b50505050508152602001600782015f9054906101000a900460ff16151515158152505090508060e00151611d67575f915050611e2a565b8273ffffffffffffffffffffffffffffffffffffffff16815f015173ffffffffffffffffffffffffffffffffffffffff1603611da7576001915050611e2a565b5f73ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff1614158015611e1657508273ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff16145b15611e25576001915050611e2a565b5f9150505b92915050565b61dead81565b611e3e612251565b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611e89612251565b8060098190555050565b5f5f5f611e9f85611314565b91509150611eb08686868585612399565b925050509392505050565b5f640140000000831115611f04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611efb906138e0565b60405180910390fd5b5f5f611f0f85611314565b915091505f8203611ffc57600854600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401611f779190612e9d565b602060405180830381865afa158015611f92573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fb69190613465565b1015611ff7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fee9061396e565b60405180910390fd5b612239565b600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b815260040161205a93929190613288565b6020604051808303815f875af1158015612076573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061209a91906132e7565b505f6064600754846120ac9190613312565b6120b69190613380565b90505f81111561216057600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb61dead836040518363ffffffff1660e01b815260040161211e9291906133b0565b6020604051808303815f875af115801561213a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061215e91906132e7565b505b5f818461216d91906133d7565b90505f81111561223657600a5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b81526004016121f49291906133b0565b6020604051808303815f875af1158015612210573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061223491906132e7565b505b50505b6122468686868585612399565b925050509392505050565b612259612584565b73ffffffffffffffffffffffffffffffffffffffff166122776112c8565b73ffffffffffffffffffffffffffffffffffffffff16146122d65761229a612584565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016122cd9190612e9d565b60405180910390fd5b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f600b6040518061010001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff16815260200188815260200187815260200142815260200185815260200184815260200160011515815250908060018154018082558091505060019003905f5260205f2090600802015f909190919091505f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020190816124ca9190613b23565b50606082015181600301556080820151816004015560a0820151816005015560c08201518160060190816124fe9190613b23565b5060e0820151816007015f6101000a81548160ff02191690831515021790555050505f6001600b8054905061253391906133d7565b9050807f4430e048e90244b7b1f92f4151bcdde3eb3f123c8621c7f9e3690954e244ec9433878a8a898960405161256f96959493929190613bf2565b60405180910390a28091505095945050505050565b5f33905090565b6040518061010001604052805f73ffffffffffffffffffffffffffffffffffffffff1681526020015f73ffffffffffffffffffffffffffffffffffffffff168152602001606081526020015f81526020015f81526020015f8152602001606081526020015f151581525090565b5f819050919050565b61260a816125f8565b82525050565b5f6020820190506126235f830184612601565b92915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6126848261263e565b810181811067ffffffffffffffff821117156126a3576126a261264e565b5b80604052505050565b5f6126b5612629565b90506126c1828261267b565b919050565b5f67ffffffffffffffff8211156126e0576126df61264e565b5b602082029050602081019050919050565b5f5ffd5b5f5ffd5b5f67ffffffffffffffff8211156127135761271261264e565b5b61271c8261263e565b9050602081019050919050565b828183375f83830152505050565b5f612749612744846126f9565b6126ac565b905082815260208101848484011115612765576127646126f5565b5b612770848285612729565b509392505050565b5f82601f83011261278c5761278b61263a565b5b813561279c848260208601612737565b91505092915050565b5f6127b76127b2846126c6565b6126ac565b905080838252602082019050602084028301858111156127da576127d96126f1565b5b835b8181101561282157803567ffffffffffffffff8111156127ff576127fe61263a565b5b80860161280c8982612778565b855260208501945050506020810190506127dc565b5050509392505050565b5f82601f83011261283f5761283e61263a565b5b813561284f8482602086016127a5565b91505092915050565b5f67ffffffffffffffff8211156128725761287161264e565b5b602082029050602081019050919050565b61288c816125f8565b8114612896575f5ffd5b50565b5f813590506128a781612883565b92915050565b5f6128bf6128ba84612858565b6126ac565b905080838252602082019050602084028301858111156128e2576128e16126f1565b5b835b8181101561290b57806128f78882612899565b8452602084019350506020810190506128e4565b5050509392505050565b5f82601f8301126129295761292861263a565b5b81356129398482602086016128ad565b91505092915050565b5f67ffffffffffffffff82111561295c5761295b61264e565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6129968261296d565b9050919050565b6129a68161298c565b81146129b0575f5ffd5b50565b5f813590506129c18161299d565b92915050565b5f6129d96129d484612942565b6126ac565b905080838252602082019050602084028301858111156129fc576129fb6126f1565b5b835b81811015612a255780612a1188826129b3565b8452602084019350506020810190506129fe565b5050509392505050565b5f82601f830112612a4357612a4261263a565b5b8135612a538482602086016129c7565b91505092915050565b5f5f5f60608486031215612a7357612a72612632565b5b5f84013567ffffffffffffffff811115612a9057612a8f612636565b5b612a9c8682870161282b565b935050602084013567ffffffffffffffff811115612abd57612abc612636565b5b612ac986828701612915565b925050604084013567ffffffffffffffff811115612aea57612ae9612636565b5b612af686828701612a2f565b9150509250925092565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b612b32816125f8565b82525050565b5f612b438383612b29565b60208301905092915050565b5f602082019050919050565b5f612b6582612b00565b612b6f8185612b0a565b9350612b7a83612b1a565b805f5b83811015612baa578151612b918882612b38565b9750612b9c83612b4f565b925050600181019050612b7d565b5085935050505092915050565b5f6020820190508181035f830152612bcf8184612b5b565b905092915050565b5f60208284031215612bec57612beb612632565b5b5f82013567ffffffffffffffff811115612c0957612c08612636565b5b612c1584828501612915565b91505092915050565b5f60208284031215612c3357612c32612632565b5b5f612c40848285016129b3565b91505092915050565b5f5f60408385031215612c5f57612c5e612632565b5b5f612c6c858286016129b3565b9250506020612c7d85828601612899565b9150509250929050565b5f8115159050919050565b612c9b81612c87565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f612cd382612ca1565b612cdd8185612cab565b9350612ced818560208601612cbb565b612cf68161263e565b840191505092915050565b5f604082019050612d145f830185612c92565b8181036020830152612d268184612cc9565b90509392505050565b5f5f5f60608486031215612d4657612d45612632565b5b5f84013567ffffffffffffffff811115612d6357612d62612636565b5b612d6f86828701612778565b9350506020612d8086828701612899565b9250506040612d91868287016129b3565b9150509250925092565b5f60208284031215612db057612daf612632565b5b5f612dbd84828501612899565b91505092915050565b5f5f5f5f5f60a08688031215612ddf57612dde612632565b5b5f612dec88828901612899565b9550506020612dfd88828901612899565b9450506040612e0e88828901612899565b9350506060612e1f88828901612899565b9250506080612e3088828901612899565b9150509295509295909350565b5f60a082019050612e505f830188612601565b612e5d6020830187612601565b612e6a6040830186612601565b612e776060830185612601565b612e846080830184612601565b9695505050505050565b612e978161298c565b82525050565b5f602082019050612eb05f830184612e8e565b92915050565b5f604082019050612ec95f830185612601565b8181036020830152612edb8184612cc9565b90509392505050565b5f819050919050565b5f612f07612f02612efd8461296d565b612ee4565b61296d565b9050919050565b5f612f1882612eed565b9050919050565b5f612f2982612f0e565b9050919050565b612f3981612f1f565b82525050565b5f602082019050612f525f830184612f30565b92915050565b612f618161298c565b82525050565b5f82825260208201905092915050565b5f612f8182612ca1565b612f8b8185612f67565b9350612f9b818560208601612cbb565b612fa48161263e565b840191505092915050565b612fb881612c87565b82525050565b5f61010083015f830151612fd45f860182612f58565b506020830151612fe76020860182612f58565b5060408301518482036040860152612fff8282612f77565b91505060608301516130146060860182612b29565b5060808301516130276080860182612b29565b5060a083015161303a60a0860182612b29565b5060c083015184820360c08601526130528282612f77565b91505060e083015161306760e0860182612faf565b508091505092915050565b5f6020820190508181035f83015261308a8184612fbe565b905092915050565b5f6020820190508181035f8301526130aa8184612cc9565b905092915050565b5f610100820190506130c65f83018b612e8e565b6130d3602083018a612e8e565b81810360408301526130e58189612cc9565b90506130f46060830188612601565b6131016080830187612601565b61310e60a0830186612601565b81810360c08301526131208185612cc9565b905061312f60e0830184612c92565b9998505050505050505050565b5f5f6040838503121561315257613151612632565b5b5f61315f85828601612899565b9250506020613170858286016129b3565b9150509250929050565b5f60208201905061318d5f830184612c92565b92915050565b7f417272617973206c656e677468206d69736d61746368000000000000000000005f82015250565b5f6131c7601683612cab565b91506131d282613193565b602082019050919050565b5f6020820190508181035f8301526131f4816131bb565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61325f826125f8565b915061326a836125f8565b925082820190508082111561328257613281613228565b5b92915050565b5f60608201905061329b5f830186612e8e565b6132a86020830185612e8e565b6132b56040830184612601565b949350505050565b6132c681612c87565b81146132d0575f5ffd5b50565b5f815190506132e1816132bd565b92915050565b5f602082840312156132fc576132fb612632565b5b5f613309848285016132d3565b91505092915050565b5f61331c826125f8565b9150613327836125f8565b9250828202613335816125f8565b9150828204841483151761334c5761334b613228565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61338a826125f8565b9150613395836125f8565b9250826133a5576133a4613353565b5b828204905092915050565b5f6040820190506133c35f830185612e8e565b6133d06020830184612601565b9392505050565b5f6133e1826125f8565b91506133ec836125f8565b925082820390508181111561340457613403613228565b5b92915050565b5f613414826125f8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361344657613445613228565b5b600182019050919050565b5f8151905061345f81612883565b92915050565b5f6020828403121561347a57613479612632565b5b5f61348784828501613451565b91505092915050565b5f81905092915050565b7f467265652075706c6f616420617070726f76656420666f7220000000000000005f82015250565b5f6134ce601983613490565b91506134d98261349a565b601982019050919050565b5f6134ee82612ca1565b6134f88185613490565b9350613508818560208601612cbb565b80840191505092915050565b5f61351e826134c2565b915061352a82846134e4565b915081905092915050565b7f506169642075706c6f616420617070726f76656420666f7220000000000000005f82015250565b5f613569601983613490565b915061357482613535565b601982019050919050565b5f6135898261355d565b915061359582846134e4565b915081905092915050565b7f496e73756666696369656e7420434c4f414b2062616c616e636520666f7220005f82015250565b5f6135d4601f83613490565b91506135df826135a0565b601f82019050919050565b5f6135f4826135c8565b915061360082846134e4565b915081905092915050565b7f496e76616c69642075706c6f61642049440000000000000000000000000000005f82015250565b5f61363f601183612cab565b915061364a8261360b565b602082019050919050565b5f6020820190508181035f83015261366c81613633565b9050919050565b7f4f6e6c792075706c6f616465722063616e2064656163746976617465000000005f82015250565b5f6136a7601c83612cab565b91506136b282613673565b602082019050919050565b5f6020820190508181035f8301526136d48161369b565b9050919050565b7f46696c652073697a65206578636565647320354742206d6178696d756d206c695f8201527f6d69740000000000000000000000000000000000000000000000000000000000602082015250565b5f613735602383612cab565b9150613740826136db565b604082019050919050565b5f6020820190508181035f83015261376281613729565b9050919050565b7f496e76616c6964204944000000000000000000000000000000000000000000005f82015250565b5f61379d600a83612cab565b91506137a882613769565b602082019050919050565b5f6020820190508181035f8301526137ca81613791565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061381557607f821691505b602082108103613828576138276137d1565b5b50919050565b7f50657263656e74616765206d757374206265203c3d20313030000000000000005f82015250565b5f613862601983612cab565b915061386d8261382e565b602082019050919050565b5f6020820190508181035f83015261388f81613856565b9050919050565b7f46696c65206578636565647320354742206d6178696d756d2073697a650000005f82015250565b5f6138ca601d83612cab565b91506138d582613896565b602082019050919050565b5f6020820190508181035f8301526138f7816138be565b9050919050565b7f4d75737420686f6c64206d696e696d756d20434c4f414b20666f7220667265655f8201527f2075706c6f616473000000000000000000000000000000000000000000000000602082015250565b5f613958602883612cab565b9150613963826138fe565b604082019050919050565b5f6020820190508181035f8301526139858161394c565b9050919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026139e87fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826139ad565b6139f286836139ad565b95508019841693508086168417925050509392505050565b5f613a24613a1f613a1a846125f8565b612ee4565b6125f8565b9050919050565b5f819050919050565b613a3d83613a0a565b613a51613a4982613a2b565b8484546139b9565b825550505050565b5f5f905090565b613a68613a59565b613a73818484613a34565b505050565b5b81811015613a9657613a8b5f82613a60565b600181019050613a79565b5050565b601f821115613adb57613aac8161398c565b613ab58461399e565b81016020851015613ac4578190505b613ad8613ad08561399e565b830182613a78565b50505b505050565b5f82821c905092915050565b5f613afb5f1984600802613ae0565b1980831691505092915050565b5f613b138383613aec565b9150826002028217905092915050565b613b2c82612ca1565b67ffffffffffffffff811115613b4557613b4461264e565b5b613b4f82546137fe565b613b5a828285613a9a565b5f60209050601f831160018114613b8b575f8415613b79578287015190505b613b838582613b08565b865550613bea565b601f198416613b998661398c565b5f5b82811015613bc057848901518255600182019150602085019450602081019050613b9b565b86831015613bdd5784890151613bd9601f891682613aec565b8355505b6001600288020188555050505b505050505050565b5f60c082019050613c055f830189612e8e565b613c126020830188612e8e565b8181036040830152613c248187612cc9565b9050613c336060830186612601565b613c406080830185612601565b81810360a0830152613c528184612cc9565b905097965050505050505056fe54494552313a203130304d422d3235304d422c2054494552323a203235304d422d3530304d422c2054494552333a203530304d422d3147422c2054494552343a203147422d3247422c2054494552353a203247422d354742496e73756666696369656e7420434c4f414b2062616c616e636520666f7220667265652075706c6f616473a264697066735822122004daa7f8fdbe663d346edf32482ec6d9920250fd852aa9e3f122e145dc30d84464736f6c634300081c0033

Verified Source Code Partial Match

Compiler: v0.8.30+commit.73712a01 EVM: prague Optimization: No
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
cloak_transfr.sol 342 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract CloakTransferContract is Ownable {
    address public constant CLOAK_ADDRESS = 0xdE496A902836601E86e79d5B10e713C95580640B;
    address public PAYMENT_ADDRESS = 0x64B7FaBdd619B9020859a19f1151a86A9c867bcA;
    address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;

    // File size tier constants (in bytes)
    uint256 public constant TIER_1_MIN = 100 * 1024 * 1024;   // 100MB
    uint256 public constant TIER_1_MAX = 250 * 1024 * 1024;   // 250MB
    uint256 public constant TIER_2_MAX = 500 * 1024 * 1024;   // 500MB
    uint256 public constant TIER_3_MAX = 1024 * 1024 * 1024;  // 1GB
    uint256 public constant TIER_4_MAX = 2 * 1024 * 1024 * 1024; // 2GB
    uint256 public constant MAX_FILE_SIZE = 5 * 1024 * 1024 * 1024; // 5GB max

    // Pricing for each tier in CLOAK tokens (with 18 decimals)
    uint256 public tier1Price; // 100MB-250MB
    uint256 public tier2Price; // 250MB-500MB  
    uint256 public tier3Price; // 500MB-1GB
    uint256 public tier4Price; // 1GB-2GB
    uint256 public tier5Price; // 2GB-5GB

    uint256 public burnPercentage; // Percentage of payment to burn (0-100)
    uint256 public MIN_CLOAK_BALANCE = 1e18; // Minimum 1 CLOAK for free tier
    uint256 public MAX_FREE_SIZE = 100 * 1024 * 1024; // 100 MB in bytes for free tier
    uint256 private constant DECIMALS_MULTIPLIER = 10**18;

    IERC20 public cloakToken;

    struct FileUpload {
        address uploader;
        address recipient; // Optional recipient for the file transfer
        string fileCID; // Generic file identifier (internally maps to our storage system)
        uint256 fileSize; // Size in bytes
        uint256 timestamp;
        uint256 pricePaid; // Amount paid in CLOAK tokens
        string tier; // Which tier was used for pricing
        bool active; // Can be deactivated by uploader
    }

    FileUpload[] public uploads;

    event FileUploaded(
        uint256 indexed id,
        address uploader,
        address recipient,
        string fileCID,
        uint256 fileSize,
        uint256 pricePaid,
        string tier
    );

    event FileDeactivated(uint256 indexed id, address uploader);
    event TierPricesUpdated(uint256 tier1, uint256 tier2, uint256 tier3, uint256 tier4, uint256 tier5);

    constructor() Ownable(msg.sender) {
        cloakToken = IERC20(CLOAK_ADDRESS);
        burnPercentage = 10; // 10% burn
        
        // Initialize default tier prices (in CLOAK with 18 decimals)
        // These can be updated by owner based on USD equivalent
        tier1Price = 5 * DECIMALS_MULTIPLIER;   // 5 CLOAK for 100MB-250MB
        tier2Price = 10 * DECIMALS_MULTIPLIER;  // 10 CLOAK for 250MB-500MB
        tier3Price = 15 * DECIMALS_MULTIPLIER;  // 15 CLOAK for 500MB-1GB
        tier4Price = 25 * DECIMALS_MULTIPLIER;  // 25 CLOAK for 1GB-2GB
        tier5Price = 40 * DECIMALS_MULTIPLIER;  // 40 CLOAK for 2GB-5GB
    }

    // ============= Pricing Functions =============

    function getPriceForFileSize(uint256 _fileSize) public view returns (uint256 price, string memory tier) {
        require(_fileSize <= MAX_FILE_SIZE, "File size exceeds 5GB maximum limit");
        
        // Free tier for files under 100MB with minimum CLOAK balance
        if (_fileSize <= MAX_FREE_SIZE) {
            return (0, "FREE");
        }
        
        // Tiered pricing based on file size
        if (_fileSize <= TIER_1_MAX) {
            return (tier1Price, "TIER1"); // 100MB-250MB
        } else if (_fileSize <= TIER_2_MAX) {
            return (tier2Price, "TIER2"); // 250MB-500MB
        } else if (_fileSize <= TIER_3_MAX) {
            return (tier3Price, "TIER3"); // 500MB-1GB
        } else if (_fileSize <= TIER_4_MAX) {
            return (tier4Price, "TIER4"); // 1GB-2GB
        } else {
            return (tier5Price, "TIER5"); // 2GB-5GB
        }
    }

    function getChargeForMultipleFiles(uint256[] memory _fileSizes) external view returns (uint256) {
        uint256 totalCharge = 0;
        for (uint i = 0; i < _fileSizes.length; i++) {
            (uint256 price,) = getPriceForFileSize(_fileSizes[i]);
            totalCharge += price;
        }
        return totalCharge;
    }

    function canUserUpload(address _user, uint256 _fileSize) external view returns (bool, string memory) {
        uint256 userBalance = cloakToken.balanceOf(_user);
        (uint256 price, string memory tier) = getPriceForFileSize(_fileSize);
        
        if (price == 0) { // Free tier
            if (userBalance >= MIN_CLOAK_BALANCE) {
                return (true, string(abi.encodePacked("Free upload approved for ", tier)));
            }
            return (false, "Insufficient CLOAK balance for free uploads");
        } else {
            if (userBalance >= price) {
                return (true, string(abi.encodePacked("Paid upload approved for ", tier)));
            }
            return (false, string(abi.encodePacked("Insufficient CLOAK balance for ", tier)));
        }
    }

    // ============= Owner Functions =============
    
    function updateTierPrices(
        uint256 _tier1Price,
        uint256 _tier2Price, 
        uint256 _tier3Price,
        uint256 _tier4Price,
        uint256 _tier5Price
    ) external onlyOwner {
        tier1Price = _tier1Price * DECIMALS_MULTIPLIER;
        tier2Price = _tier2Price * DECIMALS_MULTIPLIER;
        tier3Price = _tier3Price * DECIMALS_MULTIPLIER;
        tier4Price = _tier4Price * DECIMALS_MULTIPLIER;
        tier5Price = _tier5Price * DECIMALS_MULTIPLIER;
        
        emit TierPricesUpdated(tier1Price, tier2Price, tier3Price, tier4Price, tier5Price);
    }

    function setFreeSizeFile(uint256 _size) external onlyOwner {
        MAX_FREE_SIZE = _size;
    }

    function setMinCloakBalance(uint256 _balance) external onlyOwner {
        MIN_CLOAK_BALANCE = _balance * DECIMALS_MULTIPLIER;
    }

    function setPaymentWallet(address _charge_address) external onlyOwner {
        PAYMENT_ADDRESS = _charge_address;
    }

    function setBurnPercentage(uint256 _percent) external onlyOwner {
        require(_percent <= 100, "Percentage must be <= 100");
        burnPercentage = _percent;
    }

    // ============= Upload Functions =============

    function uploadFile(
        string memory _fileCID,
        uint256 _fileSize,
        address _recipient
    ) external returns (uint256) {
        return _processUpload(_fileCID, _fileSize, _recipient);
    }

    function uploadMultipleFiles(
        string[] memory _fileCIDs,
        uint256[] memory _fileSizes,
        address[] memory _recipients
    ) external returns (uint256[] memory) {
        require(_fileCIDs.length == _fileSizes.length, "Arrays length mismatch");
        require(_fileCIDs.length == _recipients.length, "Arrays length mismatch");
        
        // Calculate total charge first
        uint256 totalCharge = 0;
        for (uint i = 0; i < _fileSizes.length; i++) {
            (uint256 price,) = getPriceForFileSize(_fileSizes[i]);
            totalCharge += price;
        }
        
        // Process payment if needed
        if (totalCharge > 0) {
            cloakToken.transferFrom(msg.sender, address(this), totalCharge);
            
            uint256 burnAmount = (totalCharge * burnPercentage) / 100;
            if (burnAmount > 0) {
                cloakToken.transfer(BURN_ADDRESS, burnAmount);
            }
            
            uint256 paymentAmount = totalCharge - burnAmount;
            if (paymentAmount > 0) {
                cloakToken.transfer(PAYMENT_ADDRESS, paymentAmount);
            }
        }
        
        // Process all uploads
        uint256[] memory uploadIds = new uint256[](_fileCIDs.length);
        for (uint i = 0; i < _fileCIDs.length; i++) {
            uploadIds[i] = _recordUpload(_fileCIDs[i], _fileSizes[i], _recipients[i]);
        }
        
        return uploadIds;
    }

    function _processUpload(
        string memory _fileCID,
        uint256 _fileSize,
        address _recipient
    ) internal returns (uint256) {
        require(_fileSize <= MAX_FILE_SIZE, "File exceeds 5GB maximum size");
        
        (uint256 price, string memory tier) = getPriceForFileSize(_fileSize);
        
        if (price == 0) {
            // Free upload if holding minimum CLOAK
            require(
                cloakToken.balanceOf(msg.sender) >= MIN_CLOAK_BALANCE,
                "Must hold minimum CLOAK for free uploads"
            );
        } else {
            // Charge for paid tiers
            cloakToken.transferFrom(msg.sender, address(this), price);

            uint256 burnAmount = (price * burnPercentage) / 100;
            if (burnAmount > 0) {
                cloakToken.transfer(BURN_ADDRESS, burnAmount);
            }

            uint256 paymentAmount = price - burnAmount;
            if (paymentAmount > 0) {
                cloakToken.transfer(PAYMENT_ADDRESS, paymentAmount);
            }
        }

        return _recordUpload(_fileCID, _fileSize, _recipient, price, tier);
    }

    function _recordUpload(
        string memory _fileCID,
        uint256 _fileSize,
        address _recipient
    ) internal returns (uint256) {
        (uint256 price, string memory tier) = getPriceForFileSize(_fileSize);
        return _recordUpload(_fileCID, _fileSize, _recipient, price, tier);
    }

    function _recordUpload(
        string memory _fileCID,
        uint256 _fileSize,
        address _recipient,
        uint256 _pricePaid,
        string memory _tier
    ) internal returns (uint256) {
        uploads.push(
            FileUpload({
                uploader: msg.sender,
                recipient: _recipient,
                fileCID: _fileCID,
                fileSize: _fileSize,
                timestamp: block.timestamp,
                pricePaid: _pricePaid,
                tier: _tier,
                active: true
            })
        );

        uint256 uploadId = uploads.length - 1;
        emit FileUploaded(uploadId, msg.sender, _recipient, _fileCID, _fileSize, _pricePaid, _tier);
        return uploadId;
    }

    // ============= Access Control Functions =============
    
    function canAccessFile(uint256 _uploadId, address _user) external view returns (bool) {
        require(_uploadId < uploads.length, "Invalid upload ID");
        FileUpload memory upload = uploads[_uploadId];
        
        if (!upload.active) return false;
        
        // Uploader can always access
        if (upload.uploader == _user) return true;
        
        // Recipient can access if specified
        if (upload.recipient != address(0) && upload.recipient == _user) return true;
        
        return false;
    }

    function deactivateUpload(uint256 _uploadId) external {
        require(_uploadId < uploads.length, "Invalid upload ID");
        require(uploads[_uploadId].uploader == msg.sender, "Only uploader can deactivate");
        
        uploads[_uploadId].active = false;
        emit FileDeactivated(_uploadId, msg.sender);
    }

    // ============= Query Functions =============

    function getUploadCount() external view returns (uint256) {
        return uploads.length;
    }

    function getUpload(uint256 _id) external view returns (FileUpload memory) {
        require(_id < uploads.length, "Invalid ID");
        return uploads[_id];
    }

    function getUserUploads(address _user) external view returns (uint256[] memory) {
        uint256 count = 0;
        
        // Count user's uploads
        for (uint i = 0; i < uploads.length; i++) {
            if (uploads[i].uploader == _user || uploads[i].recipient == _user) {
                count++;
            }
        }
        
        // Collect upload IDs
        uint256[] memory userUploads = new uint256[](count);
        uint256 index = 0;
        for (uint i = 0; i < uploads.length; i++) {
            if (uploads[i].uploader == _user || uploads[i].recipient == _user) {
                userUploads[index] = i;
                index++;
            }
        }
        
        return userUploads;
    }

    // ============= Tier Information Functions =============

    function getAllTierPrices() external view returns (uint256, uint256, uint256, uint256, uint256) {
        return (tier1Price, tier2Price, tier3Price, tier4Price, tier5Price);
    }

    function getTierInfo() external pure returns (string memory) {
        return "TIER1: 100MB-250MB, TIER2: 250MB-500MB, TIER3: 500MB-1GB, TIER4: 1GB-2GB, TIER5: 2GB-5GB";
    }
}

Read Contract

BURN_ADDRESS 0xfccc2813 → address
CLOAK_ADDRESS 0xce7e2847 → address
MAX_FILE_SIZE 0x5a9baf37 → uint256
MAX_FREE_SIZE 0x4b769654 → uint256
MIN_CLOAK_BALANCE 0x20fd6780 → uint256
PAYMENT_ADDRESS 0xe0269505 → address
TIER_1_MAX 0xa62cc6eb → uint256
TIER_1_MIN 0xb0a32c7a → uint256
TIER_2_MAX 0x9ad34845 → uint256
TIER_3_MAX 0x0ba51d09 → uint256
TIER_4_MAX 0x1058299d → uint256
burnPercentage 0xf01f20df → uint256
canAccessFile 0xfc5cc73b → bool
canUserUpload 0x54b43e62 → bool, string
cloakToken 0xabe8386b → address
getAllTierPrices 0x89fb8760 → uint256, uint256, uint256, uint256, uint256
getChargeForMultipleFiles 0x2950a47f → uint256
getPriceForFileSize 0x945e0a4c → uint256, string
getTierInfo 0xeb6cc010 → string
getUpload 0xb83392a8 → tuple
getUploadCount 0xca27cf04 → uint256
getUserUploads 0x412bd348 → uint256[]
owner 0x8da5cb5b → address
tier1Price 0xfb8b51a0 → uint256
tier2Price 0x4a079215 → uint256
tier3Price 0x439d8f4e → uint256
tier4Price 0xef035cd5 → uint256
tier5Price 0x009ae45e → uint256
uploads 0xfbfecaa3 → address, address, string, uint256, uint256, uint256, string, bool

Write Contract 10 functions

These functions modify contract state and require a wallet transaction to execute.

deactivateUpload 0x662b517d
uint256 _uploadId
renounceOwnership 0x715018a6
No parameters
setBurnPercentage 0xc3f0d327
uint256 _percent
setFreeSizeFile 0xfd8c32ef
uint256 _size
setMinCloakBalance 0x8fe02300
uint256 _balance
setPaymentWallet 0xfd6cb613
address _charge_address
transferOwnership 0xf2fde38b
address newOwner
updateTierPrices 0x833ad0ff
uint256 _tier1Price
uint256 _tier2Price
uint256 _tier3Price
uint256 _tier4Price
uint256 _tier5Price
uploadFile 0x5af87fdb
string _fileCID
uint256 _fileSize
address _recipient
returns: uint256
uploadMultipleFiles 0x2784de60
string[] _fileCIDs
uint256[] _fileSizes
address[] _recipients
returns: uint256[]

Recent Transactions

This address has 1 on-chain transactions, but only 1.3% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →