Skip to content

Instantly share code, notes, and snippets.

View szerintedmi's full-sized avatar

Peter Petrovics szerintedmi

  • Equal Experts
  • London, UK
View GitHub Profile
@szerintedmi
szerintedmi / MonetarySupervisor_DEPLOYS.json
Last active April 24, 2018 15:41
resource format deployments/<networkid>/
{
"contractName": "MonetarySupervisor",
"latestAbiHash": "7fde219f…",
"7fde219f…": {
"latestDeployedAddress": "7fde219f…",
"deployments": {
"7fde219f…": {
"generatedAt": "<ISO86901 timestamp>",
"truffleContractFileUpdatedAt": "<ISO86901 timestamp when source truffle contracts json was generated>",
"deployTransactionHash": "0x12…",
@szerintedmi
szerintedmi / StabilityBoardScripts.sol
Last active May 24, 2018 20:46
Stability board scripts first pass
contract StabiltyBoard {
address[] allSigners // all signers, even disabled ones
mapping(address => bool) isSigner;
struct Approvals {
bool approved; // do we want to calculate quorum at the time time of approve call
// or each time when isApprove called? if latter then no need for this bool
uint signCount;
mapping(address => bool) signedBy;
address[] signers; // do we need revoke?
@szerintedmi
szerintedmi / StabiltyBoard.sol
Last active May 24, 2018 21:29
StabiltyBoard delegateCall scripts
contract StabiltyBoard {
address[] allSigners // all signers, even disabled ones
mapping(address => bool) isSigner;
enum ScriptState { New, Approved, Done , Failed }
struct Script {
ScriptState state; // do we want to calculate quorum at the time time of approve or execute call ?
uint signCount;
mapping(address => bool) signedBy;
@szerintedmi
szerintedmi / Rink0004_migrate_MSv0_5_0.sol
Created June 10, 2018 13:42
Rink0004_migrate_MSv0_5_0
/* script to switch over to latest MonetarySupervisor and Rates contracts
must be executed via StabilityBoardProxy
NB: additional updates of old contracts are not part of this contract but executed from deployer account because old contracts
*/
pragma solidity 0.4.24;
import "../../generic/MultiSig.sol";
import "../../TokenAEur.sol";
import "../../MonetarySupervisor.sol";
@szerintedmi
szerintedmi / 23_executeRink0004_and_revokeOldPermissions.js
Created June 10, 2018 13:45
23_executeRink0004_and_revokeOldPermissions.js
/******************************************************************************
* Execute Rink0004_migrate_MSv0_5_0.sol (already signed by stability board)
* and switch to new MS and rates contracts and revoke permissions from old contracts
* NB:
* - switch contracts can executed from deployer account for now because old contracts didn't have multiSig.
* In future these must be set via StabilityBoardProxy, ie. be part of the migrate script
******************************************************************************/
const Migrations = artifacts.require("./Migrations.sol");
const Rink0004_migrate_MSv0_5_0 = artifacts.require("./Rink0004_migrate_MSv0_5_0.sol");
const StabilityBoardProxy = artifacts.require("./StabilityBoardProxy.sol");
@szerintedmi
szerintedmi / Main0006_initNewLocker.sol
Created July 5, 2018 15:39
Main0006_initNewLocker
/* grant permissions & add lock products to new locker contract
It sets up the products with different interest rates than in old locker and
introduces two new lock products: 90 days and 180 days term
NB: once UI is switched over to new locker, products in old locker
should be disabled to prevent ppl keep using locker directly
*/
pragma solidity 0.4.24;
import "../../generic/MultiSig.sol";
/* set defaulting fee from 5% to 10% */
pragma solidity 0.4.24;
import "../../LoanManager.sol";
contract Rink0010_changeDefaultingFee {
address constant stabilityBoardProxyAddress = 0x44022C28766652EC5901790E53CEd7A79a19c10A;
@szerintedmi
szerintedmi / Rink0011_adjustInterest.sol
Created September 7, 2018 10:51
Rink0011_adjustInterest
/* adjust lock & loan interest rates, increase allowedLtdDifferenceAmount */
pragma solidity 0.4.24;
import "../../LoanManager.sol";
import "../../Locker.sol";
import "../../MonetarySupervisor.sol";
contract Rink0011_adjustInterest {
@szerintedmi
szerintedmi / sendTx.js
Last active May 3, 2019 14:05
barebone demonstration of web3 tx not resolving issue
const Web3 = require("web3");
const OPTIONS = {
defaultBlock: "latest",
transactionConfirmationBlocks: 1,
transactionBlockTimeout: 5
};
const web3 = new Web3(
new Web3.providers.WebsocketProvider("ws://localhost:8545"),
@szerintedmi
szerintedmi / deployContract.js
Last active April 5, 2019 16:18
barebone script to deploy a solidity contract
const Web3 = require("web3");
const web3 = new Web3(
Web3.providers.WebsocketProvider("ws://localhost:8545"),
null,
{
defaultBlock: "latest",
defaultGas: 5000000,
defaultGasPrice: 1,
transactionBlockTimeout: 50,