Skip to content

Instantly share code, notes, and snippets.

@rgsk
rgsk / kudos.sol
Created November 21, 2021 10:04
web 3.0 Session 1
pragma solidity >=0.7.0 <0.9.0;
contract Kudos {
mapping (address => Kudo[]) allKudos;
function giveKudos(address who, string memory what, string memory comments) public {
Kudo memory kudo = Kudo(what, msg.sender, comments);
allKudos[who].push(kudo);
}
function getKudosAtIndex(address who, uint index) public view returns (string memory, address, string memory) {
Kudo memory kudo = allKudos[who][index];
@rgsk
rgsk / helloworld.sol
Last active November 21, 2021 09:07
web3.0 Session
pragma solidity >=0.7.0 <0.9.0;
contract Kudos {
int startingNumber;
function setStartingNumber(int startNum) public {
startingNumber = startNum;
}
function getSum(int numToAdd) public view returns (int) {
return startingNumber + numToAdd;
}
{
"start_demography12345678910": {
"id": "start_demography",
"question": "Hey ${name}, Tell us your current weight? (in kg)",
"previous": "start_assessment",
"next": "1",
"type": "num",
"key": "current_weight",
"ui": {
"label": "Current Weight",