Merge branch 'main' into feature/m

This commit is contained in:
bartosz-lipinski 2021-04-15 21:17:10 -05:00
commit 44b5fa403d
125 changed files with 127573 additions and 32803 deletions

View File

@ -16,7 +16,7 @@
"downlevelIteration": true,
"noEmit": true,
"jsx": "react",
"typeRoots": ["../../types"]
"typeRoots": ["types", "../../types", "../../node_modules/@types"]
},
"include": ["src"]
}

View File

@ -1,5 +1,8 @@
@surge-20: #00CC82;
@surge-30: #00B372;
@tungsten-100: #06101a;
@tungsten-80: #2F506F;
@tungsten-60: #547595;
@tungsten-50: #0D1B28;
@tungsten-40: #7BA4C7;
@tungsten-0: #193650;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,558 @@
{
"contractName": "Context",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Context.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x8d3cb350f04ff49cfb10aef08d87f19dcbaecc8027b0bed12f3275cd12f38cf0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ded47ec7c96750f9bd04bbbc84f659992d4ba901cb7b532a52cd468272cf378f\",\"dweb:/ipfs/QmfBrGtQP7rZEqEg6Wz6jh2N2Kukpj1z5v3CGWmAqrzm96\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"immutableReferences": {},
"sourceMap": "",
"deployedSourceMap": "",
"source": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.0 <0.8.0;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address payable) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes memory) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n}\n",
"sourcePath": "@openzeppelin/contracts/utils/Context.sol",
"ast": {
"absolutePath": "@openzeppelin/contracts/utils/Context.sol",
"exportedSymbols": {
"Context": [3618]
},
"id": 3619,
"license": "MIT",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 3597,
"literals": ["solidity", ">=", "0.6", ".0", "<", "0.8", ".0"],
"nodeType": "PragmaDirective",
"src": "33:31:9"
},
{
"abstract": true,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 3618,
"linearizedBaseContracts": [3618],
"name": "Context",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 3605,
"nodeType": "Block",
"src": "668:34:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 3602,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "685:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 3603,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "685:10:9",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"functionReturnParameters": 3601,
"id": 3604,
"nodeType": "Return",
"src": "678:17:9"
}
]
},
"documentation": null,
"id": 3606,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_msgSender",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 3598,
"nodeType": "ParameterList",
"parameters": [],
"src": "617:2:9"
},
"returnParameters": {
"id": 3601,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3600,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 3606,
"src": "651:15:9",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
"typeName": {
"id": 3599,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "651:15:9",
"stateMutability": "payable",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "650:17:9"
},
"scope": 3618,
"src": "598:104:9",
"stateMutability": "view",
"virtual": true,
"visibility": "internal"
},
{
"body": {
"id": 3616,
"nodeType": "Block",
"src": "773:165:9",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 3611,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "783:4:9",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Context_$3618",
"typeString": "contract Context"
}
},
"id": 3612,
"nodeType": "ExpressionStatement",
"src": "783:4:9"
},
{
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 3613,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -15,
"src": "923:3:9",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 3614,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "data",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "923:8:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes_calldata_ptr",
"typeString": "bytes calldata"
}
},
"functionReturnParameters": 3610,
"id": 3615,
"nodeType": "Return",
"src": "916:15:9"
}
]
},
"documentation": null,
"id": 3617,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "_msgData",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 3607,
"nodeType": "ParameterList",
"parameters": [],
"src": "725:2:9"
},
"returnParameters": {
"id": 3610,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3609,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 3617,
"src": "759:12:9",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 3608,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "759:5:9",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "758:14:9"
},
"scope": 3618,
"src": "708:230:9",
"stateMutability": "view",
"virtual": true,
"visibility": "internal"
}
],
"scope": 3619,
"src": "566:374:9"
}
],
"src": "33:908:9"
},
"legacyAST": {
"attributes": {
"absolutePath": "@openzeppelin/contracts/utils/Context.sol",
"exportedSymbols": {
"Context": [3618]
},
"license": "MIT"
},
"children": [
{
"attributes": {
"literals": ["solidity", ">=", "0.6", ".0", "<", "0.8", ".0"]
},
"id": 3597,
"name": "PragmaDirective",
"src": "33:31:9"
},
{
"attributes": {
"abstract": true,
"baseContracts": [null],
"contractDependencies": [null],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [3618],
"name": "Context",
"scope": 3619
},
"children": [
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [null],
"name": "_msgSender",
"overrides": null,
"scope": 3618,
"stateMutability": "view",
"virtual": true,
"visibility": "internal"
},
"children": [
{
"attributes": {
"parameters": [null]
},
"children": [],
"id": 3598,
"name": "ParameterList",
"src": "617:2:9"
},
{
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "",
"overrides": null,
"scope": 3606,
"stateVariable": false,
"storageLocation": "default",
"type": "address payable",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "payable",
"type": "address payable"
},
"id": 3599,
"name": "ElementaryTypeName",
"src": "651:15:9"
}
],
"id": 3600,
"name": "VariableDeclaration",
"src": "651:15:9"
}
],
"id": 3601,
"name": "ParameterList",
"src": "650:17:9"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 3601
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [null],
"referencedDeclaration": -15,
"type": "msg",
"value": "msg"
},
"id": 3602,
"name": "Identifier",
"src": "685:3:9"
}
],
"id": 3603,
"name": "MemberAccess",
"src": "685:10:9"
}
],
"id": 3604,
"name": "Return",
"src": "678:17:9"
}
],
"id": 3605,
"name": "Block",
"src": "668:34:9"
}
],
"id": 3606,
"name": "FunctionDefinition",
"src": "598:104:9"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [null],
"name": "_msgData",
"overrides": null,
"scope": 3618,
"stateMutability": "view",
"virtual": true,
"visibility": "internal"
},
"children": [
{
"attributes": {
"parameters": [null]
},
"children": [],
"id": 3607,
"name": "ParameterList",
"src": "725:2:9"
},
{
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "",
"overrides": null,
"scope": 3617,
"stateVariable": false,
"storageLocation": "memory",
"type": "bytes",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "bytes",
"type": "bytes"
},
"id": 3608,
"name": "ElementaryTypeName",
"src": "759:5:9"
}
],
"id": 3609,
"name": "VariableDeclaration",
"src": "759:12:9"
}
],
"id": 3610,
"name": "ParameterList",
"src": "758:14:9"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [null],
"referencedDeclaration": -28,
"type": "contract Context",
"value": "this"
},
"id": 3611,
"name": "Identifier",
"src": "783:4:9"
}
],
"id": 3612,
"name": "ExpressionStatement",
"src": "783:4:9"
},
{
"attributes": {
"functionReturnParameters": 3610
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "data",
"referencedDeclaration": null,
"type": "bytes calldata"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [null],
"referencedDeclaration": -15,
"type": "msg",
"value": "msg"
},
"id": 3613,
"name": "Identifier",
"src": "923:3:9"
}
],
"id": 3614,
"name": "MemberAccess",
"src": "923:8:9"
}
],
"id": 3615,
"name": "Return",
"src": "916:15:9"
}
],
"id": 3616,
"name": "Block",
"src": "773:165:9"
}
],
"id": 3617,
"name": "FunctionDefinition",
"src": "708:230:9"
}
],
"id": 3618,
"name": "ContractDefinition",
"src": "566:374:9"
}
],
"id": 3619,
"name": "SourceUnit",
"src": "33:908:9"
},
"compiler": {
"name": "solc",
"version": "0.6.12+commit.27d51765.Emscripten.clang"
},
"networks": {},
"schemaVersion": "3.3.4",
"updatedAt": "2021-04-12T21:53:29.929Z",
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -47,6 +47,7 @@
"eventemitter3": "^4.0.7",
"fortmatic": "^2.2.1",
"identicon.js": "^2.3.3",
"javascript-time-ago": "^2.3.4",
"jazzicon": "^1.5.0",
"lodash": "^4.17.20",
"react": "16.13.1",
@ -97,12 +98,14 @@
"@types/bn.js": "^5.1.0",
"@types/bs58": "^4.0.1",
"@types/identicon.js": "^2.3.0",
"@types/javascript-time-ago": "^2.0.2",
"@types/jest": "^24.9.1",
"@types/node": "^12.12.62",
"arweave-deploy": "^1.9.1",
"gh-pages": "^3.1.0",
"npm-link-shared": "0.5.6",
"prettier": "^2.1.2"
"prettier": "^2.1.2",
"typechain": "^4.0.3"
},
"peerDependencies": {
"react": "*",

View File

@ -1,4 +1,4 @@
<svg viewBox="0 0 1420 1000" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="1420" height="1401" viewBox="0 0 1420 1401" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="-217.293" y="597" width="1311.39" height="1311.39" rx="299.5" transform="rotate(-45 -217.293 597)" fill="url(#paint0_linear)" stroke="url(#paint1_linear)"/>
<rect x="176.707" y="597" width="754.19" height="754.19" rx="119.5" transform="rotate(-45 176.707 597)" fill="url(#paint2_linear)" stroke="url(#paint3_linear)"/>
<rect x="369.707" y="597" width="480.94" height="480.94" rx="60.5" transform="rotate(-45 369.707 597)" fill="url(#paint4_linear)" stroke="url(#paint5_linear)"/>
@ -27,18 +27,6 @@
<circle cx="46.5" cy="254.5" r="0.5" fill="#2F506F"/>
<circle cx="1309.5" cy="168.5" r="0.5" fill="#193650"/>
<circle cx="454.5" cy="560.5" r="0.5" fill="white"/>
<circle cx="1062.5" cy="2226.5" r="0.5" fill="white"/>
<g filter="url(#filter2_b)">
<path d="M725.384 408L727.282 405.322L711.202 331L689.316 331L677.927 376.419L666.425 331L644.539 331L628.459 405.322L630.358 408H641.524L655.147 343.275H656.599L671.227 400.188H684.515L699.143 343.275H700.594L714.217 408H725.384Z" fill="url(#paint10_linear)"/>
<path d="M301 333.678L302.898 331H314.065L327.688 395.725H329.139L343.767 338.812H357.055L371.683 395.725H373.135L386.758 331H397.924L399.823 333.678L383.743 408H361.857L350.356 362.581L338.966 408H317.08L301 333.678Z" fill="url(#paint11_linear)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M542.862 408V331H584.341C596.4 331 602.43 337.026 602.43 349.078V361.688C602.43 371.137 598.708 376.865 591.264 378.874L604.663 405.099L602.988 408H591.375L577.082 379.767H556.485V408H542.862ZM556.485 367.491H583.894C587.169 367.491 588.807 365.855 588.807 362.581V348.186C588.807 344.912 587.169 343.275 583.894 343.275H556.485V367.491Z" fill="url(#paint12_linear)"/>
<path d="M761.199 331V408H774.822V374.187H815.906V408H829.529V331H815.906V361.912H774.822V331H761.199Z" fill="url(#paint13_linear)"/>
<path d="M974.495 408V331H988.117V395.725H1022.96V408H974.495Z" fill="url(#paint14_linear)"/>
<path d="M1056.6 331V408H1117V395.725H1070.22V374.187H1099.83V361.912H1070.22V343.275H1117V331H1056.6Z" fill="url(#paint15_linear)"/>
</g>
<path fill-rule="evenodd" clip-rule="evenodd" d="M460.495 342.073L442.269 360.091C437.572 364.735 437.572 372.265 442.269 376.909L460.495 394.927C465.192 399.571 472.808 399.571 477.505 394.927L495.731 376.909C500.428 372.265 500.428 364.735 495.731 360.091L477.505 342.073C472.808 337.429 465.192 337.429 460.495 342.073ZM432.549 350.482C422.484 360.433 422.484 376.567 432.549 386.518L450.775 404.537C460.84 414.488 477.16 414.488 487.225 404.537L505.451 386.518C515.516 376.567 515.516 360.433 505.451 350.482L487.225 332.463C477.16 322.512 460.84 322.512 450.775 332.463L432.549 350.482Z" fill="#DC1FFF"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M892.495 342.073L874.269 360.091C869.572 364.735 869.572 372.265 874.269 376.909L892.495 394.927C897.192 399.571 904.808 399.571 909.505 394.927L927.731 376.909C932.428 372.265 932.428 364.735 927.731 360.091L909.505 342.073C904.808 337.429 897.192 337.429 892.495 342.073ZM864.549 350.482C854.484 360.433 854.484 376.567 864.549 386.518L882.775 404.537C892.84 414.488 909.16 414.488 919.225 404.537L937.451 386.518C947.516 376.567 947.516 360.433 937.451 350.482L919.225 332.463C909.16 322.512 892.84 322.512 882.775 332.463L864.549 350.482Z" fill="#00FFA3"/>
<path d="M450.811 248H457.924V246.75H452.22V242.795H457.47V241.545H452.22V237.614H457.833V236.364H450.811V248ZM472.537 237.614H476.196V248H477.605V237.614H481.264V236.364H472.537V237.614ZM496.239 248H497.648V242.795H503.852V248H505.261V236.364H503.852V241.545H497.648V236.364H496.239V248ZM520.883 248H527.996V246.75H522.292V242.795H527.542V241.545H522.292V237.614H527.905V236.364H520.883V248ZM543.245 248H544.654V243.455H547.2C547.302 243.455 547.398 243.455 547.495 243.449L549.95 248H551.586L548.955 243.193C550.438 242.688 551.131 241.477 551.131 239.932C551.131 237.875 549.904 236.364 547.177 236.364H543.245V248ZM544.654 242.182V237.614H547.131C549.018 237.614 549.745 238.534 549.745 239.932C549.745 241.33 549.018 242.182 547.154 242.182H544.654ZM566.279 248H573.393V246.75H567.688V242.795H572.938V241.545H567.688V237.614H573.302V236.364H566.279V248ZM596.278 236.364V243.955C596.278 245.659 595.108 246.886 593.165 246.886C591.221 246.886 590.051 245.659 590.051 243.955V236.364H588.642V244.068C588.642 246.455 590.426 248.205 593.165 248.205C595.903 248.205 597.687 246.455 597.687 244.068V236.364H596.278ZM613.301 236.364V248H614.619V239.159H614.733L618.369 248H619.642L623.279 239.159H623.392V248H624.71V236.364H623.029L619.074 246.023H618.938L614.983 236.364H613.301ZM660.863 245.955H662.136V242.841H665.249V241.568H662.136V238.455H660.863V241.568H657.749V242.841H660.863V245.955ZM704.646 239.273H706.01C705.947 237.517 704.328 236.205 702.078 236.205C699.851 236.205 698.101 237.5 698.101 239.455C698.101 241.023 699.237 241.955 701.055 242.477L702.487 242.886C703.714 243.227 704.805 243.659 704.805 244.818C704.805 246.091 703.578 246.932 701.964 246.932C700.578 246.932 699.351 246.318 699.237 245H697.783C697.919 246.909 699.464 248.205 701.964 248.205C704.646 248.205 706.169 246.727 706.169 244.841C706.169 242.659 704.101 241.955 702.896 241.636L701.714 241.318C700.851 241.091 699.464 240.636 699.464 239.386C699.464 238.273 700.487 237.455 702.033 237.455C703.442 237.455 704.51 238.125 704.646 239.273ZM731.104 242.182C731.104 238.5 728.945 236.205 725.967 236.205C722.99 236.205 720.831 238.5 720.831 242.182C720.831 245.864 722.99 248.159 725.967 248.159C728.945 248.159 731.104 245.864 731.104 242.182ZM729.74 242.182C729.74 245.205 728.081 246.841 725.967 246.841C723.854 246.841 722.195 245.205 722.195 242.182C722.195 239.159 723.854 237.523 725.967 237.523C728.081 237.523 729.74 239.159 729.74 242.182ZM746.273 248H753.091V246.75H747.682V236.364H746.273V248ZM769.285 248L770.455 244.705H775.16L776.33 248H777.808L773.535 236.364H772.08L767.808 248H769.285ZM770.898 243.455L772.762 238.205H772.853L774.717 243.455H770.898ZM801.647 236.364H800.261V245.523H800.147L793.784 236.364H792.42V248H793.829V238.864H793.943L800.284 248H801.647V236.364ZM817.744 248L818.915 244.705H823.619L824.79 248H826.267L821.994 236.364H820.54L816.267 248H817.744ZM819.358 243.455L821.221 238.205H821.312L823.176 243.455H819.358ZM858.179 248H862.384C865.134 248 866.27 246.659 866.27 244.909C866.27 243.068 864.998 242.068 863.929 242V241.886C864.929 241.614 865.816 240.955 865.816 239.455C865.816 237.75 864.679 236.364 862.248 236.364H858.179V248ZM859.588 246.75V242.705H862.452C863.975 242.705 864.929 243.727 864.929 244.909C864.929 245.932 864.225 246.75 862.384 246.75H859.588ZM859.588 241.477V237.614H862.248C863.793 237.614 864.475 238.432 864.475 239.455C864.475 240.682 863.475 241.477 862.202 241.477H859.588ZM881.386 248H882.795V243.455H885.34C885.442 243.455 885.539 243.455 885.636 243.449L888.09 248H889.727L887.096 243.193C888.579 242.688 889.272 241.477 889.272 239.932C889.272 237.875 888.045 236.364 885.317 236.364H881.386V248ZM882.795 242.182V237.614H885.272C887.158 237.614 887.886 238.534 887.886 239.932C887.886 241.33 887.158 242.182 885.295 242.182H882.795ZM905.829 236.364H904.42V248H905.829V236.364ZM925.045 248C928.591 248 930.591 245.795 930.591 242.159C930.591 238.545 928.591 236.364 925.204 236.364H921.454V248H925.045ZM922.864 246.75V237.614H925.114C927.841 237.614 929.227 239.341 929.227 242.159C929.227 245 927.841 246.75 924.954 246.75H922.864ZM953.709 240H955.163C954.732 237.75 952.845 236.205 950.391 236.205C947.408 236.205 945.3 238.5 945.3 242.182C945.3 245.864 947.391 248.159 950.482 248.159C953.254 248.159 955.232 246.312 955.232 243.432V242.182H950.8V243.432H953.868C953.828 245.523 952.453 246.841 950.482 246.841C948.323 246.841 946.663 245.205 946.663 242.182C946.663 239.159 948.323 237.523 950.391 237.523C952.073 237.523 953.215 238.472 953.709 240ZM970.445 248H977.559V246.75H971.854V242.795H977.104V241.545H971.854V237.614H977.468V236.364H970.445V248Z" fill="url(#paint16_linear)"/>
<defs>
<filter id="filter0_f" x="946.909" y="-268.564" width="963.182" height="1042.11" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
@ -50,12 +38,6 @@
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="15" result="effect1_foregroundBlur"/>
</filter>
<filter id="filter2_b" x="295" y="325" width="828" height="89" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feGaussianBlur in="BackgroundImage" stdDeviation="3"/>
<feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_backgroundBlur" result="shape"/>
</filter>
<linearGradient id="paint0_linear" x1="1158.03" y1="147.28" x2="619.214" y2="1495.03" gradientUnits="userSpaceOnUse">
<stop offset="0.0877329" stop-color="#0A1F31" stop-opacity="0.8"/>
<stop offset="1"/>
@ -96,34 +78,5 @@
<stop stop-color="#E451FF"/>
<stop offset="1" stop-color="#09020C" stop-opacity="0"/>
</radialGradient>
<linearGradient id="paint10_linear" x1="709" y1="303" x2="709" y2="429.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint11_linear" x1="709" y1="303" x2="709" y2="429.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint12_linear" x1="709" y1="303" x2="709" y2="429.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint13_linear" x1="709" y1="303" x2="709" y2="429.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint14_linear" x1="709" y1="303" x2="709" y2="429.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint15_linear" x1="709" y1="303" x2="709" y2="429.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint16_linear" x1="433.986" y1="252" x2="1009.03" y2="252" gradientUnits="userSpaceOnUse">
<stop offset="0.130208" stop-color="#DC1FFF"/>
<stop offset="0.5" stop-color="#4DA9FF"/>
<stop offset="0.885417" stop-color="#00CC82"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,50 @@
<svg width="816" height="176" viewBox="0 0 816 176" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_b)">
<path d="M424.384 172L426.282 169.322L410.202 95L388.316 95L376.927 140.419L365.425 95L343.539 95L327.459 169.322L329.358 172H340.524L354.147 107.275H355.599L370.227 164.188H383.515L398.143 107.275H399.594L413.217 172H424.384Z" fill="url(#paint0_linear)"/>
<path d="M0 97.6783L1.89829 95.0001H13.0647L26.6877 159.725H28.1393L42.7673 102.812H56.0554L70.6833 159.725H72.135L85.758 95.0001H96.9244L98.8227 97.6783L82.743 172H60.8569L49.3555 126.581L37.9658 172H16.0796L0 97.6783Z" fill="url(#paint1_linear)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M241.862 172V95.0001H283.341C295.4 95.0001 301.43 101.026 301.43 113.078V125.688C301.43 135.137 297.708 140.865 290.264 142.874L303.663 169.099L301.988 172H290.375L276.082 143.767H255.485V172H241.862ZM255.485 131.491H282.894C286.169 131.491 287.807 129.855 287.807 126.581V112.186C287.807 108.912 286.169 107.275 282.894 107.275H255.485V131.491Z" fill="url(#paint2_linear)"/>
<path d="M460.199 95.0001V172H473.822V138.187H514.906V172H528.529V95.0001H514.906V125.912H473.822V95.0001H460.199Z" fill="url(#paint3_linear)"/>
<path d="M673.495 172V95.0001H687.117V159.725H721.957V172H673.495Z" fill="url(#paint4_linear)"/>
<path d="M755.598 95.0001V172H816V159.725H769.221V138.187H798.827V125.912H769.221V107.275H816V95.0001H755.598Z" fill="url(#paint5_linear)"/>
</g>
<path fill-rule="evenodd" clip-rule="evenodd" d="M159.495 106.073L141.269 124.091C136.572 128.735 136.572 136.265 141.269 140.909L159.495 158.927C164.192 163.571 171.808 163.571 176.505 158.927L194.731 140.909C199.428 136.265 199.428 128.735 194.731 124.091L176.505 106.073C171.808 101.429 164.192 101.429 159.495 106.073ZM131.549 114.482C121.484 124.433 121.484 140.567 131.549 150.518L149.775 168.537C159.84 178.488 176.16 178.488 186.225 168.537L204.451 150.518C214.516 140.567 214.516 124.433 204.451 114.482L186.225 96.4634C176.16 86.5122 159.84 86.5122 149.775 96.4634L131.549 114.482Z" fill="#DC1FFF"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M591.495 106.073L573.269 124.091C568.572 128.735 568.572 136.265 573.269 140.909L591.495 158.927C596.192 163.571 603.808 163.571 608.505 158.927L626.731 140.909C631.428 136.265 631.428 128.735 626.731 124.091L608.505 106.073C603.808 101.429 596.192 101.429 591.495 106.073ZM563.549 114.482C553.484 124.433 553.484 140.567 563.549 150.518L581.775 168.537C591.84 178.488 608.16 178.488 618.225 168.537L636.451 150.518C646.516 140.567 646.516 124.433 636.451 114.482L618.225 96.4634C608.16 86.5122 591.84 86.5122 581.775 96.4634L563.549 114.482Z" fill="#00FFA3"/>
<path d="M149.811 12H156.924V10.75H151.22V6.79545H156.47V5.54545H151.22V1.61364H156.833V0.363636H149.811V12ZM171.537 1.61364H175.196V12H176.605V1.61364H180.264V0.363636H171.537V1.61364ZM195.239 12H196.648V6.79545H202.852V12H204.261V0.363636H202.852V5.54545H196.648V0.363636H195.239V12ZM219.883 12H226.996V10.75H221.292V6.79545H226.542V5.54545H221.292V1.61364H226.905V0.363636H219.883V12ZM242.245 12H243.654V7.45455H246.2C246.302 7.45455 246.398 7.45455 246.495 7.44886L248.95 12H250.586L247.955 7.19318C249.438 6.6875 250.131 5.47727 250.131 3.93182C250.131 1.875 248.904 0.363636 246.177 0.363636H242.245V12ZM243.654 6.18182V1.61364H246.131C248.018 1.61364 248.745 2.53409 248.745 3.93182C248.745 5.32955 248.018 6.18182 246.154 6.18182H243.654ZM265.279 12H272.393V10.75H266.688V6.79545H271.938V5.54545H266.688V1.61364H272.302V0.363636H265.279V12ZM295.278 0.363636V7.95455C295.278 9.65909 294.108 10.8864 292.165 10.8864C290.221 10.8864 289.051 9.65909 289.051 7.95455V0.363636H287.642V8.06818C287.642 10.4545 289.426 12.2045 292.165 12.2045C294.903 12.2045 296.687 10.4545 296.687 8.06818V0.363636H295.278ZM312.301 0.363636V12H313.619V3.15909H313.733L317.369 12H318.642L322.279 3.15909H322.392V12H323.71V0.363636H322.029L318.074 10.0227H317.938L313.983 0.363636H312.301ZM359.863 9.95455H361.136V6.84091H364.249V5.56818H361.136V2.45455H359.863V5.56818H356.749V6.84091H359.863V9.95455ZM403.646 3.27273H405.01C404.947 1.51705 403.328 0.204545 401.078 0.204545C398.851 0.204545 397.101 1.5 397.101 3.45455C397.101 5.02273 398.237 5.95455 400.055 6.47727L401.487 6.88636C402.714 7.22727 403.805 7.65909 403.805 8.81818C403.805 10.0909 402.578 10.9318 400.964 10.9318C399.578 10.9318 398.351 10.3182 398.237 9H396.783C396.919 10.9091 398.464 12.2045 400.964 12.2045C403.646 12.2045 405.169 10.7273 405.169 8.84091C405.169 6.65909 403.101 5.95455 401.896 5.63636L400.714 5.31818C399.851 5.09091 398.464 4.63636 398.464 3.38636C398.464 2.27273 399.487 1.45455 401.033 1.45455C402.442 1.45455 403.51 2.125 403.646 3.27273ZM430.104 6.18182C430.104 2.5 427.945 0.204545 424.967 0.204545C421.99 0.204545 419.831 2.5 419.831 6.18182C419.831 9.86364 421.99 12.1591 424.967 12.1591C427.945 12.1591 430.104 9.86364 430.104 6.18182ZM428.74 6.18182C428.74 9.20455 427.081 10.8409 424.967 10.8409C422.854 10.8409 421.195 9.20455 421.195 6.18182C421.195 3.15909 422.854 1.52273 424.967 1.52273C427.081 1.52273 428.74 3.15909 428.74 6.18182ZM445.273 12H452.091V10.75H446.682V0.363636H445.273V12ZM468.285 12L469.455 8.70455H474.16L475.33 12H476.808L472.535 0.363636H471.08L466.808 12H468.285ZM469.898 7.45455L471.762 2.20455H471.853L473.717 7.45455H469.898ZM500.647 0.363636H499.261V9.52273H499.147L492.784 0.363636H491.42V12H492.829V2.86364H492.943L499.284 12H500.647V0.363636ZM516.744 12L517.915 8.70455H522.619L523.79 12H525.267L520.994 0.363636H519.54L515.267 12H516.744ZM518.358 7.45455L520.221 2.20455H520.312L522.176 7.45455H518.358ZM557.179 12H561.384C564.134 12 565.27 10.6591 565.27 8.90909C565.27 7.06818 563.998 6.06818 562.929 6V5.88636C563.929 5.61364 564.816 4.95455 564.816 3.45455C564.816 1.75 563.679 0.363636 561.248 0.363636H557.179V12ZM558.588 10.75V6.70455H561.452C562.975 6.70455 563.929 7.72727 563.929 8.90909C563.929 9.93182 563.225 10.75 561.384 10.75H558.588ZM558.588 5.47727V1.61364H561.248C562.793 1.61364 563.475 2.43182 563.475 3.45455C563.475 4.68182 562.475 5.47727 561.202 5.47727H558.588ZM580.386 12H581.795V7.45455H584.34C584.442 7.45455 584.539 7.45455 584.636 7.44886L587.09 12H588.727L586.096 7.19318C587.579 6.6875 588.272 5.47727 588.272 3.93182C588.272 1.875 587.045 0.363636 584.317 0.363636H580.386V12ZM581.795 6.18182V1.61364H584.272C586.158 1.61364 586.886 2.53409 586.886 3.93182C586.886 5.32955 586.158 6.18182 584.295 6.18182H581.795ZM604.829 0.363636H603.42V12H604.829V0.363636ZM624.045 12C627.591 12 629.591 9.79545 629.591 6.15909C629.591 2.54545 627.591 0.363636 624.204 0.363636H620.454V12H624.045ZM621.864 10.75V1.61364H624.114C626.841 1.61364 628.227 3.34091 628.227 6.15909C628.227 9 626.841 10.75 623.954 10.75H621.864ZM652.709 4H654.163C653.732 1.75 651.845 0.204545 649.391 0.204545C646.408 0.204545 644.3 2.5 644.3 6.18182C644.3 9.86364 646.391 12.1591 649.482 12.1591C652.254 12.1591 654.232 10.3125 654.232 7.43182V6.18182H649.8V7.43182H652.868C652.828 9.52273 651.453 10.8409 649.482 10.8409C647.323 10.8409 645.663 9.20455 645.663 6.18182C645.663 3.15909 647.323 1.52273 649.391 1.52273C651.073 1.52273 652.215 2.47159 652.709 4ZM669.445 12H676.559V10.75H670.854V6.79545H676.104V5.54545H670.854V1.61364H676.468V0.363636H669.445V12Z" fill="url(#paint6_linear)"/>
<defs>
<filter id="filter0_b" x="-6" y="89" width="828" height="89" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feGaussianBlur in="BackgroundImage" stdDeviation="3"/>
<feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_backgroundBlur" result="shape"/>
</filter>
<linearGradient id="paint0_linear" x1="408" y1="67" x2="408" y2="193.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="408" y1="67" x2="408" y2="193.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint2_linear" x1="408" y1="67" x2="408" y2="193.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint3_linear" x1="408" y1="67" x2="408" y2="193.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint4_linear" x1="408" y1="67" x2="408" y2="193.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint5_linear" x1="408" y1="67" x2="408" y2="193.791" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#010202" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint6_linear" x1="132.986" y1="16" x2="708.028" y2="16" gradientUnits="userSpaceOnUse">
<stop offset="0.130208" stop-color="#DC1FFF"/>
<stop offset="0.5" stop-color="#4DA9FF"/>
<stop offset="0.885417" stop-color="#00CC82"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -0,0 +1,97 @@
<svg viewBox="0 0 1420 862" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_f)">
<ellipse cx="711.5" cy="366.5" rx="277.5" ry="207.5" fill="url(#paint0_radial)"/>
</g>
<g style="mix-blend-mode:color-dodge" opacity="0.2" filter="url(#filter1_f)">
<ellipse rx="1023.46" ry="103.62" transform="matrix(1 -1.74846e-07 -1.74846e-07 -1 814.464 406.62)" fill="url(#paint1_linear)"/>
</g>
<g filter="url(#filter2_f)">
<ellipse cx="1494.5" cy="280.5" rx="377.5" ry="366.5" fill="url(#paint2_radial)" fill-opacity="0.2"/>
</g>
<g filter="url(#filter3_f)">
<ellipse cx="454.5" cy="-155.5" rx="606.5" ry="588.5" fill="url(#paint3_radial)" fill-opacity="0.2"/>
</g>
<circle cx="157" cy="339" r="1" fill="#2F506F"/>
<circle cx="507" cy="505" r="1" fill="#2F506F"/>
<circle cx="1125" cy="505" r="1" fill="#2F506F"/>
<circle cx="923" cy="155" r="1" fill="#2F506F"/>
<circle cx="1286" cy="596" r="1" fill="#7BA4C7"/>
<circle cx="433" cy="106" r="1" fill="#7BA4C7"/>
<circle cx="513" cy="792" r="1" fill="#7BA4C7"/>
<circle cx="1343" cy="114" r="1" fill="#7BA4C7"/>
<circle cx="31" cy="694" r="1" fill="#D1D7DC"/>
<circle cx="1204" cy="274" r="1" fill="#D1D7DC"/>
<circle cx="409" cy="188" r="1" fill="#D1D7DC"/>
<circle cx="1165" cy="110" r="1" fill="#D1D7DC"/>
<circle cx="862.5" cy="162.5" r="0.5" fill="white"/>
<circle cx="286.5" cy="264.5" r="0.5" fill="white"/>
<circle cx="529.5" cy="142.5" r="0.5" fill="white"/>
<circle cx="545.5" cy="172.5" r="0.5" fill="white"/>
<circle cx="1062.5" cy="831.5" r="0.5" fill="white"/>
<circle cx="795.5" cy="226.5" r="0.5" fill="white"/>
<circle cx="954.5" cy="517.5" r="0.5" fill="#547595"/>
<circle cx="212.5" cy="668.5" r="0.5" fill="#547595"/>
<circle cx="235.5" cy="407.5" r="0.5" fill="#547595"/>
<circle cx="1100.5" cy="319.5" r="0.5" fill="#2F506F"/>
<circle cx="1272.5" cy="472.5" r="0.5" fill="#2F506F"/>
<circle cx="591.5" cy="192.5" r="0.5" fill="#2F506F"/>
<circle cx="657.5" cy="115.5" r="0.5" fill="#2F506F"/>
<circle cx="272.5" cy="678.5" r="0.5" fill="#2F506F"/>
<circle cx="1199.5" cy="131.5" r="0.5" fill="#2F506F"/>
<circle cx="1334.5" cy="861.5" r="0.5" fill="#2F506F"/>
<circle cx="46.5" cy="254.5" r="0.5" fill="#2F506F"/>
<circle cx="280.5" cy="255.5" r="0.5" fill="#2F506F"/>
<circle cx="898.5" cy="255.5" r="0.5" fill="#2F506F"/>
<circle cx="539.5" cy="163.5" r="0.5" fill="#2F506F"/>
<circle cx="319.5" cy="278.5" r="0.5" fill="#193650"/>
<circle cx="562.5" cy="156.5" r="0.5" fill="#193650"/>
<circle cx="953.5" cy="308.5" r="0.5" fill="#193650"/>
<circle cx="271.5" cy="298.5" r="0.5" fill="#193650"/>
<circle cx="514.5" cy="176.5" r="0.5" fill="#193650"/>
<circle cx="905.5" cy="328.5" r="0.5" fill="#193650"/>
<circle cx="295.5" cy="262.5" r="0.5" fill="#193650"/>
<circle cx="913.5" cy="262.5" r="0.5" fill="#193650"/>
<circle cx="554.5" cy="170.5" r="0.5" fill="#193650"/>
<circle cx="1309.5" cy="168.5" r="0.5" fill="#193650"/>
<circle cx="489.5" cy="560.5" r="0.5" fill="white"/>
<circle cx="645.5" cy="636.5" r="0.5" fill="white"/>
<defs>
<filter id="filter0_f" x="404" y="129" width="615" height="475" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="15" result="effect1_foregroundBlur"/>
</filter>
<filter id="filter1_f" x="-409" y="103" width="2446.93" height="607.24" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="100" result="effect1_foregroundBlur"/>
</filter>
<filter id="filter2_f" x="1087" y="-116" width="815" height="793" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="15" result="effect1_foregroundBlur"/>
</filter>
<filter id="filter3_f" x="-182" y="-774" width="1273" height="1237" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="15" result="effect1_foregroundBlur"/>
</filter>
<radialGradient id="paint0_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(711.132 366.217) rotate(89.8986) scale(207.783 277.879)">
<stop stop-opacity="0.6"/>
<stop offset="1" stop-opacity="0"/>
</radialGradient>
<linearGradient id="paint1_linear" x1="348" y1="103.62" x2="873.182" y2="675.081" gradientUnits="userSpaceOnUse">
<stop stop-color="#E500FF"/>
<stop offset="0.582233"/>
<stop offset="1" stop-color="#42FF00"/>
</linearGradient>
<radialGradient id="paint2_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(1494.5 280.5) rotate(90) scale(366.5 377.5)">
<stop stop-color="#0000FF"/>
<stop offset="1" stop-color="#0000FF" stop-opacity="0"/>
</radialGradient>
<radialGradient id="paint3_radial" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(453.697 -156.303) rotate(89.9219) scale(589.303 607.328)">
<stop stop-color="#DC1FFF"/>
<stop offset="1" stop-color="#09020C" stop-opacity="0"/>
</radialGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,3 @@
<svg width="404" height="70" viewBox="0 0 404 70" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M35.4559 1C30.4167 1 25.584 3.00178 22.0208 6.56497L7.02082 21.565C-0.399147 28.9849 -0.399146 41.0151 7.02081 48.435L22.0208 63.4351C25.584 66.9983 30.4167 69 35.4559 69L368.544 69C373.583 69 378.416 66.9982 381.979 63.435L396.979 48.435C404.399 41.0151 404.399 28.9849 396.979 21.565L381.979 6.56497C378.416 3.00178 373.583 1 368.544 1H35.4559Z" fill="#06101A" stroke="#193650" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 513 B

View File

@ -0,0 +1,3 @@
<svg width="157" height="56" viewBox="0 0 157 56" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.52724e-05 28C1.13148e-05 12.536 12.536 1.14574e-06 28 2.55909e-06L128.279 1.17242e-05C131.483 1.2017e-05 134.554 1.28125 136.808 3.55835L152.644 19.5583C157.273 24.2345 157.273 31.7655 152.644 36.4417L136.808 52.4417C134.554 54.7188 131.483 56 128.279 56L28 56C12.536 56 3.92299e-05 43.464 2.52724e-05 28Z" fill="#0D1B28"/>
</svg>

After

Width:  |  Height:  |  Size: 441 B

View File

@ -140,10 +140,6 @@ em {
padding: 6px 16px !important;
}
.ant-table {
margin: 0px 30px;
}
.ant-menu-inline-collapsed > .ant-menu-item {
padding-left: 16px !important;
}

View File

@ -1,5 +1,22 @@
@import "_colors";
.app-left {
header.ant-layout-header.App-Bar {
position: absolute;
width: 100%;
background: transparent;
display: flex;
justify-content: center;
height: 80px;
.nav-burger {
cursor: pointer;
display: none;
}
}
.app-bar-item.logo {
position: absolute;
left: 10%;
}
@ -12,6 +29,7 @@
min-width: 50%;
justify-content: center;
height: auto;
align-items: center;
.app-bar-item {
cursor: pointer;
padding: 0 30px;
@ -25,3 +43,57 @@
}
}
}
@media screen and (min-width: 901px) {
header.ant-layout-header.App-Bar {
width: 100% !important;
}
}
@media screen and (max-width: 1200px) {
.app-bar-item.logo {
position: relative;
left: 0;
}
.app-bar-item.app-right{
position: relative;
left: 0;
padding: 0;
}
}
@media screen and (max-width: 900px) {
header.ant-layout-header.App-Bar {
position: fixed;
transition: ease-in-out 0.5s;
width: 0;
max-width: 240px;
height: 100%;
flex-direction: column;
justify-content: flex-start;
padding: 0;
.nav-burger {
display: inline-block;
left: 30px;
position: relative;
transition: ease-in-out 0.5s;
z-index: 10;
}
.app-bar-inner {
//opacity: 0;
left: -100px;
position: relative;
transition: ease-in-out 0.5s;
flex-direction: column;
}
background: #06101a;
& > .nav-burger.mobile-active {
width: 30px;
position: relative;
left: 0;
}
.app-bar-inner.mobile-active {
left: 0px;
}
}
}

