This file contains hidden or 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
contract MapTest = | |
record state = { my_map: map(string, string) | |
, owner : address} | |
public function init() : state = { my_map = {}, owner = Call.caller } | |
public function set_map(new_map : map(string, string)) : bool = | |
only_owner() | |
filter_put(set_map_at_index, Map.to_list(new_map), []) |
This file contains hidden or 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
contract Vote = | |
type candidate = address | |
type votes = list(address) | |
record state = | |
{ vote : map(candidate, votes) } | |
public function init() : state = | |
{ vote = { } } |
This file contains hidden or 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
/* | |
* ISC License (ISC) | |
* Copyright (c) 2018 aeternity developers | |
* | |
* Permission to use, copy, modify, and/or distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
This file contains hidden or 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
/* | |
* ISC License (ISC) | |
* Copyright (c) 2018 aeternity developers | |
* | |
* Permission to use, copy, modify, and/or distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
This file contains hidden or 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
@compiler >= 4 | |
contract AddressBook = | |
record state = | |
{ people : map(address, person) } | |
record person = | |
{ first_name : string | |
, last_name : string | |
, age : int } |
This file contains hidden or 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
const DDNSService = artifacts.require('../contracts/DDNSService.sol') | |
const assertRevert = require('./utils/assertRevert'); | |
const watchEvent = require('./utils/watchEvent'); | |
const constants = require('./utils/constants'); | |
const increaseTime = require('./utils/increaseTime'); | |
contract('DDNSService', ([owner, wallet, anotherAccount]) => { | |
let contractInstance; | |
let events = []; |
This file contains hidden or 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.4.22 <0.6.0; | |
import "./common/Ownable.sol"; | |
import "./common/Destructible.sol"; | |
import "./libs/SafeMath.sol"; | |
contract DDNSService is Destructible { | |
/** USINGS */ |
This file contains hidden or 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
/* | |
* @dev - Get ip of domain | |
* @param domain | |
* @param topLevel | |
*/ | |
function getIP( | |
bytes memory domain, | |
bytes12 topLevel | |
) | |
public |
This file contains hidden or 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
/** | |
* @dev - Get receipt list for the msg.sender | |
*/ | |
function getReceiptList() public view returns (bytes32[] memory) { | |
return paymentReceipts[msg.sender]; | |
} |
This file contains hidden or 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
/* | |
* @dev - Get single receipt | |
* @param receiptKey | |
*/ | |
function getReceipt(bytes32 receiptKey) public view returns (uint, uint, uint) { | |
return (receiptDetails[receiptKey].amountPaidWei, | |
receiptDetails[receiptKey].timestamp, | |
receiptDetails[receiptKey].expires); | |
} |