Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mapping(uint=>address) public theWork; //noita
- mapping(uint=>uint) workingTotem;
- mapping(uint=>string) public txt;
- mapping(uint=>bool) requestLocked;
- event OracleRequest(address buidlr, uint totemID, uint earningsToManifest, address _theWork, string text, uint ticketID);
- function oracleRequest(uint totemID, string memory _txt, address contract_optional) public payable returns(uint ticketID){
- address sender = msg.sender;
- require( staker[totemID] == sender && !totemManifest[totemID] && !requestLocked[totemID] );
- uint ID = ORACLE.fileRequestTicket{value: msg.value}(1, true);
- workingTotem[ID] = totemID;
- theWork[totemID] = contract_optional;
- txt[totemID] = _txt;
- requestLocked[totemID] = true;
- emit OracleRequest(sender, totemID, builder_dividendsOf(totemID)+builder_earnings[totemID], contract_optional, _txt, ID);
- return ID;
- }
- event CommunityReward(address buidlr, uint totemID, uint reward, address contractBuilt, string text, uint ticketID);
- event RequestRejected(uint totemID, uint ticketID);
- function oracleIntFallback(uint ticketID, bool requestRejected, uint numberOfOptions, uint[] memory optionWeights, int[] memory intOptions) public{
- uint optWeight;
- uint positive;
- uint negative;
- uint totemID = workingTotem[ticketID];
- require( msg.sender == address(ORACLE) );
- for(uint i; i < numberOfOptions; i+=1){
- optWeight = optionWeights[i];
- if(intOptions[i]>0){
- positive += optWeight;
- }else{
- negative += optWeight;
- }
- }
- if(!requestRejected && positive>negative){
- //emit event and give reward
- if(!totemManifest[totemID]){
- totemManifest[totemID] = true;
- uint earned = builder_earnings[totemID];
- if(earned>0){
- if( staker[totemID]==address(0) ){
- storeUpCommunityRewards(earned);
- }else{
- earnings[MVTpool][staker[totemID]] += earned;
- }
- }
- emit CommunityReward(staker[totemID], totemID, earned, theWork[totemID], txt[totemID], ticketID );
- }
- }else{
- emit RequestRejected(totemID,ticketID);
- }
- requestLocked[totemID] = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment