Skip to content

Instantly share code, notes, and snippets.

@app.route('/to_send_per_entity/<int:entity_id>/<int:shares_owned>/<int:shares_in_circulation>/<int:dividend_fund>', methods=['GET'])
@cross_origin()
def to_send(entity_id, shares_owned, shares_in_circulation, dividend_fund):
if entity_id > LEAGUE_SIZE:
entity_id -= LEAGUE_SIZE
league = league_data()
entity_held_score = float(league[entity_id - 1]['fantasy_points'])
sum_scores = 0.0
@beshup
beshup / calculateDividend.js
Created May 14, 2021 23:32
not actually javascript
function requestDividendWorthyEntities(string memory request_uri) public onlyOwner {
Chainlink.Request memory request = buildChainlinkRequest(nba_JOBID, address(this), this.fulfill.selector);
// Set the URL to perform the request on
request.add("get", request_uri);
request.add("path", "to_send");
bytes32 reqID = sendChainlinkRequestTo(nba_ORACLE, request, fee);
jobIdMapping[reqID] = msg.sender;
}
@beshup
beshup / giveDividendPerPlayer.js
Last active May 14, 2021 23:27
not actually javascript
function giveDividendPerPlayer(string memory request_uri) public hasSeasonStarted {
require(lastDividendWithdrawn[msg.sender] < currWeekStart);
lastDividendWithdrawn[msg.sender] = block.timestamp;
requestDividendWorthyEntities(request_uri);
}