Created
January 20, 2020 14:56
-
-
Save Dave-Whiffin/45c648f2b6b393479a8a6ba0e1553d0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"constant":false,"inputs":[{"internalType":"address payable","name":"_parent","type":"address"}],"name":"joinTo","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nodes","outputs":[{"internalType":"uint8","name":"level","type":"uint8"},{"internalType":"address payable","name":"parent","type":"address"},{"internalType":"address payable","name":"descendant1","type":"address"},{"internalType":"address payable","name":"descendant2","type":"address"},{"internalType":"address payable","name":"descendant3","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"levelUp","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address payable","name":"_parent","type":"address"}],"name":"findAvailableNode","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"descendant1","type":"address"},{"internalType":"address payable","name":"descendant2","type":"address"},{"internalType":"address payable","name":"descendant3","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"uint8","name":"level","type":"uint8"}],"name":"LevelUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"parent","type":"address"}],"name":"Joined","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"user","type":"address"}],"name":"SaleSkiped","type":"event"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
610100604052670de0b6b3a76400006080908152671bc16d674ec8000060a052676124fee993bc000060c05268019274b259f654000060e052610046906001906004610668565b5034801561005357600080fd5b5060405161102c38038061102c8339818101604052606081101561007657600080fd5b8101908080519060200190929190805190602001909291908051906020019092919050505033600260006101000a8154816001600160a01b0302191690836001600160a01b031602179055506040518060a00160405280600460ff168152602001600260009054906101000a90046001600160a01b03166001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001826001600160a01b0316815250600080600260009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050506040518060a00160405280600460ff168152602001600260009054906101000a90046001600160a01b03166001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815250600080856001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050506040518060a00160405280600460ff168152602001600260009054906101000a90046001600160a01b03166001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815250600080846001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050506040518060a00160405280600460ff168152602001600260009054906101000a90046001600160a01b03166001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815250600080836001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050505050506106db565b8280548282559060005260206000209081019282156106ae579160200282015b828111156106ae57825182906001600160481b0316905591602001919060010190610688565b506106ba9291506106be565b5090565b6106d891905b808211156106ba57600081556001016106c4565b90565b610942806106ea6000396000f3fe60806040526004361061004a5760003560e01c806301219c741461004f578063189a5a17146100775780634ea1ecf9146100e75780638da5cb5b146100ef578063c79772ef14610120575b600080fd5b6100756004803603602081101561006557600080fd5b50356001600160a01b0316610153565b005b34801561008357600080fd5b506100aa6004803603602081101561009a57600080fd5b50356001600160a01b0316610379565b6040805160ff90961686526001600160a01b0394851660208701529284168584015290831660608501529091166080830152519081900360a00190f35b6100756103bb565b3480156100fb57600080fd5b506101046105b9565b604080516001600160a01b039092168252519081900360200190f35b34801561012c57600080fd5b506101046004803603602081101561014357600080fd5b50356001600160a01b03166105c8565b3360009081526020819052604090205460ff16156101ac576040805162461bcd60e51b8152602060048201526011602482015270185b1c9958591e4818dbdb9b9958dd1959607a1b604482015290519081900360640190fd5b60006101b7826105c8565b6001600160a01b038082166000908152602081905260409020600181015492935091166101f7576001810180546001600160a01b0319163317905561029a565b60028101546001600160a01b0316610222576002810180546001600160a01b0319163317905561029a565b60038101546001600160a01b031661024d576003810180546001600160a01b0319163317905561029a565b6040805162461bcd60e51b815260206004820152601d60248201527f746865726520617265206e6f20656d7074792064657363656e64616e74000000604482015290519081900360640190fd5b6040805160a08101825260018082526001600160a01b0380861660208085018281526000868801818152606088018281526080890183815233808552958490528a842099518a549551891661010002610100600160a81b031960ff9290921660ff199097169690961716949094178955905196880180549787166001600160a01b03199889161790555160028801805491871691881691909117905590516003909601805496909416959094169490941790915592517f7702dccda75540ad1dca8d5276c048f4a5c0e4203f6da4be214bfb1901b203ea9190a3505050565b600060208190529081526040902080546001820154600283015460039093015460ff8316936001600160a01b0361010090940484169392831692908116911685565b336000908152602081905260409020805460ff16610420576040805162461bcd60e51b815260206004820152601860248201527f796f7520617265206e6f7420696e20506f6e7a7947616d650000000000000000604482015290519081900360640190fd5b80546001805460009260ff1690811061043557fe5b90600052602060002001541161047f576040805162461bcd60e51b815260206004820152600a6024820152691b185cdd081b195d995b60b21b604482015290519081900360640190fd5b805461010090046001600160a01b031660005b825460ff168110156104c9576001600160a01b03918216600090815260208190526040902054610100900490911690600101610492565b505b81546001600160a01b03821660009081526020819052604090205460ff91821660010182169116101561055c576040805133815290516001600160a01b038316917f27dd2b446e574e858c61cf3431c74990e293fca9727d172c88d18ffb293fc51b919081900360200190a26001600160a01b039081166000908152602081905260409020546101009004166104cb565b815460ff198116600160ff928316018216178084556040805191909216815290516001600160a01b0383169133917fd3025c5a7ee366197baa9cb6bf9971a524392f6acfc0075f262f58006607409f916020908290030190a35050565b6002546001600160a01b031681565b60408051600d8082526101c0820190925260009160609190602082016101a0803883395050506001600160a01b0384166000908152602081905260408120549192509060019060ff166106565760025483516001600160a01b0390911690849060009061063157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050610685565b848360008151811061066457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b600083838060010194508151811061069957fe5b602002602001015190506106ab6108df565b506001600160a01b0380821660009081526020818152604091829020825160a081018452815460ff811680835261010090910486169382019390935260018201548516938101939093526002810154841660608401526003015490921660808201529061074e576040805162461bcd60e51b815260206004820152600c60248201526b1d1c99594818dc985cda195960a21b604482015290519081900360640190fd5b60408101516001600160a01b031661076c575093506108da92505050565b60608101516001600160a01b031661078a575093506108da92505050565b60808101516001600160a01b03166107a8575093506108da92505050565b600383865103101561084157606085516003026001016040519080825280602002602001820160405280156107e7578160200160208202803883390190505b509050845b848110156108365786818151811061080057fe5b6020026020010151828783038151811061081657fe5b6001600160a01b03909216602092830291909101909101526001016107ec565b509450600093909203915b6040810151855160018501948791811061085757fe5b6001600160a01b03909216602092830291909101909101526060810151855160018501948791811061088557fe5b6001600160a01b0390921660209283029190910190910152608081015185516001850194879181106108b357fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505050610685565b919050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fea265627a7a72315820f420e423499774b39d46534ec484f49c475bc824c2f7dbe6cf56c024008d5a7f64736f6c634300050b0032 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//pragma solidity ^0.5.14; | |
pragma solidity ^0.5.0; | |
contract PonzyGameModified{ | |
mapping(address => Node) public nodes; | |
uint[] prices = [1 ether, 2 ether, 7 ether, 29 ether]; | |
address payable public owner; | |
event LevelUp(address indexed user, address indexed seller, uint8 level); | |
event Joined(address indexed user, address indexed parent); | |
event SaleSkiped(address indexed seller, address user); | |
struct Node { | |
uint8 level; | |
address payable parent; | |
address payable descendant1; | |
address payable descendant2; | |
address payable descendant3; | |
} | |
constructor(address payable descendant1, address payable descendant2, address payable descendant3) public { | |
owner = msg.sender; | |
nodes[owner] = Node(4, owner, descendant1, descendant2, descendant3 ); | |
nodes[descendant1] = Node(4, owner, address(uint160(0)), address(uint160(0)), address(uint160(0)) ); | |
nodes[descendant2] = Node(4, owner, address(uint160(0)), address(uint160(0)), address(uint160(0)) ); | |
nodes[descendant3] = Node(4, owner, address(uint160(0)), address(uint160(0)), address(uint160(0)) ); | |
} | |
function joinTo(address payable _parent) payable public{ | |
// require(msg.value == prices[0],"wrong ether amount"); | |
require(nodes[msg.sender].level == 0, "already connected"); | |
address payable parent = findAvailableNode(_parent); | |
Node storage node = nodes[parent]; | |
if(node.descendant1 == address(0)){ | |
node.descendant1 = msg.sender; | |
} else if(node.descendant2 == address(0)) { | |
node.descendant2 = msg.sender; | |
} else if(node.descendant3 == address(0)) { | |
node.descendant3 = msg.sender; | |
} else revert("there are no empty descendant"); | |
// parent.transfer(1e18); | |
nodes[msg.sender] = Node(1, parent, address(0),address(0),address(0)); | |
emit Joined(msg.sender, parent); | |
} | |
function findAvailableNode(address payable _parent) public view returns (address payable){ | |
address payable[] memory queue = new address payable[](13); | |
uint current = 0; | |
uint last = 1; | |
if(nodes[_parent].level == 0) queue[0] = owner; | |
else queue[0] = _parent; | |
while(true){ | |
address payable currentAddress = queue[current++]; | |
Node memory currentNode = nodes[currentAddress]; | |
require(currentNode.level > 0, "tree crashed"); | |
if(currentNode.descendant1 == address(0)) return currentAddress; | |
if(currentNode.descendant2 == address(0)) return currentAddress; | |
if(currentNode.descendant3 == address(0)) return currentAddress; | |
if(queue.length - last < 3){ | |
address payable[] memory tmp = new address payable[](queue.length * 3 + 1); | |
for(uint i = current; i < last;i++) | |
tmp[i - current] = queue[i]; | |
queue = tmp; | |
last -=current; | |
current = 0; | |
} | |
queue[last++] = currentNode.descendant1; | |
queue[last++] = currentNode.descendant2; | |
queue[last++] = currentNode.descendant3; | |
} | |
} | |
function levelUp() payable public { | |
Node storage it = nodes[msg.sender]; | |
require(it.level > 0, "you are not in PonzyGame"); | |
require(prices[it.level] > 0, "last level"); | |
// require(msg.value == prices[it.level], "wrong ether amount"); | |
address payable parent = it.parent; | |
for(uint i = 0; i < it.level; i++) | |
parent = nodes[parent].parent; | |
while(nodes[parent].level < it.level + 1){ | |
emit SaleSkiped(parent, msg.sender); | |
parent = nodes[parent].parent; | |
} | |
// parent.transfer(prices[it.level]); | |
it.level++; | |
emit LevelUp(msg.sender,parent,it.level); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Nethereum.ABI.FunctionEncoding; | |
using Nethereum.ABI.FunctionEncoding.Attributes; | |
using Nethereum.Contracts; | |
using Nethereum.Hex.HexConvertors.Extensions; | |
using Nethereum.Web3; | |
using Nethereum.Web3.Accounts; | |
using System; | |
using System.Threading.Tasks; | |
namespace MyOnAsSalat | |
{ | |
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
// we're using the hosted nethereum test chain | |
var url = "http://testchain.nethereum.com:8545"; | |
// this is a pre funded test account we'll use to deploy the contract and become the owner | |
var privateKey = "0x7580e7fb49df1c861f0050fae31c2224c6aba908e116b8da44ee8cd927b990b0"; | |
var account = new Account(privateKey); | |
var web3 = new Web3(account, url); | |
// we need another account who can join the game | |
// purely for this example, we'll create a new Ethereum account | |
var ecKey = Nethereum.Signer.EthECKey.GenerateKey(); | |
var privateKey2 = ecKey.GetPrivateKeyAsBytes().ToHex(); | |
var account2 = new Account(privateKey2); | |
// transfer some eth to the new account, just enough to cover the gas | |
// this will allow it to make a transaction later | |
await web3.Eth.GetEtherTransferService() | |
.TransferEtherAndWaitForReceiptAsync(account2.Address, 0.1m); | |
// deploy an instance of the contract | |
// the owner will become the web3.Account.Address | |
var deploymentArgs = new PonzyGameModifiedDeployment | |
{ | |
Descendant1 = string.Empty, | |
Descendant2 = string.Empty, | |
Descendant3 = string.Empty | |
}; | |
var deploymentHandler = web3.Eth.GetContractDeploymentHandler<PonzyGameModifiedDeployment>(); | |
var deploymentReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentArgs); | |
// contract is now deployed | |
var contractAddress = deploymentReceipt.ContractAddress; | |
// who is the owner - according to the Solidity code, it should be the account that deployed the contract | |
var ownerHandler = web3.Eth.GetContractQueryHandler<OwnerFunction>(); | |
var owner = await ownerHandler.QueryAsync<string>(contractAddress); | |
Console.WriteLine($"owner: {owner}"); | |
// query the owner node | |
var nodesFunctionHandler = web3.Eth.GetContractQueryHandler<NodesFunction>(); | |
var nodesArg = new NodesFunction { ReturnValue1 = owner }; | |
var nodes = await nodesFunctionHandler.QueryDeserializingToObjectAsync<NodesOutputDTO>(nodesArg, contractAddress); | |
Console.WriteLine($"Parent: {nodes.Parent}"); | |
Console.WriteLine($"Level: {nodes.Level}"); | |
Console.WriteLine($"Descendant1: {nodes.Descendant1}"); | |
Console.WriteLine($"Descendant2: {nodes.Descendant2}"); | |
Console.WriteLine($"Descendant3: {nodes.Descendant3}"); | |
// query find available node | |
var findAvailableNodeArgs = new FindAvailableNodeFunction() { Parent = account.Address }; | |
var findAvailableNodeHandler = web3.Eth.GetContractQueryHandler<FindAvailableNodeFunction>(); | |
var availableNode = await findAvailableNodeHandler.QueryAsync<string>(contractAddress, findAvailableNodeArgs); | |
Console.WriteLine($"Available Node: {availableNode}"); | |
// the arguments we intend on sending to the joinTo function | |
// an amount of ether and the parent address | |
var joinToArgs = new JoinToFunction | |
{ | |
AmountToSend = 1, | |
Parent = account.Address | |
}; | |
// for joinTo the msg.sender can not be the owner | |
// the msg.sender is equal to the web3.Account.Address | |
// the code below demonstrates invoking the contract without a transaction so that we can receive the exception | |
// it runs the code on the Ethereum virtual machine | |
// if any revert exceptions are thrown they are caught in the catch block | |
try | |
{ | |
var joinToQueryHandler = web3.Eth.GetContractQueryHandler<JoinToFunction>(); | |
await joinToQueryHandler.QueryAsync<bool>(contractAddress, joinToArgs); | |
} | |
catch(SmartContractRevertException revertEx) | |
{ | |
Console.WriteLine("Expected Exception: already connected"); | |
Console.WriteLine($"Actual Exception: {revertEx.Message}"); | |
} | |
// recreate our web3 object using the other account | |
web3 = new Web3(account2, url); | |
// these parameters should be valid | |
// we're trying to join as a different user | |
// but still specifying the owner as the parent | |
joinToArgs = new JoinToFunction | |
{ | |
AmountToSend = 1, | |
Parent = account.Address | |
}; | |
bool valid = true; | |
// try a query to catch any revert errors before trying to raise a transaction | |
// we are expecting this to work and NOT throw an exception | |
try | |
{ | |
var joinToQueryHandler = web3.Eth.GetContractQueryHandler<JoinToFunction>(); | |
await joinToQueryHandler.QueryAsync<bool>(contractAddress, joinToArgs); | |
} | |
catch (SmartContractRevertException revertEx) | |
{ | |
valid = false; | |
Console.WriteLine(revertEx.Message); | |
} | |
if (!valid) return; | |
// the query worked so we should be ok | |
// execute the transaction | |
var joinToFunctionHandler = web3.Eth.GetContractTransactionHandler<JoinToFunction>(); | |
var joinToReceipt = await joinToFunctionHandler.SendRequestAndWaitForReceiptAsync(contractAddress, joinToArgs); | |
Console.WriteLine($"Tx Succeeded - Hash: {joinToReceipt.TransactionHash}"); | |
// write out the events | |
foreach(var joinToEvent in joinToReceipt.Logs.DecodeAllEvents<JoinedEventDTO>()) | |
{ | |
Console.WriteLine($"Event: {joinToEvent.Event.Parent}, {joinToEvent.Event.User}"); | |
} | |
} | |
} | |
public partial class PonzyGameModifiedDeployment : PonzyGameModifiedDeploymentBase | |
{ | |
public PonzyGameModifiedDeployment() : base(BYTECODE) { } | |
public PonzyGameModifiedDeployment(string byteCode) : base(byteCode) { } | |
} | |
public class PonzyGameModifiedDeploymentBase : ContractDeploymentMessage | |
{ | |
public static string BYTECODE = "610100604052670de0b6b3a76400006080908152671bc16d674ec8000060a052676124fee993bc000060c05268019274b259f654000060e052610046906001906004610668565b5034801561005357600080fd5b5060405161102c38038061102c8339818101604052606081101561007657600080fd5b8101908080519060200190929190805190602001909291908051906020019092919050505033600260006101000a8154816001600160a01b0302191690836001600160a01b031602179055506040518060a00160405280600460ff168152602001600260009054906101000a90046001600160a01b03166001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001826001600160a01b0316815250600080600260009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050506040518060a00160405280600460ff168152602001600260009054906101000a90046001600160a01b03166001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815250600080856001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050506040518060a00160405280600460ff168152602001600260009054906101000a90046001600160a01b03166001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815250600080846001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050506040518060a00160405280600460ff168152602001600260009054906101000a90046001600160a01b03166001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815250600080836001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055509050505050506106db565b8280548282559060005260206000209081019282156106ae579160200282015b828111156106ae57825182906001600160481b0316905591602001919060010190610688565b506106ba9291506106be565b5090565b6106d891905b808211156106ba57600081556001016106c4565b90565b610942806106ea6000396000f3fe60806040526004361061004a5760003560e01c806301219c741461004f578063189a5a17146100775780634ea1ecf9146100e75780638da5cb5b146100ef578063c79772ef14610120575b600080fd5b6100756004803603602081101561006557600080fd5b50356001600160a01b0316610153565b005b34801561008357600080fd5b506100aa6004803603602081101561009a57600080fd5b50356001600160a01b0316610379565b6040805160ff90961686526001600160a01b0394851660208701529284168584015290831660608501529091166080830152519081900360a00190f35b6100756103bb565b3480156100fb57600080fd5b506101046105b9565b604080516001600160a01b039092168252519081900360200190f35b34801561012c57600080fd5b506101046004803603602081101561014357600080fd5b50356001600160a01b03166105c8565b3360009081526020819052604090205460ff16156101ac576040805162461bcd60e51b8152602060048201526011602482015270185b1c9958591e4818dbdb9b9958dd1959607a1b604482015290519081900360640190fd5b60006101b7826105c8565b6001600160a01b038082166000908152602081905260409020600181015492935091166101f7576001810180546001600160a01b0319163317905561029a565b60028101546001600160a01b0316610222576002810180546001600160a01b0319163317905561029a565b60038101546001600160a01b031661024d576003810180546001600160a01b0319163317905561029a565b6040805162461bcd60e51b815260206004820152601d60248201527f746865726520617265206e6f20656d7074792064657363656e64616e74000000604482015290519081900360640190fd5b6040805160a08101825260018082526001600160a01b0380861660208085018281526000868801818152606088018281526080890183815233808552958490528a842099518a549551891661010002610100600160a81b031960ff9290921660ff199097169690961716949094178955905196880180549787166001600160a01b03199889161790555160028801805491871691881691909117905590516003909601805496909416959094169490941790915592517f7702dccda75540ad1dca8d5276c048f4a5c0e4203f6da4be214bfb1901b203ea9190a3505050565b600060208190529081526040902080546001820154600283015460039093015460ff8316936001600160a01b0361010090940484169392831692908116911685565b336000908152602081905260409020805460ff16610420576040805162461bcd60e51b815260206004820152601860248201527f796f7520617265206e6f7420696e20506f6e7a7947616d650000000000000000604482015290519081900360640190fd5b80546001805460009260ff1690811061043557fe5b90600052602060002001541161047f576040805162461bcd60e51b815260206004820152600a6024820152691b185cdd081b195d995b60b21b604482015290519081900360640190fd5b805461010090046001600160a01b031660005b825460ff168110156104c9576001600160a01b03918216600090815260208190526040902054610100900490911690600101610492565b505b81546001600160a01b03821660009081526020819052604090205460ff91821660010182169116101561055c576040805133815290516001600160a01b038316917f27dd2b446e574e858c61cf3431c74990e293fca9727d172c88d18ffb293fc51b919081900360200190a26001600160a01b039081166000908152602081905260409020546101009004166104cb565b815460ff198116600160ff928316018216178084556040805191909216815290516001600160a01b0383169133917fd3025c5a7ee366197baa9cb6bf9971a524392f6acfc0075f262f58006607409f916020908290030190a35050565b6002546001600160a01b031681565b60408051600d8082526101c0820190925260009160609190602082016101a0803883395050506001600160a01b0384166000908152602081905260408120549192509060019060ff166106565760025483516001600160a01b0390911690849060009061063157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050610685565b848360008151811061066457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b600083838060010194508151811061069957fe5b602002602001015190506106ab6108df565b506001600160a01b0380821660009081526020818152604091829020825160a081018452815460ff811680835261010090910486169382019390935260018201548516938101939093526002810154841660608401526003015490921660808201529061074e576040805162461bcd60e51b815260206004820152600c60248201526b1d1c99594818dc985cda195960a21b604482015290519081900360640190fd5b60408101516001600160a01b031661076c575093506108da92505050565b60608101516001600160a01b031661078a575093506108da92505050565b60808101516001600160a01b03166107a8575093506108da92505050565b600383865103101561084157606085516003026001016040519080825280602002602001820160405280156107e7578160200160208202803883390190505b509050845b848110156108365786818151811061080057fe5b6020026020010151828783038151811061081657fe5b6001600160a01b03909216602092830291909101909101526001016107ec565b509450600093909203915b6040810151855160018501948791811061085757fe5b6001600160a01b03909216602092830291909101909101526060810151855160018501948791811061088557fe5b6001600160a01b0390921660209283029190910190910152608081015185516001850194879181106108b357fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505050610685565b919050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091529056fea265627a7a72315820f420e423499774b39d46534ec484f49c475bc824c2f7dbe6cf56c024008d5a7f64736f6c634300050b0032"; | |
public PonzyGameModifiedDeploymentBase() : base(BYTECODE) { } | |
public PonzyGameModifiedDeploymentBase(string byteCode) : base(byteCode) { } | |
[Parameter("address", "descendant1", 1)] | |
public virtual string Descendant1 { get; set; } | |
[Parameter("address", "descendant2", 2)] | |
public virtual string Descendant2 { get; set; } | |
[Parameter("address", "descendant3", 3)] | |
public virtual string Descendant3 { get; set; } | |
} | |
public partial class JoinToFunction : JoinToFunctionBase { } | |
[Function("joinTo")] | |
public class JoinToFunctionBase : FunctionMessage | |
{ | |
[Parameter("address", "_parent", 1)] | |
public virtual string Parent { get; set; } | |
} | |
public partial class NodesFunction : NodesFunctionBase { } | |
[Function("nodes", typeof(NodesOutputDTO))] | |
public class NodesFunctionBase : FunctionMessage | |
{ | |
[Parameter("address", "", 1)] | |
public virtual string ReturnValue1 { get; set; } | |
} | |
public partial class LevelUpFunction : LevelUpFunctionBase { } | |
[Function("levelUp")] | |
public class LevelUpFunctionBase : FunctionMessage | |
{ | |
} | |
public partial class OwnerFunction : OwnerFunctionBase { } | |
[Function("owner", "address")] | |
public class OwnerFunctionBase : FunctionMessage | |
{ | |
} | |
public partial class FindAvailableNodeFunction : FindAvailableNodeFunctionBase { } | |
[Function("findAvailableNode", "address")] | |
public class FindAvailableNodeFunctionBase : FunctionMessage | |
{ | |
[Parameter("address", "_parent", 1)] | |
public virtual string Parent { get; set; } | |
} | |
public partial class LevelUpEventDTO : LevelUpEventDTOBase { } | |
[Event("LevelUp")] | |
public class LevelUpEventDTOBase : IEventDTO | |
{ | |
[Parameter("address", "user", 1, true)] | |
public virtual string User { get; set; } | |
[Parameter("address", "seller", 2, true)] | |
public virtual string Seller { get; set; } | |
[Parameter("uint8", "level", 3, false)] | |
public virtual byte Level { get; set; } | |
} | |
public partial class JoinedEventDTO : JoinedEventDTOBase { } | |
[Event("Joined")] | |
public class JoinedEventDTOBase : IEventDTO | |
{ | |
[Parameter("address", "user", 1, true)] | |
public virtual string User { get; set; } | |
[Parameter("address", "parent", 2, true)] | |
public virtual string Parent { get; set; } | |
} | |
public partial class SaleSkipedEventDTO : SaleSkipedEventDTOBase { } | |
[Event("SaleSkiped")] | |
public class SaleSkipedEventDTOBase : IEventDTO | |
{ | |
[Parameter("address", "seller", 1, true)] | |
public virtual string Seller { get; set; } | |
[Parameter("address", "user", 2, false)] | |
public virtual string User { get; set; } | |
} | |
public partial class NodesOutputDTO : NodesOutputDTOBase { } | |
[FunctionOutput] | |
public class NodesOutputDTOBase : IFunctionOutputDTO | |
{ | |
[Parameter("uint8", "level", 1)] | |
public virtual byte Level { get; set; } | |
[Parameter("address", "parent", 2)] | |
public virtual string Parent { get; set; } | |
[Parameter("address", "descendant1", 3)] | |
public virtual string Descendant1 { get; set; } | |
[Parameter("address", "descendant2", 4)] | |
public virtual string Descendant2 { get; set; } | |
[Parameter("address", "descendant3", 5)] | |
public virtual string Descendant3 { get; set; } | |
} | |
public partial class OwnerOutputDTO : OwnerOutputDTOBase { } | |
[FunctionOutput] | |
public class OwnerOutputDTOBase : IFunctionOutputDTO | |
{ | |
[Parameter("address", "", 1)] | |
public virtual string ReturnValue1 { get; set; } | |
} | |
public partial class FindAvailableNodeOutputDTO : FindAvailableNodeOutputDTOBase { } | |
[FunctionOutput] | |
public class FindAvailableNodeOutputDTOBase : IFunctionOutputDTO | |
{ | |
[Parameter("address", "", 1)] | |
public virtual string ReturnValue1 { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment