diff --git a/abis/SkaleAllocator.json b/abis/SkaleAllocator.json new file mode 100644 index 0000000..6115cd1 --- /dev/null +++ b/abis/SkaleAllocator.json @@ -0,0 +1,1279 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "PlanCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VESTING_MANAGER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vestingCliff", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalVestingDuration", + "type": "uint256" + }, + { + "internalType": "enum Allocator.TimeUnit", + "name": "vestingIntervalTimeUnit", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "vestingInterval", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "canDelegate", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isTerminatable", + "type": "bool" + } + ], + "name": "addPlan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "wallet", + "type": "address" + } + ], + "name": "calculateVestedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "vestedAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "internalType": "uint256", + "name": "planId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startMonth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fullAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lockupAmount", + "type": "uint256" + } + ], + "name": "connectBeneficiaryToPlan", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "contractManager", + "outputs": [ + { + "internalType": "contract IContractManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "getBeneficiaryPlanParams", + "outputs": [ + { + "components": [ + { + "internalType": "enum Allocator.BeneficiaryStatus", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "planId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "startMonth", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "fullAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountAfterLockup", + "type": "uint256" + } + ], + "internalType": "struct Allocator.Beneficiary", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "getEscrowAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "getFinishVestingTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "getFullAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "getLockupPeriodEndTimestamp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "planId", + "type": "uint256" + } + ], + "name": "getPlan", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "totalVestingDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "vestingCliff", + "type": "uint256" + }, + { + "internalType": "enum Allocator.TimeUnit", + "name": "vestingIntervalTimeUnit", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "vestingInterval", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isDelegationAllowed", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isTerminatable", + "type": "bool" + } + ], + "internalType": "struct Allocator.Plan", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "getStartMonth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "getTimeOfNextVest", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "getVestingCliffInMonth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractManagerAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "isBeneficiaryRegistered", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "isDelegationAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "isVestingActive", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "startVesting", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "stopVesting", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "operatorData", + "type": "bytes" + } + ], + "name": "tokensReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "escrow_address": "0x7eC20A5cA88F07faa4790e0E6e22b3006216A978", + "escrow_abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "cancelPendingDelegation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vestedAmount", + "type": "uint256" + } + ], + "name": "cancelVesting", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "contractManager", + "outputs": [ + { + "internalType": "contract IContractManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegationPeriod", + "type": "uint256" + }, + { + "internalType": "string", + "name": "info", + "type": "string" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractManagerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractManagerAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "requestUndelegation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "retrieve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "retrieveAfterTermination", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "operatorData", + "type": "bytes" + } + ], + "name": "tokensReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "tokensToSend", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "withdrawBounty", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "proxy_admin_address": "0x82E6C51b1d996b55E948d3757452aD80F2C56EA3", + "proxy_factory_address": "0x2921BDfa68567230c28a16aAD480Bff56d388EeC", + "contract_manager_abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "contractsName", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "contractsAddress", + "type": "address" + } + ], + "name": "ContractUpgraded", + "type": "event", + "signature": "0x2b51ff7c4cc8e6fe1c72e9d9685b7d2a88a5d82ad3a644afbdceb0272c89c1c3" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event", + "signature": "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "contracts", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true, + "signature": "0xec56a373" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true, + "signature": "0x8da5cb5b" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + "signature": "0x715018a6" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + "signature": "0xf2fde38b" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + "signature": "0x8129fc1c" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "contractsName", + "type": "string" + }, + { + "internalType": "address", + "name": "newContractsAddress", + "type": "address" + } + ], + "name": "setContractsAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function", + "signature": "0xdd9e2940" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "getContract", + "outputs": [ + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function", + "constant": true, + "signature": "0x35817773" + } + ] \ No newline at end of file diff --git a/abis/SkaleDelegationController.json b/abis/SkaleDelegationController.json new file mode 100644 index 0000000..fcd7612 --- /dev/null +++ b/abis/SkaleDelegationController.json @@ -0,0 +1,858 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "DelegationAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "DelegationProposed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "DelegationRequestCanceledByUser", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "UndelegationRequested", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractManager", + "outputs": [ + { + "internalType": "contract ContractManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "delegations", + "outputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegationPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "created", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "started", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "finished", + "type": "uint256" + }, + { + "internalType": "string", + "name": "info", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "delegationsByHolder", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "delegationsByValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getAndUpdateDelegatedToValidatorNow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "getAndUpdateDelegatedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "month", + "type": "uint256" + } + ], + "name": "getAndUpdateEffectiveDelegatedByHolderToValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "effectiveDelegated", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegationPeriod", + "type": "uint256" + }, + { + "internalType": "string", + "name": "info", + "type": "string" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "wallet", + "type": "address" + } + ], + "name": "getAndUpdateLockedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "wallet", + "type": "address" + } + ], + "name": "getAndUpdateForbiddenForDelegationAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "cancelPendingDelegation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "acceptPendingDelegation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "requestUndelegation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "confiscate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "month", + "type": "uint256" + } + ], + "name": "getAndUpdateEffectiveDelegatedToValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getAndUpdateDelegatedByHolderToValidatorNow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "getDelegation", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegationPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "created", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "started", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "finished", + "type": "uint256" + }, + { + "internalType": "string", + "name": "info", + "type": "string" + } + ], + "internalType": "struct DelegationController.Delegation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getFirstDelegationMonth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getDelegationsByValidatorLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "getDelegationsByHolderLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractsAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "month", + "type": "uint256" + } + ], + "name": "getAndUpdateDelegatedToValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "internalType": "uint256", + "name": "limit", + "type": "uint256" + } + ], + "name": "processSlashes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "processAllSlashes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "getState", + "outputs": [ + { + "internalType": "enum DelegationController.State", + "name": "state", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "getLockedInPendingDelegations", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "hasUnprocessedSlashes", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ] \ No newline at end of file diff --git a/abis/SkaleDistributor.json b/abis/SkaleDistributor.json new file mode 100644 index 0000000..f7dfb58 --- /dev/null +++ b/abis/SkaleDistributor.json @@ -0,0 +1,470 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "BountyWasPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawBounty", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawFee", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractManager", + "outputs": [ + { + "internalType": "contract ContractManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getAndUpdateEarnedBountyAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endMonth", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "withdrawBounty", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "withdrawFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "tokensReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getEarnedFeeAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endMonth", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractsAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "wallet", + "type": "address" + }, + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getAndUpdateEarnedBountyAmountOf", + "outputs": [ + { + "internalType": "uint256", + "name": "earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endMonth", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getEarnedFeeAmountOf", + "outputs": [ + { + "internalType": "uint256", + "name": "earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endMonth", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] \ No newline at end of file diff --git a/abis/SkaleEscrow.json b/abis/SkaleEscrow.json new file mode 100644 index 0000000..936fc73 --- /dev/null +++ b/abis/SkaleEscrow.json @@ -0,0 +1,430 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractManager", + "outputs": [ + { + "internalType": "contract IContractManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractManagerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "beneficiary", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractManagerAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "operatorData", + "type": "bytes" + } + ], + "name": "tokensReceived", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "tokensToSend", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "retrieve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "retrieveAfterTermination", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "delegationPeriod", + "type": "uint256" + }, + { + "internalType": "string", + "name": "info", + "type": "string" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "requestUndelegation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "delegationId", + "type": "uint256" + } + ], + "name": "cancelPendingDelegation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + } + ], + "name": "withdrawBounty", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "vestedAmount", + "type": "uint256" + } + ], + "name": "cancelVesting", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] \ No newline at end of file diff --git a/abis/SkaleTokenState.json b/abis/SkaleTokenState.json new file mode 100644 index 0000000..eb62cd3 --- /dev/null +++ b/abis/SkaleTokenState.json @@ -0,0 +1,321 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "locker", + "type": "string" + } + ], + "name": "LockerWasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "locker", + "type": "string" + } + ], + "name": "LockerWasRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractManager", + "outputs": [ + { + "internalType": "contract ContractManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "getAndUpdateLockedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "getAndUpdateForbiddenForDelegationAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "locker", + "type": "string" + } + ], + "name": "removeLocker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractManagerAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "locker", + "type": "string" + } + ], + "name": "addLocker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] \ No newline at end of file diff --git a/abis/SkaleValidatorService.json b/abis/SkaleValidatorService.json new file mode 100644 index 0000000..3aef90d --- /dev/null +++ b/abis/SkaleValidatorService.json @@ -0,0 +1,903 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "NodeAddressWasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "NodeAddressWasRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAddress", + "type": "address" + } + ], + "name": "ValidatorAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "ValidatorRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "ValidatorWasDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "ValidatorWasEnabled", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractManager", + "outputs": [ + { + "internalType": "contract ContractManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numberOfValidators", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "trustedValidatorsList", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "useWhitelist", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "validators", + "outputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "validatorAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "requestedAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "uint256", + "name": "feeRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "registrationTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDelegationAmount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "acceptNewRequests", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "uint256", + "name": "feeRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDelegationAmount", + "type": "uint256" + } + ], + "name": "registerValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "enableValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "disableValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newValidatorAddress", + "type": "address" + } + ], + "name": "requestForNewAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "confirmNewAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "sig", + "type": "bytes" + } + ], + "name": "linkNodeAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "unlinkNodeAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "minimumDelegationAmount", + "type": "uint256" + } + ], + "name": "setValidatorMDA", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setValidatorName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "newDescription", + "type": "string" + } + ], + "name": "setValidatorDescription", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "startAcceptingNewRequests", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stopAcceptingNewRequests", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getAndUpdateBondAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getMyNodesAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTrustedValidators", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "checkMinimumDelegation", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "checkValidatorAddressToId", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "getValidatorIdByNodeAddress", + "outputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "isAuthorizedValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "contractManagerAddress", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getNodeAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "validatorExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorAddress", + "type": "address" + } + ], + "name": "validatorAddressExists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorAddress", + "type": "address" + } + ], + "name": "checkIfValidatorAddressExists", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "getValidator", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "address", + "name": "validatorAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "requestedAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "description", + "type": "string" + }, + { + "internalType": "uint256", + "name": "feeRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "registrationTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumDelegationAmount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "acceptNewRequests", + "type": "bool" + } + ], + "internalType": "struct ValidatorService.Validator", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorAddress", + "type": "address" + } + ], + "name": "getValidatorId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorId", + "type": "uint256" + } + ], + "name": "isAcceptingNewRequests", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ] \ No newline at end of file diff --git a/examples/SKALE/bountiesEarned.ts b/examples/SKALE/bountiesEarned.ts new file mode 100644 index 0000000..20a2ec5 --- /dev/null +++ b/examples/SKALE/bountiesEarned.ts @@ -0,0 +1,33 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0x2a42Ccca55FdE8a9CA2D7f3C66fcddE99B4baB90'; + const Distributor = new Contract('SkaleDistributor').address(proxyAddress); + + //parameter needed for checking the earned bounties + const idOfValidator = "validator id"; + + /** + * Retrieve the amount of earned bounties for the provided by token holder (delgator). + * This will return the bounties earned since the last withdraw for a specific delegation to a validator. + * This needs to be called for each validator that a token holder (delegator) is delegating to. + */ + let { data, amount, address } = Distributor.methods().getAndUpdateEarnedBountyAmount.call({ + validatorId: idOfValidator + }); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/cancelPendingDelegation.ts b/examples/SKALE/cancelPendingDelegation.ts new file mode 100644 index 0000000..8528264 --- /dev/null +++ b/examples/SKALE/cancelPendingDelegation.ts @@ -0,0 +1,33 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + //parameter needed for cancel delegation request + const idOfDelegation = 'ID of delegation to cancel'; + + const proxyAddress = '0x06dD71dAb27C1A3e0B172d53735f00Bf1a66Eb79'; + const DelegationController = new Contract('SkaleDelegationController').address(proxyAddress); + + /** + * This allows the delegator to cancel the PENDING delegation before the validator approves + * or before the start of the next Epoch. + * If a delegation is already in the DELEGATED or COMPLETED state, this method can not be called. + */ + let { data, amount, address } = DelegationController.methods().cancelPendingDelegation.call({ + delegationId: idOfDelegation + }); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/cancelPendingDelegationFromEscrow.ts b/examples/SKALE/cancelPendingDelegationFromEscrow.ts new file mode 100644 index 0000000..360fb4a --- /dev/null +++ b/examples/SKALE/cancelPendingDelegationFromEscrow.ts @@ -0,0 +1,48 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0xB575c158399227b6ef4Dcfb05AA3bCa30E12a7ba'; + const Allocator = new Contract('SkaleAllocator').address(proxyAddress); + + /** + * Get the Escrow wallet address that is linked to the delegator's Bitgo wallet address + */ + let { data, amount, address } = Allocator.methods().getEscrowAddress.call({ + beneficiary: bitGoWallet.getAddress() + }); + let escrowAddress = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + + //Retrieve Escrow contract for delegator + const Escrow = new Contract('SkaleEscrow').address(escrowAddress); + + //parameter needed for cancel delegation request + const idOfDelegation = 'ID of delegation to cancel'; + + + /** + * Request to cancel PENDING delegation from the delegator's Escrow account. + * + * This allows the delegator to cancel the PENDING delegation before the validator approves + * or before the start of the next Epoch. + * If a delegation is already in the DELEGATED or COMPLETED state, this method can not be called. + */ + ({ data, amount, address } = Escrow.methods().cancelPendingDelegation.call({ + delegationId: idOfDelegation + })); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + + +} + +sendBitGoTx(); diff --git a/examples/SKALE/delegate.ts b/examples/SKALE/delegate.ts new file mode 100644 index 0000000..eef29b1 --- /dev/null +++ b/examples/SKALE/delegate.ts @@ -0,0 +1,37 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + //parameters needed for the delegation request + const idOfValidator = "validator id"; + const amounttoDelegate = "amount of proposed delegation"; + const proposedDelegationPeriod = "period of proposed delegation (3months)"; + const descriptionAboutDelegation = "description or summary about the delegation"; + + const proxyAddress = '0x06dD71dAb27C1A3e0B172d53735f00Bf1a66Eb79'; + const DelegationController = new Contract('SkaleDelegationController').address(proxyAddress); + + /** + * Sending a proposal to delegate SKL tokens to the validator. + */ + let { data, amount, address } = DelegationController.methods().delegate.call({ + validatorId: idOfValidator, + amount: amounttoDelegate, + delegationPeriod: proposedDelegationPeriod, + info: descriptionAboutDelegation + }); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/delegateFromEscrow.ts b/examples/SKALE/delegateFromEscrow.ts new file mode 100644 index 0000000..deb3ff4 --- /dev/null +++ b/examples/SKALE/delegateFromEscrow.ts @@ -0,0 +1,50 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0xB575c158399227b6ef4Dcfb05AA3bCa30E12a7ba'; + const Allocator = new Contract('SkaleAllocator').address(proxyAddress); + + /** + * Get the Escrow wallet address that is linked to the delegator's Bitgo wallet address + */ + let { data, amount, address } = Allocator.methods().getEscrowAddress.call({ + beneficiary: bitGoWallet.getAddress() + }); + let escrowAddress = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + + //Retrieve Escrow contract for delegator + const Escrow = new Contract('SkaleEscrow').address(escrowAddress); + + //parameters needed for the delegation request + const idOfValidator = "validator id"; + const amounttoDelegate = "amount of proposed delegation"; + const proposedDelegationPeriod = "period of proposed delegation (3months)"; + const descriptionAboutDelegation = "description or summary about the delegation"; + + + /** + * Sending a proposal to delegate SKL tokens to the validator from the delegator's Escrow account. + */ + ({ data, amount, address } = Escrow.methods().delegate.call({ + validatorId: idOfValidator, + amount: amounttoDelegate, + delegationPeriod: proposedDelegationPeriod, + info: descriptionAboutDelegation + })); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + + +} + +sendBitGoTx(); diff --git a/examples/SKALE/getEscrowAddress.ts b/examples/SKALE/getEscrowAddress.ts new file mode 100644 index 0000000..e12350f --- /dev/null +++ b/examples/SKALE/getEscrowAddress.ts @@ -0,0 +1,27 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0xB575c158399227b6ef4Dcfb05AA3bCa30E12a7ba'; + const Allocator = new Contract('SkaleAllocator').address(proxyAddress); + + /** + * Get the Escrow wallet address that is linked to the investor's Bitgo wallet address + */ + let { data, amount, address } = Allocator.methods().getEscrowAddress.call({ + beneficiary: bitGoWallet.getAddress() + }); + let escrowAddress = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/listDelegation.ts b/examples/SKALE/listDelegation.ts new file mode 100644 index 0000000..3d752bb --- /dev/null +++ b/examples/SKALE/listDelegation.ts @@ -0,0 +1,60 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0x06dD71dAb27C1A3e0B172d53735f00Bf1a66Eb79'; + const DelegationController = new Contract('SkaleDelegationController').address(proxyAddress); + + let delegations = []; + /** + * List all of the delegations for th token holder (delegator). + * This will return the states of each of the delegation requests sent. + * + * First get Total amount of delegations for the holder + */ + let { data, amount, address } = DelegationController.methods().getDelegationsByHolderLength.call({ + holder: bitGoWallet.getAddress() + }); + + /** + * Then get the delegation ids for the total amount of delegations. + */ + for (let index = 0; index < parseInt(data); index++) { + let delegation = {info: {}, state: {}}; + + let delegationId = ({ data, amount, address } = DelegationController.methods().delegationsByHolder.call({ + address: bitGoWallet.getAddress(), + index: index + })); + + let delegationInfo = ({ data, amount, address } = DelegationController.methods().getDelegation.call({ + delegationId: delegationId + })); + + /** Get the state of the delegation (PROPOSED, ACCEPTED, CANCELED, etc). State is returned as an integer + * where 0 = PROPOSED, 1 = ACCEPTED, etc + * States can be found below + //https://github.com/skalenetwork/skale-manager/blob/develop/contracts/delegation/DelegationController.sol#L64 + */ + let delegationState = ({ data, amount, address } = DelegationController.methods().getState.call({ + delegationId: delegationId + })); + + delegation.info = delegationInfo.data; + delegation.state = delegationState.data; + + delegations.push(delegation); + } + +} + +sendBitGoTx(); diff --git a/examples/SKALE/listDelegationFromEscrow.ts b/examples/SKALE/listDelegationFromEscrow.ts new file mode 100644 index 0000000..6c12a4c --- /dev/null +++ b/examples/SKALE/listDelegationFromEscrow.ts @@ -0,0 +1,72 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0xB575c158399227b6ef4Dcfb05AA3bCa30E12a7ba'; + const Allocator = new Contract('SkaleAllocator').address(proxyAddress); + + /** + * Get the Escrow wallet address that is linked to the delegator's Bitgo wallet address + */ + let { data, amount, address } = Allocator.methods().getEscrowAddress.call({ + beneficiary: bitGoWallet.getAddress() + }); + let escrowAddress = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + + const delegationControllerAddress = '0x06dD71dAb27C1A3e0B172d53735f00Bf1a66Eb79'; + const DelegationController = new Contract('SkaleDelegationController').address(delegationControllerAddress); + let delegations = []; + /** + * List all of the delegations for th token holder's Escrow contract. + * This will return the states of each of the delegation requests sent. + * + * First get Total amount of delegations for the holder + */ + let delegationsTotal = ({ data, amount, address } = DelegationController.methods().getDelegationsByHolderLength.call({ + holder: escrowAddress + })); + + /** + * Then get the delegation ids for the total amount of delegations. + */ + for (let index = 0; index < parseInt(delegationsTotal.data); index++) { + let delegation = {info: {}, state: {}}; + + let delegationId = ({ data, amount, address } = DelegationController.methods().delegationsByHolder.call({ + address: escrowAddress, + index: index + })); + + let delegationInfo = ({ data, amount, address } = DelegationController.methods().getDelegation.call({ + delegationId: delegationId + })); + + /** Get the state of the delegation (PROPOSED, ACCEPTED, CANCELED, etc). State is returned as an integer + * where 0 = PROPOSED, 1 = ACCEPTED, etc + * States can be found below + //https://github.com/skalenetwork/skale-manager/blob/develop/contracts/delegation/DelegationController.sol#L64 + */ + let delegationState = ({ data, amount, address } = DelegationController.methods().getState.call({ + delegationId: delegationId + })); + + delegation.info = delegationInfo.data; + delegation.state = delegationState.data; + + delegations.push(delegation); + } + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/listValidators.ts b/examples/SKALE/listValidators.ts new file mode 100644 index 0000000..fbdb469 --- /dev/null +++ b/examples/SKALE/listValidators.ts @@ -0,0 +1,26 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0x840C8122433A5AA7ad60C1Bcdc36AB9DcCF761a5'; + const ValidatorService = new Contract('SkaleValidatorService').address(proxyAddress); + + /** + * List all of the trusted validators that are registered within the SKALE Network. + */ + let { data, amount, address } = ValidatorService.methods().getTrustedValidators.call({}); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/requestUndelegation.ts b/examples/SKALE/requestUndelegation.ts new file mode 100644 index 0000000..5fb7abe --- /dev/null +++ b/examples/SKALE/requestUndelegation.ts @@ -0,0 +1,33 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + //parameter for the id of the undelegation request + const idOfDelegation = 'ID of delegation to undelegate'; + + const proxyAddress = '0x06dD71dAb27C1A3e0B172d53735f00Bf1a66Eb79'; + const DelegationController = new Contract('SkaleDelegationController').address(proxyAddress); + + /** + * After the epoch starts all delegations that are accepted turns to DELEGATED state. + * Token holders (delegators) can request undelegation once the delegation is in the DELEGATED state + * But only their delegations will be “undelegated” once their delegation period is over. + */ + let { data, amount, address } = DelegationController.methods().requestUndelegation.call({ + delegationId: idOfDelegation + }); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/requestUndelegationFromEscrow.ts b/examples/SKALE/requestUndelegationFromEscrow.ts new file mode 100644 index 0000000..e6bdef8 --- /dev/null +++ b/examples/SKALE/requestUndelegationFromEscrow.ts @@ -0,0 +1,48 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0xB575c158399227b6ef4Dcfb05AA3bCa30E12a7ba'; + const Allocator = new Contract('SkaleAllocator').address(proxyAddress); + + /** + * Get the Escrow wallet address that is linked to the delegator's Bitgo wallet address + */ + let { data, amount, address } = Allocator.methods().getEscrowAddress.call({ + beneficiary: bitGoWallet.getAddress() + }); + let escrowAddress = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + + //Retrieve Escrow contract for delegator + const Escrow = new Contract('SkaleEscrow').address(escrowAddress); + + //parameter for the id of the undelegation request + const idOfDelegation = 'ID of delegation to undelegate'; + + + /** + * Request to undelegate from the delegator's Escrow account. + * + * After the epoch starts all delegations that are accepted turns to DELEGATED state. + * Token holders (delegators) can request undelegation once the delegation is in the DELEGATED state + * But only their delegations will be “undelegated” once their delegation period is over. + */ + ({ data, amount, address } = Escrow.methods().requestUndelegation.call({ + delegationId: idOfDelegation + })); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + + +} + +sendBitGoTx(); diff --git a/examples/SKALE/showLockedTokens.ts b/examples/SKALE/showLockedTokens.ts new file mode 100644 index 0000000..7d316da --- /dev/null +++ b/examples/SKALE/showLockedTokens.ts @@ -0,0 +1,28 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const delegatorWalletAddress = 'delegator wallet address'; + const proxyAddress = '0x1F2157Bf5C820f68826ef1DC71824816Ee795f41'; + const TokenState = new Contract('SkaleTokenState').address(proxyAddress); + + /** + * List the amount of the tokens that are locked within the token holder (delegator) + * wallet. + */ + let { data, amount, address } = TokenState.methods().getAndUpdateLockedAmount.call({holder: delegatorWalletAddress}); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/showLockedTokensForEscrow.ts b/examples/SKALE/showLockedTokensForEscrow.ts new file mode 100644 index 0000000..b11cb00 --- /dev/null +++ b/examples/SKALE/showLockedTokensForEscrow.ts @@ -0,0 +1,45 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0xB575c158399227b6ef4Dcfb05AA3bCa30E12a7ba'; + const Allocator = new Contract('SkaleAllocator').address(proxyAddress); + + /** + * Get the Escrow wallet address that is linked to the delegator's Bitgo wallet address + */ + let { data, amount, address } = Allocator.methods().getEscrowAddress.call({ + beneficiary: bitGoWallet.getAddress() + }); + let escrowAddress = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + + const tokenStateAddress = '0x1F2157Bf5C820f68826ef1DC71824816Ee795f41'; + const TokenState = new Contract('SkaleTokenState').address(tokenStateAddress); + + /** + * List the amount of the tokens that are locked within the token holder's Escrow + * contract. + */ + ({ data, amount, address } = TokenState.methods().getAndUpdateLockedAmount.call({ + holder: escrowAddress + })); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/withdrawBounty.ts b/examples/SKALE/withdrawBounty.ts new file mode 100644 index 0000000..9513dee --- /dev/null +++ b/examples/SKALE/withdrawBounty.ts @@ -0,0 +1,34 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + //parameters needed for withdrawing bounties + const idOfValidator = "validator id"; + const addressOfReceivingDelegator = "token holder address"; + + const proxyAddress = '0x4eE5F270572285776814e32952446e9B7Ee15C86'; + const Distributor = new Contract('SkaleDistributor').address(proxyAddress); + + /** + * Allows token holder (delegator) to withdraw bounty from a specific validator. + * This needs to be called per validator in order to recieve all of the bounties. + */ + let { data, amount, address } = Distributor.methods().withdrawBounty.call({ + validatorId: idOfValidator, + address: addressOfReceivingDelegator + }); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx(); diff --git a/examples/SKALE/withdrawBountyFromEscrow.ts b/examples/SKALE/withdrawBountyFromEscrow.ts new file mode 100644 index 0000000..d55b20b --- /dev/null +++ b/examples/SKALE/withdrawBountyFromEscrow.ts @@ -0,0 +1,46 @@ +import { BitGo } from 'bitgo'; +import * as ethUtil from 'ethereumjs-util'; +import { Contract } from '../../src/contract'; + + +async function sendBitGoTx(): Promise { + + const bitGo = new BitGo({ env: 'prod' }); + const baseCoin = bitGo.coin('eth'); + bitGo.authenticateWithAccessToken({ accessToken: 'access token' }); + const bitGoWallet = await baseCoin.wallets().get({ id: 'wallet id' }); + const walletPassphrase = 'password'; + + const proxyAddress = '0xB575c158399227b6ef4Dcfb05AA3bCa30E12a7ba'; + const Allocator = new Contract('SkaleAllocator').address(proxyAddress); + + /** + * Get the Escrow wallet address that is linked to the delegator's Bitgo wallet address + */ + let { data, amount, address } = Allocator.methods().getEscrowAddress.call({ + beneficiary: bitGoWallet.getAddress() + }); + let escrowAddress = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + + //Retrieve Escrow contract for delegator + const Escrow = new Contract('SkaleEscrow').address(escrowAddress); + + //parameters needed for withdrawing bounties + const idOfValidator = "validator id"; + + /** + * Withdraw bounty for delegator's Escrow account. + * + * Allows token holder (delegator) to withdraw bounty from a specific validator. + * This needs to be called per validator in order to recieve all of the bounties. + */ + ({ data, amount, address } = Escrow.methods().withdrawBounty.call({ + validatorId: idOfValidator, + address: bitGoWallet.getAddress() + })); + let transaction = await bitGoWallet.send({ data, amount, address, walletPassphrase }); + console.dir(transaction); + +} + +sendBitGoTx();