Skip to content

Instantly share code, notes, and snippets.

View mazaletskiy's full-sized avatar

Alexander Mazaletskiy mazaletskiy

View GitHub Profile
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import "../../contracts/mocks/ERC20PodsMock.sol";
import "../../contracts/mocks/Mock.sol";
pragma solidity ^0.4.15;
contract StringsAndBytes {
/* --- public variables for storing tests results */
string public lastTestStringResult; //
bytes32 public lastTestBytes32Result; //
bytes public lastTestBytesResult; // bytes: dynamically-sized byte array
bool public lastTestBoolResult; //

Keybase proof

I hereby claim:

  • I am alexandermazaletskiy on github.
  • I am hashpunk (https://keybase.io/hashpunk) on keybase.
  • I have a public key ASAy_HorRfRUmJ6xHVpDW2vKvYHLEwlbqcUXQyLziING2wo

To claim this, I am signing this object:

@mazaletskiy
mazaletskiy / gh-pages-deploy.md
Created February 28, 2019 15:08 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@mazaletskiy
mazaletskiy / gist:7d5b643ace9a3209617e378a98c1b6fb
Last active January 7, 2019 12:04
Описание смарт-контракт
ERC-20 контракт
Доступные функции
1. Установление блокировки Lock. Позволяет включить или выключить функции минтинга (mint) и сжигания токенов (burn) (контракт AkropolisToken, Lockable)
2. Установление контракта на паузу Pause. В этом случае на паузу ставятся все переводы, tranfer, transferFrom, Approve (контракт AkropolisToken, Pausable)
3. Установить whitelist (добавление и удаление) адресов с которых можно производить tranfer, tranferFrom (контракт whitelist)
4. Для адреса whitelist ограничение на количество токенов, которые он может переводить (контракт Whitelist)
5. Контракт является Upgrable и использует TokenProxy.
6. Содержит также функции которые позволяют увеличить количество токенов, разрешенных от имени другого лица (increaseApproval) на значение value, так и уменьшить decreaseApproval.
@mazaletskiy
mazaletskiy / MTT2.sol
Created June 19, 2018 09:40
MTT2.sol
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
@mazaletskiy
mazaletskiy / MTT1.sol
Last active June 19, 2018 09:39
MTT1.sol
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev safe arithmetic functions
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
@mazaletskiy
mazaletskiy / OB-Ricardian-Contracts.md
Created September 16, 2017 11:44 — forked from drwasho/OB-Ricardian-Contracts.md
Proposal for Ricardian Contracts in Open Bazaar

0

Ricardian Contracts in OpenBazaar

What is a Ricardian Contract

A Ricardian Contract can be defined as a single document that is a) a contract offered by an issuer to holders, b) for a valuable right held by holders, and managed by the issuer, c) easily readable by people (like a contract on paper), d) readable by programs (parsable like a database), e) digitally signed, f) carries the keys and server information, and g) allied with a unique and secure identifier.
- Ian Grigg

The Ricardian contract is a means of tracking the liability of one party to another when selling goods to each other in OpenBazaar. Fundamentally, a contract represents a single unit of a good or service. Ricardian contracts should be used in OpenBazaar as they are means of effectively tracking legitimately signed agreements between two parties, which cannot be forged afte

@mazaletskiy
mazaletskiy / tasks.json
Created August 12, 2017 16:26 — forked from tomconte/tasks.json
Truffle tasks for Visual Studio Code. You can then use them to interact with Truffle, e.g. CTRL-P then "task migrate".
{
// Truffle tasks for Visual Studio Code
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "truffle",
"isShellCommand": true,
"args": [],
"showOutput": "always",
"echoCommand": true,
@mazaletskiy
mazaletskiy / 0 README.md
Created July 29, 2017 17:24 — forked from chriseth/0 README.md
Formal verification for re-entrant Solidity contracts

This gist shows how formal conditions of Solidity smart contracts can be automatically verified even in the presence of potential re-entrant calls from other contracts.

Solidity already supports formal verification of some contracts that do not make calls to other contracts. This of course excludes any contract that transfers Ether or tokens.

The Solidity contract below models a crude crowdfunding contract that can hold Ether and some person can withdraw Ether according to their shares. It is missing the actual access control, but the point that wants to be made