$f = ($x) => {
$a = var['a'];
$x * $a
};
// one-line syntax for functions that have only one expression
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
const path = require('path') | |
// eslint-disable-next-line no-unused-vars | |
const { Testkit, Utils } = require('aa-testkit') | |
const { Network } = Testkit({ | |
TESTDATA_DIR: path.join(__dirname, '../testdata'), | |
}) | |
describe('Check 2 wallets', function () { | |
this.timeout(120 * 1000) |
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
{ | |
init: `{ | |
$asset = 'n9y3VomFeWFeZZ2PcSEcmyBb/bI7kzZduBJigNetnkY='; | |
$mm_asset = var['mm_asset']; | |
}`, | |
messages: { | |
cases: [ | |
{ // define share asset | |
if: `{ trigger.data.define AND !$mm_asset }`, | |
messages: [ |
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
// bitcoin_hash is the hash (in hex) of the latest Bitcoin block | |
// arrPoints is array of points of all addresses ordered by address [{address: "...", points: 1234}, ...] | |
// rows1 is array of balances of all addresses ordered by address [{address: "...", balance: 1234}, ...] | |
// sum is the sum of all points | |
// 1. winner by points | |
let hash = crypto.createHash('sha256').update(bitcoin_hash).digest('hex'); | |
let number = new BigNumber(hash, 16); | |
let random = (number.div(new BigNumber(2).pow(256))).times(sum); |