Skip to content

Instantly share code, notes, and snippets.

View angrymouse's full-sized avatar
🐭
I'm mouse

Mykyta Rykov angrymouse

🐭
I'm mouse
View GitHub Profile
@angrymouse
angrymouse / BATCHED_CALLS.MD
Last active March 21, 2022 00:59
SmartWeave Batched Calls Specification

Batched contract calls specification

Why

Batched Contract Calls (BCC) allows smartweave users to interact with many contracts using one transaction. It opens possibilities for one-time FCP (Foreign Call Protocol) execution, significantly increases time of calling contracts that require consistent execution, allows to do transfer of PST (Profit Sharing Tokens) to buch of addresses at once.

Suggested implementation

To call contract, program digs all transactions with tag "Contract" that equals to contract initial state transaction id.

Transaction can have many "Contract" tags, each "Contract" tag has own index.

/**
Simple(ish) example of discord gateway
This code will get to ready, and then remain connected with heartbeats
see https://discordapi.com/topics/gateway for more info
zlib compression is implemented as it will be required in gateway v7 (so get used to it now)
*/
const WebSocket = require('ws'); // npmjs.org/ws
const zlib = require('zlib-sync'); // npmjs.org/zlib-sync
const erlpack = require('erlpack'); // github.com/discordapp/erlpack
@agustinhaller
agustinhaller / makeId.js
Created August 8, 2013 03:06
makeId function
function makeid(length)
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for(var i=0; i < length; i++)
{
text += possible.charAt(Math.floor(Math.random() * possible.length));
}