View File

@ -1,8 +1,17 @@
import React, { useCallback } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import './index.less';
import { Link, useLocation } from 'react-router-dom';
import {
MenuFoldOutlined,
MenuUnfoldOutlined,
SettingOutlined,
} from '@ant-design/icons';
import { Button, Popover } from 'antd';
import { LABELS } from '../../constants';
import { Settings } from '@oyster/common';
export const AppBar = () => {
export const AppBar = (props: { isRoot?: boolean }) => {
const [showMobileMenu, setShowMobileMenu] = useState<boolean>(false);
const location = useLocation();
const isActiveClass = useCallback(
@ -12,16 +21,62 @@ export const AppBar = () => {
[location],
);
useEffect(() => {
const header = document.getElementById('app-header');
if (header) {
header.style.width = showMobileMenu ? '100%' : '0';
}
}, [showMobileMenu, document.body.offsetWidth]);
return (
<div className={'app-bar-inner'}>
<div className={`app-bar-item ${isActiveClass('move')}`}>
<Link to="/move">Bridge</Link>
<>
<span
className={`nav-burger ${showMobileMenu ? 'mobile-active' : ''}`}
onClick={() => setShowMobileMenu(!showMobileMenu)}
>
{showMobileMenu ? (
<MenuFoldOutlined style={{ fontSize: '25px' }} />
) : (
<MenuUnfoldOutlined style={{ fontSize: '25px' }} />
)}
</span>
<div className={`app-bar-inner ${showMobileMenu ? 'mobile-active' : ''}`}>
{!props.isRoot && (
<div className={`app-bar-item logo root-mobile`}>
<Link to="/">
<img alt="logo-bar" src={'/appbar/logo.svg'} />
</Link>
</div>
)}
<div className={`app-bar-item ${isActiveClass('move')}`}>
<Link to="/move">Bridge</Link>
</div>
<div className={`app-bar-item ${isActiveClass('faq')}`}>
<Link to="/faq">FAQ</Link>
</div>
<div className={`app-bar-item ${isActiveClass('proof-of-assets')}`}>
<Link to="/proof-of-assets">Proof-of-Assets</Link>
</div>
<div className={`app-bar-item ${isActiveClass('help')}`}>
<Link to="/help">Help</Link>
</div>
{!props.isRoot && (
<Popover
placement="topRight"
title={LABELS.SETTINGS_TOOLTIP}
content={<Settings />}
trigger="click"
>
<Button
className={'app-right app-bar-item'}
shape="circle"
size="large"
type="text"
icon={<SettingOutlined />}
/>
</Popover>
)}
</div>
<div className={`app-bar-item ${isActiveClass('faq')}`}>FAQ</div>
<div className={`app-bar-item ${isActiveClass('poassets')}`}>
Proof-of-Assets
</div>
<div className={`app-bar-item ${isActiveClass('help')}`}>Help</div>
</div>
</>
);
};

View File

@ -0,0 +1,58 @@
@import "_colors";
.ant-btn-group.ant-dropdown-button {
button {
text-transform: uppercase;
color: white;
background: #E67828;
//border-radius: 8px;
height: 40px;
}
button:first-child {
width: 134px;
border-bottom-left-radius: 8px !important;
border-top-left-radius: 8px !important;
}
button:last-child {
border-bottom-right-radius: 8px !important;
border-top-right-radius: 8px !important;
}
}
.eth-connect {
display: flex;
justify-content: center;
& > button {
color: white;
background: #E67828;
border-radius: 8px;
height: 40px;
width: 166px;
}
.eth-address {
position: relative;
width: 183px;
height: 48px;
background: @tungsten-100;
border: 2px solid #193650;
box-sizing: border-box;
border-radius: 8px;
font-size: 16px;
line-height: 21px;
color: #03E1FF;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.disconnect {
cursor: pointer;
color: #193650;
font-size: 16px;
&:hover {
transform: scale(1.3);
transition: ease-out 0.5s;
}
}
}

View File

@ -1,5 +1,6 @@
import React from 'react';
import { Button, Dropdown, Menu } from 'antd';
import './index.less';
import { useCorrectNetwork } from '../../hooks/useCorrectNetwork';
import { shortenAddress } from '@oyster/common';
@ -12,6 +13,7 @@ export const EthereumConnect = () => {
connected,
walletProvider,
select,
disconnect,
} = useEthereum();
const { hasCorrespondingNetworks } = useCorrectNetwork();
@ -24,10 +26,10 @@ export const EthereumConnect = () => {
);
return (
<div style={{ marginRight: 8 }}>
<div className={'eth-connect'}>
{connected ? (
hasCorrespondingNetworks ? (
<>
<div className={'eth-address'}>
<img
alt={'ethereum-icon'}
width={20}
@ -36,7 +38,10 @@ export const EthereumConnect = () => {
src={walletProvider.icon}
/>
{shortenAddress(accounts[0], 4)}
</>
<span className={'disconnect'} onClick={() => disconnect()}>
X
</span>
</div>
) : (
<Button danger type={'primary'}>
WRONG NETWORK
@ -47,11 +52,11 @@ export const EthereumConnect = () => {
onClick={() => onConnectEthereum && onConnectEthereum()}
overlay={menu}
>
Connect Ethereum
CONNECT
</Dropdown.Button>
) : (
<Button onClick={() => onConnectEthereum && onConnectEthereum()}>
Connect Ethereum
CONNECT WALLET
</Button>
)}
</div>

View File

@ -1,9 +1,18 @@
import React, { useState } from 'react';
import { NumericInput } from '@oyster/common';
import { Card } from 'antd';
import React, { useEffect, useState } from 'react';
import {
ConnectButton,
CurrentUserWalletBadge,
NumericInput,
useMint,
useUserAccounts,
useWallet,
} from '@oyster/common';
import './style.less';
import { ASSET_CHAIN } from '../../models/bridge/constants';
import { TokenSelectModal } from '../TokenSelectModal';
import { chainToName } from '../../utils/assets';
import { TokenChain } from '../TokenDisplay/tokenChain';
import { EthereumConnect } from '../EthereumConnect';
export function Input(props: {
title: string;
@ -14,34 +23,58 @@ export function Input(props: {
amount?: number | null;
onChain: (chain: ASSET_CHAIN) => void;
onInputChange: (value: number | undefined) => void;
className?: string;
}) {
const { connected } = useWallet();
const [lastAmount, setLastAmount] = useState<string>('');
const { userAccounts } = useUserAccounts();
const [balance, setBalance] = useState<number>(0);
const mint = useMint(props.asset?.startsWith('0x') ? '' : props.asset);
useEffect(() => {
if (props.chain === ASSET_CHAIN.Solana) {
const currentAccount = userAccounts?.find(
a => a.info.mint.toBase58() === props.asset,
);
if (currentAccount && mint) {
setBalance(
currentAccount.info.amount.toNumber() / Math.pow(10, mint.decimals),
);
} else {
setBalance(0);
}
}
}, [props.asset, props.chain, userAccounts, mint]);
return (
<Card
className="ccy-input from-input"
style={{ borderRadius: 20 }}
bodyStyle={{ padding: 0 }}
>
<div className="ccy-input-header">
<div className="ccy-input-header-left">{props.title}</div>
{!!props.balance && (
<div className={`dashed-input-container ${props.className}`}>
<div className="input-header">{props.title}</div>
<div className="input-chain">
<TokenChain chain={props.chain} className={'input-icon'} />
{chainToName(props.chain)}
{props.chain !== ASSET_CHAIN.Solana ? (
typeof props.balance === 'number' && (
<div
className="balance"
onClick={() =>
props.onInputChange && props.onInputChange(props.balance)
}
>
{props.balance.toFixed(10)}
</div>
)
) : (
<div
className="ccy-input-header-right"
onClick={() =>
props.onInputChange && props.onInputChange(props.balance)
}
className="balance"
onClick={() => props.onInputChange && props.onInputChange(balance)}
>
Balance: {props.balance.toFixed(6)}
{balance.toFixed(10)}
</div>
)}
</div>
<div
className="ccy-input-header"
style={{ padding: '0px 10px 5px 7px', height: 80 }}
>
<div className="input-container">
<NumericInput
className={'input'}
value={
parseFloat(lastAmount || '0.00') === props.amount
? lastAmount
@ -55,22 +88,29 @@ export function Input(props: {
setLastAmount(val);
}}
style={{
fontSize: 24,
boxShadow: 'none',
borderColor: 'transparent',
outline: 'transparent',
}}
placeholder="0.00"
/>
<div className="ccy-input-header-right" style={{ display: 'flex' }}>
<div className="input-select">
<TokenSelectModal
onSelectToken={token => props.setAsset(token)}
onChain={(chain: ASSET_CHAIN) => props.onChain(chain)}
asset={props.asset}
chain={props.chain}
showIconChain={false}
/>
</div>
</div>
</Card>
{props.chain === ASSET_CHAIN.Ethereum ? (
<EthereumConnect />
) : connected ? (
<CurrentUserWalletBadge showDisconnect={true} />
) : (
<ConnectButton type="text" size="large" allowWalletChange={true} />
)}
</div>
);
}

View File

@ -1,3 +1,5 @@
@import "_colors";
.multichain-option {
display: flex;
align-items: center;
@ -95,3 +97,119 @@
.ant-select-dropdown {
width: 150px !important;
}
.dashed-input-container {
width: 342px;
height: 342px;
border: 4px dotted;
border-radius: 50%;
box-sizing: border-box;
&.left {
border-color: #6E1080;
}
&.right {
border-color: #008051;
}
.input-header{
margin-top: 26px;
display: block;
text-align: center;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 21px;
color: @tungsten-40;
}
.input-chain{
margin-top: 13px;
font-style: normal;
font-weight: normal;
font-size: 20px;
line-height: 24px;
.input-icon {
margin-right: 10px;
}
.balance {
margin-top: 22px;
font-size: 12px;
line-height: 16px;
color: @tungsten-60
}
}
.input-container{
position: relative;
margin: 16px -36px 34px -36px ;
height: 66px;
background-image: url('/transfer/input.svg');
background-size: 100% 66px;
background-repeat: no-repeat;
input.input {
padding: 0 36px 0 36px;
font-size: 32px;
line-height: 39px;
color: @tungsten-80;
height: 100%;
}
.input-select {
display: flex;
align-content: center;
flex-direction: row;
position: absolute;
right: 11px;
top: 7px;
height: 52px;
width: 161px;
padding: 0 19px;
background-image: url(/transfer/select-bg.svg);
background-size: 100% 52px;
background-repeat: no-repeat;
.token-chain-logo {
position: relative;
width: auto;
height: auto;
display: flex;
}
.token-logo {
width: 32px;
height: 32px;
}
}
}
}
.wallet-wrapper {
display: flex;
justify-content: center;
padding: 0;
.wallet-key {
position: relative;
width: 183px;
height: 48px;
background: @tungsten-100;
border: 2px solid #193650;
box-sizing: border-box;
border-radius: 8px;
padding: 0;
margin: 0;
font-size: 16px;
line-height: 21px;
color: #03E1FF;
display: flex;
justify-content: space-evenly;
align-items: center;
.disconnect {
cursor: pointer;
color: #193650;
font-size: 16px;
&:hover {
transform: scale(1.3);
transition: ease-out 0.5s;
}
}
}
}

View File

@ -1,63 +1,24 @@
import React, { useEffect, useState } from 'react';
import React from 'react';
import './../../App.less';
import './index.less';
import { Layout, Button, Popover } from 'antd';
import { Link, useLocation } from 'react-router-dom';
import { Layout } from 'antd';
import { useLocation } from 'react-router-dom';
import { LABELS } from '../../constants';
import { AppBar } from '../AppBar';
import Wormhole from '../Wormhole';
import { Footer as AppFooter } from './../Footer';
import { EthereumConnect } from '../EthereumConnect';
import { useEthereum } from '../../contexts';
import { Settings } from '@oyster/common';
import { SettingOutlined } from '@ant-design/icons';
const { Header, Content, Footer } = Layout;
export const AppLayout = React.memo((props: any) => {
const { connected, disconnect } = useEthereum();
const location = useLocation();
const [wormholeReady, setWormholeReady] = useState(false);
const paths: { [key: string]: string } = {
'/faucet': '7',
};
const isRoot = location.pathname === '/';
const current =
[...Object.keys(paths)].find(key => location.pathname.startsWith(key)) ||
'';
return (
<>
<div className={`App`}>
<Layout title={LABELS.APP_TITLE}>
<Header className="App-Bar">
{!isRoot && (
<div className="app-title app-left">
<Link to="/">
<img src={'/appbar/logo.svg'} />
</Link>
</div>
)}
<AppBar />
{!isRoot && (
<Popover
placement="topRight"
title={LABELS.SETTINGS_TOOLTIP}
content={<Settings />}
trigger="click"
>
<Button
className={'app-right'}
shape="circle"
size="large"
type="text"
icon={<SettingOutlined />}
/>
</Popover>
)}
<Header className="App-Bar" id={'app-header'}>
<AppBar isRoot={isRoot} />
</Header>
<Content style={{ flexDirection: 'column' }}>
{props.children}

View File

@ -0,0 +1,54 @@
@import "_colors";
#recent-tx-container {
max-width: 70%;
margin: auto;
padding-bottom: 70px;
.completed {
color: @surge-30;
}
.failed {
color: @tungsten-60;
}
.error {
color: #6E1080;
}
.description-text {
color: @tungsten-60
}
.ant-table-pagination.ant-pagination {
margin: 16px 100px;
}
.ant-table {
thead {
tr > th.ant-table-cell {
background-color: @tungsten-100;
border: none;
}
}
tbody > tr:nth-child(even) > td.ant-table-cell {
background-color: @tungsten-100;
border: none;
}
tbody > tr:nth-child(odd) > td.ant-table-cell {
background-color: @tungsten-50;
border: none;
}
}
}
@media screen and (max-width: 900px) {
#recent-tx-container {
max-width: 100%;
}
}
@media screen and (max-width: 1200px) {
#recent-tx-container {
max-width: 90%;
}
}

View File

@ -0,0 +1,169 @@
import { Table } from 'antd';
import React from 'react';
import './index.less';
import TimeAgo from 'javascript-time-ago';
import en from 'javascript-time-ago/locale/en';
import { Link } from 'react-router-dom';
import { TokenDisplay } from '../../components/TokenDisplay';
import { toChainSymbol } from '../../contexts/chainPair';
import {
formatUSD,
shortenAddress,
EtherscanLink,
ExplorerLink,
Identicon,
} from '@oyster/common';
import { useWormholeTransactions } from '../../hooks/useWormholeTransactions';
import { ASSET_CHAIN } from '../../utils/assets';
import { TokenChain } from '../TokenDisplay/tokenChain';
import bs58 from 'bs58';
TimeAgo.addDefaultLocale(en);
const timeAgo = new TimeAgo('en-US');
export const RecentTransactionsTable = () => {
const { loading: loadingTransfers, transfers } = useWormholeTransactions();
const columns = [
{
title: '',
dataIndex: 'logo',
key: 'logo',
render(text: string, record: any) {
return {
props: { style: {} },
children: record.logo ? (
<Link
to={`/move?from=${toChainSymbol(record.chain)}&token=${
record.symbol
}`}
>
<span style={{ display: 'inline-flex', alignItems: 'center' }}>
{record.logo && (
<TokenDisplay logo={record.logo} chain={record.chain} />
)}
</span>
</Link>
) : (
<div className="token-chain-logo">
<Identicon
style={{ width: '50' }}
address={
record.chain === ASSET_CHAIN.Solana
? record.address
: bs58.encode(Buffer.from(record.address))
}
/>
<TokenChain chain={record.chain} className={'chain-logo'} />
</div>
),
};
},
},
{
title: 'Asset',
dataIndex: 'symbol',
key: 'symbol',
render(text: string, record: any) {
return {
props: { style: {} },
children: record.symbol ? (
<Link
to={`/move?from=${toChainSymbol(record.chain)}&token=${
record.symbol
}`}
>
<span style={{ display: 'inline-flex', alignItems: 'center' }}>
{record.symbol}
</span>
</Link>
) : record.lockup.assetChain === ASSET_CHAIN.Solana ? (
<ExplorerLink
address={record.address}
length={5}
type={'address'}
/>
) : (
<EtherscanLink
address={record.address}
type={'address'}
length={5}
/>
),
};
},
},
{
title: 'Tokens moved',
dataIndex: 'amount',
key: 'amount',
},
{
title: '$, value',
dataIndex: 'value',
key: 'value',
render(text: string, record: any) {
return {
props: { style: {} },
children: record.value ? formatUSD.format(record.value) : '--',
};
},
},
{
title: 'TX hash',
dataIndex: 'txhash',
key: 'txhash',
render(text: string, record: any) {
return {
props: { style: {} },
children: (
<a href={record.explorer} target="_blank" rel="noopener noreferrer">
{shortenAddress(text, 6)}
</a>
),
};
},
},
{
title: 'Date',
dataIndex: 'date',
key: 'date',
render(text: string, record: any) {
return {
props: { style: {} },
children: timeAgo.format(new Date(record.date * 1000)),
};
},
},
{
title: 'Status',
dataIndex: 'status',
key: 'status',
render(text: string, record: any) {
return {
props: { style: {} },
children: <span className={`${record.status?.toLowerCase()}`}>{record.status}</span>,
};
},
},
];
return (
<div id={'recent-tx-container'}>
<div className={'home-subtitle'} style={{ marginBottom: '70px' }}>
Recent Transactions
</div>
<Table
scroll={{
scrollToFirstRowOnChange: false,
x: 900,
}}
dataSource={transfers.sort((a, b) => b.date - a.date)}
columns={columns}
loading={loadingTransfers}
/>
</div>
);
};

View File

@ -5,6 +5,7 @@ import React from 'react';
import { useEthereum } from '../../contexts';
import { ASSET_CHAIN } from '../../models/bridge/constants';
import './style.less';
import { TokenChain } from './tokenChain';
export const TokenDisplay = ({
asset,
@ -20,15 +21,7 @@ export const TokenDisplay = ({
return (
<div className="token-chain-logo">
<img className="token-logo" alt="" src={logo || token?.logoURI} />
<img
className="chain-logo"
alt=""
src={
chain === ASSET_CHAIN.Ethereum
? '/blockchains/ETH.svg'
: '/blockchains/solana.webp'
}
/>
{chain && <TokenChain chain={chain} className={'chain-logo'} />}
</div>
);
};

View File

@ -3,6 +3,12 @@
width: 60px;
height: 60px;
display: flex;
.chain-logo {
position: absolute;
bottom: 3px;
right: 3px;
}
}
.token-logo {
@ -16,10 +22,8 @@
.chain-logo {
border: 1px solid hsla(0, 0%, 50.2%, 0.5);
border-radius: 20px;
position: absolute;
background: #fff;
width: 30px;
height: 30px;
bottom: 3px;
right: 3px;
}

View File

@ -0,0 +1,20 @@
import React from 'react';
import { ASSET_CHAIN } from '../../models/bridge/constants';
export const TokenChain = (props: {
chain?: ASSET_CHAIN;
className?: string;
}) => {
const { chain, className } = props;
return (
<img
className={`chain-logo ${className}`}
alt=""
src={
chain === ASSET_CHAIN.Ethereum
? '/blockchains/ETH.svg'
: '/blockchains/solana.webp'
}
/>
);
};

View File

@ -15,6 +15,7 @@ export const TokenSelectModal = (props: {
onChain: (chain: ASSET_CHAIN) => void;
asset?: string;
chain?: ASSET_CHAIN;
showIconChain?: boolean;
}) => {
const { tokens: ethTokens } = useEthereum();
const { tokens: solTokens } = useConnectionConfig();
@ -110,9 +111,11 @@ export const TokenSelectModal = (props: {
<TokenDisplay
asset={props.asset}
token={firstToken}
chain={props.chain}
chain={props.showIconChain ? props.chain : undefined}
/>
</div>
<div className={'multichain-option-symbol'}>{firstToken.symbol}</div>
<span className={'down-arrow'}></span>
</div>
) : null}
<Modal

View File

@ -1,3 +1,4 @@
@import "_colors";
.input-token-search {
margin: 20px 0 20px 0;
}
@ -31,4 +32,20 @@
.ReactVirtualized__Grid.ReactVirtualized__List:focus {
outline: none !important;
}
}
.multichain-option {
.multichain-option-symbol {
margin-left: 10px;
font-style: normal;
font-weight: 500;
font-size: 16px;
line-height: 21px;
color: @tungsten-60;
}
.down-arrow{
margin-left: 10px;
width: 15px;
height: 11px;
}
}

View File

@ -1,35 +1,23 @@
import React, { useEffect, useState } from 'react';
import { notification, Spin, Button } from 'antd';
import {
contexts,
ConnectButton,
programIds,
notify,
cache,
useUserAccounts,
} from '@oyster/common';
import { contexts } from '@oyster/common';
import { Input } from '../Input';
import './style.less';
import { ASSET_CHAIN, chainToName } from '../../utils/assets';
import {
bridgeAuthorityKey,
displayBalance,
fromSolana,
ProgressUpdate,
toSolana,
TransferRequest,
wrappedAssetMintKey,
} from '../../models/bridge';
import { useEthereum } from '../../contexts';
import { TokenDisplay } from '../TokenDisplay';
import { WrappedAssetFactory } from '../../contracts/WrappedAssetFactory';
import { WormholeFactory } from '../../contracts/WormholeFactory';
import BN from 'bn.js';
import { useTokenChainPairState } from '../../contexts/chainPair';
import { LABELS } from '../../constants';
import { useCorrectNetwork } from '../../hooks/useCorrectNetwork';
import { BigNumber } from 'ethers/utils';
import { RecentTransactionsTable } from '../RecentTransactionsTable';
const { useConnection } = contexts.Connection;
const { useWallet } = contexts.Wallet;
@ -52,7 +40,7 @@ export const typeToIcon = (type: string, isLast: boolean) => {
export const Transfer = () => {
const connection = useConnection();
const { wallet } = useWallet();
const { wallet, connected } = useWallet();
const { provider, tokenMap } = useEthereum();
const hasCorrespondingNetworks = useCorrectNetwork();
const {
@ -95,7 +83,7 @@ export const Transfer = () => {
<>
<div className="exchange-card">
<Input
title={`From ${chainToName(request.from)}`}
title={`From`}
asset={request.asset}
balance={displayBalance(A.info)}
setAsset={asset => setAssetInformation(asset)}
@ -110,6 +98,7 @@ export const Transfer = () => {
setLastTypedAccount(A.chain);
A.setAmount(amount || 0);
}}
className={'left'}
/>
<Button
type="primary"
@ -125,10 +114,10 @@ export const Transfer = () => {
}
}}
>
<span></span>
</Button>
<Input
title={`To ${chainToName(request.to)}`}
title={`To`}
asset={request.asset}
balance={displayBalance(B.info)}
setAsset={asset => setAssetInformation(asset)}
@ -143,13 +132,15 @@ export const Transfer = () => {
setLastTypedAccount(B.chain);
B.setAmount(amount || 0);
}}
className={'right'}
/>
</div>
<ConnectButton
<Button
className={'transfer-button'}
type="primary"
size="large"
style={{ width: '100%' }}
disabled={!(A.amount && B.amount)}
disabled={!(A.amount && B.amount) || !connected || !provider}
onClick={async () => {
if (!wallet || !provider) {
return;
@ -201,8 +192,9 @@ export const Transfer = () => {
},
);
}
} catch {
} catch (err) {
// TODO...
console.log(err);
}
})();
}, [setActiveSteps]);
@ -287,7 +279,8 @@ export const Transfer = () => {
? LABELS.ENTER_AMOUNT
: LABELS.TRANSFER
: LABELS.SET_CORRECT_WALLET_NETWORK}
</ConnectButton>
</Button>
<RecentTransactionsTable />
</>
);
};

View File

@ -1,18 +1,97 @@
@import "_colors";
.input-card {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 10px;
}
.flexColumn:not(.home-container) {
background: @tungsten-100;
}
.swap-button {
border-radius: 2em;
width: 40px;
height: 40px;
font-size: 20px;
font-weight: bold;
padding-left: 8px;
font-size: 19px;
top: 253px;
color: black;
& > span:after {
content: '⇆';
padding-left: 0;
}
}
.exchange-card {
position: relative;
max-width: calc(100% - 460px);
width: 100%;
margin: 167px auto 150px auto;
display: flex;
justify-content: space-between;
}
.transfer-button{
display: flex;
position: absolute;
width: 240px;
height: 64px;
left: calc(50% - 240px/2);
top: 555px;
border-radius: 12px;
border: none;
align-items: center;
justify-content: center;
background: @surge-20;
color: white;
font-weight: bold;
font-size: 18px;
line-height: 23px;
text-align: center;
letter-spacing: 0.04em;
text-transform: uppercase;
font-feature-settings: 'ss02' on;
&:disabled{
background: @tungsten-50;
color: #193650;
}
}
div:not(.home-container) {
& > #recent-tx-container{
width: 100%;
max-width: calc(100% - 388px);
margin: auto;
}
}
@media screen and (max-width: 1200px){
.exchange-card {
height: 770px;
width: 100%;
margin: 97px auto 0 auto;
justify-content: space-between;
flex-direction: column;
align-items: center;
}
.transfer-button {
display: flex;
position: relative;
width: 240px;
height: 64px;
left: calc(50% - 240px/2);
top: 30px;
margin-bottom: 100px;
}
.swap-button {
top: 0;
}
div:not(.home-container) > #recent-tx-container {
max-width: calc(100% - 100px);
}
.swap-button {
& > span:after {
content: "⇅";
}
}
}

View File

@ -13,12 +13,15 @@ export const BridgeProvider: FunctionComponent = ({ children }) => {
const connection = useConnection();
const programs = utils.programIds();
/// let bridge = new SolanaBridge(endpoint, connection, programs.wormhole.pubkey, programs.token);
let bridge = new SolanaBridge(
endpoint,
connection,
programs.wormhole.pubkey,
programs.token,
);
return (
<BridgeContext.Provider value={undefined}>
{children}
</BridgeContext.Provider>
<BridgeContext.Provider value={bridge}>{children}</BridgeContext.Provider>
);
};

View File

@ -110,7 +110,7 @@ export const useCurrencyLeg = (mintAddress: string) => {
// sol asset on eth chain
// sol asset on sol chain
let ethAddress: string = '';
//let ethAddress: string = '';
if (solToken) {
// let signer = provider.getSigner();
// let e = WrappedAssetFactory.connect(asset, provider);
@ -249,7 +249,7 @@ export function TokenChainPairProvider({ children = null as any }) {
return;
}
let { defaultChain, defaultToken } = getDefaultTokens(
ethTokens,
tokens,
location.search,
);
if (!defaultToken || !defaultChain) {
@ -269,15 +269,7 @@ export function TokenChainPairProvider({ children = null as any }) {
);
// mintAddressA and mintAddressB are not included here to prevent infinite loop
// eslint-disable-next-line
}, [
location,
location.search,
location.pathname,
setMintAddress,
tokens,
setChainA,
setChainB,
]);
}, [location, location.search, location.pathname, tokens]);
const calculateDependent = useCallback(async () => {
if (mintAddress) {

View File

@ -7,13 +7,7 @@ import React, {
useMemo,
useState,
} from 'react';
// @ts-ignore
import { useWallet as useEthereumWallet } from 'use-wallet';
// @ts-ignore
import WalletConnectProvider from '@walletconnect/web3-provider';
// @ts-ignore
import Fortmatic from 'fortmatic';
import { useWallet, useLocalStorageState } from '@oyster/common';
import { WalletAdapter } from '@solana/wallet-base';
import { TokenList, TokenInfo } from '@uniswap/token-lists';

View File

@ -4,22 +4,16 @@ import { Market, MARKETS, Orderbook, TOKEN_MINTS } from '@project-serum/serum';
import { AccountInfo, Connection, PublicKey } from '@solana/web3.js';
import { useMemo } from 'react';
import {
contexts,
utils,
ParsedAccount,
KnownTokenMap,
EventEmitter,
} from '@oyster/common';
import { contexts, utils, EventEmitter } from '@oyster/common';
import { DexMarketParser } from './../models/dex';
import { MINT_TO_MARKET } from '../models/marketOverrides';
const { useConnectionConfig } = contexts.Connection;
const { convert, fromLamports, getTokenName, STABLE_COINS } = utils;
const { STABLE_COINS } = utils;
const { cache, getMultipleAccounts } = contexts.Accounts;
const INITAL_LIQUIDITY_DATE = new Date('2020-10-27');
export const BONFIDA_POOL_INTERVAL = 30 * 60_000; // 30 min
//const INITAL_LIQUIDITY_DATE = new Date('2020-10-27');
//export const BONFIDA_POOL_INTERVAL = 30 * 60_000; // 30 min
interface RecentPoolData {
pool_identifier: string;

600
packages/bridge/src/contracts/ERC20.d.ts vendored Normal file
View File

@ -0,0 +1,600 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, ContractTransaction, EventFilter, Signer } from 'ethers';
import { Listener, Provider } from 'ethers/providers';
import { Arrayish, BigNumber, BigNumberish, Interface } from 'ethers/utils';
import {
TransactionOverrides,
TypedEventDescription,
TypedFunctionDescription,
} from '.';
interface ERC20Interface extends Interface {
functions: {
name: TypedFunctionDescription<{ encode([]: []): string }>;
symbol: TypedFunctionDescription<{ encode([]: []): string }>;
decimals: TypedFunctionDescription<{ encode([]: []): string }>;
totalSupply: TypedFunctionDescription<{ encode([]: []): string }>;
balanceOf: TypedFunctionDescription<{
encode([account]: [string]): string;
}>;
transfer: TypedFunctionDescription<{
encode([recipient, amount]: [string, BigNumberish]): string;
}>;
allowance: TypedFunctionDescription<{
encode([owner, spender]: [string, string]): string;
}>;
approve: TypedFunctionDescription<{
encode([spender, amount]: [string, BigNumberish]): string;
}>;
transferFrom: TypedFunctionDescription<{
encode([sender, recipient, amount]: [
string,
string,
BigNumberish,
]): string;
}>;
increaseAllowance: TypedFunctionDescription<{
encode([spender, addedValue]: [string, BigNumberish]): string;
}>;
decreaseAllowance: TypedFunctionDescription<{
encode([spender, subtractedValue]: [string, BigNumberish]): string;
}>;
};
events: {
Approval: TypedEventDescription<{
encodeTopics([owner, spender, value]: [
string | null,
string | null,
null,
]): string[];
}>;
Transfer: TypedEventDescription<{
encodeTopics([from, to, value]: [
string | null,
string | null,
null,
]): string[];
}>;
};
}
export class ERC20 extends Contract {
connect(signerOrProvider: Signer | Provider | string): ERC20;
attach(addressOrName: string): ERC20;
deployed(): Promise<ERC20>;
on(event: EventFilter | string, listener: Listener): ERC20;
once(event: EventFilter | string, listener: Listener): ERC20;
addListener(eventName: EventFilter | string, listener: Listener): ERC20;
removeAllListeners(eventName: EventFilter | string): ERC20;
removeListener(eventName: any, listener: Listener): ERC20;
interface: ERC20Interface;
functions: {
/**
* Returns the name of the token.
*/
name(overrides?: TransactionOverrides): Promise<string>;
/**
* Returns the name of the token.
*/
'name()'(overrides?: TransactionOverrides): Promise<string>;
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
symbol(overrides?: TransactionOverrides): Promise<string>;
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
'symbol()'(overrides?: TransactionOverrides): Promise<string>;
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
decimals(overrides?: TransactionOverrides): Promise<number>;
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
'decimals()'(overrides?: TransactionOverrides): Promise<number>;
/**
* See {IERC20-totalSupply}.
*/
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* See {IERC20-totalSupply}.
*/
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* See {IERC20-balanceOf}.
*/
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-balanceOf}.
*/
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-allowance}.
*/
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-allowance}.
*/
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-approve}. Requirements: - `spender` cannot be the zero address.
*/
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-approve}. Requirements: - `spender` cannot be the zero address.
*/
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`.
*/
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`.
*/
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.
*/
increaseAllowance(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.
*/
'increaseAllowance(address,uint256)'(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
decreaseAllowance(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
'decreaseAllowance(address,uint256)'(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
};
/**
* Returns the name of the token.
*/
name(overrides?: TransactionOverrides): Promise<string>;
/**
* Returns the name of the token.
*/
'name()'(overrides?: TransactionOverrides): Promise<string>;
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
symbol(overrides?: TransactionOverrides): Promise<string>;
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
'symbol()'(overrides?: TransactionOverrides): Promise<string>;
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
decimals(overrides?: TransactionOverrides): Promise<number>;
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
'decimals()'(overrides?: TransactionOverrides): Promise<number>;
/**
* See {IERC20-totalSupply}.
*/
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* See {IERC20-totalSupply}.
*/
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* See {IERC20-balanceOf}.
*/
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-balanceOf}.
*/
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-allowance}.
*/
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-allowance}.
*/
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-approve}. Requirements: - `spender` cannot be the zero address.
*/
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-approve}. Requirements: - `spender` cannot be the zero address.
*/
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`.
*/
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`.
*/
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.
*/
increaseAllowance(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.
*/
'increaseAllowance(address,uint256)'(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
decreaseAllowance(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
'decreaseAllowance(address,uint256)'(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
filters: {
Approval(
owner: string | null,
spender: string | null,
value: null,
): EventFilter;
Transfer(from: string | null, to: string | null, value: null): EventFilter;
};
estimate: {
/**
* Returns the name of the token.
*/
name(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the name of the token.
*/
'name()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
symbol(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the symbol of the token, usually a shorter version of the name.
*/
'symbol()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
decimals(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is called. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.
*/
'decimals()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* See {IERC20-totalSupply}.
*/
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* See {IERC20-totalSupply}.
*/
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* See {IERC20-balanceOf}.
*/
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-balanceOf}.
*/
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.
*/
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-allowance}.
*/
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-allowance}.
*/
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-approve}. Requirements: - `spender` cannot be the zero address.
*/
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-approve}. Requirements: - `spender` cannot be the zero address.
*/
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`.
*/
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`.
*/
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.
*/
increaseAllowance(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.
*/
'increaseAllowance(address,uint256)'(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
decreaseAllowance(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.
*/
'decreaseAllowance(address,uint256)'(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
};
}

File diff suppressed because one or more lines are too long

View File

@ -1,401 +0,0 @@
/* Generated by ts-generator ver. 0.0.8 */
/* tslint:disable */
import { Contract, ContractTransaction, EventFilter, Signer } from 'ethers';
import { Listener, Provider } from 'ethers/providers';
import { Arrayish, BigNumber, BigNumberish, Interface } from 'ethers/utils';
import {
TransactionOverrides,
TypedEventDescription,
TypedFunctionDescription,
} from '.';
interface Erc20Interface extends Interface {
functions: {
allowance: TypedFunctionDescription<{
encode([owner, spender]: [string, string]): string;
}>;
approve: TypedFunctionDescription<{
encode([spender, amount]: [string, BigNumberish]): string;
}>;
balanceOf: TypedFunctionDescription<{
encode([account]: [string]): string;
}>;
decimals: TypedFunctionDescription<{ encode([]: []): string }>;
decreaseAllowance: TypedFunctionDescription<{
encode([spender, subtractedValue]: [string, BigNumberish]): string;
}>;
increaseAllowance: TypedFunctionDescription<{
encode([spender, addedValue]: [string, BigNumberish]): string;
}>;
name: TypedFunctionDescription<{ encode([]: []): string }>;
symbol: TypedFunctionDescription<{ encode([]: []): string }>;
totalSupply: TypedFunctionDescription<{ encode([]: []): string }>;
transfer: TypedFunctionDescription<{
encode([recipient, amount]: [string, BigNumberish]): string;
}>;
transferFrom: TypedFunctionDescription<{
encode([sender, recipient, amount]: [
string,
string,
BigNumberish,
]): string;
}>;
};
events: {
Approval: TypedEventDescription<{
encodeTopics([owner, spender, value]: [
string | null,
string | null,
null,
]): string[];
}>;
Transfer: TypedEventDescription<{
encodeTopics([from, to, value]: [
string | null,
string | null,
null,
]): string[];
}>;
};
}
export class Erc20 extends Contract {
connect(signerOrProvider: Signer | Provider | string): Erc20;
attach(addressOrName: string): Erc20;
deployed(): Promise<Erc20>;
on(event: EventFilter | string, listener: Listener): Erc20;
once(event: EventFilter | string, listener: Listener): Erc20;
addListener(eventName: EventFilter | string, listener: Listener): Erc20;
removeAllListeners(eventName: EventFilter | string): Erc20;
removeListener(eventName: any, listener: Listener): Erc20;
interface: Erc20Interface;
functions: {
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
decimals(overrides?: TransactionOverrides): Promise<number>;
'decimals()'(overrides?: TransactionOverrides): Promise<number>;
decreaseAllowance(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'decreaseAllowance(address,uint256)'(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
increaseAllowance(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'increaseAllowance(address,uint256)'(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
name(overrides?: TransactionOverrides): Promise<string>;
'name()'(overrides?: TransactionOverrides): Promise<string>;
symbol(overrides?: TransactionOverrides): Promise<string>;
'symbol()'(overrides?: TransactionOverrides): Promise<string>;
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
};
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
decimals(overrides?: TransactionOverrides): Promise<number>;
'decimals()'(overrides?: TransactionOverrides): Promise<number>;
decreaseAllowance(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'decreaseAllowance(address,uint256)'(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
increaseAllowance(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'increaseAllowance(address,uint256)'(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
name(overrides?: TransactionOverrides): Promise<string>;
'name()'(overrides?: TransactionOverrides): Promise<string>;
symbol(overrides?: TransactionOverrides): Promise<string>;
'symbol()'(overrides?: TransactionOverrides): Promise<string>;
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
filters: {
Approval(
owner: string | null,
spender: string | null,
value: null,
): EventFilter;
Transfer(from: string | null, to: string | null, value: null): EventFilter;
};
estimate: {
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
decimals(overrides?: TransactionOverrides): Promise<BigNumber>;
'decimals()'(overrides?: TransactionOverrides): Promise<BigNumber>;
decreaseAllowance(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'decreaseAllowance(address,uint256)'(
spender: string,
subtractedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
increaseAllowance(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'increaseAllowance(address,uint256)'(
spender: string,
addedValue: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
name(overrides?: TransactionOverrides): Promise<BigNumber>;
'name()'(overrides?: TransactionOverrides): Promise<BigNumber>;
symbol(overrides?: TransactionOverrides): Promise<BigNumber>;
'symbol()'(overrides?: TransactionOverrides): Promise<BigNumber>;
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
};
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,388 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, ContractTransaction, EventFilter, Signer } from 'ethers';
import { Listener, Provider } from 'ethers/providers';
import { Arrayish, BigNumber, BigNumberish, Interface } from 'ethers/utils';
import {
TransactionOverrides,
TypedEventDescription,
TypedFunctionDescription,
} from '.';
interface IERC20Interface extends Interface {
functions: {
totalSupply: TypedFunctionDescription<{ encode([]: []): string }>;
balanceOf: TypedFunctionDescription<{
encode([account]: [string]): string;
}>;
transfer: TypedFunctionDescription<{
encode([recipient, amount]: [string, BigNumberish]): string;
}>;
allowance: TypedFunctionDescription<{
encode([owner, spender]: [string, string]): string;
}>;
approve: TypedFunctionDescription<{
encode([spender, amount]: [string, BigNumberish]): string;
}>;
transferFrom: TypedFunctionDescription<{
encode([sender, recipient, amount]: [
string,
string,
BigNumberish,
]): string;
}>;
};
events: {
Approval: TypedEventDescription<{
encodeTopics([owner, spender, value]: [
string | null,
string | null,
null,
]): string[];
}>;
Transfer: TypedEventDescription<{
encodeTopics([from, to, value]: [
string | null,
string | null,
null,
]): string[];
}>;
};
}
export class IERC20 extends Contract {
connect(signerOrProvider: Signer | Provider | string): IERC20;
attach(addressOrName: string): IERC20;
deployed(): Promise<IERC20>;
on(event: EventFilter | string, listener: Listener): IERC20;
once(event: EventFilter | string, listener: Listener): IERC20;
addListener(eventName: EventFilter | string, listener: Listener): IERC20;
removeAllListeners(eventName: EventFilter | string): IERC20;
removeListener(eventName: any, listener: Listener): IERC20;
interface: IERC20Interface;
functions: {
/**
* Returns the amount of tokens in existence.
*/
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the amount of tokens in existence.
*/
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
};
/**
* Returns the amount of tokens in existence.
*/
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the amount of tokens in existence.
*/
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
filters: {
Approval(
owner: string | null,
spender: string | null,
value: null,
): EventFilter;
Transfer(from: string | null, to: string | null, value: null): EventFilter;
};
estimate: {
/**
* Returns the amount of tokens in existence.
*/
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the amount of tokens in existence.
*/
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
};
}

View File

@ -0,0 +1,200 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer } from 'ethers';
import { Provider } from 'ethers/providers';
import { IERC20 } from './IERC20';
export class IERC20Factory {
static connect(address: string, signerOrProvider: Signer | Provider): IERC20 {
return new Contract(address, _abi, signerOrProvider) as IERC20;
}
}
const _abi = [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'owner',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'spender',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256',
},
],
name: 'Approval',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'from',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'to',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256',
},
],
name: 'Transfer',
type: 'event',
},
{
inputs: [],
name: 'totalSupply',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'account',
type: 'address',
},
],
name: 'balanceOf',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'recipient',
type: 'address',
},
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'transfer',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool',
},
],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'owner',
type: 'address',
},
{
internalType: 'address',
name: 'spender',
type: 'address',
},
],
name: 'allowance',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'spender',
type: 'address',
},
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'approve',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool',
},
],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'sender',
type: 'address',
},
{
internalType: 'address',
name: 'recipient',
type: 'address',
},
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'transferFrom',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool',
},
],
stateMutability: 'nonpayable',
type: 'function',
},
];

436
packages/bridge/src/contracts/WETH.d.ts vendored Normal file
View File

@ -0,0 +1,436 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, ContractTransaction, EventFilter, Signer } from 'ethers';
import { Listener, Provider } from 'ethers/providers';
import { Arrayish, BigNumber, BigNumberish, Interface } from 'ethers/utils';
import {
TransactionOverrides,
TypedEventDescription,
TypedFunctionDescription,
} from '.';
interface WETHInterface extends Interface {
functions: {
allowance: TypedFunctionDescription<{
encode([owner, spender]: [string, string]): string;
}>;
approve: TypedFunctionDescription<{
encode([spender, amount]: [string, BigNumberish]): string;
}>;
balanceOf: TypedFunctionDescription<{
encode([account]: [string]): string;
}>;
totalSupply: TypedFunctionDescription<{ encode([]: []): string }>;
transfer: TypedFunctionDescription<{
encode([recipient, amount]: [string, BigNumberish]): string;
}>;
transferFrom: TypedFunctionDescription<{
encode([sender, recipient, amount]: [
string,
string,
BigNumberish,
]): string;
}>;
deposit: TypedFunctionDescription<{ encode([]: []): string }>;
withdraw: TypedFunctionDescription<{
encode([amount]: [BigNumberish]): string;
}>;
};
events: {
Approval: TypedEventDescription<{
encodeTopics([owner, spender, value]: [
string | null,
string | null,
null,
]): string[];
}>;
Transfer: TypedEventDescription<{
encodeTopics([from, to, value]: [
string | null,
string | null,
null,
]): string[];
}>;
};
}
export class WETH extends Contract {
connect(signerOrProvider: Signer | Provider | string): WETH;
attach(addressOrName: string): WETH;
deployed(): Promise<WETH>;
on(event: EventFilter | string, listener: Listener): WETH;
once(event: EventFilter | string, listener: Listener): WETH;
addListener(eventName: EventFilter | string, listener: Listener): WETH;
removeAllListeners(eventName: EventFilter | string): WETH;
removeListener(eventName: any, listener: Listener): WETH;
interface: WETHInterface;
functions: {
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Returns the amount of tokens owned by `account`.
*/
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens in existence.
*/
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the amount of tokens in existence.
*/
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
deposit(overrides?: TransactionOverrides): Promise<ContractTransaction>;
'deposit()'(overrides?: TransactionOverrides): Promise<ContractTransaction>;
withdraw(
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'withdraw(uint256)'(
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
};
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Returns the amount of tokens owned by `account`.
*/
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens in existence.
*/
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the amount of tokens in existence.
*/
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
deposit(overrides?: TransactionOverrides): Promise<ContractTransaction>;
'deposit()'(overrides?: TransactionOverrides): Promise<ContractTransaction>;
withdraw(
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'withdraw(uint256)'(
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
filters: {
Approval(
owner: string | null,
spender: string | null,
value: null,
): EventFilter;
Transfer(from: string | null, to: string | null, value: null): EventFilter;
};
estimate: {
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
allowance(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.
*/
'allowance(address,address)'(
owner: string,
spender: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
approve(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Sets `amount` as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.
*/
'approve(address,uint256)'(
spender: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
balanceOf(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens owned by `account`.
*/
'balanceOf(address)'(
account: string,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Returns the amount of tokens in existence.
*/
totalSupply(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Returns the amount of tokens in existence.
*/
'totalSupply()'(overrides?: TransactionOverrides): Promise<BigNumber>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transfer(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transfer(address,uint256)'(
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
transferFrom(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
/**
* Moves `amount` tokens from `sender` to `recipient` using the allowance mechanism. `amount` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.
*/
'transferFrom(address,address,uint256)'(
sender: string,
recipient: string,
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
deposit(overrides?: TransactionOverrides): Promise<BigNumber>;
'deposit()'(overrides?: TransactionOverrides): Promise<BigNumber>;
withdraw(
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'withdraw(uint256)'(
amount: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
};
}

View File

@ -0,0 +1,220 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, Signer } from 'ethers';
import { Provider } from 'ethers/providers';
import { WETH } from './WETH';
export class WETHFactory {
static connect(address: string, signerOrProvider: Signer | Provider): WETH {
return new Contract(address, _abi, signerOrProvider) as WETH;
}
}
const _abi = [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'owner',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'spender',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256',
},
],
name: 'Approval',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'from',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'to',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256',
},
],
name: 'Transfer',
type: 'event',
},
{
inputs: [
{
internalType: 'address',
name: 'owner',
type: 'address',
},
{
internalType: 'address',
name: 'spender',
type: 'address',
},
],
name: 'allowance',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'spender',
type: 'address',
},
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'approve',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool',
},
],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'account',
type: 'address',
},
],
name: 'balanceOf',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'totalSupply',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'recipient',
type: 'address',
},
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'transfer',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool',
},
],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'sender',
type: 'address',
},
{
internalType: 'address',
name: 'recipient',
type: 'address',
},
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'transferFrom',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool',
},
],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'deposit',
outputs: [],
stateMutability: 'payable',
type: 'function',
},
{
inputs: [
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'withdraw',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
];

View File

@ -1,5 +1,6 @@
/* Generated by ts-generator ver. 0.0.8 */
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, ContractTransaction, EventFilter, Signer } from 'ethers';
import { Listener, Provider } from 'ethers/providers';
@ -34,6 +35,10 @@ interface WormholeInterface extends Interface {
submitVAA: TypedFunctionDescription<{ encode([vaa]: [Arrayish]): string }>;
parseAndVerifyVAA: TypedFunctionDescription<{
encode([vaa]: [Arrayish]): string;
}>;
lockAssets: TypedFunctionDescription<{
encode([asset, amount, recipient, target_chain, nonce, refund_dust]: [
string,
@ -184,6 +189,42 @@ export class Wormhole extends Contract {
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
parseAndVerifyVAA(
vaa: Arrayish,
overrides?: TransactionOverrides,
): Promise<{
version: number;
hash: string;
guardian_set_index: number;
timestamp: number;
action: number;
payload: string;
0: number;
1: string;
2: number;
3: number;
4: number;
5: string;
}>;
'parseAndVerifyVAA(bytes)'(
vaa: Arrayish,
overrides?: TransactionOverrides,
): Promise<{
version: number;
hash: string;
guardian_set_index: number;
timestamp: number;
action: number;
payload: string;
0: number;
1: string;
2: number;
3: number;
4: number;
5: string;
}>;
lockAssets(
asset: string,
amount: BigNumberish,
@ -301,6 +342,42 @@ export class Wormhole extends Contract {
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
parseAndVerifyVAA(
vaa: Arrayish,
overrides?: TransactionOverrides,
): Promise<{
version: number;
hash: string;
guardian_set_index: number;
timestamp: number;
action: number;
payload: string;
0: number;
1: string;
2: number;
3: number;
4: number;
5: string;
}>;
'parseAndVerifyVAA(bytes)'(
vaa: Arrayish,
overrides?: TransactionOverrides,
): Promise<{
version: number;
hash: string;
guardian_set_index: number;
timestamp: number;
action: number;
payload: string;
0: number;
1: string;
2: number;
3: number;
4: number;
5: string;
}>;
lockAssets(
asset: string,
amount: BigNumberish,
@ -432,6 +509,16 @@ export class Wormhole extends Contract {
overrides?: TransactionOverrides,
): Promise<BigNumber>;
parseAndVerifyVAA(
vaa: Arrayish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'parseAndVerifyVAA(bytes)'(
vaa: Arrayish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
lockAssets(
asset: string,
amount: BigNumberish,

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
/* Generated by ts-generator ver. 0.0.8 */
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import { Contract, ContractTransaction, EventFilter, Signer } from 'ethers';
import { Listener, Provider } from 'ethers/providers';
@ -21,7 +22,11 @@ interface WrappedAssetInterface extends Interface {
initialized: TypedFunctionDescription<{ encode([]: []): string }>;
initialize: TypedFunctionDescription<{
encode([_assetChain, _assetAddress]: [BigNumberish, Arrayish]): string;
encode([_assetChain, _assetAddress, decimals]: [
BigNumberish,
Arrayish,
BigNumberish,
]): string;
}>;
mint: TypedFunctionDescription<{
@ -128,12 +133,14 @@ export class WrappedAsset extends Contract {
initialize(
_assetChain: BigNumberish,
_assetAddress: Arrayish,
decimals: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'initialize(uint8,bytes32)'(
'initialize(uint8,bytes32,uint8)'(
_assetChain: BigNumberish,
_assetAddress: Arrayish,
decimals: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
@ -347,12 +354,14 @@ export class WrappedAsset extends Contract {
initialize(
_assetChain: BigNumberish,
_assetAddress: Arrayish,
decimals: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
'initialize(uint8,bytes32)'(
'initialize(uint8,bytes32,uint8)'(
_assetChain: BigNumberish,
_assetAddress: Arrayish,
decimals: BigNumberish,
overrides?: TransactionOverrides,
): Promise<ContractTransaction>;
@ -576,12 +585,14 @@ export class WrappedAsset extends Contract {
initialize(
_assetChain: BigNumberish,
_assetAddress: Arrayish,
decimals: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;
'initialize(uint8,bytes32)'(
'initialize(uint8,bytes32,uint8)'(
_assetChain: BigNumberish,
_assetAddress: Arrayish,
decimals: BigNumberish,
overrides?: TransactionOverrides,
): Promise<BigNumber>;

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
/* Generated by ts-generator ver. 0.0.8 */
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import {
BigNumberish,
EventDescription,

View File

@ -0,0 +1,300 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import { useConnection, useConnectionConfig, programIds } from '@oyster/common';
import { WORMHOLE_PROGRAM_ID, POSTVAA_INSTRUCTION } from '../utils/ids';
import { ASSET_CHAIN } from '../utils/assets';
import { useEthereum } from '../contexts';
import {
Connection,
ParsedInstruction,
PartiallyDecodedInstruction,
PublicKey,
} from '@solana/web3.js';
import {
bridgeAuthorityKey,
TransferOutProposalLayout,
} from './../models/bridge';
import bs58 from 'bs58';
import {
COINGECKO_COIN_PRICE_API,
COINGECKO_POOL_INTERVAL,
useCoingecko,
} from '../contexts/coingecko';
import { BN } from 'bn.js';
import { WormholeFactory } from '../contracts/WormholeFactory';
import { ethers } from 'ethers';
import { useBridge } from '../contexts/bridge';
import { SolanaBridge } from '../core';
interface ParsedData {
info: any;
type: string;
}
type WrappedTransferMeta = {
chain: number;
decimals: number;
address: string;
publicKey: PublicKey;
coinId?: string;
price?: number;
explorer?: any;
logo?: string;
symbol?: string;
amount: number;
value?: number | string;
txhash?: string;
date: number; // timestamp
status?: string;
lockup?: any;
vaa?: any;
};
const queryWrappedMetaTransactions = async (
authorityKey: PublicKey,
connection: Connection,
setTransfers: (arr: WrappedTransferMeta[]) => void,
provider: ethers.providers.Web3Provider,
bridge?: SolanaBridge,
) => {
const filters = [
{
dataSize: TransferOutProposalLayout.span,
},
];
let wh = WormholeFactory.connect(
programIds().wormhole.bridge,
provider,
);
const resp = await (connection as any)._rpcRequest('getProgramAccounts', [
WORMHOLE_PROGRAM_ID.toBase58(),
{
commitment: connection.commitment,
filters,
},
]);
const transfers = new Map<string, WrappedTransferMeta>();
resp.result
.map((acc: any) => ({
publicKey: new PublicKey(acc.pubkey),
account: {
data: bs58.decode(acc.account.data),
executable: acc.account.executable,
owner: new PublicKey(acc.account.owner),
lamports: acc.account.lamports,
},
}))
.map((acc: any) => {
if (acc.account.data.length === TransferOutProposalLayout.span) {
const metaTransfer = TransferOutProposalLayout.decode(acc.account.data);
let assetAddress: string = '';
if (metaTransfer.assetChain !== ASSET_CHAIN.Solana) {
assetAddress = Buffer.from(
metaTransfer.assetAddress.slice(12),
).toString('hex');
} else {
assetAddress = new PublicKey(metaTransfer.assetAddress).toBase58();
}
const dec = new BN(10).pow(new BN(metaTransfer.assetDecimals));
const rawAmount = new BN(metaTransfer.amount, 2, 'le');
const amount = rawAmount.div(dec).toNumber();
const txhash = acc.publicKey.toBase58();
transfers.set(assetAddress, {
publicKey: acc.publicKey,
amount,
date: metaTransfer.vaaTime,
chain: metaTransfer.assetChain,
address: assetAddress,
decimals: 9,
txhash,
explorer: `https://explorer.solana.com/address/${txhash}`,
lockup: metaTransfer,
});
}
return null;
});
await Promise.all(
[...transfers.values()].map(async transfer => {
const resp = await (connection as any)._rpcRequest(
'getConfirmedSignaturesForAddress2',
[transfer.publicKey.toBase58()],
);
for (const sig of resp.result) {
const confirmedTx = await connection.getParsedConfirmedTransaction(
sig.signature,
);
if (!confirmedTx) continue;
const instructions = confirmedTx.transaction?.message?.instructions;
const filteredInstructions = instructions?.filter(ins => {
return ins.programId.toBase58() === WORMHOLE_PROGRAM_ID.toBase58();
});
if (filteredInstructions && filteredInstructions?.length > 0) {
for (const ins of filteredInstructions) {
const data = bs58.decode((ins as PartiallyDecodedInstruction).data);
if (
data[0] === POSTVAA_INSTRUCTION &&
confirmedTx.meta?.err == null &&
bridge
) {
const lockup = transfer.lockup;
let vaa = lockup.vaa;
for (let i = vaa.length; i > 0; i--) {
if (vaa[i] == 0xff) {
vaa = vaa.slice(0, i);
break;
}
}
let signatures = await bridge.fetchSignatureStatus(
lockup.signatureAccount,
);
let sigData = Buffer.of(
...signatures.reduce((previousValue, currentValue) => {
previousValue.push(currentValue.index);
previousValue.push(...currentValue.signature);
return previousValue;
}, new Array<number>()),
);
vaa = Buffer.concat([
vaa.slice(0, 5),
Buffer.of(signatures.length),
sigData,
vaa.slice(6),
]);
try {
if (vaa?.length) {
const _ = await wh.parseAndVerifyVAA(vaa);
transfer.status = 'Failed';
transfer.vaa = vaa;
//TODO: handle vaa not posted
//console.log({ result });
} else {
transfer.status = 'Error';
transfer.vaa = vaa;
//TODO: handle empty data
//console.log({ vaa });
}
} catch (e) {
//console.log({ error: e });
transfer.vaa = vaa;
transfer.status = 'Completed';
}
}
}
}
}
}),
);
setTransfers([...transfers.values()]);
};
export const useWormholeTransactions = () => {
const connection = useConnection();
const { tokenMap: ethTokens } = useEthereum();
const { tokenMap } = useConnectionConfig();
const { coinList } = useCoingecko();
const bridge = useBridge();
const [loading, setLoading] = useState<boolean>(true);
const [transfers, setTransfers] = useState<WrappedTransferMeta[]>([]);
const [amountInUSD, setAmountInUSD] = useState<number>(0);
useEffect(() => {
setLoading(true);
(async () => {
// authority -> query for token accounts to get locked assets
let authorityKey = await bridgeAuthorityKey(programIds().wormhole.pubkey);
// query wrapped assets that were imported to solana from other chains
queryWrappedMetaTransactions(
authorityKey,
connection,
setTransfers,
new ethers.providers.Web3Provider((window as any).ethereum),
bridge,
).then(() => setLoading(false));
})();
}, [connection, setTransfers]);
const coingeckoTimer = useRef<number>(0);
const dataSourcePriceQuery = useCallback(async () => {
if (transfers.length === 0) return;
const ids = [
...new Set(
transfers
.map(transfer => {
let knownToken = tokenMap.get(transfer.address);
if (knownToken) {
transfer.logo = knownToken.logoURI;
transfer.symbol = knownToken.symbol;
}
let token = ethTokens.get(`0x${transfer.address || ''}`);
if (token) {
transfer.logo = token.logoURI;
transfer.symbol = token.symbol;
}
if (transfer.symbol) {
let coinInfo = coinList.get(transfer.symbol.toLowerCase());
if (coinInfo) {
transfer.coinId = coinInfo.id;
return coinInfo.id;
}
}
return '';
})
.filter(a => a?.length),
),
];
if (ids.length === 0) return;
const parameters = `?ids=${ids.join(',')}&vs_currencies=usd`;
const resp = await window.fetch(COINGECKO_COIN_PRICE_API + parameters);
const usdByCoinId = await resp.json();
transfers.forEach(transfer => {
transfer.price = usdByCoinId[transfer.coinId as string]?.usd || 1;
transfer.value =
Math.round(transfer.amount * (transfer.price || 1) * 100) / 100;
});
setAmountInUSD(10);
coingeckoTimer.current = window.setTimeout(
() => dataSourcePriceQuery(),
COINGECKO_POOL_INTERVAL,
);
}, [transfers, setAmountInUSD]);
useEffect(() => {
if (transfers && coinList && !loading) {
dataSourcePriceQuery();
}
return () => {
window.clearTimeout(coingeckoTimer.current);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [transfers, coinList, loading]);
return {
loading,
transfers,
totalInUSD: amountInUSD,
};
};

View File

@ -31,10 +31,3 @@ code {
height: auto;
top: 0;
}
.wormhole-bg {
background-image: url('/home/background.svg');
background-size: 100% auto;
background-color: #06101a;
background-repeat: no-repeat;
}

View File

@ -1,18 +1,21 @@
// 40 - ExecutedVAA (claim)
export const NOP = 0;
import { publicKey } from '@oyster/common/dist/lib/utils/layout';
import * as BufferLayout from 'buffer-layout';
export const ClaimedVAA = BufferLayout.struct([
BufferLayout.blob(32, 'hash'),
BufferLayout.u32('vaaTime'),
BufferLayout.u8('initialized'),
//BufferLayout.seq(BufferLayout.u8(), 3),
]);
/*
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct ClaimedVAA {
/// hash of the vaa
pub hash: [u8; 32],
/// time the vaa was submitted
pub vaa_time: u32,
/// Is `true` if this structure has been initialized.
pub is_initialized: bool,
}
*/

View File

@ -8,7 +8,7 @@ import {
createAssociatedTokenAccountInstruction,
} from '@oyster/common';
import { ethers } from 'ethers';
import { Erc20Factory } from '../../../contracts/Erc20Factory';
import { ERC20Factory } from '../../../contracts/ERC20Factory';
import { WormholeFactory } from '../../../contracts/WormholeFactory';
import { AssetMeta, createWrappedAssetInstruction } from './../meta';
import { bridgeAuthorityKey, wrappedAssetMintKey } from './../helpers';
@ -168,7 +168,7 @@ export const toSolana = async (
const group = 'Approve assets';
try {
if (request.info?.allowance.lt(amountBN)) {
let e = Erc20Factory.connect(request.asset, signer);
let e = ERC20Factory.connect(request.asset, signer);
setProgress({
message: `Waiting for ${walletName} approval`,
type: 'user',

View File

@ -1,14 +1,17 @@
import { HashRouter, Route, Switch } from 'react-router-dom';
import React from 'react';
import { contexts } from '@oyster/common';
import {
MarketProvider,
TokenPairProvider,
EthereumProvider,
} from './contexts';
import { MarketProvider, EthereumProvider } from './contexts';
import { AppLayout } from './components/Layout';
import { FaucetView, HomeView, TransferView } from './views';
import {
FaucetView,
HomeView,
TransferView,
HelpView,
ProofOfAssetsView,
FaqView,
} from './views';
import { CoingeckoProvider } from './contexts/coingecko';
import { BridgeProvider } from './contexts/bridge';
import { UseWalletProvider } from 'use-wallet';
@ -38,6 +41,12 @@ export function Routes() {
component={() => <HomeView />}
/>
<Route path="/move" children={<TransferView />} />
<Route path="/faq" children={<FaqView />} />
<Route
path="/proof-of-assets"
children={<ProofOfAssetsView />}
/>
<Route path="/help" children={<HelpView />} />
<Route
exact
path="/faucet"

View File

@ -50,5 +50,5 @@ export const chainToName = (chain?: ASSET_CHAIN) => {
};
export const filterModalSolTokens = (tokens: TokenInfo[]) => {
return tokens;
return tokens.filter(token => token.symbol !== 'SOL');
};

View File

@ -1,5 +1,36 @@
import { PublicKey } from '@solana/web3.js';
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
export const WORMHOLE_PROGRAM_ID = new PublicKey(
'WormT3McKhFJ2RkiGpdw9GKvNCrB2aB54gb2uV9MfQC',
);
export const POSTVAA_INSTRUCTION: number = 2;
const INSTRUCTION_LOOKUP: { [key: number]: string } = {
0: 'Initialize Bridge',
1: 'Transfer Assets Out',
[POSTVAA_INSTRUCTION]: 'Post VAA',
3: 'Evict Transfer Proposal',
4: 'Evict Claimed VAA',
5: 'Poke Proposal',
6: 'Verify Signatures',
7: 'Create Wrapped Asset',
};
export function isWormholeInstruction(
instruction: TransactionInstruction,
): boolean {
return WORMHOLE_PROGRAM_ID.toBase58() === instruction.programId.toBase58();
}
export function parsWormholeInstructionTitle(
instruction: TransactionInstruction,
): string {
const code = instruction.data[0];
if (!(code in INSTRUCTION_LOOKUP)) {
throw new Error(`Unrecognized Wormhole instruction code: ${code}`);
}
return INSTRUCTION_LOOKUP[code];
}

View File

View File

@ -0,0 +1,12 @@
import React from 'react';
import './index.less';
export const FaqView = () => {
return (
<div
className="flexColumn transfer-bg"
style={{ flex: 1, minHeight: '90vh' }}
></div>
);
};

View File

@ -0,0 +1,12 @@
import React from 'react';
import './index.less';
export const HelpView = () => {
return (
<div
className="flexColumn transfer-bg"
style={{ flex: 1, minHeight: '90vh' }}
></div>
);
};

View File

@ -8,15 +8,6 @@ section.ant-layout {
margin: auto;
position: relative;
}
header.ant-layout-header.App-Bar {
position: absolute;
width: 100%;
background: transparent;
display: flex;
justify-content: center;
height: 80px;
}
.get-started {
background: url("/home/get-started.svg") center center no-repeat;
@ -48,6 +39,7 @@ header.ant-layout-header.App-Bar {
.home-container {
width: 100%;
background-color: #06101a;
#how-it-works-container {
display: flex;
flex-direction: column;
@ -64,9 +56,11 @@ header.ant-layout-header.App-Bar {
display: flex;
flex-direction: row;
justify-content: space-evenly;
max-width: 90%;
margin: auto;
.home-description-item {
padding: 0 100px 0 100px;
padding: 0 30px 0 30px;
.description-title {
font-size: 20px;
line-height: 160%;
@ -81,6 +75,8 @@ header.ant-layout-header.App-Bar {
}
#recent-tx-container {
max-width: 70%;
margin: auto;
padding-bottom: 70px;
.description-text {
color: @tungsten-60
@ -89,7 +85,6 @@ header.ant-layout-header.App-Bar {
margin: 16px 100px;
}
.ant-table {
margin: 0 100px;
thead {
tr > th.ant-table-cell {
background-color: @tungsten-100;
@ -114,12 +109,19 @@ header.ant-layout-header.App-Bar {
align-items: center;
justify-content: flex-end;
min-height: 802px;
.main-logo {
& > img {
max-width: 100%;
}
}
& > div {
font-size: 16px;
line-height: 160%;
width: auto;
margin: 3px 0 30px 0;
margin: 3px 20px 30px 20px;
}
& > div:first-child {
margin-bottom: 120px;
}
}
@ -136,3 +138,35 @@ footer.ant-layout-footer {
width: 100%;
background-color: @tungsten-100;
}
.wormhole-bg {
background-image: url('/home/background.svg');
background-size: 100% auto;
background-repeat: no-repeat;
}
@media screen and (max-width: 900px) {
.justify-bottom-container {
min-height: 640px;
}
.home-container {
#recent-tx-container {
max-width: 100%;
}
#how-it-works-container {
.home-description {
flex-direction: column;
}
}
}
}
@media screen and (max-width: 1200px) {
.home-container {
#recent-tx-container {
max-width: 90%;
}
}
}

View File

@ -1,8 +1,7 @@
import { Table, Col, Row, Statistic, Button } from 'antd';
import { Table } from 'antd';
import anime from 'animejs';
import React, { useMemo } from 'react';
import { GUTTER } from '../../constants';
import { formatNumber, formatUSD, shortenAddress } from '@oyster/common';
import React from 'react';
import { formatUSD, shortenAddress } from '@oyster/common';
import './itemStyle.less';
import './index.less';
import { Link } from 'react-router-dom';
@ -127,8 +126,11 @@ export const HomeView = () => {
};
return (
<>
<div className="flexColumn home-container wormhole-bg">
<div className={'justify-bottom-container'}>
<div className="flexColumn home-container">
<div className={'justify-bottom-container wormhole-bg'}>
<div className={'main-logo'}>
<img src={'/home/main-logo.svg'} />
</div>
<div>
A decentralized and bi-directional bridge for
<br /> ERC-20 and SPL tokens
@ -186,13 +188,17 @@ export const HomeView = () => {
</div>
</div>
<div id={'recent-tx-container'}>
<div className={'home-subtitle'}>Recent Transactions</div>
<div className={'description-text'} style={{ marginBottom: '70px' }}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<div className={'home-subtitle'}>Total Value Locked</div>
<div
className={'assets-total description-text'}
style={{ marginBottom: '70px', fontSize: '40px' }}
>
{formatUSD.format(totalInUSD)}
</div>
<Table
scroll={{
scrollToFirstRowOnChange: false,
x: 900,
}}
dataSource={externalAssets.filter(a => a.name)}
columns={columns}

View File

@ -1,3 +1,6 @@
export { HomeView } from './home';
export { FaucetView } from './faucet';
export { TransferView } from './transfer';
export { HelpView } from './help';
export { FaqView } from './faq';
export { ProofOfAssetsView } from './proof-of-assets';

View File

@ -0,0 +1,12 @@
import React from 'react';
import './index.less';
export const ProofOfAssetsView = () => {
return (
<div
className="flexColumn transfer-bg"
style={{ flex: 1, minHeight: '90vh' }}
></div>
);
};

View File

@ -0,0 +1,7 @@
.transfer-bg {
background-image: url('/transfer/background.svg');
background-size: 100% auto;
background-color: #06101a;
background-repeat: no-repeat;
}

View File

@ -1,18 +1,15 @@
import React from 'react';
import { Card } from 'antd';
import './index.less';
import { Transfer } from '../../components/Transfer';
export const TransferView = () => {
return (
<>
<div className="flexColumn" style={{ flex: 1, minHeight: '90vh' }}>
<Card
className="bridge-card"
headStyle={{ padding: 0 }}
bodyStyle={{ position: 'relative' }}
>
<Transfer />
</Card>
<div
className="flexColumn transfer-bg"
style={{ flex: 1, minHeight: '90vh' }}
>
<Transfer />
</div>
</>
);

View File

@ -1,6 +1,5 @@
import EventEmitter from 'eventemitter3';
import { PublicKey, Transaction } from '@solana/web3.js';
import { notify } from '@oyster/common';
import { WalletAdapter } from '@solana/wallet-base';
import { ethers } from 'ethers';
import WalletConnectProvider from '@walletconnect/web3-provider';

View File

@ -16,7 +16,7 @@
"downlevelIteration": true,
"noEmit": true,
"jsx": "react",
"typeRoots": ["../../types"]
"typeRoots": ["types", "../../types", "../../node_modules/@types"]
},
"include": ["src"]
}

View File

@ -1,6 +1,7 @@
export { ExplorerLink } from './ExplorerLink/index';
export { ConnectButton } from './ConnectButton/index';
export { CurrentUserBadge } from './CurrentUserBadge/index';
export { CurrentUserWalletBadge } from './CurrentUserWalletBadge/index';
export { Identicon } from './Identicon/index';
export { Info } from './Icons/info';
export { NumericInput } from './Input/numeric';

View File

@ -5,7 +5,7 @@ import { Button, Modal } from "antd";
import React, { useCallback, useContext, useEffect, useMemo, useState } from "react";
import { notify } from "./../utils/notifications";
import { useConnectionConfig } from "./connection";
import { useLocalStorageState } from "./../utils/utils";
import { useLocalStorageState } from "../utils/utils";
import { LedgerProvider } from "@solana/wallet-ledger";
import { SolongWalletAdapter } from "../wallet-adapters/solong";
import { PhantomWalletAdapter } from "../wallet-adapters/phantom";

View File

@ -1,3 +1,4 @@
export * from './useUserAccounts';
export * from './useAccountByMint';
export * from './useTokenName';
export * from './useThatState';

View File

@ -0,0 +1,16 @@
import { useState } from 'react';
// Extends useState() hook with async getThatState getter which can be used to get state value in contexts (ex. async callbacks) where up to date state is not available
export function useThatState<T>(initialState: T) {
const [state, setState] = useState<T>(initialState);
const getThatState = () =>
new Promise<T>(resolve => {
// Use NOP setState call to retrieve current state value
setState(s => {
resolve(s);
return s;
});
});
return [state, setState, getThatState] as const;
}

View File

@ -58,21 +58,34 @@ export function approve(
// if delegate is not passed ephemeral transfer authority is used
delegate?: PublicKey,
existingTransferAuthority?: Account,
): Account {
const tokenProgram = TOKEN_PROGRAM_ID;
const transferAuthority = new Account();
instructions.push(
Token.createApproveInstruction(
tokenProgram,
account,
delegate ?? transferAuthority.publicKey,
owner,
[],
amount,
),
const transferAuthority = existingTransferAuthority || new Account();
const delegateKey = delegate ?? transferAuthority.publicKey;
const instruction = Token.createApproveInstruction(
tokenProgram,
account,
delegateKey,
owner,
[],
amount,
);
// Temp. workaround for a bug in Token.createApproveInstruction which doesn't add the delegate account to signers
instruction.keys = instruction.keys.map(k =>
k.pubkey.equals(delegateKey)
? {
...k,
isSigner: true,
}
: k,
);
instructions.push(instruction);
if (autoRevoke) {
cleanupInstructions.push(
Token.createRevokeInstruction(tokenProgram, account, owner, []),

View File

@ -36,7 +36,6 @@ let WORMHOLE_BRIDGE: {
let TIMELOCK: {
programId: PublicKey;
programAccountId: PublicKey;
};
let SWAP_PROGRAM_ID: PublicKey;
@ -56,9 +55,6 @@ export const PROGRAM_IDS = [
{
name: 'mainnet-beta',
timelock: () => ({
programAccountId: new PublicKey(
'9gBhDCCKV7KELLFRY8sAJZXqDmvUfmNzFzpB2b4FUVVr',
),
programId: new PublicKey('9iAeqqppjn7g1Jn8o2cQCqU5aQVV3h4q9bbWdKRbeC2w'),
}),
wormhole: () => ({
@ -80,10 +76,7 @@ export const PROGRAM_IDS = [
{
name: 'testnet',
timelock: () => ({
programAccountId: new PublicKey(
'7CxEuz8Qtius9aCyJqGnWZyBNvf6WTTNmA8G26BdMTSF',
),
programId: new PublicKey('8DevpkpN6CsdczP6rQ64CHraApXFrq96oGm4VjSNCs4q'),
programId: new PublicKey('DCVPuhaGNMLh73FRWFroH4o3ERUhBKMRWfBgJV94VqRk'),
}),
wormhole: () => ({
pubkey: new PublicKey('5gQf5AUhAgWYgUCt9ouShm9H7dzzXUsLdssYwe5krKhg'),
@ -101,10 +94,7 @@ export const PROGRAM_IDS = [
{
name: 'devnet',
timelock: () => ({
programAccountId: new PublicKey(
'9qR84VknBPtVyRw9XwCYRP6B1GiBtZohNo6TqETzw9Jv',
),
programId: new PublicKey('GWXcJzvWpJb7Sq2iqGSnJNiQJ3HmS3Zjg3vhyJf4JwBU'),
programId: new PublicKey('DCVPuhaGNMLh73FRWFroH4o3ERUhBKMRWfBgJV94VqRk'),
}),
wormhole: () => ({
pubkey: new PublicKey('WormT3McKhFJ2RkiGpdw9GKvNCrB2aB54gb2uV9MfQC'),
@ -122,9 +112,6 @@ export const PROGRAM_IDS = [
{
name: 'localnet',
timelock: () => ({
programAccountId: new PublicKey(
'5jmddiXrpvPp587iRvhtAnNrJa2PNMFRm5cxFW6yCG14',
),
programId: new PublicKey('3KEiR9eX7isb8xeFzTzbLZij8tKH6YFYUbMyjBp8ygDK'),
}),
wormhole: () => ({

View File

@ -163,6 +163,14 @@ export function fromLamports(
return (amount / precision) * rate;
}
export const tryParseKey = (key: string): PublicKey | null => {
try {
return new PublicKey(key);
} catch (error) {
return null;
}
};
var SI_SYMBOL = ['', 'k', 'M', 'G', 'T', 'P', 'E'];
const abbreviateNumber = (number: number, precision: number) => {

View File

@ -1,6 +1,6 @@
import EventEmitter from "eventemitter3";
import { PublicKey } from "@solana/web3.js";
import { notify } from "./../utils/notifications";
import { notify } from "../utils/notifications";
export class SolongAdapter extends EventEmitter {
_publicKey: any;

View File

@ -16,8 +16,8 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": ["../../types/", "../../node_modules/@types", "../../types"]
"typeRoots": ["types", "../../types", "../../node_modules/@types"]
},
"include": ["src/**/*", "src/config/tokens.json"],
"include": ["src/**/*"],
"exclude": ["src/**/*.test.ts", "**/node_modules"]
}

View File

@ -1,7 +1,7 @@
import React, { useMemo } from "react";
import { GUTTER, LABELS } from "../../constants";
import { LiquidateItem } from "./item";
import { useEnrichedLendingObligations } from "./../../hooks";
import { useEnrichedLendingObligations } from "../../hooks";
import "./style.less";
import { Card, Col, Row, Statistic, Typography } from "antd";
import { BarChartStatistic } from "../../components/BarChartStatistic";

View File

@ -1,10 +1,10 @@
import React from "react";
import { useLendingReserve } from "./../../hooks";
import { useLendingReserve } from "../../hooks";
import { useParams } from "react-router-dom";
import "./style.less";
import { UserLendingCard } from "./../../components/UserLendingCard";
import { ReserveStatus } from "./../../components/ReserveStatus";
import { UserLendingCard } from "../../components/UserLendingCard";
import { ReserveStatus } from "../../components/ReserveStatus";
import { Col, Row } from "antd";
import { GUTTER } from "../../constants";

View File

@ -16,7 +16,7 @@
"downlevelIteration": true,
"noEmit": true,
"jsx": "react",
"typeRoots": ["../../types"]
"typeRoots": ["types", "../../types", "../../node_modules/@types"]
},
"include": ["src"]
}

View File

@ -50,7 +50,7 @@ export const addCustomSingleSignerTransaction = async (
});
const [authority] = await PublicKey.findProgramAddress(
[PROGRAM_IDS.timelock.programAccountId.toBuffer()],
[proposal.pubkey.toBuffer()],
PROGRAM_IDS.timelock.programId,
);
@ -71,6 +71,7 @@ export const addCustomSingleSignerTransaction = async (
await serializeInstruction({
connection,
instr: pingInstruction(),
proposal
})
).base64;
@ -79,6 +80,7 @@ export const addCustomSingleSignerTransaction = async (
await serializeInstruction({
connection,
instr: pingInstruction(),
proposal
})
).byteArray;

View File

@ -47,7 +47,7 @@ export const addSigner = async (
);
const [mintAuthority] = await PublicKey.findProgramAddress(
[PROGRAM_IDS.timelock.programAccountId.toBuffer()],
[proposal.pubkey.toBuffer()],
PROGRAM_IDS.timelock.programId,
);

View File

@ -15,6 +15,7 @@ import {
TimelockStateLayout,
} from '../models/timelock';
const { cache } = contexts.Accounts;
const { sendTransactions } = contexts.Connection;
const { createMint, createTokenAccount } = actions;
const { notify } = utils;
@ -39,6 +40,17 @@ export const createProposal = async (
AccountLayout.span,
);
const sourceMintDecimals = (
await cache.queryMint(
connection,
useGovernance
? timelockConfig.info.governanceMint
: timelockConfig.info.councilMint,
)
).decimals;
const timelockSetKey = new Account();
const {
sigMint,
voteMint,
@ -62,6 +74,8 @@ export const createProposal = async (
mintRentExempt,
timelockConfig,
useGovernance,
sourceMintDecimals,
timelockSetKey,
);
let createTimelockAccountsSigners: Account[] = [];
@ -75,7 +89,6 @@ export const createProposal = async (
TimelockStateLayout.span,
);
const timelockSetKey = new Account();
const timelockStateKey = new Account();
const uninitializedTimelockStateInstruction = SystemProgram.createAccount({
@ -101,7 +114,7 @@ export const createProposal = async (
signers.push(timelockSetKey);
createTimelockAccountsSigners.push(timelockSetKey);
createTimelockAccountsInstructions.push(uninitializedTimelockSetInstruction);
console.log('useGov ernance is', useGovernance, timelockConfig);
instructions.push(
initTimelockSetInstruction(
timelockStateKey.publicKey,
@ -186,11 +199,13 @@ async function getAssociatedAccountsAndInstructions(
mintRentExempt: number,
timelockConfig: ParsedAccount<TimelockConfig>,
useGovernance: boolean,
sourceMintDecimals: number,
newProposalKey: Account,
): Promise<ValidationReturn> {
const PROGRAM_IDS = utils.programIds();
const [authority] = await PublicKey.findProgramAddress(
[PROGRAM_IDS.timelock.programAccountId.toBuffer()],
[newProposalKey.publicKey.toBuffer()],
PROGRAM_IDS.timelock.programId,
);
@ -224,7 +239,7 @@ async function getAssociatedAccountsAndInstructions(
voteMintInstructions,
wallet.publicKey,
mintRentExempt,
0,
sourceMintDecimals,
authority,
authority,
voteMintSigners,
@ -234,7 +249,7 @@ async function getAssociatedAccountsAndInstructions(
voteMintInstructions,
wallet.publicKey,
mintRentExempt,
0,
sourceMintDecimals,
authority,
authority,
voteMintSigners,
@ -244,7 +259,7 @@ async function getAssociatedAccountsAndInstructions(
voteMintInstructions,
wallet.publicKey,
mintRentExempt,
0,
sourceMintDecimals,
authority,
authority,
voteMintSigners,

View File

@ -12,17 +12,22 @@ import {
actions,
} from '@oyster/common';
import { TimelockSet } from '../models/timelock';
import { TimelockConfig, TimelockSet, TimelockState } from '../models/timelock';
import { AccountLayout } from '@solana/spl-token';
import { depositSourceTokensInstruction } from '../models/depositSourceTokens';
import { LABELS } from '../constants';
import { depositSourceTokensInstruction } from '../models/depositSourceTokens';
import { createEmptyGovernanceVotingRecordInstruction } from '../models/createEmptyGovernanceVotingRecord';
import { voteInstruction } from '../models/vote';
const { createTokenAccount } = actions;
const { sendTransaction } = contexts.Connection;
const { sendTransactions } = contexts.Connection;
const { notify } = utils;
const { approve } = models;
export const depositSourceTokens = async (
export const depositSourceTokensAndVote = async (
connection: Connection,
wallet: any,
proposal: ParsedAccount<TimelockSet>,
@ -30,12 +35,18 @@ export const depositSourceTokens = async (
existingYesVoteAccount: PublicKey | undefined,
existingNoVoteAccount: PublicKey | undefined,
sourceAccount: PublicKey,
votingTokenAmount: number,
timelockConfig: ParsedAccount<TimelockConfig>,
state: ParsedAccount<TimelockState>,
yesVotingTokenAmount: number,
noVotingTokenAmount: number,
) => {
const votingTokenAmount =
yesVotingTokenAmount > 0 ? yesVotingTokenAmount : noVotingTokenAmount;
const PROGRAM_IDS = utils.programIds();
let signers: Account[] = [];
let instructions: TransactionInstruction[] = [];
let depositSigners: Account[] = [];
let depositInstructions: TransactionInstruction[] = [];
const accountRentExempt = await connection.getMinimumBalanceForRentExemption(
AccountLayout.span,
@ -44,18 +55,18 @@ export const depositSourceTokens = async (
let needToCreateGovAccountToo = !existingVoteAccount;
if (!existingVoteAccount) {
existingVoteAccount = createTokenAccount(
instructions,
depositInstructions,
wallet.publicKey,
accountRentExempt,
proposal.info.votingMint,
wallet.publicKey,
signers,
depositSigners,
);
}
const [governanceVotingRecord] = await PublicKey.findProgramAddress(
[
PROGRAM_IDS.timelock.programAccountId.toBuffer(),
PROGRAM_IDS.timelock.programId.toBuffer(),
proposal.pubkey.toBuffer(),
existingVoteAccount.toBuffer(),
],
@ -63,7 +74,7 @@ export const depositSourceTokens = async (
);
if (needToCreateGovAccountToo) {
instructions.push(
depositInstructions.push(
createEmptyGovernanceVotingRecordInstruction(
governanceVotingRecord,
proposal.pubkey,
@ -74,43 +85,43 @@ export const depositSourceTokens = async (
}
if (!existingYesVoteAccount) {
createTokenAccount(
instructions,
existingYesVoteAccount = createTokenAccount(
depositInstructions,
wallet.publicKey,
accountRentExempt,
proposal.info.yesVotingMint,
wallet.publicKey,
signers,
depositSigners,
);
}
if (!existingNoVoteAccount) {
createTokenAccount(
instructions,
existingNoVoteAccount = createTokenAccount(
depositInstructions,
wallet.publicKey,
accountRentExempt,
proposal.info.noVotingMint,
wallet.publicKey,
signers,
depositSigners,
);
}
const [mintAuthority] = await PublicKey.findProgramAddress(
[PROGRAM_IDS.timelock.programAccountId.toBuffer()],
[proposal.pubkey.toBuffer()],
PROGRAM_IDS.timelock.programId,
);
const transferAuthority = approve(
instructions,
const depositAuthority = approve(
depositInstructions,
[],
sourceAccount,
wallet.publicKey,
votingTokenAmount,
);
signers.push(transferAuthority);
depositSigners.push(depositAuthority);
instructions.push(
depositInstructions.push(
depositSourceTokensInstruction(
governanceVotingRecord,
existingVoteAccount,
@ -118,31 +129,77 @@ export const depositSourceTokens = async (
proposal.info.sourceHolding,
proposal.info.votingMint,
proposal.pubkey,
transferAuthority.publicKey,
depositAuthority.publicKey,
mintAuthority,
votingTokenAmount,
),
);
let voteSigners: Account[] = [];
let voteInstructions: TransactionInstruction[] = [];
const voteAuthority = approve(
voteInstructions,
[],
existingVoteAccount,
wallet.publicKey,
yesVotingTokenAmount + noVotingTokenAmount,
);
voteSigners.push(voteAuthority);
voteInstructions.push(
voteInstruction(
governanceVotingRecord,
state.pubkey,
existingVoteAccount,
existingYesVoteAccount,
existingNoVoteAccount,
proposal.info.votingMint,
proposal.info.yesVotingMint,
proposal.info.noVotingMint,
proposal.info.sourceMint,
proposal.pubkey,
timelockConfig.pubkey,
voteAuthority.publicKey,
mintAuthority,
yesVotingTokenAmount,
noVotingTokenAmount,
),
);
const [votingMsg, votedMsg, voteTokensMsg] =
yesVotingTokenAmount > 0
? [
LABELS.VOTING_YEAH,
LABELS.VOTED_YEAH,
`${yesVotingTokenAmount} ${LABELS.TOKENS_VOTED_FOR_THE_PROPOSAL}.`,
]
: [
LABELS.VOTING_NAY,
LABELS.VOTED_NAY,
`${noVotingTokenAmount} ${LABELS.TOKENS_VOTED_AGAINST_THE_PROPOSAL}.`,
];
notify({
message: LABELS.ADDING_VOTES_TO_VOTER,
message: votingMsg,
description: LABELS.PLEASE_WAIT,
type: 'warn',
});
try {
let tx = await sendTransaction(
await sendTransactions(
connection,
wallet,
instructions,
signers,
[depositInstructions, voteInstructions],
[depositSigners, voteSigners],
true,
);
notify({
message: LABELS.VOTES_ADDED,
message: votedMsg,
type: 'success',
description: LABELS.TRANSACTION + ` ${tx}`,
description: voteTokensMsg,
});
} catch (ex) {
console.error(ex);

View File

@ -4,13 +4,7 @@ import {
PublicKey,
TransactionInstruction,
} from '@solana/web3.js';
import {
contexts,
utils,
models,
ParsedAccount,
actions,
} from '@oyster/common';
import { contexts, utils, ParsedAccount, actions } from '@oyster/common';
import { TimelockConfig } from '../models/timelock';
import { AccountLayout, Token } from '@solana/spl-token';

View File

@ -113,7 +113,7 @@ export const registerProgramGovernance = async (
const [timelockConfigKey] = await PublicKey.findProgramAddress(
[
PROGRAM_IDS.timelock.programAccountId.toBuffer(),
PROGRAM_IDS.timelock.programId.toBuffer(),
uninitializedTimelockConfig.governanceMint.toBuffer(),
uninitializedTimelockConfig.councilMint.toBuffer(),
uninitializedTimelockConfig.program.toBuffer(),

View File

@ -25,7 +25,7 @@ export const removeSigner = async (
let instructions: TransactionInstruction[] = [];
const [mintAuthority] = await PublicKey.findProgramAddress(
[PROGRAM_IDS.timelock.programAccountId.toBuffer()],
[proposal.pubkey.toBuffer()],
PROGRAM_IDS.timelock.programId,
);

View File

@ -26,7 +26,7 @@ export const sign = async (
let instructions: TransactionInstruction[] = [];
const [mintAuthority] = await PublicKey.findProgramAddress(
[PROGRAM_IDS.timelock.programAccountId.toBuffer()],
[proposal.pubkey.toBuffer()],
PROGRAM_IDS.timelock.programId,
);

View File

@ -1,108 +0,0 @@
import {
Account,
Connection,
PublicKey,
TransactionInstruction,
} from '@solana/web3.js';
import {
contexts,
utils,
models,
ParsedAccount,
actions,
} from '@oyster/common';
import { TimelockConfig, TimelockSet, TimelockState } from '../models/timelock';
import { LABELS } from '../constants';
import { voteInstruction } from '../models/vote';
const { createTokenAccount } = actions;
const { sendTransaction } = contexts.Connection;
const { notify } = utils;
const { approve } = models;
export const vote = async (
connection: Connection,
wallet: any,
proposal: ParsedAccount<TimelockSet>,
timelockConfig: ParsedAccount<TimelockConfig>,
state: ParsedAccount<TimelockState>,
votingAccount: PublicKey,
yesVotingAccount: PublicKey,
noVotingAccount: PublicKey,
yesVotingTokenAmount: number,
noVotingTokenAmount: number,
) => {
const PROGRAM_IDS = utils.programIds();
let signers: Account[] = [];
let instructions: TransactionInstruction[] = [];
const [mintAuthority] = await PublicKey.findProgramAddress(
[PROGRAM_IDS.timelock.programAccountId.toBuffer()],
PROGRAM_IDS.timelock.programId,
);
const [governanceVotingRecord] = await PublicKey.findProgramAddress(
[
PROGRAM_IDS.timelock.programAccountId.toBuffer(),
proposal.pubkey.toBuffer(),
votingAccount.toBuffer(),
],
PROGRAM_IDS.timelock.programId,
);
const transferAuthority = approve(
instructions,
[],
votingAccount,
wallet.publicKey,
yesVotingTokenAmount + noVotingTokenAmount,
);
signers.push(transferAuthority);
instructions.push(
voteInstruction(
governanceVotingRecord,
state.pubkey,
votingAccount,
yesVotingAccount,
noVotingAccount,
proposal.info.votingMint,
proposal.info.yesVotingMint,
proposal.info.noVotingMint,
proposal.info.sourceMint,
proposal.pubkey,
timelockConfig.pubkey,
transferAuthority.publicKey,
mintAuthority,
yesVotingTokenAmount,
noVotingTokenAmount,
),
);
notify({
message: LABELS.BURNING_VOTES,
description: LABELS.PLEASE_WAIT,
type: 'warn',
});
try {
let tx = await sendTransaction(
connection,
wallet,
instructions,
signers,
true,
);
notify({
message: LABELS.VOTES_BURNED,
type: 'success',
description: LABELS.TRANSACTION + ` ${tx}`,
});
} catch (ex) {
console.error(ex);
throw new Error();
}
};

View File

@ -12,7 +12,11 @@ import {
actions,
} from '@oyster/common';
import { TimelockSet, TimelockState } from '../models/timelock';
import {
TimelockSet,
TimelockState,
TimelockStateStatus,
} from '../models/timelock';
import { AccountLayout } from '@solana/spl-token';
import { withdrawVotingTokensInstruction } from '../models/withdrawVotingTokens';
import { LABELS } from '../constants';
@ -75,7 +79,7 @@ export const withdrawVotingTokens = async (
}
const [mintAuthority] = await PublicKey.findProgramAddress(
[PROGRAM_IDS.timelock.programAccountId.toBuffer()],
[proposal.pubkey.toBuffer()],
PROGRAM_IDS.timelock.programId,
);
@ -89,25 +93,31 @@ export const withdrawVotingTokens = async (
votingTokenAmount,
);
const yesTransferAuthority = approve(
approve(
instructions,
[],
existingYesVoteAccount,
wallet.publicKey,
votingTokenAmount,
undefined,
undefined,
transferAuthority,
);
const noTransferAuthority = approve(
approve(
instructions,
[],
existingNoVoteAccount,
wallet.publicKey,
votingTokenAmount,
undefined,
undefined,
transferAuthority,
);
const [governanceVotingRecord] = await PublicKey.findProgramAddress(
[
PROGRAM_IDS.timelock.programAccountId.toBuffer(),
PROGRAM_IDS.timelock.programId.toBuffer(),
proposal.pubkey.toBuffer(),
existingVoteAccount.toBuffer(),
],
@ -115,8 +125,6 @@ export const withdrawVotingTokens = async (
);
signers.push(transferAuthority);
signers.push(yesTransferAuthority);
signers.push(noTransferAuthority);
instructions.push(
withdrawVotingTokensInstruction(
@ -134,15 +142,18 @@ export const withdrawVotingTokens = async (
state.pubkey,
proposal.pubkey,
transferAuthority.publicKey,
yesTransferAuthority.publicKey,
noTransferAuthority.publicKey,
mintAuthority,
votingTokenAmount,
),
);
const [msg, completedMsg] =
state.info.status === TimelockStateStatus.Voting
? [LABELS.WITHDRAWING_YOUR_VOTE, LABELS.VOTE_WITHDRAWN]
: [LABELS.REFUNDING_YOUR_TOKENS, LABELS.TOKENS_REFUNDED];
notify({
message: LABELS.WITHDRAWING_VOTING_TOKENS,
message: msg,
description: LABELS.PLEASE_WAIT,
type: 'warn',
});
@ -157,7 +168,7 @@ export const withdrawVotingTokens = async (
);
notify({
message: LABELS.TOKENS_WITHDRAWN,
message: completedMsg,
type: 'success',
description: LABELS.TRANSACTION + ` ${tx}`,
});

View File

@ -1,106 +0,0 @@
import { ParsedAccount } from '@oyster/common';
import { Button, Col, Modal, Row, Slider } from 'antd';
import React, { useState } from 'react';
import {
TimelockConfig,
TimelockSet,
TimelockState,
TimelockStateStatus,
VotingEntryRule,
} from '../../models/timelock';
import { LABELS } from '../../constants';
import { depositSourceTokens } from '../../actions/depositSourceTokens';
import { contexts, hooks } from '@oyster/common';
import { ExclamationCircleOutlined } from '@ant-design/icons';
const { useWallet } = contexts.Wallet;
const { useConnection } = contexts.Connection;
const { useAccountByMint } = hooks;
const { confirm } = Modal;
export function RegisterToVote({
proposal,
state,
timelockConfig,
}: {
proposal: ParsedAccount<TimelockSet>;
state: ParsedAccount<TimelockState>;
timelockConfig: ParsedAccount<TimelockConfig>;
}) {
const wallet = useWallet();
const connection = useConnection();
const voteAccount = useAccountByMint(proposal.info.votingMint);
const yesVoteAccount = useAccountByMint(proposal.info.yesVotingMint);
const noVoteAccount = useAccountByMint(proposal.info.noVotingMint);
const userTokenAccount = useAccountByMint(proposal.info.sourceMint);
const alreadyHaveTokens =
(voteAccount && voteAccount.info.amount.toNumber() > 0) ||
(yesVoteAccount && yesVoteAccount.info.amount.toNumber() > 0) ||
(noVoteAccount && noVoteAccount.info.amount.toNumber() > 0);
const eligibleToView =
timelockConfig.info.votingEntryRule == VotingEntryRule.Anytime &&
[TimelockStateStatus.Draft, TimelockStateStatus.Voting].includes(
state.info.status,
);
const [_, setTokenAmount] = useState(1);
return eligibleToView ? (
<Button
type="primary"
onClick={() =>
confirm({
title: 'Confirm',
icon: <ExclamationCircleOutlined />,
content: (
<Row>
<Col span={24}>
<p>
You can convert up to{' '}
{userTokenAccount?.info.amount.toNumber() || 0} tokens to
voting tokens to vote on this proposal. You can refund these
at any time.
</p>
{userTokenAccount?.info.amount.toNumber() && (
<Slider
min={1}
max={userTokenAccount?.info.amount.toNumber() || 0}
onChange={setTokenAmount}
/>
)}
</Col>
</Row>
),
okText: LABELS.CONFIRM,
cancelText: LABELS.CANCEL,
onOk: async () => {
if (userTokenAccount) {
// tokenAmount is out of date in this scope, so we use a trick to get it here.
const valueHolder = { value: 0 };
await setTokenAmount(amount => {
valueHolder.value = amount;
return amount;
});
await depositSourceTokens(
connection,
wallet.wallet,
proposal,
voteAccount?.pubkey,
yesVoteAccount?.pubkey,
noVoteAccount?.pubkey,
userTokenAccount.pubkey,
valueHolder.value,
);
// reset
setTokenAmount(1);
}
},
})
}
>
{alreadyHaveTokens ? LABELS.ADD_MORE_VOTES : LABELS.REGISTER_TO_VOTE}
</Button>
) : null;
}

View File

@ -1,6 +1,6 @@
import { ParsedAccount } from '@oyster/common';
import { Button, Col, Modal, Row, Slider, Switch } from 'antd';
import React, { useState } from 'react';
import { Button, Col, Modal, Row } from 'antd';
import React from 'react';
import {
TimelockConfig,
TimelockSet,
@ -8,13 +8,11 @@ import {
TimelockStateStatus,
} from '../../models/timelock';
import { LABELS } from '../../constants';
import { vote } from '../../actions/vote';
import { depositSourceTokensAndVote } from '../../actions/depositSourceTokensAndVote';
import { contexts, hooks } from '@oyster/common';
import {
CheckOutlined,
CloseOutlined,
ExclamationCircleOutlined,
} from '@ant-design/icons';
import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
import './style.less';
const { useWallet } = contexts.Wallet;
const { useConnection } = contexts.Connection;
@ -25,87 +23,84 @@ export function Vote({
proposal,
state,
timelockConfig,
yeahVote,
}: {
proposal: ParsedAccount<TimelockSet>;
state: ParsedAccount<TimelockState>;
timelockConfig: ParsedAccount<TimelockConfig>;
yeahVote: boolean;
}) {
const wallet = useWallet();
const connection = useConnection();
const voteAccount = useAccountByMint(proposal.info.votingMint);
const yesVoteAccount = useAccountByMint(proposal.info.yesVotingMint);
const noVoteAccount = useAccountByMint(proposal.info.noVotingMint);
const [mode, setMode] = useState(true);
const [_, setTokenAmount] = useState(1);
const userTokenAccount = useAccountByMint(proposal.info.sourceMint);
const eligibleToView =
voteAccount &&
voteAccount.info.amount.toNumber() > 0 &&
userTokenAccount &&
userTokenAccount.info.amount.toNumber() > 0 &&
state.info.status === TimelockStateStatus.Voting;
const [btnLabel, title, msg, icon] = yeahVote
? [
LABELS.VOTE_YEAH,
LABELS.VOTE_YEAH_QUESTION,
LABELS.VOTE_YEAH_MSG,
<CheckOutlined />,
]
: [
LABELS.VOTE_NAY,
LABELS.VOTE_NAY_QUESTION,
LABELS.VOTE_NAY_MSG,
<CloseOutlined />,
];
return eligibleToView ? (
<Button
type="primary"
icon={icon}
onClick={() =>
confirm({
title: 'Confirm',
icon: <ExclamationCircleOutlined />,
title: title,
icon: icon,
content: (
<Row>
<Col span={24}>
<p>
Burning your {voteAccount?.info.amount.toNumber()} tokens is
an irreversible action. Choose how many to burn in favor OR
against this proposal. Use the switch to indicate preference.
</p>
<Slider
min={1}
max={voteAccount?.info.amount.toNumber()}
onChange={setTokenAmount}
/>
<Switch
checkedChildren={<CheckOutlined />}
unCheckedChildren={<CloseOutlined />}
defaultChecked
onChange={setMode}
/>
<p>{msg}</p>
</Col>
</Row>
),
okText: LABELS.CONFIRM,
cancelText: LABELS.CANCEL,
onOk: async () => {
if (voteAccount && yesVoteAccount && noVoteAccount) {
// tokenAmount and mode is out of date in this scope, so we use a trick to get it here.
const valueHolder = { value: 0, mode: true };
await setTokenAmount(amount => {
valueHolder.value = amount;
return amount;
});
await setMode(mode => {
valueHolder.mode = mode;
return mode;
});
const yesTokenAmount = valueHolder.mode ? valueHolder.value : 0;
const noTokenAmount = !valueHolder.mode ? valueHolder.value : 0;
await vote(
if (userTokenAccount) {
const voteAmount = userTokenAccount.info.amount.toNumber();
const yesTokenAmount = yeahVote ? voteAmount : 0;
const noTokenAmount = !yeahVote ? voteAmount : 0;
await depositSourceTokensAndVote(
connection,
wallet.wallet,
proposal,
voteAccount?.pubkey,
yesVoteAccount?.pubkey,
noVoteAccount?.pubkey,
userTokenAccount.pubkey,
timelockConfig,
state,
voteAccount.pubkey,
yesVoteAccount.pubkey,
noVoteAccount.pubkey,
yesTokenAmount,
noTokenAmount,
);
// reset
setTokenAmount(1);
}
},
})
}
>
{LABELS.VOTE}
{btnLabel}
</Button>
) : null;
}

View File

@ -1,6 +1,6 @@
import { ParsedAccount } from '@oyster/common';
import { Button, Col, Modal, Row, Slider } from 'antd';
import React, { useState } from 'react';
import { Button, Col, Modal, Row } from 'antd';
import React from 'react';
import {
TimelockConfig,
TimelockSet,
@ -17,9 +17,8 @@ const { useConnection } = contexts.Connection;
const { useAccountByMint } = hooks;
const { confirm } = Modal;
export function WithdrawTokens({
export function WithdrawVote({
proposal,
timelockConfig,
state,
}: {
proposal: ParsedAccount<TimelockSet>;
@ -33,45 +32,53 @@ export function WithdrawTokens({
const noVoteAccount = useAccountByMint(proposal.info.noVotingMint);
const userAccount = useAccountByMint(proposal.info.sourceMint);
const votingTokens =
(voteAccount && voteAccount.info.amount.toNumber()) ||
0 +
((yesVoteAccount && yesVoteAccount.info.amount.toNumber()) || 0) +
((noVoteAccount && noVoteAccount.info.amount.toNumber()) || 0);
let additionalMsg =
state.info.status !== TimelockStateStatus.Voting
? ''
: LABELS.ADDITIONAL_VOTING_MSG;
const [_, setTokenAmount] = useState(1);
return votingTokens > 0 ? (
const eligibleToView =
votingTokens > 0 &&
(state.info.status === TimelockStateStatus.Voting ||
state.info.status === TimelockStateStatus.Completed ||
state.info.status === TimelockStateStatus.Executing ||
state.info.status === TimelockStateStatus.Defeated);
const [btnLabel, title, msg, action] =
state.info.status === TimelockStateStatus.Voting
? [
LABELS.WITHDRAW_VOTE,
LABELS.WITHDRAW_YOUR_VOTE_QUESTION,
LABELS.WITHDRAW_YOUR_VOTE_MSG,
LABELS.WITHDRAW,
]
: [
LABELS.REFUND_TOKENS,
LABELS.REFUND_YOUR_TOKENS_QUESTION,
LABELS.REFUND_YOUR_TOKENS_MSG,
LABELS.REFUND,
];
return eligibleToView ? (
<Button
type="primary"
onClick={() =>
confirm({
title: 'Confirm',
title: title,
icon: <ExclamationCircleOutlined />,
content: (
<Row>
<Col span={24}>
<p>You can withdraw up to {votingTokens} voting tokens. </p>
{additionalMsg && <p>{additionalMsg}</p>}
<Slider min={1} max={votingTokens} onChange={setTokenAmount} />
<p>{msg}</p>
</Col>
</Row>
),
okText: LABELS.CONFIRM,
okText: action,
cancelText: LABELS.CANCEL,
onOk: async () => {
if (userAccount) {
// tokenAmount is out of date in this scope, so we use a trick to get it here.
const valueHolder = { value: 0 };
await setTokenAmount(amount => {
valueHolder.value = amount;
return amount;
});
await withdrawVotingTokens(
connection,
wallet.wallet,
@ -81,16 +88,14 @@ export function WithdrawTokens({
yesVoteAccount?.pubkey,
noVoteAccount?.pubkey,
userAccount.pubkey,
valueHolder.value,
votingTokens,
);
// reset
setTokenAmount(1);
}
},
})
}
>
{LABELS.REFUND_TOKENS}
{btnLabel}
</Button>
) : null;
}

View File

@ -5,3 +5,13 @@
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* IE */
}
.vote-radio-group {
width: 100%;
user-select: none;
padding: 10px;
.ant-radio-button-wrapper {
width: 50%;
text-align: center;
}
}

View File

@ -39,8 +39,7 @@ export const LABELS = {
ADD: 'Add',
REMOVE: 'Remove',
ADDING_OR_REMOVING: 'Type',
ADDING_VOTES_TO_VOTER: 'Converting governance tokens to voting tokens',
VOTES_ADDED: 'Governance tokens converted.',
ADDING_GOVERNANCE_TOKENS: 'Adding governance tokens',
PLEASE_WAIT: 'Please wait...',
GOVERNANCE_TOKENS_ADDED: 'Governance tokens added.',
@ -61,18 +60,44 @@ export const LABELS = {
ADD_GOVERNANCE_TOKENS: 'Add Governance Tokens',
ADD_COUNCIL_TOKENS: 'Add Council Tokens',
ACTIONS: 'Actions',
BURNING_VOTES: 'Burning your votes...',
VOTES_BURNED: 'Votes burned',
VOTE: 'Vote',
VOTE_YEAH: 'Yeah',
VOTE_YEAH_QUESTION: 'Vote Yeah?',
VOTE_YEAH_MSG: 'Vote in favour of the proposal.',
VOTING_YEAH: 'Voting for the proposal',
VOTED_YEAH: 'Voted for the proposal',
VOTE_NAY: 'Nay',
VOTE_NAY_QUESTION: 'Vote Nay?',
VOTE_NAY_MSG: 'Vote against the proposal.',
VOTING_NAY: 'Voting against the proposal',
VOTED_NAY: 'Voted against the proposal',
TOKENS_VOTED_FOR_THE_PROPOSAL: 'tokens voted for the proposal',
TOKENS_VOTED_AGAINST_THE_PROPOSAL: 'tokens voted against the proposal',
EXECUTING: 'Executing...',
EXECUTED: 'Executed.',
WITHDRAWING_VOTING_TOKENS: 'Refunding voting tokens as Source Tokens',
TOKENS_WITHDRAWN: 'Voting tokens refunded as Source Tokens',
REGISTER_TO_VOTE: 'Register to Vote',
CONFIRM: 'Confirm',
CANCEL: 'Cancel',
ADD_MORE_VOTES: 'Add More Votes',
WITHDRAW_VOTE: 'Withdraw My Vote',
WITHDRAW_YOUR_VOTE_QUESTION: 'Withdraw your vote?',
WITHDRAW_YOUR_VOTE_MSG:
'Once you withdraw your vote it wont count towards the proposal voting outcome.',
WITHDRAW: 'Withdraw',
WITHDRAWING_YOUR_VOTE: 'Withdrawing your vote',
VOTE_WITHDRAWN: 'Your vote has been withdrawn',
REFUND_TOKENS: 'Refund My Tokens',
REFUND_YOUR_TOKENS_QUESTION: 'Refund your tokens?',
REFUND_YOUR_TOKENS_MSG:
'The proposal has been voted. Refunding your tokens wont change the outcome.',
REFUND: 'Refund',
REFUNDING_YOUR_TOKENS: 'Refunding your tokens',
TOKENS_REFUNDED: 'Your voting tokens have been refunded',
REGISTER_GOVERNANCE: 'Register',
PROGRAM: 'Program ID',
GOVERNANCE: 'Governance Token Holders',
@ -102,8 +127,16 @@ export const LABELS = {
SLOT_MUST_BE_NUMERIC: 'Slot can only be numeric',
SLOT_MUST_BE_GREATER_THAN: 'Slot must be greater than or equal to ',
DELAY: 'Slot Delay',
MIN_SLOT_MUST_BE_NUMERIC: 'Minimum Slot Waiting Period can only be numeric',
TIME_LIMIT_MUST_BE_NUMERIC: 'Time Limit can only be numeric',
PROGRAM_ID_IS_NOT_A_VALID_PUBLIC_KEY: (programId: string) =>
`Program ID: '${programId}' is not a valid public key`,
GOVERNANCE_MINT_IS_NOT_A_VALID_PUBLIC_KEY: (programId: string) =>
`Governance Mint ID: '${programId}' is not a valid public key`,
COUNCIL_MINT_IS_NOT_A_VALID_PUBLIC_KEY: (programId: string) =>
`Council Mint ID: '${programId}' is not a valid public key`,
TIME_LIMIT: 'Voting Time Limit',
THIS_CONFIG_LACKS_COUNCIL: 'This program does not have a council.',
GIT_CONTENT_EXCEEDED:

Some files were not shown because too many files have changed in this diff Show More